GCC Code Coverage Report


Directory: ./
File: Svc/RateGroupDriver/RateGroupDriver.hpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /**
2 * \author T. Canham
3 * \brief RateGroupDivider component implementation
4 *
5 * This component implements a divider function. A primary tick is invoked
6 * via the CycleIn port. The divider array then divides down the tick into
7 * CycleOut ports. The ports are called at the rate of
8 * input rate/divider[port]
9 *
10 * \copyright
11 * Copyright 2009-2015, by the California Institute of Technology.
12 * ALL RIGHTS RESERVED. United States Government Sponsorship
13 * acknowledged.
14 * <br /><br />
15 */
16
17 #ifndef SVC_RATEGROUPDRIVER_HPP
18 #define SVC_RATEGROUPDRIVER_HPP
19
20 #include <Fw/FPrimeBasicTypes.hpp>
21 #include <Svc/RateGroupDriver/RateGroupDriverComponentAc.hpp>
22
23 namespace Svc {
24
25 //! \class RateGroupDriver
26 //! \brief Implementation class for RateGroupDriver
27 //!
28 //! Takes the input from CycleIn and divides it.
29 //! Output rate is CycleIn rate/divider[port]
30 //!
31
32 class RateGroupDriver final : public RateGroupDriverComponentBase {
33 friend class RateGroupDriverImplTester;
34
35 public:
36 //! Size of the divider table, provided as a constants to users passing the table in
37 static const FwIndexType DIVIDER_SIZE = NUM_CYCLEOUT_OUTPUT_PORTS;
38
39 //! \class Divider
40 //! \brief Struct describing a divider
41 struct Divider {
42 //! Initializes divisor and offset to 0 (unused)
43 constexpr Divider() : divisor(0), offset(0) {}
44 //! Initializes divisor and offset to passed-in pair
45 9 constexpr Divider(FwSizeType divisorIn, FwSizeType offsetIn) : divisor(divisorIn), offset(offsetIn) {}
46 //! Divisor
47 FwSizeType divisor;
48 //! Offset
49 FwSizeType offset;
50 };
51
52 //! \class DividerSet
53 //! \brief Struct containing an array of dividers
54 struct DividerSet {
55 //! Dividers
56 Divider dividers[Svc::RateGroupDriver::DIVIDER_SIZE];
57 };
58
59 //! \brief RateGroupDriver constructor
60 //!
61 //! The constructor takes the divider array and stores it
62 //! for use when the CycleIn port is called.
63 //!
64 //! \param compName component name
65 //!
66 RateGroupDriver(const char* compName);
67
68 //! \brief RateGroupDriver configuration function
69 //! \param dividersSet set of dividers used to divide down input tick
70
71 void configure(const DividerSet& dividersSet);
72
73 //! \brief RateGroupDriverImpl destructor
74
75 ~RateGroupDriver();
76
77 private:
78 //! downcall for input port
79 //! NOTE: This port can execute in ISR context.
80 void CycleIn_handler(FwIndexType portNum, Os::RawTime& cycleStart);
81
82 //! divider array
83 Divider m_dividers[NUM_CYCLEOUT_OUTPUT_PORTS];
84
85 //! tick counter
86 FwSizeType m_ticks;
87
88 //! rollover counter
89 FwSizeType m_rollover;
90
91 //! has the configure method been called
92 bool m_configured;
93 };
94
95 } // namespace Svc
96
97 #endif
98