stm32_rcc.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file STM32L1xx/stm32_rcc.h
  15. * @brief RCC helper driver header.
  16. * @note This file requires definitions from the ST header file
  17. * @p stm32l1xx.h.
  18. *
  19. * @addtogroup STM32L1xx_RCC
  20. * @{
  21. */
  22. #ifndef STM32_RCC_H
  23. #define STM32_RCC_H
  24. /*===========================================================================*/
  25. /* Driver constants. */
  26. /*===========================================================================*/
  27. /*===========================================================================*/
  28. /* Driver pre-compile time settings. */
  29. /*===========================================================================*/
  30. /*===========================================================================*/
  31. /* Derived constants and error checks. */
  32. /*===========================================================================*/
  33. /*===========================================================================*/
  34. /* Driver data structures and types. */
  35. /*===========================================================================*/
  36. /*===========================================================================*/
  37. /* Driver macros. */
  38. /*===========================================================================*/
  39. /**
  40. * @name Generic RCC operations
  41. * @{
  42. */
  43. /**
  44. * @brief Enables the clock of one or more peripheral on the APB1 bus.
  45. *
  46. * @param[in] mask APB1 peripherals mask
  47. * @param[in] lp low power enable flag
  48. *
  49. * @api
  50. */
  51. #define rccEnableAPB1(mask, lp) { \
  52. RCC->APB1ENR |= (mask); \
  53. if (lp) \
  54. RCC->APB1LPENR |= (mask); \
  55. else \
  56. RCC->APB1LPENR &= ~(mask); \
  57. (void)RCC->APB1LPENR; \
  58. }
  59. /**
  60. * @brief Disables the clock of one or more peripheral on the APB1 bus.
  61. *
  62. * @param[in] mask APB1 peripherals mask
  63. *
  64. * @api
  65. */
  66. #define rccDisableAPB1(mask) { \
  67. RCC->APB1ENR &= ~(mask); \
  68. RCC->APB1LPENR &= ~(mask); \
  69. (void)RCC->APB1LPENR; \
  70. }
  71. /**
  72. * @brief Resets one or more peripheral on the APB1 bus.
  73. *
  74. * @param[in] mask APB1 peripherals mask
  75. *
  76. * @api
  77. */
  78. #define rccResetAPB1(mask) { \
  79. RCC->APB1RSTR |= (mask); \
  80. RCC->APB1RSTR &= ~(mask); \
  81. (void)RCC->APB1RSTR; \
  82. }
  83. /**
  84. * @brief Enables the clock of one or more peripheral on the APB2 bus.
  85. *
  86. * @param[in] mask APB2 peripherals mask
  87. * @param[in] lp low power enable flag
  88. *
  89. * @api
  90. */
  91. #define rccEnableAPB2(mask, lp) { \
  92. RCC->APB2ENR |= (mask); \
  93. if (lp) \
  94. RCC->APB2LPENR |= (mask); \
  95. else \
  96. RCC->APB2LPENR &= ~(mask); \
  97. (void)RCC->APB2LPENR; \
  98. }
  99. /**
  100. * @brief Disables the clock of one or more peripheral on the APB2 bus.
  101. *
  102. * @param[in] mask APB2 peripherals mask
  103. *
  104. * @api
  105. */
  106. #define rccDisableAPB2(mask) { \
  107. RCC->APB2ENR &= ~(mask); \
  108. RCC->APB2LPENR &= ~(mask); \
  109. (void)RCC->APB2LPENR; \
  110. }
  111. /**
  112. * @brief Resets one or more peripheral on the APB2 bus.
  113. *
  114. * @param[in] mask APB2 peripherals mask
  115. *
  116. * @api
  117. */
  118. #define rccResetAPB2(mask) { \
  119. RCC->APB2RSTR |= (mask); \
  120. RCC->APB2RSTR &= ~(mask); \
  121. (void)RCC->APB2RSTR; \
  122. }
  123. /**
  124. * @brief Enables the clock of one or more peripheral on the AHB bus.
  125. *
  126. * @param[in] mask AHB peripherals mask
  127. * @param[in] lp low power enable flag
  128. *
  129. * @api
  130. */
  131. #define rccEnableAHB(mask, lp) { \
  132. RCC->AHBENR |= (mask); \
  133. if (lp) \
  134. RCC->AHBLPENR |= (mask); \
  135. else \
  136. RCC->AHBLPENR &= ~(mask); \
  137. (void)RCC->AHBLPENR; \
  138. }
  139. /**
  140. * @brief Disables the clock of one or more peripheral on the AHB bus.
  141. *
  142. * @param[in] mask AHB peripherals mask
  143. *
  144. * @api
  145. */
  146. #define rccDisableAHB(mask) { \
  147. RCC->AHBENR &= ~(mask); \
  148. RCC->AHBLPENR &= ~(mask); \
  149. (void)RCC->AHBLPENR; \
  150. }
  151. /**
  152. * @brief Resets one or more peripheral on the AHB bus.
  153. *
  154. * @param[in] mask AHB peripherals mask
  155. *
  156. * @api
  157. */
  158. #define rccResetAHB(mask) { \
  159. RCC->AHBRSTR |= (mask); \
  160. RCC->AHBRSTR &= ~(mask); \
  161. (void)RCC->AHBRSTR; \
  162. }
  163. /** @} */
  164. /**
  165. * @name ADC peripherals specific RCC operations
  166. * @{
  167. */
  168. /**
  169. * @brief Enables the ADC1 peripheral clock.
  170. *
  171. * @param[in] lp low power enable flag
  172. *
  173. * @api
  174. */
  175. #define rccEnableADC1(lp) rccEnableAPB2(RCC_APB2ENR_ADC1EN, lp)
  176. /**
  177. * @brief Disables the ADC1 peripheral clock.
  178. *
  179. * @api
  180. */
  181. #define rccDisableADC1() rccDisableAPB2(RCC_APB2ENR_ADC1EN)
  182. /**
  183. * @brief Resets the ADC1 peripheral.
  184. *
  185. * @api
  186. */
  187. #define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST)
  188. /** @} */
  189. /**
  190. * @name DAC peripheral specific RCC operations
  191. * @{
  192. */
  193. /**
  194. * @brief Enables the DAC1 peripheral clock.
  195. *
  196. * @param[in] lp low power enable flag
  197. *
  198. * @api
  199. */
  200. #define rccEnableDAC1(lp) rccEnableAPB1(RCC_APB1ENR_DACEN, lp)
  201. /**
  202. * @brief Disables the DAC1 peripheral clock.
  203. *
  204. * @api
  205. */
  206. #define rccDisableDAC1() rccDisableAPB1(RCC_APB1ENR_DACEN)
  207. /**
  208. * @brief Resets the DAC1 peripheral.
  209. *
  210. * @api
  211. */
  212. #define rccResetDAC1() rccResetAPB1(RCC_APB1RSTR_DACRST)
  213. /** @} */
  214. /**
  215. * @name DMA peripheral specific RCC operations
  216. * @{
  217. */
  218. /**
  219. * @brief Enables the DMA1 peripheral clock.
  220. *
  221. * @param[in] lp low power enable flag
  222. *
  223. * @api
  224. */
  225. #define rccEnableDMA1(lp) rccEnableAHB(RCC_AHBENR_DMA1EN, lp)
  226. /**
  227. * @brief Disables the DMA1 peripheral clock.
  228. *
  229. * @api
  230. */
  231. #define rccDisableDMA1() rccDisableAHB(RCC_AHBENR_DMA1EN)
  232. /**
  233. * @brief Resets the DMA1 peripheral.
  234. *
  235. * @api
  236. */
  237. #define rccResetDMA1() rccResetAHB(RCC_AHBRSTR_DMA1RST)
  238. /**
  239. * @brief Enables the DMA2 peripheral clock.
  240. *
  241. * @param[in] lp low power enable flag
  242. *
  243. * @api
  244. */
  245. #define rccEnableDMA2(lp) rccEnableAHB(RCC_AHBENR_DMA2EN, lp)
  246. /**
  247. * @brief Disables the DMA2 peripheral clock.
  248. *
  249. * @api
  250. */
  251. #define rccDisableDMA2() rccDisableAHB(RCC_AHBENR_DMA2EN)
  252. /**
  253. * @brief Resets the DMA2 peripheral.
  254. *
  255. * @api
  256. */
  257. #define rccResetDMA2() rccResetAHB(RCC_AHBRSTR_DMA2RST)
  258. /** @} */
  259. /**
  260. * @name PWR interface specific RCC operations
  261. * @{
  262. */
  263. /**
  264. * @brief Enables the PWR interface clock.
  265. *
  266. * @param[in] lp low power enable flag
  267. *
  268. * @api
  269. */
  270. #define rccEnablePWRInterface(lp) rccEnableAPB1(RCC_APB1ENR_PWREN, lp)
  271. /**
  272. * @brief Disables PWR interface clock.
  273. *
  274. * @api
  275. */
  276. #define rccDisablePWRInterface() rccDisableAPB1(RCC_APB1ENR_PWREN)
  277. /**
  278. * @brief Resets the PWR interface.
  279. *
  280. * @api
  281. */
  282. #define rccResetPWRInterface() rccResetAPB1(RCC_APB1RSTR_PWRRST)
  283. /** @} */
  284. /**
  285. * @name I2C peripherals specific RCC operations
  286. * @{
  287. */
  288. /**
  289. * @brief Enables the I2C1 peripheral clock.
  290. *
  291. * @param[in] lp low power enable flag
  292. *
  293. * @api
  294. */
  295. #define rccEnableI2C1(lp) rccEnableAPB1(RCC_APB1ENR_I2C1EN, lp)
  296. /**
  297. * @brief Disables the I2C1 peripheral clock.
  298. *
  299. * @api
  300. */
  301. #define rccDisableI2C1() rccDisableAPB1(RCC_APB1ENR_I2C1EN)
  302. /**
  303. * @brief Resets the I2C1 peripheral.
  304. *
  305. * @api
  306. */
  307. #define rccResetI2C1() rccResetAPB1(RCC_APB1RSTR_I2C1RST)
  308. /**
  309. * @brief Enables the I2C2 peripheral clock.
  310. *
  311. * @param[in] lp low power enable flag
  312. *
  313. * @api
  314. */
  315. #define rccEnableI2C2(lp) rccEnableAPB1(RCC_APB1ENR_I2C2EN, lp)
  316. /**
  317. * @brief Disables the I2C2 peripheral clock.
  318. *
  319. * @api
  320. */
  321. #define rccDisableI2C2() rccDisableAPB1(RCC_APB1ENR_I2C2EN)
  322. /**
  323. * @brief Resets the I2C2 peripheral.
  324. *
  325. * @api
  326. */
  327. #define rccResetI2C2() rccResetAPB1(RCC_APB1RSTR_I2C2RST)
  328. /** @} */
  329. /**
  330. * @name SPI peripherals specific RCC operations
  331. * @{
  332. */
  333. /**
  334. * @brief Enables the SPI1 peripheral clock.
  335. *
  336. * @param[in] lp low power enable flag
  337. *
  338. * @api
  339. */
  340. #define rccEnableSPI1(lp) rccEnableAPB2(RCC_APB2ENR_SPI1EN, lp)
  341. /**
  342. * @brief Disables the SPI1 peripheral clock.
  343. *
  344. * @api
  345. */
  346. #define rccDisableSPI1() rccDisableAPB2(RCC_APB2ENR_SPI1EN)
  347. /**
  348. * @brief Resets the SPI1 peripheral.
  349. *
  350. * @api
  351. */
  352. #define rccResetSPI1() rccResetAPB2(RCC_APB2RSTR_SPI1RST)
  353. /**
  354. * @brief Enables the SPI2 peripheral clock.
  355. *
  356. * @param[in] lp low power enable flag
  357. *
  358. * @api
  359. */
  360. #define rccEnableSPI2(lp) rccEnableAPB1(RCC_APB1ENR_SPI2EN, lp)
  361. /**
  362. * @brief Disables the SPI2 peripheral clock.
  363. *
  364. * @api
  365. */
  366. #define rccDisableSPI2() rccDisableAPB1(RCC_APB1ENR_SPI2EN)
  367. /**
  368. * @brief Resets the SPI2 peripheral.
  369. *
  370. * @api
  371. */
  372. #define rccResetSPI2() rccResetAPB1(RCC_APB1RSTR_SPI2RST)
  373. /** @} */
  374. /**
  375. * @name TIM peripherals specific RCC operations
  376. * @{
  377. */
  378. /**
  379. * @brief Enables the TIM2 peripheral clock.
  380. *
  381. * @param[in] lp low power enable flag
  382. *
  383. * @api
  384. */
  385. #define rccEnableTIM2(lp) rccEnableAPB1(RCC_APB1ENR_TIM2EN, lp)
  386. /**
  387. * @brief Disables the TIM2 peripheral clock.
  388. *
  389. * @api
  390. */
  391. #define rccDisableTIM2() rccDisableAPB1(RCC_APB1ENR_TIM2EN)
  392. /**
  393. * @brief Resets the TIM2 peripheral.
  394. *
  395. * @api
  396. */
  397. #define rccResetTIM2() rccResetAPB1(RCC_APB1RSTR_TIM2RST)
  398. /**
  399. * @brief Enables the TIM3 peripheral clock.
  400. *
  401. * @param[in] lp low power enable flag
  402. *
  403. * @api
  404. */
  405. #define rccEnableTIM3(lp) rccEnableAPB1(RCC_APB1ENR_TIM3EN, lp)
  406. /**
  407. * @brief Disables the TIM3 peripheral clock.
  408. *
  409. * @api
  410. */
  411. #define rccDisableTIM3() rccDisableAPB1(RCC_APB1ENR_TIM3EN)
  412. /**
  413. * @brief Resets the TIM3 peripheral.
  414. *
  415. * @api
  416. */
  417. #define rccResetTIM3() rccResetAPB1(RCC_APB1RSTR_TIM3RST)
  418. /**
  419. * @brief Enables the TIM4 peripheral clock.
  420. *
  421. * @param[in] lp low power enable flag
  422. *
  423. * @api
  424. */
  425. #define rccEnableTIM4(lp) rccEnableAPB1(RCC_APB1ENR_TIM4EN, lp)
  426. /**
  427. * @brief Disables the TIM4 peripheral clock.
  428. *
  429. * @api
  430. */
  431. #define rccDisableTIM4() rccDisableAPB1(RCC_APB1ENR_TIM4EN)
  432. /**
  433. * @brief Resets the TIM4 peripheral.
  434. *
  435. * @api
  436. */
  437. #define rccResetTIM4() rccResetAPB1(RCC_APB1RSTR_TIM4RST)
  438. /**
  439. * @brief Enables the TIM5 peripheral clock.
  440. *
  441. * @param[in] lp low power enable flag
  442. *
  443. * @api
  444. */
  445. #define rccEnableTIM5(lp) rccEnableAPB1(RCC_APB1ENR_TIM5EN, lp)
  446. /**
  447. * @brief Disables the TIM5 peripheral clock.
  448. *
  449. * @api
  450. */
  451. #define rccDisableTIM5() rccDisableAPB1(RCC_APB1ENR_TIM5EN)
  452. /**
  453. * @brief Resets the TIM5 peripheral.
  454. *
  455. * @api
  456. */
  457. #define rccResetTIM5() rccResetAPB1(RCC_APB1RSTR_TIM5RST)
  458. /**
  459. * @brief Enables the TIM6 peripheral clock.
  460. *
  461. * @param[in] lp low power enable flag
  462. *
  463. * @api
  464. */
  465. #define rccEnableTIM6(lp) rccEnableAPB1(RCC_APB1ENR_TIM6EN, lp)
  466. /**
  467. * @brief Disables the TIM6 peripheral clock.
  468. *
  469. * @api
  470. */
  471. #define rccDisableTIM6() rccDisableAPB1(RCC_APB1ENR_TIM6EN)
  472. /**
  473. * @brief Resets the TIM6 peripheral.
  474. *
  475. * @api
  476. */
  477. #define rccResetTIM6() rccResetAPB1(RCC_APB1RSTR_TIM6RST)
  478. /**
  479. * @brief Enables the TIM7 peripheral clock.
  480. *
  481. * @param[in] lp low power enable flag
  482. *
  483. * @api
  484. */
  485. #define rccEnableTIM7(lp) rccEnableAPB1(RCC_APB1ENR_TIM7EN, lp)
  486. /**
  487. * @brief Disables the TIM7 peripheral clock.
  488. *
  489. * @api
  490. */
  491. #define rccDisableTIM7() rccDisableAPB1(RCC_APB1ENR_TIM7EN)
  492. /**
  493. * @brief Resets the TIM7 peripheral.
  494. *
  495. * @api
  496. */
  497. #define rccResetTIM7() rccResetAPB1(RCC_APB1RSTR_TIM7RST)
  498. /**
  499. * @brief Enables the TIM9 peripheral clock.
  500. *
  501. * @param[in] lp low power enable flag
  502. *
  503. * @api
  504. */
  505. #define rccEnableTIM9(lp) rccEnableAPB2(RCC_APB2ENR_TIM9EN, lp)
  506. /**
  507. * @brief Disables the TIM9 peripheral clock.
  508. *
  509. * @api
  510. */
  511. #define rccDisableTIM9() rccDisableAPB2(RCC_APB2ENR_TIM9EN)
  512. /**
  513. * @brief Resets the TIM9 peripheral.
  514. *
  515. * @api
  516. */
  517. #define rccResetTIM9() rccResetAPB2(RCC_APB2RSTR_TIM9RST)
  518. /**
  519. * @brief Enables the TIM10 peripheral clock.
  520. *
  521. * @param[in] lp low power enable flag
  522. *
  523. * @api
  524. */
  525. #define rccEnableTIM10(lp) rccEnableAPB2(RCC_APB2ENR_TIM10EN, lp)
  526. /**
  527. * @brief Disables the TIM10 peripheral clock.
  528. *
  529. * @api
  530. */
  531. #define rccDisableTIM10() rccDisableAPB2(RCC_APB2ENR_TIM10EN)
  532. /**
  533. * @brief Resets the TIM10 peripheral.
  534. *
  535. * @api
  536. */
  537. #define rccResetTIM10() rccResetAPB2(RCC_APB2RSTR_TIM10RST)
  538. /**
  539. * @brief Enables the TIM10 peripheral clock.
  540. *
  541. * @param[in] lp low power enable flag
  542. *
  543. * @api
  544. */
  545. #define rccEnableTIM11(lp) rccEnableAPB2(RCC_APB2ENR_TIM11EN, lp)
  546. /**
  547. * @brief Disables the TIM11 peripheral clock.
  548. *
  549. * @api
  550. */
  551. #define rccDisableTIM11() rccDisableAPB2(RCC_APB2ENR_TIM11EN)
  552. /**
  553. * @brief Resets the TIM11 peripheral.
  554. *
  555. * @api
  556. */
  557. #define rccResetTIM11() rccResetAPB2(RCC_APB2RSTR_TIM11RST)
  558. /** @} */
  559. /**
  560. * @name USART/UART peripherals specific RCC operations
  561. * @{
  562. */
  563. /**
  564. * @brief Enables the USART1 peripheral clock.
  565. *
  566. * @param[in] lp low power enable flag
  567. *
  568. * @api
  569. */
  570. #define rccEnableUSART1(lp) rccEnableAPB2(RCC_APB2ENR_USART1EN, lp)
  571. /**
  572. * @brief Disables the USART1 peripheral clock.
  573. *
  574. * @api
  575. */
  576. #define rccDisableUSART1() rccDisableAPB2(RCC_APB2ENR_USART1EN)
  577. /**
  578. * @brief Resets the USART1 peripheral.
  579. *
  580. * @api
  581. */
  582. #define rccResetUSART1() rccResetAPB2(RCC_APB2RSTR_USART1RST)
  583. /**
  584. * @brief Enables the USART2 peripheral clock.
  585. *
  586. * @param[in] lp low power enable flag
  587. *
  588. * @api
  589. */
  590. #define rccEnableUSART2(lp) rccEnableAPB1(RCC_APB1ENR_USART2EN, lp)
  591. /**
  592. * @brief Disables the USART2 peripheral clock.
  593. *
  594. * @api
  595. */
  596. #define rccDisableUSART2() rccDisableAPB1(RCC_APB1ENR_USART2EN)
  597. /**
  598. * @brief Resets the USART2 peripheral.
  599. *
  600. * @api
  601. */
  602. #define rccResetUSART2() rccResetAPB1(RCC_APB1RSTR_USART2RST)
  603. /**
  604. * @brief Enables the USART3 peripheral clock.
  605. *
  606. * @param[in] lp low power enable flag
  607. *
  608. * @api
  609. */
  610. #define rccEnableUSART3(lp) rccEnableAPB1(RCC_APB1ENR_USART3EN, lp)
  611. /**
  612. * @brief Disables the USART3 peripheral clock.
  613. *
  614. * @api
  615. */
  616. #define rccDisableUSART3() rccDisableAPB1(RCC_APB1ENR_USART3EN)
  617. /**
  618. * @brief Resets the USART3 peripheral.
  619. *
  620. * @api
  621. */
  622. #define rccResetUSART3() rccResetAPB1(RCC_APB1RSTR_USART3RST)
  623. /**
  624. * @brief Enables the UART4 peripheral clock.
  625. *
  626. * @param[in] lp low power enable flag
  627. *
  628. * @api
  629. */
  630. #define rccEnableUART4(lp) rccEnableAPB1(RCC_APB1ENR_UART4EN, lp)
  631. /**
  632. * @brief Disables the UART4 peripheral clock.
  633. *
  634. * @api
  635. */
  636. #define rccDisableUART4() rccDisableAPB1(RCC_APB1ENR_UART4EN)
  637. /**
  638. * @brief Resets the UART4 peripheral.
  639. *
  640. * @api
  641. */
  642. #define rccResetUART4() rccResetAPB1(RCC_APB1RSTR_UART4RST)
  643. /**
  644. * @brief Enables the UART5 peripheral clock.
  645. *
  646. * @param[in] lp low power enable flag
  647. *
  648. * @api
  649. */
  650. #define rccEnableUART5(lp) rccEnableAPB1(RCC_APB1ENR_UART5EN, lp)
  651. /**
  652. * @brief Disables the UART5 peripheral clock.
  653. *
  654. * @api
  655. */
  656. #define rccDisableUART5() rccDisableAPB1(RCC_APB1ENR_UART5EN)
  657. /**
  658. * @brief Resets the UART5 peripheral.
  659. *
  660. * @api
  661. */
  662. #define rccResetUART5() rccResetAPB1(RCC_APB1RSTR_UART5RST)
  663. /** @} */
  664. /**
  665. * @name USB peripheral specific RCC operations
  666. * @{
  667. */
  668. /**
  669. * @brief Enables the USB peripheral clock.
  670. *
  671. * @param[in] lp low power enable flag
  672. *
  673. * @api
  674. */
  675. #define rccEnableUSB(lp) rccEnableAPB1(RCC_APB1ENR_USBEN, lp)
  676. /**
  677. * @brief Disables the USB peripheral clock.
  678. *
  679. * @api
  680. */
  681. #define rccDisableUSB() rccDisableAPB1(RCC_APB1ENR_USBEN)
  682. /**
  683. * @brief Resets the USB peripheral.
  684. *
  685. * @api
  686. */
  687. #define rccResetUSB() rccResetAPB1(RCC_APB1RSTR_USBRST)
  688. /** @} */
  689. /*===========================================================================*/
  690. /* External declarations. */
  691. /*===========================================================================*/
  692. #ifdef __cplusplus
  693. extern "C" {
  694. #endif
  695. #ifdef __cplusplus
  696. }
  697. #endif
  698. #endif /* STM32_RCC_H */
  699. /** @} */