apm32f0xx_rcm.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. /*!
  2. * @file apm32f0xx_rcm.h
  3. *
  4. * @brief This file contains all the functions prototypes for the RCM firmware library
  5. *
  6. * @version V1.0.2
  7. *
  8. * @date 2022-02-21
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be useful and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. #ifndef __APM32F0XX_RCM_H
  26. #define __APM32F0XX_RCM_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "apm32f0xx.h"
  31. /** @addtogroup APM32F0xx_StdPeriphDriver
  32. @{
  33. */
  34. /** @addtogroup RCM_Driver RCM Driver
  35. @{
  36. */
  37. /** @defgroup RCM_Macros Macros
  38. @{
  39. */
  40. /**@} end of group RCM_Macros*/
  41. /** @defgroup RCM_Enumerations Enumerations
  42. @{
  43. */
  44. /**
  45. * @brief HSE enum
  46. */
  47. typedef enum
  48. {
  49. RCM_HSE_CLOSE = 0x00, /*!< turn OFF the HSE oscillator */
  50. RCM_HSE_OPEN = 0x01, /*!< turn ON the HSE oscillator */
  51. RCM_HSE_BYPASS = 0x05, /*!< HSE oscillator bypassed with external clock */
  52. } RCM_HSE_T;
  53. /**
  54. * @brief LSE enum
  55. */
  56. typedef enum
  57. {
  58. RCM_LSE_CLOSE = 0x00, /*!< turn OFF the LSE oscillator */
  59. RCM_LSE_OPEN = 0x01, /*!< turn ON the LSE oscillator */
  60. RCM_LSE_BYPASS = 0x05, /*!< LSE oscillator bypassed with external clock */
  61. } RCM_LSE_T;
  62. /**
  63. * @brief LSE_Drive enum
  64. */
  65. typedef enum
  66. {
  67. RCM_LSE_DRIVE_Low = 0x00, /*!< LSE oscillator low drive capability */
  68. RCM_LSE_DRIVE_MediumLow, /*!< LSE oscillator medium low drive capability */
  69. RCM_LSE_DRIVE_MediumHigh, /*!< LSE oscillator medium high drive capability */
  70. RCM_LSE_DRIVE_High, /*!< LSE oscillator high drive capability */
  71. } RCM_LSE_DRIVE_T;
  72. /**
  73. * @brief System clock select
  74. */
  75. typedef enum
  76. {
  77. RCM_PLL_SEL_HSI_DIV2, /*!< HSI clock divided by 2 selected as PLL clock source */
  78. RCM_PLL_SEL_HSI, /*!< HSI clock selected as PLL clock entry, only for APM32F072 and APM32F091 devices */
  79. RCM_PLL_SEL_HSE, /*!< HSE/CLKDIV1 selected as PLL clock entry */
  80. RCM_PLL_SEL_HSI48 /*!< HSI48 oscillator clock selected as PLL clock source, only for APM32F072 and APM32F091 devices */
  81. } RCM_PLL_SEL_T;
  82. /**
  83. * @brief PLL multiplication factor
  84. */
  85. typedef enum
  86. {
  87. RCM_PLLMF_2, /*!< specifies the PLLMULCFG clock multiple factor as 2 */
  88. RCM_PLLMF_3, /*!< specifies the PLLMULCFG clock multiple factor as 3 */
  89. RCM_PLLMF_4, /*!< specifies the PLLMULCFG clock multiple factor as 4 */
  90. RCM_PLLMF_5, /*!< specifies the PLLMULCFG clock multiple factor as 5 */
  91. RCM_PLLMF_6, /*!< specifies the PLLMULCFG clock multiple factor as 6 */
  92. RCM_PLLMF_7, /*!< specifies the PLLMULCFG clock multiple factor as 7 */
  93. RCM_PLLMF_8, /*!< specifies the PLLMULCFG clock multiple factor as 8 */
  94. RCM_PLLMF_9, /*!< specifies the PLLMULCFG clock multiple factor as 9 */
  95. RCM_PLLMF_10, /*!< specifies the PLLMULCFG clock multiple factor as 10 */
  96. RCM_PLLMF_11, /*!< specifies the PLLMULCFG clock multiple factor as 11 */
  97. RCM_PLLMF_12, /*!< specifies the PLLMULCFG clock multiple factor as 12 */
  98. RCM_PLLMF_13, /*!< specifies the PLLMULCFG clock multiple factor as 13 */
  99. RCM_PLLMF_14, /*!< specifies the PLLMULCFG clock multiple factor as 14 */
  100. RCM_PLLMF_15, /*!< specifies the PLLMULCFG clock multiple factor as 15 */
  101. RCM_PLLMF_16, /*!< specifies the PLLMULCFG clock multiple factor as 16 */
  102. } RCM_PLLMF_T;
  103. /**
  104. * @brief RCM clock division
  105. */
  106. typedef enum
  107. {
  108. RCM_CLK_DIV_1, /*!< specifies the PLLDIVCFG clock division factor as 1 */
  109. RCM_CLK_DIV_2, /*!< specifies the PLLDIVCFG clock division factor as 2 */
  110. RCM_CLK_DIV_3, /*!< specifies the PLLDIVCFG clock division factor as 3 */
  111. RCM_CLK_DIV_4, /*!< specifies the PLLDIVCFG clock division factor as 4 */
  112. RCM_CLK_DIV_5, /*!< specifies the PLLDIVCFG clock division factor as 5 */
  113. RCM_CLK_DIV_6, /*!< specifies the PLLDIVCFG clock division factor as 6 */
  114. RCM_CLK_DIV_7, /*!< specifies the PLLDIVCFG clock division factor as 7 */
  115. RCM_CLK_DIV_8, /*!< specifies the PLLDIVCFG clock division factor as 8 */
  116. RCM_CLK_DIV_9, /*!< specifies the PLLDIVCFG clock division factor as 9 */
  117. RCM_CLK_DIV_10, /*!< specifies the PLLDIVCFG clock division factor as 10 */
  118. RCM_CLK_DIV_11, /*!< specifies the PLLDIVCFG clock division factor as 11 */
  119. RCM_CLK_DIV_12, /*!< specifies the PLLDIVCFG clock division factor as 12 */
  120. RCM_CLK_DIV_13, /*!< specifies the PLLDIVCFG clock division factor as 13 */
  121. RCM_CLK_DIV_14, /*!< specifies the PLLDIVCFG clock division factor as 14 */
  122. RCM_CLK_DIV_15, /*!< specifies the PLLDIVCFG clock division factor as 15 */
  123. RCM_CLK_DIV_16, /*!< specifies the PLLDIVCFG clock division factor as 16 */
  124. } RCM_CLK_DIV_T;
  125. /**
  126. * @brief Clock output control
  127. */
  128. typedef enum
  129. {
  130. RCM_COC_NO_CLOCK, /*!< No clock selected */
  131. RCM_COC_HSI14, /*!< HSI14 oscillator clock selected */
  132. RCM_COC_LSI, /*!< LSI oscillator clock selected */
  133. RCM_COC_LSE, /*!< LSE oscillator clock selected */
  134. RCM_COC_SYSCLK, /*!< System clock selected */
  135. RCM_COC_HSI, /*!< HSI oscillator clock selected */
  136. RCM_COC_HSE, /*!< HSE oscillator clock selected */
  137. RCM_COC_PLLCLK_DIV_2, /*!< PLL clock divided by 2 selected */
  138. RCM_COC_HSI48, /*!< HSI48 oscillator clock selected, only for APM32F072 and APM32F091 devices */
  139. RCM_COC_PLLCLK /*!< PLL clock selected */
  140. } RCM_COCCLK_T;
  141. /**
  142. * @brief Clock output division
  143. */
  144. typedef enum
  145. {
  146. RCM_COC_DIV_1, /*!< MCOSEL clock is divided by 1 */
  147. RCM_COC_DIV_2, /*!< MCOSEL clock is divided by 2 */
  148. RCM_COC_DIV_4, /*!< MCOSEL clock is divided by 4 */
  149. RCM_COC_DIV_8, /*!< MCOSEL clock is divided by 8 */
  150. RCM_COC_DIV_16, /*!< MCOSEL clock is divided by 16 */
  151. RCM_COC_DIV_32, /*!< MCOSEL clock is divided by 32 */
  152. RCM_COC_DIV_64, /*!< MCOSEL clock is divided by 64 */
  153. RCM_COC_DIV_128, /*!< MCOSEL clock is divided by 128 */
  154. } RCM_COCPRE_T;
  155. /**
  156. * @brief System clock select
  157. */
  158. typedef enum
  159. {
  160. RCM_SYSCLK_SEL_HSI, /*!< HSI selected as system clock source */
  161. RCM_SYSCLK_SEL_HSE, /*!< HSE selected as system clock source */
  162. RCM_SYSCLK_SEL_PLL, /*!< PLL selected as system clock source */
  163. RCM_SYSCLK_SEL_HSI48, /*!< HSI48 selected as system clock source, only for APM32F072 and APM32F091 devices */
  164. } RCM_SYSCLK_SEL_T;
  165. /**
  166. * @brief AHB divider Number
  167. */
  168. typedef enum
  169. {
  170. RCM_SYSCLK_DIV_1 = 7, /*!< AHB clock = SYSCLK */
  171. RCM_SYSCLK_DIV_2, /*!< AHB clock = SYSCLK/2 */
  172. RCM_SYSCLK_DIV_4, /*!< AHB clock = SYSCLK/4 */
  173. RCM_SYSCLK_DIV_8, /*!< AHB clock = SYSCLK/8 */
  174. RCM_SYSCLK_DIV_16, /*!< AHB clock = SYSCLK/16 */
  175. RCM_SYSCLK_DIV_64, /*!< AHB clock = SYSCLK/64 */
  176. RCM_SYSCLK_DIV_128, /*!< AHB clock = SYSCLK/128 */
  177. RCM_SYSCLK_DIV_256, /*!< AHB clock = SYSCLK/256 */
  178. RCM_SYSCLK_DIV_512, /*!< AHB clock = SYSCLK/512 */
  179. } RCM_AHBDIV_T;
  180. /**
  181. * @brief APB divider Number
  182. */
  183. typedef enum
  184. {
  185. RCM_HCLK_DIV_1 = 3, /*!< APB clock = HCLK */
  186. RCM_HCLK_DIV_2, /*!< APB clock = HCLK/2 */
  187. RCM_HCLK_DIV_4, /*!< APB clock = HCLK/4 */
  188. RCM_HCLK_DIV_8, /*!< APB clock = HCLK/8 */
  189. RCM_HCLK_DIV_16 /*!< APB clock = HCLK/16 */
  190. } RCM_APBDIV_T;
  191. /**
  192. * @brief CEC divider Number
  193. */
  194. typedef enum
  195. {
  196. RCM_CECCLK_HSI_DIV_224, /*!< CEC clock = HSI/244 (32768Hz) */
  197. RCM_CECCLK_LSI_DIV, /*!< CEC clock = LSI */
  198. } RCM_CECCLK_T;
  199. /**
  200. * @brief I2C clock source selectio
  201. */
  202. typedef enum
  203. {
  204. RCM_I2C1CLK_HSI, /*!< I2C1 clock = HSI */
  205. RCM_I2C1CLK_SYSCLK, /*!< I2C1 clock = System Clock */
  206. } RCM_I2CCLK_T;
  207. /**
  208. * @brief USART clock source selectio
  209. */
  210. typedef enum
  211. {
  212. RCM_USART1CLK_PCLK = ((uint32_t)0x00010000), /*!< USART1 clock = APB Clock (PCLK) */
  213. RCM_USART1CLK_SYSCLK = ((uint32_t)0x00010001), /*!< USART1 clock = System Clock */
  214. RCM_USART1CLK_LSE = ((uint32_t)0x00010002), /*!< USART1 clock = LSE Clock */
  215. RCM_USART1CLK_HSI = ((uint32_t)0x00010003), /*!< USART1 clock = HSI Clock */
  216. RCM_USART2CLK_PCLK = ((uint32_t)0x00020000), /*!< USART2 clock = APB Clock (PCLK), only for APM32F072 and APM32F091 devices */
  217. RCM_USART2CLK_SYSCLK = ((uint32_t)0x00020001), /*!< USART2 clock = System Clock, only for APM32F072 and APM32F091 devices */
  218. RCM_USART2CLK_LSE = ((uint32_t)0x00020002), /*!< USART2 clock = LSE Clock, only for APM32F072 and APM32F091 devices */
  219. RCM_USART2CLK_HSI = ((uint32_t)0x00020003), /*!< USART2 clock = HSI Clock, only for APM32F072 and APM32F091 devices */
  220. RCM_USART3CLK_PCLK = ((uint32_t)0x00040000), /*!< USART3 clock = APB Clock (PCLK), only for APM32F091 devices */
  221. RCM_USART3CLK_SYSCLK = ((uint32_t)0x00040001), /*!< USART3 clock = System Clock, only for APM32F091 devices */
  222. RCM_USART3CLK_LSE = ((uint32_t)0x00040002), /*!< USART3 clock = LSE Clock, only for APM32F091 devices */
  223. RCM_USART3CLK_HSI = ((uint32_t)0x00040003), /*!< USART3 clock = HSI Clock, only for APM32F091 devices */
  224. } RCM_USARTCLK_T;
  225. /**
  226. * @brief USB clock source selection
  227. */
  228. typedef enum
  229. {
  230. RCM_USBCLK_HSI48, /*!<hsi48 selected as USB clock, only for APM32F072 devices */
  231. RCM_USBCLK_PLLCLK, /*!<PLL clock selected as USB clock, only for APM32F072 devices */
  232. } RCM_USBCLK_T;
  233. /**
  234. * @brief RTC clock select
  235. */
  236. typedef enum
  237. {
  238. RCM_RTCCLK_LSE = 0X01, /*!< LSE selected as RTC clock */
  239. RCM_RTCCLK_LSI, /*!< LSI selected as RTC clock */
  240. RCM_RTCCLK_HSE_DIV_32 /*!< HSE divided by 32 selected as RTC clock */
  241. } RCM_RTCCLK_T;
  242. /**
  243. * @brief AHB peripheral
  244. */
  245. typedef enum
  246. {
  247. RCM_AHB_PERIPH_DMA1 = BIT0, /*!< DMA1 peripheral clock */
  248. RCM_AHB_PERIPH_DMA2 = BIT1, /*!< DMA2 peripheral clock */
  249. RCM_AHB_PERIPH_SRAM = BIT2, /*!< SRAM peripheral clock */
  250. RCM_AHB_PERIPH_FPU = BIT4, /*!< FMC peripheral clock */
  251. RCM_AHB_PERIPH_CRC = BIT6, /*!< CRC peripheral clock */
  252. RCM_AHB_PERIPH_GPIOA = BIT17, /*!< GPIOA peripheral clock */
  253. RCM_AHB_PERIPH_GPIOB = BIT18, /*!< GPIOB peripheral clock */
  254. RCM_AHB_PERIPH_GPIOC = BIT19, /*!< GPIOC peripheral clock */
  255. RCM_AHB_PERIPH_GPIOD = BIT20, /*!< GPIOD peripheral clock */
  256. RCM_AHB_PERIPH_GPIOE = BIT21, /*!< GPIOE peripheral clock, only for APM32F072 and APM32F091 devices */
  257. RCM_AHB_PERIPH_GPIOF = BIT22, /*!< GPIOF peripheral clock */
  258. RCM_AHB_PERIPH_TSC = BIT24, /*!< TSC peripheral clock */
  259. } RCM_AHB_PERIPH_T;
  260. /**
  261. * @brief AHB2 peripheral
  262. */
  263. typedef enum
  264. {
  265. RCM_APB2_PERIPH_SYSCFG = BIT0, /*!< SYSCFG peripheral clock */
  266. RCM_APB2_PERIPH_USART6 = BIT5, /*!< USART6 peripheral clock */
  267. RCM_APB2_PERIPH_USART7 = BIT6, /*!< USART7 peripheral clock */
  268. RCM_APB2_PERIPH_USART8 = BIT7, /*!< USART8 peripheral clock */
  269. RCM_APB2_PERIPH_ADC1 = BIT9, /*!< ADC1 peripheral clock */
  270. RCM_APB2_PERIPH_TMR1 = BIT11, /*!< TMR1 peripheral clock */
  271. RCM_APB2_PERIPH_SPI1 = BIT12, /*!< SPI1 peripheral clock */
  272. RCM_APB2_PERIPH_USART1 = BIT14, /*!< USART1 peripheral clock */
  273. RCM_APB2_PERIPH_TMR15 = BIT16, /*!< TMR15 peripheral clock */
  274. RCM_APB2_PERIPH_TMR16 = BIT17, /*!< TMR16 peripheral clock */
  275. RCM_APB2_PERIPH_TMR17 = BIT18, /*!< TMR17 peripheral clock */
  276. RCM_APB2_PERIPH_DBGMCU = BIT22, /*!< DBGMCU peripheral clock */
  277. } RCM_APB2_PERIPH_T;
  278. /**
  279. * @brief AHB1 peripheral
  280. */
  281. typedef enum
  282. {
  283. RCM_APB1_PERIPH_TMR2 = BIT0, /*!< TMR2 peripheral clock, only for APM32F072 and APM32F091 devices */
  284. RCM_APB1_PERIPH_TMR3 = BIT1, /*!< TMR3 peripheral clock */
  285. RCM_APB1_PERIPH_TMR6 = BIT4, /*!< TMR6 peripheral clock */
  286. RCM_APB1_PERIPH_TMR7 = BIT5, /*!< TMR7 peripheral clock, only for APM32F072 and APM32F091 devices */
  287. RCM_APB1_PERIPH_TMR14 = BIT8, /*!< TMR14 peripheral clock */
  288. RCM_APB1_PERIPH_WWDT = BIT11, /*!< WWDT peripheral clock */
  289. RCM_APB1_PERIPH_SPI2 = BIT14, /*!< SPI2 peripheral clock */
  290. RCM_APB1_PERIPH_USART2 = BIT17, /*!< USART2 peripheral clock */
  291. RCM_APB1_PERIPH_USART3 = BIT18, /*!< USART3 peripheral clock, only for APM32F072 and APM32F091 devices */
  292. RCM_APB1_PERIPH_USART4 = BIT19, /*!< USART4 peripheral clock, only for APM32F072 and APM32F091 devices */
  293. RCM_APB1_PERIPH_USART5 = BIT20, /*!< USART5 peripheral clock, only for APM32F091 devices */
  294. RCM_APB1_PERIPH_I2C1 = BIT21, /*!< I2C1 peripheral clock */
  295. RCM_APB1_PERIPH_I2C2 = BIT22, /*!< I2C2 peripheral clock */
  296. RCM_APB1_PERIPH_USB = BIT23, /*!< USB peripheral clock only for APM32F072 devices */
  297. RCM_APB1_PERIPH_CAN = BIT25, /*!< CAN peripheral clock, only for APM32F072 and APM32F091 devices */
  298. RCM_APB1_PERIPH_CRS = BIT27, /*!< CRS peripheral clock, only for APM32F072 and APM32F091 devices */
  299. RCM_APB1_PERIPH_PMU = BIT28, /*!< PMU peripheral clock */
  300. RCM_APB1_PERIPH_DAC = BIT29, /*!< DAC peripheral clock, only for APM32F072 and APM32F091 devices */
  301. RCM_APB1_PERIPH_CEC = BIT30, /*!< CEC peripheral clock, only for APM32F072 and APM32F091 devices */
  302. } RCM_APB1_PERIPH_T;
  303. /**
  304. * @brief RCM Interrupt Source
  305. */
  306. typedef enum
  307. {
  308. RCM_INT_LSIRDY = BIT0, /*!< LSI ready interrupt */
  309. RCM_INT_LSERDY = BIT1, /*!< LSE ready interrupt */
  310. RCM_INT_HSIRDY = BIT2, /*!< HSI ready interrupt */
  311. RCM_INT_HSERDY = BIT3, /*!< HSE ready interrupt */
  312. RCM_INT_PLLRDY = BIT4, /*!< PLL ready interrupt */
  313. RCM_INT_HSI14RDY = BIT5, /*!< HSI14 ready interrupt */
  314. RCM_INT_HSI48RDY = BIT6, /*!< HSI48 ready interrupt (Only for APM32F072 and APM32F091 devices) */
  315. RCM_INT_CSS = BIT7 /*!< Clock security system interrupt */
  316. } RCM_INT_T;
  317. /**
  318. * @brief RCM FLAG define
  319. */
  320. typedef enum
  321. {
  322. RCM_FLAG_HSIRDY = 0x001, /*!< HSI Ready Flag */
  323. RCM_FLAG_HSERDY = 0x011, /*!< HSE Ready Flag */
  324. RCM_FLAG_PLLRDY = 0x019, /*!< PLL Ready Flag */
  325. RCM_FLAG_LSERDY = 0x101, /*!< LSE Ready Flag */
  326. RCM_FLAG_LSIRDY = 0x201, /*!< LSI Ready Flag */
  327. RCM_FLAG_V18PRRST = 0x217, /*!< Software reset flag */
  328. RCM_FLAG_OBRST = 0x219, /*!< Option byte loader reset flag */
  329. RCM_FLAG_PINRST = 0x21A, /*!< PIN reset flag */
  330. RCM_FLAG_PWRRST = 0x21B, /*!< POR/PDR reset flag */
  331. RCM_FLAG_SWRST = 0x21C, /*!< Software reset flag */
  332. RCM_FLAG_IWDTRST = 0x21D, /*!< Independent watchdog reset flag */
  333. RCM_FLAG_WWDTRST = 0x21E, /*!< Window watchdog reset flag */
  334. RCM_FLAG_LPRRST = 0x21F, /*!< Low-power reset flag */
  335. RCM_FLAG_HSI14RDY = 0x301, /*!< HSI14 Ready Flag */
  336. RCM_FLAG_HSI48RDY = 0x311, /*!< HSI48 Ready Flag (Only for APM32F072 devices and APM32F091 devices) */
  337. } RCM_FLAG_T;
  338. /**@} end of group RCM_Enumerations*/
  339. /** @defgroup RCM_Structures Structures
  340. @{
  341. */
  342. /**@} end of group RCM_Structures*/
  343. /** @defgroup RCM_Variables Variables
  344. @{
  345. */
  346. /**@} end of group RCM_Variables*/
  347. /** @defgroup RCM_Fuctions Fuctions
  348. @{
  349. */
  350. /** Function description */
  351. void RCM_Reset(void);
  352. void RCM_ConfigHSE(RCM_HSE_T state);
  353. uint8_t RCM_WaitHSEReady(void);
  354. void RCM_SetHSITrim(uint8_t HSITrim);
  355. void RCM_EnableHSI(void);
  356. void RCM_DisableHSI(void);
  357. void RCM_SetHSI14Trim(uint8_t HSI14Trim);
  358. void RCM_EnableHSI14(void);
  359. void RCM_DisableHSI14(void);
  360. void RCM_EnableHSI14ADC(void);
  361. void RCM_DisableHSI14ADC(void);
  362. void RCM_ConfigLSE(RCM_LSE_T state);
  363. void RCM_ConfigDriveLSE(RCM_LSE_DRIVE_T state);
  364. void RCM_EnableLSI(void);
  365. void RCM_DisableLSI(void);
  366. void RCM_ConfigPLL(RCM_PLL_SEL_T pllSelect, RCM_PLLMF_T pllMf);
  367. void RCM_EnablePLL(void);
  368. void RCM_DisablePLL(void);
  369. void RCM_EnableHSI48(void); /*!< Only for APM32F072 and APM32F091 devices */
  370. void RCM_DisableHSI48(void); /*!< Only for APM32F072 and APM32F091 devices */
  371. uint32_t RCM_ReadHSI48CalibrationValue(void); /*!< Only for APM32F072 and APM32F091 devices */
  372. void RCM_ConfigCLKDIV(RCM_CLK_DIV_T state);
  373. void RCM_EnableCCS(void);
  374. void RCM_DisableCCS(void);
  375. #if defined (APM32F030) || defined (APM32F051)
  376. void RCM_ConfigCOC(RCM_COCCLK_T cocClock);
  377. #else
  378. void RCM_ConfigCOC(RCM_COCCLK_T cocClock, RCM_COCPRE_T divided);
  379. #endif
  380. void RCM_ConfigSYSCLK(RCM_SYSCLK_SEL_T sysClkSelect);
  381. RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void);
  382. void RCM_ConfigAHB(RCM_AHBDIV_T AHBDiv);
  383. void RCM_ConfigAPB(RCM_APBDIV_T APBDiv);
  384. void RCM_ConfigCECCLK(RCM_CECCLK_T CECClk);
  385. void RCM_ConfigI2CCLK(RCM_I2CCLK_T I2CCLk);
  386. void RCM_ConfigUSARTCLK(RCM_USARTCLK_T USARTClk);
  387. void RCM_ConfigUSBCLK(RCM_USBCLK_T USBClk); /*!< Only for APM32F072 devices */
  388. uint32_t RCM_ReadSYSCLKFreq(void);
  389. uint32_t RCM_ReadHCLKFreq(void);
  390. uint32_t RCM_ReadPCLKFreq(void);
  391. uint32_t RCM_ReadADCCLKFreq(void);
  392. uint32_t RCM_ReadCECCLKFreq(void);
  393. uint32_t RCM_ReadI2C1CLKFreq(void);
  394. uint32_t RCM_ReadUSART1CLKFreq(void);
  395. uint32_t RCM_ReadUSART2CLKFreq(void);
  396. uint32_t RCM_ReadUSBCLKFreq(void);
  397. void RCM_ConfigRTCCLK(RCM_RTCCLK_T RTCClk);
  398. void RCM_EnableRTCCLK(void);
  399. void RCM_DisableRTCCLK(void);
  400. void RCM_EnableBackupReset(void);
  401. void RCM_DisableBackupReset(void);
  402. void RCM_EnableAHBPeriphClock(uint32_t AHBPeriph);
  403. void RCM_DisableAHBPeriphClock(uint32_t AHBPeriph);
  404. void RCM_EnableAPB2PeriphClock(uint32_t APB2Periph);
  405. void RCM_DisableAPB2PeriphClock(uint32_t APB2Periph);
  406. void RCM_EnableAPB1PeriphClock(uint32_t APB1Periph);
  407. void RCM_DisableAPB1PeriphClock(uint32_t APB1Periph);
  408. void RCM_EnableAHBPeriphReset(uint32_t AHBPeriph);
  409. void RCM_DisableAHBPeriphReset(uint32_t AHBPeriph);
  410. void RCM_EnableAPB1PeriphReset(uint32_t APB1Periph);
  411. void RCM_DisableAPB1PeriphReset(uint32_t APB1Periph);
  412. void RCM_EnableAPB2PeriphReset(uint32_t APB2Periph);
  413. void RCM_DisableAPB2PeriphReset(uint32_t APB2Periph);
  414. void RCM_EnableInterrupt(uint8_t interrupt);
  415. void RCM_DisableInterrupt(uint8_t interrupt);
  416. uint16_t RCM_ReadStatusFlag(RCM_FLAG_T flag);
  417. void RCM_ClearStatusFlag(void);
  418. uint8_t RCM_ReadIntFlag(RCM_INT_T flag);
  419. void RCM_ClearIntFlag(uint8_t flag);
  420. #ifdef __cplusplus
  421. }
  422. #endif
  423. #endif /* __APM32F0XX_RCM_H */
  424. /**@} end of group RCM_Functions*/
  425. /**@} end of group RCM_Driver*/
  426. /**@} end of group APM32F0xx_StdPeriphDriver*/