stm32_rcc.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650
  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 STM32F4xx/stm32_rcc.h
  15. * @brief RCC helper driver header.
  16. * @note This file requires definitions from the ST header file
  17. * @p stm32f4xx.h.
  18. *
  19. * @addtogroup STM32F4xx_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. *
  88. * @api
  89. */
  90. #define rccEnableAPB2(mask, lp) { \
  91. RCC->APB2ENR |= (mask); \
  92. if (lp) \
  93. RCC->APB2LPENR |= (mask); \
  94. else \
  95. RCC->APB2LPENR &= ~(mask); \
  96. (void)RCC->APB2LPENR; \
  97. }
  98. /**
  99. * @brief Disables the clock of one or more peripheral on the APB2 bus.
  100. *
  101. * @param[in] mask APB2 peripherals mask
  102. *
  103. * @api
  104. */
  105. #define rccDisableAPB2(mask) { \
  106. RCC->APB2ENR &= ~(mask); \
  107. RCC->APB2LPENR &= ~(mask); \
  108. (void)RCC->APB2LPENR; \
  109. }
  110. /**
  111. * @brief Resets one or more peripheral on the APB2 bus.
  112. *
  113. * @param[in] mask APB2 peripherals mask
  114. *
  115. * @api
  116. */
  117. #define rccResetAPB2(mask) { \
  118. RCC->APB2RSTR |= (mask); \
  119. RCC->APB2RSTR &= ~(mask); \
  120. (void)RCC->APB2RSTR; \
  121. }
  122. /**
  123. * @brief Enables the clock of one or more peripheral on the AHB1 bus.
  124. *
  125. * @param[in] mask AHB1 peripherals mask
  126. * @param[in] lp low power enable flag
  127. *
  128. * @api
  129. */
  130. #define rccEnableAHB1(mask, lp) { \
  131. RCC->AHB1ENR |= (mask); \
  132. if (lp) \
  133. RCC->AHB1LPENR |= (mask); \
  134. else \
  135. RCC->AHB1LPENR &= ~(mask); \
  136. (void)RCC->AHB1LPENR; \
  137. }
  138. /**
  139. * @brief Disables the clock of one or more peripheral on the AHB1 bus.
  140. *
  141. * @param[in] mask AHB1 peripherals mask
  142. *
  143. * @api
  144. */
  145. #define rccDisableAHB1(mask) { \
  146. RCC->AHB1ENR &= ~(mask); \
  147. RCC->AHB1LPENR &= ~(mask); \
  148. (void)RCC->AHB1LPENR; \
  149. }
  150. /**
  151. * @brief Resets one or more peripheral on the AHB1 bus.
  152. *
  153. * @param[in] mask AHB1 peripherals mask
  154. *
  155. * @api
  156. */
  157. #define rccResetAHB1(mask) { \
  158. RCC->AHB1RSTR |= (mask); \
  159. RCC->AHB1RSTR &= ~(mask); \
  160. (void)RCC->AHB1RSTR; \
  161. }
  162. /**
  163. * @brief Enables the clock of one or more peripheral on the AHB2 bus.
  164. *
  165. * @param[in] mask AHB2 peripherals mask
  166. * @param[in] lp low power enable flag
  167. *
  168. * @api
  169. */
  170. #define rccEnableAHB2(mask, lp) { \
  171. RCC->AHB2ENR |= (mask); \
  172. if (lp) \
  173. RCC->AHB2LPENR |= (mask); \
  174. else \
  175. RCC->AHB2LPENR &= ~(mask); \
  176. (void)RCC->AHB2LPENR; \
  177. }
  178. /**
  179. * @brief Disables the clock of one or more peripheral on the AHB2 bus.
  180. *
  181. * @param[in] mask AHB2 peripherals mask
  182. *
  183. * @api
  184. */
  185. #define rccDisableAHB2(mask) { \
  186. RCC->AHB2ENR &= ~(mask); \
  187. RCC->AHB2LPENR &= ~(mask); \
  188. (void)RCC->AHB2LPENR; \
  189. }
  190. /**
  191. * @brief Resets one or more peripheral on the AHB2 bus.
  192. *
  193. * @param[in] mask AHB2 peripherals mask
  194. *
  195. * @api
  196. */
  197. #define rccResetAHB2(mask) { \
  198. RCC->AHB2RSTR |= (mask); \
  199. RCC->AHB2RSTR &= ~(mask); \
  200. (void)RCC->AHB2RSTR; \
  201. }
  202. /**
  203. * @brief Enables the clock of one or more peripheral on the AHB3 (FSMC) bus.
  204. *
  205. * @param[in] mask AHB3 peripherals mask
  206. * @param[in] lp low power enable flag
  207. *
  208. * @api
  209. */
  210. #define rccEnableAHB3(mask, lp) { \
  211. RCC->AHB3ENR |= (mask); \
  212. if (lp) \
  213. RCC->AHB3LPENR |= (mask); \
  214. else \
  215. RCC->AHB3LPENR &= ~(mask); \
  216. (void)RCC->AHB3LPENR; \
  217. }
  218. /**
  219. * @brief Disables the clock of one or more peripheral on the AHB3 (FSMC) bus.
  220. *
  221. * @param[in] mask AHB3 peripherals mask
  222. *
  223. * @api
  224. */
  225. #define rccDisableAHB3(mask) { \
  226. RCC->AHB3ENR &= ~(mask); \
  227. RCC->AHB3LPENR &= ~(mask); \
  228. (void)RCC->AHB3LPENR; \
  229. }
  230. /**
  231. * @brief Resets one or more peripheral on the AHB3 (FSMC) bus.
  232. *
  233. * @param[in] mask AHB3 peripherals mask
  234. *
  235. * @api
  236. */
  237. #define rccResetAHB3(mask) { \
  238. RCC->AHB3RSTR |= (mask); \
  239. RCC->AHB3RSTR &= ~(mask); \
  240. (void)RCC->AHB3RSTR; \
  241. }
  242. /** @} */
  243. /**
  244. * @name ADC peripherals specific RCC operations
  245. * @{
  246. */
  247. /**
  248. * @brief Enables the ADC1 peripheral clock.
  249. *
  250. * @param[in] lp low power enable flag
  251. *
  252. * @api
  253. */
  254. #define rccEnableADC1(lp) rccEnableAPB2(RCC_APB2ENR_ADC1EN, lp)
  255. /**
  256. * @brief Disables the ADC1 peripheral clock.
  257. *
  258. * @api
  259. */
  260. #define rccDisableADC1() rccDisableAPB2(RCC_APB2ENR_ADC1EN)
  261. /**
  262. * @brief Resets the ADC1 peripheral.
  263. *
  264. * @api
  265. */
  266. #define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST)
  267. /**
  268. * @brief Enables the ADC2 peripheral clock.
  269. *
  270. * @param[in] lp low power enable flag
  271. *
  272. * @api
  273. */
  274. #define rccEnableADC2(lp) rccEnableAPB2(RCC_APB2ENR_ADC2EN, lp)
  275. /**
  276. * @brief Disables the ADC2 peripheral clock.
  277. *
  278. * @api
  279. */
  280. #define rccDisableADC2() rccDisableAPB2(RCC_APB2ENR_ADC2EN)
  281. /**
  282. * @brief Resets the ADC2 peripheral.
  283. *
  284. * @api
  285. */
  286. #define rccResetADC2() rccResetAPB2(RCC_APB2RSTR_ADC2RST)
  287. /**
  288. * @brief Enables the ADC3 peripheral clock.
  289. *
  290. * @param[in] lp low power enable flag
  291. *
  292. * @api
  293. */
  294. #define rccEnableADC3(lp) rccEnableAPB2(RCC_APB2ENR_ADC3EN, lp)
  295. /**
  296. * @brief Disables the ADC3 peripheral clock.
  297. *
  298. * @api
  299. */
  300. #define rccDisableADC3() rccDisableAPB2(RCC_APB2ENR_ADC3EN)
  301. /**
  302. * @brief Resets the ADC3 peripheral.
  303. *
  304. * @api
  305. */
  306. #define rccResetADC3() rccResetAPB2(RCC_APB2RSTR_ADC3RST)
  307. /** @} */
  308. /**
  309. * @name DAC peripheral specific RCC operations
  310. * @{
  311. */
  312. /**
  313. * @brief Enables the DAC1 peripheral clock.
  314. *
  315. * @param[in] lp low power enable flag
  316. *
  317. * @api
  318. */
  319. #define rccEnableDAC1(lp) rccEnableAPB1(RCC_APB1ENR_DACEN, lp)
  320. /**
  321. * @brief Disables the DAC1 peripheral clock.
  322. *
  323. * @api
  324. */
  325. #define rccDisableDAC1() rccDisableAPB1(RCC_APB1ENR_DACEN)
  326. /**
  327. * @brief Resets the DAC1 peripheral.
  328. *
  329. * @api
  330. */
  331. #define rccResetDAC1() rccResetAPB1(RCC_APB1RSTR_DACRST)
  332. /** @} */
  333. /**
  334. * @name DMA peripheral specific RCC operations
  335. * @{
  336. */
  337. /**
  338. * @brief Enables the DMA1 peripheral clock.
  339. *
  340. * @param[in] lp low power enable flag
  341. *
  342. * @api
  343. */
  344. #define rccEnableDMA1(lp) rccEnableAHB1(RCC_AHB1ENR_DMA1EN, lp)
  345. /**
  346. * @brief Disables the DMA1 peripheral clock.
  347. *
  348. * @api
  349. */
  350. #define rccDisableDMA1() rccDisableAHB1(RCC_AHB1ENR_DMA1EN)
  351. /**
  352. * @brief Resets the DMA1 peripheral.
  353. *
  354. * @api
  355. */
  356. #define rccResetDMA1() rccResetAHB1(RCC_AHB1RSTR_DMA1RST)
  357. /**
  358. * @brief Enables the DMA2 peripheral clock.
  359. *
  360. * @param[in] lp low power enable flag
  361. *
  362. * @api
  363. */
  364. #define rccEnableDMA2(lp) rccEnableAHB1(RCC_AHB1ENR_DMA2EN, lp)
  365. /**
  366. * @brief Disables the DMA2 peripheral clock.
  367. *
  368. * @api
  369. */
  370. #define rccDisableDMA2() rccDisableAHB1(RCC_AHB1ENR_DMA2EN)
  371. /**
  372. * @brief Resets the DMA2 peripheral.
  373. *
  374. * @api
  375. */
  376. #define rccResetDMA2() rccResetAHB1(RCC_AHB1RSTR_DMA2RST)
  377. /** @} */
  378. /**
  379. * @name BKPSRAM specific RCC operations
  380. * @{
  381. */
  382. /**
  383. * @brief Enables the BKPSRAM peripheral clock.
  384. *
  385. * @param[in] lp low power enable flag
  386. *
  387. * @api
  388. */
  389. #define rccEnableBKPSRAM(lp) rccEnableAHB1(RCC_AHB1ENR_BKPSRAMEN, lp)
  390. /**
  391. * @brief Disables the BKPSRAM peripheral clock.
  392. *
  393. * @api
  394. */
  395. #define rccDisableBKPSRAM() rccDisableAHB1(RCC_AHB1ENR_BKPSRAMEN)
  396. /** @} */
  397. /**
  398. * @name PWR interface specific RCC operations
  399. * @{
  400. */
  401. /**
  402. * @brief Enables the PWR interface clock.
  403. *
  404. * @param[in] lp low power enable flag
  405. *
  406. * @api
  407. */
  408. #define rccEnablePWRInterface(lp) rccEnableAPB1(RCC_APB1ENR_PWREN, lp)
  409. /**
  410. * @brief Disables PWR interface clock.
  411. *
  412. * @api
  413. */
  414. #define rccDisablePWRInterface() rccDisableAPB1(RCC_APB1ENR_PWREN)
  415. /**
  416. * @brief Resets the PWR interface.
  417. *
  418. * @api
  419. */
  420. #define rccResetPWRInterface() rccResetAPB1(RCC_APB1RSTR_PWRRST)
  421. /** @} */
  422. /**
  423. * @name CAN peripherals specific RCC operations
  424. * @{
  425. */
  426. /**
  427. * @brief Enables the CAN1 peripheral clock.
  428. *
  429. * @param[in] lp low power enable flag
  430. *
  431. * @api
  432. */
  433. #define rccEnableCAN1(lp) rccEnableAPB1(RCC_APB1ENR_CAN1EN, lp)
  434. /**
  435. * @brief Disables the CAN1 peripheral clock.
  436. *
  437. * @api
  438. */
  439. #define rccDisableCAN1() rccDisableAPB1(RCC_APB1ENR_CAN1EN)
  440. /**
  441. * @brief Resets the CAN1 peripheral.
  442. *
  443. * @api
  444. */
  445. #define rccResetCAN1() rccResetAPB1(RCC_APB1RSTR_CAN1RST)
  446. /**
  447. * @brief Enables the CAN2 peripheral clock.
  448. *
  449. * @param[in] lp low power enable flag
  450. *
  451. * @api
  452. */
  453. #define rccEnableCAN2(lp) rccEnableAPB1(RCC_APB1ENR_CAN2EN, lp)
  454. /**
  455. * @brief Disables the CAN2 peripheral clock.
  456. *
  457. * @api
  458. */
  459. #define rccDisableCAN2() rccDisableAPB1(RCC_APB1ENR_CAN2EN)
  460. /**
  461. * @brief Resets the CAN2 peripheral.
  462. *
  463. * @api
  464. */
  465. #define rccResetCAN2() rccResetAPB1(RCC_APB1RSTR_CAN2RST)
  466. /** @} */
  467. /**
  468. * @name ETH peripheral specific RCC operations
  469. * @{
  470. */
  471. /**
  472. * @brief Enables the ETH peripheral clock.
  473. *
  474. * @param[in] lp low power enable flag
  475. *
  476. * @api
  477. */
  478. #define rccEnableETH(lp) rccEnableAHB1(RCC_AHB1ENR_ETHMACEN | \
  479. RCC_AHB1ENR_ETHMACTXEN | \
  480. RCC_AHB1ENR_ETHMACRXEN, lp)
  481. /**
  482. * @brief Disables the ETH peripheral clock.
  483. *
  484. * @api
  485. */
  486. #define rccDisableETH() rccDisableAHB1(RCC_AHB1ENR_ETHMACEN | \
  487. RCC_AHB1ENR_ETHMACTXEN | \
  488. RCC_AHB1ENR_ETHMACRXEN)
  489. /**
  490. * @brief Resets the ETH peripheral.
  491. *
  492. * @api
  493. */
  494. #define rccResetETH() rccResetAHB1(RCC_AHB1RSTR_ETHMACRST)
  495. /** @} */
  496. /**
  497. * @name I2C peripherals specific RCC operations
  498. * @{
  499. */
  500. /**
  501. * @brief Enables the I2C1 peripheral clock.
  502. *
  503. * @param[in] lp low power enable flag
  504. *
  505. * @api
  506. */
  507. #define rccEnableI2C1(lp) rccEnableAPB1(RCC_APB1ENR_I2C1EN, lp)
  508. /**
  509. * @brief Disables the I2C1 peripheral clock.
  510. *
  511. * @api
  512. */
  513. #define rccDisableI2C1() rccDisableAPB1(RCC_APB1ENR_I2C1EN)
  514. /**
  515. * @brief Resets the I2C1 peripheral.
  516. *
  517. * @api
  518. */
  519. #define rccResetI2C1() rccResetAPB1(RCC_APB1RSTR_I2C1RST)
  520. /**
  521. * @brief Enables the I2C2 peripheral clock.
  522. *
  523. * @param[in] lp low power enable flag
  524. *
  525. * @api
  526. */
  527. #define rccEnableI2C2(lp) rccEnableAPB1(RCC_APB1ENR_I2C2EN, lp)
  528. /**
  529. * @brief Disables the I2C2 peripheral clock.
  530. *
  531. * @api
  532. */
  533. #define rccDisableI2C2() rccDisableAPB1(RCC_APB1ENR_I2C2EN)
  534. /**
  535. * @brief Resets the I2C2 peripheral.
  536. *
  537. * @api
  538. */
  539. #define rccResetI2C2() rccResetAPB1(RCC_APB1RSTR_I2C2RST)
  540. /**
  541. * @brief Enables the I2C3 peripheral clock.
  542. *
  543. * @param[in] lp low power enable flag
  544. *
  545. * @api
  546. */
  547. #define rccEnableI2C3(lp) rccEnableAPB1(RCC_APB1ENR_I2C3EN, lp)
  548. /**
  549. * @brief Disables the I2C3 peripheral clock.
  550. *
  551. * @api
  552. */
  553. #define rccDisableI2C3() rccDisableAPB1(RCC_APB1ENR_I2C3EN)
  554. /**
  555. * @brief Resets the I2C3 peripheral.
  556. *
  557. * @api
  558. */
  559. #define rccResetI2C3() rccResetAPB1(RCC_APB1RSTR_I2C3RST)
  560. /** @} */
  561. /**
  562. * @brief Enables the I2C4 peripheral clock.
  563. *
  564. * @api
  565. */
  566. #define rccEnableI2C4() rccEnableAPB1(RCC_APB1ENR_FMPI2C1EN, lp)
  567. /**
  568. * @brief Disables the I2C4 peripheral clock.
  569. *
  570. * @param[in] lp low power enable flag
  571. *
  572. * @api
  573. */
  574. #define rccDisableI2C4(lp) rccDisableAPB1(RCC_APB1ENR_FMPI2C1EN, lp)
  575. /**
  576. * @brief Resets the I2C4 peripheral.
  577. *
  578. * @api
  579. */
  580. #define rccResetI2C4() rccResetAPB1(RCC_APB1RSTR_FMPI2C1RST)
  581. /** @} */
  582. /**
  583. * @name OTG peripherals specific RCC operations
  584. * @{
  585. */
  586. /**
  587. * @brief Enables the OTG_FS peripheral clock.
  588. *
  589. * @param[in] lp low power enable flag
  590. *
  591. * @api
  592. */
  593. #define rccEnableOTG_FS(lp) rccEnableAHB2(RCC_AHB2ENR_OTGFSEN, lp)
  594. /**
  595. * @brief Disables the OTG_FS peripheral clock.
  596. *
  597. * @api
  598. */
  599. #define rccDisableOTG_FS() rccDisableAHB2(RCC_AHB2ENR_OTGFSEN)
  600. /**
  601. * @brief Resets the OTG_FS peripheral.
  602. *
  603. * @api
  604. */
  605. #define rccResetOTG_FS() rccResetAHB2(RCC_AHB2RSTR_OTGFSRST)
  606. /**
  607. * @brief Enables the OTG_HS peripheral clock.
  608. *
  609. * @param[in] lp low power enable flag
  610. *
  611. * @api
  612. */
  613. #define rccEnableOTG_HS(lp) rccEnableAHB1(RCC_AHB1ENR_OTGHSEN, lp)
  614. /**
  615. * @brief Disables the OTG_HS peripheral clock.
  616. *
  617. * @api
  618. */
  619. #define rccDisableOTG_HS() rccDisableAHB1(RCC_AHB1ENR_OTGHSEN)
  620. /**
  621. * @brief Resets the OTG_HS peripheral.
  622. *
  623. * @api
  624. */
  625. #define rccResetOTG_HS() rccResetAHB1(RCC_AHB1RSTR_OTGHRST)
  626. /**
  627. * @brief Enables the OTG_HS peripheral clock.
  628. *
  629. * @param[in] lp low power enable flag
  630. *
  631. * @api
  632. */
  633. #define rccEnableOTG_HSULPI(lp) rccEnableAHB1(RCC_AHB1ENR_OTGHSULPIEN, lp)
  634. /**
  635. * @brief Disables the OTG_HS peripheral clock.
  636. *
  637. * @api
  638. */
  639. #define rccDisableOTG_HSULPI() rccDisableAHB1(RCC_AHB1ENR_OTGHSULPIEN)
  640. /** @} */
  641. /**
  642. * @name QUADSPI peripherals specific RCC operations
  643. * @{
  644. */
  645. /**
  646. * @brief Enables the QUADSPI1 peripheral clock.
  647. *
  648. * @param[in] lp low power enable flag
  649. *
  650. * @api
  651. */
  652. #define rccEnableQUADSPI1(lp) rccEnableAHB3(RCC_AHB3ENR_QSPIEN, lp)
  653. /**
  654. * @brief Disables the QUADSPI1 peripheral clock.
  655. *
  656. * @api
  657. */
  658. #define rccDisableQUADSPI1() rccDisableAHB3(RCC_AHB3ENR_QSPIEN)
  659. /**
  660. * @brief Resets the QUADSPI1 peripheral.
  661. *
  662. * @api
  663. */
  664. #define rccResetQUADSPI1() rccResetAHB3(RCC_AHB3RSTR_QSPIRST)
  665. /** @} */
  666. /**
  667. * @name SDIO peripheral specific RCC operations
  668. * @{
  669. */
  670. /**
  671. * @brief Enables the SDIO peripheral clock.
  672. *
  673. * @param[in] lp low power enable flag
  674. *
  675. * @api
  676. */
  677. #define rccEnableSDIO(lp) rccEnableAPB2(RCC_APB2ENR_SDIOEN, lp)
  678. /**
  679. * @brief Disables the SDIO peripheral clock.
  680. *
  681. * @api
  682. */
  683. #define rccDisableSDIO() rccDisableAPB2(RCC_APB2ENR_SDIOEN)
  684. /**
  685. * @brief Resets the SDIO peripheral.
  686. *
  687. * @api
  688. */
  689. #define rccResetSDIO() rccResetAPB2(RCC_APB2RSTR_SDIORST)
  690. /** @} */
  691. /**
  692. * @name SPI peripherals specific RCC operations
  693. * @{
  694. */
  695. /**
  696. * @brief Enables the SPI1 peripheral clock.
  697. *
  698. * @param[in] lp low power enable flag
  699. *
  700. * @api
  701. */
  702. #define rccEnableSPI1(lp) rccEnableAPB2(RCC_APB2ENR_SPI1EN, lp)
  703. /**
  704. * @brief Disables the SPI1 peripheral clock.
  705. *
  706. * @api
  707. */
  708. #define rccDisableSPI1() rccDisableAPB2(RCC_APB2ENR_SPI1EN)
  709. /**
  710. * @brief Resets the SPI1 peripheral.
  711. *
  712. * @api
  713. */
  714. #define rccResetSPI1() rccResetAPB2(RCC_APB2RSTR_SPI1RST)
  715. /**
  716. * @brief Enables the SPI2 peripheral clock.
  717. *
  718. * @param[in] lp low power enable flag
  719. *
  720. * @api
  721. */
  722. #define rccEnableSPI2(lp) rccEnableAPB1(RCC_APB1ENR_SPI2EN, lp)
  723. /**
  724. * @brief Disables the SPI2 peripheral clock.
  725. *
  726. * @api
  727. */
  728. #define rccDisableSPI2() rccDisableAPB1(RCC_APB1ENR_SPI2EN)
  729. /**
  730. * @brief Resets the SPI2 peripheral.
  731. *
  732. * @api
  733. */
  734. #define rccResetSPI2() rccResetAPB1(RCC_APB1RSTR_SPI2RST)
  735. /**
  736. * @brief Enables the SPI3 peripheral clock.
  737. *
  738. * @param[in] lp low power enable flag
  739. *
  740. * @api
  741. */
  742. #define rccEnableSPI3(lp) rccEnableAPB1(RCC_APB1ENR_SPI3EN, lp)
  743. /**
  744. * @brief Disables the SPI3 peripheral clock.
  745. *
  746. * @api
  747. */
  748. #define rccDisableSPI3() rccDisableAPB1(RCC_APB1ENR_SPI3EN)
  749. /**
  750. * @brief Resets the SPI3 peripheral.
  751. *
  752. * @api
  753. */
  754. #define rccResetSPI3() rccResetAPB1(RCC_APB1RSTR_SPI3RST)
  755. /**
  756. * @brief Enables the SPI4 peripheral clock.
  757. *
  758. * @param[in] lp low power enable flag
  759. *
  760. * @api
  761. */
  762. #define rccEnableSPI4(lp) rccEnableAPB2(RCC_APB2ENR_SPI4EN, lp)
  763. /**
  764. * @brief Disables the SPI4 peripheral clock.
  765. *
  766. * @api
  767. */
  768. #define rccDisableSPI4() rccDisableAPB2(RCC_APB2ENR_SPI4EN)
  769. /**
  770. * @brief Resets the SPI4 peripheral.
  771. *
  772. * @api
  773. */
  774. #define rccResetSPI4() rccResetAPB2(RCC_APB2RSTR_SPI4RST)
  775. /**
  776. * @brief Enables the SPI5 peripheral clock.
  777. *
  778. * @param[in] lp low power enable flag
  779. *
  780. * @api
  781. */
  782. #define rccEnableSPI5(lp) rccEnableAPB2(RCC_APB2ENR_SPI5EN, lp)
  783. /**
  784. * @brief Disables the SPI5 peripheral clock.
  785. *
  786. * @api
  787. */
  788. #define rccDisableSPI5() rccDisableAPB2(RCC_APB2ENR_SPI5EN)
  789. /**
  790. * @brief Resets the SPI5 peripheral.
  791. *
  792. * @api
  793. */
  794. #define rccResetSPI5() rccResetAPB2(RCC_APB2RSTR_SPI5RST)
  795. /**
  796. * @brief Enables the SPI6 peripheral clock.
  797. *
  798. * @param[in] lp low power enable flag
  799. *
  800. * @api
  801. */
  802. #define rccEnableSPI6(lp) rccEnableAPB2(RCC_APB2ENR_SPI6EN, lp)
  803. /**
  804. * @brief Disables the SPI6 peripheral clock.
  805. *
  806. * @api
  807. */
  808. #define rccDisableSPI6() rccDisableAPB2(RCC_APB2ENR_SPI6EN)
  809. /**
  810. * @brief Resets the SPI6 peripheral.
  811. *
  812. * @api
  813. */
  814. #define rccResetSPI6() rccResetAPB2(RCC_APB2RSTR_SPI6RST)
  815. /** @} */
  816. /**
  817. * @name TIM peripherals specific RCC operations
  818. * @{
  819. */
  820. /**
  821. * @brief Enables the TIM1 peripheral clock.
  822. *
  823. * @param[in] lp low power enable flag
  824. *
  825. * @api
  826. */
  827. #define rccEnableTIM1(lp) rccEnableAPB2(RCC_APB2ENR_TIM1EN, lp)
  828. /**
  829. * @brief Disables the TIM1 peripheral clock.
  830. *
  831. * @api
  832. */
  833. #define rccDisableTIM1() rccDisableAPB2(RCC_APB2ENR_TIM1EN)
  834. /**
  835. * @brief Resets the TIM1 peripheral.
  836. *
  837. * @api
  838. */
  839. #define rccResetTIM1() rccResetAPB2(RCC_APB2RSTR_TIM1RST)
  840. /**
  841. * @brief Enables the TIM2 peripheral clock.
  842. *
  843. * @param[in] lp low power enable flag
  844. *
  845. * @api
  846. */
  847. #define rccEnableTIM2(lp) rccEnableAPB1(RCC_APB1ENR_TIM2EN, lp)
  848. /**
  849. * @brief Disables the TIM2 peripheral clock.
  850. *
  851. * @api
  852. */
  853. #define rccDisableTIM2() rccDisableAPB1(RCC_APB1ENR_TIM2EN)
  854. /**
  855. * @brief Resets the TIM2 peripheral.
  856. *
  857. * @api
  858. */
  859. #define rccResetTIM2() rccResetAPB1(RCC_APB1RSTR_TIM2RST)
  860. /**
  861. * @brief Enables the TIM3 peripheral clock.
  862. *
  863. * @param[in] lp low power enable flag
  864. *
  865. * @api
  866. */
  867. #define rccEnableTIM3(lp) rccEnableAPB1(RCC_APB1ENR_TIM3EN, lp)
  868. /**
  869. * @brief Disables the TIM3 peripheral clock.
  870. *
  871. * @api
  872. */
  873. #define rccDisableTIM3() rccDisableAPB1(RCC_APB1ENR_TIM3EN)
  874. /**
  875. * @brief Resets the TIM3 peripheral.
  876. *
  877. * @api
  878. */
  879. #define rccResetTIM3() rccResetAPB1(RCC_APB1RSTR_TIM3RST)
  880. /**
  881. * @brief Enables the TIM4 peripheral clock.
  882. *
  883. * @param[in] lp low power enable flag
  884. *
  885. * @api
  886. */
  887. #define rccEnableTIM4(lp) rccEnableAPB1(RCC_APB1ENR_TIM4EN, lp)
  888. /**
  889. * @brief Disables the TIM4 peripheral clock.
  890. *
  891. * @api
  892. */
  893. #define rccDisableTIM4() rccDisableAPB1(RCC_APB1ENR_TIM4EN)
  894. /**
  895. * @brief Resets the TIM4 peripheral.
  896. *
  897. * @api
  898. */
  899. #define rccResetTIM4() rccResetAPB1(RCC_APB1RSTR_TIM4RST)
  900. /**
  901. * @brief Enables the TIM5 peripheral clock.
  902. *
  903. * @param[in] lp low power enable flag
  904. *
  905. * @api
  906. */
  907. #define rccEnableTIM5(lp) rccEnableAPB1(RCC_APB1ENR_TIM5EN, lp)
  908. /**
  909. * @brief Disables the TIM5 peripheral clock.
  910. *
  911. * @api
  912. */
  913. #define rccDisableTIM5() rccDisableAPB1(RCC_APB1ENR_TIM5EN)
  914. /**
  915. * @brief Resets the TIM5 peripheral.
  916. *
  917. * @api
  918. */
  919. #define rccResetTIM5() rccResetAPB1(RCC_APB1RSTR_TIM5RST)
  920. /**
  921. * @brief Enables the TIM6 peripheral clock.
  922. *
  923. * @param[in] lp low power enable flag
  924. *
  925. * @api
  926. */
  927. #define rccEnableTIM6(lp) rccEnableAPB1(RCC_APB1ENR_TIM6EN, lp)
  928. /**
  929. * @brief Disables the TIM6 peripheral clock.
  930. *
  931. * @api
  932. */
  933. #define rccDisableTIM6() rccDisableAPB1(RCC_APB1ENR_TIM6EN)
  934. /**
  935. * @brief Resets the TIM6 peripheral.
  936. *
  937. * @api
  938. */
  939. #define rccResetTIM6() rccResetAPB1(RCC_APB1RSTR_TIM6RST)
  940. /**
  941. * @brief Enables the TIM7 peripheral clock.
  942. *
  943. * @param[in] lp low power enable flag
  944. *
  945. * @api
  946. */
  947. #define rccEnableTIM7(lp) rccEnableAPB1(RCC_APB1ENR_TIM7EN, lp)
  948. /**
  949. * @brief Disables the TIM7 peripheral clock.
  950. *
  951. * @api
  952. */
  953. #define rccDisableTIM7() rccDisableAPB1(RCC_APB1ENR_TIM7EN)
  954. /**
  955. * @brief Resets the TIM7 peripheral.
  956. *
  957. * @api
  958. */
  959. #define rccResetTIM7() rccResetAPB1(RCC_APB1RSTR_TIM7RST)
  960. /**
  961. * @brief Enables the TIM8 peripheral clock.
  962. *
  963. * @param[in] lp low power enable flag
  964. *
  965. * @api
  966. */
  967. #define rccEnableTIM8(lp) rccEnableAPB2(RCC_APB2ENR_TIM8EN, lp)
  968. /**
  969. * @brief Disables the TIM8 peripheral clock.
  970. *
  971. * @api
  972. */
  973. #define rccDisableTIM8() rccDisableAPB2(RCC_APB2ENR_TIM8EN)
  974. /**
  975. * @brief Resets the TIM8 peripheral.
  976. *
  977. * @api
  978. */
  979. #define rccResetTIM8() rccResetAPB2(RCC_APB2RSTR_TIM8RST)
  980. /**
  981. * @brief Enables the TIM9 peripheral clock.
  982. *
  983. * @param[in] lp low power enable flag
  984. *
  985. * @api
  986. */
  987. #define rccEnableTIM9(lp) rccEnableAPB2(RCC_APB2ENR_TIM9EN, lp)
  988. /**
  989. * @brief Disables the TIM9 peripheral clock.
  990. *
  991. * @api
  992. */
  993. #define rccDisableTIM9() rccDisableAPB2(RCC_APB2ENR_TIM9EN)
  994. /**
  995. * @brief Resets the TIM9 peripheral.
  996. *
  997. * @api
  998. */
  999. #define rccResetTIM9() rccResetAPB2(RCC_APB2RSTR_TIM9RST)
  1000. /**
  1001. * @brief Enables the TIM10 peripheral clock.
  1002. *
  1003. * @param[in] lp low power enable flag
  1004. *
  1005. * @api
  1006. */
  1007. #define rccEnableTIM10(lp) rccEnableAPB2(RCC_APB2ENR_TIM10EN, lp)
  1008. /**
  1009. * @brief Disables the TIM10 peripheral clock.
  1010. *
  1011. * @api
  1012. */
  1013. #define rccDisableTIM10() rccDisableAPB2(RCC_APB2ENR_TIM10EN)
  1014. /**
  1015. * @brief Resets the TIM10 peripheral.
  1016. *
  1017. * @api
  1018. */
  1019. #define rccResetTIM10() rccResetAPB2(RCC_APB2RSTR_TIM10RST)
  1020. /**
  1021. * @brief Enables the TIM11 peripheral clock.
  1022. *
  1023. * @param[in] lp low power enable flag
  1024. *
  1025. * @api
  1026. */
  1027. #define rccEnableTIM11(lp) rccEnableAPB2(RCC_APB2ENR_TIM11EN, lp)
  1028. /**
  1029. * @brief Disables the TIM11 peripheral clock.
  1030. *
  1031. * @api
  1032. */
  1033. #define rccDisableTIM11() rccDisableAPB2(RCC_APB2ENR_TIM11EN)
  1034. /**
  1035. * @brief Resets the TIM11 peripheral.
  1036. *
  1037. * @api
  1038. */
  1039. #define rccResetTIM11() rccResetAPB2(RCC_APB2RSTR_TIM11RST)
  1040. /**
  1041. * @brief Enables the TIM12 peripheral clock.
  1042. *
  1043. * @param[in] lp low power enable flag
  1044. *
  1045. * @api
  1046. */
  1047. #define rccEnableTIM12(lp) rccEnableAPB1(RCC_APB1ENR_TIM12EN, lp)
  1048. /**
  1049. * @brief Disables the TIM12 peripheral clock.
  1050. *
  1051. * @api
  1052. */
  1053. #define rccDisableTIM12() rccDisableAPB1(RCC_APB1ENR_TIM12EN)
  1054. /**
  1055. * @brief Resets the TIM12 peripheral.
  1056. *
  1057. * @api
  1058. */
  1059. #define rccResetTIM12() rccResetAPB1(RCC_APB1RSTR_TIM12RST)
  1060. /**
  1061. * @brief Enables the TIM13 peripheral clock.
  1062. *
  1063. * @param[in] lp low power enable flag
  1064. *
  1065. * @api
  1066. */
  1067. #define rccEnableTIM13(lp) rccEnableAPB1(RCC_APB1ENR_TIM13EN, lp)
  1068. /**
  1069. * @brief Disables the TIM13 peripheral clock.
  1070. *
  1071. * @api
  1072. */
  1073. #define rccDisableTIM13() rccDisableAPB1(RCC_APB1ENR_TIM13EN)
  1074. /**
  1075. * @brief Resets the TIM13 peripheral.
  1076. *
  1077. * @api
  1078. */
  1079. #define rccResetTIM13() rccResetAPB1(RCC_APB1RSTR_TIM13RST)
  1080. /**
  1081. * @brief Enables the TIM14 peripheral clock.
  1082. *
  1083. * @param[in] lp low power enable flag
  1084. *
  1085. * @api
  1086. */
  1087. #define rccEnableTIM14(lp) rccEnableAPB1(RCC_APB1ENR_TIM14EN, lp)
  1088. /**
  1089. * @brief Disables the TIM14 peripheral clock.
  1090. *
  1091. * @api
  1092. */
  1093. #define rccDisableTIM14() rccDisableAPB1(RCC_APB1ENR_TIM14EN)
  1094. /**
  1095. * @brief Resets the TIM14 peripheral.
  1096. *
  1097. * @api
  1098. */
  1099. #define rccResetTIM14() rccResetAPB1(RCC_APB1RSTR_TIM14RST)
  1100. /** @} */
  1101. /**
  1102. * @brief Enables the LPTIM1 peripheral clock.
  1103. * @note The @p lp parameter is ignored in this family.
  1104. *
  1105. * @param[in] lp low power enable flag
  1106. *
  1107. * @api
  1108. */
  1109. #define rccEnableLPTIM1(lp) rccEnableAPB1(RCC_APB1ENR_LPTIM1EN, lp)
  1110. /**
  1111. * @brief Disables the LPTIM1 peripheral clock.
  1112. *
  1113. * @api
  1114. */
  1115. #define rccDisableLPTIM1() rccDisableAPB1(RCC_APB1ENR_LPTIM1EN, lp)
  1116. /**
  1117. * @brief Resets the LPTIM1 peripheral.
  1118. *
  1119. * @api
  1120. */
  1121. #define rccResetLPTIM1() rccResetAPB1(RCC_APB1RSTR_LPTIM1RST)
  1122. /** @} */
  1123. /**
  1124. * @name USART/UART peripherals specific RCC operations
  1125. * @{
  1126. */
  1127. /**
  1128. * @brief Enables the USART1 peripheral clock.
  1129. *
  1130. * @param[in] lp low power enable flag
  1131. *
  1132. * @api
  1133. */
  1134. #define rccEnableUSART1(lp) rccEnableAPB2(RCC_APB2ENR_USART1EN, lp)
  1135. /**
  1136. * @brief Disables the USART1 peripheral clock.
  1137. *
  1138. * @api
  1139. */
  1140. #define rccDisableUSART1() rccDisableAPB2(RCC_APB2ENR_USART1EN)
  1141. /**
  1142. * @brief Resets the USART1 peripheral.
  1143. *
  1144. * @api
  1145. */
  1146. #define rccResetUSART1() rccResetAPB2(RCC_APB2RSTR_USART1RST)
  1147. /**
  1148. * @brief Enables the USART2 peripheral clock.
  1149. *
  1150. * @param[in] lp low power enable flag
  1151. *
  1152. * @api
  1153. */
  1154. #define rccEnableUSART2(lp) rccEnableAPB1(RCC_APB1ENR_USART2EN, lp)
  1155. /**
  1156. * @brief Disables the USART2 peripheral clock.
  1157. *
  1158. * @api
  1159. */
  1160. #define rccDisableUSART2() rccDisableAPB1(RCC_APB1ENR_USART2EN)
  1161. /**
  1162. * @brief Resets the USART2 peripheral.
  1163. *
  1164. * @api
  1165. */
  1166. #define rccResetUSART2() rccResetAPB1(RCC_APB1RSTR_USART2RST)
  1167. /**
  1168. * @brief Enables the USART3 peripheral clock.
  1169. *
  1170. * @param[in] lp low power enable flag
  1171. *
  1172. * @api
  1173. */
  1174. #define rccEnableUSART3(lp) rccEnableAPB1(RCC_APB1ENR_USART3EN, lp)
  1175. /**
  1176. * @brief Disables the USART3 peripheral clock.
  1177. *
  1178. * @api
  1179. */
  1180. #define rccDisableUSART3() rccDisableAPB1(RCC_APB1ENR_USART3EN)
  1181. /**
  1182. * @brief Resets the USART3 peripheral.
  1183. *
  1184. * @api
  1185. */
  1186. #define rccResetUSART3() rccResetAPB1(RCC_APB1RSTR_USART3RST)
  1187. /**
  1188. * @brief Enables the UART4 peripheral clock.
  1189. *
  1190. * @param[in] lp low power enable flag
  1191. *
  1192. * @api
  1193. */
  1194. #define rccEnableUART4(lp) rccEnableAPB1(RCC_APB1ENR_UART4EN, lp)
  1195. /**
  1196. * @brief Disables the UART4 peripheral clock.
  1197. *
  1198. * @api
  1199. */
  1200. #define rccDisableUART4() rccDisableAPB1(RCC_APB1ENR_UART4EN)
  1201. /**
  1202. * @brief Resets the UART4 peripheral.
  1203. *
  1204. * @api
  1205. */
  1206. #define rccResetUART4() rccResetAPB1(RCC_APB1RSTR_UART4RST)
  1207. /**
  1208. * @brief Enables the UART5 peripheral clock.
  1209. *
  1210. * @param[in] lp low power enable flag
  1211. *
  1212. * @api
  1213. */
  1214. #define rccEnableUART5(lp) rccEnableAPB1(RCC_APB1ENR_UART5EN, lp)
  1215. /**
  1216. * @brief Disables the UART5 peripheral clock.
  1217. *
  1218. * @api
  1219. */
  1220. #define rccDisableUART5() rccDisableAPB1(RCC_APB1ENR_UART5EN)
  1221. /**
  1222. * @brief Resets the UART5 peripheral.
  1223. *
  1224. * @api
  1225. */
  1226. #define rccResetUART5() rccResetAPB1(RCC_APB1RSTR_UART5RST)
  1227. /**
  1228. * @brief Enables the USART6 peripheral clock.
  1229. *
  1230. * @param[in] lp low power enable flag
  1231. *
  1232. * @api
  1233. */
  1234. #define rccEnableUSART6(lp) rccEnableAPB2(RCC_APB2ENR_USART6EN, lp)
  1235. /**
  1236. * @brief Disables the USART6 peripheral clock.
  1237. *
  1238. * @api
  1239. */
  1240. #define rccDisableUSART6() rccDisableAPB2(RCC_APB2ENR_USART6EN)
  1241. /**
  1242. * @brief Resets the USART6 peripheral.
  1243. *
  1244. * @api
  1245. */
  1246. #define rccResetUSART6() rccResetAPB2(RCC_APB2RSTR_USART6RST)
  1247. /**
  1248. * @brief Enables the UART7 peripheral clock.
  1249. *
  1250. * @param[in] lp low power enable flag
  1251. *
  1252. * @api
  1253. */
  1254. #define rccEnableUART7(lp) rccEnableAPB1(RCC_APB1ENR_UART7EN, lp)
  1255. /**
  1256. * @brief Disables the UART7 peripheral clock.
  1257. *
  1258. * @api
  1259. */
  1260. #define rccDisableUART7() rccDisableAPB1(RCC_APB1ENR_UART7EN)
  1261. /**
  1262. * @brief Resets the UART7 peripheral.
  1263. *
  1264. * @api
  1265. */
  1266. #define rccResetUART7() rccResetAPB1(RCC_APB1RSTR_UART7RST)
  1267. /**
  1268. * @brief Enables the UART8 peripheral clock.
  1269. *
  1270. * @param[in] lp low power enable flag
  1271. *
  1272. * @api
  1273. */
  1274. #define rccEnableUART8(lp) rccEnableAPB1(RCC_APB1ENR_UART8EN, lp)
  1275. /**
  1276. * @brief Disables the UART8 peripheral clock.
  1277. *
  1278. * @api
  1279. */
  1280. #define rccDisableUART8() rccDisableAPB1(RCC_APB1ENR_UART8EN)
  1281. /**
  1282. * @brief Resets the UART8 peripheral.
  1283. *
  1284. * @api
  1285. */
  1286. #define rccResetUART8() rccResetAPB1(RCC_APB1RSTR_UART8RST)
  1287. /** @} */
  1288. /**
  1289. * @brief Enables the UART9 peripheral clock.
  1290. * @note The @p lp parameter is ignored in this family.
  1291. *
  1292. * @param[in] lp low power enable flag
  1293. *
  1294. * @api
  1295. */
  1296. #define rccEnableUART9(lp) rccEnableAPB2(RCC_APB2ENR_UART9EN, lp)
  1297. /**
  1298. * @brief Disables the UART9 peripheral clock.
  1299. *
  1300. * @api
  1301. */
  1302. #define rccDisableUART9() rccDisableAPB2(RCC_APB2ENR_UART9EN, lp)
  1303. /**
  1304. * @brief Resets the UART9 peripheral.
  1305. *
  1306. * @api
  1307. */
  1308. #define rccResetUART9() rccResetAPB2(RCC_APB2RSTR_UART9RST)
  1309. /** @} */
  1310. /**
  1311. * @brief Enables the UART10 peripheral clock.
  1312. * @note The @p lp parameter is ignored in this family.
  1313. *
  1314. * @param[in] lp low power enable flag
  1315. *
  1316. * @api
  1317. */
  1318. #define rccEnableUART10(lp) rccEnableAPB2(RCC_APB2ENR_UART10EN, lp)
  1319. /**
  1320. * @brief Disables the UART10 peripheral clock.
  1321. *
  1322. * @api
  1323. */
  1324. #define rccDisableUART10(lp) rccDisableAPB2(RCC_APB2ENR_UART10EN, lp)
  1325. /**
  1326. * @brief Resets the UART10 peripheral.
  1327. *
  1328. * @api
  1329. */
  1330. #define rccResetUART10() rccResetAPB2(RCC_APB2RSTR_UART10RST)
  1331. /** @} */
  1332. /**
  1333. * @name LTDC peripheral specific RCC operations
  1334. * @{
  1335. */
  1336. /**
  1337. * @brief Enables the LTDC peripheral clock.
  1338. *
  1339. * @param[in] lp low power enable flag
  1340. *
  1341. * @api
  1342. */
  1343. #define rccEnableLTDC(lp) rccEnableAPB2(RCC_APB2ENR_LTDCEN, lp)
  1344. /**
  1345. * @brief Disables the LTDC peripheral clock.
  1346. *
  1347. * @api
  1348. */
  1349. #define rccDisableLTDC() rccDisableAPB2(RCC_APB2ENR_LTDCEN)
  1350. /**
  1351. * @brief Resets the LTDC peripheral.
  1352. *
  1353. * @api
  1354. */
  1355. #define rccResetLTDC() rccResetAPB2(RCC_APB2RSTR_LTDCRST)
  1356. /**
  1357. * @name DMA2D peripheral specific RCC operations
  1358. * @{
  1359. */
  1360. /**
  1361. * @brief Enables the DMA2D peripheral clock.
  1362. *
  1363. * @param[in] lp low power enable flag
  1364. *
  1365. * @api
  1366. */
  1367. #define rccEnableDMA2D(lp) rccEnableAHB1(RCC_AHB1ENR_DMA2DEN, lp)
  1368. /**
  1369. * @brief Disables the DMA2D peripheral clock.
  1370. *
  1371. * @api
  1372. */
  1373. #define rccDisableDMA2D() rccDisableAHB1(RCC_AHB1ENR_DMA2DEN)
  1374. /**
  1375. * @brief Resets the DMA2D peripheral.
  1376. *
  1377. * @api
  1378. */
  1379. #define rccResetDMA2D() rccResetAHB1(RCC_AHB1RSTR_DMA2DRST)
  1380. /** @} */
  1381. /**
  1382. * @name CRC peripheral specific RCC operations
  1383. * @{
  1384. */
  1385. /**
  1386. * @brief Enables the CRC peripheral clock.
  1387. *
  1388. * @param[in] lp low power enable flag
  1389. *
  1390. * @api
  1391. */
  1392. #define rccEnableCRC(lp) rccEnableAHB1(RCC_AHB1ENR_CRCEN, lp)
  1393. /**
  1394. * @brief Disables the CRC peripheral clock.
  1395. *
  1396. * @api
  1397. */
  1398. #define rccDisableCRC() rccDisableAHB1(RCC_AHB1ENR_CRCEN)
  1399. /**
  1400. * @brief Resets the CRC peripheral.
  1401. *
  1402. * @api
  1403. */
  1404. #define rccResetCRC() rccResetAHB1(RCC_AHB1RSTR_CRCRST)
  1405. /** @} */
  1406. /**
  1407. * @name FSMC peripherals specific RCC operations
  1408. * @{
  1409. */
  1410. /**
  1411. * @brief Enables the FSMC peripheral clock.
  1412. *
  1413. * @param[in] lp low power enable flag
  1414. *
  1415. * @api
  1416. */
  1417. #if STM32_HAS_FSMC || defined(__DOXYGEN__)
  1418. #if STM32_FSMC_IS_FMC || defined(__DOXYGEN__)
  1419. #define rccEnableFSMC(lp) rccEnableAHB3(RCC_AHB3ENR_FMCEN, lp)
  1420. #else
  1421. #define rccEnableFSMC(lp) rccEnableAHB3(RCC_AHB3ENR_FSMCEN, lp)
  1422. #endif
  1423. #endif
  1424. /**
  1425. * @brief Disables the FSMC peripheral clock.
  1426. *
  1427. * @api
  1428. */
  1429. #if STM32_HAS_FSMC || defined(__DOXYGEN__)
  1430. #if STM32_FSMC_IS_FMC || defined(__DOXYGEN__)
  1431. #define rccDisableFSMC() rccDisableAHB3(RCC_AHB3ENR_FMCEN)
  1432. #else
  1433. #define rccDisableFSMC() rccDisableAHB3(RCC_AHB3ENR_FSMCEN)
  1434. #endif
  1435. #endif
  1436. /**
  1437. * @brief Resets the FSMC peripheral.
  1438. *
  1439. * @api
  1440. */
  1441. #if STM32_HAS_FSMC || defined(__DOXYGEN__)
  1442. #if STM32_FSMC_IS_FMC || defined(__DOXYGEN__)
  1443. #define rccResetFSMC() rccResetAHB3(RCC_AHB3RSTR_FMCRST)
  1444. #else
  1445. #define rccResetFSMC() rccResetAHB3(RCC_AHB3RSTR_FSMCRST)
  1446. #endif
  1447. #endif
  1448. /** @} */
  1449. /*===========================================================================*/
  1450. /* External declarations. */
  1451. /*===========================================================================*/
  1452. #ifdef __cplusplus
  1453. extern "C" {
  1454. #endif
  1455. #ifdef __cplusplus
  1456. }
  1457. #endif
  1458. #endif /* STM32_RCC_H */
  1459. /** @} */