stm32g0xx_ll_bus.h 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_ll_bus.h
  4. * @author MCD 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 & APB peripherals, 1 dummy read is necessary
  15. [..]
  16. Workarounds:
  17. (#) For AHB & APB 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. * Copyright (c) 2018 STMicroelectronics.
  24. * All rights reserved.
  25. *
  26. * This software is licensed under terms that can be found in the LICENSE file in
  27. * the root directory of this software component.
  28. * If no LICENSE file comes with this software, it is provided AS-IS.
  29. ******************************************************************************
  30. */
  31. /* Define to prevent recursive inclusion -------------------------------------*/
  32. #ifndef STM32G0xx_LL_BUS_H
  33. #define STM32G0xx_LL_BUS_H
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /* Includes ------------------------------------------------------------------*/
  38. #include "stm32g0xx.h"
  39. /** @addtogroup STM32G0xx_LL_Driver
  40. * @{
  41. */
  42. #if defined(RCC)
  43. /** @defgroup BUS_LL BUS
  44. * @{
  45. */
  46. /* Private types -------------------------------------------------------------*/
  47. /* Private variables ---------------------------------------------------------*/
  48. /* Private constants ---------------------------------------------------------*/
  49. /* Private macros ------------------------------------------------------------*/
  50. /* Exported types ------------------------------------------------------------*/
  51. /* Exported constants --------------------------------------------------------*/
  52. /** @defgroup BUS_LL_Exported_Constants BUS Exported Constants
  53. * @{
  54. */
  55. /** @defgroup BUS_LL_EC_AHB1_GRP1_PERIPH AHB1 GRP1 PERIPH
  56. * @{
  57. */
  58. #define LL_AHB1_GRP1_PERIPH_ALL 0xFFFFFFFFU
  59. #define LL_AHB1_GRP1_PERIPH_DMA1 RCC_AHBENR_DMA1EN
  60. #if defined(DMA2)
  61. #define LL_AHB1_GRP1_PERIPH_DMA2 RCC_AHBENR_DMA2EN
  62. #endif /* DMA2 */
  63. #define LL_AHB1_GRP1_PERIPH_FLASH RCC_AHBENR_FLASHEN
  64. #define LL_AHB1_GRP1_PERIPH_SRAM RCC_AHBSMENR_SRAMSMEN
  65. #if defined(CRC)
  66. #define LL_AHB1_GRP1_PERIPH_CRC RCC_AHBENR_CRCEN
  67. #endif /* CRC */
  68. #if defined(AES)
  69. #define LL_AHB1_GRP1_PERIPH_CRYP RCC_AHBENR_AESEN
  70. #endif /* AES */
  71. #if defined(RNG)
  72. #define LL_AHB1_GRP1_PERIPH_RNG RCC_AHBENR_RNGEN
  73. #endif /* RNG */
  74. /**
  75. * @}
  76. */
  77. /** @defgroup BUS_LL_EC_APB1_GRP1_PERIPH APB1 GRP1 PERIPH
  78. * @{
  79. */
  80. #define LL_APB1_GRP1_PERIPH_ALL 0xFFFFFFFFU
  81. #if defined(TIM2)
  82. #define LL_APB1_GRP1_PERIPH_TIM2 RCC_APBENR1_TIM2EN
  83. #endif /* TIM2 */
  84. #if defined(TIM3)
  85. #define LL_APB1_GRP1_PERIPH_TIM3 RCC_APBENR1_TIM3EN
  86. #endif /* TIM3 */
  87. #if defined(TIM4)
  88. #define LL_APB1_GRP1_PERIPH_TIM4 RCC_APBENR1_TIM4EN
  89. #endif /* TIM4 */
  90. #if defined(TIM6)
  91. #define LL_APB1_GRP1_PERIPH_TIM6 RCC_APBENR1_TIM6EN
  92. #endif /* TIM6 */
  93. #if defined(TIM7)
  94. #define LL_APB1_GRP1_PERIPH_TIM7 RCC_APBENR1_TIM7EN
  95. #endif /* TIM7 */
  96. #if defined(LPUART2)
  97. #define LL_APB1_GRP1_PERIPH_LPUART2 RCC_APBENR1_LPUART2EN
  98. #endif /* LPUART2 */
  99. #if defined(USART5)
  100. #define LL_APB1_GRP1_PERIPH_USART5 RCC_APBENR1_USART5EN
  101. #endif /* USART5 */
  102. #if defined(USART6)
  103. #define LL_APB1_GRP1_PERIPH_USART6 RCC_APBENR1_USART6EN
  104. #endif /* USART6 */
  105. #define LL_APB1_GRP1_PERIPH_RTC RCC_APBENR1_RTCAPBEN
  106. #define LL_APB1_GRP1_PERIPH_WWDG RCC_APBENR1_WWDGEN
  107. #if defined(FDCAN1) || defined(FDCAN2)
  108. #define LL_APB1_GRP1_PERIPH_FDCAN RCC_APBENR1_FDCANEN
  109. #endif /* FDCAN1 */
  110. #if defined(USB_DRD_FS)
  111. #define LL_APB1_GRP1_PERIPH_USB RCC_APBENR1_USBEN
  112. #endif /* USB_DRD_FS */
  113. #define LL_APB1_GRP1_PERIPH_SPI2 RCC_APBENR1_SPI2EN
  114. #if defined(SPI3)
  115. #define LL_APB1_GRP1_PERIPH_SPI3 RCC_APBENR1_SPI3EN
  116. #endif /* SPI3 */
  117. #if defined(CRS)
  118. #define LL_APB1_GRP1_PERIPH_CRS RCC_APBENR1_CRSEN
  119. #endif /* CRS */
  120. #define LL_APB1_GRP1_PERIPH_USART2 RCC_APBENR1_USART2EN
  121. #if defined(USART3)
  122. #define LL_APB1_GRP1_PERIPH_USART3 RCC_APBENR1_USART3EN
  123. #endif /* USART3 */
  124. #if defined(USART4)
  125. #define LL_APB1_GRP1_PERIPH_USART4 RCC_APBENR1_USART4EN
  126. #endif /* USART4 */
  127. #if defined(LPUART1)
  128. #define LL_APB1_GRP1_PERIPH_LPUART1 RCC_APBENR1_LPUART1EN
  129. #endif /* LPUART1 */
  130. #define LL_APB1_GRP1_PERIPH_I2C1 RCC_APBENR1_I2C1EN
  131. #define LL_APB1_GRP1_PERIPH_I2C2 RCC_APBENR1_I2C2EN
  132. #if defined(I2C3)
  133. #define LL_APB1_GRP1_PERIPH_I2C3 RCC_APBENR1_I2C3EN
  134. #endif /* I2C3 */
  135. #if defined(CEC)
  136. #define LL_APB1_GRP1_PERIPH_CEC RCC_APBENR1_CECEN
  137. #endif /* CEC */
  138. #if defined(UCPD1)
  139. #define LL_APB1_GRP1_PERIPH_UCPD1 RCC_APBENR1_UCPD1EN
  140. #endif /* UCPD1 */
  141. #if defined(UCPD2)
  142. #define LL_APB1_GRP1_PERIPH_UCPD2 RCC_APBENR1_UCPD2EN
  143. #endif /* UCPD2 */
  144. #define LL_APB1_GRP1_PERIPH_DBGMCU RCC_APBENR1_DBGEN
  145. #define LL_APB1_GRP1_PERIPH_PWR RCC_APBENR1_PWREN
  146. #if defined(DAC1)
  147. #define LL_APB1_GRP1_PERIPH_DAC1 RCC_APBENR1_DAC1EN
  148. #endif /* DAC1 */
  149. #if defined(LPTIM2)
  150. #define LL_APB1_GRP1_PERIPH_LPTIM2 RCC_APBENR1_LPTIM2EN
  151. #endif /* LPTIM2 */
  152. #if defined(LPTIM1)
  153. #define LL_APB1_GRP1_PERIPH_LPTIM1 RCC_APBENR1_LPTIM1EN
  154. #endif /* LPTIM1 */
  155. /**
  156. * @}
  157. */
  158. /** @defgroup BUS_LL_EC_APB2_GRP1_PERIPH APB2 GRP1 PERIPH
  159. * @{
  160. */
  161. #define LL_APB2_GRP1_PERIPH_ALL 0xFFFFFFFFU
  162. #define LL_APB2_GRP1_PERIPH_SYSCFG RCC_APBENR2_SYSCFGEN
  163. #define LL_APB2_GRP1_PERIPH_TIM1 RCC_APBENR2_TIM1EN
  164. #define LL_APB2_GRP1_PERIPH_SPI1 RCC_APBENR2_SPI1EN
  165. #define LL_APB2_GRP1_PERIPH_USART1 RCC_APBENR2_USART1EN
  166. #if defined(TIM14)
  167. #define LL_APB2_GRP1_PERIPH_TIM14 RCC_APBENR2_TIM14EN
  168. #endif /* TIM14 */
  169. #if defined(TIM15)
  170. #define LL_APB2_GRP1_PERIPH_TIM15 RCC_APBENR2_TIM15EN
  171. #endif /* TIM15 */
  172. #if defined(TIM16)
  173. #define LL_APB2_GRP1_PERIPH_TIM16 RCC_APBENR2_TIM16EN
  174. #endif /* TIM16 */
  175. #if defined(TIM17)
  176. #define LL_APB2_GRP1_PERIPH_TIM17 RCC_APBENR2_TIM17EN
  177. #endif /* TIM17 */
  178. #if defined(ADC)
  179. #define LL_APB2_GRP1_PERIPH_ADC RCC_APBENR2_ADCEN
  180. #endif /* ADC */
  181. /**
  182. * @}
  183. */
  184. /** @defgroup BUS_LL_EC_IOP_GRP1_PERIPH IOP GRP1 PERIPH
  185. * @{
  186. */
  187. #define LL_IOP_GRP1_PERIPH_ALL 0xFFFFFFFFU
  188. #define LL_IOP_GRP1_PERIPH_GPIOA RCC_IOPENR_GPIOAEN
  189. #define LL_IOP_GRP1_PERIPH_GPIOB RCC_IOPENR_GPIOBEN
  190. #define LL_IOP_GRP1_PERIPH_GPIOC RCC_IOPENR_GPIOCEN
  191. #define LL_IOP_GRP1_PERIPH_GPIOD RCC_IOPENR_GPIODEN
  192. #if defined(GPIOE)
  193. #define LL_IOP_GRP1_PERIPH_GPIOE RCC_IOPENR_GPIOEEN
  194. #endif /* GPIOE */
  195. #if defined(GPIOF)
  196. #define LL_IOP_GRP1_PERIPH_GPIOF RCC_IOPENR_GPIOFEN
  197. #endif /* GPIOF */
  198. /**
  199. * @}
  200. */
  201. /**
  202. * @}
  203. */
  204. /* Exported macro ------------------------------------------------------------*/
  205. /* Exported functions --------------------------------------------------------*/
  206. /** @defgroup BUS_LL_Exported_Functions BUS Exported Functions
  207. * @{
  208. */
  209. /** @defgroup BUS_LL_EF_AHB1 AHB1
  210. * @{
  211. */
  212. /**
  213. * @brief Enable AHB1 peripherals clock.
  214. * @rmtoll AHBENR DMA1EN LL_AHB1_GRP1_EnableClock\n
  215. * AHBENR FLASHEN LL_AHB1_GRP1_EnableClock\n
  216. * AHBENR CRCEN LL_AHB1_GRP1_EnableClock\n
  217. * AHBENR AESEN LL_AHB1_GRP1_EnableClock\n
  218. * AHBENR RNGEN LL_AHB1_GRP1_EnableClock
  219. * @param Periphs This parameter can be a combination of the following values:
  220. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  221. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  222. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  223. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  224. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  225. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  226. * @retval None
  227. */
  228. __STATIC_INLINE void LL_AHB1_GRP1_EnableClock(uint32_t Periphs)
  229. {
  230. __IO uint32_t tmpreg;
  231. SET_BIT(RCC->AHBENR, Periphs);
  232. /* Delay after an RCC peripheral clock enabling */
  233. tmpreg = READ_BIT(RCC->AHBENR, Periphs);
  234. (void)tmpreg;
  235. }
  236. /**
  237. * @brief Check if AHB1 peripheral clock is enabled or not
  238. * @rmtoll AHBENR DMA1EN LL_AHB1_GRP1_IsEnabledClock\n
  239. * AHBENR FLASHEN LL_AHB1_GRP1_IsEnabledClock\n
  240. * AHBENR CRCEN LL_AHB1_GRP1_IsEnabledClock\n
  241. * AHBENR AESEN LL_AHB1_GRP1_IsEnabledClock\n
  242. * AHBENR RNGEN LL_AHB1_GRP1_IsEnabledClock
  243. * @param Periphs This parameter can be a combination of the following values:
  244. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  245. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  246. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  247. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  248. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  249. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  250. * @retval State of Periphs (1 or 0).
  251. */
  252. __STATIC_INLINE uint32_t LL_AHB1_GRP1_IsEnabledClock(uint32_t Periphs)
  253. {
  254. return ((READ_BIT(RCC->AHBENR, Periphs) == Periphs) ? 1UL : 0UL);
  255. }
  256. /**
  257. * @brief Disable AHB1 peripherals clock.
  258. * @rmtoll AHBENR DMA1EN LL_AHB1_GRP1_DisableClock\n
  259. * AHBENR FLASHEN LL_AHB1_GRP1_DisableClock\n
  260. * AHBENR CRCEN LL_AHB1_GRP1_DisableClock\n
  261. * AHBENR AESEN LL_AHB1_GRP1_DisableClock\n
  262. * AHBENR RNGEN LL_AHB1_GRP1_DisableClock
  263. * @param Periphs This parameter can be a combination of the following values:
  264. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  265. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  266. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  267. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  268. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  269. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  270. * @retval None
  271. */
  272. __STATIC_INLINE void LL_AHB1_GRP1_DisableClock(uint32_t Periphs)
  273. {
  274. CLEAR_BIT(RCC->AHBENR, Periphs);
  275. }
  276. /**
  277. * @brief Force AHB1 peripherals reset.
  278. * @rmtoll AHBRSTR DMA1RST LL_AHB1_GRP1_ForceReset\n
  279. * AHBRSTR FLASHRST LL_AHB1_GRP1_ForceReset\n
  280. * AHBRSTR CRCRST LL_AHB1_GRP1_ForceReset\n
  281. * AHBRSTR AESRST LL_AHB1_GRP1_ForceReset\n
  282. * AHBRSTR RNGRST LL_AHB1_GRP1_ForceReset
  283. * @param Periphs This parameter can be a combination of the following values:
  284. * @arg @ref LL_AHB1_GRP1_PERIPH_ALL
  285. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  286. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  287. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  288. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  289. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  290. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  291. * @retval None
  292. */
  293. __STATIC_INLINE void LL_AHB1_GRP1_ForceReset(uint32_t Periphs)
  294. {
  295. SET_BIT(RCC->AHBRSTR, Periphs);
  296. }
  297. /**
  298. * @brief Release AHB1 peripherals reset.
  299. * @rmtoll AHBRSTR DMA1RST LL_AHB1_GRP1_ReleaseReset\n
  300. * AHBRSTR FLASHRST LL_AHB1_GRP1_ReleaseReset\n
  301. * AHBRSTR CRCRST LL_AHB1_GRP1_ReleaseReset\n
  302. * AHBRSTR AESRST LL_AHB1_GRP1_ReleaseReset\n
  303. * AHBRSTR RNGRST LL_AHB1_GRP1_ReleaseReset
  304. * @param Periphs This parameter can be a combination of the following values:
  305. * @arg @ref LL_AHB1_GRP1_PERIPH_ALL
  306. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  307. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  308. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  309. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  310. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  311. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  312. * @retval None
  313. */
  314. __STATIC_INLINE void LL_AHB1_GRP1_ReleaseReset(uint32_t Periphs)
  315. {
  316. CLEAR_BIT(RCC->AHBRSTR, Periphs);
  317. }
  318. /**
  319. * @brief Enable AHB1 peripheral clocks in Sleep and Stop modes
  320. * @rmtoll AHBSMENR DMA1SMEN LL_AHB1_GRP1_EnableClockStopSleep\n
  321. * AHBSMENR FLASHSMEN LL_AHB1_GRP1_EnableClockStopSleep\n
  322. * AHBSMENR SRAMSMEN LL_AHB1_GRP1_EnableClockStopSleep\n
  323. * AHBSMENR CRCSMEN LL_AHB1_GRP1_EnableClockStopSleep\n
  324. * AHBSMENR AESSMEN LL_AHB1_GRP1_EnableClockStopSleep\n
  325. * AHBSMENR RNGSMEN LL_AHB1_GRP1_EnableClockStopSleep
  326. * @param Periphs This parameter can be a combination of the following values:
  327. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  328. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  329. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  330. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  331. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  332. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  333. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  334. * @retval None
  335. */
  336. __STATIC_INLINE void LL_AHB1_GRP1_EnableClockStopSleep(uint32_t Periphs)
  337. {
  338. __IO uint32_t tmpreg;
  339. SET_BIT(RCC->AHBSMENR, Periphs);
  340. /* Delay after an RCC peripheral clock enabling */
  341. tmpreg = READ_BIT(RCC->AHBSMENR, Periphs);
  342. (void)tmpreg;
  343. }
  344. /**
  345. * @brief Disable AHB1 peripheral clocks in Sleep and Stop modes
  346. * @rmtoll AHBSMENR DMA1SMEN LL_AHB1_GRP1_DisableClockStopSleep\n
  347. * AHBSMENR FLASHSMEN LL_AHB1_GRP1_DisableClockStopSleep\n
  348. * AHBSMENR SRAMSMEN LL_AHB1_GRP1_DisableClockStopSleep\n
  349. * AHBSMENR CRCSMEN LL_AHB1_GRP1_DisableClockStopSleep\n
  350. * AHBSMENR AESSMEN LL_AHB1_GRP1_DisableClockStopSleep\n
  351. * AHBSMENR RNGSMEN LL_AHB1_GRP1_DisableClockStopSleep
  352. * @param Periphs This parameter can be a combination of the following values:
  353. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  354. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  355. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  356. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  357. * @arg @ref LL_AHB1_GRP1_PERIPH_CRYP (*)
  358. * @arg @ref LL_AHB1_GRP1_PERIPH_RNG (*)
  359. * @note (*) RNG & CRYP Peripherals available only on STM32G081xx
  360. * @retval None
  361. */
  362. __STATIC_INLINE void LL_AHB1_GRP1_DisableClockStopSleep(uint32_t Periphs)
  363. {
  364. CLEAR_BIT(RCC->AHBSMENR, Periphs);
  365. }
  366. /**
  367. * @}
  368. */
  369. /** @defgroup BUS_LL_EF_APB1 APB1
  370. * @{
  371. */
  372. /**
  373. * @brief Enable APB1 peripherals clock.
  374. * @rmtoll APBENR1 TIM2EN LL_APB1_GRP1_EnableClock\n
  375. * APBENR1 TIM3EN LL_APB1_GRP1_EnableClock\n
  376. * APBENR1 TIM4EN LL_APB1_GRP1_EnableClock\n
  377. * APBENR1 TIM6EN LL_APB1_GRP1_EnableClock\n
  378. * APBENR1 TIM7EN LL_APB1_GRP1_EnableClock\n
  379. * APBENR1 RTCAPBEN LL_APB1_GRP1_EnableClock\n
  380. * APBENR1 WWDGEN LL_APB1_GRP1_EnableClock\n
  381. * APBENR1 SPI2EN LL_APB1_GRP1_EnableClock\n
  382. * APBENR1 SPI3EN LL_APB1_GRP1_EnableClock\n
  383. * APBENR1 USART2EN LL_APB1_GRP1_EnableClock\n
  384. * APBENR1 USART3EN LL_APB1_GRP1_EnableClock\n
  385. * APBENR1 USART4EN LL_APB1_GRP1_EnableClock\n
  386. * APBENR1 USART5EN LL_APB1_GRP1_EnableClock\n
  387. * APBENR1 USART6EN LL_APB1_GRP1_EnableClock\n
  388. * APBENR1 LPUART1EN LL_APB1_GRP1_EnableClock\n
  389. * APBENR1 LPUART2EN LL_APB1_GRP1_EnableClock\n
  390. * APBENR1 I2C1EN LL_APB1_GRP1_EnableClock\n
  391. * APBENR1 I2C2EN LL_APB1_GRP1_EnableClock\n
  392. * APBENR1 I2C3EN LL_APB1_GRP1_EnableClock\n
  393. * APBENR1 CECEN LL_APB1_GRP1_EnableClock\n
  394. * APBENR1 UCPD1EN LL_APB1_GRP1_EnableClock\n
  395. * APBENR1 UCPD2EN LL_APB1_GRP1_EnableClock\n
  396. * APBENR1 USBEN LL_APB1_GRP1_EnableClock\n
  397. * APBENR1 FDCANEN LL_APB1_GRP1_EnableClock\n
  398. * APBENR1 DBGEN LL_APB1_GRP1_EnableClock\n
  399. * APBENR1 PWREN LL_APB1_GRP1_EnableClock\n
  400. * APBENR1 DAC1EN LL_APB1_GRP1_EnableClock\n
  401. * APBENR1 LPTIM2EN LL_APB1_GRP1_EnableClock\n
  402. * APBENR1 LPTIM1EN LL_APB1_GRP1_EnableClock
  403. * @param Periphs This parameter can be a combination of the following values:
  404. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  405. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  406. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  407. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  408. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  409. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  410. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  411. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  412. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  413. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  414. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  415. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  416. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  417. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  418. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  419. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  420. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  421. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  422. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  423. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  424. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  425. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  426. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  427. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  428. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  429. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  430. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  431. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  432. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  433. * @note Peripheral marked with (1) are not available all devices
  434. * @retval None
  435. */
  436. __STATIC_INLINE void LL_APB1_GRP1_EnableClock(uint32_t Periphs)
  437. {
  438. __IO uint32_t tmpreg;
  439. SET_BIT(RCC->APBENR1, Periphs);
  440. /* Delay after an RCC peripheral clock enabling */
  441. tmpreg = READ_BIT(RCC->APBENR1, Periphs);
  442. (void)tmpreg;
  443. }
  444. /**
  445. * @brief Check if APB1 peripheral clock is enabled or not
  446. * @rmtoll APBENR1 TIM2EN LL_APB1_GRP1_IsEnabledClock\n
  447. * APBENR1 TIM3EN LL_APB1_GRP1_IsEnabledClock\n
  448. * APBENR1 TIM4EN LL_APB1_GRP1_IsEnabledClock\n
  449. * APBENR1 TIM6EN LL_APB1_GRP1_IsEnabledClock\n
  450. * APBENR1 TIM7EN LL_APB1_GRP1_IsEnabledClock\n
  451. * APBENR1 RTCAPBEN LL_APB1_GRP1_IsEnabledClock\n
  452. * APBENR1 WWDGEN LL_APB1_GRP1_IsEnabledClock\n
  453. * APBENR1 SPI2EN LL_APB1_GRP1_IsEnabledClock\n
  454. * APBENR1 SPI3EN LL_APB1_GRP1_IsEnabledClock\n
  455. * APBENR1 USART2EN LL_APB1_GRP1_IsEnabledClock\n
  456. * APBENR1 USART3EN LL_APB1_GRP1_IsEnabledClock\n
  457. * APBENR1 USART4EN LL_APB1_GRP1_IsEnabledClock\n
  458. * APBENR1 USART5EN LL_APB1_GRP1_IsEnabledClock\n
  459. * APBENR1 USART6EN LL_APB1_GRP1_IsEnabledClock\n
  460. * APBENR1 LPUART1EN LL_APB1_GRP1_IsEnabledClock\n
  461. * APBENR1 LPUART2EN LL_APB1_GRP1_IsEnabledClock\n
  462. * APBENR1 I2C1EN LL_APB1_GRP1_IsEnabledClock\n
  463. * APBENR1 I2C2EN LL_APB1_GRP1_IsEnabledClock\n
  464. * APBENR1 I2C3EN LL_APB1_GRP1_IsEnabledClock\n
  465. * APBENR1 CECEN LL_APB1_GRP1_IsEnabledClock\n
  466. * APBENR1 UCPD1EN LL_APB1_GRP1_IsEnabledClock\n
  467. * APBENR1 UCPD2EN LL_APB1_GRP1_IsEnabledClock\n
  468. * APBENR1 USBEN LL_APB1_GRP1_IsEnabledClock\n
  469. * APBENR1 FDCANEN LL_APB1_GRP1_IsEnabledClock\n
  470. * APBENR1 DBGEN LL_APB1_GRP1_IsEnabledClock\n
  471. * APBENR1 PWREN LL_APB1_GRP1_IsEnabledClock\n
  472. * APBENR1 DAC1EN LL_APB1_GRP1_IsEnabledClock\n
  473. * APBENR1 LPTIM2EN LL_APB1_GRP1_IsEnabledClock\n
  474. * APBENR1 LPTIM1EN LL_APB1_GRP1_IsEnabledClock
  475. * @param Periphs This parameter can be a combination of the following values:
  476. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  477. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  478. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  479. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  480. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  481. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  482. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  483. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  484. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  485. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  486. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  487. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  488. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  489. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  490. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  491. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  492. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  493. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  494. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  495. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  496. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  497. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  498. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  499. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  500. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  501. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  502. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  503. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  504. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  505. * @note Peripheral marked with (1) are not available all devices
  506. * @retval State of Periphs (1 or 0).
  507. */
  508. __STATIC_INLINE uint32_t LL_APB1_GRP1_IsEnabledClock(uint32_t Periphs)
  509. {
  510. return ((READ_BIT(RCC->APBENR1, Periphs) == (Periphs)) ? 1UL : 0UL);
  511. }
  512. /**
  513. * @brief Disable APB1 peripherals clock.
  514. * @rmtoll APBENR1 TIM2EN LL_APB1_GRP1_DisableClock\n
  515. * APBENR1 TIM3EN LL_APB1_GRP1_DisableClock\n
  516. * APBENR1 TIM4EN LL_APB1_GRP1_DisableClock\n
  517. * APBENR1 TIM6EN LL_APB1_GRP1_DisableClock\n
  518. * APBENR1 TIM7EN LL_APB1_GRP1_DisableClock\n
  519. * APBENR1 RTCAPBEN LL_APB1_GRP1_DisableClock\n
  520. * APBENR1 WWDGEN LL_APB1_GRP1_DisableClock\n
  521. * APBENR1 SPI2EN LL_APB1_GRP1_DisableClock\n
  522. * APBENR1 SPI3EN LL_APB1_GRP1_DisableClock\n
  523. * APBENR1 USART2EN LL_APB1_GRP1_DisableClock\n
  524. * APBENR1 USART3EN LL_APB1_GRP1_DisableClock\n
  525. * APBENR1 USART4EN LL_APB1_GRP1_DisableClock\n
  526. * APBENR1 USART5EN LL_APB1_GRP1_DisableClock\n
  527. * APBENR1 USART6EN LL_APB1_GRP1_DisableClock\n
  528. * APBENR1 LPUART1EN LL_APB1_GRP1_DisableClock\n
  529. * APBENR1 LPUART2EN LL_APB1_GRP1_DisableClock\n
  530. * APBENR1 I2C1EN LL_APB1_GRP1_DisableClock\n
  531. * APBENR1 I2C2EN LL_APB1_GRP1_DisableClock\n
  532. * APBENR1 I2C3EN LL_APB1_GRP1_DisableClock\n
  533. * APBENR1 CECEN LL_APB1_GRP1_DisableClock\n
  534. * APBENR1 UCPD1EN LL_APB1_GRP1_DisableClock\n
  535. * APBENR1 UCPD2EN LL_APB1_GRP1_DisableClock\n
  536. * APBENR1 USBEN LL_APB1_GRP1_DisableClock\n
  537. * APBENR1 FDCANEN LL_APB1_GRP1_DisableClock\n
  538. * APBENR1 DBGEN LL_APB1_GRP1_DisableClock\n
  539. * APBENR1 PWREN LL_APB1_GRP1_DisableClock\n
  540. * APBENR1 DAC1EN LL_APB1_GRP1_DisableClock\n
  541. * APBENR1 LPTIM2EN LL_APB1_GRP1_DisableClock\n
  542. * APBENR1 LPTIM1EN LL_APB1_GRP1_DisableClock
  543. * @param Periphs This parameter can be a combination of the following values:
  544. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  545. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  546. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  547. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  548. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  549. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  550. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  551. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  552. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  553. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  554. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  555. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  556. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  557. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  558. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  559. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  560. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  561. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  562. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  563. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  564. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  565. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  566. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  567. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  568. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  569. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  570. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  571. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  572. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  573. * @note Peripheral marked with (1) are not available all devices
  574. * @retval None
  575. */
  576. __STATIC_INLINE void LL_APB1_GRP1_DisableClock(uint32_t Periphs)
  577. {
  578. CLEAR_BIT(RCC->APBENR1, Periphs);
  579. }
  580. /**
  581. * @brief Force APB1 peripherals reset.
  582. * @rmtoll APBRSTR1 TIM2RST LL_APB1_GRP1_ForceReset\n
  583. * APBRSTR1 TIM3RST LL_APB1_GRP1_ForceReset\n
  584. * APBRSTR1 TIM4RST LL_APB1_GRP1_ForceReset\n
  585. * APBRSTR1 TIM6RST LL_APB1_GRP1_ForceReset\n
  586. * APBRSTR1 TIM7RST LL_APB1_GRP1_ForceReset\n
  587. * APBRSTR1 RTCRST LL_APB1_GRP1_ForceReset\n
  588. * APBRSTR1 SPI2RST LL_APB1_GRP1_ForceReset\n
  589. * APBRSTR1 SPI3RST LL_APB1_GRP1_ForceReset\n
  590. * APBRSTR1 USART2RST LL_APB1_GRP1_ForceReset\n
  591. * APBRSTR1 USART3RST LL_APB1_GRP1_ForceReset\n
  592. * APBRSTR1 USART4RST LL_APB1_GRP1_ForceReset\n
  593. * APBRSTR1 USART5RST LL_APB1_GRP1_ForceReset\n
  594. * APBRSTR1 USART6RST LL_APB1_GRP1_ForceReset\n
  595. * APBRSTR1 LPUART1RST LL_APB1_GRP1_ForceReset\n
  596. * APBRSTR1 LPUART2RST LL_APB1_GRP1_ForceReset\n
  597. * APBRSTR1 I2C1RST LL_APB1_GRP1_ForceReset\n
  598. * APBRSTR1 I2C2RST LL_APB1_GRP1_ForceReset\n
  599. * APBRSTR1 I2C3RST LL_APB1_GRP1_ForceReset\n
  600. * APBRSTR1 CECRST LL_APB1_GRP1_ForceReset\n
  601. * APBRSTR1 UCPD1RST LL_APB1_GRP1_ForceReset\n
  602. * APBRSTR1 UCPD2RST LL_APB1_GRP1_ForceReset\n
  603. * APBRSTR1 USBRST LL_APB1_GRP1_ForceReset\n
  604. * APBRSTR1 FDCANRST LL_APB1_GRP1_ForceReset\n
  605. * APBRSTR1 DBGRST LL_APB1_GRP1_ForceReset\n
  606. * APBRSTR1 PWRRST LL_APB1_GRP1_ForceReset\n
  607. * APBRSTR1 DAC1RST LL_APB1_GRP1_ForceReset\n
  608. * APBRSTR1 LPTIM2RST LL_APB1_GRP1_ForceReset\n
  609. * APBRSTR1 LPTIM1RST LL_APB1_GRP1_ForceReset
  610. * @param Periphs This parameter can be a combination of the following values:
  611. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  612. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  613. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  614. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  615. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  616. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  617. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  618. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  619. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  620. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  621. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  622. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  623. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  624. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  625. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  626. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  627. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  628. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  629. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  630. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  631. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  632. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  633. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  634. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  635. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  636. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  637. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  638. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  639. * @note Peripheral marked with (1) are not available all devices
  640. * @retval None
  641. */
  642. __STATIC_INLINE void LL_APB1_GRP1_ForceReset(uint32_t Periphs)
  643. {
  644. SET_BIT(RCC->APBRSTR1, Periphs);
  645. }
  646. /**
  647. * @brief Release APB1 peripherals reset.
  648. * @rmtoll APBRSTR1 TIM2RST LL_APB1_GRP1_ReleaseReset\n
  649. * APBRSTR1 TIM4RST LL_APB1_GRP1_ReleaseReset\n
  650. * APBRSTR1 TIM6RST LL_APB1_GRP1_ReleaseReset\n
  651. * APBRSTR1 TIM7RST LL_APB1_GRP1_ReleaseReset\n
  652. * APBRSTR1 RTCRST LL_APB1_GRP1_ReleaseReset\n
  653. * APBRSTR1 SPI2RST LL_APB1_GRP1_ReleaseReset\n
  654. * APBRSTR1 SPI3RST LL_APB1_GRP1_ReleaseReset\n
  655. * APBRSTR1 USART2RST LL_APB1_GRP1_ReleaseReset\n
  656. * APBRSTR1 USART3RST LL_APB1_GRP1_ReleaseReset\n
  657. * APBRSTR1 USART4RST LL_APB1_GRP1_ReleaseReset\n
  658. * APBRSTR1 USART5RST LL_APB1_GRP1_ReleaseReset\n
  659. * APBRSTR1 USART6RST LL_APB1_GRP1_ReleaseReset\n
  660. * APBRSTR1 LPUART1RST LL_APB1_GRP1_ReleaseReset\n
  661. * APBRSTR1 LPUART2RST LL_APB1_GRP1_ReleaseReset\n
  662. * APBRSTR1 I2C1RST LL_APB1_GRP1_ReleaseReset\n
  663. * APBRSTR1 I2C2RST LL_APB1_GRP1_ReleaseReset\n
  664. * APBRSTR1 I2C3RST LL_APB1_GRP1_ReleaseReset\n
  665. * APBRSTR1 CECRST LL_APB1_GRP1_ReleaseReset\n
  666. * APBRSTR1 UCPD1RST LL_APB1_GRP1_ReleaseReset\n
  667. * APBRSTR1 UCPD2RST LL_APB1_GRP1_ReleaseReset\n
  668. * APBRSTR1 USBRST LL_APB1_GRP1_ReleaseReset\n
  669. * APBRSTR1 FDCANRST LL_APB1_GRP1_ReleaseReset\n
  670. * APBRSTR1 DBGRST LL_APB1_GRP1_ReleaseReset\n
  671. * APBRSTR1 PWRRST LL_APB1_GRP1_ReleaseReset\n
  672. * APBRSTR1 DAC1RST LL_APB1_GRP1_ReleaseReset\n
  673. * APBRSTR1 LPTIM2RST LL_APB1_GRP1_ReleaseReset\n
  674. * APBRSTR1 LPTIM1RST LL_APB1_GRP1_ReleaseReset
  675. * @param Periphs This parameter can be a combination of the following values:
  676. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  677. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  678. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  679. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  680. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  681. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  682. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  683. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  684. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  685. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  686. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  687. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  688. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  689. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  690. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  691. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  692. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  693. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  694. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  695. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  696. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  697. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  698. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  699. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  700. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  701. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  702. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  703. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  704. * @note Peripheral marked with (1) are not available all devices
  705. * @retval None
  706. */
  707. __STATIC_INLINE void LL_APB1_GRP1_ReleaseReset(uint32_t Periphs)
  708. {
  709. CLEAR_BIT(RCC->APBRSTR1, Periphs);
  710. }
  711. /**
  712. * @brief Enable APB1 peripheral clocks in Sleep and Stop modes
  713. * @rmtoll APBSMENR1 TIM2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  714. * APBSMENR1 TIM3SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  715. * APBSMENR1 TIM4SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  716. * APBSMENR1 TIM6SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  717. * APBSMENR1 TIM7SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  718. * APBSMENR1 RTCAPBSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  719. * APBSMENR1 WWDGSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  720. * APBSMENR1 SPI2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  721. * APBSMENR1 SPI3SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  722. * APBSMENR1 USART2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  723. * APBSMENR1 USART3SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  724. * APBSMENR1 USART4SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  725. * APBSMENR1 USART5SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  726. * APBSMENR1 USART6SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  727. * APBSMENR1 LPUART1SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  728. * APBSMENR1 LPUART2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  729. * APBSMENR1 I2C1SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  730. * APBSMENR1 I2C2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  731. * APBSMENR1 I2C3SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  732. * APBSMENR1 CECSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  733. * APBSMENR1 UCPD1SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  734. * APBSMENR1 UCPD2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  735. * APBSMENR1 USBSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  736. * APBSMENR1 FDCANSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  737. * APBSMENR1 DBGSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  738. * APBSMENR1 PWRSMEN LL_APB1_GRP1_EnableClockStopSleep\n
  739. * APBSMENR1 DAC1SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  740. * APBSMENR1 LPTIM2SMEN LL_APB1_GRP1_EnableClockStopSleep\n
  741. * APBSMENR1 LPTIM1SMEN LL_APB1_GRP1_EnableClockStopSleep
  742. * @param Periphs This parameter can be a combination of the following values:
  743. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  744. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  745. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  746. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  747. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  748. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  749. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  750. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  751. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  752. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  753. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  754. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  755. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  756. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  757. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  758. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  759. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  760. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  761. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  762. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  763. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  764. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  765. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  766. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  767. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  768. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  769. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  770. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  771. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  772. * @note Peripheral marked with (1) are not available all devices
  773. * @retval None
  774. */
  775. __STATIC_INLINE void LL_APB1_GRP1_EnableClockStopSleep(uint32_t Periphs)
  776. {
  777. __IO uint32_t tmpreg;
  778. SET_BIT(RCC->APBSMENR1, Periphs);
  779. /* Delay after an RCC peripheral clock enabling */
  780. tmpreg = READ_BIT(RCC->APBSMENR1, Periphs);
  781. (void)tmpreg;
  782. }
  783. /**
  784. * @brief Disable APB1 peripheral clocks in Sleep and Stop modes
  785. * @rmtoll APBSMENR1 TIM2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  786. * APBSMENR1 TIM3SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  787. * APBSMENR1 TIM'SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  788. * APBSMENR1 TIM6SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  789. * APBSMENR1 TIM7SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  790. * APBSMENR1 RTCAPBSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  791. * APBSMENR1 WWDGSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  792. * APBSMENR1 SPI2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  793. * APBSMENR1 SPI3SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  794. * APBSMENR1 USART2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  795. * APBSMENR1 USART3SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  796. * APBSMENR1 USART4SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  797. * APBSMENR1 USART5SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  798. * APBSMENR1 USART6SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  799. * APBSMENR1 LPUART1SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  800. * APBSMENR1 LPUART2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  801. * APBSMENR1 I2C1SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  802. * APBSMENR1 I2C2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  803. * APBSMENR1 I2C3SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  804. * APBSMENR1 CECSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  805. * APBSMENR1 UCPD1SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  806. * APBSMENR1 UCPD2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  807. * APBSMENR1 USBSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  808. * APBSMENR1 FSCANSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  809. * APBSMENR1 DBGSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  810. * APBSMENR1 PWRSMEN LL_APB1_GRP1_DisableClockStopSleep\n
  811. * APBSMENR1 DAC1SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  812. * APBSMENR1 LPTIM2SMEN LL_APB1_GRP1_DisableClockStopSleep\n
  813. * APBSMENR1 LPTIM1SMEN LL_APB1_GRP1_DisableClockStopSleep
  814. * @param Periphs This parameter can be a combination of the following values:
  815. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2 (1)
  816. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  817. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (1)
  818. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (1)
  819. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (1)
  820. * @arg @ref LL_APB1_GRP1_PERIPH_RTC
  821. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  822. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2
  823. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (1)
  824. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  825. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (1)
  826. * @arg @ref LL_APB1_GRP1_PERIPH_USART4 (1)
  827. * @arg @ref LL_APB1_GRP1_PERIPH_USART5 (1)
  828. * @arg @ref LL_APB1_GRP1_PERIPH_USART6 (1)
  829. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART1 (1)
  830. * @arg @ref LL_APB1_GRP1_PERIPH_LPUART2 (1)
  831. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  832. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2
  833. * @arg @ref LL_APB1_GRP1_PERIPH_I2C3 (1)
  834. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (1)
  835. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD1 (1)
  836. * @arg @ref LL_APB1_GRP1_PERIPH_UCPD2 (1)
  837. * @arg @ref LL_APB1_GRP1_PERIPH_USB (1)
  838. * @arg @ref LL_APB1_GRP1_PERIPH_FDCAN (1)
  839. * @arg @ref LL_APB1_GRP1_PERIPH_DBGMCU
  840. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  841. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (1)
  842. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM2 (1)
  843. * @arg @ref LL_APB1_GRP1_PERIPH_LPTIM1 (1)
  844. * @note Peripheral marked with (1) are not available all devices
  845. * @retval None
  846. */
  847. __STATIC_INLINE void LL_APB1_GRP1_DisableClockStopSleep(uint32_t Periphs)
  848. {
  849. CLEAR_BIT(RCC->APBSMENR1, Periphs);
  850. }
  851. /**
  852. * @}
  853. */
  854. /** @defgroup BUS_LL_EF_APB2 APB2
  855. * @{
  856. */
  857. /**
  858. * @brief Enable APB2 peripherals clock.
  859. * @rmtoll APBENR2 SYSCFGEN LL_APB2_GRP1_EnableClock\n
  860. * APBENR2 TIM1EN LL_APB2_GRP1_EnableClock\n
  861. * APBENR2 SPI1EN LL_APB2_GRP1_EnableClock\n
  862. * APBENR2 USART1EN LL_APB2_GRP1_EnableClock\n
  863. * APBENR2 TIM14EN LL_APB2_GRP1_EnableClock\n
  864. * APBENR2 TIM15EN LL_APB2_GRP1_EnableClock\n
  865. * APBENR2 TIM16EN LL_APB2_GRP1_EnableClock\n
  866. * APBENR2 TIM17EN LL_APB2_GRP1_EnableClock\n
  867. * APBENR2 ADCEN LL_APB2_GRP1_EnableClock
  868. * @param Periphs This parameter can be a combination of the following values:
  869. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  870. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  871. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  872. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  873. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  874. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  875. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  876. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  877. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  878. * @note (*) peripheral not available on all devices
  879. * @retval None
  880. */
  881. __STATIC_INLINE void LL_APB2_GRP1_EnableClock(uint32_t Periphs)
  882. {
  883. __IO uint32_t tmpreg;
  884. SET_BIT(RCC->APBENR2, Periphs);
  885. /* Delay after an RCC peripheral clock enabling */
  886. tmpreg = READ_BIT(RCC->APBENR2, Periphs);
  887. (void)tmpreg;
  888. }
  889. /**
  890. * @brief Check if APB2 peripheral clock is enabled or not
  891. * @rmtoll APBENR2 SYSCFGEN LL_APB2_GRP1_IsEnabledClock\n
  892. * APBENR2 TIM1EN LL_APB2_GRP1_IsEnabledClock\n
  893. * APBENR2 SPI1EN LL_APB2_GRP1_IsEnabledClock\n
  894. * APBENR2 USART1EN LL_APB2_GRP1_IsEnabledClock\n
  895. * APBENR2 TIM14EN LL_APB2_GRP1_IsEnabledClock\n
  896. * APBENR2 TIM15EN LL_APB2_GRP1_IsEnabledClock\n
  897. * APBENR2 TIM16EN LL_APB2_GRP1_IsEnabledClock\n
  898. * APBENR2 TIM17EN LL_APB2_GRP1_IsEnabledClock\n
  899. * APBENR2 ADCEN LL_APB2_GRP1_IsEnabledClock
  900. * @param Periphs This parameter can be a combination of the following values:
  901. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  902. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  903. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  904. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  905. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  906. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  907. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  908. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  909. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  910. * @note (*) peripheral not available on all devices
  911. * @retval State of Periphs (1 or 0).
  912. */
  913. __STATIC_INLINE uint32_t LL_APB2_GRP1_IsEnabledClock(uint32_t Periphs)
  914. {
  915. return ((READ_BIT(RCC->APBENR2, Periphs) == (Periphs)) ? 1UL : 0UL);
  916. }
  917. /**
  918. * @brief Disable APB2 peripherals clock.
  919. * @rmtoll APBENR2 SYSCFGEN LL_APB2_GRP1_DisableClock\n
  920. * APBENR2 TIM1EN LL_APB2_GRP1_DisableClock\n
  921. * APBENR2 SPI1EN LL_APB2_GRP1_DisableClock\n
  922. * APBENR2 USART1EN LL_APB2_GRP1_DisableClock\n
  923. * APBENR2 TIM14EN LL_APB2_GRP1_DisableClock\n
  924. * APBENR2 TIM15EN LL_APB2_GRP1_DisableClock\n
  925. * APBENR2 TIM16EN LL_APB2_GRP1_DisableClock\n
  926. * APBENR2 TIM17EN LL_APB2_GRP1_DisableClock\n
  927. * APBENR2 ADCEN LL_APB2_GRP1_DisableClock
  928. * @param Periphs This parameter can be a combination of the following values:
  929. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  930. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  931. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  932. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  933. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  934. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  935. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  936. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  937. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  938. * @note (*) peripheral not available on all devices
  939. * @retval None
  940. */
  941. __STATIC_INLINE void LL_APB2_GRP1_DisableClock(uint32_t Periphs)
  942. {
  943. CLEAR_BIT(RCC->APBENR2, Periphs);
  944. }
  945. /**
  946. * @brief Force APB2 peripherals reset.
  947. * @rmtoll APBRSTR2 SYSCFGRST LL_APB2_GRP1_ForceReset\n
  948. * APBRSTR2 TIM1RST LL_APB2_GRP1_ForceReset\n
  949. * APBRSTR2 SPI1RST LL_APB2_GRP1_ForceReset\n
  950. * APBRSTR2 USART1RST LL_APB2_GRP1_ForceReset\n
  951. * APBRSTR2 TIM14RST LL_APB2_GRP1_ForceReset\n
  952. * APBRSTR2 TIM15RST LL_APB2_GRP1_ForceReset\n
  953. * APBRSTR2 TIM16RST LL_APB2_GRP1_ForceReset\n
  954. * APBRSTR2 TIM17RST LL_APB2_GRP1_ForceReset\n
  955. * APBRSTR2 ADCRST LL_APB2_GRP1_ForceReset
  956. * @param Periphs This parameter can be a combination of the following values:
  957. * @arg @ref LL_APB2_GRP1_PERIPH_ALL
  958. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  959. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  960. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  961. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  962. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  963. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  964. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  965. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  966. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  967. * @note (*) peripheral not available on all devices
  968. * @retval None
  969. */
  970. __STATIC_INLINE void LL_APB2_GRP1_ForceReset(uint32_t Periphs)
  971. {
  972. SET_BIT(RCC->APBRSTR2, Periphs);
  973. }
  974. /**
  975. * @brief Release APB2 peripherals reset.
  976. * @rmtoll APBRSTR2 SYSCFGRST LL_APB2_GRP1_ReleaseReset\n
  977. * APBRSTR2 TIM1RST LL_APB2_GRP1_ReleaseReset\n
  978. * APBRSTR2 SPI1RST LL_APB2_GRP1_ReleaseReset\n
  979. * APBRSTR2 USART1RST LL_APB2_GRP1_ReleaseReset\n
  980. * APBRSTR2 TIM14RST LL_APB2_GRP1_ReleaseReset\n
  981. * APBRSTR2 TIM15RST LL_APB2_GRP1_ReleaseReset\n
  982. * APBRSTR2 TIM16RST LL_APB2_GRP1_ReleaseReset\n
  983. * APBRSTR2 TIM17RST LL_APB2_GRP1_ReleaseReset\n
  984. * APBRSTR2 ADCRST LL_APB2_GRP1_ReleaseReset
  985. * @param Periphs This parameter can be a combination of the following values:
  986. * @arg @ref LL_APB2_GRP1_PERIPH_ALL
  987. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  988. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  989. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  990. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  991. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  992. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  993. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  994. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  995. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  996. * @note (*) peripheral not available on all devices
  997. * @retval None
  998. */
  999. __STATIC_INLINE void LL_APB2_GRP1_ReleaseReset(uint32_t Periphs)
  1000. {
  1001. CLEAR_BIT(RCC->APBRSTR2, Periphs);
  1002. }
  1003. /**
  1004. * @brief Enable APB2 peripheral clocks in Sleep and Stop modes
  1005. * @rmtoll APBSMENR2 SYSCFGSMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1006. * APBSMENR2 TIM1SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1007. * APBSMENR2 SPI1SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1008. * APBSMENR2 USART1SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1009. * APBSMENR2 TIM14SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1010. * APBSMENR2 TIM15SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1011. * APBSMENR2 TIM16SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1012. * APBSMENR2 TIM17SMEN LL_APB2_GRP1_EnableClockStopSleep\n
  1013. * APBSMENR2 ADCSMEN LL_APB2_GRP1_EnableClockStopSleep
  1014. * @param Periphs This parameter can be a combination of the following values:
  1015. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  1016. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  1017. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  1018. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  1019. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  1020. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  1021. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  1022. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  1023. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  1024. * @note (*) peripheral not available on all devices
  1025. * @retval None
  1026. */
  1027. __STATIC_INLINE void LL_APB2_GRP1_EnableClockStopSleep(uint32_t Periphs)
  1028. {
  1029. __IO uint32_t tmpreg;
  1030. SET_BIT(RCC->APBSMENR2, Periphs);
  1031. /* Delay after an RCC peripheral clock enabling */
  1032. tmpreg = READ_BIT(RCC->APBSMENR2, Periphs);
  1033. (void)tmpreg;
  1034. }
  1035. /**
  1036. * @brief Disable APB2 peripheral clocks in Sleep and Stop modes
  1037. * @rmtoll APBSMENR2 SYSCFGSMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1038. * APBSMENR2 TIM1SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1039. * APBSMENR2 SPI1SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1040. * APBSMENR2 USART1SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1041. * APBSMENR2 TIM14SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1042. * APBSMENR2 TIM15SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1043. * APBSMENR2 TIM16SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1044. * APBSMENR2 TIM17SMEN LL_APB2_GRP1_DisableClockStopSleep\n
  1045. * APBSMENR2 ADCSMEN LL_APB2_GRP1_DisableClockStopSleep
  1046. * @param Periphs This parameter can be a combination of the following values:
  1047. * @arg @ref LL_APB2_GRP1_PERIPH_SYSCFG
  1048. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  1049. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  1050. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  1051. * @arg @ref LL_APB2_GRP1_PERIPH_TIM14
  1052. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  1053. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16
  1054. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17
  1055. * @arg @ref LL_APB2_GRP1_PERIPH_ADC
  1056. * @note (*) peripheral not available on all devices
  1057. * @retval None
  1058. */
  1059. __STATIC_INLINE void LL_APB2_GRP1_DisableClockStopSleep(uint32_t Periphs)
  1060. {
  1061. CLEAR_BIT(RCC->APBSMENR2, Periphs);
  1062. }
  1063. /**
  1064. * @}
  1065. */
  1066. /** @defgroup BUS_LL_EF_IOP IOP
  1067. * @{
  1068. */
  1069. /**
  1070. * @brief Enable IOP peripherals clock.
  1071. * @rmtoll IOPENR GPIOAEN LL_IOP_GRP1_EnableClock\n
  1072. * IOPENR GPIOBEN LL_IOP_GRP1_EnableClock\n
  1073. * IOPENR GPIOCEN LL_IOP_GRP1_EnableClock\n
  1074. * IOPENR GPIODEN LL_IOP_GRP1_EnableClock\n
  1075. * IOPENR GPIOEEN LL_IOP_GRP1_EnableClock\n
  1076. * IOPENR GPIOFEN LL_IOP_GRP1_EnableClock
  1077. * @param Periphs This parameter can be a combination of the following values:
  1078. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1079. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1080. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1081. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1082. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1083. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1084. * @retval None
  1085. */
  1086. __STATIC_INLINE void LL_IOP_GRP1_EnableClock(uint32_t Periphs)
  1087. {
  1088. __IO uint32_t tmpreg;
  1089. SET_BIT(RCC->IOPENR, Periphs);
  1090. /* Delay after an RCC peripheral clock enabling */
  1091. tmpreg = READ_BIT(RCC->IOPENR, Periphs);
  1092. (void)tmpreg;
  1093. }
  1094. /**
  1095. * @brief Check if IOP peripheral clock is enabled or not
  1096. * @rmtoll IOPENR GPIOAEN LL_IOP_GRP1_IsEnabledClock\n
  1097. * IOPENR GPIOBEN LL_IOP_GRP1_IsEnabledClock\n
  1098. * IOPENR GPIOCEN LL_IOP_GRP1_IsEnabledClock\n
  1099. * IOPENR GPIODEN LL_IOP_GRP1_IsEnabledClock\n
  1100. * IOPENR GPIOEEN LL_IOP_GRP1_IsEnabledClock\n
  1101. * IOPENR GPIOFEN LL_IOP_GRP1_IsEnabledClock
  1102. * @param Periphs This parameter can be a combination of the following values:
  1103. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1104. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1105. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1106. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1107. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1108. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1109. * @retval State of Periphs (1 or 0).
  1110. */
  1111. __STATIC_INLINE uint32_t LL_IOP_GRP1_IsEnabledClock(uint32_t Periphs)
  1112. {
  1113. return ((READ_BIT(RCC->IOPENR, Periphs) == Periphs) ? 1UL : 0UL);
  1114. }
  1115. /**
  1116. * @brief Disable IOP peripherals clock.
  1117. * @rmtoll IOPENR GPIOAEN LL_IOP_GRP1_DisableClock\n
  1118. * IOPENR GPIOBEN LL_IOP_GRP1_DisableClock\n
  1119. * IOPENR GPIOCEN LL_IOP_GRP1_DisableClock\n
  1120. * IOPENR GPIODEN LL_IOP_GRP1_DisableClock\n
  1121. * IOPENR GPIOEEN LL_IOP_GRP1_DisableClock\n
  1122. * IOPENR GPIOFEN LL_IOP_GRP1_DisableClock
  1123. * @param Periphs This parameter can be a combination of the following values:
  1124. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1125. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1126. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1127. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1128. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1129. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1130. * @retval None
  1131. */
  1132. __STATIC_INLINE void LL_IOP_GRP1_DisableClock(uint32_t Periphs)
  1133. {
  1134. CLEAR_BIT(RCC->IOPENR, Periphs);
  1135. }
  1136. /**
  1137. * @brief Disable IOP peripherals clock.
  1138. * @rmtoll IOPRSTR GPIOARST LL_IOP_GRP1_ForceReset\n
  1139. * IOPRSTR GPIOBRST LL_IOP_GRP1_ForceReset\n
  1140. * IOPRSTR GPIOCRST LL_IOP_GRP1_ForceReset\n
  1141. * IOPRSTR GPIODRST LL_IOP_GRP1_ForceReset\n
  1142. * IOPRSTR GPIOERST LL_IOP_GRP1_ForceReset\n
  1143. * IOPRSTR GPIOFRST LL_IOP_GRP1_ForceReset
  1144. * @param Periphs This parameter can be a combination of the following values:
  1145. * @arg @ref LL_IOP_GRP1_PERIPH_ALL
  1146. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1147. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1148. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1149. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1150. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1151. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1152. * @retval None
  1153. */
  1154. __STATIC_INLINE void LL_IOP_GRP1_ForceReset(uint32_t Periphs)
  1155. {
  1156. SET_BIT(RCC->IOPRSTR, Periphs);
  1157. }
  1158. /**
  1159. * @brief Release IOP peripherals reset.
  1160. * @rmtoll IOPRSTR GPIOARST LL_IOP_GRP1_ReleaseReset\n
  1161. * IOPRSTR GPIOBRST LL_IOP_GRP1_ReleaseReset\n
  1162. * IOPRSTR GPIOCRST LL_IOP_GRP1_ReleaseReset\n
  1163. * IOPRSTR GPIODRST LL_IOP_GRP1_ReleaseReset\n
  1164. * IOPRSTR GPIOERST LL_IOP_GRP1_ReleaseReset\n
  1165. * IOPRSTR GPIOFRST LL_IOP_GRP1_ReleaseReset
  1166. * @param Periphs This parameter can be a combination of the following values:
  1167. * @arg @ref LL_IOP_GRP1_PERIPH_ALL
  1168. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1169. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1170. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1171. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1172. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1173. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1174. * @retval None
  1175. */
  1176. __STATIC_INLINE void LL_IOP_GRP1_ReleaseReset(uint32_t Periphs)
  1177. {
  1178. CLEAR_BIT(RCC->IOPRSTR, Periphs);
  1179. }
  1180. /**
  1181. * @brief Enable IOP peripheral clocks in Sleep and Stop modes
  1182. * @rmtoll IOPSMENR GPIOASMEN LL_IOP_GRP1_EnableClockStopSleep\n
  1183. * IOPSMENR GPIOBSMEN LL_IOP_GRP1_EnableClockStopSleep\n
  1184. * IOPSMENR GPIOCSMEN LL_IOP_GRP1_EnableClockStopSleep\n
  1185. * IOPSMENR GPIODSMEN LL_IOP_GRP1_EnableClockStopSleep\n
  1186. * IOPSMENR GPIOESMEN LL_IOP_GRP1_EnableClockStopSleep\n
  1187. * IOPSMENR GPIOFSMEN LL_IOP_GRP1_EnableClockStopSleep
  1188. * @param Periphs This parameter can be a combination of the following values:
  1189. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1190. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1191. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1192. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1193. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1194. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1195. * @retval None
  1196. */
  1197. __STATIC_INLINE void LL_IOP_GRP1_EnableClockStopSleep(uint32_t Periphs)
  1198. {
  1199. __IO uint32_t tmpreg;
  1200. SET_BIT(RCC->IOPSMENR, Periphs);
  1201. /* Delay after an RCC peripheral clock enabling */
  1202. tmpreg = READ_BIT(RCC->IOPSMENR, Periphs);
  1203. (void)tmpreg;
  1204. }
  1205. /**
  1206. * @brief Disable IOP peripheral clocks in Sleep and Stop modes
  1207. * @rmtoll IOPSMENR GPIOASMEN LL_IOP_GRP1_DisableClockStopSleep\n
  1208. * IOPSMENR GPIOBSMEN LL_IOP_GRP1_DisableClockStopSleep\n
  1209. * IOPSMENR GPIOCSMEN LL_IOP_GRP1_DisableClockStopSleep\n
  1210. * IOPSMENR GPIODSMEN LL_IOP_GRP1_DisableClockStopSleep\n
  1211. * IOPSMENR GPIOESMEN LL_IOP_GRP1_DisableClockStopSleep\n
  1212. * IOPSMENR GPIOFSMEN LL_IOP_GRP1_DisableClockStopSleep
  1213. * @param Periphs This parameter can be a combination of the following values:
  1214. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOA
  1215. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOB
  1216. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOC
  1217. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOD
  1218. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOE
  1219. * @arg @ref LL_IOP_GRP1_PERIPH_GPIOF
  1220. * @retval None
  1221. */
  1222. __STATIC_INLINE void LL_IOP_GRP1_DisableClockStopSleep(uint32_t Periphs)
  1223. {
  1224. CLEAR_BIT(RCC->IOPSMENR, Periphs);
  1225. }
  1226. /**
  1227. * @}
  1228. */
  1229. /**
  1230. * @}
  1231. */
  1232. /**
  1233. * @}
  1234. */
  1235. #endif /* RCC */
  1236. /**
  1237. * @}
  1238. */
  1239. #ifdef __cplusplus
  1240. }
  1241. #endif
  1242. #endif /* STM32G0xx_LL_BUS_H */