]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core_A/src/Ref_Timer.txt
Doc link fixes
[cmsis] / CMSIS / DoxyGen / Core_A / src / Ref_Timer.txt
1 /* ##########################  Generic Physical Timer functions  ############################ */
2 /**
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>.
7 */
8 /** @{ */
9
10 /** \brief Physical Timer Control register */
11 typedef union
12 {
13   struct
14   {
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 */
21 } CNTP_CTL_Type;
22
23 /**
24 * \details
25 *  Configures the frequency the timer shall run at.
26 */
27 __STATIC_INLINE void PL1_SetCounterFrequency(uint32_t value);
28
29 /**
30 * \details 
31 * Sets the reset value of the timer.
32 */
33 __STATIC_INLINE void PL1_SetLoadValue(uint32_t value);
34
35 /** Get the current counter value.
36 * \return Current counter value.
37 */
38 __STATIC_INLINE uint32_t PL1_GetCurrentValue();
39
40 /** \brief Get the current physical counter value.
41 * \return Current physical counter value.
42 */
43 __STATIC_INLINE uint64_t PL1_GetCurrentPhysicalValue(void);
44
45 /** \brief Set the physical compare value.
46 * \param [in] value New physical timer compare value.
47 */
48 __STATIC_INLINE void PL1_SetPhysicalCompareValue(uint64_t value);
49
50 /** \brief Get the physical compare value.
51 * \return Physical compare value.
52 */
53 __STATIC_INLINE uint64_t PL1_GetPhysicalCompareValue(void);
54
55 /** 
56 * \details
57 *  Configure the timer by setting the control value.
58 */
59 __STATIC_INLINE void PL1_SetControl(uint32_t value);
60
61 /** Get the timer control value.
62 * \return \ref CNTP_CTL_Type Timer control value.
63 */
64 __STATIC_INLINE uint32_t PL1_GetControl();
65
66 /** @} */
67
68 /* ##########################  Private Timer functions  ############################ */
69 /**
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>.
75
76 @{
77 \struct Timer_Type
78 \def PTIM
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)
85 @}
86 */
87
88 /* ########################## Timer_Type Members ########################## */
89 /**
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.
95
96 \var __IOM uint32_t Timer_Type::COUNTER
97 \details Private Timer Counter Register
98 The Timer Counter Register is a decrementing counter.
99
100 The Timer Counter Register decrements if the timer is enabled using the timer enable bit in the Timer Control Register.
101
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
105 and stops.
106
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.
110
111 Writing to the Timer Counter Register or Timer Load Register forces the Timer Counter
112 Register to decrement from the newly written value.
113
114 \var __IOM uint32_t Timer_Type::CONTROL
115 \details Private Timer Control Register
116
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. |
125
126 \var __IM uint32_t Timer_Type::ISR
127 \details Private Timer Interrupt Status Register
128
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.
132
133 \var __IOM uint32_t Timer_Type::WLOAD
134 \details Watchdog Load Register
135
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.
140
141 \var __IOM uint32_t Timer_Type::WCOUNTER
142 \details Watchdog Counter Register
143
144 The Watchdog Counter Register is a down counter.
145
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.
152
153 \var __IOM uint32_t Timer_Type::WCONTROL
154 \details Watchdog Control Register
155
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      |
165
166 \var __IOM uint32_t Timer_Type::WISR
167 \details Watchdog Interrupt Status Register
168
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. |
173
174 \var __IOM uint32_t Timer_Type::WRESET
175 \details Watchdog Reset Status Register
176
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) | 
181
182 \var __IM uint32_t Timer_Type::WDISABLE
183 \details Watchdog Disable Register
184
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.
188 */
189
190 /* ########################## Private Timer Member ########################## */
191 /**
192
193 \var uint32_t CNTP_CTL_Type::ENABLE
194 \details Enables the timer.
195
196 Permitted values are:
197  - 0 - Timer disabled.
198  - 1 - Timer enabled.
199
200 \var uint32_t CNTP_CTL_Type::IMASK
201 \details Timer output signal mask bit. 
202
203 Permitted values are:
204  - 0 - Timer output signal is not masked.
205  - 1 - Timer output signal is masked.
206
207
208 \var uint32_t CNTP_CTL_Type::ISTATUS
209 \details The status of the timer.
210
211 This bit indicates whether the timer condition is asserted:
212  - 0 - Timer condition is not asserted.
213  - 1 - Timer condition is asserted.
214 */