at32f423_crm.h 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. /**
  2. **************************************************************************
  3. * @file at32f423_crm.h
  4. * @brief at32f423 crm 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_CRM_H
  26. #define __AT32F423_CRM_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* includes ------------------------------------------------------------------*/
  31. #include "at32f423.h"
  32. /** @addtogroup AT32F423_periph_driver
  33. * @{
  34. */
  35. /** @addtogroup CRM
  36. * @{
  37. */
  38. #define CRM_REG(value) PERIPH_REG(CRM_BASE, value)
  39. #define CRM_REG_BIT(value) PERIPH_REG_BIT(value)
  40. /** @defgroup CRM_flags_definition
  41. * @brief crm flag
  42. * @{
  43. */
  44. #define CRM_HICK_STABLE_FLAG MAKE_VALUE(0x00, 1) /*!< high speed internal clock stable flag */
  45. #define CRM_HEXT_STABLE_FLAG MAKE_VALUE(0x00, 17) /*!< high speed external crystal stable flag */
  46. #define CRM_PLL_STABLE_FLAG MAKE_VALUE(0x00, 25) /*!< phase locking loop stable flag */
  47. #define CRM_LEXT_STABLE_FLAG MAKE_VALUE(0x70, 1) /*!< low speed external crystal stable flag */
  48. #define CRM_LICK_STABLE_FLAG MAKE_VALUE(0x74, 1) /*!< low speed internal clock stable flag */
  49. #define CRM_ALL_RESET_FLAG MAKE_VALUE(0x74, 24) /*!< all reset flag */
  50. #define CRM_NRST_RESET_FLAG MAKE_VALUE(0x74, 26) /*!< nrst pin reset flag */
  51. #define CRM_POR_RESET_FLAG MAKE_VALUE(0x74, 27) /*!< power on reset flag */
  52. #define CRM_SW_RESET_FLAG MAKE_VALUE(0x74, 28) /*!< software reset flag */
  53. #define CRM_WDT_RESET_FLAG MAKE_VALUE(0x74, 29) /*!< watchdog timer reset flag */
  54. #define CRM_WWDT_RESET_FLAG MAKE_VALUE(0x74, 30) /*!< window watchdog timer reset flag */
  55. #define CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x74, 31) /*!< low-power reset flag */
  56. #define CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x0C, 0) /*!< low speed internal clock stable interrupt ready flag */
  57. #define CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x0C, 1) /*!< low speed external crystal stable interrupt ready flag */
  58. #define CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x0C, 2) /*!< high speed internal clock stable interrupt ready flag */
  59. #define CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x0C, 3) /*!< high speed external crystal stable interrupt ready flag */
  60. #define CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x0C, 4) /*!< phase locking loop stable interrupt ready flag */
  61. #define CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x0C, 7) /*!< clock failure interrupt ready flag */
  62. /**
  63. * @}
  64. */
  65. /** @defgroup CRM_interrupts_definition
  66. * @brief crm interrupt
  67. * @{
  68. */
  69. #define CRM_LICK_STABLE_INT ((uint32_t)0x00000100) /*!< low speed internal clock stable interrupt */
  70. #define CRM_LEXT_STABLE_INT ((uint32_t)0x00000200) /*!< low speed external crystal stable interrupt */
  71. #define CRM_HICK_STABLE_INT ((uint32_t)0x00000400) /*!< high speed internal clock stable interrupt */
  72. #define CRM_HEXT_STABLE_INT ((uint32_t)0x00000800) /*!< high speed external crystal stable interrupt */
  73. #define CRM_PLL_STABLE_INT ((uint32_t)0x00001000) /*!< phase locking loop stable interrupt */
  74. #define CRM_CLOCK_FAILURE_INT ((uint32_t)0x00800000) /*!< clock failure interrupt */
  75. /**
  76. * @}
  77. */
  78. /** @defgroup CRM_exported_types
  79. * @{
  80. */
  81. /**
  82. * @brief crm periph clock
  83. */
  84. typedef enum
  85. {
  86. /* ahb periph1 */
  87. CRM_GPIOA_PERIPH_CLOCK = MAKE_VALUE(0x30, 0), /*!< gpioa periph clock */
  88. CRM_GPIOB_PERIPH_CLOCK = MAKE_VALUE(0x30, 1), /*!< gpiob periph clock */
  89. CRM_GPIOC_PERIPH_CLOCK = MAKE_VALUE(0x30, 2), /*!< gpioc periph clock */
  90. CRM_GPIOD_PERIPH_CLOCK = MAKE_VALUE(0x30, 3), /*!< gpiod periph clock */
  91. CRM_GPIOE_PERIPH_CLOCK = MAKE_VALUE(0x30, 4), /*!< gpioe periph clock */
  92. CRM_GPIOF_PERIPH_CLOCK = MAKE_VALUE(0x30, 5), /*!< gpiof periph clock */
  93. CRM_CRC_PERIPH_CLOCK = MAKE_VALUE(0x30, 12), /*!< crc periph clock */
  94. CRM_DMA1_PERIPH_CLOCK = MAKE_VALUE(0x30, 22), /*!< dma1 periph clock */
  95. CRM_DMA2_PERIPH_CLOCK = MAKE_VALUE(0x30, 24), /*!< dma2 periph clock */
  96. /* ahb periph2 */
  97. CRM_OTGFS1_PERIPH_CLOCK = MAKE_VALUE(0x34, 7), /*!< otgfs1 periph clock */
  98. /* ahb periph3 */
  99. CRM_XMC_PERIPH_CLOCK = MAKE_VALUE(0x38, 0), /*!< xmc periph clock */
  100. /* apb1 periph */
  101. CRM_TMR2_PERIPH_CLOCK = MAKE_VALUE(0x40, 0), /*!< tmr2 periph clock */
  102. CRM_TMR3_PERIPH_CLOCK = MAKE_VALUE(0x40, 1), /*!< tmr3 periph clock */
  103. CRM_TMR4_PERIPH_CLOCK = MAKE_VALUE(0x40, 2), /*!< tmr4 periph clock */
  104. CRM_TMR6_PERIPH_CLOCK = MAKE_VALUE(0x40, 4), /*!< tmr6 periph clock */
  105. CRM_TMR7_PERIPH_CLOCK = MAKE_VALUE(0x40, 5), /*!< tmr7 periph clock */
  106. CRM_TMR12_PERIPH_CLOCK = MAKE_VALUE(0x40, 6), /*!< tmr12 periph clock */
  107. CRM_TMR13_PERIPH_CLOCK = MAKE_VALUE(0x40, 7), /*!< tmr13 periph clock */
  108. CRM_TMR14_PERIPH_CLOCK = MAKE_VALUE(0x40, 8), /*!< tmr14 periph clock */
  109. CRM_WWDT_PERIPH_CLOCK = MAKE_VALUE(0x40, 11), /*!< wwdt periph clock */
  110. CRM_SPI2_PERIPH_CLOCK = MAKE_VALUE(0x40, 14), /*!< spi2 periph clock */
  111. CRM_SPI3_PERIPH_CLOCK = MAKE_VALUE(0x40, 15), /*!< spi3 periph clock */
  112. CRM_USART2_PERIPH_CLOCK = MAKE_VALUE(0x40, 17), /*!< usart2 periph clock */
  113. CRM_USART3_PERIPH_CLOCK = MAKE_VALUE(0x40, 18), /*!< usart3 periph clock */
  114. CRM_USART4_PERIPH_CLOCK = MAKE_VALUE(0x40, 19), /*!< usart4 periph clock */
  115. CRM_USART5_PERIPH_CLOCK = MAKE_VALUE(0x40, 20), /*!< usart5 periph clock */
  116. CRM_I2C1_PERIPH_CLOCK = MAKE_VALUE(0x40, 21), /*!< i2c1 periph clock */
  117. CRM_I2C2_PERIPH_CLOCK = MAKE_VALUE(0x40, 22), /*!< i2c2 periph clock */
  118. CRM_I2C3_PERIPH_CLOCK = MAKE_VALUE(0x40, 23), /*!< i2c3 periph clock */
  119. CRM_CAN1_PERIPH_CLOCK = MAKE_VALUE(0x40, 25), /*!< can1 periph clock */
  120. CRM_CAN2_PERIPH_CLOCK = MAKE_VALUE(0x40, 26), /*!< can2 periph clock */
  121. CRM_PWC_PERIPH_CLOCK = MAKE_VALUE(0x40, 28), /*!< pwc periph clock */
  122. CRM_DAC_PERIPH_CLOCK = MAKE_VALUE(0x40, 29), /*!< dac periph clock */
  123. CRM_USART7_PERIPH_CLOCK = MAKE_VALUE(0x40, 30), /*!< usart7 periph clock */
  124. CRM_USART8_PERIPH_CLOCK = MAKE_VALUE(0x40, 31), /*!< usart8 periph clock */
  125. /* apb2 periph */
  126. CRM_TMR1_PERIPH_CLOCK = MAKE_VALUE(0x44, 0), /*!< tmr1 periph clock */
  127. CRM_USART1_PERIPH_CLOCK = MAKE_VALUE(0x44, 4), /*!< usart1 periph clock */
  128. CRM_USART6_PERIPH_CLOCK = MAKE_VALUE(0x44, 5), /*!< usart6 periph clock */
  129. CRM_ADC1_PERIPH_CLOCK = MAKE_VALUE(0x44, 8), /*!< adc1 periph clock */
  130. CRM_SPI1_PERIPH_CLOCK = MAKE_VALUE(0x44, 12), /*!< spi1 periph clock */
  131. CRM_SCFG_PERIPH_CLOCK = MAKE_VALUE(0x44, 14), /*!< scfg periph clock */
  132. CRM_TMR9_PERIPH_CLOCK = MAKE_VALUE(0x44, 16), /*!< tmr9 periph clock */
  133. CRM_TMR10_PERIPH_CLOCK = MAKE_VALUE(0x44, 17), /*!< tmr10 periph clock */
  134. CRM_TMR11_PERIPH_CLOCK = MAKE_VALUE(0x44, 18), /*!< tmr11 periph clock */
  135. CRM_ACC_PERIPH_CLOCK = MAKE_VALUE(0x44, 29) /*!< acc periph clock */
  136. } crm_periph_clock_type;
  137. /**
  138. * @brief crm periph reset
  139. */
  140. typedef enum
  141. {
  142. /* ahb periph1 */
  143. CRM_GPIOA_PERIPH_RESET = MAKE_VALUE(0x10, 0), /*!< gpioa periph reset */
  144. CRM_GPIOB_PERIPH_RESET = MAKE_VALUE(0x10, 1), /*!< gpiob periph reset */
  145. CRM_GPIOC_PERIPH_RESET = MAKE_VALUE(0x10, 2), /*!< gpioc periph reset */
  146. CRM_GPIOD_PERIPH_RESET = MAKE_VALUE(0x10, 3), /*!< gpiod periph reset */
  147. CRM_GPIOE_PERIPH_RESET = MAKE_VALUE(0x10, 4), /*!< gpioe periph reset */
  148. CRM_GPIOF_PERIPH_RESET = MAKE_VALUE(0x10, 5), /*!< gpiof periph reset */
  149. CRM_CRC_PERIPH_RESET = MAKE_VALUE(0x10, 12), /*!< crc periph reset */
  150. CRM_DMA1_PERIPH_RESET = MAKE_VALUE(0x10, 22), /*!< dma1 periph reset */
  151. CRM_DMA2_PERIPH_RESET = MAKE_VALUE(0x10, 24), /*!< dma2 periph reset */
  152. /* ahb periph2 */
  153. CRM_OTGFS1_PERIPH_RESET = MAKE_VALUE(0x14, 7), /*!< otgfs1 periph reset */
  154. /* ahb periph3 */
  155. CRM_XMC_PERIPH_RESET = MAKE_VALUE(0x18, 0), /*!< xmc periph reset */
  156. /* apb1 periph */
  157. CRM_TMR2_PERIPH_RESET = MAKE_VALUE(0x20, 0), /*!< tmr2 periph reset */
  158. CRM_TMR3_PERIPH_RESET = MAKE_VALUE(0x20, 1), /*!< tmr3 periph reset */
  159. CRM_TMR4_PERIPH_RESET = MAKE_VALUE(0x20, 2), /*!< tmr4 periph reset */
  160. CRM_TMR6_PERIPH_RESET = MAKE_VALUE(0x20, 4), /*!< tmr6 periph reset */
  161. CRM_TMR7_PERIPH_RESET = MAKE_VALUE(0x20, 5), /*!< tmr7 periph reset */
  162. CRM_TMR12_PERIPH_RESET = MAKE_VALUE(0x20, 6), /*!< tmr12 periph reset */
  163. CRM_TMR13_PERIPH_RESET = MAKE_VALUE(0x20, 7), /*!< tmr13 periph reset */
  164. CRM_TMR14_PERIPH_RESET = MAKE_VALUE(0x20, 8), /*!< tmr14 periph reset */
  165. CRM_WWDT_PERIPH_RESET = MAKE_VALUE(0x20, 11), /*!< wwdt periph reset */
  166. CRM_SPI2_PERIPH_RESET = MAKE_VALUE(0x20, 14), /*!< spi2 periph reset */
  167. CRM_SPI3_PERIPH_RESET = MAKE_VALUE(0x20, 15), /*!< spi3 periph reset */
  168. CRM_USART2_PERIPH_RESET = MAKE_VALUE(0x20, 17), /*!< usart2 periph reset */
  169. CRM_USART3_PERIPH_RESET = MAKE_VALUE(0x20, 18), /*!< usart3 periph reset */
  170. CRM_USART4_PERIPH_RESET = MAKE_VALUE(0x20, 19), /*!< usart4 periph reset */
  171. CRM_USART5_PERIPH_RESET = MAKE_VALUE(0x20, 20), /*!< usart5 periph reset */
  172. CRM_I2C1_PERIPH_RESET = MAKE_VALUE(0x20, 21), /*!< i2c1 periph reset */
  173. CRM_I2C2_PERIPH_RESET = MAKE_VALUE(0x20, 22), /*!< i2c2 periph reset */
  174. CRM_I2C3_PERIPH_RESET = MAKE_VALUE(0x20, 23), /*!< i2c3 periph reset */
  175. CRM_CAN1_PERIPH_RESET = MAKE_VALUE(0x20, 25), /*!< can1 periph reset */
  176. CRM_CAN2_PERIPH_RESET = MAKE_VALUE(0x20, 26), /*!< can2 periph reset */
  177. CRM_PWC_PERIPH_RESET = MAKE_VALUE(0x20, 28), /*!< pwc periph reset */
  178. CRM_DAC_PERIPH_RESET = MAKE_VALUE(0x20, 29), /*!< dac periph reset */
  179. CRM_USART7_PERIPH_RESET = MAKE_VALUE(0x20, 30), /*!< usart7 periph reset */
  180. CRM_USART8_PERIPH_RESET = MAKE_VALUE(0x20, 31), /*!< usart8 periph reset */
  181. /* apb2 periph */
  182. CRM_TMR1_PERIPH_RESET = MAKE_VALUE(0x24, 0), /*!< tmr1 periph reset */
  183. CRM_USART1_PERIPH_RESET = MAKE_VALUE(0x24, 4), /*!< usart1 periph reset */
  184. CRM_USART6_PERIPH_RESET = MAKE_VALUE(0x24, 5), /*!< usart6 periph reset */
  185. CRM_ADC_PERIPH_RESET = MAKE_VALUE(0x24, 8), /*!< adc periph reset */
  186. CRM_SPI1_PERIPH_RESET = MAKE_VALUE(0x24, 12), /*!< spi1 periph reset */
  187. CRM_SCFG_PERIPH_RESET = MAKE_VALUE(0x24, 14), /*!< scfg periph reset */
  188. CRM_TMR9_PERIPH_RESET = MAKE_VALUE(0x24, 16), /*!< tmr9 periph reset */
  189. CRM_TMR10_PERIPH_RESET = MAKE_VALUE(0x24, 17), /*!< tmr10 periph reset */
  190. CRM_TMR11_PERIPH_RESET = MAKE_VALUE(0x24, 18), /*!< tmr11 periph reset */
  191. CRM_ACC_PERIPH_RESET = MAKE_VALUE(0x24, 29) /*!< acc periph reset */
  192. } crm_periph_reset_type;
  193. /**
  194. * @brief crm periph clock in low power mode
  195. */
  196. typedef enum
  197. {
  198. /* ahb periph1 */
  199. CRM_GPIOA_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 0), /*!< gpioa sleep mode periph clock */
  200. CRM_GPIOB_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 1), /*!< gpiob sleep mode periph clock */
  201. CRM_GPIOC_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 2), /*!< gpioc sleep mode periph clock */
  202. CRM_GPIOD_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 3), /*!< gpiod sleep mode periph clock */
  203. CRM_GPIOE_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 4), /*!< gpioe sleep mode periph clock */
  204. CRM_GPIOF_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 5), /*!< gpiof sleep mode periph clock */
  205. CRM_CRC_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 12), /*!< crc sleep mode periph clock */
  206. CRM_FLASH_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 15), /*!< flash sleep mode periph clock */
  207. CRM_SRAM_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 16), /*!< sram sleep mode periph clock */
  208. CRM_DMA1_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 22), /*!< dma1 sleep mode periph clock */
  209. CRM_DMA2_PERIPH_LOWPOWER = MAKE_VALUE(0x50, 24), /*!< dma2 sleep mode periph clock */
  210. /* ahb periph2 */
  211. CRM_OTGFS1_PERIPH_LOWPOWER = MAKE_VALUE(0x54, 7), /*!< otgfs1 sleep mode periph clock */
  212. /* ahb periph3 */
  213. CRM_XMC_PERIPH_LOWPOWER = MAKE_VALUE(0x58, 0), /*!< xmc sleep mode periph clock */
  214. /* apb1 periph */
  215. CRM_TMR2_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 0), /*!< tmr2 sleep mode periph clock */
  216. CRM_TMR3_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 1), /*!< tmr3 sleep mode periph clock */
  217. CRM_TMR4_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 2), /*!< tmr4 sleep mode periph clock */
  218. CRM_TMR6_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 4), /*!< tmr6 sleep mode periph clock */
  219. CRM_TMR7_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 5), /*!< tmr7 sleep mode periph clock */
  220. CRM_TMR12_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 6), /*!< tmr12 sleep mode periph clock */
  221. CRM_TMR13_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 7), /*!< tmr13 sleep mode periph clock */
  222. CRM_TMR14_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 8), /*!< tmr14 sleep mode periph clock */
  223. CRM_WWDT_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 11), /*!< wwdt sleep mode periph clock */
  224. CRM_SPI2_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 14), /*!< spi2 sleep mode periph clock */
  225. CRM_SPI3_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 15), /*!< spi3 sleep mode periph clock */
  226. CRM_USART2_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 17), /*!< usart2 sleep mode periph clock */
  227. CRM_USART3_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 18), /*!< usart3 sleep mode periph clock */
  228. CRM_USART4_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 19), /*!< usart4 sleep mode periph clock */
  229. CRM_USART5_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 20), /*!< usart5 sleep mode periph clock */
  230. CRM_I2C1_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 21), /*!< i2c1 sleep mode periph clock */
  231. CRM_I2C2_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 22), /*!< i2c2 sleep mode periph clock */
  232. CRM_I2C3_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 23), /*!< i2c3 sleep mode periph clock */
  233. CRM_CAN1_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 25), /*!< can1 sleep mode periph clock */
  234. CRM_CAN2_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 26), /*!< can2 sleep mode periph clock */
  235. CRM_PWC_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 28), /*!< pwc sleep mode periph clock */
  236. CRM_DAC_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 29), /*!< dac sleep mode periph clock */
  237. CRM_USART7_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 30), /*!< usart7 sleep mode periph clock */
  238. CRM_USART8_PERIPH_LOWPOWER = MAKE_VALUE(0x60, 31), /*!< usart8 sleep mode periph clock */
  239. /* apb2 periph */
  240. CRM_TMR1_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 0), /*!< tmr1 sleep mode periph clock */
  241. CRM_TMR8_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 1), /*!< tmr8 sleep mode periph clock */
  242. CRM_USART1_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 4), /*!< usart1 sleep mode periph clock */
  243. CRM_USART6_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 5), /*!< usart6 sleep mode periph clock */
  244. CRM_ADC1_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 8), /*!< adc1 sleep mode periph clock */
  245. CRM_ADC2_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 9), /*!< adc2 sleep mode periph clock */
  246. CRM_ADC3_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 10), /*!< adc3 sleep mode periph clock */
  247. CRM_SPI1_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 12), /*!< spi1 sleep mode periph clock */
  248. CRM_SPI4_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 13), /*!< spi4 sleep mode periph clock */
  249. CRM_SCFG_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 14), /*!< scfg sleep mode periph clock */
  250. CRM_TMR9_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 16), /*!< tmr9 sleep mode periph clock */
  251. CRM_TMR10_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 17), /*!< tmr10 sleep mode periph clock */
  252. CRM_TMR11_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 18), /*!< tmr11 sleep mode periph clock */
  253. CRM_ACC_PERIPH_LOWPOWER = MAKE_VALUE(0x64, 29) /*!< acc sleep mode periph clock */
  254. } crm_periph_clock_lowpower_type;
  255. /**
  256. * @brief crm pll clock source
  257. */
  258. typedef enum
  259. {
  260. CRM_PLL_SOURCE_HICK = 0x00, /*!< high speed internal clock as pll reference clock source */
  261. CRM_PLL_SOURCE_HEXT = 0x01 /*!< high speed external crystal as pll reference clock source */
  262. } crm_pll_clock_source_type;
  263. /**
  264. * @brief crm pll fr
  265. */
  266. typedef enum
  267. {
  268. CRM_PLL_FR_1 = 0x00, /*!< pll post-division div1 */
  269. CRM_PLL_FR_2 = 0x01, /*!< pll post-division div2 */
  270. CRM_PLL_FR_4 = 0x02, /*!< pll post-division div4 */
  271. CRM_PLL_FR_8 = 0x03, /*!< pll post-division div8 */
  272. CRM_PLL_FR_16 = 0x04, /*!< pll post-division div16 */
  273. CRM_PLL_FR_32 = 0x05 /*!< pll post-division div32 */
  274. } crm_pll_fr_type;
  275. /**
  276. * @brief crm clock source
  277. */
  278. typedef enum
  279. {
  280. CRM_CLOCK_SOURCE_HICK = 0x00, /*!< high speed internal clock */
  281. CRM_CLOCK_SOURCE_HEXT = 0x01, /*!< high speed external crystal */
  282. CRM_CLOCK_SOURCE_PLL = 0x02, /*!< phase locking loop */
  283. CRM_CLOCK_SOURCE_LEXT = 0x03, /*!< low speed external crystal */
  284. CRM_CLOCK_SOURCE_LICK = 0x04 /*!< low speed internal clock */
  285. } crm_clock_source_type;
  286. /**
  287. * @brief crm ahb division
  288. */
  289. typedef enum
  290. {
  291. CRM_AHB_DIV_1 = 0x00, /*!< sclk div1 to ahbclk */
  292. CRM_AHB_DIV_2 = 0x08, /*!< sclk div2 to ahbclk */
  293. CRM_AHB_DIV_4 = 0x09, /*!< sclk div4 to ahbclk */
  294. CRM_AHB_DIV_8 = 0x0A, /*!< sclk div8 to ahbclk */
  295. CRM_AHB_DIV_16 = 0x0B, /*!< sclk div16 to ahbclk */
  296. CRM_AHB_DIV_64 = 0x0C, /*!< sclk div64 to ahbclk */
  297. CRM_AHB_DIV_128 = 0x0D, /*!< sclk div128 to ahbclk */
  298. CRM_AHB_DIV_256 = 0x0E, /*!< sclk div256 to ahbclk */
  299. CRM_AHB_DIV_512 = 0x0F /*!< sclk div512 to ahbclk */
  300. } crm_ahb_div_type;
  301. /**
  302. * @brief crm apb1 division
  303. */
  304. typedef enum
  305. {
  306. CRM_APB1_DIV_1 = 0x00, /*!< ahbclk div1 to apb1clk */
  307. CRM_APB1_DIV_2 = 0x04, /*!< ahbclk div2 to apb1clk */
  308. CRM_APB1_DIV_4 = 0x05, /*!< ahbclk div4 to apb1clk */
  309. CRM_APB1_DIV_8 = 0x06, /*!< ahbclk div8 to apb1clk */
  310. CRM_APB1_DIV_16 = 0x07 /*!< ahbclk div16 to apb1clk */
  311. } crm_apb1_div_type;
  312. /**
  313. * @brief crm apb2 division
  314. */
  315. typedef enum
  316. {
  317. CRM_APB2_DIV_1 = 0x00, /*!< ahbclk div1 to apb2clk */
  318. CRM_APB2_DIV_2 = 0x04, /*!< ahbclk div2 to apb2clk */
  319. CRM_APB2_DIV_4 = 0x05, /*!< ahbclk div4 to apb2clk */
  320. CRM_APB2_DIV_8 = 0x06, /*!< ahbclk div8 to apb2clk */
  321. CRM_APB2_DIV_16 = 0x07 /*!< ahbclk div16 to apb2clk */
  322. } crm_apb2_div_type;
  323. /**
  324. * @brief crm hext to sysclk division
  325. */
  326. typedef enum
  327. {
  328. CRM_HEXT_SCLK_DIV_1 = 0x00, /*!< hext div1 to sysclk */
  329. CRM_HEXT_SCLK_DIV_2 = 0x01, /*!< hext div2 to sysclk */
  330. CRM_HEXT_SCLK_DIV_4 = 0x02, /*!< hext div4 to sysclk */
  331. CRM_HEXT_SCLK_DIV_8 = 0x03, /*!< hext div8 to sysclk */
  332. CRM_HEXT_SCLK_DIV_16 = 0x04, /*!< hext div16 to sysclk */
  333. CRM_HEXT_SCLK_DIV_32 = 0x05 /*!< hext div32 to sysclk */
  334. } crm_hext_sclk_div_type;
  335. /**
  336. * @brief crm hick to sysclk division
  337. */
  338. typedef enum
  339. {
  340. CRM_HICK_SCLK_DIV_1 = 0x00, /*!< hick div1 to sysclk */
  341. CRM_HICK_SCLK_DIV_2 = 0x01, /*!< hick div2 to sysclk */
  342. CRM_HICK_SCLK_DIV_4 = 0x02, /*!< hick div4 to sysclk */
  343. CRM_HICK_SCLK_DIV_8 = 0x03, /*!< hick div8 to sysclk */
  344. CRM_HICK_SCLK_DIV_16 = 0x04 /*!< hick div16 to sysclk */
  345. } crm_hick_sclk_div_type;
  346. /**
  347. * @brief crm usb division
  348. */
  349. typedef enum
  350. {
  351. CRM_USB_DIV_3 = 0x00, /*!< pllclk div3 to usbclk */
  352. CRM_USB_DIV_2 = 0x01, /*!< pllclk div2 to usbclk */
  353. CRM_USB_DIV_5 = 0x02, /*!< pllclk div5 to usbclk */
  354. CRM_USB_DIV_4 = 0x03, /*!< pllclk div4 to usbclk */
  355. CRM_USB_DIV_7 = 0x04, /*!< pllclk div7 to usbclk */
  356. CRM_USB_DIV_6 = 0x05, /*!< pllclk div6 to usbclk */
  357. CRM_USB_DIV_9 = 0x06, /*!< pllclk div9 to usbclk */
  358. CRM_USB_DIV_8 = 0x07, /*!< pllclk div8 to usbclk */
  359. } crm_usb_div_type;
  360. /**
  361. * @brief crm ertc clock
  362. */
  363. typedef enum
  364. {
  365. CRM_ERTC_CLOCK_NOCLK = 0x000, /*!< no clock as ertc clock source */
  366. CRM_ERTC_CLOCK_LEXT = 0x001, /*!< low speed external crystal as ertc clock source */
  367. CRM_ERTC_CLOCK_LICK = 0x002, /*!< low speed internal clock as ertc clock source */
  368. CRM_ERTC_CLOCK_HEXT_DIV_2 = 0x023, /*!< high speed external crystal div2 as ertc clock source */
  369. CRM_ERTC_CLOCK_HEXT_DIV_3 = 0x033, /*!< high speed external crystal div3 as ertc clock source */
  370. CRM_ERTC_CLOCK_HEXT_DIV_4 = 0x043, /*!< high speed external crystal div4 as ertc clock source */
  371. CRM_ERTC_CLOCK_HEXT_DIV_5 = 0x053, /*!< high speed external crystal div5 as ertc clock source */
  372. CRM_ERTC_CLOCK_HEXT_DIV_6 = 0x063, /*!< high speed external crystal div6 as ertc clock source */
  373. CRM_ERTC_CLOCK_HEXT_DIV_7 = 0x073, /*!< high speed external crystal div7 as ertc clock source */
  374. CRM_ERTC_CLOCK_HEXT_DIV_8 = 0x083, /*!< high speed external crystal div8 as ertc clock source */
  375. CRM_ERTC_CLOCK_HEXT_DIV_9 = 0x093, /*!< high speed external crystal div9 as ertc clock source */
  376. CRM_ERTC_CLOCK_HEXT_DIV_10 = 0x0A3, /*!< high speed external crystal div10 as ertc clock source */
  377. CRM_ERTC_CLOCK_HEXT_DIV_11 = 0x0B3, /*!< high speed external crystal div11 as ertc clock source */
  378. CRM_ERTC_CLOCK_HEXT_DIV_12 = 0x0C3, /*!< high speed external crystal div12 as ertc clock source */
  379. CRM_ERTC_CLOCK_HEXT_DIV_13 = 0x0D3, /*!< high speed external crystal div13 as ertc clock source */
  380. CRM_ERTC_CLOCK_HEXT_DIV_14 = 0x0E3, /*!< high speed external crystal div14 as ertc clock source */
  381. CRM_ERTC_CLOCK_HEXT_DIV_15 = 0x0F3, /*!< high speed external crystal div15 as ertc clock source */
  382. CRM_ERTC_CLOCK_HEXT_DIV_16 = 0x103, /*!< high speed external crystal div16 as ertc clock source */
  383. CRM_ERTC_CLOCK_HEXT_DIV_17 = 0x113, /*!< high speed external crystal div17 as ertc clock source */
  384. CRM_ERTC_CLOCK_HEXT_DIV_18 = 0x123, /*!< high speed external crystal div18 as ertc clock source */
  385. CRM_ERTC_CLOCK_HEXT_DIV_19 = 0x133, /*!< high speed external crystal div19 as ertc clock source */
  386. CRM_ERTC_CLOCK_HEXT_DIV_20 = 0x143, /*!< high speed external crystal div20 as ertc clock source */
  387. CRM_ERTC_CLOCK_HEXT_DIV_21 = 0x153, /*!< high speed external crystal div21 as ertc clock source */
  388. CRM_ERTC_CLOCK_HEXT_DIV_22 = 0x163, /*!< high speed external crystal div22 as ertc clock source */
  389. CRM_ERTC_CLOCK_HEXT_DIV_23 = 0x173, /*!< high speed external crystal div23 as ertc clock source */
  390. CRM_ERTC_CLOCK_HEXT_DIV_24 = 0x183, /*!< high speed external crystal div24 as ertc clock source */
  391. CRM_ERTC_CLOCK_HEXT_DIV_25 = 0x193, /*!< high speed external crystal div25 as ertc clock source */
  392. CRM_ERTC_CLOCK_HEXT_DIV_26 = 0x1A3, /*!< high speed external crystal div26 as ertc clock source */
  393. CRM_ERTC_CLOCK_HEXT_DIV_27 = 0x1B3, /*!< high speed external crystal div27 as ertc clock source */
  394. CRM_ERTC_CLOCK_HEXT_DIV_28 = 0x1C3, /*!< high speed external crystal div28 as ertc clock source */
  395. CRM_ERTC_CLOCK_HEXT_DIV_29 = 0x1D3, /*!< high speed external crystal div29 as ertc clock source */
  396. CRM_ERTC_CLOCK_HEXT_DIV_30 = 0x1E3, /*!< high speed external crystal div30 as ertc clock source */
  397. CRM_ERTC_CLOCK_HEXT_DIV_31 = 0x1F3 /*!< high speed external crystal div31 as ertc clock source */
  398. } crm_ertc_clock_type;
  399. /**
  400. * @brief crm hick 48mhz division
  401. */
  402. typedef enum
  403. {
  404. CRM_HICK48_DIV6 = 0x00, /*!< fixed 8 mhz when hick is selected as sclk */
  405. CRM_HICK48_NODIV = 0x01 /*!< 8 mhz or 48 mhz depend on hickdiv when hick is selected as sclk */
  406. } crm_hick_div_6_type;
  407. /**
  408. * @brief crm sclk select
  409. */
  410. typedef enum
  411. {
  412. CRM_SCLK_HICK = 0x00, /*!< select high speed internal clock as sclk */
  413. CRM_SCLK_HEXT = 0x01, /*!< select high speed external crystal as sclk */
  414. CRM_SCLK_PLL = 0x02 /*!< select phase locking loop clock as sclk */
  415. } crm_sclk_type;
  416. /**
  417. * @brief crm clkout2 select
  418. */
  419. typedef enum
  420. {
  421. CRM_CLKOUT_SCLK = 0x00, /*!< output system clock to clkout2 pin */
  422. CRM_CLKOUT_HEXT = 0x02, /*!< output high speed external crystal to clkout2 pin */
  423. CRM_CLKOUT_PLL = 0x03, /*!< output phase locking loop clock to clkout2 pin */
  424. CRM_CLKOUT_USB = 0x10, /*!< output usbclk to clkout2 pin */
  425. CRM_CLKOUT_ADC = 0x11, /*!< output adcclk to clkout2 pin */
  426. CRM_CLKOUT_HICK = 0x12, /*!< output high speed internal clock to clkout2 pin */
  427. CRM_CLKOUT_LICK = 0x13, /*!< output low speed internal clock to clkout2 pin */
  428. CRM_CLKOUT_LEXT = 0x14 /*!< output low speed external crystal to clkout2 pin */
  429. } crm_clkout_select_type;
  430. /**
  431. * @brief crm clkout division1
  432. */
  433. typedef enum
  434. {
  435. CRM_CLKOUT_DIV1_1 = 0x00, /*!< clkout division1 div1 */
  436. CRM_CLKOUT_DIV1_2 = 0x04, /*!< clkout division1 div2 */
  437. CRM_CLKOUT_DIV1_3 = 0x05, /*!< clkout division1 div3 */
  438. CRM_CLKOUT_DIV1_4 = 0x06, /*!< clkout division1 div4 */
  439. CRM_CLKOUT_DIV1_5 = 0x07 /*!< clkout division1 div5 */
  440. } crm_clkout_div1_type;
  441. /**
  442. * @brief crm clkout division2
  443. */
  444. typedef enum
  445. {
  446. CRM_CLKOUT_DIV2_1 = 0x00, /*!< clkout division2 div1 */
  447. CRM_CLKOUT_DIV2_2 = 0x08, /*!< clkout division2 div2 */
  448. CRM_CLKOUT_DIV2_4 = 0x09, /*!< clkout division2 div4 */
  449. CRM_CLKOUT_DIV2_8 = 0x0A, /*!< clkout division2 div8 */
  450. CRM_CLKOUT_DIV2_16 = 0x0B, /*!< clkout division2 div16 */
  451. CRM_CLKOUT_DIV2_64 = 0x0C, /*!< clkout division2 div64 */
  452. CRM_CLKOUT_DIV2_128 = 0x0D, /*!< clkout division2 div128 */
  453. CRM_CLKOUT_DIV2_256 = 0x0E, /*!< clkout division2 div256 */
  454. CRM_CLKOUT_DIV2_512 = 0x0F /*!< clkout division2 div512 */
  455. } crm_clkout_div2_type;
  456. /**
  457. * @brief crm auto step mode
  458. */
  459. typedef enum
  460. {
  461. CRM_AUTO_STEP_MODE_DISABLE = 0x00, /*!< disable auto step mode */
  462. CRM_AUTO_STEP_MODE_ENABLE = 0x03 /*!< enable auto step mode */
  463. } crm_auto_step_mode_type;
  464. /**
  465. * @brief crm usart index
  466. */
  467. typedef enum
  468. {
  469. CRM_USART1 = 0x00, /*!< usart1 */
  470. CRM_USART2 = 0x01, /*!< usart2 */
  471. CRM_USART3 = 0x02 /*!< usart3 */
  472. } crm_usart_type;
  473. /**
  474. * @brief crm i2c index
  475. */
  476. typedef enum
  477. {
  478. CRM_I2C1 = 0x00 /*!< i2c1 */
  479. } crm_i2c_type;
  480. /**
  481. * @brief crm usart clock source
  482. */
  483. typedef enum
  484. {
  485. CRM_USART_CLOCK_SOURCE_PCLK = 0x00, /*!< select pclk clock as usart clock source */
  486. CRM_USART_CLOCK_SOURCE_SCLK = 0x01, /*!< select system clock as usart clock source */
  487. CRM_USART_CLOCK_SOURCE_HICK = 0x02, /*!< select high speed internal clock as usart clock source */
  488. CRM_USART_CLOCK_SOURCE_LEXT = 0x03 /*!< select low speed external crystal as usart clock source */
  489. } crm_usart_clock_source_type;
  490. /**
  491. * @brief crm i2c clock source
  492. */
  493. typedef enum
  494. {
  495. CRM_I2C_CLOCK_SOURCE_PCLK = 0x00, /*!< select pclk clock as usart clock source */
  496. CRM_I2C_CLOCK_SOURCE_SCLK = 0x01, /*!< select system clock as usart clock source */
  497. CRM_I2C_CLOCK_SOURCE_HICK = 0x02 /*!< select high speed internal clock as usart clock source */
  498. } crm_i2c_clock_source_type;
  499. /**
  500. * @brief crm adc clock source
  501. */
  502. typedef enum
  503. {
  504. CRM_ADC_CLOCK_SOURCE_HCLK = 0x00, /*!< select hclk clock as adc clock source */
  505. CRM_ADC_CLOCK_SOURCE_PLLCLK = 0x01 /*!< select pll clock as adc clock source */
  506. } crm_adc_clock_source_type;
  507. /**
  508. * @brief crm usb 48 mhz clock source select
  509. */
  510. typedef enum
  511. {
  512. CRM_USB_CLOCK_SOURCE_PLL = 0x00, /*!< select phase locking loop clock as usb clock source */
  513. CRM_USB_CLOCK_SOURCE_HICK = 0x01 /*!< select high speed internal clock as usb clock source */
  514. } crm_usb_clock_source_type;
  515. /**
  516. * @brief crm hick as system clock frequency select
  517. */
  518. typedef enum
  519. {
  520. CRM_HICK_SCLK_8MHZ = 0x00, /*!< fixed 8 mhz when hick is selected as sclk */
  521. CRM_HICK_SCLK_48MHZ = 0x01 /*!< 8 mhz or 48 mhz depend on hickdiv when hick is selected as sclk */
  522. } crm_hick_sclk_frequency_type;
  523. /**
  524. * @brief crm clocks freqency structure
  525. */
  526. typedef struct
  527. {
  528. uint32_t sclk_freq; /*!< system clock frequency */
  529. uint32_t ahb_freq; /*!< ahb bus clock frequency */
  530. uint32_t apb2_freq; /*!< apb2 bus clock frequency */
  531. uint32_t apb1_freq; /*!< apb1 bus clock frequency */
  532. } crm_clocks_freq_type;
  533. /**
  534. * @brief type define crm register all
  535. */
  536. typedef struct
  537. {
  538. /**
  539. * @brief crm ctrl register, offset:0x00
  540. */
  541. union
  542. {
  543. __IO uint32_t ctrl;
  544. struct
  545. {
  546. __IO uint32_t hicken : 1; /* [0] */
  547. __IO uint32_t hickstbl : 1; /* [1] */
  548. __IO uint32_t hicktrim : 6; /* [7:2] */
  549. __IO uint32_t hickcal : 8; /* [15:8] */
  550. __IO uint32_t hexten : 1; /* [16] */
  551. __IO uint32_t hextstbl : 1; /* [17] */
  552. __IO uint32_t hextbyps : 1; /* [18] */
  553. __IO uint32_t cfden : 1; /* [19] */
  554. __IO uint32_t reserved1 : 4; /* [23:20] */
  555. __IO uint32_t pllen : 1; /* [24] */
  556. __IO uint32_t pllstbl : 1; /* [25] */
  557. __IO uint32_t reserved2 : 6; /* [31:26] */
  558. } ctrl_bit;
  559. };
  560. /**
  561. * @brief crm pllcfg register, offset:0x04
  562. */
  563. union
  564. {
  565. __IO uint32_t pllcfg;
  566. struct
  567. {
  568. __IO uint32_t pllms : 4; /* [3:0] */
  569. __IO uint32_t reserved1 : 2; /* [5:4] */
  570. __IO uint32_t pllns : 9; /* [14:6] */
  571. __IO uint32_t reserved2 : 1; /* [15] */
  572. __IO uint32_t pllfr : 3; /* [18:16] */
  573. __IO uint32_t reserved3 : 3; /* [21:19] */
  574. __IO uint32_t pllrcs : 1; /* [22] */
  575. __IO uint32_t reserved4 : 9; /* [31:23] */
  576. } pllcfg_bit;
  577. };
  578. /**
  579. * @brief crm cfg register, offset:0x08
  580. */
  581. union
  582. {
  583. __IO uint32_t cfg;
  584. struct
  585. {
  586. __IO uint32_t sclksel : 2; /* [1:0] */
  587. __IO uint32_t sclksts : 2; /* [3:2] */
  588. __IO uint32_t ahbdiv : 4; /* [7:4] */
  589. __IO uint32_t reserved1 : 2; /* [9:8] */
  590. __IO uint32_t apb1div : 3; /* [12:10] */
  591. __IO uint32_t apb2div : 3; /* [15:13] */
  592. __IO uint32_t ertcdiv : 5; /* [20:16] */
  593. __IO uint32_t reserved2 : 6; /* [26:21] */
  594. __IO uint32_t clkoutdiv1 : 3; /* [29:27] */
  595. __IO uint32_t clkout_sel1 : 2; /* [31:30] */
  596. } cfg_bit;
  597. };
  598. /**
  599. * @brief crm clkint register, offset:0x0C
  600. */
  601. union
  602. {
  603. __IO uint32_t clkint;
  604. struct
  605. {
  606. __IO uint32_t lickstblf : 1; /* [0] */
  607. __IO uint32_t lextstblf : 1; /* [1] */
  608. __IO uint32_t hickstblf : 1; /* [2] */
  609. __IO uint32_t hextstblf : 1; /* [3] */
  610. __IO uint32_t pllstblf : 1; /* [4] */
  611. __IO uint32_t reserved1 : 2; /* [6:5] */
  612. __IO uint32_t cfdf : 1; /* [7] */
  613. __IO uint32_t lickstblien : 1; /* [8] */
  614. __IO uint32_t lextstblien : 1; /* [9] */
  615. __IO uint32_t hickstblien : 1; /* [10] */
  616. __IO uint32_t hextstblien : 1; /* [11] */
  617. __IO uint32_t pllstblien : 1; /* [12] */
  618. __IO uint32_t reserved2 : 3; /* [15:13] */
  619. __IO uint32_t lickstblfc : 1; /* [16] */
  620. __IO uint32_t lextstblfc : 1; /* [17] */
  621. __IO uint32_t hickstblfc : 1; /* [18] */
  622. __IO uint32_t hextstblfc : 1; /* [19] */
  623. __IO uint32_t pllstblfc : 1; /* [20] */
  624. __IO uint32_t reserved3 : 2; /* [22:21] */
  625. __IO uint32_t cfdfc : 1; /* [23] */
  626. __IO uint32_t reserved4 : 8; /* [31:24] */
  627. } clkint_bit;
  628. };
  629. /**
  630. * @brief crm ahbrst1 register, offset:0x10
  631. */
  632. union
  633. {
  634. __IO uint32_t ahbrst1;
  635. struct
  636. {
  637. __IO uint32_t gpioarst : 1; /* [0] */
  638. __IO uint32_t gpiobrst : 1; /* [1] */
  639. __IO uint32_t gpiocrst : 1; /* [2] */
  640. __IO uint32_t gpiodrst : 1; /* [3] */
  641. __IO uint32_t gpioerst : 1; /* [4] */
  642. __IO uint32_t gpiofrst : 1; /* [5] */
  643. __IO uint32_t reserved1 : 6; /* [11:6] */
  644. __IO uint32_t crcrst : 1; /* [12] */
  645. __IO uint32_t reserved2 : 9; /* [21:13] */
  646. __IO uint32_t dma1rst : 1; /* [22] */
  647. __IO uint32_t reserved3 : 1; /* [23] */
  648. __IO uint32_t dma2rst : 1; /* [24] */
  649. __IO uint32_t reserved4 : 7; /* [31:25] */
  650. } ahbrst1_bit;
  651. };
  652. /**
  653. * @brief crm ahbrst2 register, offset:0x14
  654. */
  655. union
  656. {
  657. __IO uint32_t ahbrst2;
  658. struct
  659. {
  660. __IO uint32_t reserved1 : 7; /* [6:0] */
  661. __IO uint32_t otgfs1rst : 1; /* [7] */
  662. __IO uint32_t reserved2 : 24;/* [31:8] */
  663. } ahbrst2_bit;
  664. };
  665. /**
  666. * @brief crm ahbrst3 register, offset:0x18
  667. */
  668. union
  669. {
  670. __IO uint32_t ahbrst3;
  671. struct
  672. {
  673. __IO uint32_t xmcrst : 1; /* [0] */
  674. __IO uint32_t reserved1 : 31;/* [31:1] */
  675. } ahbrst3_bit;
  676. };
  677. /**
  678. * @brief crm reserved1 register, offset:0x1C
  679. */
  680. __IO uint32_t reserved1;
  681. /**
  682. * @brief crm apb1rst register, offset:0x20
  683. */
  684. union
  685. {
  686. __IO uint32_t apb1rst;
  687. struct
  688. {
  689. __IO uint32_t tmr2rst : 1; /* [0] */
  690. __IO uint32_t tmr3rst : 1; /* [1] */
  691. __IO uint32_t tmr4rst : 1; /* [2] */
  692. __IO uint32_t reserved1 : 1; /* [3] */
  693. __IO uint32_t tmr6rst : 1; /* [4] */
  694. __IO uint32_t tmr7rst : 1; /* [5] */
  695. __IO uint32_t tmr12rst : 1; /* [6] */
  696. __IO uint32_t tmr13rst : 1; /* [7] */
  697. __IO uint32_t adc14rst : 1; /* [8] */
  698. __IO uint32_t reserved2 : 2; /* [10:9] */
  699. __IO uint32_t wwdtrst : 1; /* [11] */
  700. __IO uint32_t reserved3 : 2; /* [13:12] */
  701. __IO uint32_t spi2rst : 1; /* [14] */
  702. __IO uint32_t spi3rst : 1; /* [15] */
  703. __IO uint32_t reserved4 : 1; /* [16] */
  704. __IO uint32_t usart2rst : 1; /* [17] */
  705. __IO uint32_t usart3rst : 1; /* [18] */
  706. __IO uint32_t usart4rst : 1; /* [19] */
  707. __IO uint32_t usart5rst : 1; /* [20] */
  708. __IO uint32_t i2c1rst : 1; /* [21] */
  709. __IO uint32_t i2c2rst : 1; /* [22] */
  710. __IO uint32_t i2c3rst : 1; /* [23] */
  711. __IO uint32_t reserved5 : 1; /* [24] */
  712. __IO uint32_t can1rst : 1; /* [25] */
  713. __IO uint32_t can2rst : 1; /* [26] */
  714. __IO uint32_t reserved6 : 1; /* [27] */
  715. __IO uint32_t pwcrst : 1; /* [28] */
  716. __IO uint32_t dacrst : 1; /* [29] */
  717. __IO uint32_t usart7rst : 1; /* [30] */
  718. __IO uint32_t usart8rst : 1; /* [31] */
  719. } apb1rst_bit;
  720. };
  721. /**
  722. * @brief crm apb2rst register, offset:0x24
  723. */
  724. union
  725. {
  726. __IO uint32_t apb2rst;
  727. struct
  728. {
  729. __IO uint32_t tmr1rst : 1; /* [0] */
  730. __IO uint32_t reserved1 : 3; /* [3:1] */
  731. __IO uint32_t usart1rst : 1; /* [4] */
  732. __IO uint32_t usart6rst : 1; /* [5] */
  733. __IO uint32_t reserved2 : 2; /* [7:6] */
  734. __IO uint32_t adcrst : 1; /* [8] */
  735. __IO uint32_t reserved3 : 3; /* [11:9] */
  736. __IO uint32_t spi1rst : 1; /* [12] */
  737. __IO uint32_t reserved4 : 1; /* [13] */
  738. __IO uint32_t scfgrst : 1; /* [14] */
  739. __IO uint32_t reserved5 : 1; /* [15] */
  740. __IO uint32_t tmr9rst : 1; /* [16] */
  741. __IO uint32_t tmr10rst : 1; /* [17] */
  742. __IO uint32_t tmr11rst : 1; /* [18] */
  743. __IO uint32_t reserved6 : 10;/* [28:19] */
  744. __IO uint32_t accrst : 1; /* [29] */
  745. __IO uint32_t reserved7 : 2; /* [31:30] */
  746. } apb2rst_bit;
  747. };
  748. /**
  749. * @brief crm reserved2 register, offset:0x28~0x2C
  750. */
  751. __IO uint32_t reserved2[2];
  752. /**
  753. * @brief crm ahben1 register, offset:0x30
  754. */
  755. union
  756. {
  757. __IO uint32_t ahben1;
  758. struct
  759. {
  760. __IO uint32_t gpioaen : 1; /* [0] */
  761. __IO uint32_t gpioben : 1; /* [1] */
  762. __IO uint32_t gpiocen : 1; /* [2] */
  763. __IO uint32_t gpioden : 1; /* [3] */
  764. __IO uint32_t gpioeen : 1; /* [4] */
  765. __IO uint32_t gpiofen : 1; /* [5] */
  766. __IO uint32_t reserved1 : 6; /* [11:6] */
  767. __IO uint32_t crcen : 1; /* [12] */
  768. __IO uint32_t reserved2 : 9; /* [21:13] */
  769. __IO uint32_t dma1en : 1; /* [22] */
  770. __IO uint32_t reserved3 : 1; /* [23] */
  771. __IO uint32_t dma2en : 1; /* [24] */
  772. __IO uint32_t reserved4 : 7; /* [31:25] */
  773. } ahben1_bit;
  774. };
  775. /**
  776. * @brief crm ahben2 register, offset:0x34
  777. */
  778. union
  779. {
  780. __IO uint32_t ahben2;
  781. struct
  782. {
  783. __IO uint32_t reserved1 : 7; /* [6:0] */
  784. __IO uint32_t otgfs1en : 1; /* [7] */
  785. __IO uint32_t reserved2 : 24;/* [31:8] */
  786. } ahben2_bit;
  787. };
  788. /**
  789. * @brief crm ahben3 register, offset:0x38
  790. */
  791. union
  792. {
  793. __IO uint32_t ahben3;
  794. struct
  795. {
  796. __IO uint32_t xmcen : 1; /* [0] */
  797. __IO uint32_t reserved1 : 31;/* [31:1] */
  798. } ahben3_bit;
  799. };
  800. /**
  801. * @brief crm reserved3 register, offset:0x3C
  802. */
  803. __IO uint32_t reserved3;
  804. /**
  805. * @brief crm apb1en register, offset:0x40
  806. */
  807. union
  808. {
  809. __IO uint32_t apb1en;
  810. struct
  811. {
  812. __IO uint32_t tmr2en : 1; /* [0] */
  813. __IO uint32_t tmr3en : 1; /* [1] */
  814. __IO uint32_t tmr4en : 1; /* [2] */
  815. __IO uint32_t reserved1 : 1; /* [3] */
  816. __IO uint32_t tmr6en : 1; /* [4] */
  817. __IO uint32_t tmr7en : 1; /* [5] */
  818. __IO uint32_t tmr12en : 1; /* [6] */
  819. __IO uint32_t tmr13en : 1; /* [7] */
  820. __IO uint32_t adc14en : 1; /* [8] */
  821. __IO uint32_t reserved2 : 2; /* [10:9] */
  822. __IO uint32_t wwdten : 1; /* [11] */
  823. __IO uint32_t reserved3 : 2; /* [13:12] */
  824. __IO uint32_t spi2en : 1; /* [14] */
  825. __IO uint32_t spi3en : 1; /* [15] */
  826. __IO uint32_t reserved4 : 1; /* [16] */
  827. __IO uint32_t usart2en : 1; /* [17] */
  828. __IO uint32_t usart3en : 1; /* [18] */
  829. __IO uint32_t usart4en : 1; /* [19] */
  830. __IO uint32_t usart5en : 1; /* [20] */
  831. __IO uint32_t i2c1en : 1; /* [21] */
  832. __IO uint32_t i2c2en : 1; /* [22] */
  833. __IO uint32_t i2c3en : 1; /* [23] */
  834. __IO uint32_t reserved5 : 1; /* [24] */
  835. __IO uint32_t can1en : 1; /* [25] */
  836. __IO uint32_t can2en : 1; /* [26] */
  837. __IO uint32_t reserved6 : 1; /* [27] */
  838. __IO uint32_t pwcen : 1; /* [28] */
  839. __IO uint32_t dacen : 1; /* [29] */
  840. __IO uint32_t usart7en : 1; /* [30] */
  841. __IO uint32_t usart8en : 1; /* [31] */
  842. } apb1en_bit;
  843. };
  844. /**
  845. * @brief crm apb2en register, offset:0x44
  846. */
  847. union
  848. {
  849. __IO uint32_t apb2en;
  850. struct
  851. {
  852. __IO uint32_t tmr1en : 1; /* [0] */
  853. __IO uint32_t reserved1 : 3; /* [3:1] */
  854. __IO uint32_t usart1en : 1; /* [4] */
  855. __IO uint32_t usart6en : 1; /* [5] */
  856. __IO uint32_t reserved2 : 2; /* [7:6] */
  857. __IO uint32_t adc1en : 1; /* [8] */
  858. __IO uint32_t reserved3 : 3; /* [11:9] */
  859. __IO uint32_t spi1en : 1; /* [12] */
  860. __IO uint32_t reserved4 : 1; /* [13] */
  861. __IO uint32_t scfgen : 1; /* [14] */
  862. __IO uint32_t reserved5 : 1; /* [15] */
  863. __IO uint32_t tmr9en : 1; /* [16] */
  864. __IO uint32_t tmr10en : 1; /* [17] */
  865. __IO uint32_t tmr11en : 1; /* [18] */
  866. __IO uint32_t reserved6 : 10;/* [28:19] */
  867. __IO uint32_t accen : 1; /* [29] */
  868. __IO uint32_t reserved7 : 2; /* [31:30] */
  869. } apb2en_bit;
  870. };
  871. /**
  872. * @brief crm reserved4 register, offset:0x48~0x4C
  873. */
  874. __IO uint32_t reserved4[2];
  875. /**
  876. * @brief crm ahblpen1 register, offset:0x50
  877. */
  878. union
  879. {
  880. __IO uint32_t ahblpen1;
  881. struct
  882. {
  883. __IO uint32_t gpioalpen : 1; /* [0] */
  884. __IO uint32_t gpioblpen : 1; /* [1] */
  885. __IO uint32_t gpioclpen : 1; /* [2] */
  886. __IO uint32_t gpiodlpen : 1; /* [3] */
  887. __IO uint32_t gpioelpen : 1; /* [4] */
  888. __IO uint32_t gpioflpen : 1; /* [5] */
  889. __IO uint32_t reserved1 : 6; /* [11:6] */
  890. __IO uint32_t crclpen : 1; /* [12] */
  891. __IO uint32_t reserved2 : 9; /* [21:13] */
  892. __IO uint32_t dma1lpen : 1; /* [22] */
  893. __IO uint32_t reserved3 : 1; /* [23] */
  894. __IO uint32_t dma2lpen : 1; /* [24] */
  895. __IO uint32_t reserved4 : 7; /* [31:25] */
  896. } ahblpen1_bit;
  897. };
  898. /**
  899. * @brief crm ahblpen2 register, offset:0x54
  900. */
  901. union
  902. {
  903. __IO uint32_t ahblpen2;
  904. struct
  905. {
  906. __IO uint32_t reserved1 : 7; /* [6:0] */
  907. __IO uint32_t otgfs1lpen : 1; /* [7] */
  908. __IO uint32_t reserved2 : 24;/* [31:8] */
  909. } ahblpen2_bit;
  910. };
  911. /**
  912. * @brief crm ahblpen3 register, offset:0x58
  913. */
  914. union
  915. {
  916. __IO uint32_t ahblpen3;
  917. struct
  918. {
  919. __IO uint32_t xmclpen : 1; /* [0] */
  920. __IO uint32_t reserved1 : 31;/* [31:1] */
  921. } ahblpen3_bit;
  922. };
  923. /**
  924. * @brief crm reserved5 register, offset:0x5C
  925. */
  926. __IO uint32_t reserved5;
  927. /**
  928. * @brief crm apb1lpen register, offset:0x60
  929. */
  930. union
  931. {
  932. __IO uint32_t apb1lpen;
  933. struct
  934. {
  935. __IO uint32_t tmr2lpen : 1; /* [0] */
  936. __IO uint32_t tmr3lpen : 1; /* [1] */
  937. __IO uint32_t tmr4lpen : 1; /* [2] */
  938. __IO uint32_t reserved1 : 1; /* [3] */
  939. __IO uint32_t tmr6lpen : 1; /* [4] */
  940. __IO uint32_t tmr7lpen : 1; /* [5] */
  941. __IO uint32_t tmr12lpen : 1; /* [6] */
  942. __IO uint32_t tmr13lpen : 1; /* [7] */
  943. __IO uint32_t tmr14lpen : 1; /* [8] */
  944. __IO uint32_t reserved2 : 2; /* [10:9] */
  945. __IO uint32_t wwdtlpen : 1; /* [11] */
  946. __IO uint32_t reserved3 : 2; /* [13:12] */
  947. __IO uint32_t spi2lpen : 1; /* [14] */
  948. __IO uint32_t spi3lpen : 1; /* [15] */
  949. __IO uint32_t reserved4 : 1; /* [16] */
  950. __IO uint32_t usart2lpen : 1; /* [17] */
  951. __IO uint32_t usart3lpen : 1; /* [18] */
  952. __IO uint32_t usart4lpen : 1; /* [19] */
  953. __IO uint32_t usart5lpen : 1; /* [20] */
  954. __IO uint32_t i2c1lpen : 1; /* [21] */
  955. __IO uint32_t i2c2lpen : 1; /* [22] */
  956. __IO uint32_t i2c3lpen : 1; /* [23] */
  957. __IO uint32_t reserved5 : 1; /* [24] */
  958. __IO uint32_t can1lpen : 1; /* [25] */
  959. __IO uint32_t can2lpen : 1; /* [26] */
  960. __IO uint32_t reserved6 : 1; /* [27] */
  961. __IO uint32_t pwclpen : 1; /* [28] */
  962. __IO uint32_t daclpen : 1; /* [29] */
  963. __IO uint32_t usart7lpen : 1; /* [30] */
  964. __IO uint32_t usart8lpen : 1; /* [31] */
  965. } apb1lpen_bit;
  966. };
  967. /**
  968. * @brief crm apb2lpen register, offset:0x64
  969. */
  970. union
  971. {
  972. __IO uint32_t apb2lpen;
  973. struct
  974. {
  975. __IO uint32_t tmr1lpen : 1; /* [0] */
  976. __IO uint32_t reserved1 : 3; /* [3:1] */
  977. __IO uint32_t usart1lpen : 1; /* [4] */
  978. __IO uint32_t usart6lpen : 1; /* [5] */
  979. __IO uint32_t reserved2 : 2; /* [7:6] */
  980. __IO uint32_t adc1lpen : 1; /* [8] */
  981. __IO uint32_t reserved3 : 3; /* [11:9] */
  982. __IO uint32_t spi1lpen : 1; /* [12] */
  983. __IO uint32_t reserved4 : 1; /* [13] */
  984. __IO uint32_t scfglpen : 1; /* [14] */
  985. __IO uint32_t reserved5 : 1; /* [15] */
  986. __IO uint32_t tmr9lpen : 1; /* [16] */
  987. __IO uint32_t tmr10lpen : 1; /* [17] */
  988. __IO uint32_t tmr11lpen : 1; /* [18] */
  989. __IO uint32_t reserved6 : 10;/* [28:19] */
  990. __IO uint32_t acclpen : 1; /* [29] */
  991. __IO uint32_t reserved7 : 2; /* [31:30] */
  992. } apb2lpen_bit;
  993. };
  994. /**
  995. * @brief crm piclks register, offset:0x68
  996. */
  997. union
  998. {
  999. __IO uint32_t piclks;
  1000. struct
  1001. {
  1002. __IO uint32_t usart1sel : 2; /* [1:0] */
  1003. __IO uint32_t usart2sel : 2; /* [3:2] */
  1004. __IO uint32_t usart3sel : 2; /* [5:4] */
  1005. __IO uint32_t reserved1 : 6; /* [11:6] */
  1006. __IO uint32_t i2c1sel : 2; /* [13:12] */
  1007. __IO uint32_t reserved2 : 18;/* [31:14] */
  1008. } piclks_bit;
  1009. };
  1010. /**
  1011. * @brief crm reserved6 register, offset:0x6C
  1012. */
  1013. __IO uint32_t reserved6;
  1014. /**
  1015. * @brief crm bpdc register, offset:0x70
  1016. */
  1017. union
  1018. {
  1019. __IO uint32_t bpdc;
  1020. struct
  1021. {
  1022. __IO uint32_t lexten : 1; /* [0] */
  1023. __IO uint32_t lextstbl : 1; /* [1] */
  1024. __IO uint32_t lextbyps : 1; /* [2] */
  1025. __IO uint32_t reserved1 : 5; /* [7:3] */
  1026. __IO uint32_t ertcsel : 2; /* [9:8] */
  1027. __IO uint32_t reserved2 : 5; /* [14:10] */
  1028. __IO uint32_t ertcen : 1; /* [15] */
  1029. __IO uint32_t bpdrst : 1; /* [16] */
  1030. __IO uint32_t reserved3 : 15;/* [31:17] */
  1031. } bpdc_bit;
  1032. };
  1033. /**
  1034. * @brief crm ctrlsts register, offset:0x74
  1035. */
  1036. union
  1037. {
  1038. __IO uint32_t ctrlsts;
  1039. struct
  1040. {
  1041. __IO uint32_t licken : 1; /* [0] */
  1042. __IO uint32_t lickstbl : 1; /* [1] */
  1043. __IO uint32_t reserved1 : 22;/* [23:2] */
  1044. __IO uint32_t rstfc : 1; /* [24] */
  1045. __IO uint32_t reserved2 : 1; /* [25] */
  1046. __IO uint32_t nrstf : 1; /* [26] */
  1047. __IO uint32_t porrstf : 1; /* [27] */
  1048. __IO uint32_t swrstf : 1; /* [28] */
  1049. __IO uint32_t wdtrstf : 1; /* [29] */
  1050. __IO uint32_t wwdtrstf : 1; /* [30] */
  1051. __IO uint32_t lprstf : 1; /* [31] */
  1052. } ctrlsts_bit;
  1053. };
  1054. /**
  1055. * @brief crm reserved7 register, offset:0x78~0x9C
  1056. */
  1057. __IO uint32_t reserved7[10];
  1058. /**
  1059. * @brief crm misc1 register, offset:0xA0
  1060. */
  1061. union
  1062. {
  1063. __IO uint32_t misc1;
  1064. struct
  1065. {
  1066. __IO uint32_t hickcal_key : 8; /* [7:0] */
  1067. __IO uint32_t reserved1 : 4; /* [11:8] */
  1068. __IO uint32_t hickdiv : 1; /* [12] */
  1069. __IO uint32_t hick_to_usb : 1; /* [13] */
  1070. __IO uint32_t hick_to_sclk : 1; /* [14] */
  1071. __IO uint32_t pllclk_to_adc : 1; /* [15] */
  1072. __IO uint32_t clkout_sel2 : 4; /* [19:16] */
  1073. __IO uint32_t reserved2 : 8; /* [27:20] */
  1074. __IO uint32_t clkoutdiv2 : 4; /* [31:28] */
  1075. } misc1_bit;
  1076. };
  1077. /**
  1078. * @brief crm misc2 register, offset:0xA4
  1079. */
  1080. union
  1081. {
  1082. __IO uint32_t misc2;
  1083. struct
  1084. {
  1085. __IO uint32_t reserved1 : 4; /* [3:0] */
  1086. __IO uint32_t auto_step_en : 2; /* [5:4] */
  1087. __IO uint32_t reserved2 : 6; /* [11:6] */
  1088. __IO uint32_t usbdiv : 4; /* [15:12] */
  1089. __IO uint32_t hick_to_sclk_div : 3; /* [18:16] */
  1090. __IO uint32_t hext_to_sclk_div : 3; /* [21:19] */
  1091. __IO uint32_t reserved3 : 10;/* [31:22] */
  1092. } misc2_bit;
  1093. };
  1094. } crm_type;
  1095. /**
  1096. * @}
  1097. */
  1098. #define CRM ((crm_type *) CRM_BASE)
  1099. /** @defgroup CRM_exported_functions
  1100. * @{
  1101. */
  1102. void crm_reset(void);
  1103. void crm_lext_bypass(confirm_state new_state);
  1104. void crm_hext_bypass(confirm_state new_state);
  1105. flag_status crm_flag_get(uint32_t flag);
  1106. error_status crm_hext_stable_wait(void);
  1107. void crm_hick_clock_trimming_set(uint8_t trim_value);
  1108. void crm_hick_clock_calibration_set(uint8_t cali_value);
  1109. void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state);
  1110. void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state);
  1111. void crm_periph_lowpower_mode_enable(crm_periph_clock_lowpower_type value, confirm_state new_state);
  1112. void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state);
  1113. void crm_flag_clear(uint32_t flag);
  1114. void crm_ertc_clock_select(crm_ertc_clock_type value);
  1115. void crm_ertc_clock_enable(confirm_state new_state);
  1116. void crm_ahb_div_set(crm_ahb_div_type value);
  1117. void crm_apb1_div_set(crm_apb1_div_type value);
  1118. void crm_apb2_div_set(crm_apb2_div_type value);
  1119. void crm_hext_sclk_div_set(crm_hext_sclk_div_type value);
  1120. void crm_hick_sclk_div_set(crm_hick_sclk_div_type value);
  1121. void crm_usb_clock_div_set(crm_usb_div_type value);
  1122. void crm_clock_failure_detection_enable(confirm_state new_state);
  1123. void crm_battery_powered_domain_reset(confirm_state new_state);
  1124. void crm_auto_step_mode_enable(confirm_state new_state);
  1125. void crm_hick_divider_select(crm_hick_div_6_type value);
  1126. void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value);
  1127. void crm_usb_clock_source_select(crm_usb_clock_source_type value);
  1128. void crm_usart_clock_select(crm_usart_type usart_index, crm_usart_clock_source_type value);
  1129. crm_usart_clock_source_type crm_usart_clock_get(crm_usart_type usart_index);
  1130. void crm_i2c_clock_select(crm_i2c_type i2c_index, crm_i2c_clock_source_type value);
  1131. crm_i2c_clock_source_type crm_i2c_clock_get(crm_i2c_type i2c_index);
  1132. void crm_adc_clock_select(crm_adc_clock_source_type value);
  1133. void crm_pll_config(crm_pll_clock_source_type clock_source, uint16_t pll_ns, \
  1134. uint16_t pll_ms, crm_pll_fr_type pll_fr);
  1135. void crm_sysclk_switch(crm_sclk_type value);
  1136. crm_sclk_type crm_sysclk_switch_status_get(void);
  1137. void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct);
  1138. void crm_clock_out_set(crm_clkout_select_type clkout);
  1139. void crm_clkout_div_set(crm_clkout_div1_type div1, crm_clkout_div2_type div2);
  1140. void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state);
  1141. error_status crm_pll_parameter_calculate(crm_pll_clock_source_type pll_rcs, uint32_t target_sclk_freq, \
  1142. uint16_t *ret_ms, uint16_t *ret_ns, uint16_t *ret_fr);
  1143. /**
  1144. * @}
  1145. */
  1146. /**
  1147. * @}
  1148. */
  1149. /**
  1150. * @}
  1151. */
  1152. #ifdef __cplusplus
  1153. }
  1154. #endif
  1155. #endif