hc32f4a0_tmr6.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. /**
  2. *******************************************************************************
  3. * @file hc32f4a0_tmr6.h
  4. * @brief Head file for TMR6 module.
  5. *
  6. @verbatim
  7. Change Logs:
  8. Date Author Notes
  9. 2020-06-12 Wangmin First version
  10. 2020-07-15 Wangmin Refine macro define
  11. @endverbatim
  12. *******************************************************************************
  13. * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
  14. *
  15. * This software component is licensed by HDSC under BSD 3-Clause license
  16. * (the "License"); You may not use this file except in compliance with the
  17. * License. You may obtain a copy of the License at:
  18. * opensource.org/licenses/BSD-3-Clause
  19. *
  20. *******************************************************************************
  21. */
  22. #ifndef __HC32F4A0_TMR6_H__
  23. #define __HC32F4A0_TMR6_H__
  24. /* C binding of definitions if building with C++ compiler */
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. /*******************************************************************************
  30. * Include files
  31. ******************************************************************************/
  32. #include "hc32_common.h"
  33. #include "ddl_config.h"
  34. /**
  35. * @addtogroup HC32F4A0_DDL_Driver
  36. * @{
  37. */
  38. /**
  39. * @addtogroup DDL_TMR6
  40. * @{
  41. */
  42. #if (DDL_TMR6_ENABLE == DDL_ON)
  43. /*******************************************************************************
  44. * Global type definitions ('typedef')
  45. ******************************************************************************/
  46. /**
  47. * @defgroup TMR6_Global_Types TMR6 Global Types
  48. * @{
  49. */
  50. /**
  51. * @brief Timer6 base counter function structure definition
  52. */
  53. typedef struct
  54. {
  55. uint32_t u32CntMode; /*!< Count mode, @ref TMR6_Count_Mode_define */
  56. uint32_t u32CntDir; /*!< Count direction, @ref TMR6_Count_Direction_define */
  57. uint32_t u32CntClkDiv; /*!< Count clock division select, @ref TMR6_Count_Clock_define */
  58. uint32_t u32CntStpAftOvf; /*!< Count stop after overflow @ref TMR6_Count_Stop_After_Overflow_define*/
  59. }stc_tmr6_basecnt_cfg_t;
  60. /**
  61. * @brief Timer6 buffer function configuration structure definition
  62. */
  63. typedef struct
  64. {
  65. uint32_t u32BufFunCmd; /*!< specifies the buffer function status,
  66. and this parameter can be a value of
  67. @ref TMR6_Buffer_Function_sta_Define */
  68. uint32_t u32BufNum; /*!< specifies the buffer number,
  69. and this parameter can be a value of
  70. @ref TMR6_Buffer_Number_Chose_Define */
  71. uint32_t u32BufTransTim; /*!< specifies the buffer send time,
  72. and this parameter can be a value of
  73. @ref TMR6_Buffer_Transfer_Time_Cfg_Define */
  74. }stc_tmr6_buf_func_cfg_t;
  75. /**
  76. * @brief Timer6 Valid period function configuration structure definition
  77. */
  78. typedef struct
  79. {
  80. uint32_t u32StatChA; /*!< specifies the valid period function status for channel A,
  81. and this parameter can be a value of
  82. @ref TMR6_Valid_Period_CHA_STAT_Define */
  83. uint32_t u32StatChB; /*!< specifies the valid period function status for channel B,
  84. and this parameter can be a value of
  85. @ref TMR6_Valid_Period_CHB_STAT_Define */
  86. uint32_t u32CntCond; /*!< specifies the count condition,
  87. and this parameter can be a value of
  88. @ref TMR6_Valid_Period_Count_Condition_Define */
  89. uint32_t u32PeriodInterval; /*!< specifies the interval of the valid period,
  90. @ref TMR6_Valid_Period_Count_Define */
  91. }stc_tmr6_valid_period_func_cfg_t;
  92. /**
  93. * @brief Timer6 port input configuration structure definition
  94. */
  95. typedef struct
  96. {
  97. uint32_t u32PortMode; /*!< Port function mode @ref TMR6_Port_Mode_Func */
  98. uint32_t u32FilterSta; /*!< trig source capture input filter status
  99. @ref TMR6_Port_Input_Filter_Sta*/
  100. uint32_t u32FltClk; /*!< Filter clock @ref TMR6_Input_Port_Filter_Clk*/
  101. }stc_tmr6_port_input_cfg_t;
  102. /**
  103. * @brief Timer6 port output configuration structure definition
  104. */
  105. typedef struct
  106. {
  107. uint32_t u32PortMode; /*!< Port function mode @ref TMR6_Port_Mode_Func */
  108. uint32_t u32NextPeriodForceSta; /*!< Port State Next period @ref TMR6_Force_Port_Output_Sta */
  109. uint32_t u32DownCntMatchAnotherCmpRegSta; /*!< Port state when counter match another compare register
  110. (CHA matched GCMBR, CHB matched GCMAR) in count-down mode
  111. @ref TMR6_Port_Output_Sta */
  112. uint32_t u32UpCntMatchAnotherCmpRegSta; /*!< Port state when counter match another compare register
  113. (CHA matched GCMBR, CHB matched GCMAR) in count-up mode
  114. @ref TMR6_Port_Output_Sta*/
  115. uint32_t u32DownCntMatchCmpRegSta; /*!< Port state when counter match compare register
  116. (CHA matched GCMAR, CHB matched GCMBR) in count-down mode
  117. @ref TMR6_Port_Output_Sta */
  118. uint32_t u32UpCntMatchCmpRegSta; /*!< Port state when counter match compare register
  119. (CHA matched GCMAR, CHB matched GCMBR) in count-up mode
  120. @ref TMR6_Port_Output_Sta */
  121. uint32_t u32UnderflowSta; /*!< Port State when counter underflow @ref TMR6_Port_Output_Sta */
  122. uint32_t u32OverflowSta; /*!< Port State when counter overflow @ref TMR6_Port_Output_Sta */
  123. uint32_t u32StopSta; /*!< Port State when count stop @ref TMR6_Port_Output_Sta */
  124. uint32_t u32StartSta; /*!< Port State when count start @ref TMR6_Port_Output_Sta */
  125. }stc_tmr6_port_output_cfg_t;
  126. /**
  127. * @brief Timer6 EMB configuration structure definition
  128. */
  129. typedef struct
  130. {
  131. uint32_t u32ValidCh; /*!< Valid EMB event channel @ref TMR6_Emb_channel */
  132. uint32_t u32ReleaseMode; /*!< Port release mode when EMB event invalid @ref TMR6_Emb_Release_Mode */
  133. uint32_t u32PortSta; /*!< Port Output status when EMB event valid @ref TMR6_Emb_Port_Sta */
  134. }stc_tmr6_emb_cfg_t;
  135. /**
  136. * @brief Timer6 Dead time function configuration structure definition
  137. */
  138. typedef struct
  139. {
  140. uint32_t u32DtEqualUpDwn; /*!< Enable down count dead time register equal to up count DT register
  141. @ref TMR6_Deadtime_Reg_Equal_Func_define */
  142. uint32_t u32EnDtBufUp; /*!< Enable buffer transfer for up count dead time register
  143. (DTUBR-->DTUAR) @ref TMR6_Deadtime_CountUp_Buf_Func_define*/
  144. uint32_t u32EnDtBufDwn; /*!< Enable buffer transfer for down count dead time register
  145. (DTDBR-->DTDAR) @ref TMR6_Deadtime_CountDown_Buf_Func_define*/
  146. uint32_t u32DtUpdCond; /*!< Buffer transfer condition for triangular wave mode
  147. @ref TMR6_Deadtime_Buf_Transfer_Condition_define */
  148. }stc_tmr6_deadtime_cfg_t;
  149. /**
  150. * @brief Timer6 Dead time function configuration structure definition
  151. */
  152. typedef struct
  153. {
  154. uint32_t u32ZMaskCycle; /*!< Z phase input mask periods selection @ref TMR6_Zmask_Cycle_define*/
  155. uint32_t u32PosCntMaskEn; /*!< As position count timer, clear function enable(TRUE) or disable(FALSE)
  156. during the time of Z phase input mask @ref TMR6_Zmask_Position_Unit_Clear_Func_define*/
  157. uint32_t u32RevCntMaskEn; /*!< As revolution count timer, the counter function enable(TRUE) or
  158. disable(FALSE) during the time of Z phase input mask @ref TMR6_Zmask_Revolution_Unit_Count_Func_define*/
  159. }stc_tmr6_zmask_cfg_t;
  160. /**
  161. * @}
  162. */
  163. /*******************************************************************************
  164. * Global pre-processor symbols/macros ('#define')
  165. ******************************************************************************/
  166. /**
  167. * @defgroup TMR6_Global_Macros TMR6 Global Macros
  168. * @{
  169. */
  170. /** @defgroup TMR6_Sta_Bit_Get_Define TMR6 status bit define
  171. * @{
  172. */
  173. /* Status bit indicate that GCMAR register matched with counter register */
  174. #define TMR6_STAT_CNT_MATCH_A (TMR6_STFLR_CMAF)
  175. /* Status bit indicate that GCMBR register matched with counter register */
  176. #define TMR6_STAT_CNT_MATCH_B (TMR6_STFLR_CMBF)
  177. /* Status bit indicate that GCMCR register matched with counter register */
  178. #define TMR6_STAT_CNT_MATCH_C (TMR6_STFLR_CMCF)
  179. /* Status bit indicate that GCMDR register matched with counter register */
  180. #define TMR6_STAT_CNT_MATCH_D (TMR6_STFLR_CMDF)
  181. /* Status bit indicate that GCMER register matched with counter register */
  182. #define TMR6_STAT_CNT_MATCH_E (TMR6_STFLR_CMEF)
  183. /* Status bit indicate that GCMFR register matched with counter register */
  184. #define TMR6_STAT_CNT_MATCH_F (TMR6_STFLR_CMFF)
  185. /* Status bit indicate that counter register overflow */
  186. #define TMR6_STAT_OVERFLOW (TMR6_STFLR_OVFF)
  187. /* Status bit indicate that counter register underflow */
  188. #define TMR6_STAT_UNDERFLOW (TMR6_STFLR_UDFF)
  189. /* Status bit indicate that dead time error */
  190. #define TMR6_STAT_DEAD_TIME_ERR (TMR6_STFLR_DTEF)
  191. /* Status bit indicate that SCMAR register matched with counter register during count-up */
  192. #define TMR6_STAT_UPCNT_SP_MATCH_A (TMR6_STFLR_CMSAUF)
  193. /* Status bit indicate that SCMAR register matched with counter register during count-down */
  194. #define TMR6_STAT_DOWNCNT_SP_MATCH_A (TMR6_STFLR_CMSADF)
  195. /* Status bit indicate that SCMBR register matched with counter register during count-up */
  196. #define TMR6_STAT_UPCNT_SP_MATCH_B (TMR6_STFLR_CMSBUF)
  197. /* Status bit indicate that SCMBR register matched with counter register during count-down */
  198. #define TMR6_STAT_DOWNCNT_SP_MATCH_B (TMR6_STFLR_CMSBDF)
  199. /* Counter direction flag */
  200. #define TMR6_STAT_CNT_DIR (TMR6_STFLR_DIRF)
  201. /**
  202. * @}
  203. */
  204. /** @defgroup TMR6_Interrupt_Enable_Bit_Define TMR6 interrupt configuration bit define
  205. * @{
  206. */
  207. /* Interrupt enable bit for GCMAR register matched */
  208. #define TMR6_IRQ_EN_CNT_MATCH_A (TMR6_ICONR_INTENA)
  209. /* Interrupt enable bit for GCMBR register matched */
  210. #define TMR6_IRQ_EN_CNT_MATCH_B (TMR6_ICONR_INTENB)
  211. /* Interrupt enable bit for GCMCR register matched */
  212. #define TMR6_IRQ_EN_CNT_MATCH_C (TMR6_ICONR_INTENC)
  213. /* Interrupt enable bit for GCMDR register matched */
  214. #define TMR6_IRQ_EN_CNT_MATCH_D (TMR6_ICONR_INTEND)
  215. /* Interrupt enable bit for GCMER register matched */
  216. #define TMR6_IRQ_EN_CNT_MATCH_E (TMR6_ICONR_INTENE)
  217. /* Interrupt enable bit for GCMFR register matched */
  218. #define TMR6_IRQ_EN_CNT_MATCH_F (TMR6_ICONR_INTENF)
  219. /* Interrupt enable bit for counter register overflow */
  220. #define TMR6_IRQ_EN_OVERFLOW (TMR6_ICONR_INTENOVF)
  221. /* Interrupt enable bit for counter register underflow */
  222. #define TMR6_IRQ_EN_UNDERFLOW (TMR6_ICONR_INTENUDF)
  223. /* Interrupt enable bit for dead time */
  224. #define TMR6_IRQ_EN_DEAD_TIME_ERR (TMR6_ICONR_INTENDTE)
  225. /* Interrupt enable bit for SCMAR register matched during count-up*/
  226. #define TMR6_IRQ_EN_UPCNT_SP_MATCH_A (TMR6_ICONR_INTENSAU)
  227. /* Interrupt enable bit for SCMAR register matched during count-down*/
  228. #define TMR6_IRQ_EN_DOWNCNT_SP_MATCH_A (TMR6_ICONR_INTENSAD)
  229. /* Interrupt enable bit for SCMBR register matched during count-up*/
  230. #define TMR6_IRQ_EN_UPCNT_SP_MATCH_B (TMR6_ICONR_INTENSBU)
  231. /* Interrupt enable bit for SCMBR register matched during count-down*/
  232. #define TMR6_IRQ_EN_DOWNCNT_SP_MATCH_B (TMR6_ICONR_INTENSBD)
  233. /**
  234. * @}
  235. */
  236. /** @defgroup TMR6_Period_Register_Index_Define TMR6 period register Index define
  237. * @{
  238. */
  239. #define TMR6_PERIOD_REG_A (0x00UL)
  240. #define TMR6_PERIOD_REG_B (0x01UL)
  241. #define TMR6_PERIOD_REG_C (0x02UL)
  242. /**
  243. * @}
  244. */
  245. /** @defgroup TMR6_Compare_Register_Index_Define TMR6 compare register Index define
  246. * @{
  247. */
  248. #define TMR6_CMP_REG_A (0x00UL)
  249. #define TMR6_CMP_REG_B (0x01UL)
  250. #define TMR6_CMP_REG_C (0x02UL)
  251. #define TMR6_CMP_REG_D (0x03UL)
  252. #define TMR6_CMP_REG_E (0x04UL)
  253. #define TMR6_CMP_REG_F (0x05UL)
  254. /**
  255. * @}
  256. */
  257. /** @defgroup TMR6_Compare_channel_Define TMR6 general/special compare channel index define
  258. * @{
  259. */
  260. #define TMR6_CH_A (0x00UL)
  261. #define TMR6_CH_B (0x01UL)
  262. /**
  263. * @}
  264. */
  265. /** @defgroup TMR6_Buffer_Function_sta_Define TMR6 buffer function status define
  266. * @{
  267. */
  268. #define TMR6_BUF_FUNC_OFF (0x00000000UL)
  269. #define TMR6_BUF_FUNC_ON (TMR6_BCONR_BENA)
  270. /**
  271. * @}
  272. */
  273. /** @defgroup TMR6_Buffer_Number_Chose_Define TMR6 buffer number configuration define
  274. * @{
  275. */
  276. #define TMR6_BUF_FUNC_SINGLE (0x00000000UL)
  277. #define TMR6_BUF_FUNC_DOUBLE (TMR6_BCONR_BSEA)
  278. /**
  279. * @}
  280. */
  281. /** @defgroup TMR6_Buffer_Transfer_Time_Cfg_Define TMR6 buffer transfer time configuration define
  282. * @{
  283. */
  284. #define TMR6_BUF_TRANS_TIM_NONE (0x00000000UL)
  285. #define TMR6_BUF_TRANS_TIM_OVERFLOW (TMR6_BCONR_BTRUA)
  286. #define TMR6_BUF_TRANS_TIM_UNDERFLOW (TMR6_BCONR_BTRDA)
  287. #define TMR6_BUF_TRANS_TIM_BOTH (TMR6_BCONR_BTRUA | TMR6_BCONR_BTRDA)
  288. /**
  289. * @}
  290. */
  291. /** @defgroup TMR6_Valid_Period_Count_Condition_Define TMR6 valid period function count condition define
  292. * @{
  293. */
  294. /* Valid period function off */
  295. #define TMR6_VALID_PERIOD_FUNC_OFF (0x00000000UL)
  296. /* Counted when Sawtooth waveform overflow and underflow, triangular wave underflow */
  297. #define TMR6_VALID_PERIOD_CNT_COND_UNDERFLOW (TMR6_VPERR_PCNTE_0)
  298. /* Counted when Sawtooth waveform overflow and underflow, triangular wave overflow */
  299. #define TMR6_VALID_PERIOD_CNT_COND_OVERFLOW (TMR6_VPERR_PCNTE_1)
  300. /* Counted when Sawtooth waveform overflow and underflow, triangular wave overflow and underflow */
  301. #define TMR6_VALID_PERIOD_CNT_COND_BOTH (TMR6_VPERR_PCNTE_0 | TMR6_VPERR_PCNTE_1)
  302. /**
  303. * @}
  304. */
  305. /** @defgroup TMR6_Valid_Period_Count_Define TMR6 valid period function count define
  306. * @{
  307. */
  308. /* Valid period count function invalid */
  309. #define TMR6_VALID_PERIOD_CNT_INVALID (0x00000000UL)
  310. /* Interrupt and event valid every other 1 period */
  311. #define TMR6_VALID_PERIOD_CNT_1 (TMR6_VPERR_PCNTS_0)
  312. /* Interrupt and event valid every other 2 period */
  313. #define TMR6_VALID_PERIOD_CNT_2 (TMR6_VPERR_PCNTS_1)
  314. /* Interrupt and event valid every other 3 period */
  315. #define TMR6_VALID_PERIOD_CNT_3 (TMR6_VPERR_PCNTS_0 | TMR6_VPERR_PCNTS_1)
  316. /* Interrupt and event valid every other 4 period */
  317. #define TMR6_VALID_PERIOD_CNT_4 (TMR6_VPERR_PCNTS_2)
  318. /* Interrupt and event valid every other 5 period */
  319. #define TMR6_VALID_PERIOD_CNT_5 (TMR6_VPERR_PCNTS_2 | TMR6_VPERR_PCNTS_0)
  320. /* Interrupt and event valid every other 6 period */
  321. #define TMR6_VALID_PERIOD_CNT_6 (TMR6_VPERR_PCNTS_2 | TMR6_VPERR_PCNTS_1)
  322. /* Interrupt and event valid every other 7 period */
  323. #define TMR6_VALID_PERIOD_CNT_7 (TMR6_VPERR_PCNTS_2 | TMR6_VPERR_PCNTS_1 | TMR6_VPERR_PCNTS_0)
  324. /**
  325. * @}
  326. */
  327. /** @defgroup TMR6_Valid_Period_CHA_STAT_Define TMR6 valid period function channel A status define
  328. * @{
  329. */
  330. #define TMR6_VALID_PERIOD_FUNC_CHA_OFF (0x00000000UL)
  331. #define TMR6_VALID_PERIOD_FUNC_CHA_ON (TMR6_VPERR_SPPERIA)
  332. /**
  333. * @}
  334. */
  335. /** @defgroup TMR6_Valid_Period_CHB_STAT_Define TMR6 valid period function channel B status define
  336. * @{
  337. */
  338. #define TMR6_VALID_PERIOD_FUNC_CHB_OFF (0x00000000UL)
  339. #define TMR6_VALID_PERIOD_FUNC_CHB_ON (TMR6_VPERR_SPPERIB)
  340. /**
  341. * @}
  342. */
  343. /** @defgroup TMR6_DeadTime_Reg_Define TMR6 dead time register define
  344. * @{
  345. */
  346. /* Register DTUAR */
  347. #define TMR6_DEADTIME_REG_UP_A (0x00U)
  348. /* Register DTDAR */
  349. #define TMR6_DEADTIME_REG_DOWN_A (0x01U)
  350. /* Register DTUBR */
  351. #define TMR6_DEADTIME_REG_UP_B (0x02U)
  352. /* Register DTDBR */
  353. #define TMR6_DEADTIME_REG_DOWN_B (0x03U)
  354. /**
  355. * @}
  356. */
  357. /** @defgroup TMR6_Port_Define TMR6 input and output port define
  358. * @{
  359. */
  360. /* port TIM6_<t>_PWMA */
  361. #define TMR6_IO_PWMA (0x00U)
  362. /* port TIM6_<t>_PWMB */
  363. #define TMR6_IO_PWMB (0x01U)
  364. /* Input port TIM6_TRIGA */
  365. #define TMR6_INPUT_TRIGA (0x02U)
  366. /* Input port TIM6_TRIGB */
  367. #define TMR6_INPUT_TRIGB (0x03U)
  368. /* Input port TIM6_TRIGC */
  369. #define TMR6_INPUT_TRIGC (0x04U)
  370. /* Input port TIM6_TRIGD */
  371. #define TMR6_INPUT_TRIGD (0x05U)
  372. /**
  373. * @}
  374. */
  375. /** @defgroup TMR6_Input_Port_Filter_Clk TMR6 input port define
  376. * @{
  377. */
  378. #define TMR6_INPUT_FILTER_PCLK0_DIV1 (0x00U)
  379. #define TMR6_INPUT_FILTER_PCLK0_DIV4 (0x01U)
  380. #define TMR6_INPUT_FILTER_PCLK0_DIV16 (0x02U)
  381. #define TMR6_INPUT_FILTER_PCLK0_DIV64 (0x03U)
  382. /**
  383. * @}
  384. */
  385. /** @defgroup TMR6_Port_Mode_Func TMR6 port function mode selection
  386. * @{
  387. */
  388. #define TMR6_PORT_COMPARE_OUTPUT (0x00U)
  389. #define TMR6_PORT_CAPTURE_INPUT (TMR6_PCNAR_CAPMDA)
  390. /**
  391. * @}
  392. */
  393. /** @defgroup TMR6_Port_Input_Filter_Sta TMR6 port input filter function status
  394. * @{
  395. */
  396. #define TMR6_PORT_INPUT_FILTER_OFF (0x00U)
  397. #define TMR6_PORT_INPUT_FILTER_ON (0x01U)
  398. /**
  399. * @}
  400. */
  401. /** @defgroup TMR6_Port_Output_Sta TMR6 port output status
  402. * @{
  403. */
  404. #define TMR6_PORT_OUTPUT_STA_LOW (0x00U)
  405. #define TMR6_PORT_OUTPUT_STA_HIGH (0x01U)
  406. #define TMR6_PORT_OUTPUT_STA_HOLD (0x02U)
  407. #define TMR6_PORT_OUTPUT_STA_REVERSE (0x03U)
  408. /**
  409. * @}
  410. */
  411. /** @defgroup TMR6_Force_Port_Output_Sta TMR6 force port output status next period
  412. * @{
  413. */
  414. #define TMR6_FORCE_PORT_OUTPUT_INVALID (0x00U)
  415. #define TMR6_FORCE_PORT_OUTPUT_STA_LOW (0x02U)
  416. #define TMR6_FORCE_PORT_OUTPUT_STA_HIGH (0x03U)
  417. /**
  418. * @}
  419. */
  420. /** @defgroup TMR6_Emb_channel TMR6 EMB event valid channel
  421. * @{
  422. */
  423. #define TMR6_EMB_EVENT_VALID_CH0 (0x00U)
  424. #define TMR6_EMB_EVENT_VALID_CH1 (TMR6_PCNAR_EMBSA_0)
  425. #define TMR6_EMB_EVENT_VALID_CH2 (TMR6_PCNAR_EMBSA_1)
  426. #define TMR6_EMB_EVENT_VALID_CH3 (TMR6_PCNAR_EMBSA_0 | TMR6_PCNAR_EMBSA_1)
  427. /**
  428. * @}
  429. */
  430. /** @defgroup TMR6_Emb_Release_Mode TMR6 EMB function release mode when EMB event invalid
  431. * @{
  432. */
  433. #define TMR6_EMB_RELEASE_IMMEDIATE (0x00U)
  434. #define TMR6_EMB_RELEASE_OVERFLOW (TMR6_PCNAR_EMBRA_0)
  435. #define TMR6_EMB_RELEASE_UNDERFLOW (TMR6_PCNAR_EMBRA_1)
  436. #define TMR6_EMB_RELEASE_OVERFLOW_UNDERFLOW (TMR6_PCNAR_EMBRA_0 | TMR6_PCNAR_EMBRA_1)
  437. /**
  438. * @}
  439. */
  440. /** @defgroup TMR6_Emb_Port_Sta TMR6 EMB port output status when EMB event valid
  441. * @{
  442. */
  443. #define TMR6_EMB_PORTSTA_NORMAL (0x00U)
  444. #define TMR6_EMB_PORTSTA_HIZ (TMR6_PCNAR_EMBCA_0)
  445. #define TMR6_EMB_PORTSTA_LOW (TMR6_PCNAR_EMBCA_1)
  446. #define TMR6_EMB_PORTSTA_HIGH (TMR6_PCNAR_EMBCA_0 | TMR6_PCNAR_EMBCA_1)
  447. /**
  448. * @}
  449. */
  450. /** @defgroup TMR6_Deadtime_CountUp_Buf_Func_define TMR6 Dead time buffer function for count up stage
  451. * @{
  452. */
  453. #define TMR6_DEADTIME_CNT_UP_BUF_OFF (0x00U)
  454. #define TMR6_DEADTIME_CNT_UP_BUF_ON (TMR6_DCONR_DTBENU)
  455. /**
  456. * @}
  457. */
  458. /** @defgroup TMR6_Deadtime_CountDown_Buf_Func_define TMR6 Dead time buffer function for count down stage
  459. * @{
  460. */
  461. #define TMR6_DEADTIME_CNT_DOWN_BUF_OFF (0x00U)
  462. #define TMR6_DEADTIME_CNT_DOWN_BUF_ON (TMR6_DCONR_DTBEND)
  463. /**
  464. * @}
  465. */
  466. /** @defgroup TMR6_Deadtime_Buf_Transfer_Condition_define TMR6 Dead time buffer transfer condition define for triangular count mode
  467. * @{
  468. */
  469. #define TMR6_DEADTIME_TRANS_COND_NONE (0x00U)
  470. #define TMR6_DEADTIME_TRANS_COND_OVERFLOW (TMR6_DCONR_DTBTRU)
  471. #define TMR6_DEADTIME_TRANS_COND_UNDERFLOW (TMR6_DCONR_DTBTRD)
  472. #define TMR6_DEADTIME_TRANS_COND_BOTH (TMR6_DCONR_DTBTRU | TMR6_DCONR_DTBTRD)
  473. /**
  474. * @}
  475. */
  476. /** @defgroup TMR6_Deadtime_Reg_Equal_Func_define TMR6 Dead time function DTDAR equal DTUAR
  477. * @{
  478. */
  479. #define TMR6_DEADTIME_EQUAL_OFF (0x00U)
  480. #define TMR6_DEADTIME_EQUAL_ON (TMR6_DCONR_SEPA)
  481. /**
  482. * @}
  483. */
  484. /** @defgroup TMR6_Soft_Sync_Ctrl_Unit_Number_define TMR6 Software synchronization start/stop/clear/update unit number define
  485. * @{
  486. */
  487. #define TMR6_SOFT_SYNC_CTRL_U1 (TMR6_SSTAR_SSTA1)
  488. #define TMR6_SOFT_SYNC_CTRL_U2 (TMR6_SSTAR_SSTA2)
  489. #define TMR6_SOFT_SYNC_CTRL_U3 (TMR6_SSTAR_SSTA3)
  490. #define TMR6_SOFT_SYNC_CTRL_U4 (TMR6_SSTAR_SSTA4)
  491. #define TMR6_SOFT_SYNC_CTRL_U5 (TMR6_SSTAR_SSTA5)
  492. #define TMR6_SOFT_SYNC_CTRL_U6 (TMR6_SSTAR_SSTA6)
  493. #define TMR6_SOFT_SYNC_CTRL_U7 (TMR6_SSTAR_SSTA7)
  494. #define TMR6_SOFT_SYNC_CTRL_U8 (TMR6_SSTAR_SSTA8)
  495. /**
  496. * @}
  497. */
  498. /** @defgroup TMR6_hardware_control_event_define TMR6 hardware start/stop/clear/update/capture events define
  499. * @{
  500. */
  501. #define TMR6_HW_CTRL_PWMA_RISING (TMR6_HSTAR_HSTA0)
  502. #define TMR6_HW_CTRL_PWMA_FAILLING (TMR6_HSTAR_HSTA1)
  503. #define TMR6_HW_CTRL_PWMB_RISING (TMR6_HSTAR_HSTA2)
  504. #define TMR6_HW_CTRL_PWMB_FAILLING (TMR6_HSTAR_HSTA3)
  505. #define TMR6_HW_CTRL_INTER_EVENT0 (TMR6_HSTAR_HSTA8)
  506. #define TMR6_HW_CTRL_INTER_EVENT1 (TMR6_HSTAR_HSTA9)
  507. #define TMR6_HW_CTRL_INTER_EVENT2 (TMR6_HSTAR_HSTA10)
  508. #define TMR6_HW_CTRL_INTER_EVENT3 (TMR6_HSTAR_HSTA11)
  509. #define TMR6_HW_CTRL_TRIGEA_RISING (TMR6_HSTAR_HSTA16)
  510. #define TMR6_HW_CTRL_TRIGEA_FAILLING (TMR6_HSTAR_HSTA17)
  511. #define TMR6_HW_CTRL_TRIGEB_RISING (TMR6_HSTAR_HSTA18)
  512. #define TMR6_HW_CTRL_TRIGEB_FAILLING (TMR6_HSTAR_HSTA19)
  513. #define TMR6_HW_CTRL_TRIGEC_RISING (TMR6_HSTAR_HSTA20)
  514. #define TMR6_HW_CTRL_TRIGEC_FAILLING (TMR6_HSTAR_HSTA21)
  515. #define TMR6_HW_CTRL_TRIGED_RISING (TMR6_HSTAR_HSTA22)
  516. #define TMR6_HW_CTRL_TRIGED_FAILLING (TMR6_HSTAR_HSTA23)
  517. /**
  518. * @}
  519. */
  520. /** @defgroup TMR6_hardware_count_event_define TMR6 hardware increase/decrease events define
  521. * @{
  522. */
  523. #define TMR6_HW_CNT_PWMAL_PWMBRISING (TMR6_HCUPR_HCUP0)
  524. #define TMR6_HW_CNT_PWMAL_PWMBFAILLING (TMR6_HCUPR_HCUP1)
  525. #define TMR6_HW_CNT_PWMAH_PWMBRISING (TMR6_HCUPR_HCUP2)
  526. #define TMR6_HW_CNT_PWMAH_PWMBFAILLING (TMR6_HCUPR_HCUP3)
  527. #define TMR6_HW_CNT_PWMBL_PWMARISING (TMR6_HCUPR_HCUP4)
  528. #define TMR6_HW_CNT_PWMBL_PWMAFAILLING (TMR6_HCUPR_HCUP5)
  529. #define TMR6_HW_CNT_PWMBH_PWMARISING (TMR6_HCUPR_HCUP6)
  530. #define TMR6_HW_CNT_PWMBH_PWMAFAILLING (TMR6_HCUPR_HCUP7)
  531. #define TMR6_HW_CNT_INTER_EVENT0 (TMR6_HCUPR_HCUP8)
  532. #define TMR6_HW_CNT_INTER_EVENT1 (TMR6_HCUPR_HCUP9)
  533. #define TMR6_HW_CNT_INTER_EVENT2 (TMR6_HCUPR_HCUP10)
  534. #define TMR6_HW_CNT_INTER_EVENT3 (TMR6_HCUPR_HCUP11)
  535. #define TMR6_HW_CNT_TRIGEA_RISING (TMR6_HCUPR_HCUP16)
  536. #define TMR6_HW_CNT_TRIGEA_FAILLING (TMR6_HCUPR_HCUP17)
  537. #define TMR6_HW_CNT_TRIGEB_RISING (TMR6_HCUPR_HCUP18)
  538. #define TMR6_HW_CNT_TRIGEB_FAILLING (TMR6_HCUPR_HCUP19)
  539. #define TMR6_HW_CNT_TRIGEC_RISING (TMR6_HCUPR_HCUP20)
  540. #define TMR6_HW_CNT_TRIGEC_FAILLING (TMR6_HCUPR_HCUP21)
  541. #define TMR6_HW_CNT_TRIGED_RISING (TMR6_HCUPR_HCUP22)
  542. #define TMR6_HW_CNT_TRIGED_FAILLING (TMR6_HCUPR_HCUP23)
  543. /**
  544. * @}
  545. */
  546. /** @defgroup TMR6_Count_Direction_define TMR6 base counter function direction define
  547. * @{
  548. */
  549. #define TMR6_CNT_INCREASE (TMR6_GCONR_DIR)
  550. #define TMR6_CNT_DECREASE (0x00U)
  551. /**
  552. * @}
  553. */
  554. /** @defgroup TMR6_Count_Mode_define TMR6 base counter function mode define
  555. * @{
  556. */
  557. #define TMR6_MODE_SAWTOOTH (0x00U)
  558. #define TMR6_MODE_TRIANGLE (TMR6_GCONR_MODE)
  559. /**
  560. * @}
  561. */
  562. /** @defgroup TMR6_Count_Clock_define TMR6 base counter clock source define
  563. * @{
  564. */
  565. #define TMR6_CLK_PCLK0_DIV1 (0x00UL)
  566. #define TMR6_CLK_PCLK0_DIV2 (0x01UL << TMR6_GCONR_CKDIV_POS)
  567. #define TMR6_CLK_PCLK0_DIV4 (0x02UL << TMR6_GCONR_CKDIV_POS)
  568. #define TMR6_CLK_PCLK0_DIV8 (0x03UL << TMR6_GCONR_CKDIV_POS)
  569. #define TMR6_CLK_PCLK0_DIV16 (0x04UL << TMR6_GCONR_CKDIV_POS)
  570. #define TMR6_CLK_PCLK0_DIV32 (0x05UL << TMR6_GCONR_CKDIV_POS)
  571. #define TMR6_CLK_PCLK0_DIV64 (0x06UL << TMR6_GCONR_CKDIV_POS)
  572. #define TMR6_CLK_PCLK0_DIV128 (0x07UL << TMR6_GCONR_CKDIV_POS)
  573. #define TMR6_CLK_PCLK0_DIV256 (0x08UL << TMR6_GCONR_CKDIV_POS)
  574. #define TMR6_CLK_PCLK0_DIV512 (0x09UL << TMR6_GCONR_CKDIV_POS)
  575. #define TMR6_CLK_PCLK0_DIV1024 (0x0AUL << TMR6_GCONR_CKDIV_POS)
  576. /**
  577. * @}
  578. */
  579. /** @defgroup TMR6_Count_Stop_After_Overflow_define TMR6 count stop after overflow function define
  580. * @{
  581. */
  582. #define TMR6_CNT_CONTINUOUS (0x00U)
  583. #define TMR6_STOP_AFTER_OVF (TMR6_GCONR_OVSTP)
  584. /**
  585. * @}
  586. */
  587. /** @defgroup TMR6_Zmask_Cycle_define TMR6 Z Mask input function mask cycles number define
  588. * @{
  589. */
  590. #define TMR6_ZMASK_CYCLE_FUNC_INVALID (0x00U)
  591. #define TMR6_ZMASK_CYCLE_4 (TMR6_GCONR_ZMSKVAL_0)
  592. #define TMR6_ZMASK_CYCLE_8 (TMR6_GCONR_ZMSKVAL_1)
  593. #define TMR6_ZMASK_CYCLE_16 (TMR6_GCONR_ZMSKVAL_0 | TMR6_GCONR_ZMSKVAL_1)
  594. /**
  595. * @}
  596. */
  597. /** @defgroup TMR6_Zmask_Position_Unit_Clear_Func_define TMR6 unit as position timer, z phase input mask function define for clear action
  598. * @{
  599. */
  600. #define TMR6_POS_CLR_ZMASK_FUNC_INVALID (0x00U)
  601. #define TMR6_POS_CLR_ZMASK_FUNC_VALID (TMR6_GCONR_ZMSKPOS)
  602. /**
  603. * @}
  604. */
  605. /** @defgroup TMR6_Zmask_Revolution_Unit_Count_Func_define TMR6 unit as revolution timer, z phase input mask function define for count action
  606. * @{
  607. */
  608. #define TMR6_REVO_CNT_ZMASK_FUNC_INVALID (0x00U)
  609. #define TMR6_REVO_CNT_ZMASK_FUNC_VALID (TMR6_GCONR_ZMSKREV)
  610. /**
  611. * @}
  612. */
  613. /** @defgroup TMR6_Hardware_Trigger_Index_define TMR6 hardware trigger index define
  614. * @{
  615. */
  616. #define TMR6_HW_TRIG_0 (0x00U)
  617. #define TMR6_HW_TRIG_1 (0x01U)
  618. #define TMR6_HW_TRIG_2 (0x02U)
  619. #define TMR6_HW_TRIG_3 (0x03U)
  620. /**
  621. * @}
  622. */
  623. /** @defgroup TMR6_Common_Trigger_Source_Cfg_define TMR6 common Trigger Source Config
  624. * @{
  625. */
  626. #define TMR6_COM_TRIG1 (AOS_TMR6_HTSSR_COMTRG_EN_0)
  627. #define TMR6_COM_TRIG2 (AOS_TMR6_HTSSR_COMTRG_EN_1)
  628. #define TMR6_COM_TRIG_MASK (AOS_TMR6_HTSSR_COMTRG_EN)
  629. /**
  630. * @}
  631. */
  632. /**
  633. * @}
  634. */
  635. /*******************************************************************************
  636. * Global variable definitions ('extern')
  637. ******************************************************************************/
  638. /*******************************************************************************
  639. Global function prototypes (definition in C source)
  640. ******************************************************************************/
  641. /**
  642. * @addtogroup TMR6_Global_Functions
  643. * @{
  644. */
  645. /**
  646. * @brief Get Software Sync start status
  647. * @param None
  648. * @retval An uint32_t data indicate the read status.
  649. */
  650. __STATIC_INLINE uint32_t TMR6_GetSwSyncStaState(void)
  651. {
  652. return READ_REG32(M4_TMR6_1->SSTAR);
  653. }
  654. /* TMR6 interrupt request enable or disable */
  655. void TMR6_IntCmd(M4_TMR6_TypeDef *TMR6x, uint32_t u32Tmr6Irq, en_functional_state_t enNewState);
  656. /* Get Timer6 status flag */
  657. en_flag_status_t TMR6_GetSta(const M4_TMR6_TypeDef *TMR6x, uint32_t u32StaBit);
  658. /* Get Timer6 period number when valid period function enable */
  659. uint32_t TMR6_GetPeriodNum(const M4_TMR6_TypeDef *TMR6x);
  660. /* De-initialize the timer6 unit */
  661. void TMR6_DeInit(M4_TMR6_TypeDef *TMR6x);
  662. /* Initialize the timer6 unit */
  663. en_result_t TMR6_Init(M4_TMR6_TypeDef *TMR6x, const stc_tmr6_basecnt_cfg_t* pstcTmr6BaseCntCfg);
  664. /* Timer6 counter function command */
  665. void TMR6_CountCmd(M4_TMR6_TypeDef *TMR6x, en_functional_state_t enNewState);
  666. /* Timer6 counter register set */
  667. void TMR6_SetCntReg(M4_TMR6_TypeDef *TMR6x, uint32_t u32Value);
  668. /* Timer6 update register set */
  669. void TMR6_SetUpdateReg(M4_TMR6_TypeDef *TMR6x, uint32_t u32Value);
  670. /* Timer6 set period register(A~C) */
  671. void TMR6_SetPeriodReg(M4_TMR6_TypeDef *TMR6x, uint32_t u32PeriodReg, uint32_t u32PeriodVal);
  672. /* Timer6 set general compare register(A~F) */
  673. void TMR6_SetGenCmpReg(M4_TMR6_TypeDef *TMR6x, uint32_t u32GenCmpReg, uint32_t u32CmpVal);
  674. /* Timer6 set special compare register(A~F) */
  675. void TMR6_SetSpecialCmpReg(M4_TMR6_TypeDef *TMR6x, uint32_t u32SpecialCmpReg, uint32_t u32CmpVal);
  676. /* Timer6 set dead time registerr */
  677. void TMR6_SetDeadTimeReg(M4_TMR6_TypeDef *TMR6x, uint32_t u32DeadTimeReg, uint32_t u32CmpVal);
  678. /* Timer6 get counter register value */
  679. uint32_t TMR6_GetCntReg(const M4_TMR6_TypeDef *TMR6x);
  680. /* Timer6 get update register value */
  681. uint32_t TMR6_GetUpdateReg(const M4_TMR6_TypeDef *TMR6x);
  682. /* Timer6 Get period register(A~C) */
  683. uint32_t TMR6_GetPeriodReg(const M4_TMR6_TypeDef *TMR6x, uint32_t u32PeriodReg);
  684. /* Timer6 get general compare registers value(A~F) */
  685. uint32_t TMR6_GetGenCmpReg(const M4_TMR6_TypeDef *TMR6x, uint32_t u32GenCmpReg);
  686. /* Timer6 get special compare registers value(A~F) */
  687. uint32_t TMR6_GetSpecialCmpReg(const M4_TMR6_TypeDef *TMR6x, uint32_t u32SpecialCmpReg);
  688. /* Timer6 get dead time register */
  689. uint32_t TMR6_GetDeadTimeReg(const M4_TMR6_TypeDef *TMR6x, uint32_t u32DeadTimeReg);
  690. /* Timer6 general compare buffer function configuration */
  691. en_result_t TMR6_GenCmpBufCfg(M4_TMR6_TypeDef *TMR6x, uint32_t u32CmpChIdx, const stc_tmr6_buf_func_cfg_t* pstcGenBufCfg);
  692. /* Timer6 special compare buffer function configuration */
  693. en_result_t TMR6_SpecialCmpBufCfg(M4_TMR6_TypeDef *TMR6x, uint32_t u32CmpChIdx, const stc_tmr6_buf_func_cfg_t* pstcSpecialBufCfg);
  694. /* Timer6 period buffer function configuration */
  695. en_result_t TMR6_PeriodBufCfg(M4_TMR6_TypeDef *TMR6x, const stc_tmr6_buf_func_cfg_t* pstcPeriodBufCfg);
  696. /* Timer6 valid period function configuration for special compare function */
  697. en_result_t TMR6_ValidPeriodCfg(M4_TMR6_TypeDef *TMR6x, const stc_tmr6_valid_period_func_cfg_t* pstcValidPeriodCfg);
  698. /* Port input configuration(Trig) */
  699. en_result_t TMR6_PortInputConfig(M4_TMR6_TypeDef *TMR6x,
  700. uint32_t u32PortSel,
  701. const stc_tmr6_port_input_cfg_t* pstcTmr6PortInputCfg);
  702. /* Port output configuration(Trig) */
  703. en_result_t TMR6_PortOutputConfig(M4_TMR6_TypeDef *TMR6x,
  704. uint32_t u32PortSel,
  705. const stc_tmr6_port_output_cfg_t* pstcTmr6PortOutputCfg);
  706. /* EMB function configuration */
  707. en_result_t TMR6_EMBConfig(M4_TMR6_TypeDef *TMR6x,
  708. uint32_t u32PortSel,
  709. const stc_tmr6_emb_cfg_t* pstcTmr6EmbCfg);
  710. /* Timer6 dead time function command */
  711. void TMR6_DeadTimeFuncCmd(M4_TMR6_TypeDef *TMR6x, en_functional_state_t enNewState);
  712. /* DeadTime function configuration */
  713. en_result_t TMR6_DeadTimeCfg(M4_TMR6_TypeDef *TMR6x, const stc_tmr6_deadtime_cfg_t* pstcTmr6DTCfg);
  714. /* Timer6 unit Z phase input mask config */
  715. en_result_t TMR6_ZMaskCfg(M4_TMR6_TypeDef *TMR6x, const stc_tmr6_zmask_cfg_t* pstcTmr6ZMaskCfg);
  716. /* Software Sync Start */
  717. void TMR6_SwSyncStart(uint32_t u32UnitCombine);
  718. /* Software Sync Stop */
  719. void TMR6_SwSyncStop(uint32_t u32UnitCombine);
  720. /* Software Sync clear */
  721. void TMR6_SwSyncClr(uint32_t u32UnitCombine);
  722. /* Software Sync update */
  723. void TMR6_SwSyncUpdate(uint32_t u32UnitCombine);
  724. /* Hardware start function command */
  725. void TMR6_HwStartFuncCmd(M4_TMR6_TypeDef *TMR6x, en_functional_state_t enNewState);
  726. /* Hardware stop function command */
  727. void TMR6_HwStopFuncCmd(M4_TMR6_TypeDef *TMR6x, en_functional_state_t enNewState);
  728. /* Hardware clear function command */
  729. void TMR6_HwClrFuncCmd(M4_TMR6_TypeDef *TMR6x, en_functional_state_t enNewState);
  730. /* Hardware update function command */
  731. void TMR6_HwUpdateFuncCmd(M4_TMR6_TypeDef *TMR6x, en_functional_state_t enNewState);
  732. /* Hardware start condtion command */
  733. void TMR6_HwStartCondCmd(M4_TMR6_TypeDef *TMR6x,
  734. uint32_t u32CondSrc,
  735. en_functional_state_t enNewState);
  736. /* Hardware stop condtion command */
  737. void TMR6_HwStopCondCmd(M4_TMR6_TypeDef *TMR6x,
  738. uint32_t u32CondSrc,
  739. en_functional_state_t enNewState);
  740. /* Hardware clear condtion command */
  741. void TMR6_HwClrCondCmd(M4_TMR6_TypeDef *TMR6x,
  742. uint32_t u32CondSrc,
  743. en_functional_state_t enNewState);
  744. /* Hardware update condtion command */
  745. void TMR6_HwUpdCondCmd(M4_TMR6_TypeDef *TMR6x,
  746. uint32_t u32CondSrc,
  747. en_functional_state_t enNewState);
  748. /* Hardware capture condtion command for channel A */
  749. void TMR6_HwCaptureChACondCmd(M4_TMR6_TypeDef *TMR6x,
  750. uint32_t u32CondSrc,
  751. en_functional_state_t enNewState);
  752. /* Hardware capture condtion command for channel B */
  753. void TMR6_HwCaptureChBCondCmd(M4_TMR6_TypeDef *TMR6x,
  754. uint32_t u32CondSrc,
  755. en_functional_state_t enNewState);
  756. /* Hardware increase conditon command */
  757. void TMR6_HwIncreaseCondCmd(M4_TMR6_TypeDef *TMR6x,
  758. uint32_t u32CondSrc,
  759. en_functional_state_t enNewState);
  760. /* Hardware decrease conditon command */
  761. void TMR6_HwDecreaseCondCmd(M4_TMR6_TypeDef *TMR6x,
  762. uint32_t u32CondSrc,
  763. en_functional_state_t enNewState);
  764. /* Hardware start function condition clear */
  765. void TMR6_HwStartCondClr(M4_TMR6_TypeDef *TMR6x);
  766. /* Hardware stop function condition clear */
  767. void TMR6_HwStopCondClr(M4_TMR6_TypeDef *TMR6x);
  768. /* Hardware clear function condition clear */
  769. void TMR6_HwClrCondClr(M4_TMR6_TypeDef *TMR6x);
  770. /* Hardware update function condition clear */
  771. void TMR6_HwUpdCondClr(M4_TMR6_TypeDef *TMR6x);
  772. /* Hardware capture condition clear for channel A */
  773. void TMR6_HwCaptureChACondClr(M4_TMR6_TypeDef *TMR6x);
  774. /* Hardware capture condition clear for channel B */
  775. void TMR6_HwCaptureChBCondClr(M4_TMR6_TypeDef *TMR6x);
  776. /* Hardware increase condition clear */
  777. void TMR6_HwIncreaseCondClr(M4_TMR6_TypeDef *TMR6x);
  778. /* Hardware decrease condition clear */
  779. void TMR6_HwDecreaseCondClr(M4_TMR6_TypeDef *TMR6x);
  780. /* Timer6 Hardware trigger event configuration for(trigger0~trigger3) */
  781. void TMR6_SetTriggerSrc(uint32_t u32TrigIndex, en_event_src_t enEvent);
  782. /* Timer6 Hardware trigger common event function command for(trigger0~trigger3) */
  783. void TMR6_ComTriggerCmd(uint32_t u32TrigIndex, uint32_t u32ComTrig, en_functional_state_t enNewState);
  784. /* Set the fields of structure stc_timer4_pwm_init_t to default values */
  785. en_result_t TMR6_BaseCntStructInit(stc_tmr6_basecnt_cfg_t *pstcInit);
  786. /* Set the fields of structure stc_tmr6_buf_func_cfg_t to default values */
  787. en_result_t TMR6_BufFuncStructInit(stc_tmr6_buf_func_cfg_t *pstcInit);
  788. /* Set the fields of structure stc_tmr6_valid_period_func_cfg_t to default values */
  789. en_result_t TMR6_ValidPeriodStructInit(stc_tmr6_valid_period_func_cfg_t *pstcInit);
  790. /* Set the fields of structure stc_tmr6_port_input_cfg_t to default values */
  791. en_result_t TMR6_PortInputStructInit(stc_tmr6_port_input_cfg_t *pstcInit);
  792. /* Set the fields of structure stc_tmr6_port_output_cfg_t to default values */
  793. en_result_t TMR6_PortOutputStructInit(stc_tmr6_port_output_cfg_t *pstcInit);
  794. /* Set the fields of structure stc_tmr6_emb_cfg_t to default values */
  795. en_result_t TMR6_EMBCfgStructInit(stc_tmr6_emb_cfg_t *pstcInit);
  796. /* Set the fields of structure stc_tmr6_deadtime_cfg_t to default values */
  797. en_result_t TMR6_DeadTimeCfgStructInit(stc_tmr6_deadtime_cfg_t *pstcInit);
  798. /* Set the fields of structure stc_tmr6_zmask_cfg_t to default values */
  799. en_result_t TMR6_ZMaskCfgStructInit(stc_tmr6_zmask_cfg_t *pstcInit);
  800. /**
  801. * @}
  802. */
  803. #endif /* DDL_TMR6_ENABLE */
  804. /**
  805. * @}
  806. */
  807. /**
  808. * @}
  809. */
  810. #ifdef __cplusplus
  811. }
  812. #endif
  813. #endif /* __HC32F4A0_TMR6_H__ */
  814. /*******************************************************************************
  815. * EOF (not truncated)
  816. ******************************************************************************/