at32f423_tmr.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. /**
  2. **************************************************************************
  3. * @file at32f423_tmr.h
  4. * @brief at32f423 tmr header file
  5. **************************************************************************
  6. * Copyright notice & Disclaimer
  7. *
  8. * The software Board Support Package (BSP) that is made available to
  9. * download from Artery official website is the copyrighted work of Artery.
  10. * Artery authorizes customers to use, copy, and distribute the BSP
  11. * software and its related documentation for the purpose of design and
  12. * development in conjunction with Artery microcontrollers. Use of the
  13. * software is governed by this copyright notice and the following disclaimer.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  16. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  17. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  18. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  19. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  21. *
  22. **************************************************************************
  23. */
  24. /* define to prevent recursive inclusion -------------------------------------*/
  25. #ifndef __AT32F423_TMR_H
  26. #define __AT32F423_TMR_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* includes ------------------------------------------------------------------*/
  31. #include "at32f423.h"
  32. /** @addtogroup AT32F423_periph_driver
  33. * @{
  34. */
  35. /** @addtogroup TMR
  36. * @{
  37. */
  38. /** @defgroup TMR_flags_definition
  39. * @brief tmr flag
  40. * @{
  41. */
  42. #define TMR_OVF_FLAG ((uint32_t)0x000001) /*!< tmr flag overflow */
  43. #define TMR_C1_FLAG ((uint32_t)0x000002) /*!< tmr flag channel 1 */
  44. #define TMR_C2_FLAG ((uint32_t)0x000004) /*!< tmr flag channel 2 */
  45. #define TMR_C3_FLAG ((uint32_t)0x000008) /*!< tmr flag channel 3 */
  46. #define TMR_C4_FLAG ((uint32_t)0x000010) /*!< tmr flag channel 4 */
  47. #define TMR_C5_FLAG ((uint32_t)0x010000) /*!< tmr flag channel 5 */
  48. #define TMR_HALL_FLAG ((uint32_t)0x000020) /*!< tmr flag hall */
  49. #define TMR_TRIGGER_FLAG ((uint32_t)0x000040) /*!< tmr flag trigger */
  50. #define TMR_BRK_FLAG ((uint32_t)0x000080) /*!< tmr flag brake */
  51. #define TMR_C1_RECAPTURE_FLAG ((uint32_t)0x000200) /*!< tmr flag channel 1 recapture */
  52. #define TMR_C2_RECAPTURE_FLAG ((uint32_t)0x000400) /*!< tmr flag channel 2 recapture */
  53. #define TMR_C3_RECAPTURE_FLAG ((uint32_t)0x000800) /*!< tmr flag channel 3 recapture */
  54. #define TMR_C4_RECAPTURE_FLAG ((uint32_t)0x001000) /*!< tmr flag channel 4 recapture */
  55. /**
  56. * @}
  57. */
  58. /** @defgroup TMR_interrupt_select_type_definition
  59. * @brief tmr interrupt select type
  60. * @{
  61. */
  62. #define TMR_OVF_INT ((uint32_t)0x000001) /*!< tmr interrupt overflow */
  63. #define TMR_C1_INT ((uint32_t)0x000002) /*!< tmr interrupt channel 1 */
  64. #define TMR_C2_INT ((uint32_t)0x000004) /*!< tmr interrupt channel 2 */
  65. #define TMR_C3_INT ((uint32_t)0x000008) /*!< tmr interrupt channel 3 */
  66. #define TMR_C4_INT ((uint32_t)0x000010) /*!< tmr interrupt channel 4 */
  67. #define TMR_HALL_INT ((uint32_t)0x000020) /*!< tmr interrupt hall */
  68. #define TMR_TRIGGER_INT ((uint32_t)0x000040) /*!< tmr interrupt trigger */
  69. #define TMR_BRK_INT ((uint32_t)0x000080) /*!< tmr interrupt brake */
  70. /**
  71. * @}
  72. */
  73. /** @defgroup TMR_exported_types
  74. * @{
  75. */
  76. /**
  77. * @brief tmr clock division type
  78. */
  79. typedef enum
  80. {
  81. TMR_CLOCK_DIV1 = 0x00, /*!< tmr clock division 1 */
  82. TMR_CLOCK_DIV2 = 0x01, /*!< tmr clock division 2 */
  83. TMR_CLOCK_DIV4 = 0x02 /*!< tmr clock division 4 */
  84. } tmr_clock_division_type;
  85. /**
  86. * @brief tmr counter mode type
  87. */
  88. typedef enum
  89. {
  90. TMR_COUNT_UP = 0x00, /*!< tmr counter mode up */
  91. TMR_COUNT_DOWN = 0x01, /*!< tmr counter mode down */
  92. TMR_COUNT_TWO_WAY_1 = 0x02, /*!< tmr counter mode two way 1 */
  93. TMR_COUNT_TWO_WAY_2 = 0x04, /*!< tmr counter mode two way 2 */
  94. TMR_COUNT_TWO_WAY_3 = 0x06 /*!< tmr counter mode two way 3 */
  95. } tmr_count_mode_type;
  96. /**
  97. * @brief tmr primary mode select type
  98. */
  99. typedef enum
  100. {
  101. TMR_PRIMARY_SEL_RESET = 0x00, /*!< tmr primary mode select reset */
  102. TMR_PRIMARY_SEL_ENABLE = 0x01, /*!< tmr primary mode select enable */
  103. TMR_PRIMARY_SEL_OVERFLOW = 0x02, /*!< tmr primary mode select overflow */
  104. TMR_PRIMARY_SEL_COMPARE = 0x03, /*!< tmr primary mode select compare */
  105. TMR_PRIMARY_SEL_C1ORAW = 0x04, /*!< tmr primary mode select c1oraw */
  106. TMR_PRIMARY_SEL_C2ORAW = 0x05, /*!< tmr primary mode select c2oraw */
  107. TMR_PRIMARY_SEL_C3ORAW = 0x06, /*!< tmr primary mode select c3oraw */
  108. TMR_PRIMARY_SEL_C4ORAW = 0x07 /*!< tmr primary mode select c4oraw */
  109. } tmr_primary_select_type;
  110. /**
  111. * @brief tmr subordinate mode input select type
  112. */
  113. typedef enum
  114. {
  115. TMR_SUB_INPUT_SEL_IS0 = 0x00, /*!< subordinate mode input select is0 */
  116. TMR_SUB_INPUT_SEL_IS1 = 0x01, /*!< subordinate mode input select is1 */
  117. TMR_SUB_INPUT_SEL_IS2 = 0x02, /*!< subordinate mode input select is2 */
  118. TMR_SUB_INPUT_SEL_IS3 = 0x03, /*!< subordinate mode input select is3 */
  119. TMR_SUB_INPUT_SEL_C1INC = 0x04, /*!< subordinate mode input select c1inc */
  120. TMR_SUB_INPUT_SEL_C1DF1 = 0x05, /*!< subordinate mode input select c1df1 */
  121. TMR_SUB_INPUT_SEL_C2DF2 = 0x06, /*!< subordinate mode input select c2df2 */
  122. TMR_SUB_INPUT_SEL_EXTIN = 0x07 /*!< subordinate mode input select extin */
  123. } sub_tmr_input_sel_type;
  124. /**
  125. * @brief tmr subordinate mode select type
  126. */
  127. typedef enum
  128. {
  129. TMR_SUB_MODE_DIABLE = 0x00, /*!< subordinate mode disable */
  130. TMR_SUB_ENCODER_MODE_A = 0x01, /*!< subordinate mode select encoder mode a */
  131. TMR_SUB_ENCODER_MODE_B = 0x02, /*!< subordinate mode select encoder mode b */
  132. TMR_SUB_ENCODER_MODE_C = 0x03, /*!< subordinate mode select encoder mode c */
  133. TMR_SUB_RESET_MODE = 0x04, /*!< subordinate mode select reset */
  134. TMR_SUB_HANG_MODE = 0x05, /*!< subordinate mode select hang */
  135. TMR_SUB_TRIGGER_MODE = 0x06, /*!< subordinate mode select trigger */
  136. TMR_SUB_EXTERNAL_CLOCK_MODE_A = 0x07 /*!< subordinate mode external clock mode a */
  137. } tmr_sub_mode_select_type;
  138. /**
  139. * @brief tmr encoder mode type
  140. */
  141. typedef enum
  142. {
  143. TMR_ENCODER_MODE_A = TMR_SUB_ENCODER_MODE_A, /*!< tmr encoder mode a */
  144. TMR_ENCODER_MODE_B = TMR_SUB_ENCODER_MODE_B, /*!< tmr encoder mode b */
  145. TMR_ENCODER_MODE_C = TMR_SUB_ENCODER_MODE_C /*!< tmr encoder mode c */
  146. } tmr_encoder_mode_type;
  147. /**
  148. * @brief tmr output control mode type
  149. */
  150. typedef enum
  151. {
  152. TMR_OUTPUT_CONTROL_OFF = 0x00, /*!< tmr output control mode off */
  153. TMR_OUTPUT_CONTROL_HIGH = 0x01, /*!< tmr output control mode high */
  154. TMR_OUTPUT_CONTROL_LOW = 0x02, /*!< tmr output control mode low */
  155. TMR_OUTPUT_CONTROL_SWITCH = 0x03, /*!< tmr output control mode switch */
  156. TMR_OUTPUT_CONTROL_FORCE_LOW = 0x04, /*!< tmr output control mode force low */
  157. TMR_OUTPUT_CONTROL_FORCE_HIGH = 0x05, /*!< tmr output control mode force high */
  158. TMR_OUTPUT_CONTROL_PWM_MODE_A = 0x06, /*!< tmr output control mode pwm a */
  159. TMR_OUTPUT_CONTROL_PWM_MODE_B = 0x07 /*!< tmr output control mode pwm b */
  160. } tmr_output_control_mode_type;
  161. /**
  162. * @brief tmr force output type
  163. */
  164. typedef enum
  165. {
  166. TMR_FORCE_OUTPUT_HIGH = TMR_OUTPUT_CONTROL_FORCE_HIGH, /*!< tmr force output high */
  167. TMR_FORCE_OUTPUT_LOW = TMR_OUTPUT_CONTROL_FORCE_LOW /*!< tmr force output low */
  168. } tmr_force_output_type;
  169. /**
  170. * @brief tmr output channel polarity type
  171. */
  172. typedef enum
  173. {
  174. TMR_OUTPUT_ACTIVE_HIGH = 0x00, /*!< tmr output channel polarity high */
  175. TMR_OUTPUT_ACTIVE_LOW = 0x01 /*!< tmr output channel polarity low */
  176. } tmr_output_polarity_type;
  177. /**
  178. * @brief tmr input channel polarity type
  179. */
  180. typedef enum
  181. {
  182. TMR_INPUT_RISING_EDGE = 0x00, /*!< tmr input channel polarity rising */
  183. TMR_INPUT_FALLING_EDGE = 0x01, /*!< tmr input channel polarity falling */
  184. TMR_INPUT_BOTH_EDGE = 0x03 /*!< tmr input channel polarity both edge */
  185. } tmr_input_polarity_type;
  186. /**
  187. * @brief tmr channel select type
  188. */
  189. typedef enum
  190. {
  191. TMR_SELECT_CHANNEL_1 = 0x00, /*!< tmr channel select channel 1 */
  192. TMR_SELECT_CHANNEL_1C = 0x01, /*!< tmr channel select channel 1 complementary */
  193. TMR_SELECT_CHANNEL_2 = 0x02, /*!< tmr channel select channel 2 */
  194. TMR_SELECT_CHANNEL_2C = 0x03, /*!< tmr channel select channel 2 complementary */
  195. TMR_SELECT_CHANNEL_3 = 0x04, /*!< tmr channel select channel 3 */
  196. TMR_SELECT_CHANNEL_3C = 0x05, /*!< tmr channel select channel 3 complementary */
  197. TMR_SELECT_CHANNEL_4 = 0x06, /*!< tmr channel select channel 4 */
  198. TMR_SELECT_CHANNEL_5 = 0x07 /*!< tmr channel select channel 5 */
  199. } tmr_channel_select_type;
  200. /**
  201. * @brief tmr channel1 input connected type
  202. */
  203. typedef enum
  204. {
  205. TMR_CHANEL1_CONNECTED_C1IRAW = 0x00, /*!< channel1 pins is only connected to C1IRAW input */
  206. TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR = 0x01 /*!< channel1/2/3 pins are connected to C1IRAW input after xored */
  207. } tmr_channel1_input_connected_type;
  208. /**
  209. * @brief tmr input channel mapped type channel direction
  210. */
  211. typedef enum
  212. {
  213. TMR_CC_CHANNEL_MAPPED_DIRECT = 0x01, /*!< channel is configured as input, mapped direct */
  214. TMR_CC_CHANNEL_MAPPED_INDIRECT = 0x02, /*!< channel is configured as input, mapped indirect */
  215. TMR_CC_CHANNEL_MAPPED_STI = 0x03 /*!< channel is configured as input, mapped trc */
  216. } tmr_input_direction_mapped_type;
  217. /**
  218. * @brief tmr input divider type
  219. */
  220. typedef enum
  221. {
  222. TMR_CHANNEL_INPUT_DIV_1 = 0x00, /*!< tmr channel input divider 1 */
  223. TMR_CHANNEL_INPUT_DIV_2 = 0x01, /*!< tmr channel input divider 2 */
  224. TMR_CHANNEL_INPUT_DIV_4 = 0x02, /*!< tmr channel input divider 4 */
  225. TMR_CHANNEL_INPUT_DIV_8 = 0x03 /*!< tmr channel input divider 8 */
  226. } tmr_channel_input_divider_type;
  227. /**
  228. * @brief tmr dma request source select type
  229. */
  230. typedef enum
  231. {
  232. TMR_DMA_REQUEST_BY_CHANNEL = 0x00, /*!< tmr dma request source select channel */
  233. TMR_DMA_REQUEST_BY_OVERFLOW = 0x01 /*!< tmr dma request source select overflow */
  234. } tmr_dma_request_source_type;
  235. /**
  236. * @brief tmr dma request type
  237. */
  238. typedef enum
  239. {
  240. TMR_OVERFLOW_DMA_REQUEST = 0x00000100, /*!< tmr dma request select overflow */
  241. TMR_C1_DMA_REQUEST = 0x00000200, /*!< tmr dma request select channel 1 */
  242. TMR_C2_DMA_REQUEST = 0x00000400, /*!< tmr dma request select channel 2 */
  243. TMR_C3_DMA_REQUEST = 0x00000800, /*!< tmr dma request select channel 3 */
  244. TMR_C4_DMA_REQUEST = 0x00001000, /*!< tmr dma request select channel 4 */
  245. TMR_HALL_DMA_REQUEST = 0x00002000, /*!< tmr dma request select hall */
  246. TMR_TRIGGER_DMA_REQUEST = 0x00004000 /*!< tmr dma request select trigger */
  247. } tmr_dma_request_type;
  248. /**
  249. * @brief tmr event triggered by software type
  250. */
  251. typedef enum
  252. {
  253. TMR_OVERFLOW_SWTRIG = 0x00000001, /*!< tmr event triggered by software of overflow */
  254. TMR_C1_SWTRIG = 0x00000002, /*!< tmr event triggered by software of channel 1 */
  255. TMR_C2_SWTRIG = 0x00000004, /*!< tmr event triggered by software of channel 2 */
  256. TMR_C3_SWTRIG = 0x00000008, /*!< tmr event triggered by software of channel 3 */
  257. TMR_C4_SWTRIG = 0x00000010, /*!< tmr event triggered by software of channel 4 */
  258. TMR_HALL_SWTRIG = 0x00000020, /*!< tmr event triggered by software of hall */
  259. TMR_TRIGGER_SWTRIG = 0x00000040, /*!< tmr event triggered by software of trigger */
  260. TMR_BRK_SWTRIG = 0x00000080 /*!< tmr event triggered by software of brake */
  261. }tmr_event_trigger_type;
  262. /**
  263. * @brief tmr polarity active type
  264. */
  265. typedef enum
  266. {
  267. TMR_POLARITY_ACTIVE_HIGH = 0x00, /*!< tmr polarity active high */
  268. TMR_POLARITY_ACTIVE_LOW = 0x01, /*!< tmr polarity active low */
  269. TMR_POLARITY_ACTIVE_BOTH = 0x02 /*!< tmr polarity active both high ande low */
  270. }tmr_polarity_active_type;
  271. /**
  272. * @brief tmr external signal divider type
  273. */
  274. typedef enum
  275. {
  276. TMR_ES_FREQUENCY_DIV_1 = 0x00, /*!< tmr external signal frequency divider 1 */
  277. TMR_ES_FREQUENCY_DIV_2 = 0x01, /*!< tmr external signal frequency divider 2 */
  278. TMR_ES_FREQUENCY_DIV_4 = 0x02, /*!< tmr external signal frequency divider 4 */
  279. TMR_ES_FREQUENCY_DIV_8 = 0x03 /*!< tmr external signal frequency divider 8 */
  280. }tmr_external_signal_divider_type;
  281. /**
  282. * @brief tmr external signal polarity type
  283. */
  284. typedef enum
  285. {
  286. TMR_ES_POLARITY_NON_INVERTED = 0x00, /*!< tmr external signal polarity non-inerted */
  287. TMR_ES_POLARITY_INVERTED = 0x01 /*!< tmr external signal polarity inerted */
  288. }tmr_external_signal_polarity_type;
  289. /**
  290. * @brief tmr dma transfer length type
  291. */
  292. typedef enum
  293. {
  294. TMR_DMA_TRANSFER_1BYTE = 0x00, /*!< tmr dma transfer length 1 byte */
  295. TMR_DMA_TRANSFER_2BYTES = 0x01, /*!< tmr dma transfer length 2 bytes */
  296. TMR_DMA_TRANSFER_3BYTES = 0x02, /*!< tmr dma transfer length 3 bytes */
  297. TMR_DMA_TRANSFER_4BYTES = 0x03, /*!< tmr dma transfer length 4 bytes */
  298. TMR_DMA_TRANSFER_5BYTES = 0x04, /*!< tmr dma transfer length 5 bytes */
  299. TMR_DMA_TRANSFER_6BYTES = 0x05, /*!< tmr dma transfer length 6 bytes */
  300. TMR_DMA_TRANSFER_7BYTES = 0x06, /*!< tmr dma transfer length 7 bytes */
  301. TMR_DMA_TRANSFER_8BYTES = 0x07, /*!< tmr dma transfer length 8 bytes */
  302. TMR_DMA_TRANSFER_9BYTES = 0x08, /*!< tmr dma transfer length 9 bytes */
  303. TMR_DMA_TRANSFER_10BYTES = 0x09, /*!< tmr dma transfer length 10 bytes */
  304. TMR_DMA_TRANSFER_11BYTES = 0x0A, /*!< tmr dma transfer length 11 bytes */
  305. TMR_DMA_TRANSFER_12BYTES = 0x0B, /*!< tmr dma transfer length 12 bytes */
  306. TMR_DMA_TRANSFER_13BYTES = 0x0C, /*!< tmr dma transfer length 13 bytes */
  307. TMR_DMA_TRANSFER_14BYTES = 0x0D, /*!< tmr dma transfer length 14 bytes */
  308. TMR_DMA_TRANSFER_15BYTES = 0x0E, /*!< tmr dma transfer length 15 bytes */
  309. TMR_DMA_TRANSFER_16BYTES = 0x0F, /*!< tmr dma transfer length 16 bytes */
  310. TMR_DMA_TRANSFER_17BYTES = 0x10, /*!< tmr dma transfer length 17 bytes */
  311. TMR_DMA_TRANSFER_18BYTES = 0x11 /*!< tmr dma transfer length 18 bytes */
  312. }tmr_dma_transfer_length_type;
  313. /**
  314. * @brief tmr dma base address type
  315. */
  316. typedef enum
  317. {
  318. TMR_CTRL1_ADDRESS = 0x0000, /*!< tmr dma base address ctrl1 */
  319. TMR_CTRL2_ADDRESS = 0x0001, /*!< tmr dma base address ctrl2 */
  320. TMR_STCTRL_ADDRESS = 0x0002, /*!< tmr dma base address stctrl */
  321. TMR_IDEN_ADDRESS = 0x0003, /*!< tmr dma base address iden */
  322. TMR_ISTS_ADDRESS = 0x0004, /*!< tmr dma base address ists */
  323. TMR_SWEVT_ADDRESS = 0x0005, /*!< tmr dma base address swevt */
  324. TMR_CM1_ADDRESS = 0x0006, /*!< tmr dma base address cm1 */
  325. TMR_CM2_ADDRESS = 0x0007, /*!< tmr dma base address cm2 */
  326. TMR_CCTRL_ADDRESS = 0x0008, /*!< tmr dma base address cctrl */
  327. TMR_CVAL_ADDRESS = 0x0009, /*!< tmr dma base address cval */
  328. TMR_DIV_ADDRESS = 0x000A, /*!< tmr dma base address div */
  329. TMR_PR_ADDRESS = 0x000B, /*!< tmr dma base address pr */
  330. TMR_RPR_ADDRESS = 0x000C, /*!< tmr dma base address rpr */
  331. TMR_C1DT_ADDRESS = 0x000D, /*!< tmr dma base address c1dt */
  332. TMR_C2DT_ADDRESS = 0x000E, /*!< tmr dma base address c2dt */
  333. TMR_C3DT_ADDRESS = 0x000F, /*!< tmr dma base address c3dt */
  334. TMR_C4DT_ADDRESS = 0x0010, /*!< tmr dma base address c4dt */
  335. TMR_BRK_ADDRESS = 0x0011, /*!< tmr dma base address brake */
  336. TMR_DMACTRL_ADDRESS = 0x0012 /*!< tmr dma base address dmactrl */
  337. }tmr_dma_address_type;
  338. /**
  339. * @brief tmr brk polarity type
  340. */
  341. typedef enum
  342. {
  343. TMR_BRK_INPUT_ACTIVE_LOW = 0x00, /*!< tmr brk input channel active low */
  344. TMR_BRK_INPUT_ACTIVE_HIGH = 0x01 /*!< tmr brk input channel active high */
  345. }tmr_brk_polarity_type;
  346. /**
  347. * @brief tmr write protect level type
  348. */
  349. typedef enum
  350. {
  351. TMR_WP_OFF = 0x00, /*!< tmr write protect off */
  352. TMR_WP_LEVEL_3 = 0x01, /*!< tmr write protect level 3 */
  353. TMR_WP_LEVEL_2 = 0x02, /*!< tmr write protect level 2 */
  354. TMR_WP_LEVEL_1 = 0x03 /*!< tmr write protect level 1 */
  355. }tmr_wp_level_type;
  356. /**
  357. * @brief tmr input remap type
  358. */
  359. typedef enum
  360. {
  361. TMR14_GPIO = 0x00, /*!< tmr14 input remap to gpio */
  362. TMR14_ERTCCLK = 0x01, /*!< tmr14 input remap to ertc clock */
  363. TMR14_HEXT_DIV32 = 0x02, /*!< tmr14 input remap to hext div32*/
  364. TMR14_CLKOUT = 0x03 /*!< tmr14 input remap to clkout */
  365. }tmr_input_remap_type ;
  366. /**
  367. * @brief tmr output config type
  368. */
  369. typedef struct
  370. {
  371. tmr_output_control_mode_type oc_mode; /*!< output channel mode */
  372. confirm_state oc_idle_state; /*!< output channel idle state */
  373. confirm_state occ_idle_state; /*!< output channel complementary idle state */
  374. tmr_output_polarity_type oc_polarity; /*!< output channel polarity */
  375. tmr_output_polarity_type occ_polarity; /*!< output channel complementary polarity */
  376. confirm_state oc_output_state; /*!< output channel enable */
  377. confirm_state occ_output_state; /*!< output channel complementary enable */
  378. } tmr_output_config_type;
  379. /**
  380. * @brief tmr input capture config type
  381. */
  382. typedef struct
  383. {
  384. tmr_channel_select_type input_channel_select; /*!< tmr input channel select */
  385. tmr_input_polarity_type input_polarity_select; /*!< tmr input polarity select */
  386. tmr_input_direction_mapped_type input_mapped_select; /*!< tmr channel mapped direct or indirect */
  387. uint8_t input_filter_value; /*!< tmr channel filter value */
  388. } tmr_input_config_type;
  389. /**
  390. * @brief tmr brkdt config type
  391. */
  392. typedef struct
  393. {
  394. uint8_t deadtime; /*!< dead-time generator setup */
  395. tmr_brk_polarity_type brk_polarity; /*!< tmr brake polarity */
  396. tmr_wp_level_type wp_level; /*!< write protect configuration */
  397. confirm_state auto_output_enable; /*!< automatic output enable */
  398. confirm_state fcsoen_state; /*!< frozen channel status when output enable */
  399. confirm_state fcsodis_state; /*!< frozen channel status when output disable */
  400. confirm_state brk_enable; /*!< tmr brk enale */
  401. } tmr_brkdt_config_type;
  402. /**
  403. * @brief type define tmr register all
  404. */
  405. typedef struct
  406. {
  407. /**
  408. * @brief tmr ctrl1 register, offset:0x00
  409. */
  410. union
  411. {
  412. __IO uint32_t ctrl1;
  413. struct
  414. {
  415. __IO uint32_t tmren : 1; /* [0] */
  416. __IO uint32_t ovfen : 1; /* [1] */
  417. __IO uint32_t ovfs : 1; /* [2] */
  418. __IO uint32_t ocmen : 1; /* [3] */
  419. __IO uint32_t cnt_dir : 3; /* [6:4] */
  420. __IO uint32_t prben : 1; /* [7] */
  421. __IO uint32_t clkdiv : 2; /* [9:8] */
  422. __IO uint32_t pmen : 1; /* [10] */
  423. __IO uint32_t reserved1 : 21;/* [31:11] */
  424. } ctrl1_bit;
  425. };
  426. /**
  427. * @brief tmr ctrl2 register, offset:0x04
  428. */
  429. union
  430. {
  431. __IO uint32_t ctrl2;
  432. struct
  433. {
  434. __IO uint32_t cbctrl : 1; /* [0] */
  435. __IO uint32_t reserved1 : 1; /* [1] */
  436. __IO uint32_t ccfs : 1; /* [2] */
  437. __IO uint32_t drs : 1; /* [3] */
  438. __IO uint32_t ptos : 3; /* [6:4] */
  439. __IO uint32_t c1insel : 1; /* [7] */
  440. __IO uint32_t c1ios : 1; /* [8] */
  441. __IO uint32_t c1cios : 1; /* [9] */
  442. __IO uint32_t c2ios : 1; /* [10] */
  443. __IO uint32_t c2cios : 1; /* [11] */
  444. __IO uint32_t c3ios : 1; /* [12] */
  445. __IO uint32_t c3cios : 1; /* [13] */
  446. __IO uint32_t c4ios : 1; /* [14] */
  447. __IO uint32_t reserved2 : 16;/* [30:15] */
  448. __IO uint32_t trgout2en : 1; /* [31] */
  449. } ctrl2_bit;
  450. };
  451. /**
  452. * @brief tmr smc register, offset:0x08
  453. */
  454. union
  455. {
  456. __IO uint32_t stctrl;
  457. struct
  458. {
  459. __IO uint32_t smsel : 3; /* [2:0] */
  460. __IO uint32_t reserved1 : 1; /* [3] */
  461. __IO uint32_t stis : 3; /* [6:4] */
  462. __IO uint32_t sts : 1; /* [7] */
  463. __IO uint32_t esf : 4; /* [11:8] */
  464. __IO uint32_t esdiv : 2; /* [13:12] */
  465. __IO uint32_t ecmben : 1; /* [14] */
  466. __IO uint32_t esp : 1; /* [15] */
  467. __IO uint32_t reserved2 : 16;/* [31:16] */
  468. } stctrl_bit;
  469. };
  470. /**
  471. * @brief tmr die register, offset:0x0C
  472. */
  473. union
  474. {
  475. __IO uint32_t iden;
  476. struct
  477. {
  478. __IO uint32_t ovfien : 1; /* [0] */
  479. __IO uint32_t c1ien : 1; /* [1] */
  480. __IO uint32_t c2ien : 1; /* [2] */
  481. __IO uint32_t c3ien : 1; /* [3] */
  482. __IO uint32_t c4ien : 1; /* [4] */
  483. __IO uint32_t hallien : 1; /* [5] */
  484. __IO uint32_t tien : 1; /* [6] */
  485. __IO uint32_t brkie : 1; /* [7] */
  486. __IO uint32_t ovfden : 1; /* [8] */
  487. __IO uint32_t c1den : 1; /* [9] */
  488. __IO uint32_t c2den : 1; /* [10] */
  489. __IO uint32_t c3den : 1; /* [11] */
  490. __IO uint32_t c4den : 1; /* [12] */
  491. __IO uint32_t hallde : 1; /* [13] */
  492. __IO uint32_t tden : 1; /* [14] */
  493. __IO uint32_t reserved1 : 17;/* [31:15] */
  494. } iden_bit;
  495. };
  496. /**
  497. * @brief tmr ists register, offset:0x10
  498. */
  499. union
  500. {
  501. __IO uint32_t ists;
  502. struct
  503. {
  504. __IO uint32_t ovfif : 1; /* [0] */
  505. __IO uint32_t c1if : 1; /* [1] */
  506. __IO uint32_t c2if : 1; /* [2] */
  507. __IO uint32_t c3if : 1; /* [3] */
  508. __IO uint32_t c4if : 1; /* [4] */
  509. __IO uint32_t hallif : 1; /* [5] */
  510. __IO uint32_t trgif : 1; /* [6] */
  511. __IO uint32_t brkif : 1; /* [7] */
  512. __IO uint32_t reserved1 : 1; /* [8] */
  513. __IO uint32_t c1rf : 1; /* [9] */
  514. __IO uint32_t c2rf : 1; /* [10] */
  515. __IO uint32_t c3rf : 1; /* [11] */
  516. __IO uint32_t c4rf : 1; /* [12] */
  517. __IO uint32_t reserved2 : 19;/* [31:13] */
  518. } ists_bit;
  519. };
  520. /**
  521. * @brief tmr eveg register, offset:0x14
  522. */
  523. union
  524. {
  525. __IO uint32_t swevt;
  526. struct
  527. {
  528. __IO uint32_t ovfswtr : 1; /* [0] */
  529. __IO uint32_t c1swtr : 1; /* [1] */
  530. __IO uint32_t c2swtr : 1; /* [2] */
  531. __IO uint32_t c3swtr : 1; /* [3] */
  532. __IO uint32_t c4swtr : 1; /* [4] */
  533. __IO uint32_t hallswtr : 1; /* [5] */
  534. __IO uint32_t trgswtr : 1; /* [6] */
  535. __IO uint32_t brkswtr : 1; /* [7] */
  536. __IO uint32_t reserved : 24;/* [31:8] */
  537. } swevt_bit;
  538. };
  539. /**
  540. * @brief tmr ccm1 register, offset:0x18
  541. */
  542. union
  543. {
  544. __IO uint32_t cm1;
  545. /**
  546. * @brief channel mode
  547. */
  548. struct
  549. {
  550. __IO uint32_t c1c : 2; /* [1:0] */
  551. __IO uint32_t c1oien : 1; /* [2] */
  552. __IO uint32_t c1oben : 1; /* [3] */
  553. __IO uint32_t c1octrl : 3; /* [6:4] */
  554. __IO uint32_t c1osen : 1; /* [7] */
  555. __IO uint32_t c2c : 2; /* [9:8] */
  556. __IO uint32_t c2oien : 1; /* [10] */
  557. __IO uint32_t c2oben : 1; /* [11] */
  558. __IO uint32_t c2octrl : 3; /* [14:12] */
  559. __IO uint32_t c2osen : 1; /* [15] */
  560. __IO uint32_t reserved1 : 16;/* [31:16] */
  561. } cm1_output_bit;
  562. /**
  563. * @brief input capture mode
  564. */
  565. struct
  566. {
  567. __IO uint32_t c1c : 2; /* [1:0] */
  568. __IO uint32_t c1idiv : 2; /* [3:2] */
  569. __IO uint32_t c1df : 4; /* [7:4] */
  570. __IO uint32_t c2c : 2; /* [9:8] */
  571. __IO uint32_t c2idiv : 2; /* [11:10] */
  572. __IO uint32_t c2df : 4; /* [15:12] */
  573. __IO uint32_t reserved1 : 16;/* [31:16] */
  574. } cm1_input_bit;
  575. };
  576. /**
  577. * @brief tmr ccm2 register, offset:0x1C
  578. */
  579. union
  580. {
  581. __IO uint32_t cm2;
  582. /**
  583. * @brief channel mode
  584. */
  585. struct
  586. {
  587. __IO uint32_t c3c : 2; /* [1:0] */
  588. __IO uint32_t c3oien : 1; /* [2] */
  589. __IO uint32_t c3oben : 1; /* [3] */
  590. __IO uint32_t c3octrl : 3; /* [6:4] */
  591. __IO uint32_t c3osen : 1; /* [7] */
  592. __IO uint32_t c4c : 2; /* [9:8] */
  593. __IO uint32_t c4oien : 1; /* [10] */
  594. __IO uint32_t c4oben : 1; /* [11] */
  595. __IO uint32_t c4octrl : 3; /* [14:12] */
  596. __IO uint32_t c4osen : 1; /* [15] */
  597. __IO uint32_t reserved1 : 16;/* [31:16] */
  598. } cm2_output_bit;
  599. /**
  600. * @brief input capture mode
  601. */
  602. struct
  603. {
  604. __IO uint32_t c3c : 2; /* [1:0] */
  605. __IO uint32_t c3idiv : 2; /* [3:2] */
  606. __IO uint32_t c3df : 4; /* [7:4] */
  607. __IO uint32_t c4c : 2; /* [9:8] */
  608. __IO uint32_t c4idiv : 2; /* [11:10] */
  609. __IO uint32_t c4df : 4; /* [15:12] */
  610. __IO uint32_t reserved1 : 16;/* [31:16] */
  611. } cm2_input_bit;
  612. };
  613. /**
  614. * @brief tmr cce register, offset:0x20
  615. */
  616. union
  617. {
  618. uint32_t cctrl;
  619. struct
  620. {
  621. __IO uint32_t c1en : 1; /* [0] */
  622. __IO uint32_t c1p : 1; /* [1] */
  623. __IO uint32_t c1cen : 1; /* [2] */
  624. __IO uint32_t c1cp : 1; /* [3] */
  625. __IO uint32_t c2en : 1; /* [4] */
  626. __IO uint32_t c2p : 1; /* [5] */
  627. __IO uint32_t c2cen : 1; /* [6] */
  628. __IO uint32_t c2cp : 1; /* [7] */
  629. __IO uint32_t c3en : 1; /* [8] */
  630. __IO uint32_t c3p : 1; /* [9] */
  631. __IO uint32_t c3cen : 1; /* [10] */
  632. __IO uint32_t c3cp : 1; /* [11] */
  633. __IO uint32_t c4en : 1; /* [12] */
  634. __IO uint32_t c4p : 1; /* [13] */
  635. __IO uint32_t reserved1 : 18;/* [31:14] */
  636. } cctrl_bit;
  637. };
  638. /**
  639. * @brief tmr cnt register, offset:0x24
  640. */
  641. union
  642. {
  643. __IO uint32_t cval;
  644. struct
  645. {
  646. __IO uint32_t cval : 32;/* [31:0] */
  647. } cval_bit;
  648. };
  649. /**
  650. * @brief tmr div, offset:0x28
  651. */
  652. union
  653. {
  654. __IO uint32_t div;
  655. struct
  656. {
  657. __IO uint32_t div : 16;/* [15:0] */
  658. __IO uint32_t reserved1 : 16;/* [31:16] */
  659. } div_bit;
  660. };
  661. /**
  662. * @brief tmr pr register, offset:0x2C
  663. */
  664. union
  665. {
  666. __IO uint32_t pr;
  667. struct
  668. {
  669. __IO uint32_t pr : 32;/* [31:0] */
  670. } pr_bit;
  671. };
  672. /**
  673. * @brief tmr rpr register, offset:0x30
  674. */
  675. union
  676. {
  677. __IO uint32_t rpr;
  678. struct
  679. {
  680. __IO uint32_t rpr : 16;/* [15:0] */
  681. __IO uint32_t reserved1 : 16;/* [31:16] */
  682. } rpr_bit;
  683. };
  684. /**
  685. * @brief tmr c1dt register, offset:0x34
  686. */
  687. union
  688. {
  689. uint32_t c1dt;
  690. struct
  691. {
  692. __IO uint32_t c1dt : 32;/* [31:0] */
  693. } c1dt_bit;
  694. };
  695. /**
  696. * @brief tmr c2dt register, offset:0x38
  697. */
  698. union
  699. {
  700. uint32_t c2dt;
  701. struct
  702. {
  703. __IO uint32_t c2dt : 32;/* [31:0] */
  704. } c2dt_bit;
  705. };
  706. /**
  707. * @brief tmr c3dt register, offset:0x3C
  708. */
  709. union
  710. {
  711. __IO uint32_t c3dt;
  712. struct
  713. {
  714. __IO uint32_t c3dt : 32;/* [31:0] */
  715. } c3dt_bit;
  716. };
  717. /**
  718. * @brief tmr c4dt register, offset:0x40
  719. */
  720. union
  721. {
  722. __IO uint32_t c4dt;
  723. struct
  724. {
  725. __IO uint32_t c4dt : 32;/* [31:0] */
  726. } c4dt_bit;
  727. };
  728. /**
  729. * @brief tmr brk register, offset:0x44
  730. */
  731. union
  732. {
  733. __IO uint32_t brk;
  734. struct
  735. {
  736. __IO uint32_t dtc : 8; /* [7:0] */
  737. __IO uint32_t wpc : 2; /* [9:8] */
  738. __IO uint32_t fcsodis : 1; /* [10] */
  739. __IO uint32_t fcsoen : 1; /* [11] */
  740. __IO uint32_t brken : 1; /* [12] */
  741. __IO uint32_t brkv : 1; /* [13] */
  742. __IO uint32_t aoen : 1; /* [14] */
  743. __IO uint32_t oen : 1; /* [15] */
  744. __IO uint32_t reserved1 : 16; /* [31:16] */
  745. } brk_bit;
  746. };
  747. /**
  748. * @brief tmr dmactrl register, offset:0x48
  749. */
  750. union
  751. {
  752. __IO uint32_t dmactrl;
  753. struct
  754. {
  755. __IO uint32_t addr : 5; /* [4:0] */
  756. __IO uint32_t reserved1 : 3; /* [7:5] */
  757. __IO uint32_t dtb : 5; /* [12:8] */
  758. __IO uint32_t reserved2 : 19;/* [31:13] */
  759. } dmactrl_bit;
  760. };
  761. /**
  762. * @brief tmr dmadt register, offset:0x4C
  763. */
  764. union
  765. {
  766. __IO uint32_t dmadt;
  767. struct
  768. {
  769. __IO uint32_t dmadt : 16;/* [15:0] */
  770. __IO uint32_t reserved1 : 16;/* [31:16] */
  771. } dmadt_bit;
  772. };
  773. /**
  774. * @brief tmr rmp register, offset:0x50
  775. */
  776. union
  777. {
  778. __IO uint32_t rmp;
  779. struct
  780. {
  781. __IO uint32_t tmr14_ch1_irmp : 2; /* [1:0] */
  782. __IO uint32_t reserved1 : 30;/* [31:2] */
  783. } rmp_bit;
  784. };
  785. /**
  786. * @brief tmr reserved0 register, offset:0x54-0x6C
  787. */
  788. __IO uint32_t reserved1[7];
  789. /**
  790. * @brief tmr cm3 register, offset:0x70
  791. */
  792. union
  793. {
  794. __IO uint32_t cm3;
  795. struct
  796. {
  797. __IO uint32_t reserved1 : 2; /* [1:0] */
  798. __IO uint32_t c5oien : 1; /* [2] */
  799. __IO uint32_t c5oben : 1; /* [3] */
  800. __IO uint32_t c5octrl : 3; /* [6:4] */
  801. __IO uint32_t c5osen : 1; /* [7] */
  802. __IO uint32_t reserved2 : 24;/* [31:8] */
  803. } cm3_output_bit;
  804. };
  805. /**
  806. * @brief tmr c5dt register, offset:0x74
  807. */
  808. union
  809. {
  810. __IO uint32_t c5dt;
  811. struct
  812. {
  813. __IO uint32_t c5dt : 32;/* [31:0] */
  814. } c5dt_bit;
  815. };
  816. } tmr_type;
  817. /**
  818. * @}
  819. */
  820. #define TMR1 ((tmr_type *) TMR1_BASE)
  821. #define TMR2 ((tmr_type *) TMR2_BASE)
  822. #define TMR3 ((tmr_type *) TMR3_BASE)
  823. #define TMR4 ((tmr_type *) TMR4_BASE)
  824. #define TMR6 ((tmr_type *) TMR6_BASE)
  825. #define TMR7 ((tmr_type *) TMR7_BASE)
  826. #define TMR9 ((tmr_type *) TMR9_BASE)
  827. #define TMR10 ((tmr_type *) TMR10_BASE)
  828. #define TMR11 ((tmr_type *) TMR11_BASE)
  829. #define TMR12 ((tmr_type *) TMR12_BASE)
  830. #define TMR13 ((tmr_type *) TMR13_BASE)
  831. #define TMR14 ((tmr_type *) TMR14_BASE)
  832. /** @defgroup TMR_exported_functions
  833. * @{
  834. */
  835. void tmr_reset(tmr_type *tmr_x);
  836. void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state);
  837. void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct);
  838. void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct);
  839. void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct);
  840. void tmr_base_init(tmr_type* tmr_x, uint32_t tmr_pr, uint32_t tmr_div);
  841. void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div);
  842. void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir);
  843. void tmr_repetition_counter_set(tmr_type *tmr_x, uint16_t tmr_rpr_value);
  844. void tmr_counter_value_set(tmr_type *tmr_x, uint32_t tmr_cnt_value);
  845. uint32_t tmr_counter_value_get(tmr_type *tmr_x);
  846. void tmr_div_value_set(tmr_type *tmr_x, uint32_t tmr_div_value);
  847. uint32_t tmr_div_value_get(tmr_type *tmr_x);
  848. void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  849. tmr_output_config_type *tmr_output_struct);
  850. void tmr_output_channel_mode_select(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  851. tmr_output_control_mode_type oc_mode);
  852. void tmr_period_value_set(tmr_type *tmr_x, uint32_t tmr_pr_value);
  853. uint32_t tmr_period_value_get(tmr_type *tmr_x);
  854. void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  855. uint32_t tmr_channel_value);
  856. uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel);
  857. void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state);
  858. void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  859. confirm_state new_state);
  860. void tmr_output_channel_immediately_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  861. confirm_state new_state);
  862. void tmr_output_channel_switch_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  863. confirm_state new_state);
  864. void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state);
  865. void tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state);
  866. void tmr_overflow_request_source_set(tmr_type *tmr_x, confirm_state new_state);
  867. void tmr_overflow_event_disable(tmr_type *tmr_x, confirm_state new_state);
  868. void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, \
  869. tmr_channel_input_divider_type divider_factor);
  870. void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state);
  871. void tmr_input_channel_filter_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  872. uint16_t filter_value);
  873. void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct, \
  874. tmr_channel_input_divider_type divider_factor);
  875. void tmr_channel1_input_select(tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect);
  876. void tmr_input_channel_divider_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  877. tmr_channel_input_divider_type divider_factor);
  878. void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode);
  879. void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode);
  880. void tmr_channel_dma_select(tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select);
  881. void tmr_hall_select(tmr_type *tmr_x, confirm_state new_state);
  882. void tmr_channel_buffer_enable(tmr_type *tmr_x, confirm_state new_state);
  883. void tmr_trgout2_enable(tmr_type *tmr_x, confirm_state new_state);
  884. void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select);
  885. void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state);
  886. void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state);
  887. void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state);
  888. flag_status tmr_flag_get(tmr_type *tmr_x, uint32_t tmr_flag);
  889. void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag);
  890. void tmr_event_sw_trigger(tmr_type *tmr_x, tmr_event_trigger_type tmr_event);
  891. void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state);
  892. void tmr_internal_clock_set(tmr_type *tmr_x);
  893. void tmr_output_channel_polarity_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  894. tmr_polarity_active_type oc_polarity);
  895. void tmr_external_clock_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, \
  896. tmr_external_signal_polarity_type es_polarity, uint16_t es_filter);
  897. void tmr_external_clock_mode1_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, \
  898. tmr_external_signal_polarity_type es_polarity, uint16_t es_filter);
  899. void tmr_external_clock_mode2_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, \
  900. tmr_external_signal_polarity_type es_polarity, uint16_t es_filter);
  901. void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type \
  902. ic1_polarity, tmr_input_polarity_type ic2_polarity);
  903. void tmr_force_output_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
  904. tmr_force_output_type force_output);
  905. void tmr_dma_control_config(tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, \
  906. tmr_dma_address_type dma_base_address);
  907. void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct);
  908. void tmr_iremap_config(tmr_type *tmr_x, tmr_input_remap_type input_remap);
  909. /**
  910. * @}
  911. */
  912. /**
  913. * @}
  914. */
  915. /**
  916. * @}
  917. */
  918. #ifdef __cplusplus
  919. }
  920. #endif
  921. #endif