py32f0xx_ll_bus.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /**
  2. ******************************************************************************
  3. * @file py32f0xx_ll_bus.h
  4. * @author MCU Application Team
  5. * @brief Header file of BUS LL module.
  6. @verbatim
  7. ##### RCC Limitations #####
  8. ==============================================================================
  9. [..]
  10. A delay between an RCC peripheral clock enable and the effective peripheral
  11. enabling should be taken into account in order to manage the peripheral read/write
  12. from/to registers.
  13. (+) This delay depends on the peripheral mapping.
  14. (++) AHB & APB1 peripherals, 1 dummy read is necessary
  15. [..]
  16. Workarounds:
  17. (#) For AHB & APB1 peripherals, a dummy read to the peripheral register has been
  18. inserted in each LL_{BUS}_GRP{x}_EnableClock() function.
  19. @endverbatim
  20. ******************************************************************************
  21. * @attention
  22. *
  23. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  24. * All rights reserved.</center></h2>
  25. *
  26. * This software component is licensed by Puya under BSD 3-Clause license,
  27. * the "License"; You may not use this file except in compliance with the
  28. * License. You may obtain a copy of the License at:
  29. * opensource.org/licenses/BSD-3-Clause
  30. *
  31. ******************************************************************************
  32. * @attention
  33. *
  34. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  35. * All rights reserved.</center></h2>
  36. *
  37. * This software component is licensed by ST under BSD 3-Clause license,
  38. * the "License"; You may not use this file except in compliance with the
  39. * License. You may obtain a copy of the License at:
  40. * opensource.org/licenses/BSD-3-Clause
  41. *
  42. ******************************************************************************
  43. */
  44. /* Define to prevent recursive inclusion -------------------------------------*/
  45. #ifndef PY32F0XX_LL_BUS_H
  46. #define PY32F0XX_LL_BUS_H
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. /* Includes ------------------------------------------------------------------*/
  51. #include "py32f0xx.h"
  52. /** @addtogroup PY32F0xx_LL_Driver
  53. * @{
  54. */
  55. #if defined(RCC)
  56. /** @defgroup BUS_LL BUS
  57. * @{
  58. */
  59. /* Private types -------------------------------------------------------------*/
  60. /* Private variables ---------------------------------------------------------*/
  61. /* Private constants ---------------------------------------------------------*/
  62. /* Private macros ------------------------------------------------------------*/
  63. /* Exported types ------------------------------------------------------------*/
  64. /* Exported constants --------------------------------------------------------*/
  65. /** @defgroup BUS_LL_Exported_Constants BUS Exported Constants
  66. * @{
  67. */
  68. /** @defgroup BUS_LL_EC_AHB1_GRP1_PERIPH AHB1 GRP1 PERIPH
  69. * @{
  70. */
  71. #define LL_AHB1_GRP1_PERIPH_ALL 0xFFFFFFFFU
  72. #if (defined(DMA) || defined(DMA1))
  73. #define LL_AHB1_GRP1_PERIPH_DMA1 RCC_AHBENR_DMAEN
  74. #endif
  75. #define LL_AHB1_GRP1_PERIPH_FLASH RCC_AHBENR_FLASHEN
  76. #define LL_AHB1_GRP1_PERIPH_SRAM RCC_AHBENR_SRAMEN
  77. #define LL_AHB1_GRP1_PERIPH_CRC RCC_AHBENR_CRCEN
  78. /**
  79. * @}
  80. */
  81. /** @defgroup BUS_LL_EC_APB1_GRP1_PERIPH APB1 GRP1 PERIPH
  82. * @{
  83. */
  84. #define LL_APB1_GRP1_PERIPH_ALL 0xFFFFFFFFU
  85. #if defined(TIM3)
  86. #define LL_APB1_GRP1_PERIPH_TIM3 RCC_APBENR1_TIM3EN
  87. #endif
  88. #if defined(RTC)
  89. #define LL_APB1_GRP1_PERIPH_RTC RCC_APBENR1_RTCAPBEN
  90. #endif
  91. #if defined(WWDG)
  92. #define LL_APB1_GRP1_PERIPH_WWDG RCC_APBENR1_WWDGEN
  93. #endif
  94. #if defined(SPI2)
  95. #define LL_APB1_GRP1_PERIPH_SPI2 RCC_APBENR1_SPI2EN
  96. #endif
  97. #if defined(USART2)
  98. #define LL_APB1_GRP1_PERIPH_USART2 RCC_APBENR1_USART2EN
  99. #endif
  100. #define LL_APB1_GRP1_PERIPH_I2C1 RCC_APBENR1_I2CEN
  101. #define LL_APB1_GRP1_PERIPH_DBGMCU RCC_APBENR1_DBGEN
  102. #define LL_APB1_GRP1_PERIPH_PWR RCC_APBENR1_PWREN
  103. #define LL_APB1_GRP1_PERIPH_LPTIM1 RCC_APBENR1_LPTIMEN
  104. /**
  105. * @}
  106. */
  107. /** @defgroup BUS_LL_EC_APB1_GRP2_PERIPH APB1 GRP2 PERIPH
  108. * @{
  109. */
  110. #define LL_APB1_GRP2_PERIPH_ALL 0xFFFFFFFFU
  111. #define LL_APB1_GRP2_PERIPH_SYSCFG RCC_APBENR2_SYSCFGEN
  112. #define LL_APB1_GRP2_PERIPH_TIM1 RCC_APBENR2_TIM1EN
  113. #define LL_APB1_GRP2_PERIPH_SPI1 RCC_APBENR2_SPI1EN
  114. #define LL_APB1_GRP2_PERIPH_USART1 RCC_APBENR2_USART1EN
  115. #if defined(TIM14)
  116. #define LL_APB1_GRP2_PERIPH_TIM14 RCC_APBENR2_TIM14EN
  117. #endif
  118. #define LL_APB1_GRP2_PERIPH_TIM16 RCC_APBENR2_TIM16EN
  119. #if defined(TIM17)
  120. #define LL_APB1_GRP2_PERIPH_TIM17 RCC_APBENR2_TIM17EN
  121. #endif
  122. #define LL_APB1_GRP2_PERIPH_ADC1 RCC_APBENR2_ADCEN
  123. #if defined(COMP1)
  124. #define LL_APB1_GRP2_PERIPH_COMP1 RCC_APBENR2_COMP1EN
  125. #endif
  126. #if defined(COMP2)
  127. #define LL_APB1_GRP2_PERIPH_COMP2 RCC_APBENR2_COMP2EN
  128. #endif
  129. #if defined(LED)
  130. #define LL_APB1_GRP2_PERIPH_LED RCC_APBENR2_LEDEN
  131. #endif
  132. /**
  133. * @}
  134. */
  135. /** @defgroup BUS_LL_EC_IOP_GRP1_PERIPH IOP GRP1 PERIPH
  136. * @{
  137. */
  138. #define LL_IOP_GRP1_PERIPH_ALL 0xFFFFFFFFU
  139. #define LL_IOP_GRP1_PERIPH_GPIOA RCC_IOPENR_GPIOAEN
  140. #define LL_IOP_GRP1_PERIPH_GPIOB RCC_IOPENR_GPIOBEN
  141. #define LL_IOP_GRP1_PERIPH_GPIOF RCC_IOPENR_GPIOFEN
  142. /**
  143. * @}
  144. */
  145. /**
  146. * @}
  147. */
  148. /* Exported macro ------------------------------------------------------------*/
  149. /* Exported functions --------------------------------------------------------*/
  150. /** @defgroup BUS_LL_Exported_Functions BUS Exported Functions
  151. * @{
  152. */
  153. /** @defgroup BUS_LL_EF_AHB1 AHB1
  154. * @{
  155. */
  156. /**
  157. * @brief Enable AHB1 peripherals clock.
  158. * @param Periphs This parameter can be a combination of the following values:
  159. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  160. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  161. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  162. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  163. * @note Depending on devices and packages, some peripherals may not be available.
  164. * Refer to device datasheet for peripherals availability.
  165. * @retval None
  166. */
  167. __STATIC_INLINE void LL_AHB1_GRP1_EnableClock(uint32_t Periphs)
  168. {
  169. __IO uint32_t tmpreg;
  170. SET_BIT(RCC->AHBENR, Periphs);
  171. /* Delay after an RCC peripheral clock enabling */
  172. tmpreg = READ_BIT(RCC->AHBENR, Periphs);
  173. (void)tmpreg;
  174. }
  175. /**
  176. * @brief Check if AHB1 peripheral clock is enabled or not
  177. * @param Periphs This parameter can be a combination of the following values:
  178. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  179. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  180. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  181. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  182. * @note Depending on devices and packages, some peripherals may not be available.
  183. * Refer to device datasheet for peripherals availability.
  184. * @retval State of Periphs (1 or 0).
  185. */
  186. __STATIC_INLINE uint32_t LL_AHB1_GRP1_IsEnabledClock(uint32_t Periphs)
  187. {
  188. return ((READ_BIT(RCC->AHBENR, Periphs) == Periphs) ? 1UL : 0UL);
  189. }
  190. /**
  191. * @brief Disable AHB1 peripherals clock.
  192. * @param Periphs This parameter can be a combination of the following values:
  193. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  194. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  195. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  196. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  197. * @note Depending on devices and packages, some peripherals may not be available.
  198. * Refer to device datasheet for peripherals availability.
  199. * @retval None
  200. */
  201. __STATIC_INLINE void LL_AHB1_GRP1_DisableClock(uint32_t Periphs)
  202. {
  203. CLEAR_BIT(RCC->AHBENR, Periphs);
  204. }
  205. /**
  206. * @brief Force AHB1 peripherals reset.
  207. * @param Periphs This parameter can be a combination of the following values:
  208. * @arg @ref LL_AHB1_GRP1_PERIPH_ALL
  209. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  210. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  211. * @note Depending on devices and packages, some peripherals may not be available.
  212. * Refer to device datasheet for peripherals availability.
  213. * @retval None
  214. */
  215. __STATIC_INLINE void LL_AHB1_GRP1_ForceReset(uint32_t Periphs)
  216. {
  217. SET_BIT(RCC->AHBRSTR, Periphs);
  218. }
  219. /**
  220. * @brief Release AHB1 peripherals reset.
  221. * @param Periphs This parameter can be a combination of the following values:
  222. * @arg @ref LL_AHB1_GRP1_PERIPH_ALL
  223. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  224. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  225. * @note Depending on devices and packages, some peripherals may not be available.
  226. * Refer to device datasheet for peripherals availability.
  227. * @retval None
  228. */
  229. __STATIC_INLINE void LL_AHB1_GRP1_ReleaseReset(uint32_t Periphs)
  230. {
  231. CLEAR_BIT(RCC->AHBRSTR, Periphs);
  232. }
  233. /**
  234. * @}
  235. */
  236. /** @defgroup BUS_LL_EF_APB1_GRP1 APB1 GRP1
  237. * @{
  238. */
  239. /**
  240. * @brief Enable APB1 GRP1 peripherals clock.
  241. * @param Periphs This parameter can be a combination of the following values:
  242. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  243. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  244. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  245. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  246. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  247. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  248. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  249. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  250. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1
  251. * @note Depending on devices and packages, some peripherals may not be available.
  252. * Refer to device datasheet for peripherals availability.
  253. * @retval None
  254. */
  255. __STATIC_INLINE void LL_APB1_GRP1_EnableClock(uint32_t Periphs)
  256. {
  257. __IO uint32_t tmpreg;
  258. SET_BIT(RCC->APBENR1, Periphs);
  259. /* Delay after an RCC peripheral clock enabling */
  260. tmpreg = READ_BIT(RCC->APBENR1, Periphs);
  261. (void)tmpreg;
  262. }
  263. /**
  264. * @brief Check if APB1 GRP1 peripheral clock is enabled or not
  265. * @param Periphs This parameter can be a combination of the following values:
  266. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  267. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  268. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  269. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  270. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  271. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  272. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  273. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  274. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1
  275. * @note Depending on devices and packages, some peripherals may not be available.
  276. * Refer to device datasheet for peripherals availability.
  277. * @retval State of Periphs (1 or 0).
  278. */
  279. __STATIC_INLINE uint32_t LL_APB1_GRP1_IsEnabledClock(uint32_t Periphs)
  280. {
  281. return ((READ_BIT(RCC->APBENR1, Periphs) == (Periphs)) ? 1UL : 0UL);
  282. }
  283. /**
  284. * @brief Disable APB1 GRP1 peripherals clock.
  285. * @param Periphs This parameter can be a combination of the following values:
  286. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  287. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  288. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  289. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  290. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  291. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  292. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  293. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  294. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1
  295. * @note Depending on devices and packages, some peripherals may not be available.
  296. * Refer to device datasheet for peripherals availability.
  297. * @retval None
  298. */
  299. __STATIC_INLINE void LL_APB1_GRP1_DisableClock(uint32_t Periphs)
  300. {
  301. CLEAR_BIT(RCC->APBENR1, Periphs);
  302. }
  303. /**
  304. * @brief Force APB1 GRP1 peripherals reset.
  305. * @param Periphs This parameter can be a combination of the following values:
  306. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  307. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  308. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  309. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  310. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  311. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  312. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1
  313. * @note Depending on devices and packages, some peripherals may not be available.
  314. * Refer to device datasheet for peripherals availability.
  315. * @retval None
  316. */
  317. __STATIC_INLINE void LL_APB1_GRP1_ForceReset(uint32_t Periphs)
  318. {
  319. SET_BIT(RCC->APBRSTR1, Periphs);
  320. }
  321. /**
  322. * @brief Release APB1 GRP1 peripherals reset.
  323. * @param Periphs This parameter can be a combination of the following values:
  324. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  325. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  326. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  327. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  328. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  329. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  330. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1
  331. * @note Depending on devices and packages, some peripherals may not be available.
  332. * Refer to device datasheet for peripherals availability.
  333. * @retval None
  334. */
  335. __STATIC_INLINE void LL_APB1_GRP1_ReleaseReset(uint32_t Periphs)
  336. {
  337. CLEAR_BIT(RCC->APBRSTR1, Periphs);
  338. }
  339. /**
  340. * @}
  341. */
  342. /** @defgroup BUS_LL_EF_APB1_GRP2 APB1 GRP2
  343. * @{
  344. */
  345. /**
  346. * @brief Enable APB1 GRP2 peripherals clock.
  347. * @param Periphs This parameter can be a combination of the following values:
  348. * @arg @ref LL_APB1_GRP2_PERIPH_SYSCFG
  349. * @arg @ref LL_APB1_GRP2_PERIPH_TIM1
  350. * @arg @ref LL_APB1_GRP2_PERIPH_SPI1
  351. * @arg @ref LL_APB1_GRP2_PERIPH_USART1
  352. * @arg @ref LL_APB1_GRP2_PERIPH_TIM14
  353. * @arg @ref LL_APB1_GRP2_PERIPH_TIM16
  354. * @arg @ref LL_APB1_GRP2_PERIPH_TIM17
  355. * @arg @ref LL_APB1_GRP2_PERIPH_ADC1
  356. * @arg @ref LL_APB1_GRP2_PERIPH_COMP1
  357. * @arg @ref LL_APB1_GRP2_PERIPH_COMP2
  358. * @arg @ref LL_APB1_GRP2_PERIPH_LED
  359. * @note Depending on devices and packages, some peripherals may not be available.
  360. * Refer to device datasheet for peripherals availability.
  361. * @retval None
  362. */
  363. __STATIC_INLINE void LL_APB1_GRP2_EnableClock(uint32_t Periphs)
  364. {
  365. __IO uint32_t tmpreg;
  366. SET_BIT(RCC->APBENR2, Periphs);
  367. /* Delay after an RCC peripheral clock enabling */
  368. tmpreg = READ_BIT(RCC->APBENR2, Periphs);
  369. (void)tmpreg;
  370. }
  371. /**
  372. * @brief Check if APB1 GRP2 peripheral clock is enabled or not
  373. * @param Periphs This parameter can be a combination of the following values:
  374. * @arg @ref LL_APB1_GRP2_PERIPH_SYSCFG
  375. * @arg @ref LL_APB1_GRP2_PERIPH_TIM1
  376. * @arg @ref LL_APB1_GRP2_PERIPH_SPI1
  377. * @arg @ref LL_APB1_GRP2_PERIPH_USART1
  378. * @arg @ref LL_APB1_GRP2_PERIPH_TIM14
  379. * @arg @ref LL_APB1_GRP2_PERIPH_TIM16
  380. * @arg @ref LL_APB1_GRP2_PERIPH_TIM17
  381. * @arg @ref LL_APB1_GRP2_PERIPH_ADC1
  382. * @arg @ref LL_APB1_GRP2_PERIPH_COMP1
  383. * @arg @ref LL_APB1_GRP2_PERIPH_COMP2
  384. * @arg @ref LL_APB1_GRP2_PERIPH_LED
  385. * @note Depending on devices and packages, some peripherals may not be available.
  386. * Refer to device datasheet for peripherals availability.
  387. * @retval State of Periphs (1 or 0).
  388. */
  389. __STATIC_INLINE uint32_t LL_APB1_GRP2_IsEnabledClock(uint32_t Periphs)
  390. {
  391. return ((READ_BIT(RCC->APBENR2, Periphs) == (Periphs)) ? 1UL : 0UL);
  392. }
  393. /**
  394. * @brief Disable APB1 GRP2 peripherals clock.
  395. * @param Periphs This parameter can be a combination of the following values:
  396. * @arg @ref LL_APB1_GRP2_PERIPH_SYSCFG
  397. * @arg @ref LL_APB1_GRP2_PERIPH_TIM1
  398. * @arg @ref LL_APB1_GRP2_PERIPH_SPI1
  399. * @arg @ref LL_APB1_GRP2_PERIPH_USART1
  400. * @arg @ref LL_APB1_GRP2_PERIPH_TIM14
  401. * @arg @ref LL_APB1_GRP2_PERIPH_TIM16
  402. * @arg @ref LL_APB1_GRP2_PERIPH_TIM17
  403. * @arg @ref LL_APB1_GRP2_PERIPH_ADC1
  404. * @arg @ref LL_APB1_GRP2_PERIPH_COMP1
  405. * @arg @ref LL_APB1_GRP2_PERIPH_COMP2
  406. * @arg @ref LL_APB1_GRP2_PERIPH_LED
  407. * @note Depending on devices and packages, some peripherals may not be available.
  408. * Refer to device datasheet for peripherals availability.
  409. * @retval None
  410. */
  411. __STATIC_INLINE void LL_APB1_GRP2_DisableClock(uint32_t Periphs)
  412. {
  413. CLEAR_BIT(RCC->APBENR2, Periphs);
  414. }
  415. /**
  416. * @brief Force APB1 GRP2 peripherals reset.
  417. * @param Periphs This parameter can be a combination of the following values:
  418. * @arg @ref LL_APB1_GRP2_PERIPH_ALL
  419. * @arg @ref LL_APB1_GRP2_PERIPH_SYSCFG
  420. * @arg @ref LL_APB1_GRP2_PERIPH_TIM1
  421. * @arg @ref LL_APB1_GRP2_PERIPH_SPI1
  422. * @arg @ref LL_APB1_GRP2_PERIPH_USART1
  423. * @arg @ref LL_APB1_GRP2_PERIPH_TIM14
  424. * @arg @ref LL_APB1_GRP2_PERIPH_TIM16
  425. * @arg @ref LL_APB1_GRP2_PERIPH_TIM17
  426. * @arg @ref LL_APB1_GRP2_PERIPH_ADC1
  427. * @arg @ref LL_APB1_GRP2_PERIPH_COMP1
  428. * @arg @ref LL_APB1_GRP2_PERIPH_COMP2
  429. * @arg @ref LL_APB1_GRP2_PERIPH_LED
  430. * @note Depending on devices and packages, some peripherals may not be available.
  431. * Refer to device datasheet for peripherals availability.
  432. * @retval None
  433. */
  434. __STATIC_INLINE void LL_APB1_GRP2_ForceReset(uint32_t Periphs)
  435. {
  436. SET_BIT(RCC->APBRSTR2, Periphs);
  437. }
  438. /**
  439. * @brief Release APB1 GRP2 peripherals reset.
  440. * @param Periphs This parameter can be a combination of the following values:
  441. * @arg @ref LL_APB1_GRP2_PERIPH_ALL
  442. * @arg @ref LL_APB1_GRP2_PERIPH_SYSCFG
  443. * @arg @ref LL_APB1_GRP2_PERIPH_TIM1
  444. * @arg @ref LL_APB1_GRP2_PERIPH_SPI1
  445. * @arg @ref LL_APB1_GRP2_PERIPH_USART1
  446. * @arg @ref LL_APB1_GRP2_PERIPH_TIM14
  447. * @arg @ref LL_APB1_GRP2_PERIPH_TIM16
  448. * @arg @ref LL_APB1_GRP2_PERIPH_TIM17
  449. * @arg @ref LL_APB1_GRP2_PERIPH_ADC1
  450. * @arg @ref LL_APB1_GRP2_PERIPH_COMP1
  451. * @arg @ref LL_APB1_GRP2_PERIPH_COMP2
  452. * @arg @ref LL_APB1_GRP2_PERIPH_LED
  453. * @note Depending on devices and packages, some peripherals may not be available.
  454. * Refer to device datasheet for peripherals availability.
  455. * @note (*) peripheral not available on all devices
  456. * @retval None
  457. */
  458. __STATIC_INLINE void LL_APB1_GRP2_ReleaseReset(uint32_t Periphs)
  459. {
  460. CLEAR_BIT(RCC->APBRSTR2, Periphs);
  461. }
  462. /**
  463. * @}
  464. */
  465. /** @defgroup BUS_LL_EF_IOP IOP
  466. * @{
  467. */
  468. /**
  469. * @brief Enable IOP peripherals clock.
  470. * @param Periphs This parameter can be a combination of the following values:
  471. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  472. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  473. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  474. * @retval None
  475. */
  476. __STATIC_INLINE void LL_IOP_GRP1_EnableClock(uint32_t Periphs)
  477. {
  478. __IO uint32_t tmpreg;
  479. SET_BIT(RCC->IOPENR, Periphs);
  480. /* Delay after an RCC peripheral clock enabling */
  481. tmpreg = READ_BIT(RCC->IOPENR, Periphs);
  482. (void)tmpreg;
  483. }
  484. /**
  485. * @brief Check if IOP peripheral clock is enabled or not
  486. * @param Periphs This parameter can be a combination of the following values:
  487. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  488. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  489. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  490. * @retval State of Periphs (1 or 0).
  491. */
  492. __STATIC_INLINE uint32_t LL_IOP_GRP1_IsEnabledClock(uint32_t Periphs)
  493. {
  494. return ((READ_BIT(RCC->IOPENR, Periphs) == Periphs) ? 1UL : 0UL);
  495. }
  496. /**
  497. * @brief Disable IOP peripherals clock.
  498. * @param Periphs This parameter can be a combination of the following values:
  499. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  500. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  501. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  502. * @retval None
  503. */
  504. __STATIC_INLINE void LL_IOP_GRP1_DisableClock(uint32_t Periphs)
  505. {
  506. CLEAR_BIT(RCC->IOPENR, Periphs);
  507. }
  508. /**
  509. * @brief Disable IOP peripherals clock.
  510. * @param Periphs This parameter can be a combination of the following values:
  511. * @arg @ref LL_IOP_GRP1_PERIPH_ALL
  512. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  513. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  514. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  515. * @retval None
  516. */
  517. __STATIC_INLINE void LL_IOP_GRP1_ForceReset(uint32_t Periphs)
  518. {
  519. SET_BIT(RCC->IOPRSTR, Periphs);
  520. }
  521. /**
  522. * @brief Release IOP peripherals reset.
  523. * @param Periphs This parameter can be a combination of the following values:
  524. * @arg @ref LL_IOP_GRP1_PERIPH_ALL
  525. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  526. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  527. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  528. * @retval None
  529. */
  530. __STATIC_INLINE void LL_IOP_GRP1_ReleaseReset(uint32_t Periphs)
  531. {
  532. CLEAR_BIT(RCC->IOPRSTR, Periphs);
  533. }
  534. /**
  535. * @}
  536. */
  537. /**
  538. * @}
  539. */
  540. /**
  541. * @}
  542. */
  543. #endif /* RCC */
  544. /**
  545. * @}
  546. */
  547. #ifdef __cplusplus
  548. }
  549. #endif
  550. #endif /* PY32F0XX_LL_BUS_H */
  551. /************************ (C) COPYRIGHT Puya *****END OF FILE****/