stm32_rcc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  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 STM32F0xx/stm32_rcc.h
  15. * @brief RCC helper driver header.
  16. * @note This file requires definitions from the ST header file
  17. * @p stm32f0xx.h.
  18. *
  19. * @addtogroup STM32F0xx_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. * @note The @p lp parameter is ignored in this family.
  46. *
  47. * @param[in] mask APB1 peripherals mask
  48. * @param[in] lp low power enable flag
  49. *
  50. * @api
  51. */
  52. #define rccEnableAPB1(mask, lp) { \
  53. RCC->APB1ENR |= (mask); \
  54. (void)RCC->APB1ENR; \
  55. }
  56. /**
  57. * @brief Disables the clock of one or more peripheral on the APB1 bus.
  58. *
  59. * @param[in] mask APB1 peripherals mask
  60. *
  61. * @api
  62. */
  63. #define rccDisableAPB1(mask) { \
  64. RCC->APB1ENR &= ~(mask); \
  65. (void)RCC->APB1ENR; \
  66. }
  67. /**
  68. * @brief Resets one or more peripheral on the APB1 bus.
  69. *
  70. * @param[in] mask APB1 peripherals mask
  71. *
  72. * @api
  73. */
  74. #define rccResetAPB1(mask) { \
  75. RCC->APB1RSTR |= (mask); \
  76. RCC->APB1RSTR &= ~(mask); \
  77. (void)RCC->APB1RSTR; \
  78. }
  79. /**
  80. * @brief Enables the clock of one or more peripheral on the APB2 bus.
  81. * @note The @p lp parameter is ignored in this family.
  82. *
  83. * @param[in] mask APB2 peripherals mask
  84. * @param[in] lp low power enable flag
  85. *
  86. * @api
  87. */
  88. #define rccEnableAPB2(mask, lp) { \
  89. RCC->APB2ENR |= (mask); \
  90. (void)RCC->APB2ENR; \
  91. }
  92. /**
  93. * @brief Disables the clock of one or more peripheral on the APB2 bus.
  94. *
  95. * @param[in] mask APB2 peripherals mask
  96. *
  97. * @api
  98. */
  99. #define rccDisableAPB2(mask) { \
  100. RCC->APB2ENR &= ~(mask); \
  101. (void)RCC->APB2ENR; \
  102. }
  103. /**
  104. * @brief Resets one or more peripheral on the APB2 bus.
  105. *
  106. * @param[in] mask APB2 peripherals mask
  107. *
  108. * @api
  109. */
  110. #define rccResetAPB2(mask) { \
  111. RCC->APB2RSTR |= (mask); \
  112. RCC->APB2RSTR &= ~(mask); \
  113. (void)RCC->APB2RSTR; \
  114. }
  115. /**
  116. * @brief Enables the clock of one or more peripheral on the AHB bus.
  117. * @note The @p lp parameter is ignored in this family.
  118. *
  119. * @param[in] mask AHB peripherals mask
  120. * @param[in] lp low power enable flag
  121. *
  122. * @api
  123. */
  124. #define rccEnableAHB(mask, lp) { \
  125. RCC->AHBENR |= (mask); \
  126. (void)RCC->AHBENR; \
  127. }
  128. /**
  129. * @brief Disables the clock of one or more peripheral on the AHB bus.
  130. *
  131. * @param[in] mask AHB peripherals mask
  132. *
  133. * @api
  134. */
  135. #define rccDisableAHB(mask) { \
  136. RCC->AHBENR &= ~(mask); \
  137. (void)RCC->AHBENR; \
  138. }
  139. /**
  140. * @brief Resets one or more peripheral on the AHB bus.
  141. *
  142. * @param[in] mask AHB peripherals mask
  143. *
  144. * @api
  145. */
  146. #define rccResetAHB(mask) { \
  147. RCC->AHBRSTR |= (mask); \
  148. RCC->AHBRSTR &= ~(mask); \
  149. (void)RCC->AHBRSTR; \
  150. }
  151. /** @} */
  152. /**
  153. * @name ADC peripherals specific RCC operations
  154. * @{
  155. */
  156. /**
  157. * @brief Enables the ADC1 peripheral clock.
  158. * @note The @p lp parameter is ignored in this family.
  159. *
  160. * @param[in] lp low power enable flag
  161. *
  162. * @api
  163. */
  164. #define rccEnableADC1(lp) rccEnableAPB2(RCC_APB2ENR_ADC1EN, lp)
  165. /**
  166. * @brief Disables the ADC1 peripheral clock.
  167. *
  168. * @api
  169. */
  170. #define rccDisableADC1() rccDisableAPB2(RCC_APB2ENR_ADC1EN)
  171. /**
  172. * @brief Resets the ADC1 peripheral.
  173. *
  174. * @api
  175. */
  176. #define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST)
  177. /** @} */
  178. /**
  179. * @name CAN peripherals specific RCC operations
  180. * @{
  181. */
  182. /**
  183. * @brief Enables the CAN1 peripheral clock.
  184. * @note The @p lp parameter is ignored in this family.
  185. *
  186. * @param[in] lp low power enable flag
  187. *
  188. * @api
  189. */
  190. #define rccEnableCAN1(lp) rccEnableAPB1(RCC_APB1ENR_CANEN, lp)
  191. /**
  192. * @brief Disables the CAN1 peripheral clock.
  193. *
  194. * @api
  195. */
  196. #define rccDisableCAN1() rccDisableAPB1(RCC_APB1ENR_CANEN)
  197. /**
  198. * @brief Resets the CAN1 peripheral.
  199. *
  200. * @api
  201. */
  202. #define rccResetCAN1() rccResetAPB1(RCC_APB1RSTR_CANRST)
  203. /** @} */
  204. /**
  205. * @name DAC peripheral specific RCC operations
  206. * @{
  207. */
  208. /**
  209. * @brief Enables the DAC1 peripheral clock.
  210. * @note The @p lp parameter is ignored in this family.
  211. *
  212. * @param[in] lp low power enable flag
  213. *
  214. * @api
  215. */
  216. #define rccEnableDAC1(lp) rccEnableAPB1(RCC_APB1ENR_DACEN, lp)
  217. /**
  218. * @brief Disables the DAC1 peripheral clock.
  219. *
  220. * @api
  221. */
  222. #define rccDisableDAC1() rccDisableAPB1(RCC_APB1ENR_DACEN)
  223. /**
  224. * @brief Resets the DAC1 peripheral.
  225. *
  226. * @api
  227. */
  228. #define rccResetDAC1() rccResetAPB1(RCC_APB1RSTR_DACRST)
  229. /** @} */
  230. /**
  231. * @name PWR interface specific RCC operations
  232. * @{
  233. */
  234. /**
  235. * @brief Enables the PWR interface clock.
  236. * @note The @p lp parameter is ignored in this family.
  237. *
  238. * @param[in] lp low power enable flag
  239. *
  240. * @api
  241. */
  242. #define rccEnablePWRInterface(lp) rccEnableAPB1(RCC_APB1ENR_PWREN, lp)
  243. /**
  244. * @brief Disables PWR interface clock.
  245. *
  246. * @api
  247. */
  248. #define rccDisablePWRInterface() rccDisableAPB1(RCC_APB1ENR_PWREN)
  249. /**
  250. * @brief Resets the PWR interface.
  251. *
  252. * @api
  253. */
  254. #define rccResetPWRInterface() rccResetAPB1(RCC_APB1RSTR_PWRRST)
  255. /** @} */
  256. /**
  257. * @name DMA peripherals specific RCC operations
  258. * @{
  259. */
  260. /**
  261. * @brief Enables the DMA1 peripheral clock.
  262. * @note The @p lp parameter is ignored in this family.
  263. *
  264. * @param[in] lp low power enable flag
  265. *
  266. * @api
  267. */
  268. #define rccEnableDMA1(lp) rccEnableAHB(RCC_AHBENR_DMA1EN, lp)
  269. /**
  270. * @brief Disables the DMA1 peripheral clock.
  271. *
  272. * @api
  273. */
  274. #define rccDisableDMA1() rccDisableAHB(RCC_AHBENR_DMA1EN)
  275. /**
  276. * @brief Resets the DMA1 peripheral.
  277. * @note Not supported in this family, does nothing.
  278. *
  279. * @api
  280. */
  281. #define rccResetDMA1()
  282. /**
  283. * @brief Enables the DMA2 peripheral clock.
  284. * @note The @p lp parameter is ignored in this family.
  285. *
  286. * @param[in] lp low power enable flag
  287. *
  288. * @api
  289. */
  290. #define rccEnableDMA2(lp) rccEnableAHB(RCC_AHBENR_DMA2EN, lp)
  291. /**
  292. * @brief Disables the DMA2 peripheral clock.
  293. *
  294. * @api
  295. */
  296. #define rccDisableDMA2() rccDisableAHB(RCC_AHBENR_DMA2EN)
  297. /**
  298. * @brief Resets the DMA2 peripheral.
  299. * @note Not supported in this family, does nothing.
  300. *
  301. * @api
  302. */
  303. #define rccResetDMA2()
  304. /** @} */
  305. /**
  306. * @name I2C peripherals specific RCC operations
  307. * @{
  308. */
  309. /**
  310. * @brief Enables the I2C1 peripheral clock.
  311. * @note The @p lp parameter is ignored in this family.
  312. *
  313. * @param[in] lp low power enable flag
  314. *
  315. * @api
  316. */
  317. #define rccEnableI2C1(lp) rccEnableAPB1(RCC_APB1ENR_I2C1EN, lp)
  318. /**
  319. * @brief Disables the I2C1 peripheral clock.
  320. *
  321. * @api
  322. */
  323. #define rccDisableI2C1() rccDisableAPB1(RCC_APB1ENR_I2C1EN)
  324. /**
  325. * @brief Resets the I2C1 peripheral.
  326. *
  327. * @api
  328. */
  329. #define rccResetI2C1() rccResetAPB1(RCC_APB1RSTR_I2C1RST)
  330. /**
  331. * @brief Enables the I2C2 peripheral clock.
  332. * @note The @p lp parameter is ignored in this family.
  333. *
  334. * @param[in] lp low power enable flag
  335. *
  336. * @api
  337. */
  338. #define rccEnableI2C2(lp) rccEnableAPB1(RCC_APB1ENR_I2C2EN, lp)
  339. /**
  340. * @brief Disables the I2C2 peripheral clock.
  341. *
  342. * @api
  343. */
  344. #define rccDisableI2C2() rccDisableAPB1(RCC_APB1ENR_I2C2EN)
  345. /**
  346. * @brief Resets the I2C2 peripheral.
  347. *
  348. * @api
  349. */
  350. #define rccResetI2C2() rccResetAPB1(RCC_APB1RSTR_I2C2RST)
  351. /** @} */
  352. /**
  353. * @name SPI peripherals specific RCC operations
  354. * @{
  355. */
  356. /**
  357. * @brief Enables the SPI1 peripheral clock.
  358. * @note The @p lp parameter is ignored in this family.
  359. *
  360. * @param[in] lp low power enable flag
  361. *
  362. * @api
  363. */
  364. #define rccEnableSPI1(lp) rccEnableAPB2(RCC_APB2ENR_SPI1EN, lp)
  365. /**
  366. * @brief Disables the SPI1 peripheral clock.
  367. *
  368. * @api
  369. */
  370. #define rccDisableSPI1() rccDisableAPB2(RCC_APB2ENR_SPI1EN)
  371. /**
  372. * @brief Resets the SPI1 peripheral.
  373. *
  374. * @api
  375. */
  376. #define rccResetSPI1() rccResetAPB2(RCC_APB2RSTR_SPI1RST)
  377. /**
  378. * @brief Enables the SPI2 peripheral clock.
  379. * @note The @p lp parameter is ignored in this family.
  380. *
  381. * @param[in] lp low power enable flag
  382. *
  383. * @api
  384. */
  385. #define rccEnableSPI2(lp) rccEnableAPB1(RCC_APB1ENR_SPI2EN, lp)
  386. /**
  387. * @brief Disables the SPI2 peripheral clock.
  388. *
  389. * @api
  390. */
  391. #define rccDisableSPI2() rccDisableAPB1(RCC_APB1ENR_SPI2EN)
  392. /**
  393. * @brief Resets the SPI2 peripheral.
  394. *
  395. * @api
  396. */
  397. #define rccResetSPI2() rccResetAPB1(RCC_APB1RSTR_SPI2RST)
  398. /** @} */
  399. /**
  400. * @name TIM peripherals specific RCC operations
  401. * @{
  402. */
  403. /**
  404. * @brief Enables the TIM1 peripheral clock.
  405. * @note The @p lp parameter is ignored in this family.
  406. *
  407. * @param[in] lp low power enable flag
  408. *
  409. * @api
  410. */
  411. #define rccEnableTIM1(lp) rccEnableAPB2(RCC_APB2ENR_TIM1EN, lp)
  412. /**
  413. * @brief Disables the TIM1 peripheral clock.
  414. *
  415. * @api
  416. */
  417. #define rccDisableTIM1() rccDisableAPB2(RCC_APB2ENR_TIM1EN)
  418. /**
  419. * @brief Resets the TIM1 peripheral.
  420. *
  421. * @api
  422. */
  423. #define rccResetTIM1() rccResetAPB2(RCC_APB2RSTR_TIM1RST)
  424. /**
  425. * @brief Enables the TIM2 peripheral clock.
  426. * @note The @p lp parameter is ignored in this family.
  427. *
  428. * @param[in] lp low power enable flag
  429. *
  430. * @api
  431. */
  432. #define rccEnableTIM2(lp) rccEnableAPB1(RCC_APB1ENR_TIM2EN, lp)
  433. /**
  434. * @brief Disables the TIM2 peripheral clock.
  435. *
  436. * @api
  437. */
  438. #define rccDisableTIM2() rccDisableAPB1(RCC_APB1ENR_TIM2EN)
  439. /**
  440. * @brief Resets the TIM2 peripheral.
  441. *
  442. * @api
  443. */
  444. #define rccResetTIM2() rccResetAPB1(RCC_APB1RSTR_TIM2RST)
  445. /**
  446. * @brief Enables the TIM3 peripheral clock.
  447. * @note The @p lp parameter is ignored in this family.
  448. *
  449. * @param[in] lp low power enable flag
  450. *
  451. * @api
  452. */
  453. #define rccEnableTIM3(lp) rccEnableAPB1(RCC_APB1ENR_TIM3EN, lp)
  454. /**
  455. * @brief Disables the TIM3 peripheral clock.
  456. *
  457. * @api
  458. */
  459. #define rccDisableTIM3() rccDisableAPB1(RCC_APB1ENR_TIM3EN)
  460. /**
  461. * @brief Resets the TIM3 peripheral.
  462. *
  463. * @api
  464. */
  465. #define rccResetTIM3() rccResetAPB1(RCC_APB1RSTR_TIM3RST)
  466. /**
  467. * @brief Enables the TIM6 peripheral clock.
  468. * @note The @p lp parameter is ignored in this family.
  469. *
  470. * @param[in] lp low power enable flag
  471. *
  472. * @api
  473. */
  474. #define rccEnableTIM6(lp) rccEnableAPB1(RCC_APB1ENR_TIM6EN, lp)
  475. /**
  476. * @brief Disables the TIM6 peripheral clock.
  477. *
  478. * @api
  479. */
  480. #define rccDisableTIM6() rccDisableAPB1(RCC_APB1ENR_TIM6EN)
  481. /**
  482. * @brief Resets the TIM6 peripheral.
  483. *
  484. * @api
  485. */
  486. #define rccResetTIM6() rccResetAPB1(RCC_APB1RSTR_TIM6RST)
  487. /**
  488. * @brief Enables the TIM7 peripheral clock.
  489. * @note The @p lp parameter is ignored in this family.
  490. *
  491. * @param[in] lp low power enable flag
  492. *
  493. * @api
  494. */
  495. #define rccEnableTIM7(lp) rccEnableAPB1(RCC_APB1ENR_TIM7EN, lp)
  496. /**
  497. * @brief Disables the TIM7 peripheral clock.
  498. *
  499. * @api
  500. */
  501. #define rccDisableTIM7() rccDisableAPB1(RCC_APB1ENR_TIM7EN)
  502. /**
  503. * @brief Resets the TIM7 peripheral.
  504. *
  505. * @api
  506. */
  507. #define rccResetTIM7() rccResetAPB1(RCC_APB1RSTR_TIM7RST)
  508. /**
  509. * @brief Enables the TIM14 peripheral clock.
  510. * @note The @p lp parameter is ignored in this family.
  511. *
  512. * @param[in] lp low power enable flag
  513. *
  514. * @api
  515. */
  516. #define rccEnableTIM14(lp) rccEnableAPB1(RCC_APB1ENR_TIM14EN, lp)
  517. /**
  518. * @brief Disables the TIM14 peripheral clock.
  519. *
  520. * @api
  521. */
  522. #define rccDisableTIM14() rccDisableAPB1(RCC_APB1ENR_TIM14EN)
  523. /**
  524. * @brief Resets the TIM14 peripheral.
  525. *
  526. * @api
  527. */
  528. #define rccResetTIM14() rccResetAPB1(RCC_APB1RSTR_TIM14RST)
  529. /**
  530. * @brief Enables the TIM15 peripheral clock.
  531. * @note The @p lp parameter is ignored in this family.
  532. *
  533. * @param[in] lp low power enable flag
  534. *
  535. * @api
  536. */
  537. #define rccEnableTIM15(lp) rccEnableAPB2(RCC_APB2ENR_TIM15EN, lp)
  538. /**
  539. * @brief Disables the TIM15 peripheral clock.
  540. *
  541. * @api
  542. */
  543. #define rccDisableTIM15() rccDisableAPB2(RCC_APB2ENR_TIM15EN)
  544. /**
  545. * @brief Resets the TIM15 peripheral.
  546. *
  547. * @api
  548. */
  549. #define rccResetTIM15() rccResetAPB2(RCC_APB2RSTR_TIM15RST)
  550. /**
  551. * @brief Enables the TIM16 peripheral clock.
  552. * @note The @p lp parameter is ignored in this family.
  553. *
  554. * @param[in] lp low power enable flag
  555. *
  556. * @api
  557. */
  558. #define rccEnableTIM16(lp) rccEnableAPB2(RCC_APB2ENR_TIM16EN, lp)
  559. /**
  560. * @brief Disables the TIM16 peripheral clock.
  561. *
  562. * @api
  563. */
  564. #define rccDisableTIM16() rccDisableAPB2(RCC_APB2ENR_TIM16EN)
  565. /**
  566. * @brief Resets the TIM16 peripheral.
  567. *
  568. * @api
  569. */
  570. #define rccResetTIM16() rccResetAPB2(RCC_APB2RSTR_TIM16RST)
  571. /**
  572. * @brief Enables the TIM17 peripheral clock.
  573. * @note The @p lp parameter is ignored in this family.
  574. *
  575. * @param[in] lp low power enable flag
  576. *
  577. * @api
  578. */
  579. #define rccEnableTIM17(lp) rccEnableAPB2(RCC_APB2ENR_TIM17EN, lp)
  580. /**
  581. * @brief Disables the TIM17 peripheral clock.
  582. *
  583. * @api
  584. */
  585. #define rccDisableTIM17() rccDisableAPB2(RCC_APB2ENR_TIM17EN)
  586. /**
  587. * @brief Resets the TIM17 peripheral.
  588. *
  589. * @api
  590. */
  591. #define rccResetTIM17() rccResetAPB2(RCC_APB2RSTR_TIM17RST)
  592. /** @} */
  593. /**
  594. * @name USART/UART peripherals specific RCC operations
  595. * @{
  596. */
  597. /**
  598. * @brief Enables the USART1 peripheral clock.
  599. * @note The @p lp parameter is ignored in this family.
  600. *
  601. * @param[in] lp low power enable flag
  602. *
  603. * @api
  604. */
  605. #define rccEnableUSART1(lp) rccEnableAPB2(RCC_APB2ENR_USART1EN, lp)
  606. /**
  607. * @brief Disables the USART1 peripheral clock.
  608. *
  609. * @api
  610. */
  611. #define rccDisableUSART1() rccDisableAPB2(RCC_APB2ENR_USART1EN)
  612. /**
  613. * @brief Resets the USART1 peripheral.
  614. *
  615. * @api
  616. */
  617. #define rccResetUSART1() rccResetAPB2(RCC_APB2RSTR_USART1RST)
  618. /**
  619. * @brief Enables the USART2 peripheral clock.
  620. * @note The @p lp parameter is ignored in this family.
  621. *
  622. * @param[in] lp low power enable flag
  623. *
  624. * @api
  625. */
  626. #define rccEnableUSART2(lp) rccEnableAPB1(RCC_APB1ENR_USART2EN, lp)
  627. /**
  628. * @brief Disables the USART2 peripheral clock.
  629. *
  630. * @api
  631. */
  632. #define rccDisableUSART2() rccDisableAPB1(RCC_APB1ENR_USART2EN)
  633. /**
  634. * @brief Resets the USART2 peripheral.
  635. *
  636. * @api
  637. */
  638. #define rccResetUSART2() rccResetAPB1(RCC_APB1RSTR_USART2RST)
  639. /**
  640. * @brief Enables the USART3 peripheral clock.
  641. * @note The @p lp parameter is ignored in this family.
  642. *
  643. * @param[in] lp low power enable flag
  644. *
  645. * @api
  646. */
  647. #define rccEnableUSART3(lp) rccEnableAPB1(RCC_APB1ENR_USART3EN, lp)
  648. /**
  649. * @brief Disables the USART3 peripheral clock.
  650. *
  651. * @api
  652. */
  653. #define rccDisableUSART3() rccDisableAPB1(RCC_APB1ENR_USART3EN)
  654. /**
  655. * @brief Resets the USART3 peripheral.
  656. *
  657. * @api
  658. */
  659. #define rccResetUSART3() rccResetAPB1(RCC_APB1RSTR_USART3RST)
  660. /**
  661. * @brief Enables the USART4 peripheral clock.
  662. * @note The @p lp parameter is ignored in this family.
  663. *
  664. * @param[in] lp low power enable flag
  665. *
  666. * @api
  667. */
  668. #define rccEnableUART4(lp) rccEnableAPB1(RCC_APB1ENR_USART4EN, lp)
  669. /**
  670. * @brief Disables the USART4 peripheral clock.
  671. *
  672. * @api
  673. */
  674. #define rccDisableUART4() rccDisableAPB1(RCC_APB1ENR_USART4EN)
  675. /**
  676. * @brief Resets the USART4 peripheral.
  677. *
  678. * @api
  679. */
  680. #define rccResetUART4() rccResetAPB1(RCC_APB1RSTR_USART4RST)
  681. /**
  682. * @brief Enables the USART5 peripheral clock.
  683. * @note The @p lp parameter is ignored in this family.
  684. *
  685. * @param[in] lp low power enable flag
  686. *
  687. * @api
  688. */
  689. #define rccEnableUART5(lp) rccEnableAPB1(RCC_APB1ENR_USART5EN, lp)
  690. /**
  691. * @brief Disables the USART5 peripheral clock.
  692. *
  693. * @api
  694. */
  695. #define rccDisableUART5() rccDisableAPB1(RCC_APB1ENR_USART5EN)
  696. /**
  697. * @brief Resets the USART5 peripheral.
  698. *
  699. * @api
  700. */
  701. #define rccResetUART5() rccResetAPB1(RCC_APB1RSTR_USART5RST)
  702. /**
  703. * @brief Enables the USART6 peripheral clock.
  704. * @note The @p lp parameter is ignored in this family.
  705. *
  706. * @param[in] lp low power enable flag
  707. *
  708. * @api
  709. */
  710. #define rccEnableUSART6(lp) rccEnableAPB2(RCC_APB2ENR_USART6EN, lp)
  711. /**
  712. * @brief Disables the USART6 peripheral clock.
  713. *
  714. * @api
  715. */
  716. #define rccDisableUSART6() rccDisableAPB2(RCC_APB2ENR_USART6EN)
  717. /**
  718. * @brief Resets the USART6 peripheral.
  719. *
  720. * @api
  721. */
  722. #define rccResetUSART6() rccResetAPB2(RCC_APB2RSTR_USART6RST)
  723. /**
  724. * @brief Enables the UART7 peripheral clock.
  725. *
  726. * @param[in] lp low power enable flag
  727. *
  728. * @api
  729. */
  730. #define rccEnableUART7(lp) rccEnableAPB2(RCC_APB2ENR_USART7EN, lp)
  731. /**
  732. * @brief Disables the UART7 peripheral clock.
  733. *
  734. * @api
  735. */
  736. #define rccDisableUART7() rccDisableAPB2(RCC_APB2ENR_USART7EN)
  737. /**
  738. * @brief Resets the UART7 peripheral.
  739. *
  740. * @api
  741. */
  742. #define rccResetUART7() rccResetAPB2(RCC_APB2RSTR_USART7RST)
  743. /**
  744. * @brief Enables the UART8 peripheral clock.
  745. *
  746. * @param[in] lp low power enable flag
  747. *
  748. * @api
  749. */
  750. #define rccEnableUART8(lp) rccEnableAPB2(RCC_APB2ENR_USART8EN, lp)
  751. /**
  752. * @brief Disables the UART8 peripheral clock.
  753. *
  754. * @api
  755. */
  756. #define rccDisableUART8() rccDisableAPB2(RCC_APB2ENR_USART8EN)
  757. /**
  758. * @brief Resets the UART8 peripheral.
  759. *
  760. * @api
  761. */
  762. #define rccResetUART8() rccResetAPB2(RCC_APB2RSTR_USART8RST)
  763. /** @} */
  764. /**
  765. * @name USB peripherals specific RCC operations
  766. * @{
  767. */
  768. /**
  769. * @brief Enables the USB peripheral clock.
  770. * @note The @p lp parameter is ignored in this family.
  771. *
  772. * @param[in] lp low power enable flag
  773. *
  774. * @api
  775. */
  776. #define rccEnableUSB(lp) rccEnableAPB1(RCC_APB1ENR_USBEN, lp)
  777. /**
  778. * @brief Disables the USB peripheral clock.
  779. *
  780. * @api
  781. */
  782. #define rccDisableUSB() rccDisableAPB1(RCC_APB1ENR_USBEN)
  783. /**
  784. * @brief Resets the USB peripheral.
  785. *
  786. * @api
  787. */
  788. #define rccResetUSB() rccResetAPB1(RCC_APB1RSTR_USBRST)
  789. /** @} */
  790. /**
  791. * @name CRC peripherals specific RCC operations
  792. * @{
  793. */
  794. /**
  795. * @brief Enables the CRC peripheral clock.
  796. * @note The @p lp parameter is ignored in this family.
  797. *
  798. * @param[in] lp low power enable flag
  799. *
  800. * @api
  801. */
  802. #define rccEnableCRC(lp) rccEnableAHB(RCC_AHBENR_CRCEN, lp)
  803. /**
  804. * @brief Disables the CRC peripheral clock.
  805. *
  806. * @api
  807. */
  808. #define rccDisableCRC() rccDisableAHB(RCC_AHBENR_CRCEN)
  809. /**
  810. * @brief Resets the CRC peripheral.
  811. *
  812. * @api
  813. */
  814. #define rccResetCRC() rccResetAHB(RCC_AHBRSTR_CRCRST)
  815. /** @} */
  816. /**
  817. * @name WWDG peripherals specific RCC operations
  818. * @{
  819. */
  820. /**
  821. * @brief Enables the WWDG peripheral clock.
  822. * @note The @p lp parameter is ignored in this family.
  823. *
  824. * @param[in] lp low power enable flag
  825. *
  826. * @api
  827. */
  828. #define rccEnableWWDG(lp) rccEnableAPB1(RCC_APB1ENR_WWDGEN, lp)
  829. /**
  830. * @brief Disables the WWDG peripheral clock.
  831. *
  832. * @api
  833. */
  834. #define rccDisableWWDG() rccDisableAPB1(RCC_APB1ENR_WWDGEN)
  835. /**
  836. * @brief Resets the WWDG peripheral.
  837. *
  838. * @api
  839. */
  840. #define rccResetWWDG() rccResetAPB1(RCC_APB1RSTR_WWDGRST)
  841. /** @} */
  842. /*===========================================================================*/
  843. /* External declarations. */
  844. /*===========================================================================*/
  845. #ifdef __cplusplus
  846. extern "C" {
  847. #endif
  848. #ifdef __cplusplus
  849. }
  850. #endif
  851. #endif /* STM32_RCC_H */
  852. /** @} */