at32f403a_407_crm.h 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. /**
  2. **************************************************************************
  3. * @file at32f403a_407_crm.h
  4. * @brief at32f403a_407 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 __AT32F403A_407_CRM_H
  26. #define __AT32F403A_407_CRM_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* includes ------------------------------------------------------------------*/
  31. #include "at32f403a_407.h"
  32. /** @addtogroup AT32F403A_407_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(0x20, 1) /*!< low speed external crystal stable flag */
  48. #define CRM_LICK_STABLE_FLAG MAKE_VALUE(0x24, 1) /*!< low speed internal clock stable flag */
  49. #define CRM_ALL_RESET_FLAG MAKE_VALUE(0x24, 24) /*!< all reset flag */
  50. #define CRM_NRST_RESET_FLAG MAKE_VALUE(0x24, 26) /*!< nrst pin reset flag */
  51. #define CRM_POR_RESET_FLAG MAKE_VALUE(0x24, 27) /*!< power on reset flag */
  52. #define CRM_SW_RESET_FLAG MAKE_VALUE(0x24, 28) /*!< software reset flag */
  53. #define CRM_WDT_RESET_FLAG MAKE_VALUE(0x24, 29) /*!< watchdog timer reset flag */
  54. #define CRM_WWDT_RESET_FLAG MAKE_VALUE(0x24, 30) /*!< window watchdog timer reset flag */
  55. #define CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x24, 31) /*!< low-power reset flag */
  56. #define CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x08, 0) /*!< low speed internal clock stable interrupt ready flag */
  57. #define CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x08, 1) /*!< low speed external crystal stable interrupt ready flag */
  58. #define CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x08, 2) /*!< high speed internal clock stable interrupt ready flag */
  59. #define CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x08, 3) /*!< high speed external crystal stable interrupt ready flag */
  60. #define CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x08, 4) /*!< phase locking loop stable interrupt ready flag */
  61. #define CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x08, 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. #if defined (AT32F403Axx)
  87. /* ahb periph */
  88. CRM_DMA1_PERIPH_CLOCK = MAKE_VALUE(0x14, 0), /*!< dma1 periph clock */
  89. CRM_DMA2_PERIPH_CLOCK = MAKE_VALUE(0x14, 1), /*!< dma2 periph clock */
  90. CRM_CRC_PERIPH_CLOCK = MAKE_VALUE(0x14, 6), /*!< crc periph clock */
  91. CRM_XMC_PERIPH_CLOCK = MAKE_VALUE(0x14, 8), /*!< xmc periph clock */
  92. CRM_SDIO1_PERIPH_CLOCK = MAKE_VALUE(0x14, 10), /*!< sdio1 periph clock */
  93. CRM_SDIO2_PERIPH_CLOCK = MAKE_VALUE(0x14, 11), /*!< sdio2 periph clock */
  94. /* apb2 periph */
  95. CRM_IOMUX_PERIPH_CLOCK = MAKE_VALUE(0x18, 0), /*!< iomux periph clock */
  96. CRM_GPIOA_PERIPH_CLOCK = MAKE_VALUE(0x18, 2), /*!< gpioa periph clock */
  97. CRM_GPIOB_PERIPH_CLOCK = MAKE_VALUE(0x18, 3), /*!< gpiob periph clock */
  98. CRM_GPIOC_PERIPH_CLOCK = MAKE_VALUE(0x18, 4), /*!< gpioc periph clock */
  99. CRM_GPIOD_PERIPH_CLOCK = MAKE_VALUE(0x18, 5), /*!< gpiod periph clock */
  100. CRM_GPIOE_PERIPH_CLOCK = MAKE_VALUE(0x18, 6), /*!< gpioe periph clock */
  101. CRM_ADC1_PERIPH_CLOCK = MAKE_VALUE(0x18, 9), /*!< adc1 periph clock */
  102. CRM_ADC2_PERIPH_CLOCK = MAKE_VALUE(0x18, 10), /*!< adc2 periph clock */
  103. CRM_TMR1_PERIPH_CLOCK = MAKE_VALUE(0x18, 11), /*!< tmr1 periph clock */
  104. CRM_SPI1_PERIPH_CLOCK = MAKE_VALUE(0x18, 12), /*!< spi1 periph clock */
  105. CRM_TMR8_PERIPH_CLOCK = MAKE_VALUE(0x18, 13), /*!< tmr8 periph clock */
  106. CRM_USART1_PERIPH_CLOCK = MAKE_VALUE(0x18, 14), /*!< usart1 periph clock */
  107. CRM_ADC3_PERIPH_CLOCK = MAKE_VALUE(0x18, 15), /*!< adc3 periph clock */
  108. CRM_TMR9_PERIPH_CLOCK = MAKE_VALUE(0x18, 19), /*!< tmr9 periph clock */
  109. CRM_TMR10_PERIPH_CLOCK = MAKE_VALUE(0x18, 20), /*!< tmr10 periph clock */
  110. CRM_TMR11_PERIPH_CLOCK = MAKE_VALUE(0x18, 21), /*!< tmr11 periph clock */
  111. CRM_ACC_PERIPH_CLOCK = MAKE_VALUE(0x18, 22), /*!< acc periph clock */
  112. CRM_I2C3_PERIPH_CLOCK = MAKE_VALUE(0x18, 23), /*!< i2c3 periph clock */
  113. CRM_USART6_PERIPH_CLOCK = MAKE_VALUE(0x18, 24), /*!< usart6 periph clock */
  114. CRM_UART7_PERIPH_CLOCK = MAKE_VALUE(0x18, 25), /*!< uart7 periph clock */
  115. CRM_UART8_PERIPH_CLOCK = MAKE_VALUE(0x18, 26), /*!< uart8 periph clock */
  116. /* apb1 periph */
  117. CRM_TMR2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 0), /*!< tmr2 periph clock */
  118. CRM_TMR3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 1), /*!< tmr3 periph clock */
  119. CRM_TMR4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 2), /*!< tmr4 periph clock */
  120. CRM_TMR5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 3), /*!< tmr5 periph clock */
  121. CRM_TMR6_PERIPH_CLOCK = MAKE_VALUE(0x1C, 4), /*!< tmr6 periph clock */
  122. CRM_TMR7_PERIPH_CLOCK = MAKE_VALUE(0x1C, 5), /*!< tmr7 periph clock */
  123. CRM_TMR12_PERIPH_CLOCK = MAKE_VALUE(0x1C, 6), /*!< tmr12 periph clock */
  124. CRM_TMR13_PERIPH_CLOCK = MAKE_VALUE(0x1C, 7), /*!< tmr13 periph clock */
  125. CRM_TMR14_PERIPH_CLOCK = MAKE_VALUE(0x1C, 8), /*!< tmr14 periph clock */
  126. CRM_WWDT_PERIPH_CLOCK = MAKE_VALUE(0x1C, 11), /*!< wwdt periph clock */
  127. CRM_SPI2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 14), /*!< spi2 periph clock */
  128. CRM_SPI3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 15), /*!< spi3 periph clock */
  129. CRM_SPI4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 16), /*!< spi4 periph clock */
  130. CRM_USART2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 17), /*!< usart2 periph clock */
  131. CRM_USART3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 18), /*!< usart3 periph clock */
  132. CRM_UART4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 19), /*!< uart4 periph clock */
  133. CRM_UART5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 20), /*!< uart5 periph clock */
  134. CRM_I2C1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 21), /*!< i2c1 periph clock */
  135. CRM_I2C2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 22), /*!< i2c2 periph clock */
  136. CRM_USB_PERIPH_CLOCK = MAKE_VALUE(0x1C, 23), /*!< usb periph clock */
  137. CRM_CAN1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 25), /*!< can1 periph clock */
  138. CRM_CAN2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 26), /*!< can2 periph clock */
  139. CRM_BPR_PERIPH_CLOCK = MAKE_VALUE(0x1C, 27), /*!< bpr periph clock */
  140. CRM_PWC_PERIPH_CLOCK = MAKE_VALUE(0x1C, 28), /*!< pwc periph clock */
  141. CRM_DAC_PERIPH_CLOCK = MAKE_VALUE(0x1C, 29) /*!< dac periph clock */
  142. #endif
  143. #if defined (AT32F407xx)
  144. /* ahb periph */
  145. CRM_DMA1_PERIPH_CLOCK = MAKE_VALUE(0x14, 0), /*!< dma1 periph clock */
  146. CRM_DMA2_PERIPH_CLOCK = MAKE_VALUE(0x14, 1), /*!< dma2 periph clock */
  147. CRM_CRC_PERIPH_CLOCK = MAKE_VALUE(0x14, 6), /*!< crc periph clock */
  148. CRM_XMC_PERIPH_CLOCK = MAKE_VALUE(0x14, 8), /*!< xmc periph clock */
  149. CRM_SDIO1_PERIPH_CLOCK = MAKE_VALUE(0x14, 10), /*!< sdio1 periph clock */
  150. CRM_SDIO2_PERIPH_CLOCK = MAKE_VALUE(0x14, 11), /*!< sdio2 periph clock */
  151. CRM_EMAC_PERIPH_CLOCK = MAKE_VALUE(0x14, 14), /*!< emac periph clock */
  152. CRM_EMACTX_PERIPH_CLOCK = MAKE_VALUE(0x14, 15), /*!< emac tx periph clock */
  153. CRM_EMACRX_PERIPH_CLOCK = MAKE_VALUE(0x14, 16), /*!< emac rx periph clock */
  154. CRM_EMACPTP_PERIPH_CLOCK = MAKE_VALUE(0x14, 28), /*!< emac ptp periph clock */
  155. /* apb2 periph */
  156. CRM_IOMUX_PERIPH_CLOCK = MAKE_VALUE(0x18, 0), /*!< iomux periph clock */
  157. CRM_GPIOA_PERIPH_CLOCK = MAKE_VALUE(0x18, 2), /*!< gpioa periph clock */
  158. CRM_GPIOB_PERIPH_CLOCK = MAKE_VALUE(0x18, 3), /*!< gpiob periph clock */
  159. CRM_GPIOC_PERIPH_CLOCK = MAKE_VALUE(0x18, 4), /*!< gpioc periph clock */
  160. CRM_GPIOD_PERIPH_CLOCK = MAKE_VALUE(0x18, 5), /*!< gpiod periph clock */
  161. CRM_GPIOE_PERIPH_CLOCK = MAKE_VALUE(0x18, 6), /*!< gpioe periph clock */
  162. CRM_ADC1_PERIPH_CLOCK = MAKE_VALUE(0x18, 9), /*!< adc1 periph clock */
  163. CRM_ADC2_PERIPH_CLOCK = MAKE_VALUE(0x18, 10), /*!< adc2 periph clock */
  164. CRM_TMR1_PERIPH_CLOCK = MAKE_VALUE(0x18, 11), /*!< tmr1 periph clock */
  165. CRM_SPI1_PERIPH_CLOCK = MAKE_VALUE(0x18, 12), /*!< spi1 periph clock */
  166. CRM_TMR8_PERIPH_CLOCK = MAKE_VALUE(0x18, 13), /*!< tmr8 periph clock */
  167. CRM_USART1_PERIPH_CLOCK = MAKE_VALUE(0x18, 14), /*!< usart1 periph clock */
  168. CRM_ADC3_PERIPH_CLOCK = MAKE_VALUE(0x18, 15), /*!< adc3 periph clock */
  169. CRM_TMR9_PERIPH_CLOCK = MAKE_VALUE(0x18, 19), /*!< tmr9 periph clock */
  170. CRM_TMR10_PERIPH_CLOCK = MAKE_VALUE(0x18, 20), /*!< tmr10 periph clock */
  171. CRM_TMR11_PERIPH_CLOCK = MAKE_VALUE(0x18, 21), /*!< tmr11 periph clock */
  172. CRM_ACC_PERIPH_CLOCK = MAKE_VALUE(0x18, 22), /*!< acc periph clock */
  173. CRM_I2C3_PERIPH_CLOCK = MAKE_VALUE(0x18, 23), /*!< i2c3 periph clock */
  174. CRM_USART6_PERIPH_CLOCK = MAKE_VALUE(0x18, 24), /*!< usart6 periph clock */
  175. CRM_UART7_PERIPH_CLOCK = MAKE_VALUE(0x18, 25), /*!< uart7 periph clock */
  176. CRM_UART8_PERIPH_CLOCK = MAKE_VALUE(0x18, 26), /*!< uart8 periph clock */
  177. /* apb1 periph */
  178. CRM_TMR2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 0), /*!< tmr2 periph clock */
  179. CRM_TMR3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 1), /*!< tmr3 periph clock */
  180. CRM_TMR4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 2), /*!< tmr4 periph clock */
  181. CRM_TMR5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 3), /*!< tmr5 periph clock */
  182. CRM_TMR6_PERIPH_CLOCK = MAKE_VALUE(0x1C, 4), /*!< tmr6 periph clock */
  183. CRM_TMR7_PERIPH_CLOCK = MAKE_VALUE(0x1C, 5), /*!< tmr7 periph clock */
  184. CRM_TMR12_PERIPH_CLOCK = MAKE_VALUE(0x1C, 6), /*!< tmr12 periph clock */
  185. CRM_TMR13_PERIPH_CLOCK = MAKE_VALUE(0x1C, 7), /*!< tmr13 periph clock */
  186. CRM_TMR14_PERIPH_CLOCK = MAKE_VALUE(0x1C, 8), /*!< tmr14 periph clock */
  187. CRM_WWDT_PERIPH_CLOCK = MAKE_VALUE(0x1C, 11), /*!< wwdt periph clock */
  188. CRM_SPI2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 14), /*!< spi2 periph clock */
  189. CRM_SPI3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 15), /*!< spi3 periph clock */
  190. CRM_SPI4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 16), /*!< spi4 periph clock */
  191. CRM_USART2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 17), /*!< usart2 periph clock */
  192. CRM_USART3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 18), /*!< usart3 periph clock */
  193. CRM_UART4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 19), /*!< uart4 periph clock */
  194. CRM_UART5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 20), /*!< uart5 periph clock */
  195. CRM_I2C1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 21), /*!< i2c1 periph clock */
  196. CRM_I2C2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 22), /*!< i2c2 periph clock */
  197. CRM_USB_PERIPH_CLOCK = MAKE_VALUE(0x1C, 23), /*!< usb periph clock */
  198. CRM_CAN1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 25), /*!< can1 periph clock */
  199. CRM_CAN2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 26), /*!< can2 periph clock */
  200. CRM_BPR_PERIPH_CLOCK = MAKE_VALUE(0x1C, 27), /*!< bpr periph clock */
  201. CRM_PWC_PERIPH_CLOCK = MAKE_VALUE(0x1C, 28), /*!< pwc periph clock */
  202. CRM_DAC_PERIPH_CLOCK = MAKE_VALUE(0x1C, 29) /*!< dac periph clock */
  203. #endif
  204. } crm_periph_clock_type;
  205. /**
  206. * @brief crm periph reset
  207. */
  208. typedef enum
  209. {
  210. #if defined (AT32F403Axx)
  211. /* apb2 periph */
  212. CRM_IOMUX_PERIPH_RESET = MAKE_VALUE(0x0C, 0), /*!< iomux periph reset */
  213. CRM_EXINT_PERIPH_RESET = MAKE_VALUE(0x0C, 1), /*!< exint periph reset */
  214. CRM_GPIOA_PERIPH_RESET = MAKE_VALUE(0x0C, 2), /*!< gpioa periph reset */
  215. CRM_GPIOB_PERIPH_RESET = MAKE_VALUE(0x0C, 3), /*!< gpiob periph reset */
  216. CRM_GPIOC_PERIPH_RESET = MAKE_VALUE(0x0C, 4), /*!< gpioc periph reset */
  217. CRM_GPIOD_PERIPH_RESET = MAKE_VALUE(0x0C, 5), /*!< gpiod periph reset */
  218. CRM_GPIOE_PERIPH_RESET = MAKE_VALUE(0x0C, 6), /*!< gpioe periph reset */
  219. CRM_ADC1_PERIPH_RESET = MAKE_VALUE(0x0C, 9), /*!< adc1 periph reset */
  220. CRM_ADC2_PERIPH_RESET = MAKE_VALUE(0x0C, 10), /*!< adc2 periph reset */
  221. CRM_TMR1_PERIPH_RESET = MAKE_VALUE(0x0C, 11), /*!< tmr1 periph reset */
  222. CRM_SPI1_PERIPH_RESET = MAKE_VALUE(0x0C, 12), /*!< spi2 periph reset */
  223. CRM_TMR8_PERIPH_RESET = MAKE_VALUE(0x0C, 13), /*!< tmr8 periph reset */
  224. CRM_USART1_PERIPH_RESET = MAKE_VALUE(0x0C, 14), /*!< usart1 periph reset */
  225. CRM_ADC3_PERIPH_RESET = MAKE_VALUE(0x0C, 15), /*!< adc3 periph reset */
  226. CRM_TMR9_PERIPH_RESET = MAKE_VALUE(0x0C, 19), /*!< tmr9 periph reset */
  227. CRM_TMR10_PERIPH_RESET = MAKE_VALUE(0x0C, 20), /*!< tmr10 periph reset */
  228. CRM_TMR11_PERIPH_RESET = MAKE_VALUE(0x0C, 21), /*!< tmr11 periph reset */
  229. CRM_ACC_PERIPH_RESET = MAKE_VALUE(0x0C, 22), /*!< acc periph reset */
  230. CRM_I2C3_PERIPH_RESET = MAKE_VALUE(0x0C, 23), /*!< i2c3 periph reset */
  231. CRM_USART6_PERIPH_RESET = MAKE_VALUE(0x0C, 24), /*!< usart6 periph reset */
  232. CRM_UART7_PERIPH_RESET = MAKE_VALUE(0x0C, 25), /*!< uart7 periph reset */
  233. CRM_UART8_PERIPH_RESET = MAKE_VALUE(0x0C, 26), /*!< uart8 periph reset */
  234. /* apb1 periph */
  235. CRM_TMR2_PERIPH_RESET = MAKE_VALUE(0x10, 0), /*!< tmr2 periph reset */
  236. CRM_TMR3_PERIPH_RESET = MAKE_VALUE(0x10, 1), /*!< tmr3 periph reset */
  237. CRM_TMR4_PERIPH_RESET = MAKE_VALUE(0x10, 2), /*!< tmr4 periph reset */
  238. CRM_TMR5_PERIPH_RESET = MAKE_VALUE(0x10, 3), /*!< tmr5 periph reset */
  239. CRM_TMR6_PERIPH_RESET = MAKE_VALUE(0x10, 4), /*!< tmr6 periph reset */
  240. CRM_TMR7_PERIPH_RESET = MAKE_VALUE(0x10, 5), /*!< tmr7 periph reset */
  241. CRM_TMR12_PERIPH_RESET = MAKE_VALUE(0x10, 6), /*!< tmr12 periph reset */
  242. CRM_TMR13_PERIPH_RESET = MAKE_VALUE(0x10, 7), /*!< tmr13 periph reset */
  243. CRM_TMR14_PERIPH_RESET = MAKE_VALUE(0x10, 8), /*!< tmr14 periph reset */
  244. CRM_WWDT_PERIPH_RESET = MAKE_VALUE(0x10, 11), /*!< wwdt periph reset */
  245. CRM_SPI2_PERIPH_RESET = MAKE_VALUE(0x10, 14), /*!< spi2 periph reset */
  246. CRM_SPI3_PERIPH_RESET = MAKE_VALUE(0x10, 15), /*!< spi3 periph reset */
  247. CRM_SPI4_PERIPH_RESET = MAKE_VALUE(0x10, 16), /*!< spi4 periph reset */
  248. CRM_USART2_PERIPH_RESET = MAKE_VALUE(0x10, 17), /*!< usart2 periph reset */
  249. CRM_USART3_PERIPH_RESET = MAKE_VALUE(0x10, 18), /*!< usart3 periph reset */
  250. CRM_UART4_PERIPH_RESET = MAKE_VALUE(0x10, 19), /*!< uart4 periph reset */
  251. CRM_UART5_PERIPH_RESET = MAKE_VALUE(0x10, 20), /*!< uart5 periph reset */
  252. CRM_I2C1_PERIPH_RESET = MAKE_VALUE(0x10, 21), /*!< i2c1 periph reset */
  253. CRM_I2C2_PERIPH_RESET = MAKE_VALUE(0x10, 22), /*!< i2c2 periph reset */
  254. CRM_USB_PERIPH_RESET = MAKE_VALUE(0x10, 23), /*!< usb periph reset */
  255. CRM_CAN1_PERIPH_RESET = MAKE_VALUE(0x10, 25), /*!< can1 periph reset */
  256. CRM_CAN2_PERIPH_RESET = MAKE_VALUE(0x10, 26), /*!< can2 periph reset */
  257. CRM_BPR_PERIPH_RESET = MAKE_VALUE(0x10, 27), /*!< bpr periph reset */
  258. CRM_PWC_PERIPH_RESET = MAKE_VALUE(0x10, 28), /*!< pwc periph reset */
  259. CRM_DAC_PERIPH_RESET = MAKE_VALUE(0x10, 29) /*!< dac periph reset */
  260. #endif
  261. #if defined (AT32F407xx)
  262. /* ahb periph */
  263. CRM_EMAC_PERIPH_RESET = MAKE_VALUE(0x28, 14), /*!< emac periph reset */
  264. /* apb2 periph */
  265. CRM_IOMUX_PERIPH_RESET = MAKE_VALUE(0x0C, 0), /*!< iomux periph reset */
  266. CRM_EXINT_PERIPH_RESET = MAKE_VALUE(0x0C, 1), /*!< exint periph reset */
  267. CRM_GPIOA_PERIPH_RESET = MAKE_VALUE(0x0C, 2), /*!< gpioa periph reset */
  268. CRM_GPIOB_PERIPH_RESET = MAKE_VALUE(0x0C, 3), /*!< gpiob periph reset */
  269. CRM_GPIOC_PERIPH_RESET = MAKE_VALUE(0x0C, 4), /*!< gpioc periph reset */
  270. CRM_GPIOD_PERIPH_RESET = MAKE_VALUE(0x0C, 5), /*!< gpiod periph reset */
  271. CRM_GPIOE_PERIPH_RESET = MAKE_VALUE(0x0C, 6), /*!< gpioe periph reset */
  272. CRM_ADC1_PERIPH_RESET = MAKE_VALUE(0x0C, 9), /*!< adc1 periph reset */
  273. CRM_ADC2_PERIPH_RESET = MAKE_VALUE(0x0C, 10), /*!< adc2 periph reset */
  274. CRM_TMR1_PERIPH_RESET = MAKE_VALUE(0x0C, 11), /*!< tmr1 periph reset */
  275. CRM_SPI1_PERIPH_RESET = MAKE_VALUE(0x0C, 12), /*!< spi2 periph reset */
  276. CRM_TMR8_PERIPH_RESET = MAKE_VALUE(0x0C, 13), /*!< tmr8 periph reset */
  277. CRM_USART1_PERIPH_RESET = MAKE_VALUE(0x0C, 14), /*!< usart1 periph reset */
  278. CRM_ADC3_PERIPH_RESET = MAKE_VALUE(0x0C, 15), /*!< adc3 periph reset */
  279. CRM_TMR9_PERIPH_RESET = MAKE_VALUE(0x0C, 19), /*!< tmr9 periph reset */
  280. CRM_TMR10_PERIPH_RESET = MAKE_VALUE(0x0C, 20), /*!< tmr10 periph reset */
  281. CRM_TMR11_PERIPH_RESET = MAKE_VALUE(0x0C, 21), /*!< tmr11 periph reset */
  282. CRM_ACC_PERIPH_RESET = MAKE_VALUE(0x0C, 22), /*!< acc periph reset */
  283. CRM_I2C3_PERIPH_RESET = MAKE_VALUE(0x0C, 23), /*!< i2c3 periph reset */
  284. CRM_USART6_PERIPH_RESET = MAKE_VALUE(0x0C, 24), /*!< usart6 periph reset */
  285. CRM_UART7_PERIPH_RESET = MAKE_VALUE(0x0C, 25), /*!< uart7 periph reset */
  286. CRM_UART8_PERIPH_RESET = MAKE_VALUE(0x0C, 26), /*!< uart8 periph reset */
  287. /* apb1 periph */
  288. CRM_TMR2_PERIPH_RESET = MAKE_VALUE(0x10, 0), /*!< tmr2 periph reset */
  289. CRM_TMR3_PERIPH_RESET = MAKE_VALUE(0x10, 1), /*!< tmr3 periph reset */
  290. CRM_TMR4_PERIPH_RESET = MAKE_VALUE(0x10, 2), /*!< tmr4 periph reset */
  291. CRM_TMR5_PERIPH_RESET = MAKE_VALUE(0x10, 3), /*!< tmr5 periph reset */
  292. CRM_TMR6_PERIPH_RESET = MAKE_VALUE(0x10, 4), /*!< tmr6 periph reset */
  293. CRM_TMR7_PERIPH_RESET = MAKE_VALUE(0x10, 5), /*!< tmr7 periph reset */
  294. CRM_TMR12_PERIPH_RESET = MAKE_VALUE(0x10, 6), /*!< tmr12 periph reset */
  295. CRM_TMR13_PERIPH_RESET = MAKE_VALUE(0x10, 7), /*!< tmr13 periph reset */
  296. CRM_TMR14_PERIPH_RESET = MAKE_VALUE(0x10, 8), /*!< tmr14 periph reset */
  297. CRM_WWDT_PERIPH_RESET = MAKE_VALUE(0x10, 11), /*!< wwdt periph reset */
  298. CRM_SPI2_PERIPH_RESET = MAKE_VALUE(0x10, 14), /*!< spi2 periph reset */
  299. CRM_SPI3_PERIPH_RESET = MAKE_VALUE(0x10, 15), /*!< spi3 periph reset */
  300. CRM_SPI4_PERIPH_RESET = MAKE_VALUE(0x10, 16), /*!< spi4 periph reset */
  301. CRM_USART2_PERIPH_RESET = MAKE_VALUE(0x10, 17), /*!< usart2 periph reset */
  302. CRM_USART3_PERIPH_RESET = MAKE_VALUE(0x10, 18), /*!< usart3 periph reset */
  303. CRM_UART4_PERIPH_RESET = MAKE_VALUE(0x10, 19), /*!< uart4 periph reset */
  304. CRM_UART5_PERIPH_RESET = MAKE_VALUE(0x10, 20), /*!< uart5 periph reset */
  305. CRM_I2C1_PERIPH_RESET = MAKE_VALUE(0x10, 21), /*!< i2c1 periph reset */
  306. CRM_I2C2_PERIPH_RESET = MAKE_VALUE(0x10, 22), /*!< i2c2 periph reset */
  307. CRM_USB_PERIPH_RESET = MAKE_VALUE(0x10, 23), /*!< usb periph reset */
  308. CRM_CAN1_PERIPH_RESET = MAKE_VALUE(0x10, 25), /*!< can1 periph reset */
  309. CRM_CAN2_PERIPH_RESET = MAKE_VALUE(0x10, 26), /*!< can2 periph reset */
  310. CRM_BPR_PERIPH_RESET = MAKE_VALUE(0x10, 27), /*!< bpr periph reset */
  311. CRM_PWC_PERIPH_RESET = MAKE_VALUE(0x10, 28), /*!< pwc periph reset */
  312. CRM_DAC_PERIPH_RESET = MAKE_VALUE(0x10, 29) /*!< dac periph reset */
  313. #endif
  314. } crm_periph_reset_type;
  315. /**
  316. * @brief crm periph clock in sleep mode
  317. */
  318. typedef enum
  319. {
  320. /* ahb periph */
  321. CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE = MAKE_VALUE(0x14, 2), /*!< sram sleep mode periph clock */
  322. CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE = MAKE_VALUE(0x14, 4) /*!< flash sleep mode periph clock */
  323. } crm_periph_clock_sleepmd_type;
  324. /**
  325. * @brief crm pll mult_x
  326. */
  327. typedef enum
  328. {
  329. CRM_PLL_MULT_2 = 0, /*!< pll multiplication factor 2 */
  330. CRM_PLL_MULT_3 = 1, /*!< pll multiplication factor 3 */
  331. CRM_PLL_MULT_4 = 2, /*!< pll multiplication factor 4 */
  332. CRM_PLL_MULT_5 = 3, /*!< pll multiplication factor 5 */
  333. CRM_PLL_MULT_6 = 4, /*!< pll multiplication factor 6 */
  334. CRM_PLL_MULT_7 = 5, /*!< pll multiplication factor 7 */
  335. CRM_PLL_MULT_8 = 6, /*!< pll multiplication factor 8 */
  336. CRM_PLL_MULT_9 = 7, /*!< pll multiplication factor 9 */
  337. CRM_PLL_MULT_10 = 8, /*!< pll multiplication factor 10 */
  338. CRM_PLL_MULT_11 = 9, /*!< pll multiplication factor 11 */
  339. CRM_PLL_MULT_12 = 10, /*!< pll multiplication factor 12 */
  340. CRM_PLL_MULT_13 = 11, /*!< pll multiplication factor 13 */
  341. CRM_PLL_MULT_14 = 12, /*!< pll multiplication factor 14 */
  342. CRM_PLL_MULT_15 = 13, /*!< pll multiplication factor 15 */
  343. CRM_PLL_MULT_16 = 15, /*!< pll multiplication factor 16 */
  344. CRM_PLL_MULT_17 = 16, /*!< pll multiplication factor 17 */
  345. CRM_PLL_MULT_18 = 17, /*!< pll multiplication factor 18 */
  346. CRM_PLL_MULT_19 = 18, /*!< pll multiplication factor 19 */
  347. CRM_PLL_MULT_20 = 19, /*!< pll multiplication factor 20 */
  348. CRM_PLL_MULT_21 = 20, /*!< pll multiplication factor 21 */
  349. CRM_PLL_MULT_22 = 21, /*!< pll multiplication factor 22 */
  350. CRM_PLL_MULT_23 = 22, /*!< pll multiplication factor 23 */
  351. CRM_PLL_MULT_24 = 23, /*!< pll multiplication factor 24 */
  352. CRM_PLL_MULT_25 = 24, /*!< pll multiplication factor 25 */
  353. CRM_PLL_MULT_26 = 25, /*!< pll multiplication factor 26 */
  354. CRM_PLL_MULT_27 = 26, /*!< pll multiplication factor 27 */
  355. CRM_PLL_MULT_28 = 27, /*!< pll multiplication factor 28 */
  356. CRM_PLL_MULT_29 = 28, /*!< pll multiplication factor 29 */
  357. CRM_PLL_MULT_30 = 29, /*!< pll multiplication factor 30 */
  358. CRM_PLL_MULT_31 = 30, /*!< pll multiplication factor 31 */
  359. CRM_PLL_MULT_32 = 31, /*!< pll multiplication factor 32 */
  360. CRM_PLL_MULT_33 = 32, /*!< pll multiplication factor 33 */
  361. CRM_PLL_MULT_34 = 33, /*!< pll multiplication factor 34 */
  362. CRM_PLL_MULT_35 = 34, /*!< pll multiplication factor 35 */
  363. CRM_PLL_MULT_36 = 35, /*!< pll multiplication factor 36 */
  364. CRM_PLL_MULT_37 = 36, /*!< pll multiplication factor 37 */
  365. CRM_PLL_MULT_38 = 37, /*!< pll multiplication factor 38 */
  366. CRM_PLL_MULT_39 = 38, /*!< pll multiplication factor 39 */
  367. CRM_PLL_MULT_40 = 39, /*!< pll multiplication factor 40 */
  368. CRM_PLL_MULT_41 = 40, /*!< pll multiplication factor 41 */
  369. CRM_PLL_MULT_42 = 41, /*!< pll multiplication factor 42 */
  370. CRM_PLL_MULT_43 = 42, /*!< pll multiplication factor 43 */
  371. CRM_PLL_MULT_44 = 43, /*!< pll multiplication factor 44 */
  372. CRM_PLL_MULT_45 = 44, /*!< pll multiplication factor 45 */
  373. CRM_PLL_MULT_46 = 45, /*!< pll multiplication factor 46 */
  374. CRM_PLL_MULT_47 = 46, /*!< pll multiplication factor 47 */
  375. CRM_PLL_MULT_48 = 47, /*!< pll multiplication factor 48 */
  376. CRM_PLL_MULT_49 = 48, /*!< pll multiplication factor 49 */
  377. CRM_PLL_MULT_50 = 49, /*!< pll multiplication factor 50 */
  378. CRM_PLL_MULT_51 = 50, /*!< pll multiplication factor 51 */
  379. CRM_PLL_MULT_52 = 51, /*!< pll multiplication factor 52 */
  380. CRM_PLL_MULT_53 = 52, /*!< pll multiplication factor 53 */
  381. CRM_PLL_MULT_54 = 53, /*!< pll multiplication factor 54 */
  382. CRM_PLL_MULT_55 = 54, /*!< pll multiplication factor 55 */
  383. CRM_PLL_MULT_56 = 55, /*!< pll multiplication factor 56 */
  384. CRM_PLL_MULT_57 = 56, /*!< pll multiplication factor 57 */
  385. CRM_PLL_MULT_58 = 57, /*!< pll multiplication factor 58 */
  386. CRM_PLL_MULT_59 = 58, /*!< pll multiplication factor 59 */
  387. CRM_PLL_MULT_60 = 59, /*!< pll multiplication factor 60 */
  388. CRM_PLL_MULT_61 = 60, /*!< pll multiplication factor 61 */
  389. CRM_PLL_MULT_62 = 61, /*!< pll multiplication factor 62 */
  390. CRM_PLL_MULT_63 = 62, /*!< pll multiplication factor 63 */
  391. CRM_PLL_MULT_64 = 63 /*!< pll multiplication factor 64 */
  392. } crm_pll_mult_type;
  393. /**
  394. * @brief crm pll clock source
  395. */
  396. typedef enum
  397. {
  398. CRM_PLL_SOURCE_HICK = 0x00, /*!< high speed internal clock as pll reference clock source */
  399. CRM_PLL_SOURCE_HEXT = 0x01, /*!< high speed external crystal as pll reference clock source */
  400. CRM_PLL_SOURCE_HEXT_DIV = 0x02 /*!< high speed external crystal div as pll reference clock source */
  401. } crm_pll_clock_source_type;
  402. /**
  403. * @brief crm pll clock output range
  404. */
  405. typedef enum
  406. {
  407. CRM_PLL_OUTPUT_RANGE_LE72MHZ = 0x00, /*!< pll clock output range less than or equal to 72mhz */
  408. CRM_PLL_OUTPUT_RANGE_GT72MHZ = 0x01 /*!< pll clock output range greater than 72mhz */
  409. } crm_pll_output_range_type;
  410. /**
  411. * @brief crm clock source
  412. */
  413. typedef enum
  414. {
  415. CRM_CLOCK_SOURCE_HICK = 0x00, /*!< high speed internal clock */
  416. CRM_CLOCK_SOURCE_HEXT = 0x01, /*!< high speed external crystal */
  417. CRM_CLOCK_SOURCE_PLL = 0x02, /*!< phase locking loop */
  418. CRM_CLOCK_SOURCE_LEXT = 0x03, /*!< low speed external crystal */
  419. CRM_CLOCK_SOURCE_LICK = 0x04 /*!< low speed internal clock */
  420. } crm_clock_source_type;
  421. /**
  422. * @brief crm ahb division
  423. */
  424. typedef enum
  425. {
  426. CRM_AHB_DIV_1 = 0x00, /*!< sclk div1 to ahbclk */
  427. CRM_AHB_DIV_2 = 0x08, /*!< sclk div2 to ahbclk */
  428. CRM_AHB_DIV_4 = 0x09, /*!< sclk div4 to ahbclk */
  429. CRM_AHB_DIV_8 = 0x0A, /*!< sclk div8 to ahbclk */
  430. CRM_AHB_DIV_16 = 0x0B, /*!< sclk div16 to ahbclk */
  431. CRM_AHB_DIV_64 = 0x0C, /*!< sclk div64 to ahbclk */
  432. CRM_AHB_DIV_128 = 0x0D, /*!< sclk div128 to ahbclk */
  433. CRM_AHB_DIV_256 = 0x0E, /*!< sclk div256 to ahbclk */
  434. CRM_AHB_DIV_512 = 0x0F /*!< sclk div512 to ahbclk */
  435. } crm_ahb_div_type;
  436. /**
  437. * @brief crm apb1 division
  438. */
  439. typedef enum
  440. {
  441. CRM_APB1_DIV_1 = 0x00, /*!< ahbclk div1 to apb1clk */
  442. CRM_APB1_DIV_2 = 0x04, /*!< ahbclk div2 to apb1clk */
  443. CRM_APB1_DIV_4 = 0x05, /*!< ahbclk div4 to apb1clk */
  444. CRM_APB1_DIV_8 = 0x06, /*!< ahbclk div8 to apb1clk */
  445. CRM_APB1_DIV_16 = 0x07 /*!< ahbclk div16 to apb1clk */
  446. } crm_apb1_div_type;
  447. /**
  448. * @brief crm apb2 division
  449. */
  450. typedef enum
  451. {
  452. CRM_APB2_DIV_1 = 0x00, /*!< ahbclk div1 to apb2clk */
  453. CRM_APB2_DIV_2 = 0x04, /*!< ahbclk div2 to apb2clk */
  454. CRM_APB2_DIV_4 = 0x05, /*!< ahbclk div4 to apb2clk */
  455. CRM_APB2_DIV_8 = 0x06, /*!< ahbclk div8 to apb2clk */
  456. CRM_APB2_DIV_16 = 0x07 /*!< ahbclk div16 to apb2clk */
  457. } crm_apb2_div_type;
  458. /**
  459. * @brief crm adc division
  460. */
  461. typedef enum
  462. {
  463. CRM_ADC_DIV_2 = 0x00, /*!< apb2clk div2 to adcclk */
  464. CRM_ADC_DIV_4 = 0x01, /*!< apb2clk div4 to adcclk */
  465. CRM_ADC_DIV_6 = 0x02, /*!< apb2clk div6 to adcclk */
  466. CRM_ADC_DIV_8 = 0x03, /*!< apb2clk div8 to adcclk */
  467. CRM_ADC_DIV_12 = 0x05, /*!< apb2clk div12 to adcclk */
  468. CRM_ADC_DIV_16 = 0x07 /*!< apb2clk div16 to adcclk */
  469. } crm_adc_div_type;
  470. /**
  471. * @brief crm usb division
  472. */
  473. typedef enum
  474. {
  475. CRM_USB_DIV_1_5 = 0x00, /*!< pllclk div1.5 to usbclk */
  476. CRM_USB_DIV_1 = 0x01, /*!< pllclk div1 to usbclk */
  477. CRM_USB_DIV_2_5 = 0x02, /*!< pllclk div2.5 to usbclk */
  478. CRM_USB_DIV_2 = 0x03, /*!< pllclk div2 to usbclk */
  479. CRM_USB_DIV_3_5 = 0x04, /*!< pllclk div3.5 to usbclk */
  480. CRM_USB_DIV_3 = 0x05, /*!< pllclk div3 to usbclk */
  481. CRM_USB_DIV_4 = 0x06 /*!< pllclk div4 to usbclk */
  482. } crm_usb_div_type;
  483. /**
  484. * @brief crm rtc clock
  485. */
  486. typedef enum
  487. {
  488. CRM_RTC_CLOCK_NOCLK = 0x00, /*!< no clock as rtc clock source */
  489. CRM_RTC_CLOCK_LEXT = 0x01, /*!< low speed external crystal as rtc clock source */
  490. CRM_RTC_CLOCK_LICK = 0x02, /*!< low speed internal clock as rtc clock source */
  491. CRM_RTC_CLOCK_HEXT_DIV = 0x03 /*!< high speed external crystal div as rtc clock source */
  492. } crm_rtc_clock_type;
  493. /**
  494. * @brief crm hick 48mhz division
  495. */
  496. typedef enum
  497. {
  498. CRM_HICK48_DIV6 = 0x00, /*!< high speed internal clock (48 mhz) div6 */
  499. CRM_HICK48_NODIV = 0x01 /*!< high speed internal clock (48 mhz) no div */
  500. } crm_hick_div_6_type;
  501. /**
  502. * @brief crm hext division
  503. */
  504. typedef enum
  505. {
  506. CRM_HEXT_DIV_2 = 0x00, /*!< high speed external crystal div2 */
  507. CRM_HEXT_DIV_3 = 0x01, /*!< high speed external crystal div3 */
  508. CRM_HEXT_DIV_4 = 0x02, /*!< high speed external crystal div4 */
  509. CRM_HEXT_DIV_5 = 0x03 /*!< high speed external crystal div5 */
  510. } crm_hext_div_type;
  511. /**
  512. * @brief crm sclk select
  513. */
  514. typedef enum
  515. {
  516. CRM_SCLK_HICK = 0x00, /*!< select high speed internal clock as sclk */
  517. CRM_SCLK_HEXT = 0x01, /*!< select high speed external crystal as sclk */
  518. CRM_SCLK_PLL = 0x02 /*!< select phase locking loop clock as sclk */
  519. } crm_sclk_type;
  520. /**
  521. * @brief crm clkout select
  522. */
  523. typedef enum
  524. {
  525. CRM_CLKOUT_NOCLK = 0x00, /*!< output no clock to clkout pin */
  526. CRM_CLKOUT_LICK = 0x02, /*!< output low speed internal clock to clkout pin */
  527. CRM_CLKOUT_LEXT = 0x03, /*!< output low speed external crystal to clkout pin */
  528. CRM_CLKOUT_SCLK = 0x04, /*!< output system clock to clkout pin */
  529. CRM_CLKOUT_HICK = 0x05, /*!< output high speed internal clock to clkout pin */
  530. CRM_CLKOUT_HEXT = 0x06, /*!< output high speed external crystal to clkout pin */
  531. CRM_CLKOUT_PLL_DIV_2 = 0x07, /*!< output phase locking loop clock div2 to clkout pin */
  532. CRM_CLKOUT_PLL_DIV_4 = 0x0C, /*!< output phase locking loop clock div4 to clkout pin */
  533. CRM_CLKOUT_USB = 0x0D, /*!< output usbclk to clkout pin */
  534. CRM_CLKOUT_ADC = 0x0E /*!< output adcclk to clkout pin */
  535. } crm_clkout_select_type;
  536. /**
  537. * @brief crm clkout division
  538. */
  539. typedef enum
  540. {
  541. CRM_CLKOUT_DIV_1 = 0x00, /*!< clkout div1 */
  542. CRM_CLKOUT_DIV_2 = 0x08, /*!< clkout div2 */
  543. CRM_CLKOUT_DIV_4 = 0x09, /*!< clkout div4 */
  544. CRM_CLKOUT_DIV_8 = 0x0A, /*!< clkout div8 */
  545. CRM_CLKOUT_DIV_16 = 0x0B, /*!< clkout div16 */
  546. CRM_CLKOUT_DIV_64 = 0x0C, /*!< clkout div64 */
  547. CRM_CLKOUT_DIV_128 = 0x0D, /*!< clkout div128 */
  548. CRM_CLKOUT_DIV_256 = 0x0E, /*!< clkout div256 */
  549. CRM_CLKOUT_DIV_512 = 0x0F /*!< clkout div512 */
  550. } crm_clkout_div_type;
  551. /**
  552. * @brief crm auto step mode
  553. */
  554. typedef enum
  555. {
  556. CRM_AUTO_STEP_MODE_DISABLE = 0x00, /*!< disable auto step mode */
  557. CRM_AUTO_STEP_MODE_ENABLE = 0x03 /*!< enable auto step mode */
  558. } crm_auto_step_mode_type;
  559. /**
  560. * @brief crm usbdev interrupt remap
  561. */
  562. typedef enum
  563. {
  564. CRM_USB_INT19_INT20 = 0x00, /*!< usb high and low priority irq numer use 19 and 20 */
  565. CRM_USB_INT73_INT74 = 0x01 /*!< usb high and low priority irq numer use 73 and 74 */
  566. } crm_usb_int_map_type;
  567. /**
  568. * @brief crm usb 48 mhz clock source select
  569. */
  570. typedef enum
  571. {
  572. CRM_USB_CLOCK_SOURCE_PLL = 0x00, /*!< select phase locking loop clock as usb clock source */
  573. CRM_USB_CLOCK_SOURCE_HICK = 0x01 /*!< select high speed internal clock as usb clock source */
  574. } crm_usb_clock_source_type;
  575. /**
  576. * @brief crm hick as system clock frequency select
  577. */
  578. typedef enum
  579. {
  580. CRM_HICK_SCLK_8MHZ = 0x00, /*!< fixed 8 mhz when hick is selected as sclk */
  581. CRM_HICK_SCLK_48MHZ = 0x01 /*!< 8 mhz or 48 mhz depend on hickdiv when hick is selected as sclk */
  582. } crm_hick_sclk_frequency_type;
  583. /**
  584. * @brief crm emac output pulse width
  585. */
  586. typedef enum
  587. {
  588. CRM_EMAC_PULSE_125MS = 0x00, /*!< emac output pulse width 125ms */
  589. CRM_EMAC_PULSE_1SCLK = 0x01 /*!< emac output pulse width 1 system clock */
  590. } crm_emac_output_pulse_type;
  591. /**
  592. * @brief crm clocks freqency structure
  593. */
  594. typedef struct
  595. {
  596. uint32_t sclk_freq; /*!< system clock frequency */
  597. uint32_t ahb_freq; /*!< ahb bus clock frequency */
  598. uint32_t apb2_freq; /*!< apb2 bus clock frequency */
  599. uint32_t apb1_freq; /*!< apb1 bus clock frequency */
  600. uint32_t adc_freq; /*!< adc clock frequency */
  601. } crm_clocks_freq_type;
  602. /**
  603. * @brief type define crm register all
  604. */
  605. typedef struct
  606. {
  607. /**
  608. * @brief crm ctrl register, offset:0x00
  609. */
  610. union
  611. {
  612. __IO uint32_t ctrl;
  613. struct
  614. {
  615. __IO uint32_t hicken : 1; /* [0] */
  616. __IO uint32_t hickstbl : 1; /* [1] */
  617. __IO uint32_t hicktrim : 6; /* [7:2] */
  618. __IO uint32_t hickcal : 8; /* [15:8] */
  619. __IO uint32_t hexten : 1; /* [16] */
  620. __IO uint32_t hextstbl : 1; /* [17] */
  621. __IO uint32_t hextbyps : 1; /* [18] */
  622. __IO uint32_t cfden : 1; /* [19] */
  623. __IO uint32_t reserved1 : 4; /* [23:20] */
  624. __IO uint32_t pllen : 1; /* [24] */
  625. __IO uint32_t pllstbl : 1; /* [25] */
  626. __IO uint32_t reserved2 : 6; /* [31:26] */
  627. } ctrl_bit;
  628. };
  629. /**
  630. * @brief crm cfg register, offset:0x04
  631. */
  632. union
  633. {
  634. __IO uint32_t cfg;
  635. struct
  636. {
  637. __IO uint32_t sclksel : 2; /* [1:0] */
  638. __IO uint32_t sclksts : 2; /* [3:2] */
  639. __IO uint32_t ahbdiv : 4; /* [7:4] */
  640. __IO uint32_t apb1div : 3; /* [10:8] */
  641. __IO uint32_t apb2div : 3; /* [13:11] */
  642. __IO uint32_t adcdiv_l : 2; /* [15:14] */
  643. __IO uint32_t pllrcs : 1; /* [16] */
  644. __IO uint32_t pllhextdiv : 1; /* [17] */
  645. __IO uint32_t pllmult_l : 4; /* [21:18] */
  646. __IO uint32_t usbdiv_l : 2; /* [23:22] */
  647. __IO uint32_t clkout_sel : 3; /* [26:24] */
  648. __IO uint32_t usbdiv_h : 1; /* [27] */
  649. __IO uint32_t adcdiv_h : 1; /* [28] */
  650. __IO uint32_t pllmult_h : 2; /* [30:29] */
  651. __IO uint32_t pllrange : 1; /* [31] */
  652. } cfg_bit;
  653. };
  654. /**
  655. * @brief crm clkint register, offset:0x08
  656. */
  657. union
  658. {
  659. __IO uint32_t clkint;
  660. struct
  661. {
  662. __IO uint32_t lickstblf : 1; /* [0] */
  663. __IO uint32_t lextstblf : 1; /* [1] */
  664. __IO uint32_t hickstblf : 1; /* [2] */
  665. __IO uint32_t hextstblf : 1; /* [3] */
  666. __IO uint32_t pllstblf : 1; /* [4] */
  667. __IO uint32_t reserved1 : 2; /* [6:5] */
  668. __IO uint32_t cfdf : 1; /* [7] */
  669. __IO uint32_t lickstblien : 1; /* [8] */
  670. __IO uint32_t lextstblien : 1; /* [9] */
  671. __IO uint32_t hickstblien : 1; /* [10] */
  672. __IO uint32_t hextstblien : 1; /* [11] */
  673. __IO uint32_t pllstblien : 1; /* [12] */
  674. __IO uint32_t reserved2 : 3; /* [15:13] */
  675. __IO uint32_t lickstblfc : 1; /* [16] */
  676. __IO uint32_t lextstblfc : 1; /* [17] */
  677. __IO uint32_t hickstblfc : 1; /* [18] */
  678. __IO uint32_t hextstblfc : 1; /* [19] */
  679. __IO uint32_t pllstblfc : 1; /* [20] */
  680. __IO uint32_t reserved3 : 2; /* [22:21] */
  681. __IO uint32_t cfdfc : 1; /* [23] */
  682. __IO uint32_t reserved4 : 8; /* [31:24] */
  683. } clkint_bit;
  684. };
  685. /**
  686. * @brief crm apb2rst register, offset:0x0C
  687. */
  688. union
  689. {
  690. __IO uint32_t apb2rst;
  691. struct
  692. {
  693. __IO uint32_t iomuxrst : 1; /* [0] */
  694. __IO uint32_t exintrst : 1; /* [1] */
  695. __IO uint32_t gpioarst : 1; /* [2] */
  696. __IO uint32_t gpiobrst : 1; /* [3] */
  697. __IO uint32_t gpiocrst : 1; /* [4] */
  698. __IO uint32_t gpiodrst : 1; /* [5] */
  699. __IO uint32_t gpioerst : 1; /* [6] */
  700. __IO uint32_t reserved1 : 2; /* [8:7] */
  701. __IO uint32_t adc1rst : 1; /* [9] */
  702. __IO uint32_t adc2rst : 1; /* [10] */
  703. __IO uint32_t tmr1rst : 1; /* [11] */
  704. __IO uint32_t spi1rst : 1; /* [12] */
  705. __IO uint32_t tmr8rst : 1; /* [13] */
  706. __IO uint32_t usart1rst : 1; /* [14] */
  707. __IO uint32_t adc3rst : 1; /* [15] */
  708. __IO uint32_t reserved2 : 3; /* [18:16] */
  709. __IO uint32_t tmr9rst : 1; /* [19] */
  710. __IO uint32_t tmr10rst : 1; /* [20] */
  711. __IO uint32_t tmr11rst : 1; /* [21] */
  712. __IO uint32_t accrst : 1; /* [22] */
  713. __IO uint32_t i2c3rst : 1; /* [23] */
  714. __IO uint32_t usart6rst : 1; /* [24] */
  715. __IO uint32_t uart7rst : 1; /* [25] */
  716. __IO uint32_t uart8rst : 1; /* [26] */
  717. __IO uint32_t reserved3 : 5; /* [31:27] */
  718. } apb2rst_bit;
  719. };
  720. /**
  721. * @brief crm apb1rst register, offset:0x10
  722. */
  723. union
  724. {
  725. __IO uint32_t apb1rst;
  726. struct
  727. {
  728. __IO uint32_t tmr2rst : 1; /* [0] */
  729. __IO uint32_t tmr3rst : 1; /* [1] */
  730. __IO uint32_t tmr4rst : 1; /* [2] */
  731. __IO uint32_t tmr5rst : 1; /* [3] */
  732. __IO uint32_t tmr6rst : 1; /* [4] */
  733. __IO uint32_t tmr7rst : 1; /* [5] */
  734. __IO uint32_t tmr12rst : 1; /* [6] */
  735. __IO uint32_t tmr13rst : 1; /* [7] */
  736. __IO uint32_t tmr14rst : 1; /* [8] */
  737. __IO uint32_t reserved1 : 2; /* [10:9] */
  738. __IO uint32_t wwdtrst : 1; /* [11] */
  739. __IO uint32_t reserved2 : 2; /* [13:12] */
  740. __IO uint32_t spi2rst : 1; /* [14] */
  741. __IO uint32_t spi3rst : 1; /* [15] */
  742. __IO uint32_t spi4rst : 1; /* [16] */
  743. __IO uint32_t usart2rst : 1; /* [17] */
  744. __IO uint32_t usart3rst : 1; /* [18] */
  745. __IO uint32_t uart4rst : 1; /* [19] */
  746. __IO uint32_t uart5rst : 1; /* [20] */
  747. __IO uint32_t i2c1rst : 1; /* [21] */
  748. __IO uint32_t i2c2rst : 1; /* [22] */
  749. __IO uint32_t usbrst : 1; /* [23] */
  750. __IO uint32_t reserved3 : 1; /* [24] */
  751. __IO uint32_t can1rst : 1; /* [25] */
  752. __IO uint32_t can2rst : 1; /* [26] */
  753. __IO uint32_t bprrst : 1; /* [27] */
  754. __IO uint32_t pwcrst : 1; /* [28] */
  755. __IO uint32_t dacrst : 1; /* [29] */
  756. __IO uint32_t reserved4 : 2; /* [31:30] */
  757. } apb1rst_bit;
  758. };
  759. /**
  760. * @brief crm ahben register, offset:0x14
  761. */
  762. union
  763. {
  764. __IO uint32_t ahben;
  765. #if defined (AT32F403Axx)
  766. struct
  767. {
  768. __IO uint32_t dma1en : 1; /* [0] */
  769. __IO uint32_t dma2en : 1; /* [1] */
  770. __IO uint32_t sramen : 1; /* [2] */
  771. __IO uint32_t reserved1 : 1; /* [3] */
  772. __IO uint32_t flashen : 1; /* [4] */
  773. __IO uint32_t reserved2 : 1; /* [5] */
  774. __IO uint32_t crcen : 1; /* [6] */
  775. __IO uint32_t reserved3 : 1; /* [7] */
  776. __IO uint32_t xmcen : 1; /* [8] */
  777. __IO uint32_t reserved4 : 1; /* [9] */
  778. __IO uint32_t sdio1en : 1; /* [10] */
  779. __IO uint32_t sdio2en : 1; /* [11] */
  780. __IO uint32_t reserved5 : 20;/* [31:12] */
  781. } ahben_bit;
  782. #endif
  783. #if defined (AT32F407xx)
  784. struct
  785. {
  786. __IO uint32_t dma1en : 1; /* [0] */
  787. __IO uint32_t dma2en : 1; /* [1] */
  788. __IO uint32_t sramen : 1; /* [2] */
  789. __IO uint32_t reserved1 : 1; /* [3] */
  790. __IO uint32_t flashen : 1; /* [4] */
  791. __IO uint32_t reserved2 : 1; /* [5] */
  792. __IO uint32_t crcen : 1; /* [6] */
  793. __IO uint32_t reserved3 : 1; /* [7] */
  794. __IO uint32_t xmcen : 1; /* [8] */
  795. __IO uint32_t reserved4 : 1; /* [9] */
  796. __IO uint32_t sdio1en : 1; /* [10] */
  797. __IO uint32_t sdio2en : 1; /* [11] */
  798. __IO uint32_t reserved5 : 2; /* [13:12] */
  799. __IO uint32_t emacen : 1; /* [14] */
  800. __IO uint32_t emactxen : 1; /* [15] */
  801. __IO uint32_t emacrxen : 1; /* [16] */
  802. __IO uint32_t reserved6 : 11;/* [27:17] */
  803. __IO uint32_t emacptpen : 1; /* [28] */
  804. __IO uint32_t reserved7 : 3; /* [31:29] */
  805. } ahben_bit;
  806. #endif
  807. };
  808. /**
  809. * @brief crm apb2en register, offset:0x18
  810. */
  811. union
  812. {
  813. __IO uint32_t apb2en;
  814. struct
  815. {
  816. __IO uint32_t iomuxen : 1; /* [0] */
  817. __IO uint32_t reserved1 : 1; /* [1] */
  818. __IO uint32_t gpioaen : 1; /* [2] */
  819. __IO uint32_t gpioben : 1; /* [3] */
  820. __IO uint32_t gpiocen : 1; /* [4] */
  821. __IO uint32_t gpioden : 1; /* [5] */
  822. __IO uint32_t gpioeen : 1; /* [6] */
  823. __IO uint32_t reserved2 : 2; /* [8:7] */
  824. __IO uint32_t adc1en : 1; /* [9] */
  825. __IO uint32_t adc2en : 1; /* [10] */
  826. __IO uint32_t tmr1en : 1; /* [11] */
  827. __IO uint32_t spi1en : 1; /* [12] */
  828. __IO uint32_t tmr8en : 1; /* [13] */
  829. __IO uint32_t usart1en : 1; /* [14] */
  830. __IO uint32_t adc3en : 1; /* [15] */
  831. __IO uint32_t reserved3 : 3; /* [18:16] */
  832. __IO uint32_t tmr9en : 1; /* [19] */
  833. __IO uint32_t tmr10en : 1; /* [20] */
  834. __IO uint32_t tmr11en : 1; /* [21] */
  835. __IO uint32_t accen : 1; /* [22] */
  836. __IO uint32_t i2c3en : 1; /* [23] */
  837. __IO uint32_t usart6en : 1; /* [24] */
  838. __IO uint32_t uart7en : 1; /* [25] */
  839. __IO uint32_t uart8en : 1; /* [26] */
  840. __IO uint32_t reserved4 : 5; /* [31:27] */
  841. } apb2en_bit;
  842. };
  843. /**
  844. * @brief crm apb1en register, offset:0x1C
  845. */
  846. union
  847. {
  848. __IO uint32_t apb1en;
  849. struct
  850. {
  851. __IO uint32_t tmr2en : 1; /* [0] */
  852. __IO uint32_t tmr3en : 1; /* [1] */
  853. __IO uint32_t tmr4en : 1; /* [2] */
  854. __IO uint32_t tmr5en : 1; /* [3] */
  855. __IO uint32_t tmr6en : 1; /* [4] */
  856. __IO uint32_t tmr7en : 1; /* [5] */
  857. __IO uint32_t tmr12en : 1; /* [6] */
  858. __IO uint32_t tmr13en : 1; /* [7] */
  859. __IO uint32_t tmr14en : 1; /* [8] */
  860. __IO uint32_t reserved1 : 2; /* [10:9] */
  861. __IO uint32_t wwdten : 1; /* [11] */
  862. __IO uint32_t reserved2 : 2; /* [13:12] */
  863. __IO uint32_t spi2en : 1; /* [14] */
  864. __IO uint32_t spi3en : 1; /* [15] */
  865. __IO uint32_t spi4en : 1; /* [16] */
  866. __IO uint32_t usart2en : 1; /* [17] */
  867. __IO uint32_t usart3en : 1; /* [18] */
  868. __IO uint32_t uart4en : 1; /* [19] */
  869. __IO uint32_t uart5en : 1; /* [20] */
  870. __IO uint32_t i2c1en : 1; /* [21] */
  871. __IO uint32_t i2c2en : 1; /* [22] */
  872. __IO uint32_t usben : 1; /* [23] */
  873. __IO uint32_t reserved3 : 1; /* [24] */
  874. __IO uint32_t can1en : 1; /* [25] */
  875. __IO uint32_t can2en : 1; /* [26] */
  876. __IO uint32_t bpren : 1; /* [27] */
  877. __IO uint32_t pwcen : 1; /* [28] */
  878. __IO uint32_t dacen : 1; /* [29] */
  879. __IO uint32_t reserved4 : 2; /* [31:30] */
  880. } apb1en_bit;
  881. };
  882. /**
  883. * @brief crm bpdc register, offset:0x20
  884. */
  885. union
  886. {
  887. __IO uint32_t bpdc;
  888. struct
  889. {
  890. __IO uint32_t lexten : 1; /* [0] */
  891. __IO uint32_t lextstbl : 1; /* [1] */
  892. __IO uint32_t lextbyps : 1; /* [2] */
  893. __IO uint32_t reserved1 : 5; /* [7:3] */
  894. __IO uint32_t rtcsel : 2; /* [9:8] */
  895. __IO uint32_t reserved2 : 5; /* [14:10] */
  896. __IO uint32_t rtcen : 1; /* [15] */
  897. __IO uint32_t bpdrst : 1; /* [16] */
  898. __IO uint32_t reserved3 : 15;/* [31:17] */
  899. } bpdc_bit;
  900. };
  901. /**
  902. * @brief crm ctrlsts register, offset:0x24
  903. */
  904. union
  905. {
  906. __IO uint32_t ctrlsts;
  907. struct
  908. {
  909. __IO uint32_t licken : 1; /* [0] */
  910. __IO uint32_t lickstbl : 1; /* [1] */
  911. __IO uint32_t reserved1 : 22;/* [23:2] */
  912. __IO uint32_t rstfc : 1; /* [24] */
  913. __IO uint32_t reserved2 : 1; /* [25] */
  914. __IO uint32_t nrstf : 1; /* [26] */
  915. __IO uint32_t porrstf : 1; /* [27] */
  916. __IO uint32_t swrstf : 1; /* [28] */
  917. __IO uint32_t wdtrstf : 1; /* [29] */
  918. __IO uint32_t wwdtrstf : 1; /* [30] */
  919. __IO uint32_t lprstf : 1; /* [31] */
  920. } ctrlsts_bit;
  921. };
  922. /**
  923. * @brief crm ahbrst register, offset:0x28
  924. */
  925. union
  926. {
  927. __IO uint32_t ahbrst;
  928. #if defined (AT32F407xx)
  929. struct
  930. {
  931. __IO uint32_t reserved1 : 14;/* [13:0] */
  932. __IO uint32_t emacrst : 1; /* [14] */
  933. __IO uint32_t reserved2 : 17;/* [31:15] */
  934. } ahbrst_bit;
  935. #endif
  936. };
  937. /**
  938. * @brief crm reserved1 register, offset:0x2C
  939. */
  940. __IO uint32_t reserved1;
  941. /**
  942. * @brief crm misc1 register, offset:0x30
  943. */
  944. union
  945. {
  946. __IO uint32_t misc1;
  947. struct
  948. {
  949. __IO uint32_t hickcal_key : 8; /* [7:0] */
  950. __IO uint32_t reserved1 : 8; /* [15:8] */
  951. __IO uint32_t clkout_sel : 1; /* [16] */
  952. __IO uint32_t reserved2 : 7; /* [23:17] */
  953. __IO uint32_t usbbufs : 1; /* [24] */
  954. __IO uint32_t hickdiv : 1; /* [25] */
  955. __IO uint32_t reserved3 : 2; /* [27:26] */
  956. __IO uint32_t clkoutdiv : 4; /* [31:28] */
  957. } misc1_bit;
  958. };
  959. /**
  960. * @brief crm reserved2 register, offset:0x4C~0x34
  961. */
  962. __IO uint32_t reserved2[7];
  963. /**
  964. * @brief crm misc2 register, offset:0x50
  965. */
  966. union
  967. {
  968. __IO uint32_t misc2;
  969. struct
  970. {
  971. __IO uint32_t reserved1 : 16;/* [15:0] */
  972. __IO uint32_t clk_to_tmr : 1; /* [16] */
  973. __IO uint32_t reserved2 : 15;/* [31:17] */
  974. } misc2_bit;
  975. };
  976. /**
  977. * @brief crm misc3 register, offset:0x54
  978. */
  979. union
  980. {
  981. __IO uint32_t misc3;
  982. struct
  983. {
  984. __IO uint32_t reserved1 : 4; /* [3:0] */
  985. __IO uint32_t auto_step_en : 2; /* [5:4] */
  986. __IO uint32_t reserved2 : 2; /* [7:6] */
  987. __IO uint32_t hick_to_usb : 1; /* [8] */
  988. __IO uint32_t hick_to_sclk : 1; /* [9] */
  989. __IO uint32_t reserved3 : 2; /* [11:10] */
  990. __IO uint32_t hextdiv : 2; /* [13:12] */
  991. __IO uint32_t reserved4 : 1; /* [14] */
  992. __IO uint32_t emac_pps_sel : 1; /* [15] */
  993. __IO uint32_t reserved5 : 16;/* [31:16] */
  994. } misc3_bit;
  995. };
  996. /**
  997. * @brief crm reserved3 register, offset:0x58
  998. */
  999. __IO uint32_t reserved3;
  1000. /**
  1001. * @brief crm intmap register, offset:0x5C
  1002. */
  1003. union
  1004. {
  1005. __IO uint32_t intmap;
  1006. struct
  1007. {
  1008. __IO uint32_t usbintmap : 1; /* [0] */
  1009. __IO uint32_t reserved1 : 31;/* [31:1] */
  1010. } intmap_bit;
  1011. };
  1012. } crm_type;
  1013. /**
  1014. * @}
  1015. */
  1016. #define CRM ((crm_type *) CRM_BASE)
  1017. /** @defgroup CRM_exported_functions
  1018. * @{
  1019. */
  1020. void crm_reset(void);
  1021. void crm_lext_bypass(confirm_state new_state);
  1022. void crm_hext_bypass(confirm_state new_state);
  1023. flag_status crm_flag_get(uint32_t flag);
  1024. flag_status crm_interrupt_flag_get(uint32_t flag);
  1025. error_status crm_hext_stable_wait(void);
  1026. void crm_hick_clock_trimming_set(uint8_t trim_value);
  1027. void crm_hick_clock_calibration_set(uint8_t cali_value);
  1028. void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state);
  1029. void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state);
  1030. void crm_periph_sleep_mode_clock_enable(crm_periph_clock_sleepmd_type value, confirm_state new_state);
  1031. void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state);
  1032. void crm_flag_clear(uint32_t flag);
  1033. void crm_rtc_clock_select(crm_rtc_clock_type value);
  1034. void crm_rtc_clock_enable(confirm_state new_state);
  1035. void crm_ahb_div_set(crm_ahb_div_type value);
  1036. void crm_apb1_div_set(crm_apb1_div_type value);
  1037. void crm_apb2_div_set(crm_apb2_div_type value);
  1038. void crm_adc_clock_div_set(crm_adc_div_type div_value);
  1039. void crm_usb_clock_div_set(crm_usb_div_type div_value);
  1040. void crm_clock_failure_detection_enable(confirm_state new_state);
  1041. void crm_battery_powered_domain_reset(confirm_state new_state);
  1042. void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range);
  1043. void crm_sysclk_switch(crm_sclk_type value);
  1044. crm_sclk_type crm_sysclk_switch_status_get(void);
  1045. void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct);
  1046. void crm_clock_out_set(crm_clkout_select_type clkout);
  1047. void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state);
  1048. void crm_auto_step_mode_enable(confirm_state new_state);
  1049. void crm_usb_interrupt_remapping_set(crm_usb_int_map_type int_remap);
  1050. void crm_hick_divider_select(crm_hick_div_6_type value);
  1051. void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value);
  1052. void crm_usb_clock_source_select(crm_usb_clock_source_type value);
  1053. void crm_clkout_to_tmr10_enable(confirm_state new_state);
  1054. void crm_hext_clock_div_set(crm_hext_div_type value);
  1055. void crm_clkout_div_set(crm_clkout_div_type clkout_div);
  1056. #if defined (AT32F407xx)
  1057. void crm_emac_output_pulse_set(crm_emac_output_pulse_type width);
  1058. #endif
  1059. /**
  1060. * @}
  1061. */
  1062. /**
  1063. * @}
  1064. */
  1065. /**
  1066. * @}
  1067. */
  1068. #ifdef __cplusplus
  1069. }
  1070. #endif
  1071. #endif