1 /**************************************************************************//**
2 * @file timer.h
3 * @version V1.00
4 * @brief M480 series Timer Controller(Timer) driver header file
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 * @copyright (C) 2016-2020 Nuvoton Technology Corp. All rights reserved.
8 *****************************************************************************/
9 #ifndef __TIMER_H__
10 #define __TIMER_H__
11
12 #ifdef __cplusplus
13 extern "C"
14 {
15 #endif
16
17
18 /** @addtogroup Standard_Driver Standard Driver
19 @{
20 */
21
22 /** @addtogroup TIMER_Driver TIMER Driver
23 @{
24 */
25
26 /** @addtogroup TIMER_EXPORTED_CONSTANTS TIMER Exported Constants
27 @{
28 */
29 /*---------------------------------------------------------------------------------------------------------*/
30 /* TIMER Operation Mode, External Counter and Capture Mode Constant Definitions */
31 /*---------------------------------------------------------------------------------------------------------*/
32 #define TIMER_ONESHOT_MODE (0UL << TIMER_CTL_OPMODE_Pos) /*!< Timer working in one-shot mode \hideinitializer */
33 #define TIMER_PERIODIC_MODE (1UL << TIMER_CTL_OPMODE_Pos) /*!< Timer working in periodic mode \hideinitializer */
34 #define TIMER_TOGGLE_MODE (2UL << TIMER_CTL_OPMODE_Pos) /*!< Timer working in toggle-output mode \hideinitializer */
35 #define TIMER_CONTINUOUS_MODE (3UL << TIMER_CTL_OPMODE_Pos) /*!< Timer working in continuous counting mode \hideinitializer */
36 #define TIMER_TOUT_PIN_FROM_TMX (0UL << TIMER_CTL_TGLPINSEL_Pos) /*!< Timer toggle-output pin is from TMx pin \hideinitializer */
37 #define TIMER_TOUT_PIN_FROM_TMX_EXT (1UL << TIMER_CTL_TGLPINSEL_Pos) /*!< Timer toggle-output pin is from TMx_EXT pin \hideinitializer */
38
39 #define TIMER_COUNTER_EVENT_FALLING (0UL << TIMER_EXTCTL_CNTPHASE_Pos) /*!< Counter increase on falling edge detection \hideinitializer */
40 #define TIMER_COUNTER_EVENT_RISING (1UL << TIMER_EXTCTL_CNTPHASE_Pos) /*!< Counter increase on rising edge detection \hideinitializer */
41 #define TIMER_CAPTURE_FREE_COUNTING_MODE (0UL << TIMER_EXTCTL_CAPFUNCS_Pos) /*!< Timer capture event to get timer counter value \hideinitializer */
42 #define TIMER_CAPTURE_COUNTER_RESET_MODE (1UL << TIMER_EXTCTL_CAPFUNCS_Pos) /*!< Timer capture event to reset timer counter \hideinitializer */
43
44 #define TIMER_CAPTURE_EVENT_FALLING (0UL << TIMER_EXTCTL_CAPEDGE_Pos) /*!< Falling edge detection to trigger capture event \hideinitializer */
45 #define TIMER_CAPTURE_EVENT_RISING (1UL << TIMER_EXTCTL_CAPEDGE_Pos) /*!< Rising edge detection to trigger capture event \hideinitializer */
46 #define TIMER_CAPTURE_EVENT_FALLING_RISING (2UL << TIMER_EXTCTL_CAPEDGE_Pos) /*!< Both falling and rising edge detection to trigger capture event, and first event at falling edge \hideinitializer */
47 #define TIMER_CAPTURE_EVENT_RISING_FALLING (3UL << TIMER_EXTCTL_CAPEDGE_Pos) /*!< Both rising and falling edge detection to trigger capture event, and first event at rising edge \hideinitializer */
48 #define TIMER_CAPTURE_EVENT_GET_LOW_PERIOD (6UL << TIMER_EXTCTL_CAPEDGE_Pos) /*!< First capture event is at falling edge, follows are at at rising edge \hideinitializer */
49 #define TIMER_CAPTURE_EVENT_GET_HIGH_PERIOD (7UL << TIMER_EXTCTL_CAPEDGE_Pos) /*!< First capture event is at rising edge, follows are at at falling edge \hideinitializer */
50
51 #define TIMER_TRGSRC_TIMEOUT_EVENT (0UL << TIMER_TRGCTL_TRGSSEL_Pos) /*!< Select internal trigger source from timer time-out event \hideinitializer */
52 #define TIMER_TRGSRC_CAPTURE_EVENT (1UL << TIMER_TRGCTL_TRGSSEL_Pos) /*!< Select internal trigger source from timer capture event \hideinitializer */
53 #define TIMER_TRG_TO_EPWM (TIMER_TRGCTL_TRGEPWM_Msk) /*!< Each timer event as EPWM counter clock source \hideinitializer */
54 #define TIMER_TRG_TO_EADC (TIMER_TRGCTL_TRGEADC_Msk) /*!< Each timer event to start ADC conversion \hideinitializer */
55 #define TIMER_TRG_TO_DAC (TIMER_TRGCTL_TRGDAC_Msk) /*!< Each timer event to start DAC conversion \hideinitializer */
56 #define TIMER_TRG_TO_PDMA (TIMER_TRGCTL_TRGPDMA_Msk) /*!< Each timer event to trigger PDMA transfer \hideinitializer */
57
58 /*@}*/ /* end of group TIMER_EXPORTED_CONSTANTS */
59
60
61 /** @addtogroup TIMER_EXPORTED_FUNCTIONS TIMER Exported Functions
62 @{
63 */
64
65 /**
66 * @brief Set Timer Compared Value
67 *
68 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
69 * @param[in] u32Value Timer compare value. Valid values are between 2 to 0xFFFFFF.
70 *
71 * @return None
72 *
73 * @details This macro is used to set timer compared value to adjust timer time-out interval.
74 * @note 1. Never write 0x0 or 0x1 in this field, or the core will run into unknown state. \n
75 * 2. If update timer compared value in continuous counting mode, timer counter value will keep counting continuously. \n
76 * But if timer is operating at other modes, the timer up counter will restart counting and start from 0.
77 * \hideinitializer
78 */
79 #define TIMER_SET_CMP_VALUE(timer, u32Value) ((timer)->CMP = (u32Value))
80
81 /**
82 * @brief Set Timer Prescale Value
83 *
84 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
85 * @param[in] u32Value Timer prescale value. Valid values are between 0 to 0xFF.
86 *
87 * @return None
88 *
89 * @details This macro is used to set timer prescale value and timer source clock will be divided by (prescale + 1) \n
90 * before it is fed into timer.
91 * \hideinitializer
92 */
93 #define TIMER_SET_PRESCALE_VALUE(timer, u32Value) ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_PSC_Msk) | (u32Value))
94
95 /**
96 * @brief Check specify Timer Status
97 *
98 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
99 *
100 * @retval 0 Timer 24-bit up counter is inactive
101 * @retval 1 Timer 24-bit up counter is active
102 *
103 * @details This macro is used to check if specify Timer counter is inactive or active.
104 * \hideinitializer
105 */
106 #define TIMER_IS_ACTIVE(timer) (((timer)->CTL & TIMER_CTL_ACTSTS_Msk)? 1 : 0)
107
108 /**
109 * @brief Select Toggle-output Pin
110 *
111 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
112 * @param[in] u32ToutSel Toggle-output pin selection, valid values are:
113 * - \ref TIMER_TOUT_PIN_FROM_TMX
114 * - \ref TIMER_TOUT_PIN_FROM_TMX_EXT
115 *
116 * @return None
117 *
118 * @details This macro is used to select timer toggle-output pin is output on TMx or TMx_EXT pin.
119 * \hideinitializer
120 */
121 #define TIMER_SELECT_TOUT_PIN(timer, u32ToutSel) ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_TGLPINSEL_Msk) | (u32ToutSel))
122
123 /**
124 * @brief Select Timer operating mode
125 *
126 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
127 * @param[in] u32OpMode Operation mode. Possible options are
128 * - \ref TIMER_ONESHOT_MODE
129 * - \ref TIMER_PERIODIC_MODE
130 * - \ref TIMER_TOGGLE_MODE
131 * - \ref TIMER_CONTINUOUS_MODE
132 *
133 * @return None
134 * \hideinitializer
135 */
136 #define TIMER_SET_OPMODE(timer, u32OpMode) ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_OPMODE_Msk) | (u32OpMode))
137
138 /* Declare these inline functions here to avoid MISRA C 2004 rule 8.1 error */
139 __STATIC_INLINE void TIMER_Start(TIMER_T *timer);
140 __STATIC_INLINE void TIMER_Stop(TIMER_T *timer);
141 __STATIC_INLINE void TIMER_EnableWakeup(TIMER_T *timer);
142 __STATIC_INLINE void TIMER_DisableWakeup(TIMER_T *timer);
143 __STATIC_INLINE void TIMER_StartCapture(TIMER_T *timer);
144 __STATIC_INLINE void TIMER_StopCapture(TIMER_T *timer);
145 __STATIC_INLINE void TIMER_EnableCaptureDebounce(TIMER_T *timer);
146 __STATIC_INLINE void TIMER_DisableCaptureDebounce(TIMER_T *timer);
147 __STATIC_INLINE void TIMER_EnableEventCounterDebounce(TIMER_T *timer);
148 __STATIC_INLINE void TIMER_DisableEventCounterDebounce(TIMER_T *timer);
149 __STATIC_INLINE void TIMER_EnableInt(TIMER_T *timer);
150 __STATIC_INLINE void TIMER_DisableInt(TIMER_T *timer);
151 __STATIC_INLINE void TIMER_EnableCaptureInt(TIMER_T *timer);
152 __STATIC_INLINE void TIMER_DisableCaptureInt(TIMER_T *timer);
153 __STATIC_INLINE uint32_t TIMER_GetIntFlag(TIMER_T *timer);
154 __STATIC_INLINE void TIMER_ClearIntFlag(TIMER_T *timer);
155 __STATIC_INLINE uint32_t TIMER_GetCaptureIntFlag(TIMER_T *timer);
156 __STATIC_INLINE void TIMER_ClearCaptureIntFlag(TIMER_T *timer);
157 __STATIC_INLINE uint32_t TIMER_GetWakeupFlag(TIMER_T *timer);
158 __STATIC_INLINE void TIMER_ClearWakeupFlag(TIMER_T *timer);
159 __STATIC_INLINE uint32_t TIMER_GetCaptureData(TIMER_T *timer);
160 __STATIC_INLINE uint32_t TIMER_GetCounter(TIMER_T *timer);
161 __STATIC_INLINE void TIMER_ResetCounter(TIMER_T *timer);
162
163 /**
164 * @brief Start Timer Counting
165 *
166 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
167 *
168 * @return None
169 *
170 * @details This function is used to start Timer counting.
171 */
TIMER_Start(TIMER_T * timer)172 __STATIC_INLINE void TIMER_Start(TIMER_T *timer)
173 {
174 timer->CTL |= TIMER_CTL_CNTEN_Msk;
175 }
176
177 /**
178 * @brief Stop Timer Counting
179 *
180 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
181 *
182 * @return None
183 *
184 * @details This function is used to stop/suspend Timer counting.
185 */
TIMER_Stop(TIMER_T * timer)186 __STATIC_INLINE void TIMER_Stop(TIMER_T *timer)
187 {
188 timer->CTL &= ~TIMER_CTL_CNTEN_Msk;
189 }
190
191 /**
192 * @brief Enable Timer Interrupt Wake-up Function
193 *
194 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
195 *
196 * @return None
197 *
198 * @details This function is used to enable the timer interrupt wake-up function and interrupt source could be time-out interrupt, \n
199 * counter event interrupt or capture trigger interrupt.
200 * @note To wake the system from Power-down mode, timer clock source must be ether LXT or LIRC.
201 */
TIMER_EnableWakeup(TIMER_T * timer)202 __STATIC_INLINE void TIMER_EnableWakeup(TIMER_T *timer)
203 {
204 timer->CTL |= TIMER_CTL_WKEN_Msk;
205 }
206
207 /**
208 * @brief Disable Timer Wake-up Function
209 *
210 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
211 *
212 * @return None
213 *
214 * @details This function is used to disable the timer interrupt wake-up function.
215 */
TIMER_DisableWakeup(TIMER_T * timer)216 __STATIC_INLINE void TIMER_DisableWakeup(TIMER_T *timer)
217 {
218 timer->CTL &= ~TIMER_CTL_WKEN_Msk;
219 }
220
221 /**
222 * @brief Start Timer Capture Function
223 *
224 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
225 *
226 * @return None
227 *
228 * @details This function is used to start Timer capture function.
229 */
TIMER_StartCapture(TIMER_T * timer)230 __STATIC_INLINE void TIMER_StartCapture(TIMER_T *timer)
231 {
232 timer->EXTCTL |= TIMER_EXTCTL_CAPEN_Msk;
233 }
234
235 /**
236 * @brief Stop Timer Capture Function
237 *
238 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
239 *
240 * @return None
241 *
242 * @details This function is used to stop Timer capture function.
243 */
TIMER_StopCapture(TIMER_T * timer)244 __STATIC_INLINE void TIMER_StopCapture(TIMER_T *timer)
245 {
246 timer->EXTCTL &= ~TIMER_EXTCTL_CAPEN_Msk;
247 }
248
249 /**
250 * @brief Enable Capture Pin De-bounce
251 *
252 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
253 *
254 * @return None
255 *
256 * @details This function is used to enable the detect de-bounce function of capture pin.
257 */
TIMER_EnableCaptureDebounce(TIMER_T * timer)258 __STATIC_INLINE void TIMER_EnableCaptureDebounce(TIMER_T *timer)
259 {
260 timer->EXTCTL |= TIMER_EXTCTL_CAPDBEN_Msk;
261 }
262
263 /**
264 * @brief Disable Capture Pin De-bounce
265 *
266 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
267 *
268 * @return None
269 *
270 * @details This function is used to disable the detect de-bounce function of capture pin.
271 */
TIMER_DisableCaptureDebounce(TIMER_T * timer)272 __STATIC_INLINE void TIMER_DisableCaptureDebounce(TIMER_T *timer)
273 {
274 timer->EXTCTL &= ~TIMER_EXTCTL_CAPDBEN_Msk;
275 }
276
277 /**
278 * @brief Enable Counter Pin De-bounce
279 *
280 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
281 *
282 * @return None
283 *
284 * @details This function is used to enable the detect de-bounce function of counter pin.
285 */
TIMER_EnableEventCounterDebounce(TIMER_T * timer)286 __STATIC_INLINE void TIMER_EnableEventCounterDebounce(TIMER_T *timer)
287 {
288 timer->EXTCTL |= TIMER_EXTCTL_CNTDBEN_Msk;
289 }
290
291 /**
292 * @brief Disable Counter Pin De-bounce
293 *
294 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
295 *
296 * @return None
297 *
298 * @details This function is used to disable the detect de-bounce function of counter pin.
299 */
TIMER_DisableEventCounterDebounce(TIMER_T * timer)300 __STATIC_INLINE void TIMER_DisableEventCounterDebounce(TIMER_T *timer)
301 {
302 timer->EXTCTL &= ~TIMER_EXTCTL_CNTDBEN_Msk;
303 }
304
305 /**
306 * @brief Enable Timer Time-out Interrupt
307 *
308 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
309 *
310 * @return None
311 *
312 * @details This function is used to enable the timer time-out interrupt function.
313 */
TIMER_EnableInt(TIMER_T * timer)314 __STATIC_INLINE void TIMER_EnableInt(TIMER_T *timer)
315 {
316 timer->CTL |= TIMER_CTL_INTEN_Msk;
317 }
318
319 /**
320 * @brief Disable Timer Time-out Interrupt
321 *
322 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
323 *
324 * @return None
325 *
326 * @details This function is used to disable the timer time-out interrupt function.
327 */
TIMER_DisableInt(TIMER_T * timer)328 __STATIC_INLINE void TIMER_DisableInt(TIMER_T *timer)
329 {
330 timer->CTL &= ~TIMER_CTL_INTEN_Msk;
331 }
332
333 /**
334 * @brief Enable Capture Trigger Interrupt
335 *
336 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
337 *
338 * @return None
339 *
340 * @details This function is used to enable the timer capture trigger interrupt function.
341 */
TIMER_EnableCaptureInt(TIMER_T * timer)342 __STATIC_INLINE void TIMER_EnableCaptureInt(TIMER_T *timer)
343 {
344 timer->EXTCTL |= TIMER_EXTCTL_CAPIEN_Msk;
345 }
346
347 /**
348 * @brief Disable Capture Trigger Interrupt
349 *
350 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
351 *
352 * @return None
353 *
354 * @details This function is used to disable the timer capture trigger interrupt function.
355 */
TIMER_DisableCaptureInt(TIMER_T * timer)356 __STATIC_INLINE void TIMER_DisableCaptureInt(TIMER_T *timer)
357 {
358 timer->EXTCTL &= ~TIMER_EXTCTL_CAPIEN_Msk;
359 }
360
361 /**
362 * @brief Get Timer Time-out Interrupt Flag
363 *
364 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
365 *
366 * @retval 0 Timer time-out interrupt did not occur
367 * @retval 1 Timer time-out interrupt occurred
368 *
369 * @details This function indicates timer time-out interrupt occurred or not.
370 */
TIMER_GetIntFlag(TIMER_T * timer)371 __STATIC_INLINE uint32_t TIMER_GetIntFlag(TIMER_T *timer)
372 {
373 return ((timer->INTSTS & TIMER_INTSTS_TIF_Msk) ? 1UL : 0UL);
374 }
375
376 /**
377 * @brief Clear Timer Time-out Interrupt Flag
378 *
379 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
380 *
381 * @return None
382 *
383 * @details This function clears timer time-out interrupt flag to 0.
384 */
TIMER_ClearIntFlag(TIMER_T * timer)385 __STATIC_INLINE void TIMER_ClearIntFlag(TIMER_T *timer)
386 {
387 timer->INTSTS = TIMER_INTSTS_TIF_Msk;
388 }
389
390 /**
391 * @brief Get Timer Capture Interrupt Flag
392 *
393 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
394 *
395 * @retval 0 Timer capture interrupt did not occur
396 * @retval 1 Timer capture interrupt occurred
397 *
398 * @details This function indicates timer capture trigger interrupt occurred or not.
399 */
TIMER_GetCaptureIntFlag(TIMER_T * timer)400 __STATIC_INLINE uint32_t TIMER_GetCaptureIntFlag(TIMER_T *timer)
401 {
402 return timer->EINTSTS;
403 }
404
405 /**
406 * @brief Clear Timer Capture Interrupt Flag
407 *
408 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
409 *
410 * @return None
411 *
412 * @details This function clears timer capture trigger interrupt flag to 0.
413 */
TIMER_ClearCaptureIntFlag(TIMER_T * timer)414 __STATIC_INLINE void TIMER_ClearCaptureIntFlag(TIMER_T *timer)
415 {
416 timer->EINTSTS = TIMER_EINTSTS_CAPIF_Msk;
417 }
418
419 /**
420 * @brief Get Timer Wake-up Flag
421 *
422 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
423 *
424 * @retval 0 Timer does not cause CPU wake-up
425 * @retval 1 Timer interrupt event cause CPU wake-up
426 *
427 * @details This function indicates timer interrupt event has waked up system or not.
428 */
TIMER_GetWakeupFlag(TIMER_T * timer)429 __STATIC_INLINE uint32_t TIMER_GetWakeupFlag(TIMER_T *timer)
430 {
431 return (timer->INTSTS & TIMER_INTSTS_TWKF_Msk ? 1UL : 0UL);
432 }
433
434 /**
435 * @brief Clear Timer Wake-up Flag
436 *
437 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
438 *
439 * @return None
440 *
441 * @details This function clears the timer wake-up system flag to 0.
442 */
TIMER_ClearWakeupFlag(TIMER_T * timer)443 __STATIC_INLINE void TIMER_ClearWakeupFlag(TIMER_T *timer)
444 {
445 timer->INTSTS = TIMER_INTSTS_TWKF_Msk;
446 }
447
448 /**
449 * @brief Get Capture value
450 *
451 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
452 *
453 * @return 24-bit Capture Value
454 *
455 * @details This function reports the current 24-bit timer capture value.
456 */
TIMER_GetCaptureData(TIMER_T * timer)457 __STATIC_INLINE uint32_t TIMER_GetCaptureData(TIMER_T *timer)
458 {
459 return timer->CAP;
460 }
461
462 /**
463 * @brief Get Counter value
464 *
465 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
466 *
467 * @return 24-bit Counter Value
468 *
469 * @details This function reports the current 24-bit timer counter value.
470 */
TIMER_GetCounter(TIMER_T * timer)471 __STATIC_INLINE uint32_t TIMER_GetCounter(TIMER_T *timer)
472 {
473 return timer->CNT;
474 }
475
476 /**
477 * @brief Reset Counter
478 *
479 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
480 *
481 * @return None
482 *
483 * @details This function is used to reset current counter value and internal prescale counter value.
484 */
TIMER_ResetCounter(TIMER_T * timer)485 __STATIC_INLINE void TIMER_ResetCounter(TIMER_T *timer)
486 {
487 timer->CNT = 0UL;
488 while((timer->CNT&TIMER_CNT_RSTACT_Msk) == TIMER_CNT_RSTACT_Msk)
489 {
490 ;
491 }
492 }
493
494
495 uint32_t TIMER_Open(TIMER_T *timer, uint32_t u32Mode, uint32_t u32Freq);
496 void TIMER_Close(TIMER_T *timer);
497 void TIMER_Delay(TIMER_T *timer, uint32_t u32Usec);
498 void TIMER_EnableCapture(TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge);
499 void TIMER_DisableCapture(TIMER_T *timer);
500 void TIMER_EnableEventCounter(TIMER_T *timer, uint32_t u32Edge);
501 void TIMER_DisableEventCounter(TIMER_T *timer);
502 uint32_t TIMER_GetModuleClock(TIMER_T *timer);
503 void TIMER_EnableFreqCounter(TIMER_T *timer,
504 uint32_t u32DropCount,
505 uint32_t u32Timeout,
506 uint32_t u32EnableInt);
507 void TIMER_DisableFreqCounter(TIMER_T *timer);
508 void TIMER_SetTriggerSource(TIMER_T *timer, uint32_t u32Src);
509 void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask);
510
511 /*@}*/ /* end of group TIMER_EXPORTED_FUNCTIONS */
512
513 /*@}*/ /* end of group TIMER_Driver */
514
515 /*@}*/ /* end of group Standard_Driver */
516
517 #ifdef __cplusplus
518 }
519 #endif
520
521 #endif /* __TIMER_H__ */
522
523
524