stm32f1xx_ll_bus.h 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_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) 2016 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 __STM32F1xx_LL_BUS_H
  33. #define __STM32F1xx_LL_BUS_H
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /* Includes ------------------------------------------------------------------*/
  38. #include "stm32f1xx.h"
  39. /** @addtogroup STM32F1xx_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. #if defined(RCC_AHBRSTR_OTGFSRST) || defined(RCC_AHBRSTR_ETHMACRST)
  50. #define RCC_AHBRSTR_SUPPORT
  51. #endif /* RCC_AHBRSTR_OTGFSRST || RCC_AHBRSTR_ETHMACRST */
  52. /* Private macros ------------------------------------------------------------*/
  53. /* Exported types ------------------------------------------------------------*/
  54. /* Exported constants --------------------------------------------------------*/
  55. /** @defgroup BUS_LL_Exported_Constants BUS Exported Constants
  56. * @{
  57. */
  58. /** @defgroup BUS_LL_EC_AHB1_GRP1_PERIPH AHB1 GRP1 PERIPH
  59. * @{
  60. */
  61. #define LL_AHB1_GRP1_PERIPH_ALL (uint32_t)0xFFFFFFFFU
  62. #define LL_AHB1_GRP1_PERIPH_CRC RCC_AHBENR_CRCEN
  63. #define LL_AHB1_GRP1_PERIPH_DMA1 RCC_AHBENR_DMA1EN
  64. #if defined(DMA2)
  65. #define LL_AHB1_GRP1_PERIPH_DMA2 RCC_AHBENR_DMA2EN
  66. #endif /*DMA2*/
  67. #if defined(ETH)
  68. #define LL_AHB1_GRP1_PERIPH_ETHMAC RCC_AHBENR_ETHMACEN
  69. #define LL_AHB1_GRP1_PERIPH_ETHMACRX RCC_AHBENR_ETHMACRXEN
  70. #define LL_AHB1_GRP1_PERIPH_ETHMACTX RCC_AHBENR_ETHMACTXEN
  71. #endif /*ETH*/
  72. #define LL_AHB1_GRP1_PERIPH_FLASH RCC_AHBENR_FLITFEN
  73. #if defined(FSMC_Bank1)
  74. #define LL_AHB1_GRP1_PERIPH_FSMC RCC_AHBENR_FSMCEN
  75. #endif /*FSMC_Bank1*/
  76. #if defined(USB_OTG_FS)
  77. #define LL_AHB1_GRP1_PERIPH_OTGFS RCC_AHBENR_OTGFSEN
  78. #endif /*USB_OTG_FS*/
  79. #if defined(SDIO)
  80. #define LL_AHB1_GRP1_PERIPH_SDIO RCC_AHBENR_SDIOEN
  81. #endif /*SDIO*/
  82. #define LL_AHB1_GRP1_PERIPH_SRAM RCC_AHBENR_SRAMEN
  83. /**
  84. * @}
  85. */
  86. /** @defgroup BUS_LL_EC_APB1_GRP1_PERIPH APB1 GRP1 PERIPH
  87. * @{
  88. */
  89. #define LL_APB1_GRP1_PERIPH_ALL (uint32_t)0xFFFFFFFFU
  90. #define LL_APB1_GRP1_PERIPH_BKP RCC_APB1ENR_BKPEN
  91. #if defined(CAN1)
  92. #define LL_APB1_GRP1_PERIPH_CAN1 RCC_APB1ENR_CAN1EN
  93. #endif /*CAN1*/
  94. #if defined(CAN2)
  95. #define LL_APB1_GRP1_PERIPH_CAN2 RCC_APB1ENR_CAN2EN
  96. #endif /*CAN2*/
  97. #if defined(CEC)
  98. #define LL_APB1_GRP1_PERIPH_CEC RCC_APB1ENR_CECEN
  99. #endif /*CEC*/
  100. #if defined(DAC)
  101. #define LL_APB1_GRP1_PERIPH_DAC1 RCC_APB1ENR_DACEN
  102. #endif /*DAC*/
  103. #define LL_APB1_GRP1_PERIPH_I2C1 RCC_APB1ENR_I2C1EN
  104. #if defined(I2C2)
  105. #define LL_APB1_GRP1_PERIPH_I2C2 RCC_APB1ENR_I2C2EN
  106. #endif /*I2C2*/
  107. #define LL_APB1_GRP1_PERIPH_PWR RCC_APB1ENR_PWREN
  108. #if defined(SPI2)
  109. #define LL_APB1_GRP1_PERIPH_SPI2 RCC_APB1ENR_SPI2EN
  110. #endif /*SPI2*/
  111. #if defined(SPI3)
  112. #define LL_APB1_GRP1_PERIPH_SPI3 RCC_APB1ENR_SPI3EN
  113. #endif /*SPI3*/
  114. #if defined(TIM12)
  115. #define LL_APB1_GRP1_PERIPH_TIM12 RCC_APB1ENR_TIM12EN
  116. #endif /*TIM12*/
  117. #if defined(TIM13)
  118. #define LL_APB1_GRP1_PERIPH_TIM13 RCC_APB1ENR_TIM13EN
  119. #endif /*TIM13*/
  120. #if defined(TIM14)
  121. #define LL_APB1_GRP1_PERIPH_TIM14 RCC_APB1ENR_TIM14EN
  122. #endif /*TIM14*/
  123. #define LL_APB1_GRP1_PERIPH_TIM2 RCC_APB1ENR_TIM2EN
  124. #define LL_APB1_GRP1_PERIPH_TIM3 RCC_APB1ENR_TIM3EN
  125. #if defined(TIM4)
  126. #define LL_APB1_GRP1_PERIPH_TIM4 RCC_APB1ENR_TIM4EN
  127. #endif /*TIM4*/
  128. #if defined(TIM5)
  129. #define LL_APB1_GRP1_PERIPH_TIM5 RCC_APB1ENR_TIM5EN
  130. #endif /*TIM5*/
  131. #if defined(TIM6)
  132. #define LL_APB1_GRP1_PERIPH_TIM6 RCC_APB1ENR_TIM6EN
  133. #endif /*TIM6*/
  134. #if defined(TIM7)
  135. #define LL_APB1_GRP1_PERIPH_TIM7 RCC_APB1ENR_TIM7EN
  136. #endif /*TIM7*/
  137. #if defined(UART4)
  138. #define LL_APB1_GRP1_PERIPH_UART4 RCC_APB1ENR_UART4EN
  139. #endif /*UART4*/
  140. #if defined(UART5)
  141. #define LL_APB1_GRP1_PERIPH_UART5 RCC_APB1ENR_UART5EN
  142. #endif /*UART5*/
  143. #define LL_APB1_GRP1_PERIPH_USART2 RCC_APB1ENR_USART2EN
  144. #if defined(USART3)
  145. #define LL_APB1_GRP1_PERIPH_USART3 RCC_APB1ENR_USART3EN
  146. #endif /*USART3*/
  147. #if defined(USB)
  148. #define LL_APB1_GRP1_PERIPH_USB RCC_APB1ENR_USBEN
  149. #endif /*USB*/
  150. #define LL_APB1_GRP1_PERIPH_WWDG RCC_APB1ENR_WWDGEN
  151. /**
  152. * @}
  153. */
  154. /** @defgroup BUS_LL_EC_APB2_GRP1_PERIPH APB2 GRP1 PERIPH
  155. * @{
  156. */
  157. #define LL_APB2_GRP1_PERIPH_ALL (uint32_t)0xFFFFFFFFU
  158. #define LL_APB2_GRP1_PERIPH_ADC1 RCC_APB2ENR_ADC1EN
  159. #if defined(ADC2)
  160. #define LL_APB2_GRP1_PERIPH_ADC2 RCC_APB2ENR_ADC2EN
  161. #endif /*ADC2*/
  162. #if defined(ADC3)
  163. #define LL_APB2_GRP1_PERIPH_ADC3 RCC_APB2ENR_ADC3EN
  164. #endif /*ADC3*/
  165. #define LL_APB2_GRP1_PERIPH_AFIO RCC_APB2ENR_AFIOEN
  166. #define LL_APB2_GRP1_PERIPH_GPIOA RCC_APB2ENR_IOPAEN
  167. #define LL_APB2_GRP1_PERIPH_GPIOB RCC_APB2ENR_IOPBEN
  168. #define LL_APB2_GRP1_PERIPH_GPIOC RCC_APB2ENR_IOPCEN
  169. #define LL_APB2_GRP1_PERIPH_GPIOD RCC_APB2ENR_IOPDEN
  170. #if defined(GPIOE)
  171. #define LL_APB2_GRP1_PERIPH_GPIOE RCC_APB2ENR_IOPEEN
  172. #endif /*GPIOE*/
  173. #if defined(GPIOF)
  174. #define LL_APB2_GRP1_PERIPH_GPIOF RCC_APB2ENR_IOPFEN
  175. #endif /*GPIOF*/
  176. #if defined(GPIOG)
  177. #define LL_APB2_GRP1_PERIPH_GPIOG RCC_APB2ENR_IOPGEN
  178. #endif /*GPIOG*/
  179. #define LL_APB2_GRP1_PERIPH_SPI1 RCC_APB2ENR_SPI1EN
  180. #if defined(TIM10)
  181. #define LL_APB2_GRP1_PERIPH_TIM10 RCC_APB2ENR_TIM10EN
  182. #endif /*TIM10*/
  183. #if defined(TIM11)
  184. #define LL_APB2_GRP1_PERIPH_TIM11 RCC_APB2ENR_TIM11EN
  185. #endif /*TIM11*/
  186. #if defined(TIM15)
  187. #define LL_APB2_GRP1_PERIPH_TIM15 RCC_APB2ENR_TIM15EN
  188. #endif /*TIM15*/
  189. #if defined(TIM16)
  190. #define LL_APB2_GRP1_PERIPH_TIM16 RCC_APB2ENR_TIM16EN
  191. #endif /*TIM16*/
  192. #if defined(TIM17)
  193. #define LL_APB2_GRP1_PERIPH_TIM17 RCC_APB2ENR_TIM17EN
  194. #endif /*TIM17*/
  195. #define LL_APB2_GRP1_PERIPH_TIM1 RCC_APB2ENR_TIM1EN
  196. #if defined(TIM8)
  197. #define LL_APB2_GRP1_PERIPH_TIM8 RCC_APB2ENR_TIM8EN
  198. #endif /*TIM8*/
  199. #if defined(TIM9)
  200. #define LL_APB2_GRP1_PERIPH_TIM9 RCC_APB2ENR_TIM9EN
  201. #endif /*TIM9*/
  202. #define LL_APB2_GRP1_PERIPH_USART1 RCC_APB2ENR_USART1EN
  203. /**
  204. * @}
  205. */
  206. /**
  207. * @}
  208. */
  209. /* Exported macro ------------------------------------------------------------*/
  210. /* Exported functions --------------------------------------------------------*/
  211. /** @defgroup BUS_LL_Exported_Functions BUS Exported Functions
  212. * @{
  213. */
  214. /** @defgroup BUS_LL_EF_AHB1 AHB1
  215. * @{
  216. */
  217. /**
  218. * @brief Enable AHB1 peripherals clock.
  219. * @rmtoll AHBENR CRCEN LL_AHB1_GRP1_EnableClock\n
  220. * AHBENR DMA1EN LL_AHB1_GRP1_EnableClock\n
  221. * AHBENR DMA2EN LL_AHB1_GRP1_EnableClock\n
  222. * AHBENR ETHMACEN LL_AHB1_GRP1_EnableClock\n
  223. * AHBENR ETHMACRXEN LL_AHB1_GRP1_EnableClock\n
  224. * AHBENR ETHMACTXEN LL_AHB1_GRP1_EnableClock\n
  225. * AHBENR FLITFEN LL_AHB1_GRP1_EnableClock\n
  226. * AHBENR FSMCEN LL_AHB1_GRP1_EnableClock\n
  227. * AHBENR OTGFSEN LL_AHB1_GRP1_EnableClock\n
  228. * AHBENR SDIOEN LL_AHB1_GRP1_EnableClock\n
  229. * AHBENR SRAMEN LL_AHB1_GRP1_EnableClock
  230. * @param Periphs This parameter can be a combination of the following values:
  231. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  232. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  233. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 (*)
  234. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*)
  235. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*)
  236. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*)
  237. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  238. * @arg @ref LL_AHB1_GRP1_PERIPH_FSMC (*)
  239. * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*)
  240. * @arg @ref LL_AHB1_GRP1_PERIPH_SDIO (*)
  241. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  242. *
  243. * (*) value not defined in all devices.
  244. * @retval None
  245. */
  246. __STATIC_INLINE void LL_AHB1_GRP1_EnableClock(uint32_t Periphs)
  247. {
  248. __IO uint32_t tmpreg;
  249. SET_BIT(RCC->AHBENR, Periphs);
  250. /* Delay after an RCC peripheral clock enabling */
  251. tmpreg = READ_BIT(RCC->AHBENR, Periphs);
  252. (void)tmpreg;
  253. }
  254. /**
  255. * @brief Check if AHB1 peripheral clock is enabled or not
  256. * @rmtoll AHBENR CRCEN LL_AHB1_GRP1_IsEnabledClock\n
  257. * AHBENR DMA1EN LL_AHB1_GRP1_IsEnabledClock\n
  258. * AHBENR DMA2EN LL_AHB1_GRP1_IsEnabledClock\n
  259. * AHBENR ETHMACEN LL_AHB1_GRP1_IsEnabledClock\n
  260. * AHBENR ETHMACRXEN LL_AHB1_GRP1_IsEnabledClock\n
  261. * AHBENR ETHMACTXEN LL_AHB1_GRP1_IsEnabledClock\n
  262. * AHBENR FLITFEN LL_AHB1_GRP1_IsEnabledClock\n
  263. * AHBENR FSMCEN LL_AHB1_GRP1_IsEnabledClock\n
  264. * AHBENR OTGFSEN LL_AHB1_GRP1_IsEnabledClock\n
  265. * AHBENR SDIOEN LL_AHB1_GRP1_IsEnabledClock\n
  266. * AHBENR SRAMEN LL_AHB1_GRP1_IsEnabledClock
  267. * @param Periphs This parameter can be a combination of the following values:
  268. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  269. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  270. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 (*)
  271. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*)
  272. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*)
  273. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*)
  274. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  275. * @arg @ref LL_AHB1_GRP1_PERIPH_FSMC (*)
  276. * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*)
  277. * @arg @ref LL_AHB1_GRP1_PERIPH_SDIO (*)
  278. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  279. *
  280. * (*) value not defined in all devices.
  281. * @retval State of Periphs (1 or 0).
  282. */
  283. __STATIC_INLINE uint32_t LL_AHB1_GRP1_IsEnabledClock(uint32_t Periphs)
  284. {
  285. return (READ_BIT(RCC->AHBENR, Periphs) == Periphs);
  286. }
  287. /**
  288. * @brief Disable AHB1 peripherals clock.
  289. * @rmtoll AHBENR CRCEN LL_AHB1_GRP1_DisableClock\n
  290. * AHBENR DMA1EN LL_AHB1_GRP1_DisableClock\n
  291. * AHBENR DMA2EN LL_AHB1_GRP1_DisableClock\n
  292. * AHBENR ETHMACEN LL_AHB1_GRP1_DisableClock\n
  293. * AHBENR ETHMACRXEN LL_AHB1_GRP1_DisableClock\n
  294. * AHBENR ETHMACTXEN LL_AHB1_GRP1_DisableClock\n
  295. * AHBENR FLITFEN LL_AHB1_GRP1_DisableClock\n
  296. * AHBENR FSMCEN LL_AHB1_GRP1_DisableClock\n
  297. * AHBENR OTGFSEN LL_AHB1_GRP1_DisableClock\n
  298. * AHBENR SDIOEN LL_AHB1_GRP1_DisableClock\n
  299. * AHBENR SRAMEN LL_AHB1_GRP1_DisableClock
  300. * @param Periphs This parameter can be a combination of the following values:
  301. * @arg @ref LL_AHB1_GRP1_PERIPH_CRC
  302. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA1
  303. * @arg @ref LL_AHB1_GRP1_PERIPH_DMA2 (*)
  304. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*)
  305. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACRX (*)
  306. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMACTX (*)
  307. * @arg @ref LL_AHB1_GRP1_PERIPH_FLASH
  308. * @arg @ref LL_AHB1_GRP1_PERIPH_FSMC (*)
  309. * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*)
  310. * @arg @ref LL_AHB1_GRP1_PERIPH_SDIO (*)
  311. * @arg @ref LL_AHB1_GRP1_PERIPH_SRAM
  312. *
  313. * (*) value not defined in all devices.
  314. * @retval None
  315. */
  316. __STATIC_INLINE void LL_AHB1_GRP1_DisableClock(uint32_t Periphs)
  317. {
  318. CLEAR_BIT(RCC->AHBENR, Periphs);
  319. }
  320. #if defined(RCC_AHBRSTR_SUPPORT)
  321. /**
  322. * @brief Force AHB1 peripherals reset.
  323. * @rmtoll AHBRSTR ETHMACRST LL_AHB1_GRP1_ForceReset\n
  324. * AHBRSTR OTGFSRST LL_AHB1_GRP1_ForceReset
  325. * @param Periphs This parameter can be a combination of the following values:
  326. * @arg @ref LL_AHB1_GRP1_PERIPH_ALL
  327. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*)
  328. * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*)
  329. *
  330. * (*) value not defined in all devices.
  331. * @retval None
  332. */
  333. __STATIC_INLINE void LL_AHB1_GRP1_ForceReset(uint32_t Periphs)
  334. {
  335. SET_BIT(RCC->AHBRSTR, Periphs);
  336. }
  337. /**
  338. * @brief Release AHB1 peripherals reset.
  339. * @rmtoll AHBRSTR ETHMACRST LL_AHB1_GRP1_ReleaseReset\n
  340. * AHBRSTR OTGFSRST LL_AHB1_GRP1_ReleaseReset
  341. * @param Periphs This parameter can be a combination of the following values:
  342. * @arg @ref LL_AHB1_GRP1_PERIPH_ALL
  343. * @arg @ref LL_AHB1_GRP1_PERIPH_ETHMAC (*)
  344. * @arg @ref LL_AHB1_GRP1_PERIPH_OTGFS (*)
  345. *
  346. * (*) value not defined in all devices.
  347. * @retval None
  348. */
  349. __STATIC_INLINE void LL_AHB1_GRP1_ReleaseReset(uint32_t Periphs)
  350. {
  351. CLEAR_BIT(RCC->AHBRSTR, Periphs);
  352. }
  353. #endif /* RCC_AHBRSTR_SUPPORT */
  354. /**
  355. * @}
  356. */
  357. /** @defgroup BUS_LL_EF_APB1 APB1
  358. * @{
  359. */
  360. /**
  361. * @brief Enable APB1 peripherals clock.
  362. * @rmtoll APB1ENR BKPEN LL_APB1_GRP1_EnableClock\n
  363. * APB1ENR CAN1EN LL_APB1_GRP1_EnableClock\n
  364. * APB1ENR CAN2EN LL_APB1_GRP1_EnableClock\n
  365. * APB1ENR CECEN LL_APB1_GRP1_EnableClock\n
  366. * APB1ENR DACEN LL_APB1_GRP1_EnableClock\n
  367. * APB1ENR I2C1EN LL_APB1_GRP1_EnableClock\n
  368. * APB1ENR I2C2EN LL_APB1_GRP1_EnableClock\n
  369. * APB1ENR PWREN LL_APB1_GRP1_EnableClock\n
  370. * APB1ENR SPI2EN LL_APB1_GRP1_EnableClock\n
  371. * APB1ENR SPI3EN LL_APB1_GRP1_EnableClock\n
  372. * APB1ENR TIM12EN LL_APB1_GRP1_EnableClock\n
  373. * APB1ENR TIM13EN LL_APB1_GRP1_EnableClock\n
  374. * APB1ENR TIM14EN LL_APB1_GRP1_EnableClock\n
  375. * APB1ENR TIM2EN LL_APB1_GRP1_EnableClock\n
  376. * APB1ENR TIM3EN LL_APB1_GRP1_EnableClock\n
  377. * APB1ENR TIM4EN LL_APB1_GRP1_EnableClock\n
  378. * APB1ENR TIM5EN LL_APB1_GRP1_EnableClock\n
  379. * APB1ENR TIM6EN LL_APB1_GRP1_EnableClock\n
  380. * APB1ENR TIM7EN LL_APB1_GRP1_EnableClock\n
  381. * APB1ENR UART4EN LL_APB1_GRP1_EnableClock\n
  382. * APB1ENR UART5EN LL_APB1_GRP1_EnableClock\n
  383. * APB1ENR USART2EN LL_APB1_GRP1_EnableClock\n
  384. * APB1ENR USART3EN LL_APB1_GRP1_EnableClock\n
  385. * APB1ENR USBEN LL_APB1_GRP1_EnableClock\n
  386. * APB1ENR WWDGEN LL_APB1_GRP1_EnableClock
  387. * @param Periphs This parameter can be a combination of the following values:
  388. * @arg @ref LL_APB1_GRP1_PERIPH_BKP
  389. * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*)
  390. * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*)
  391. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*)
  392. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*)
  393. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  394. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*)
  395. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  396. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*)
  397. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*)
  398. * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*)
  399. * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*)
  400. * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*)
  401. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2
  402. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  403. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*)
  404. * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*)
  405. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*)
  406. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*)
  407. * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*)
  408. * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*)
  409. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  410. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*)
  411. * @arg @ref LL_APB1_GRP1_PERIPH_USB (*)
  412. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  413. *
  414. * (*) value not defined in all devices.
  415. * @retval None
  416. */
  417. __STATIC_INLINE void LL_APB1_GRP1_EnableClock(uint32_t Periphs)
  418. {
  419. __IO uint32_t tmpreg;
  420. SET_BIT(RCC->APB1ENR, Periphs);
  421. /* Delay after an RCC peripheral clock enabling */
  422. tmpreg = READ_BIT(RCC->APB1ENR, Periphs);
  423. (void)tmpreg;
  424. }
  425. /**
  426. * @brief Check if APB1 peripheral clock is enabled or not
  427. * @rmtoll APB1ENR BKPEN LL_APB1_GRP1_IsEnabledClock\n
  428. * APB1ENR CAN1EN LL_APB1_GRP1_IsEnabledClock\n
  429. * APB1ENR CAN2EN LL_APB1_GRP1_IsEnabledClock\n
  430. * APB1ENR CECEN LL_APB1_GRP1_IsEnabledClock\n
  431. * APB1ENR DACEN LL_APB1_GRP1_IsEnabledClock\n
  432. * APB1ENR I2C1EN LL_APB1_GRP1_IsEnabledClock\n
  433. * APB1ENR I2C2EN LL_APB1_GRP1_IsEnabledClock\n
  434. * APB1ENR PWREN LL_APB1_GRP1_IsEnabledClock\n
  435. * APB1ENR SPI2EN LL_APB1_GRP1_IsEnabledClock\n
  436. * APB1ENR SPI3EN LL_APB1_GRP1_IsEnabledClock\n
  437. * APB1ENR TIM12EN LL_APB1_GRP1_IsEnabledClock\n
  438. * APB1ENR TIM13EN LL_APB1_GRP1_IsEnabledClock\n
  439. * APB1ENR TIM14EN LL_APB1_GRP1_IsEnabledClock\n
  440. * APB1ENR TIM2EN LL_APB1_GRP1_IsEnabledClock\n
  441. * APB1ENR TIM3EN LL_APB1_GRP1_IsEnabledClock\n
  442. * APB1ENR TIM4EN LL_APB1_GRP1_IsEnabledClock\n
  443. * APB1ENR TIM5EN LL_APB1_GRP1_IsEnabledClock\n
  444. * APB1ENR TIM6EN LL_APB1_GRP1_IsEnabledClock\n
  445. * APB1ENR TIM7EN LL_APB1_GRP1_IsEnabledClock\n
  446. * APB1ENR UART4EN LL_APB1_GRP1_IsEnabledClock\n
  447. * APB1ENR UART5EN LL_APB1_GRP1_IsEnabledClock\n
  448. * APB1ENR USART2EN LL_APB1_GRP1_IsEnabledClock\n
  449. * APB1ENR USART3EN LL_APB1_GRP1_IsEnabledClock\n
  450. * APB1ENR USBEN LL_APB1_GRP1_IsEnabledClock\n
  451. * APB1ENR WWDGEN LL_APB1_GRP1_IsEnabledClock
  452. * @param Periphs This parameter can be a combination of the following values:
  453. * @arg @ref LL_APB1_GRP1_PERIPH_BKP
  454. * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*)
  455. * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*)
  456. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*)
  457. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*)
  458. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  459. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*)
  460. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  461. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*)
  462. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*)
  463. * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*)
  464. * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*)
  465. * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*)
  466. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2
  467. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  468. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*)
  469. * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*)
  470. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*)
  471. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*)
  472. * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*)
  473. * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*)
  474. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  475. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*)
  476. * @arg @ref LL_APB1_GRP1_PERIPH_USB (*)
  477. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  478. *
  479. * (*) value not defined in all devices.
  480. * @retval State of Periphs (1 or 0).
  481. */
  482. __STATIC_INLINE uint32_t LL_APB1_GRP1_IsEnabledClock(uint32_t Periphs)
  483. {
  484. return (READ_BIT(RCC->APB1ENR, Periphs) == Periphs);
  485. }
  486. /**
  487. * @brief Disable APB1 peripherals clock.
  488. * @rmtoll APB1ENR BKPEN LL_APB1_GRP1_DisableClock\n
  489. * APB1ENR CAN1EN LL_APB1_GRP1_DisableClock\n
  490. * APB1ENR CAN2EN LL_APB1_GRP1_DisableClock\n
  491. * APB1ENR CECEN LL_APB1_GRP1_DisableClock\n
  492. * APB1ENR DACEN LL_APB1_GRP1_DisableClock\n
  493. * APB1ENR I2C1EN LL_APB1_GRP1_DisableClock\n
  494. * APB1ENR I2C2EN LL_APB1_GRP1_DisableClock\n
  495. * APB1ENR PWREN LL_APB1_GRP1_DisableClock\n
  496. * APB1ENR SPI2EN LL_APB1_GRP1_DisableClock\n
  497. * APB1ENR SPI3EN LL_APB1_GRP1_DisableClock\n
  498. * APB1ENR TIM12EN LL_APB1_GRP1_DisableClock\n
  499. * APB1ENR TIM13EN LL_APB1_GRP1_DisableClock\n
  500. * APB1ENR TIM14EN LL_APB1_GRP1_DisableClock\n
  501. * APB1ENR TIM2EN LL_APB1_GRP1_DisableClock\n
  502. * APB1ENR TIM3EN LL_APB1_GRP1_DisableClock\n
  503. * APB1ENR TIM4EN LL_APB1_GRP1_DisableClock\n
  504. * APB1ENR TIM5EN LL_APB1_GRP1_DisableClock\n
  505. * APB1ENR TIM6EN LL_APB1_GRP1_DisableClock\n
  506. * APB1ENR TIM7EN LL_APB1_GRP1_DisableClock\n
  507. * APB1ENR UART4EN LL_APB1_GRP1_DisableClock\n
  508. * APB1ENR UART5EN LL_APB1_GRP1_DisableClock\n
  509. * APB1ENR USART2EN LL_APB1_GRP1_DisableClock\n
  510. * APB1ENR USART3EN LL_APB1_GRP1_DisableClock\n
  511. * APB1ENR USBEN LL_APB1_GRP1_DisableClock\n
  512. * APB1ENR WWDGEN LL_APB1_GRP1_DisableClock
  513. * @param Periphs This parameter can be a combination of the following values:
  514. * @arg @ref LL_APB1_GRP1_PERIPH_BKP
  515. * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*)
  516. * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*)
  517. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*)
  518. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*)
  519. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  520. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*)
  521. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  522. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*)
  523. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*)
  524. * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*)
  525. * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*)
  526. * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*)
  527. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2
  528. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  529. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*)
  530. * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*)
  531. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*)
  532. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*)
  533. * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*)
  534. * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*)
  535. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  536. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*)
  537. * @arg @ref LL_APB1_GRP1_PERIPH_USB (*)
  538. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  539. *
  540. * (*) value not defined in all devices.
  541. * @retval None
  542. */
  543. __STATIC_INLINE void LL_APB1_GRP1_DisableClock(uint32_t Periphs)
  544. {
  545. CLEAR_BIT(RCC->APB1ENR, Periphs);
  546. }
  547. /**
  548. * @brief Force APB1 peripherals reset.
  549. * @rmtoll APB1RSTR BKPRST LL_APB1_GRP1_ForceReset\n
  550. * APB1RSTR CAN1RST LL_APB1_GRP1_ForceReset\n
  551. * APB1RSTR CAN2RST LL_APB1_GRP1_ForceReset\n
  552. * APB1RSTR CECRST LL_APB1_GRP1_ForceReset\n
  553. * APB1RSTR DACRST LL_APB1_GRP1_ForceReset\n
  554. * APB1RSTR I2C1RST LL_APB1_GRP1_ForceReset\n
  555. * APB1RSTR I2C2RST LL_APB1_GRP1_ForceReset\n
  556. * APB1RSTR PWRRST LL_APB1_GRP1_ForceReset\n
  557. * APB1RSTR SPI2RST LL_APB1_GRP1_ForceReset\n
  558. * APB1RSTR SPI3RST LL_APB1_GRP1_ForceReset\n
  559. * APB1RSTR TIM12RST LL_APB1_GRP1_ForceReset\n
  560. * APB1RSTR TIM13RST LL_APB1_GRP1_ForceReset\n
  561. * APB1RSTR TIM14RST LL_APB1_GRP1_ForceReset\n
  562. * APB1RSTR TIM2RST LL_APB1_GRP1_ForceReset\n
  563. * APB1RSTR TIM3RST LL_APB1_GRP1_ForceReset\n
  564. * APB1RSTR TIM4RST LL_APB1_GRP1_ForceReset\n
  565. * APB1RSTR TIM5RST LL_APB1_GRP1_ForceReset\n
  566. * APB1RSTR TIM6RST LL_APB1_GRP1_ForceReset\n
  567. * APB1RSTR TIM7RST LL_APB1_GRP1_ForceReset\n
  568. * APB1RSTR UART4RST LL_APB1_GRP1_ForceReset\n
  569. * APB1RSTR UART5RST LL_APB1_GRP1_ForceReset\n
  570. * APB1RSTR USART2RST LL_APB1_GRP1_ForceReset\n
  571. * APB1RSTR USART3RST LL_APB1_GRP1_ForceReset\n
  572. * APB1RSTR USBRST LL_APB1_GRP1_ForceReset\n
  573. * APB1RSTR WWDGRST LL_APB1_GRP1_ForceReset
  574. * @param Periphs This parameter can be a combination of the following values:
  575. * @arg @ref LL_APB1_GRP1_PERIPH_ALL
  576. * @arg @ref LL_APB1_GRP1_PERIPH_BKP
  577. * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*)
  578. * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*)
  579. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*)
  580. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*)
  581. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  582. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*)
  583. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  584. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*)
  585. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*)
  586. * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*)
  587. * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*)
  588. * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*)
  589. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2
  590. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  591. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*)
  592. * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*)
  593. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*)
  594. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*)
  595. * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*)
  596. * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*)
  597. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  598. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*)
  599. * @arg @ref LL_APB1_GRP1_PERIPH_USB (*)
  600. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  601. *
  602. * (*) value not defined in all devices.
  603. * @retval None
  604. */
  605. __STATIC_INLINE void LL_APB1_GRP1_ForceReset(uint32_t Periphs)
  606. {
  607. SET_BIT(RCC->APB1RSTR, Periphs);
  608. }
  609. /**
  610. * @brief Release APB1 peripherals reset.
  611. * @rmtoll APB1RSTR BKPRST LL_APB1_GRP1_ReleaseReset\n
  612. * APB1RSTR CAN1RST LL_APB1_GRP1_ReleaseReset\n
  613. * APB1RSTR CAN2RST LL_APB1_GRP1_ReleaseReset\n
  614. * APB1RSTR CECRST LL_APB1_GRP1_ReleaseReset\n
  615. * APB1RSTR DACRST LL_APB1_GRP1_ReleaseReset\n
  616. * APB1RSTR I2C1RST LL_APB1_GRP1_ReleaseReset\n
  617. * APB1RSTR I2C2RST LL_APB1_GRP1_ReleaseReset\n
  618. * APB1RSTR PWRRST LL_APB1_GRP1_ReleaseReset\n
  619. * APB1RSTR SPI2RST LL_APB1_GRP1_ReleaseReset\n
  620. * APB1RSTR SPI3RST LL_APB1_GRP1_ReleaseReset\n
  621. * APB1RSTR TIM12RST LL_APB1_GRP1_ReleaseReset\n
  622. * APB1RSTR TIM13RST LL_APB1_GRP1_ReleaseReset\n
  623. * APB1RSTR TIM14RST LL_APB1_GRP1_ReleaseReset\n
  624. * APB1RSTR TIM2RST LL_APB1_GRP1_ReleaseReset\n
  625. * APB1RSTR TIM3RST LL_APB1_GRP1_ReleaseReset\n
  626. * APB1RSTR TIM4RST LL_APB1_GRP1_ReleaseReset\n
  627. * APB1RSTR TIM5RST LL_APB1_GRP1_ReleaseReset\n
  628. * APB1RSTR TIM6RST LL_APB1_GRP1_ReleaseReset\n
  629. * APB1RSTR TIM7RST LL_APB1_GRP1_ReleaseReset\n
  630. * APB1RSTR UART4RST LL_APB1_GRP1_ReleaseReset\n
  631. * APB1RSTR UART5RST LL_APB1_GRP1_ReleaseReset\n
  632. * APB1RSTR USART2RST LL_APB1_GRP1_ReleaseReset\n
  633. * APB1RSTR USART3RST LL_APB1_GRP1_ReleaseReset\n
  634. * APB1RSTR USBRST LL_APB1_GRP1_ReleaseReset\n
  635. * APB1RSTR WWDGRST LL_APB1_GRP1_ReleaseReset
  636. * @param Periphs This parameter can be a combination of the following values:
  637. * @arg @ref LL_APB1_GRP1_PERIPH_ALL
  638. * @arg @ref LL_APB1_GRP1_PERIPH_BKP
  639. * @arg @ref LL_APB1_GRP1_PERIPH_CAN1 (*)
  640. * @arg @ref LL_APB1_GRP1_PERIPH_CAN2 (*)
  641. * @arg @ref LL_APB1_GRP1_PERIPH_CEC (*)
  642. * @arg @ref LL_APB1_GRP1_PERIPH_DAC1 (*)
  643. * @arg @ref LL_APB1_GRP1_PERIPH_I2C1
  644. * @arg @ref LL_APB1_GRP1_PERIPH_I2C2 (*)
  645. * @arg @ref LL_APB1_GRP1_PERIPH_PWR
  646. * @arg @ref LL_APB1_GRP1_PERIPH_SPI2 (*)
  647. * @arg @ref LL_APB1_GRP1_PERIPH_SPI3 (*)
  648. * @arg @ref LL_APB1_GRP1_PERIPH_TIM12 (*)
  649. * @arg @ref LL_APB1_GRP1_PERIPH_TIM13 (*)
  650. * @arg @ref LL_APB1_GRP1_PERIPH_TIM14 (*)
  651. * @arg @ref LL_APB1_GRP1_PERIPH_TIM2
  652. * @arg @ref LL_APB1_GRP1_PERIPH_TIM3
  653. * @arg @ref LL_APB1_GRP1_PERIPH_TIM4 (*)
  654. * @arg @ref LL_APB1_GRP1_PERIPH_TIM5 (*)
  655. * @arg @ref LL_APB1_GRP1_PERIPH_TIM6 (*)
  656. * @arg @ref LL_APB1_GRP1_PERIPH_TIM7 (*)
  657. * @arg @ref LL_APB1_GRP1_PERIPH_UART4 (*)
  658. * @arg @ref LL_APB1_GRP1_PERIPH_UART5 (*)
  659. * @arg @ref LL_APB1_GRP1_PERIPH_USART2
  660. * @arg @ref LL_APB1_GRP1_PERIPH_USART3 (*)
  661. * @arg @ref LL_APB1_GRP1_PERIPH_USB (*)
  662. * @arg @ref LL_APB1_GRP1_PERIPH_WWDG
  663. *
  664. * (*) value not defined in all devices.
  665. * @retval None
  666. */
  667. __STATIC_INLINE void LL_APB1_GRP1_ReleaseReset(uint32_t Periphs)
  668. {
  669. CLEAR_BIT(RCC->APB1RSTR, Periphs);
  670. }
  671. /**
  672. * @}
  673. */
  674. /** @defgroup BUS_LL_EF_APB2 APB2
  675. * @{
  676. */
  677. /**
  678. * @brief Enable APB2 peripherals clock.
  679. * @rmtoll APB2ENR ADC1EN LL_APB2_GRP1_EnableClock\n
  680. * APB2ENR ADC2EN LL_APB2_GRP1_EnableClock\n
  681. * APB2ENR ADC3EN LL_APB2_GRP1_EnableClock\n
  682. * APB2ENR AFIOEN LL_APB2_GRP1_EnableClock\n
  683. * APB2ENR IOPAEN LL_APB2_GRP1_EnableClock\n
  684. * APB2ENR IOPBEN LL_APB2_GRP1_EnableClock\n
  685. * APB2ENR IOPCEN LL_APB2_GRP1_EnableClock\n
  686. * APB2ENR IOPDEN LL_APB2_GRP1_EnableClock\n
  687. * APB2ENR IOPEEN LL_APB2_GRP1_EnableClock\n
  688. * APB2ENR IOPFEN LL_APB2_GRP1_EnableClock\n
  689. * APB2ENR IOPGEN LL_APB2_GRP1_EnableClock\n
  690. * APB2ENR SPI1EN LL_APB2_GRP1_EnableClock\n
  691. * APB2ENR TIM10EN LL_APB2_GRP1_EnableClock\n
  692. * APB2ENR TIM11EN LL_APB2_GRP1_EnableClock\n
  693. * APB2ENR TIM15EN LL_APB2_GRP1_EnableClock\n
  694. * APB2ENR TIM16EN LL_APB2_GRP1_EnableClock\n
  695. * APB2ENR TIM17EN LL_APB2_GRP1_EnableClock\n
  696. * APB2ENR TIM1EN LL_APB2_GRP1_EnableClock\n
  697. * APB2ENR TIM8EN LL_APB2_GRP1_EnableClock\n
  698. * APB2ENR TIM9EN LL_APB2_GRP1_EnableClock\n
  699. * APB2ENR USART1EN LL_APB2_GRP1_EnableClock
  700. * @param Periphs This parameter can be a combination of the following values:
  701. * @arg @ref LL_APB2_GRP1_PERIPH_ADC1
  702. * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*)
  703. * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*)
  704. * @arg @ref LL_APB2_GRP1_PERIPH_AFIO
  705. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA
  706. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB
  707. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC
  708. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD
  709. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*)
  710. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*)
  711. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*)
  712. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  713. * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*)
  714. * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*)
  715. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  716. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*)
  717. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*)
  718. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  719. * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*)
  720. * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*)
  721. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  722. *
  723. * (*) value not defined in all devices.
  724. * @retval None
  725. */
  726. __STATIC_INLINE void LL_APB2_GRP1_EnableClock(uint32_t Periphs)
  727. {
  728. __IO uint32_t tmpreg;
  729. SET_BIT(RCC->APB2ENR, Periphs);
  730. /* Delay after an RCC peripheral clock enabling */
  731. tmpreg = READ_BIT(RCC->APB2ENR, Periphs);
  732. (void)tmpreg;
  733. }
  734. /**
  735. * @brief Check if APB2 peripheral clock is enabled or not
  736. * @rmtoll APB2ENR ADC1EN LL_APB2_GRP1_IsEnabledClock\n
  737. * APB2ENR ADC2EN LL_APB2_GRP1_IsEnabledClock\n
  738. * APB2ENR ADC3EN LL_APB2_GRP1_IsEnabledClock\n
  739. * APB2ENR AFIOEN LL_APB2_GRP1_IsEnabledClock\n
  740. * APB2ENR IOPAEN LL_APB2_GRP1_IsEnabledClock\n
  741. * APB2ENR IOPBEN LL_APB2_GRP1_IsEnabledClock\n
  742. * APB2ENR IOPCEN LL_APB2_GRP1_IsEnabledClock\n
  743. * APB2ENR IOPDEN LL_APB2_GRP1_IsEnabledClock\n
  744. * APB2ENR IOPEEN LL_APB2_GRP1_IsEnabledClock\n
  745. * APB2ENR IOPFEN LL_APB2_GRP1_IsEnabledClock\n
  746. * APB2ENR IOPGEN LL_APB2_GRP1_IsEnabledClock\n
  747. * APB2ENR SPI1EN LL_APB2_GRP1_IsEnabledClock\n
  748. * APB2ENR TIM10EN LL_APB2_GRP1_IsEnabledClock\n
  749. * APB2ENR TIM11EN LL_APB2_GRP1_IsEnabledClock\n
  750. * APB2ENR TIM15EN LL_APB2_GRP1_IsEnabledClock\n
  751. * APB2ENR TIM16EN LL_APB2_GRP1_IsEnabledClock\n
  752. * APB2ENR TIM17EN LL_APB2_GRP1_IsEnabledClock\n
  753. * APB2ENR TIM1EN LL_APB2_GRP1_IsEnabledClock\n
  754. * APB2ENR TIM8EN LL_APB2_GRP1_IsEnabledClock\n
  755. * APB2ENR TIM9EN LL_APB2_GRP1_IsEnabledClock\n
  756. * APB2ENR USART1EN LL_APB2_GRP1_IsEnabledClock
  757. * @param Periphs This parameter can be a combination of the following values:
  758. * @arg @ref LL_APB2_GRP1_PERIPH_ADC1
  759. * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*)
  760. * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*)
  761. * @arg @ref LL_APB2_GRP1_PERIPH_AFIO
  762. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA
  763. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB
  764. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC
  765. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD
  766. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*)
  767. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*)
  768. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*)
  769. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  770. * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*)
  771. * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*)
  772. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  773. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*)
  774. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*)
  775. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  776. * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*)
  777. * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*)
  778. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  779. *
  780. * (*) value not defined in all devices.
  781. * @retval State of Periphs (1 or 0).
  782. */
  783. __STATIC_INLINE uint32_t LL_APB2_GRP1_IsEnabledClock(uint32_t Periphs)
  784. {
  785. return (READ_BIT(RCC->APB2ENR, Periphs) == Periphs);
  786. }
  787. /**
  788. * @brief Disable APB2 peripherals clock.
  789. * @rmtoll APB2ENR ADC1EN LL_APB2_GRP1_DisableClock\n
  790. * APB2ENR ADC2EN LL_APB2_GRP1_DisableClock\n
  791. * APB2ENR ADC3EN LL_APB2_GRP1_DisableClock\n
  792. * APB2ENR AFIOEN LL_APB2_GRP1_DisableClock\n
  793. * APB2ENR IOPAEN LL_APB2_GRP1_DisableClock\n
  794. * APB2ENR IOPBEN LL_APB2_GRP1_DisableClock\n
  795. * APB2ENR IOPCEN LL_APB2_GRP1_DisableClock\n
  796. * APB2ENR IOPDEN LL_APB2_GRP1_DisableClock\n
  797. * APB2ENR IOPEEN LL_APB2_GRP1_DisableClock\n
  798. * APB2ENR IOPFEN LL_APB2_GRP1_DisableClock\n
  799. * APB2ENR IOPGEN LL_APB2_GRP1_DisableClock\n
  800. * APB2ENR SPI1EN LL_APB2_GRP1_DisableClock\n
  801. * APB2ENR TIM10EN LL_APB2_GRP1_DisableClock\n
  802. * APB2ENR TIM11EN LL_APB2_GRP1_DisableClock\n
  803. * APB2ENR TIM15EN LL_APB2_GRP1_DisableClock\n
  804. * APB2ENR TIM16EN LL_APB2_GRP1_DisableClock\n
  805. * APB2ENR TIM17EN LL_APB2_GRP1_DisableClock\n
  806. * APB2ENR TIM1EN LL_APB2_GRP1_DisableClock\n
  807. * APB2ENR TIM8EN LL_APB2_GRP1_DisableClock\n
  808. * APB2ENR TIM9EN LL_APB2_GRP1_DisableClock\n
  809. * APB2ENR USART1EN LL_APB2_GRP1_DisableClock
  810. * @param Periphs This parameter can be a combination of the following values:
  811. * @arg @ref LL_APB2_GRP1_PERIPH_ADC1
  812. * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*)
  813. * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*)
  814. * @arg @ref LL_APB2_GRP1_PERIPH_AFIO
  815. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA
  816. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB
  817. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC
  818. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD
  819. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*)
  820. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*)
  821. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*)
  822. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  823. * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*)
  824. * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*)
  825. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  826. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*)
  827. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*)
  828. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  829. * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*)
  830. * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*)
  831. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  832. *
  833. * (*) value not defined in all devices.
  834. * @retval None
  835. */
  836. __STATIC_INLINE void LL_APB2_GRP1_DisableClock(uint32_t Periphs)
  837. {
  838. CLEAR_BIT(RCC->APB2ENR, Periphs);
  839. }
  840. /**
  841. * @brief Force APB2 peripherals reset.
  842. * @rmtoll APB2RSTR ADC1RST LL_APB2_GRP1_ForceReset\n
  843. * APB2RSTR ADC2RST LL_APB2_GRP1_ForceReset\n
  844. * APB2RSTR ADC3RST LL_APB2_GRP1_ForceReset\n
  845. * APB2RSTR AFIORST LL_APB2_GRP1_ForceReset\n
  846. * APB2RSTR IOPARST LL_APB2_GRP1_ForceReset\n
  847. * APB2RSTR IOPBRST LL_APB2_GRP1_ForceReset\n
  848. * APB2RSTR IOPCRST LL_APB2_GRP1_ForceReset\n
  849. * APB2RSTR IOPDRST LL_APB2_GRP1_ForceReset\n
  850. * APB2RSTR IOPERST LL_APB2_GRP1_ForceReset\n
  851. * APB2RSTR IOPFRST LL_APB2_GRP1_ForceReset\n
  852. * APB2RSTR IOPGRST LL_APB2_GRP1_ForceReset\n
  853. * APB2RSTR SPI1RST LL_APB2_GRP1_ForceReset\n
  854. * APB2RSTR TIM10RST LL_APB2_GRP1_ForceReset\n
  855. * APB2RSTR TIM11RST LL_APB2_GRP1_ForceReset\n
  856. * APB2RSTR TIM15RST LL_APB2_GRP1_ForceReset\n
  857. * APB2RSTR TIM16RST LL_APB2_GRP1_ForceReset\n
  858. * APB2RSTR TIM17RST LL_APB2_GRP1_ForceReset\n
  859. * APB2RSTR TIM1RST LL_APB2_GRP1_ForceReset\n
  860. * APB2RSTR TIM8RST LL_APB2_GRP1_ForceReset\n
  861. * APB2RSTR TIM9RST LL_APB2_GRP1_ForceReset\n
  862. * APB2RSTR USART1RST LL_APB2_GRP1_ForceReset
  863. * @param Periphs This parameter can be a combination of the following values:
  864. * @arg @ref LL_APB2_GRP1_PERIPH_ALL
  865. * @arg @ref LL_APB2_GRP1_PERIPH_ADC1
  866. * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*)
  867. * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*)
  868. * @arg @ref LL_APB2_GRP1_PERIPH_AFIO
  869. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA
  870. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB
  871. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC
  872. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD
  873. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*)
  874. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*)
  875. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*)
  876. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  877. * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*)
  878. * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*)
  879. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  880. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*)
  881. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*)
  882. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  883. * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*)
  884. * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*)
  885. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  886. *
  887. * (*) value not defined in all devices.
  888. * @retval None
  889. */
  890. __STATIC_INLINE void LL_APB2_GRP1_ForceReset(uint32_t Periphs)
  891. {
  892. SET_BIT(RCC->APB2RSTR, Periphs);
  893. }
  894. /**
  895. * @brief Release APB2 peripherals reset.
  896. * @rmtoll APB2RSTR ADC1RST LL_APB2_GRP1_ReleaseReset\n
  897. * APB2RSTR ADC2RST LL_APB2_GRP1_ReleaseReset\n
  898. * APB2RSTR ADC3RST LL_APB2_GRP1_ReleaseReset\n
  899. * APB2RSTR AFIORST LL_APB2_GRP1_ReleaseReset\n
  900. * APB2RSTR IOPARST LL_APB2_GRP1_ReleaseReset\n
  901. * APB2RSTR IOPBRST LL_APB2_GRP1_ReleaseReset\n
  902. * APB2RSTR IOPCRST LL_APB2_GRP1_ReleaseReset\n
  903. * APB2RSTR IOPDRST LL_APB2_GRP1_ReleaseReset\n
  904. * APB2RSTR IOPERST LL_APB2_GRP1_ReleaseReset\n
  905. * APB2RSTR IOPFRST LL_APB2_GRP1_ReleaseReset\n
  906. * APB2RSTR IOPGRST LL_APB2_GRP1_ReleaseReset\n
  907. * APB2RSTR SPI1RST LL_APB2_GRP1_ReleaseReset\n
  908. * APB2RSTR TIM10RST LL_APB2_GRP1_ReleaseReset\n
  909. * APB2RSTR TIM11RST LL_APB2_GRP1_ReleaseReset\n
  910. * APB2RSTR TIM15RST LL_APB2_GRP1_ReleaseReset\n
  911. * APB2RSTR TIM16RST LL_APB2_GRP1_ReleaseReset\n
  912. * APB2RSTR TIM17RST LL_APB2_GRP1_ReleaseReset\n
  913. * APB2RSTR TIM1RST LL_APB2_GRP1_ReleaseReset\n
  914. * APB2RSTR TIM8RST LL_APB2_GRP1_ReleaseReset\n
  915. * APB2RSTR TIM9RST LL_APB2_GRP1_ReleaseReset\n
  916. * APB2RSTR USART1RST LL_APB2_GRP1_ReleaseReset
  917. * @param Periphs This parameter can be a combination of the following values:
  918. * @arg @ref LL_APB2_GRP1_PERIPH_ALL
  919. * @arg @ref LL_APB2_GRP1_PERIPH_ADC1
  920. * @arg @ref LL_APB2_GRP1_PERIPH_ADC2 (*)
  921. * @arg @ref LL_APB2_GRP1_PERIPH_ADC3 (*)
  922. * @arg @ref LL_APB2_GRP1_PERIPH_AFIO
  923. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOA
  924. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOB
  925. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOC
  926. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOD
  927. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOE (*)
  928. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOF (*)
  929. * @arg @ref LL_APB2_GRP1_PERIPH_GPIOG (*)
  930. * @arg @ref LL_APB2_GRP1_PERIPH_SPI1
  931. * @arg @ref LL_APB2_GRP1_PERIPH_TIM10 (*)
  932. * @arg @ref LL_APB2_GRP1_PERIPH_TIM11 (*)
  933. * @arg @ref LL_APB2_GRP1_PERIPH_TIM15 (*)
  934. * @arg @ref LL_APB2_GRP1_PERIPH_TIM16 (*)
  935. * @arg @ref LL_APB2_GRP1_PERIPH_TIM17 (*)
  936. * @arg @ref LL_APB2_GRP1_PERIPH_TIM1
  937. * @arg @ref LL_APB2_GRP1_PERIPH_TIM8 (*)
  938. * @arg @ref LL_APB2_GRP1_PERIPH_TIM9 (*)
  939. * @arg @ref LL_APB2_GRP1_PERIPH_USART1
  940. *
  941. * (*) value not defined in all devices.
  942. * @retval None
  943. */
  944. __STATIC_INLINE void LL_APB2_GRP1_ReleaseReset(uint32_t Periphs)
  945. {
  946. CLEAR_BIT(RCC->APB2RSTR, Periphs);
  947. }
  948. /**
  949. * @}
  950. */
  951. /**
  952. * @}
  953. */
  954. /**
  955. * @}
  956. */
  957. #endif /* defined(RCC) */
  958. /**
  959. * @}
  960. */
  961. #ifdef __cplusplus
  962. }
  963. #endif
  964. #endif /* __STM32F1xx_LL_BUS_H */