timer.h 19 KB

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