1 /* ########################## Generic Physical Timer functions ############################ */
3 \defgroup PL1_timer_functions Generic Physical Timer Functions
4 \ingroup CMSIS_Core_FunctionInterface
5 \brief Generic Physical Timer Functions allow to control privilege level 1 physical timer registers on Generic Timer for Cortex-A7 class devices.\n
6 Reference: <a href="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464f/index.html">Cortex-A7 MPCore Technical Reference Manual</a>.
10 /** \brief Physical Timer Control register */
15 uint32_t ENABLE:1; /*!< \brief bit: 0 Enables the timer. */
16 uint32_t IMASK:1; /*!< \brief bit: 1 Timer output signal mask bit. */
17 uint32_t ISTATUS:1; /*!< \brief bit: 2 The status of the timer. */
18 uint32_t _reserved0:29; /*!< \brief bit: 3..31 Reserved */
19 } b; /*!< \brief Structure used for bit access */
20 uint32_t w; /*!< \brief Type used for word access */
25 * Configures the frequency the timer shall run at.
27 __STATIC_INLINE void PL1_SetCounterFrequency(uint32_t value);
31 * Sets the reset value of the timer.
33 __STATIC_INLINE void PL1_SetLoadValue(uint32_t value);
35 /** Get the current counter value.
36 * \return Current counter value.
38 __STATIC_INLINE uint32_t PL1_GetCurrentValue();
40 /** \brief Get the current physical counter value.
41 * \return Current physical counter value.
43 __STATIC_INLINE uint64_t PL1_GetCurrentPhysicalValue(void);
45 /** \brief Set the physical compare value.
46 * \param [in] value New physical timer compare value.
48 __STATIC_INLINE void PL1_SetPhysicalCompareValue(uint64_t value);
50 /** \brief Get the physical compare value.
51 * \return Physical compare value.
53 __STATIC_INLINE uint64_t PL1_GetPhysicalCompareValue(void);
57 * Configure the timer by setting the control value.
59 __STATIC_INLINE void PL1_SetControl(uint32_t value);
61 /** Get the timer control value.
62 * \return \ref CNTP_CTL_Type Timer control value.
64 __STATIC_INLINE uint32_t PL1_GetControl();
68 /* ########################## Private Timer functions ############################ */
70 \defgroup PTM_timer_functions Private Timer Functions
71 \ingroup CMSIS_Core_FunctionInterface
72 \brief Private Timer Functions controls private timer registers present on Cortex-A5 and A9 class devices.\n
73 References: <a href="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0434c/index.html">Cortex-A5 MPCore Technical Reference Manual</a>,
74 <a href="http://infocenter.arm.com/help/topic/com.arm.doc.100486_0401_10_en/index.html">Cortex-A9 MPCore Technical Reference Manual</a>.
79 \fn __STATIC_INLINE void PTIM_SetLoadValue(uint32_t value)
80 \fn __STATIC_INLINE uint32_t PTIM_GetLoadValue()
81 \fn __STATIC_INLINE uint32_t PTIM_GetCurrentValue()
82 \fn __STATIC_INLINE void PTIM_SetControl(uint32_t value)
83 \fn __STATIC_INLINE uint32_t PTIM_GetControl(void)
84 \fn __STATIC_INLINE void PTIM_ClearEventFlag(void)
88 /* ########################## Timer_Type Members ########################## */
90 \var __IOM uint32_t Timer_Type::LOAD
91 \details Private Timer Load Register
92 The Timer Load Register contains the value copied to the Timer Counter Register when
93 it decrements down to zero with auto reload mode enabled. Writing to the Timer Load
94 Register means that you also write to the Timer Counter Register.
96 \var __IOM uint32_t Timer_Type::COUNTER
97 \details Private Timer Counter Register
98 The Timer Counter Register is a decrementing counter.
100 The Timer Counter Register decrements if the timer is enabled using the timer enable bit in the Timer Control Register.
102 When the Timer Counter Register reaches zero and auto reload mode is enabled, it
103 reloads the value in the Timer Load Register and then decrements from that value. If
104 auto reload mode is not enabled, the Timer Counter Register decrements down to zero
107 When the Timer Counter Register reaches zero, the timer interrupt status event flag is
108 set and the interrupt ID 29 is set as pending in the Interrupt Distributor, if interrupt
109 generation is enabled in the Timer Control Register.
111 Writing to the Timer Counter Register or Timer Load Register forces the Timer Counter
112 Register to decrement from the newly written value.
114 \var __IOM uint32_t Timer_Type::CONTROL
115 \details Private Timer Control Register
117 | Bits | Name | Function |
118 | :------ | :------------ | :------------------------------------------------------------- |
119 | [31:16] | - | Reserved. |
120 | [15:8] | Prescaler | The prescaler modifies the clock period for the decrementing event for the Counter Register. |
121 | [7:3] | - | Reserved. |
122 | [2] | IRQ Enable | If set, the interrupt is set as pending in the Interrupt Distributor when the event flag is set in the Timer Status Register. |
123 | [1] | Auto Reload | If set, each time the Counter Register reaches zero, it is reloaded with the value contained in the Timer Load Register. |
124 | [0] | Time Enabled | If set, Timer is enabled and the counter decrements normally. |
126 \var __IM uint32_t Timer_Type::ISR
127 \details Private Timer Interrupt Status Register
129 The event flag is a sticky bit that is automatically set when the Counter Register reaches
130 zero. If the timer interrupt is enabled, Interrupt ID 29 is set as pending in the Interrupt
131 Distributor after the event flag is set. The event flag is cleared when written to 1.
133 \var __IOM uint32_t Timer_Type::WLOAD
134 \details Watchdog Load Register
136 The Watchdog Load Register contains the value copied to the Watchdog Counter
137 Register when it decrements down to zero with auto reload mode enabled, in Timer
138 mode. Writing to the Watchdog Load Register means that you also write to the
139 Watchdog Counter Register.
141 \var __IOM uint32_t Timer_Type::WCOUNTER
142 \details Watchdog Counter Register
144 The Watchdog Counter Register is a down counter.
146 The behavior of the watchdog when the Watchdog Counter Register reaches zero
147 depends on its current mode:
148 - Timer mode: The watchdog interrupt status event flag is set and the interrupt
149 is set as pending in the Interrupt Distributor.
150 - Watchdog mode: Tthe Watchdog reset status flag is set and the associated WDRESETREQ
151 reset request output pin is asserted.
153 \var __IOM uint32_t Timer_Type::WCONTROL
154 \details Watchdog Control Register
156 | Bits | Name | Function |
157 | :------ | :-------------- | :------------------------------------------------------------- |
158 | [31:16] | - | Reserved. |
159 | [15:8] | Prescaler | The prescaler modifies the clock period for the decrementing event for the Counter Register. |
160 | [7:4] | - | Reserved. |
161 | [3] | Watchdog Mode | 0 - Timer mode (default), 1 - Watchdog mode |
162 | [2] | IT Enable | Interrupt enable for timer mode. |
163 | [1] | Auto Reload | 0 - Single shot mode, 1 - Continuous timer mode |
164 | [0] | Watchdog Enable | 0 - Watchdog counter disabled, 1 - Watchdog timer enabled |
166 \var __IOM uint32_t Timer_Type::WISR
167 \details Watchdog Interrupt Status Register
169 | Bits | Name | Function |
170 | :------ | :-------------- | :------------------------------------------------------------- |
171 | [31:1] | - | Reserved. |
172 | [0] | Event Flag | The event flag is a sticky bit that is automatically set when the Counter Register reaches zero in timer mode. |
174 \var __IOM uint32_t Timer_Type::WRESET
175 \details Watchdog Reset Status Register
177 | Bits | Name | Function |
178 | :------ | :-------------- | :------------------------------------------------------------- |
179 | [31:1] | - | Reserved. |
180 | [0] | Reset Flag | The reset flag is a sticky bit that is automatically set when the Counter Register reaches zero and a reset request is sent accordingly. (In watchdog mode) |
182 \var __IM uint32_t Timer_Type::WDISABLE
183 \details Watchdog Disable Register
185 Use the Watchdog Disable Register to switch from watchdog to timer mode. The
186 software must write 0x12345678 then 0x87654321 successively to the Watchdog Disable
187 Register so that the watchdog mode bit in the Watchdog Control Register is set to zero.
190 /* ########################## Private Timer Member ########################## */
193 \var uint32_t CNTP_CTL_Type::ENABLE
194 \details Enables the timer.
196 Permitted values are:
197 - 0 - Timer disabled.
200 \var uint32_t CNTP_CTL_Type::IMASK
201 \details Timer output signal mask bit.
203 Permitted values are:
204 - 0 - Timer output signal is not masked.
205 - 1 - Timer output signal is masked.
208 \var uint32_t CNTP_CTL_Type::ISTATUS
209 \details The status of the timer.
211 This bit indicates whether the timer condition is asserted:
212 - 0 - Timer condition is not asserted.
213 - 1 - Timer condition is asserted.