1 /**************************************************************************//**
2  * @file     timer.h
3  * @version  V3.00
4  * @brief    Timer Controller(Timer) driver header file
5  *
6  * @copyright SPDX-License-Identifier: Apache-2.0
7  * @copyright Copyright (C) 2017-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         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 /*---------------------------------------------------------------------------------------------------------*/
125 /* static inline functions                                                                                 */
126 /*---------------------------------------------------------------------------------------------------------*/
127 /* Declare these inline functions here to avoid MISRA C 2004 rule 8.1 error */
128 __STATIC_INLINE void TIMER_Start(TIMER_T *timer);
129 __STATIC_INLINE void TIMER_Stop(TIMER_T *timer);
130 __STATIC_INLINE void TIMER_EnableWakeup(TIMER_T *timer);
131 __STATIC_INLINE void TIMER_DisableWakeup(TIMER_T *timer);
132 __STATIC_INLINE void TIMER_StartCapture(TIMER_T *timer);
133 __STATIC_INLINE void TIMER_StopCapture(TIMER_T *timer);
134 __STATIC_INLINE void TIMER_EnableCaptureDebounce(TIMER_T *timer);
135 __STATIC_INLINE void TIMER_DisableCaptureDebounce(TIMER_T *timer);
136 __STATIC_INLINE void TIMER_EnableEventCounterDebounce(TIMER_T *timer);
137 __STATIC_INLINE void TIMER_DisableEventCounterDebounce(TIMER_T *timer);
138 __STATIC_INLINE void TIMER_EnableInt(TIMER_T *timer);
139 __STATIC_INLINE void TIMER_DisableInt(TIMER_T *timer);
140 __STATIC_INLINE void TIMER_EnableCaptureInt(TIMER_T *timer);
141 __STATIC_INLINE void TIMER_DisableCaptureInt(TIMER_T *timer);
142 __STATIC_INLINE uint32_t TIMER_GetIntFlag(TIMER_T *timer);
143 __STATIC_INLINE void TIMER_ClearIntFlag(TIMER_T *timer);
144 __STATIC_INLINE uint32_t TIMER_GetCaptureIntFlag(TIMER_T *timer);
145 __STATIC_INLINE void TIMER_ClearCaptureIntFlag(TIMER_T *timer);
146 __STATIC_INLINE uint32_t TIMER_GetWakeupFlag(TIMER_T *timer);
147 __STATIC_INLINE void TIMER_ClearWakeupFlag(TIMER_T *timer);
148 __STATIC_INLINE uint32_t TIMER_GetCaptureData(TIMER_T *timer);
149 __STATIC_INLINE uint32_t TIMER_GetCounter(TIMER_T *timer);
150 __STATIC_INLINE void TIMER_ResetCounter(TIMER_T *timer);
151 
152 
153 /**
154   * @brief      Start Timer Counting
155   *
156   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
157   *
158   * @return     None
159   *
160   * @details    This function is used to start Timer counting.
161   */
TIMER_Start(TIMER_T * timer)162 __STATIC_INLINE void TIMER_Start(TIMER_T *timer)
163 {
164     timer->CTL |= TIMER_CTL_CNTEN_Msk;
165 }
166 
167 /**
168   * @brief      Stop Timer Counting
169   *
170   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
171   *
172   * @return     None
173   *
174   * @details    This function is used to stop/suspend Timer counting.
175   */
TIMER_Stop(TIMER_T * timer)176 __STATIC_INLINE void TIMER_Stop(TIMER_T *timer)
177 {
178     timer->CTL &= ~TIMER_CTL_CNTEN_Msk;
179 }
180 
181 /**
182   * @brief      Enable Timer Interrupt Wake-up Function
183   *
184   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
185   *
186   * @return     None
187   *
188   * @details    This function is used to enable the timer interrupt wake-up function and interrupt source could be time-out interrupt, \n
189   *             counter event interrupt or capture trigger interrupt.
190         To wake the system from Power-down mode, timer clock source must be ether LXT or LIRC.
191   */
TIMER_EnableWakeup(TIMER_T * timer)192 __STATIC_INLINE void TIMER_EnableWakeup(TIMER_T *timer)
193 {
194     timer->CTL |= TIMER_CTL_WKEN_Msk;
195 }
196 
197 /**
198   * @brief      Disable Timer Wake-up Function
199   *
200   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
201   *
202   * @return     None
203   *
204   * @details    This function is used to disable the timer interrupt wake-up function.
205   */
TIMER_DisableWakeup(TIMER_T * timer)206 __STATIC_INLINE void TIMER_DisableWakeup(TIMER_T *timer)
207 {
208     timer->CTL &= ~TIMER_CTL_WKEN_Msk;
209 }
210 
211 /**
212   * @brief      Start Timer Capture Function
213   *
214   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
215   *
216   * @return     None
217   *
218   * @details    This function is used to start Timer capture function.
219   */
TIMER_StartCapture(TIMER_T * timer)220 __STATIC_INLINE void TIMER_StartCapture(TIMER_T *timer)
221 {
222     timer->EXTCTL |= TIMER_EXTCTL_CAPEN_Msk;
223 }
224 
225 /**
226   * @brief      Stop Timer Capture Function
227   *
228   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
229   *
230   * @return     None
231   *
232   * @details    This function is used to stop Timer capture function.
233   */
TIMER_StopCapture(TIMER_T * timer)234 __STATIC_INLINE void TIMER_StopCapture(TIMER_T *timer)
235 {
236     timer->EXTCTL &= ~TIMER_EXTCTL_CAPEN_Msk;
237 }
238 
239 /**
240   * @brief      Enable Capture Pin De-bounce
241   *
242   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
243   *
244   * @return     None
245   *
246   * @details    This function is used to enable the detect de-bounce function of capture pin.
247   */
TIMER_EnableCaptureDebounce(TIMER_T * timer)248 __STATIC_INLINE void TIMER_EnableCaptureDebounce(TIMER_T *timer)
249 {
250     timer->EXTCTL |= TIMER_EXTCTL_CAPDBEN_Msk;
251 }
252 
253 /**
254   * @brief      Disable Capture Pin De-bounce
255   *
256   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
257   *
258   * @return     None
259   *
260   * @details    This function is used to disable the detect de-bounce function of capture pin.
261   */
TIMER_DisableCaptureDebounce(TIMER_T * timer)262 __STATIC_INLINE void TIMER_DisableCaptureDebounce(TIMER_T *timer)
263 {
264     timer->EXTCTL &= ~TIMER_EXTCTL_CAPDBEN_Msk;
265 }
266 
267 /**
268   * @brief      Enable Counter Pin De-bounce
269   *
270   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
271   *
272   * @return     None
273   *
274   * @details    This function is used to enable the detect de-bounce function of counter pin.
275   */
TIMER_EnableEventCounterDebounce(TIMER_T * timer)276 __STATIC_INLINE void TIMER_EnableEventCounterDebounce(TIMER_T *timer)
277 {
278     timer->EXTCTL |= TIMER_EXTCTL_CNTDBEN_Msk;
279 }
280 
281 /**
282   * @brief      Disable Counter Pin De-bounce
283   *
284   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
285   *
286   * @return     None
287   *
288   * @details    This function is used to disable the detect de-bounce function of counter pin.
289   */
TIMER_DisableEventCounterDebounce(TIMER_T * timer)290 __STATIC_INLINE void TIMER_DisableEventCounterDebounce(TIMER_T *timer)
291 {
292     timer->EXTCTL &= ~TIMER_EXTCTL_CNTDBEN_Msk;
293 }
294 
295 /**
296   * @brief      Enable Timer Time-out Interrupt
297   *
298   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
299   *
300   * @return     None
301   *
302   * @details    This function is used to enable the timer time-out interrupt function.
303   */
TIMER_EnableInt(TIMER_T * timer)304 __STATIC_INLINE void TIMER_EnableInt(TIMER_T *timer)
305 {
306     timer->CTL |= TIMER_CTL_INTEN_Msk;
307 }
308 
309 /**
310   * @brief      Disable Timer Time-out Interrupt
311   *
312   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
313   *
314   * @return     None
315   *
316   * @details    This function is used to disable the timer time-out interrupt function.
317   */
TIMER_DisableInt(TIMER_T * timer)318 __STATIC_INLINE void TIMER_DisableInt(TIMER_T *timer)
319 {
320     timer->CTL &= ~TIMER_CTL_INTEN_Msk;
321 }
322 
323 /**
324   * @brief      Enable Capture Trigger Interrupt
325   *
326   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
327   *
328   * @return     None
329   *
330   * @details    This function is used to enable the timer capture trigger interrupt function.
331   */
TIMER_EnableCaptureInt(TIMER_T * timer)332 __STATIC_INLINE void TIMER_EnableCaptureInt(TIMER_T *timer)
333 {
334     timer->EXTCTL |= TIMER_EXTCTL_CAPIEN_Msk;
335 }
336 
337 /**
338   * @brief      Disable Capture Trigger Interrupt
339   *
340   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
341   *
342   * @return     None
343   *
344   * @details    This function is used to disable the timer capture trigger interrupt function.
345   */
TIMER_DisableCaptureInt(TIMER_T * timer)346 __STATIC_INLINE void TIMER_DisableCaptureInt(TIMER_T *timer)
347 {
348     timer->EXTCTL &= ~TIMER_EXTCTL_CAPIEN_Msk;
349 }
350 
351 /**
352   * @brief      Get Timer Time-out Interrupt Flag
353   *
354   * @param[in]  timer   The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
355   *
356   * @retval     0   Timer time-out interrupt did not occur
357   * @retval     1   Timer time-out interrupt occurred
358   *
359   * @details    This function indicates timer time-out interrupt occurred or not.
360   */
TIMER_GetIntFlag(TIMER_T * timer)361 __STATIC_INLINE uint32_t TIMER_GetIntFlag(TIMER_T *timer)
362 {
363     return ((timer->INTSTS & TIMER_INTSTS_TIF_Msk) ? 1UL : 0UL);
364 }
365 
366 /**
367   * @brief      Clear Timer Time-out Interrupt Flag
368   *
369   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
370   *
371   * @return     None
372   *
373   * @details    This function clears timer time-out interrupt flag to 0.
374   */
TIMER_ClearIntFlag(TIMER_T * timer)375 __STATIC_INLINE void TIMER_ClearIntFlag(TIMER_T *timer)
376 {
377     timer->INTSTS = TIMER_INTSTS_TIF_Msk;
378 }
379 
380 /**
381   * @brief      Get Timer Capture Interrupt Flag
382   *
383   * @param[in]  timer   The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
384   *
385   * @retval     0   Timer capture interrupt did not occur
386   * @retval     1   Timer capture interrupt occurred
387   *
388   * @details    This function indicates timer capture trigger interrupt occurred or not.
389   */
TIMER_GetCaptureIntFlag(TIMER_T * timer)390 __STATIC_INLINE uint32_t TIMER_GetCaptureIntFlag(TIMER_T *timer)
391 {
392     return timer->EINTSTS;
393 }
394 
395 /**
396   * @brief      Clear Timer Capture Interrupt Flag
397   *
398   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
399   *
400   * @return     None
401   *
402   * @details    This function clears timer capture trigger interrupt flag to 0.
403   */
TIMER_ClearCaptureIntFlag(TIMER_T * timer)404 __STATIC_INLINE void TIMER_ClearCaptureIntFlag(TIMER_T *timer)
405 {
406     timer->EINTSTS = TIMER_EINTSTS_CAPIF_Msk;
407 }
408 
409 /**
410   * @brief      Get Timer Wake-up Flag
411   *
412   * @param[in]  timer   The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
413   *
414   * @retval     0   Timer does not cause CPU wake-up
415   * @retval     1   Timer interrupt event cause CPU wake-up
416   *
417   * @details    This function indicates timer interrupt event has waked up system or not.
418   */
TIMER_GetWakeupFlag(TIMER_T * timer)419 __STATIC_INLINE uint32_t TIMER_GetWakeupFlag(TIMER_T *timer)
420 {
421     return (timer->INTSTS & TIMER_INTSTS_TWKF_Msk ? 1UL : 0UL);
422 }
423 
424 /**
425   * @brief      Clear Timer Wake-up Flag
426   *
427   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
428   *
429   * @return     None
430   *
431   * @details    This function clears the timer wake-up system flag to 0.
432   */
TIMER_ClearWakeupFlag(TIMER_T * timer)433 __STATIC_INLINE void TIMER_ClearWakeupFlag(TIMER_T *timer)
434 {
435     timer->INTSTS = TIMER_INTSTS_TWKF_Msk;
436 }
437 
438 /**
439   * @brief      Get Capture value
440   *
441   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
442   *
443   * @return     24-bit Capture Value
444   *
445   * @details    This function reports the current 24-bit timer capture value.
446   */
TIMER_GetCaptureData(TIMER_T * timer)447 __STATIC_INLINE uint32_t TIMER_GetCaptureData(TIMER_T *timer)
448 {
449     return timer->CAP;
450 }
451 
452 /**
453   * @brief      Get Counter value
454   *
455   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
456   *
457   * @return     24-bit Counter Value
458   *
459   * @details    This function reports the current 24-bit timer counter value.
460   */
TIMER_GetCounter(TIMER_T * timer)461 __STATIC_INLINE uint32_t TIMER_GetCounter(TIMER_T *timer)
462 {
463     return timer->CNT;
464 }
465 
466 /**
467   * @brief      Reset Counter
468   *
469   * @param[in]  timer       The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
470   *
471   * @return     None
472   *
473   * @details    This function is used to reset current counter value and internal prescale counter value.
474   */
TIMER_ResetCounter(TIMER_T * timer)475 __STATIC_INLINE void TIMER_ResetCounter(TIMER_T *timer)
476 {
477     timer->CNT = 0UL;
478     while((timer->CNT & TIMER_CNT_RSTACT_Msk) == TIMER_CNT_RSTACT_Msk) {}
479 }
480 
481 
482 uint32_t TIMER_Open(TIMER_T *timer, uint32_t u32Mode, uint32_t u32Freq);
483 void TIMER_Close(TIMER_T *timer);
484 void TIMER_Delay(TIMER_T *timer, uint32_t u32Usec);
485 void TIMER_EnableCapture(TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge);
486 void TIMER_DisableCapture(TIMER_T *timer);
487 void TIMER_EnableEventCounter(TIMER_T *timer, uint32_t u32Edge);
488 void TIMER_DisableEventCounter(TIMER_T *timer);
489 uint32_t TIMER_GetModuleClock(TIMER_T *timer);
490 void TIMER_EnableFreqCounter(TIMER_T *timer, uint32_t u32DropCount, uint32_t u32Timeout, uint32_t u32EnableInt);
491 void TIMER_DisableFreqCounter(TIMER_T *timer);
492 void TIMER_SetTriggerSource(TIMER_T *timer, uint32_t u32Src);
493 void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask);
494 
495 /*@}*/ /* end of group TIMER_EXPORTED_FUNCTIONS */
496 
497 /*@}*/ /* end of group TIMER_Driver */
498 
499 /*@}*/ /* end of group Standard_Driver */
500 
501 #ifdef __cplusplus
502 }
503 #endif
504 
505 #endif /* __TIMER_H__ */
506 
507