at32f413_crm.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. /**
  2. **************************************************************************
  3. * @file at32f413_crm.h
  4. * @version v2.0.5
  5. * @date 2022-05-20
  6. * @brief at32f413 crm header file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  10. * The software Board Support Package (BSP) that is made available to
  11. * download from Artery official website is the copyrighted work of Artery.
  12. * Artery authorizes customers to use, copy, and distribute the BSP
  13. * software and its related documentation for the purpose of design and
  14. * development in conjunction with Artery microcontrollers. Use of the
  15. * software is governed by this copyright notice and the following disclaimer.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  18. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  19. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  20. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  21. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  23. *
  24. **************************************************************************
  25. */
  26. /* define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __AT32F413_CRM_H
  28. #define __AT32F413_CRM_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* includes ------------------------------------------------------------------*/
  33. #include "at32f413.h"
  34. /** @addtogroup AT32F413_periph_driver
  35. * @{
  36. */
  37. /** @addtogroup CRM
  38. * @{
  39. */
  40. #define CRM_REG(value) PERIPH_REG(CRM_BASE, value)
  41. #define CRM_REG_BIT(value) PERIPH_REG_BIT(value)
  42. /** @defgroup CRM_flags_definition
  43. * @brief crm flag
  44. * @{
  45. */
  46. #define CRM_HICK_STABLE_FLAG MAKE_VALUE(0x00, 1) /*!< high speed internal clock stable flag */
  47. #define CRM_HEXT_STABLE_FLAG MAKE_VALUE(0x00, 17) /*!< high speed external crystal stable flag */
  48. #define CRM_PLL_STABLE_FLAG MAKE_VALUE(0x00, 25) /*!< phase locking loop stable flag */
  49. #define CRM_LEXT_STABLE_FLAG MAKE_VALUE(0x20, 1) /*!< low speed external crystal stable flag */
  50. #define CRM_LICK_STABLE_FLAG MAKE_VALUE(0x24, 1) /*!< low speed internal clock stable flag */
  51. #define CRM_ALL_RESET_FLAG MAKE_VALUE(0x24, 24) /*!< all reset flag */
  52. #define CRM_NRST_RESET_FLAG MAKE_VALUE(0x24, 26) /*!< nrst pin reset flag */
  53. #define CRM_POR_RESET_FLAG MAKE_VALUE(0x24, 27) /*!< power on reset flag */
  54. #define CRM_SW_RESET_FLAG MAKE_VALUE(0x24, 28) /*!< software reset flag */
  55. #define CRM_WDT_RESET_FLAG MAKE_VALUE(0x24, 29) /*!< watchdog timer reset flag */
  56. #define CRM_WWDT_RESET_FLAG MAKE_VALUE(0x24, 30) /*!< window watchdog timer reset flag */
  57. #define CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x24, 31) /*!< low-power reset flag */
  58. #define CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x08, 0) /*!< low speed internal clock stable interrupt ready flag */
  59. #define CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x08, 1) /*!< low speed external crystal stable interrupt ready flag */
  60. #define CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x08, 2) /*!< high speed internal clock stable interrupt ready flag */
  61. #define CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x08, 3) /*!< high speed external crystal stable interrupt ready flag */
  62. #define CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x08, 4) /*!< phase locking loop stable interrupt ready flag */
  63. #define CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x08, 7) /*!< clock failure interrupt ready flag */
  64. /**
  65. * @}
  66. */
  67. /** @defgroup CRM_interrupts_definition
  68. * @brief crm interrupt
  69. * @{
  70. */
  71. #define CRM_LICK_STABLE_INT ((uint32_t)0x00000100) /*!< low speed internal clock stable interrupt */
  72. #define CRM_LEXT_STABLE_INT ((uint32_t)0x00000200) /*!< low speed external crystal stable interrupt */
  73. #define CRM_HICK_STABLE_INT ((uint32_t)0x00000400) /*!< high speed internal clock stable interrupt */
  74. #define CRM_HEXT_STABLE_INT ((uint32_t)0x00000800) /*!< high speed external crystal stable interrupt */
  75. #define CRM_PLL_STABLE_INT ((uint32_t)0x00001000) /*!< phase locking loop stable interrupt */
  76. #define CRM_CLOCK_FAILURE_INT ((uint32_t)0x00800000) /*!< clock failure interrupt */
  77. /**
  78. * @}
  79. */
  80. /** @defgroup CRM_exported_types
  81. * @{
  82. */
  83. /**
  84. * @brief crm periph clock
  85. */
  86. typedef enum
  87. {
  88. /* ahb periph */
  89. CRM_DMA1_PERIPH_CLOCK = MAKE_VALUE(0x14, 0), /*!< dma1 periph clock */
  90. CRM_DMA2_PERIPH_CLOCK = MAKE_VALUE(0x14, 1), /*!< dma2 periph clock */
  91. CRM_CRC_PERIPH_CLOCK = MAKE_VALUE(0x14, 6), /*!< crc periph clock */
  92. CRM_SDIO1_PERIPH_CLOCK = MAKE_VALUE(0x14, 10), /*!< sdio1 periph clock */
  93. /* apb2 periph */
  94. CRM_IOMUX_PERIPH_CLOCK = MAKE_VALUE(0x18, 0), /*!< iomux periph clock */
  95. CRM_GPIOA_PERIPH_CLOCK = MAKE_VALUE(0x18, 2), /*!< gpioa periph clock */
  96. CRM_GPIOB_PERIPH_CLOCK = MAKE_VALUE(0x18, 3), /*!< gpiob periph clock */
  97. CRM_GPIOC_PERIPH_CLOCK = MAKE_VALUE(0x18, 4), /*!< gpioc periph clock */
  98. CRM_GPIOD_PERIPH_CLOCK = MAKE_VALUE(0x18, 5), /*!< gpiod periph clock */
  99. CRM_GPIOF_PERIPH_CLOCK = MAKE_VALUE(0x18, 7), /*!< gpiof periph clock */
  100. CRM_ADC1_PERIPH_CLOCK = MAKE_VALUE(0x18, 9), /*!< adc1 periph clock */
  101. CRM_ADC2_PERIPH_CLOCK = MAKE_VALUE(0x18, 10), /*!< adc2 periph clock */
  102. CRM_TMR1_PERIPH_CLOCK = MAKE_VALUE(0x18, 11), /*!< tmr1 periph clock */
  103. CRM_SPI1_PERIPH_CLOCK = MAKE_VALUE(0x18, 12), /*!< spi1 periph clock */
  104. CRM_TMR8_PERIPH_CLOCK = MAKE_VALUE(0x18, 13), /*!< tmr8 periph clock */
  105. CRM_USART1_PERIPH_CLOCK = MAKE_VALUE(0x18, 14), /*!< usart1 periph clock */
  106. CRM_TMR9_PERIPH_CLOCK = MAKE_VALUE(0x18, 19), /*!< tmr9 periph clock */
  107. CRM_TMR10_PERIPH_CLOCK = MAKE_VALUE(0x18, 20), /*!< tmr10 periph clock */
  108. CRM_TMR11_PERIPH_CLOCK = MAKE_VALUE(0x18, 21), /*!< tmr11 periph clock */
  109. CRM_ACC_PERIPH_CLOCK = MAKE_VALUE(0x18, 22), /*!< acc periph clock */
  110. /* apb1 periph */
  111. CRM_TMR2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 0), /*!< tmr2 periph clock */
  112. CRM_TMR3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 1), /*!< tmr3 periph clock */
  113. CRM_TMR4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 2), /*!< tmr4 periph clock */
  114. CRM_TMR5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 3), /*!< tmr5 periph clock */
  115. CRM_WWDT_PERIPH_CLOCK = MAKE_VALUE(0x1C, 11), /*!< wwdt periph clock */
  116. CRM_SPI2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 14), /*!< spi2 periph clock */
  117. CRM_USART2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 17), /*!< usart2 periph clock */
  118. CRM_USART3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 18), /*!< usart3 periph clock */
  119. CRM_UART4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 19), /*!< uart4 periph clock */
  120. CRM_UART5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 20), /*!< uart5 periph clock */
  121. CRM_I2C1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 21), /*!< i2c1 periph clock */
  122. CRM_I2C2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 22), /*!< i2c2 periph clock */
  123. CRM_USB_PERIPH_CLOCK = MAKE_VALUE(0x1C, 23), /*!< usb periph clock */
  124. CRM_CAN1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 25), /*!< can1 periph clock */
  125. CRM_BPR_PERIPH_CLOCK = MAKE_VALUE(0x1C, 27), /*!< bpr periph clock */
  126. CRM_PWC_PERIPH_CLOCK = MAKE_VALUE(0x1C, 28), /*!< pwc periph clock */
  127. CRM_CAN2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 31), /*!< can2 periph clock */
  128. } crm_periph_clock_type;
  129. /**
  130. * @brief crm periph reset
  131. */
  132. typedef enum
  133. {
  134. /* apb2 periph */
  135. CRM_IOMUX_PERIPH_RESET = MAKE_VALUE(0x0C, 0), /*!< iomux periph reset */
  136. CRM_EXINT_PERIPH_RESET = MAKE_VALUE(0x0C, 1), /*!< exint periph reset */
  137. CRM_GPIOA_PERIPH_RESET = MAKE_VALUE(0x0C, 2), /*!< gpioa periph reset */
  138. CRM_GPIOB_PERIPH_RESET = MAKE_VALUE(0x0C, 3), /*!< gpiob periph reset */
  139. CRM_GPIOC_PERIPH_RESET = MAKE_VALUE(0x0C, 4), /*!< gpioc periph reset */
  140. CRM_GPIOD_PERIPH_RESET = MAKE_VALUE(0x0C, 5), /*!< gpiod periph reset */
  141. CRM_GPIOF_PERIPH_RESET = MAKE_VALUE(0x0C, 7), /*!< gpiof periph reset */
  142. CRM_ADC1_PERIPH_RESET = MAKE_VALUE(0x0C, 9), /*!< adc1 periph reset */
  143. CRM_ADC2_PERIPH_RESET = MAKE_VALUE(0x0C, 10), /*!< adc2 periph reset */
  144. CRM_TMR1_PERIPH_RESET = MAKE_VALUE(0x0C, 11), /*!< tmr1 periph reset */
  145. CRM_SPI1_PERIPH_RESET = MAKE_VALUE(0x0C, 12), /*!< spi2 periph reset */
  146. CRM_TMR8_PERIPH_RESET = MAKE_VALUE(0x0C, 13), /*!< tmr8 periph reset */
  147. CRM_USART1_PERIPH_RESET = MAKE_VALUE(0x0C, 14), /*!< usart1 periph reset */
  148. CRM_TMR9_PERIPH_RESET = MAKE_VALUE(0x0C, 19), /*!< tmr9 periph reset */
  149. CRM_TMR10_PERIPH_RESET = MAKE_VALUE(0x0C, 20), /*!< tmr10 periph reset */
  150. CRM_TMR11_PERIPH_RESET = MAKE_VALUE(0x0C, 21), /*!< tmr11 periph reset */
  151. CRM_ACC_PERIPH_RESET = MAKE_VALUE(0x0C, 22), /*!< acc periph reset */
  152. /* apb1 periph */
  153. CRM_TMR2_PERIPH_RESET = MAKE_VALUE(0x10, 0), /*!< tmr2 periph reset */
  154. CRM_TMR3_PERIPH_RESET = MAKE_VALUE(0x10, 1), /*!< tmr3 periph reset */
  155. CRM_TMR4_PERIPH_RESET = MAKE_VALUE(0x10, 2), /*!< tmr4 periph reset */
  156. CRM_TMR5_PERIPH_RESET = MAKE_VALUE(0x10, 3), /*!< tmr5 periph reset */
  157. CRM_WWDT_PERIPH_RESET = MAKE_VALUE(0x10, 11), /*!< wwdt periph reset */
  158. CRM_SPI2_PERIPH_RESET = MAKE_VALUE(0x10, 14), /*!< spi2 periph reset */
  159. CRM_USART2_PERIPH_RESET = MAKE_VALUE(0x10, 17), /*!< usart2 periph reset */
  160. CRM_USART3_PERIPH_RESET = MAKE_VALUE(0x10, 18), /*!< usart3 periph reset */
  161. CRM_UART4_PERIPH_RESET = MAKE_VALUE(0x10, 19), /*!< uart4 periph reset */
  162. CRM_UART5_PERIPH_RESET = MAKE_VALUE(0x10, 20), /*!< uart5 periph reset */
  163. CRM_I2C1_PERIPH_RESET = MAKE_VALUE(0x10, 21), /*!< i2c1 periph reset */
  164. CRM_I2C2_PERIPH_RESET = MAKE_VALUE(0x10, 22), /*!< i2c2 periph reset */
  165. CRM_USB_PERIPH_RESET = MAKE_VALUE(0x10, 23), /*!< usb periph reset */
  166. CRM_CAN1_PERIPH_RESET = MAKE_VALUE(0x10, 25), /*!< can1 periph reset */
  167. CRM_BPR_PERIPH_RESET = MAKE_VALUE(0x10, 27), /*!< bpr periph reset */
  168. CRM_PWC_PERIPH_RESET = MAKE_VALUE(0x10, 28), /*!< pwc periph reset */
  169. CRM_CAN2_PERIPH_RESET = MAKE_VALUE(0x10, 31), /*!< can2 periph reset */
  170. } crm_periph_reset_type;
  171. /**
  172. * @brief crm periph clock in sleep mode
  173. */
  174. typedef enum
  175. {
  176. /* ahb periph */
  177. CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE = MAKE_VALUE(0x14, 2), /*!< sram sleep mode periph clock */
  178. CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE = MAKE_VALUE(0x14, 4) /*!< flash sleep mode periph clock */
  179. } crm_periph_clock_sleepmd_type;
  180. /**
  181. * @brief crm pll mult_x
  182. */
  183. typedef enum
  184. {
  185. CRM_PLL_MULT_2 = 0, /*!< pll multiplication factor 2 */
  186. CRM_PLL_MULT_3 = 1, /*!< pll multiplication factor 3 */
  187. CRM_PLL_MULT_4 = 2, /*!< pll multiplication factor 4 */
  188. CRM_PLL_MULT_5 = 3, /*!< pll multiplication factor 5 */
  189. CRM_PLL_MULT_6 = 4, /*!< pll multiplication factor 6 */
  190. CRM_PLL_MULT_7 = 5, /*!< pll multiplication factor 7 */
  191. CRM_PLL_MULT_8 = 6, /*!< pll multiplication factor 8 */
  192. CRM_PLL_MULT_9 = 7, /*!< pll multiplication factor 9 */
  193. CRM_PLL_MULT_10 = 8, /*!< pll multiplication factor 10 */
  194. CRM_PLL_MULT_11 = 9, /*!< pll multiplication factor 11 */
  195. CRM_PLL_MULT_12 = 10, /*!< pll multiplication factor 12 */
  196. CRM_PLL_MULT_13 = 11, /*!< pll multiplication factor 13 */
  197. CRM_PLL_MULT_14 = 12, /*!< pll multiplication factor 14 */
  198. CRM_PLL_MULT_15 = 13, /*!< pll multiplication factor 15 */
  199. CRM_PLL_MULT_16 = 15, /*!< pll multiplication factor 16 */
  200. CRM_PLL_MULT_17 = 16, /*!< pll multiplication factor 17 */
  201. CRM_PLL_MULT_18 = 17, /*!< pll multiplication factor 18 */
  202. CRM_PLL_MULT_19 = 18, /*!< pll multiplication factor 19 */
  203. CRM_PLL_MULT_20 = 19, /*!< pll multiplication factor 20 */
  204. CRM_PLL_MULT_21 = 20, /*!< pll multiplication factor 21 */
  205. CRM_PLL_MULT_22 = 21, /*!< pll multiplication factor 22 */
  206. CRM_PLL_MULT_23 = 22, /*!< pll multiplication factor 23 */
  207. CRM_PLL_MULT_24 = 23, /*!< pll multiplication factor 24 */
  208. CRM_PLL_MULT_25 = 24, /*!< pll multiplication factor 25 */
  209. CRM_PLL_MULT_26 = 25, /*!< pll multiplication factor 26 */
  210. CRM_PLL_MULT_27 = 26, /*!< pll multiplication factor 27 */
  211. CRM_PLL_MULT_28 = 27, /*!< pll multiplication factor 28 */
  212. CRM_PLL_MULT_29 = 28, /*!< pll multiplication factor 29 */
  213. CRM_PLL_MULT_30 = 29, /*!< pll multiplication factor 30 */
  214. CRM_PLL_MULT_31 = 30, /*!< pll multiplication factor 31 */
  215. CRM_PLL_MULT_32 = 31, /*!< pll multiplication factor 32 */
  216. CRM_PLL_MULT_33 = 32, /*!< pll multiplication factor 33 */
  217. CRM_PLL_MULT_34 = 33, /*!< pll multiplication factor 34 */
  218. CRM_PLL_MULT_35 = 34, /*!< pll multiplication factor 35 */
  219. CRM_PLL_MULT_36 = 35, /*!< pll multiplication factor 36 */
  220. CRM_PLL_MULT_37 = 36, /*!< pll multiplication factor 37 */
  221. CRM_PLL_MULT_38 = 37, /*!< pll multiplication factor 38 */
  222. CRM_PLL_MULT_39 = 38, /*!< pll multiplication factor 39 */
  223. CRM_PLL_MULT_40 = 39, /*!< pll multiplication factor 40 */
  224. CRM_PLL_MULT_41 = 40, /*!< pll multiplication factor 41 */
  225. CRM_PLL_MULT_42 = 41, /*!< pll multiplication factor 42 */
  226. CRM_PLL_MULT_43 = 42, /*!< pll multiplication factor 43 */
  227. CRM_PLL_MULT_44 = 43, /*!< pll multiplication factor 44 */
  228. CRM_PLL_MULT_45 = 44, /*!< pll multiplication factor 45 */
  229. CRM_PLL_MULT_46 = 45, /*!< pll multiplication factor 46 */
  230. CRM_PLL_MULT_47 = 46, /*!< pll multiplication factor 47 */
  231. CRM_PLL_MULT_48 = 47, /*!< pll multiplication factor 48 */
  232. CRM_PLL_MULT_49 = 48, /*!< pll multiplication factor 49 */
  233. CRM_PLL_MULT_50 = 49, /*!< pll multiplication factor 50 */
  234. CRM_PLL_MULT_51 = 50, /*!< pll multiplication factor 51 */
  235. CRM_PLL_MULT_52 = 51, /*!< pll multiplication factor 52 */
  236. CRM_PLL_MULT_53 = 52, /*!< pll multiplication factor 53 */
  237. CRM_PLL_MULT_54 = 53, /*!< pll multiplication factor 54 */
  238. CRM_PLL_MULT_55 = 54, /*!< pll multiplication factor 55 */
  239. CRM_PLL_MULT_56 = 55, /*!< pll multiplication factor 56 */
  240. CRM_PLL_MULT_57 = 56, /*!< pll multiplication factor 57 */
  241. CRM_PLL_MULT_58 = 57, /*!< pll multiplication factor 58 */
  242. CRM_PLL_MULT_59 = 58, /*!< pll multiplication factor 59 */
  243. CRM_PLL_MULT_60 = 59, /*!< pll multiplication factor 60 */
  244. CRM_PLL_MULT_61 = 60, /*!< pll multiplication factor 61 */
  245. CRM_PLL_MULT_62 = 61, /*!< pll multiplication factor 62 */
  246. CRM_PLL_MULT_63 = 62, /*!< pll multiplication factor 63 */
  247. CRM_PLL_MULT_64 = 63 /*!< pll multiplication factor 64 */
  248. } crm_pll_mult_type;
  249. /**
  250. * @brief crm pll clock source
  251. */
  252. typedef enum
  253. {
  254. CRM_PLL_SOURCE_HICK = 0x00, /*!< high speed internal clock as pll reference clock source */
  255. CRM_PLL_SOURCE_HEXT = 0x01, /*!< high speed external crystal as pll reference clock source */
  256. CRM_PLL_SOURCE_HEXT_DIV = 0x02 /*!< high speed external crystal div as pll reference clock source */
  257. } crm_pll_clock_source_type;
  258. /**
  259. * @brief crm pll clock output range
  260. */
  261. typedef enum
  262. {
  263. CRM_PLL_OUTPUT_RANGE_LE72MHZ = 0x00, /*!< pll clock output range less than or equal to 72mhz */
  264. CRM_PLL_OUTPUT_RANGE_GT72MHZ = 0x01 /*!< pll clock output range greater than 72mhz */
  265. } crm_pll_output_range_type;
  266. /**
  267. * @brief crm clock source
  268. */
  269. typedef enum
  270. {
  271. CRM_CLOCK_SOURCE_HICK = 0x00, /*!< high speed internal clock */
  272. CRM_CLOCK_SOURCE_HEXT = 0x01, /*!< high speed external crystal */
  273. CRM_CLOCK_SOURCE_PLL = 0x02, /*!< phase locking loop */
  274. CRM_CLOCK_SOURCE_LEXT = 0x03, /*!< low speed external crystal */
  275. CRM_CLOCK_SOURCE_LICK = 0x04 /*!< low speed internal clock */
  276. } crm_clock_source_type;
  277. /**
  278. * @brief crm ahb division
  279. */
  280. typedef enum
  281. {
  282. CRM_AHB_DIV_1 = 0x00, /*!< sclk div1 to ahbclk */
  283. CRM_AHB_DIV_2 = 0x08, /*!< sclk div2 to ahbclk */
  284. CRM_AHB_DIV_4 = 0x09, /*!< sclk div4 to ahbclk */
  285. CRM_AHB_DIV_8 = 0x0A, /*!< sclk div8 to ahbclk */
  286. CRM_AHB_DIV_16 = 0x0B, /*!< sclk div16 to ahbclk */
  287. CRM_AHB_DIV_64 = 0x0C, /*!< sclk div64 to ahbclk */
  288. CRM_AHB_DIV_128 = 0x0D, /*!< sclk div128 to ahbclk */
  289. CRM_AHB_DIV_256 = 0x0E, /*!< sclk div256 to ahbclk */
  290. CRM_AHB_DIV_512 = 0x0F /*!< sclk div512 to ahbclk */
  291. } crm_ahb_div_type;
  292. /**
  293. * @brief crm apb1 division
  294. */
  295. typedef enum
  296. {
  297. CRM_APB1_DIV_1 = 0x00, /*!< ahbclk div1 to apb1clk */
  298. CRM_APB1_DIV_2 = 0x04, /*!< ahbclk div2 to apb1clk */
  299. CRM_APB1_DIV_4 = 0x05, /*!< ahbclk div4 to apb1clk */
  300. CRM_APB1_DIV_8 = 0x06, /*!< ahbclk div8 to apb1clk */
  301. CRM_APB1_DIV_16 = 0x07 /*!< ahbclk div16 to apb1clk */
  302. } crm_apb1_div_type;
  303. /**
  304. * @brief crm apb2 division
  305. */
  306. typedef enum
  307. {
  308. CRM_APB2_DIV_1 = 0x00, /*!< ahbclk div1 to apb2clk */
  309. CRM_APB2_DIV_2 = 0x04, /*!< ahbclk div2 to apb2clk */
  310. CRM_APB2_DIV_4 = 0x05, /*!< ahbclk div4 to apb2clk */
  311. CRM_APB2_DIV_8 = 0x06, /*!< ahbclk div8 to apb2clk */
  312. CRM_APB2_DIV_16 = 0x07 /*!< ahbclk div16 to apb2clk */
  313. } crm_apb2_div_type;
  314. /**
  315. * @brief crm adc division
  316. */
  317. typedef enum
  318. {
  319. CRM_ADC_DIV_2 = 0x00, /*!< apb2clk div2 to adcclk */
  320. CRM_ADC_DIV_4 = 0x01, /*!< apb2clk div4 to adcclk */
  321. CRM_ADC_DIV_6 = 0x02, /*!< apb2clk div6 to adcclk */
  322. CRM_ADC_DIV_8 = 0x03, /*!< apb2clk div8 to adcclk */
  323. CRM_ADC_DIV_12 = 0x05, /*!< apb2clk div12 to adcclk */
  324. CRM_ADC_DIV_16 = 0x07 /*!< apb2clk div16 to adcclk */
  325. } crm_adc_div_type;
  326. /**
  327. * @brief crm usb division
  328. */
  329. typedef enum
  330. {
  331. CRM_USB_DIV_1_5 = 0x00, /*!< pllclk div1.5 to usbclk */
  332. CRM_USB_DIV_1 = 0x01, /*!< pllclk div1 to usbclk */
  333. CRM_USB_DIV_2_5 = 0x02, /*!< pllclk div2.5 to usbclk */
  334. CRM_USB_DIV_2 = 0x03, /*!< pllclk div2 to usbclk */
  335. CRM_USB_DIV_3_5 = 0x04, /*!< pllclk div3.5 to usbclk */
  336. CRM_USB_DIV_3 = 0x05, /*!< pllclk div3 to usbclk */
  337. CRM_USB_DIV_4 = 0x06 /*!< pllclk div4 to usbclk */
  338. } crm_usb_div_type;
  339. /**
  340. * @brief crm rtc clock
  341. */
  342. typedef enum
  343. {
  344. CRM_RTC_CLOCK_NOCLK = 0x00, /*!< no clock as rtc clock source */
  345. CRM_RTC_CLOCK_LEXT = 0x01, /*!< low speed external crystal as rtc clock source */
  346. CRM_RTC_CLOCK_LICK = 0x02, /*!< low speed internal clock as rtc clock source */
  347. CRM_RTC_CLOCK_HEXT_DIV = 0x03 /*!< high speed external crystal div as rtc clock source */
  348. } crm_rtc_clock_type;
  349. /**
  350. * @brief crm hick 48mhz division
  351. */
  352. typedef enum
  353. {
  354. CRM_HICK48_DIV6 = 0x00, /*!< high speed internal clock (48 mhz) div6 */
  355. CRM_HICK48_NODIV = 0x01 /*!< high speed internal clock (48 mhz) no div */
  356. } crm_hick_div_6_type;
  357. /**
  358. * @brief crm sclk select
  359. */
  360. typedef enum
  361. {
  362. CRM_SCLK_HICK = 0x00, /*!< select high speed internal clock as sclk */
  363. CRM_SCLK_HEXT = 0x01, /*!< select high speed external crystal as sclk */
  364. CRM_SCLK_PLL = 0x02 /*!< select phase locking loop clock as sclk */
  365. } crm_sclk_type;
  366. /**
  367. * @brief crm clkout select
  368. */
  369. typedef enum
  370. {
  371. CRM_CLKOUT_NOCLK = 0x00, /*!< output no clock to clkout pin */
  372. CRM_CLKOUT_LICK = 0x02, /*!< output low speed internal clock to clkout pin */
  373. CRM_CLKOUT_LEXT = 0x03, /*!< output low speed external crystal to clkout pin */
  374. CRM_CLKOUT_SCLK = 0x04, /*!< output system clock to clkout pin */
  375. CRM_CLKOUT_HICK = 0x05, /*!< output high speed internal clock to clkout pin */
  376. CRM_CLKOUT_HEXT = 0x06, /*!< output high speed external crystal to clkout pin */
  377. CRM_CLKOUT_PLL_DIV_2 = 0x07, /*!< output phase locking loop clock div2 to clkout pin */
  378. CRM_CLKOUT_PLL_DIV_4 = 0x0C, /*!< output phase locking loop clock div4 to clkout pin */
  379. CRM_CLKOUT_USB = 0x0D, /*!< output usbclk to clkout pin */
  380. CRM_CLKOUT_ADC = 0x0E /*!< output adcclk to clkout pin */
  381. } crm_clkout_select_type;
  382. /**
  383. * @brief crm clkout division
  384. */
  385. typedef enum
  386. {
  387. CRM_CLKOUT_DIV_1 = 0x00, /*!< clkout div1 */
  388. CRM_CLKOUT_DIV_2 = 0x08, /*!< clkout div2 */
  389. CRM_CLKOUT_DIV_4 = 0x09, /*!< clkout div4 */
  390. CRM_CLKOUT_DIV_8 = 0x0A, /*!< clkout div8 */
  391. CRM_CLKOUT_DIV_16 = 0x0B, /*!< clkout div16 */
  392. CRM_CLKOUT_DIV_64 = 0x0C, /*!< clkout div64 */
  393. CRM_CLKOUT_DIV_128 = 0x0D, /*!< clkout div128 */
  394. CRM_CLKOUT_DIV_256 = 0x0E, /*!< clkout div256 */
  395. CRM_CLKOUT_DIV_512 = 0x0F /*!< clkout div512 */
  396. } crm_clkout_div_type;
  397. /**
  398. * @brief crm auto step mode
  399. */
  400. typedef enum
  401. {
  402. CRM_AUTO_STEP_MODE_DISABLE = 0x00, /*!< disable auto step mode */
  403. CRM_AUTO_STEP_MODE_ENABLE = 0x03 /*!< enable auto step mode */
  404. } crm_auto_step_mode_type;
  405. /**
  406. * @brief crm usbdev interrupt remap
  407. */
  408. typedef enum
  409. {
  410. CRM_USB_INT19_INT20 = 0x00, /*!< usb high and low priority irq numer use 19 and 20 */
  411. CRM_USB_INT73_INT74 = 0x01 /*!< usb high and low priority irq numer use 73 and 74 */
  412. } crm_usb_int_map_type;
  413. /**
  414. * @brief crm usb 48 mhz clock source select
  415. */
  416. typedef enum
  417. {
  418. CRM_USB_CLOCK_SOURCE_PLL = 0x00, /*!< select phase locking loop clock as usb clock source */
  419. CRM_USB_CLOCK_SOURCE_HICK = 0x01 /*!< select high speed internal clock as usb clock source */
  420. } crm_usb_clock_source_type;
  421. /**
  422. * @brief crm hick as system clock frequency select
  423. */
  424. typedef enum
  425. {
  426. CRM_HICK_SCLK_8MHZ = 0x00, /*!< fixed 8 mhz when hick is selected as sclk */
  427. CRM_HICK_SCLK_48MHZ = 0x01 /*!< 8 mhz or 48 mhz depend on hickdiv when hick is selected as sclk */
  428. } crm_hick_sclk_frequency_type;
  429. /**
  430. * @brief crm clocks freqency structure
  431. */
  432. typedef struct
  433. {
  434. uint32_t sclk_freq; /*!< system clock frequency */
  435. uint32_t ahb_freq; /*!< ahb bus clock frequency */
  436. uint32_t apb2_freq; /*!< apb2 bus clock frequency */
  437. uint32_t apb1_freq; /*!< apb1 bus clock frequency */
  438. uint32_t adc_freq; /*!< adc clock frequency */
  439. } crm_clocks_freq_type;
  440. /**
  441. * @brief type define crm register all
  442. */
  443. typedef struct
  444. {
  445. /**
  446. * @brief crm ctrl register, offset:0x00
  447. */
  448. union
  449. {
  450. __IO uint32_t ctrl;
  451. struct
  452. {
  453. __IO uint32_t hicken : 1; /* [0] */
  454. __IO uint32_t hickstbl : 1; /* [1] */
  455. __IO uint32_t hicktrim : 6; /* [7:2] */
  456. __IO uint32_t hickcal : 8; /* [15:8] */
  457. __IO uint32_t hexten : 1; /* [16] */
  458. __IO uint32_t hextstbl : 1; /* [17] */
  459. __IO uint32_t hextbyps : 1; /* [18] */
  460. __IO uint32_t cfden : 1; /* [19] */
  461. __IO uint32_t reserved1 : 4; /* [23:20] */
  462. __IO uint32_t pllen : 1; /* [24] */
  463. __IO uint32_t pllstbl : 1; /* [25] */
  464. __IO uint32_t reserved2 : 6; /* [31:26] */
  465. } ctrl_bit;
  466. };
  467. /**
  468. * @brief crm cfg register, offset:0x04
  469. */
  470. union
  471. {
  472. __IO uint32_t cfg;
  473. struct
  474. {
  475. __IO uint32_t sclksel : 2; /* [1:0] */
  476. __IO uint32_t sclksts : 2; /* [3:2] */
  477. __IO uint32_t ahbdiv : 4; /* [7:4] */
  478. __IO uint32_t apb1div : 3; /* [10:8] */
  479. __IO uint32_t apb2div : 3; /* [13:11] */
  480. __IO uint32_t adcdiv_l : 2; /* [15:14] */
  481. __IO uint32_t pllrcs : 1; /* [16] */
  482. __IO uint32_t pllhextdiv : 1; /* [17] */
  483. __IO uint32_t pllmult_l : 4; /* [21:18] */
  484. __IO uint32_t usbdiv_l : 2; /* [23:22] */
  485. __IO uint32_t clkout_sel : 3; /* [26:24] */
  486. __IO uint32_t usbdiv_h : 1; /* [27] */
  487. __IO uint32_t adcdiv_h : 1; /* [28] */
  488. __IO uint32_t pllmult_h : 2; /* [30:29] */
  489. __IO uint32_t pllrange : 1; /* [31] */
  490. } cfg_bit;
  491. };
  492. /**
  493. * @brief crm clkint register, offset:0x08
  494. */
  495. union
  496. {
  497. __IO uint32_t clkint;
  498. struct
  499. {
  500. __IO uint32_t lickstblf : 1; /* [0] */
  501. __IO uint32_t lextstblf : 1; /* [1] */
  502. __IO uint32_t hickstblf : 1; /* [2] */
  503. __IO uint32_t hextstblf : 1; /* [3] */
  504. __IO uint32_t pllstblf : 1; /* [4] */
  505. __IO uint32_t reserved1 : 2; /* [6:5] */
  506. __IO uint32_t cfdf : 1; /* [7] */
  507. __IO uint32_t lickstblien : 1; /* [8] */
  508. __IO uint32_t lextstblien : 1; /* [9] */
  509. __IO uint32_t hickstblien : 1; /* [10] */
  510. __IO uint32_t hextstblien : 1; /* [11] */
  511. __IO uint32_t pllstblien : 1; /* [12] */
  512. __IO uint32_t reserved2 : 3; /* [15:13] */
  513. __IO uint32_t lickstblfc : 1; /* [16] */
  514. __IO uint32_t lextstblfc : 1; /* [17] */
  515. __IO uint32_t hickstblfc : 1; /* [18] */
  516. __IO uint32_t hextstblfc : 1; /* [19] */
  517. __IO uint32_t pllstblfc : 1; /* [20] */
  518. __IO uint32_t reserved3 : 2; /* [22:21] */
  519. __IO uint32_t cfdfc : 1; /* [23] */
  520. __IO uint32_t reserved4 : 8; /* [31:24] */
  521. } clkint_bit;
  522. };
  523. /**
  524. * @brief crm apb2rst register, offset:0x0C
  525. */
  526. union
  527. {
  528. __IO uint32_t apb2rst;
  529. struct
  530. {
  531. __IO uint32_t iomuxrst : 1; /* [0] */
  532. __IO uint32_t exintrst : 1; /* [1] */
  533. __IO uint32_t gpioarst : 1; /* [2] */
  534. __IO uint32_t gpiobrst : 1; /* [3] */
  535. __IO uint32_t gpiocrst : 1; /* [4] */
  536. __IO uint32_t gpiodrst : 1; /* [5] */
  537. __IO uint32_t reserved1 : 1; /* [6] */
  538. __IO uint32_t gpioerst : 1; /* [7] */
  539. __IO uint32_t reserved2 : 1; /* [8] */
  540. __IO uint32_t adc1rst : 1; /* [9] */
  541. __IO uint32_t adc2rst : 1; /* [10] */
  542. __IO uint32_t tmr1rst : 1; /* [11] */
  543. __IO uint32_t spi1rst : 1; /* [12] */
  544. __IO uint32_t tmr8rst : 1; /* [13] */
  545. __IO uint32_t usart1rst : 1; /* [14] */
  546. __IO uint32_t reserved3 : 4; /* [18:15] */
  547. __IO uint32_t tmr9rst : 1; /* [19] */
  548. __IO uint32_t tmr10rst : 1; /* [20] */
  549. __IO uint32_t tmr11rst : 1; /* [21] */
  550. __IO uint32_t accrst : 1; /* [22] */
  551. __IO uint32_t reserved4 : 9; /* [31:23] */
  552. } apb2rst_bit;
  553. };
  554. /**
  555. * @brief crm apb1rst register, offset:0x10
  556. */
  557. union
  558. {
  559. __IO uint32_t apb1rst;
  560. struct
  561. {
  562. __IO uint32_t tmr2rst : 1; /* [0] */
  563. __IO uint32_t tmr3rst : 1; /* [1] */
  564. __IO uint32_t tmr4rst : 1; /* [2] */
  565. __IO uint32_t tmr5rst : 1; /* [3] */
  566. __IO uint32_t reserved1 : 7; /* [10:4] */
  567. __IO uint32_t wwdtrst : 1; /* [11] */
  568. __IO uint32_t reserved2 : 2; /* [13:12] */
  569. __IO uint32_t spi2rst : 1; /* [14] */
  570. __IO uint32_t reserved3 : 2; /* [16:15] */
  571. __IO uint32_t usart2rst : 1; /* [17] */
  572. __IO uint32_t usart3rst : 1; /* [18] */
  573. __IO uint32_t uart4rst : 1; /* [19] */
  574. __IO uint32_t uart5rst : 1; /* [20] */
  575. __IO uint32_t i2c1rst : 1; /* [21] */
  576. __IO uint32_t i2c2rst : 1; /* [22] */
  577. __IO uint32_t usbrst : 1; /* [23] */
  578. __IO uint32_t reserved4 : 1; /* [24] */
  579. __IO uint32_t can1rst : 1; /* [25] */
  580. __IO uint32_t reserved5 : 1; /* [26] */
  581. __IO uint32_t bprrst : 1; /* [27] */
  582. __IO uint32_t pwcrst : 1; /* [28] */
  583. __IO uint32_t reserved6 : 2; /* [31:30] */
  584. __IO uint32_t can2rst : 1; /* [31] */
  585. } apb1rst_bit;
  586. };
  587. /**
  588. * @brief crm ahben register, offset:0x14
  589. */
  590. union
  591. {
  592. __IO uint32_t ahben;
  593. struct
  594. {
  595. __IO uint32_t dma1en : 1; /* [0] */
  596. __IO uint32_t dma2en : 1; /* [1] */
  597. __IO uint32_t sramen : 1; /* [2] */
  598. __IO uint32_t reserved1 : 1; /* [3] */
  599. __IO uint32_t flashen : 1; /* [4] */
  600. __IO uint32_t reserved2 : 1; /* [5] */
  601. __IO uint32_t crcen : 1; /* [6] */
  602. __IO uint32_t reserved3 : 3; /* [9:7] */
  603. __IO uint32_t sdio1en : 1; /* [10] */
  604. __IO uint32_t reserved5 : 21;/* [31:11] */
  605. } ahben_bit;
  606. };
  607. /**
  608. * @brief crm apb2en register, offset:0x18
  609. */
  610. union
  611. {
  612. __IO uint32_t apb2en;
  613. struct
  614. {
  615. __IO uint32_t iomuxen : 1; /* [0] */
  616. __IO uint32_t reserved1 : 1; /* [1] */
  617. __IO uint32_t gpioaen : 1; /* [2] */
  618. __IO uint32_t gpioben : 1; /* [3] */
  619. __IO uint32_t gpiocen : 1; /* [4] */
  620. __IO uint32_t gpioden : 1; /* [5] */
  621. __IO uint32_t reserved2 : 1; /* [6] */
  622. __IO uint32_t gpiofen : 1; /* [7] */
  623. __IO uint32_t reserved3 : 1; /* [8] */
  624. __IO uint32_t adc1en : 1; /* [9] */
  625. __IO uint32_t adc2en : 1; /* [10] */
  626. __IO uint32_t tmr1en : 1; /* [11] */
  627. __IO uint32_t spi1en : 1; /* [12] */
  628. __IO uint32_t tmr8en : 1; /* [13] */
  629. __IO uint32_t usart1en : 1; /* [14] */
  630. __IO uint32_t reserved4 : 4; /* [18:15] */
  631. __IO uint32_t tmr9en : 1; /* [19] */
  632. __IO uint32_t tmr10en : 1; /* [20] */
  633. __IO uint32_t tmr11en : 1; /* [21] */
  634. __IO uint32_t accen : 1; /* [22] */
  635. __IO uint32_t reserved5 : 9; /* [31:23] */
  636. } apb2en_bit;
  637. };
  638. /**
  639. * @brief crm apb1en register, offset:0x1C
  640. */
  641. union
  642. {
  643. __IO uint32_t apb1en;
  644. struct
  645. {
  646. __IO uint32_t tmr2en : 1; /* [0] */
  647. __IO uint32_t tmr3en : 1; /* [1] */
  648. __IO uint32_t tmr4en : 1; /* [2] */
  649. __IO uint32_t tmr5en : 1; /* [3] */
  650. __IO uint32_t reserved1 : 7; /* [10:4] */
  651. __IO uint32_t wwdten : 1; /* [11] */
  652. __IO uint32_t reserved2 : 2; /* [13:12] */
  653. __IO uint32_t spi2en : 1; /* [14] */
  654. __IO uint32_t reserved3 : 2; /* [16:15] */
  655. __IO uint32_t usart2en : 1; /* [17] */
  656. __IO uint32_t usart3en : 1; /* [18] */
  657. __IO uint32_t uart4en : 1; /* [19] */
  658. __IO uint32_t uart5en : 1; /* [20] */
  659. __IO uint32_t i2c1en : 1; /* [21] */
  660. __IO uint32_t i2c2en : 1; /* [22] */
  661. __IO uint32_t usben : 1; /* [23] */
  662. __IO uint32_t reserved4 : 1; /* [24] */
  663. __IO uint32_t can1en : 1; /* [25] */
  664. __IO uint32_t reserved5 : 1; /* [26] */
  665. __IO uint32_t bpren : 1; /* [27] */
  666. __IO uint32_t pwcen : 1; /* [28] */
  667. __IO uint32_t reserved6 : 2; /* [30:29] */
  668. __IO uint32_t can2en : 1; /* [31] */
  669. } apb1en_bit;
  670. };
  671. /**
  672. * @brief crm bpdc register, offset:0x20
  673. */
  674. union
  675. {
  676. __IO uint32_t bpdc;
  677. struct
  678. {
  679. __IO uint32_t lexten : 1; /* [0] */
  680. __IO uint32_t lextstbl : 1; /* [1] */
  681. __IO uint32_t lextbyps : 1; /* [2] */
  682. __IO uint32_t reserved1 : 5; /* [7:3] */
  683. __IO uint32_t rtcsel : 2; /* [9:8] */
  684. __IO uint32_t reserved2 : 5; /* [14:10] */
  685. __IO uint32_t rtcen : 1; /* [15] */
  686. __IO uint32_t bpdrst : 1; /* [16] */
  687. __IO uint32_t reserved3 : 15;/* [31:17] */
  688. } bpdc_bit;
  689. };
  690. /**
  691. * @brief crm ctrlsts register, offset:0x24
  692. */
  693. union
  694. {
  695. __IO uint32_t ctrlsts;
  696. struct
  697. {
  698. __IO uint32_t licken : 1; /* [0] */
  699. __IO uint32_t lickstbl : 1; /* [1] */
  700. __IO uint32_t reserved1 : 22;/* [23:2] */
  701. __IO uint32_t rstfc : 1; /* [24] */
  702. __IO uint32_t reserved2 : 1; /* [25] */
  703. __IO uint32_t nrstf : 1; /* [26] */
  704. __IO uint32_t porrstf : 1; /* [27] */
  705. __IO uint32_t swrstf : 1; /* [28] */
  706. __IO uint32_t wdtrstf : 1; /* [29] */
  707. __IO uint32_t wwdtrstf : 1; /* [30] */
  708. __IO uint32_t lprstf : 1; /* [31] */
  709. } ctrlsts_bit;
  710. };
  711. /**
  712. * @brief crm reserved1 register, offset:0x28~0x2C
  713. */
  714. __IO uint32_t reserved1[2];
  715. /**
  716. * @brief crm misc1 register, offset:0x30
  717. */
  718. union
  719. {
  720. __IO uint32_t misc1;
  721. struct
  722. {
  723. __IO uint32_t hickcal_key : 8; /* [7:0] */
  724. __IO uint32_t reserved1 : 8; /* [15:8] */
  725. __IO uint32_t clkout_sel : 1; /* [16] */
  726. __IO uint32_t reserved2 : 7; /* [23:17] */
  727. __IO uint32_t usbbufs : 1; /* [24] */
  728. __IO uint32_t hickdiv : 1; /* [25] */
  729. __IO uint32_t reserved3 : 2; /* [27:26] */
  730. __IO uint32_t clkoutdiv : 4; /* [31:28] */
  731. } misc1_bit;
  732. };
  733. /**
  734. * @brief crm reserved2 register, offset:0x4C~0x34
  735. */
  736. __IO uint32_t reserved2[7];
  737. /**
  738. * @brief crm misc2 register, offset:0x50
  739. */
  740. union
  741. {
  742. __IO uint32_t misc2;
  743. struct
  744. {
  745. __IO uint32_t reserved1 : 16;/* [15:0] */
  746. __IO uint32_t clk_to_tmr : 1; /* [16] */
  747. __IO uint32_t reserved2 : 15;/* [31:17] */
  748. } misc2_bit;
  749. };
  750. /**
  751. * @brief crm misc3 register, offset:0x54
  752. */
  753. union
  754. {
  755. __IO uint32_t misc3;
  756. struct
  757. {
  758. __IO uint32_t reserved1 : 4; /* [3:0] */
  759. __IO uint32_t auto_step_en : 2; /* [5:4] */
  760. __IO uint32_t reserved2 : 2; /* [7:6] */
  761. __IO uint32_t hick_to_usb : 1; /* [8] */
  762. __IO uint32_t hick_to_sclk : 1; /* [9] */
  763. __IO uint32_t reserved3 : 22;/* [31:10] */
  764. } misc3_bit;
  765. };
  766. /**
  767. * @brief crm reserved3 register, offset:0x58
  768. */
  769. __IO uint32_t reserved3;
  770. /**
  771. * @brief crm intmap register, offset:0x5C
  772. */
  773. union
  774. {
  775. __IO uint32_t intmap;
  776. struct
  777. {
  778. __IO uint32_t usbintmap : 1; /* [0] */
  779. __IO uint32_t reserved1 : 31;/* [31:1] */
  780. } intmap_bit;
  781. };
  782. } crm_type;
  783. /**
  784. * @}
  785. */
  786. #define CRM ((crm_type *) CRM_BASE)
  787. /** @defgroup CRM_exported_functions
  788. * @{
  789. */
  790. void crm_reset(void);
  791. void crm_lext_bypass(confirm_state new_state);
  792. void crm_hext_bypass(confirm_state new_state);
  793. flag_status crm_flag_get(uint32_t flag);
  794. error_status crm_hext_stable_wait(void);
  795. void crm_hick_clock_trimming_set(uint8_t trim_value);
  796. void crm_hick_clock_calibration_set(uint8_t cali_value);
  797. void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state);
  798. void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state);
  799. void crm_periph_sleep_mode_clock_enable(crm_periph_clock_sleepmd_type value, confirm_state new_state);
  800. void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state);
  801. void crm_flag_clear(uint32_t flag);
  802. void crm_rtc_clock_select(crm_rtc_clock_type value);
  803. void crm_rtc_clock_enable(confirm_state new_state);
  804. void crm_ahb_div_set(crm_ahb_div_type value);
  805. void crm_apb1_div_set(crm_apb1_div_type value);
  806. void crm_apb2_div_set(crm_apb2_div_type value);
  807. void crm_adc_clock_div_set(crm_adc_div_type div_value);
  808. void crm_usb_clock_div_set(crm_usb_div_type div_value);
  809. void crm_clock_failure_detection_enable(confirm_state new_state);
  810. void crm_battery_powered_domain_reset(confirm_state new_state);
  811. void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range);
  812. void crm_sysclk_switch(crm_sclk_type value);
  813. crm_sclk_type crm_sysclk_switch_status_get(void);
  814. void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct);
  815. void crm_clock_out_set(crm_clkout_select_type clkout);
  816. void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state);
  817. void crm_auto_step_mode_enable(confirm_state new_state);
  818. void crm_usb_interrupt_remapping_set(crm_usb_int_map_type int_remap);
  819. void crm_hick_divider_select(crm_hick_div_6_type value);
  820. void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value);
  821. void crm_usb_clock_source_select(crm_usb_clock_source_type value);
  822. void crm_clkout_to_tmr10_enable(confirm_state new_state);
  823. void crm_clkout_div_set(crm_clkout_div_type clkout_div);
  824. /**
  825. * @}
  826. */
  827. /**
  828. * @}
  829. */
  830. /**
  831. * @}
  832. */
  833. #ifdef __cplusplus
  834. }
  835. #endif
  836. #endif