stm32_rcc.h 21 KB

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