stm32_rcc.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721
  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 STM32F7xx/stm32_rcc.h
  15. * @brief RCC helper driver header.
  16. * @note This file requires definitions from the ST header file
  17. * @p stm32f7xx.h.
  18. *
  19. * @addtogroup STM32F7xx_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, low set
  47. * @param[in] lp low power enable flag
  48. *
  49. * @api
  50. */
  51. #define rccEnableAPB1L(mask, lp) { \
  52. RCC->APB1LENR |= (mask); \
  53. if (lp) \
  54. RCC->APB1LLPENR |= (mask); \
  55. else \
  56. RCC->APB1LLPENR &= ~(mask); \
  57. (void)RCC->APB1LLPENR; \
  58. }
  59. /**
  60. * @brief Enables the clock of one or more peripheral on the APB1 bus.
  61. *
  62. * @param[in] mask APB1 peripherals mask, high set
  63. * @param[in] lp low power enable flag
  64. *
  65. * @api
  66. */
  67. #define rccEnableAPB1H(mask, lp) { \
  68. RCC->APB1HENR |= (mask); \
  69. if (lp) \
  70. RCC->APB1HLPENR |= (mask); \
  71. else \
  72. RCC->APB1HLPENR &= ~(mask); \
  73. (void)RCC->APB1HLPENR; \
  74. }
  75. /**
  76. * @brief Disables the clock of one or more peripheral on the APB1 bus.
  77. *
  78. * @param[in] mask APB1 peripherals mask, low set
  79. *
  80. * @api
  81. */
  82. #define rccDisableAPB1L(mask) { \
  83. RCC->APB1LENR &= ~(mask); \
  84. RCC->APB1LLPENR &= ~(mask); \
  85. (void)RCC->APB1LLPENR; \
  86. }
  87. /**
  88. * @brief Disables the clock of one or more peripheral on the APB1 bus.
  89. *
  90. * @param[in] mask APB1 peripherals mask, high set
  91. *
  92. * @api
  93. */
  94. #define rccDisableAPB1H(mask) { \
  95. RCC->APB1HENR &= ~(mask); \
  96. RCC->APB1HLPENR &= ~(mask); \
  97. (void)RCC->APB1HLPENR; \
  98. }
  99. /**
  100. * @brief Resets one or more peripheral on the APB1 bus.
  101. *
  102. * @param[in] mask APB1 peripherals mask, low set
  103. *
  104. * @api
  105. */
  106. #define rccResetAPB1L(mask) { \
  107. RCC->APB1LRSTR |= (mask); \
  108. RCC->APB1LRSTR &= ~(mask); \
  109. (void)RCC->APB1LRSTR; \
  110. }
  111. /**
  112. * @brief Resets one or more peripheral on the APB1 bus.
  113. *
  114. * @param[in] mask APB1 peripherals mask, high set
  115. *
  116. * @api
  117. */
  118. #define rccResetAPB1H(mask) { \
  119. RCC->APB1HRSTR |= (mask); \
  120. RCC->APB1HRSTR &= ~(mask); \
  121. (void)RCC->APB1HRSTR; \
  122. }
  123. /**
  124. * @brief Enables the clock of one or more peripheral on the APB2 bus.
  125. *
  126. * @param[in] mask APB2 peripherals mask
  127. * @param[in] lp low power enable flag
  128. *
  129. * @api
  130. */
  131. #define rccEnableAPB2(mask, lp) { \
  132. RCC->APB2ENR |= (mask); \
  133. if (lp) \
  134. RCC->APB2LPENR |= (mask); \
  135. else \
  136. RCC->APB2LPENR &= ~(mask); \
  137. (void)RCC->APB2LPENR; \
  138. }
  139. /**
  140. * @brief Disables the clock of one or more peripheral on the APB2 bus.
  141. *
  142. * @param[in] mask APB2 peripherals mask
  143. *
  144. * @api
  145. */
  146. #define rccDisableAPB2(mask) { \
  147. RCC->APB2ENR &= ~(mask); \
  148. RCC->APB2LPENR &= ~(mask); \
  149. (void)RCC->APB2LPENR; \
  150. }
  151. /**
  152. * @brief Resets one or more peripheral on the APB2 bus.
  153. *
  154. * @param[in] mask APB2 peripherals mask
  155. *
  156. * @api
  157. */
  158. #define rccResetAPB2(mask) { \
  159. RCC->APB2RSTR |= (mask); \
  160. RCC->APB2RSTR &= ~(mask); \
  161. (void)RCC->APB2RSTR; \
  162. }
  163. /**
  164. * @brief Enables the clock of one or more peripheral on the APB3 bus.
  165. *
  166. * @param[in] mask APB3 peripherals mask
  167. * @param[in] lp low power enable flag
  168. *
  169. * @api
  170. */
  171. #define rccEnableAPB3(mask, lp) { \
  172. RCC->APB3ENR |= (mask); \
  173. if (lp) \
  174. RCC->APB3LPENR |= (mask); \
  175. else \
  176. RCC->APB3LPENR &= ~(mask); \
  177. (void)RCC->APB3LPENR; \
  178. }
  179. /**
  180. * @brief Disables the clock of one or more peripheral on the APB3 bus.
  181. *
  182. * @param[in] mask APB3 peripherals mask
  183. *
  184. * @api
  185. */
  186. #define rccDisableAPB3(mask) { \
  187. RCC->APB3ENR &= ~(mask); \
  188. RCC->APB3LPENR &= ~(mask); \
  189. (void)RCC->APB3LPENR; \
  190. }
  191. /**
  192. * @brief Resets one or more peripheral on the APB3 bus.
  193. *
  194. * @param[in] mask APB2 peripherals mask
  195. *
  196. * @api
  197. */
  198. #define rccResetAPB3(mask) { \
  199. RCC->APB3RSTR |= (mask); \
  200. RCC->APB3RSTR &= ~(mask); \
  201. (void)RCC->APB3RSTR; \
  202. }
  203. /**
  204. * @brief Enables the clock of one or more peripheral on the APB4 bus.
  205. *
  206. * @param[in] mask APB4 peripherals mask
  207. * @param[in] lp low power enable flag
  208. *
  209. * @api
  210. */
  211. #define rccEnableAPB4(mask, lp) { \
  212. RCC->APB4ENR |= (mask); \
  213. if (lp) \
  214. RCC->APB4LPENR |= (mask); \
  215. else \
  216. RCC->APB4LPENR &= ~(mask); \
  217. (void)RCC->APB4LPENR; \
  218. }
  219. /**
  220. * @brief Disables the clock of one or more peripheral on the APB4 bus.
  221. *
  222. * @param[in] mask APB4 peripherals mask
  223. *
  224. * @api
  225. */
  226. #define rccDisableAPB4(mask) { \
  227. RCC->APB4ENR &= ~(mask); \
  228. RCC->APB4LPENR &= ~(mask); \
  229. (void)RCC->APB4LPENR; \
  230. }
  231. /**
  232. * @brief Resets one or more peripheral on the APB4 bus.
  233. *
  234. * @param[in] mask APB4 peripherals mask
  235. *
  236. * @api
  237. */
  238. #define rccResetAPB4(mask) { \
  239. RCC->APB4RSTR |= (mask); \
  240. RCC->APB4RSTR &= ~(mask); \
  241. (void)RCC->APB4RSTR; \
  242. }
  243. /**
  244. * @brief Enables the clock of one or more peripheral on the AHB1 bus.
  245. *
  246. * @param[in] mask AHB1 peripherals mask
  247. * @param[in] lp low power enable flag
  248. *
  249. * @api
  250. */
  251. #define rccEnableAHB1(mask, lp) { \
  252. RCC->AHB1ENR |= (mask); \
  253. if (lp) \
  254. RCC->AHB1LPENR |= (mask); \
  255. else \
  256. RCC->AHB1LPENR &= ~(mask); \
  257. (void)RCC->AHB1LPENR; \
  258. }
  259. /**
  260. * @brief Disables the clock of one or more peripheral on the AHB1 bus.
  261. *
  262. * @param[in] mask AHB1 peripherals mask
  263. *
  264. * @api
  265. */
  266. #define rccDisableAHB1(mask) { \
  267. RCC->AHB1ENR &= ~(mask); \
  268. RCC->AHB1LPENR &= ~(mask); \
  269. (void)RCC->AHB1LPENR; \
  270. }
  271. /**
  272. * @brief Resets one or more peripheral on the AHB1 bus.
  273. *
  274. * @param[in] mask AHB1 peripherals mask
  275. *
  276. * @api
  277. */
  278. #define rccResetAHB1(mask) { \
  279. RCC->AHB1RSTR |= (mask); \
  280. RCC->AHB1RSTR &= ~(mask); \
  281. (void)RCC->AHB1RSTR; \
  282. }
  283. /**
  284. * @brief Enables the clock of one or more peripheral on the AHB2 bus.
  285. *
  286. * @param[in] mask AHB2 peripherals mask
  287. * @param[in] lp low power enable flag
  288. *
  289. * @api
  290. */
  291. #define rccEnableAHB2(mask, lp) { \
  292. RCC->AHB2ENR |= (mask); \
  293. if (lp) \
  294. RCC->AHB2LPENR |= (mask); \
  295. else \
  296. RCC->AHB2LPENR &= ~(mask); \
  297. (void)RCC->AHB2LPENR; \
  298. }
  299. /**
  300. * @brief Disables the clock of one or more peripheral on the AHB2 bus.
  301. *
  302. * @param[in] mask AHB2 peripherals mask
  303. *
  304. * @api
  305. */
  306. #define rccDisableAHB2(mask) { \
  307. RCC->AHB2ENR &= ~(mask); \
  308. RCC->AHB2LPENR &= ~(mask); \
  309. (void)RCC->AHB2LPENR; \
  310. }
  311. /**
  312. * @brief Resets one or more peripheral on the AHB2 bus.
  313. *
  314. * @param[in] mask AHB2 peripherals mask
  315. *
  316. * @api
  317. */
  318. #define rccResetAHB2(mask) { \
  319. RCC->AHB2RSTR |= (mask); \
  320. RCC->AHB2RSTR &= ~(mask); \
  321. (void)RCC->AHB2RSTR; \
  322. }
  323. /**
  324. * @brief Enables the clock of one or more peripheral on the AHB3 bus.
  325. *
  326. * @param[in] mask AHB3 peripherals mask
  327. * @param[in] lp low power enable flag
  328. *
  329. * @api
  330. */
  331. #define rccEnableAHB3(mask, lp) { \
  332. RCC->AHB3ENR |= (mask); \
  333. if (lp) \
  334. RCC->AHB3LPENR |= (mask); \
  335. else \
  336. RCC->AHB3LPENR &= ~(mask); \
  337. (void)RCC->AHB3LPENR; \
  338. }
  339. /**
  340. * @brief Disables the clock of one or more peripheral on the AHB3 bus.
  341. *
  342. * @param[in] mask AHB3 peripherals mask
  343. *
  344. * @api
  345. */
  346. #define rccDisableAHB3(mask) { \
  347. RCC->AHB3ENR &= ~(mask); \
  348. RCC->AHB3LPENR &= ~(mask); \
  349. (void)RCC->AHB3LPENR; \
  350. }
  351. /**
  352. * @brief Resets one or more peripheral on the AHB3 bus.
  353. *
  354. * @param[in] mask AHB3 peripherals mask
  355. *
  356. * @api
  357. */
  358. #define rccResetAHB3(mask) { \
  359. RCC->AHB3RSTR |= (mask); \
  360. RCC->AHB3RSTR &= ~(mask); \
  361. (void)RCC->AHB3RSTR; \
  362. }
  363. /**
  364. * @brief Enables the clock of one or more peripheral on the AHB4 bus.
  365. *
  366. * @param[in] mask AHB4 peripherals mask
  367. * @param[in] lp low power enable flag
  368. *
  369. * @api
  370. */
  371. #define rccEnableAHB4(mask, lp) { \
  372. RCC->AHB4ENR |= (mask); \
  373. if (lp) \
  374. RCC->AHB4LPENR |= (mask); \
  375. else \
  376. RCC->AHB4LPENR &= ~(mask); \
  377. (void)RCC->AHB4LPENR; \
  378. }
  379. /**
  380. * @brief Disables the clock of one or more peripheral on the AHB4 bus.
  381. *
  382. * @param[in] mask AHB4 peripherals mask
  383. *
  384. * @api
  385. */
  386. #define rccDisableAHB4(mask) { \
  387. RCC->AHB4ENR &= ~(mask); \
  388. RCC->AHB4LPENR &= ~(mask); \
  389. (void)RCC->AHB4LPENR; \
  390. }
  391. /**
  392. * @brief Resets one or more peripheral on the AHB4 bus.
  393. *
  394. * @param[in] mask AHB4 peripherals mask
  395. *
  396. * @api
  397. */
  398. #define rccResetAHB4(mask) { \
  399. RCC->AHB4RSTR |= (mask); \
  400. RCC->AHB4RSTR &= ~(mask); \
  401. (void)RCC->AHB4RSTR; \
  402. }
  403. /** @} */
  404. /**
  405. * @name ADC peripherals specific RCC operations
  406. * @{
  407. */
  408. /**
  409. * @brief Enables the ADC1/ADC2 peripheral clock.
  410. *
  411. * @param[in] lp low power enable flag
  412. *
  413. * @api
  414. */
  415. #define rccEnableADC12(lp) rccEnableAHB1(RCC_AHB1ENR_ADC12EN, lp)
  416. /**
  417. * @brief Disables the ADC1/ADC2 peripheral clock.
  418. *
  419. * @api
  420. */
  421. #define rccDisableADC12() rccDisableAHB1(RCC_AHB1ENR_ADC12EN)
  422. /**
  423. * @brief Resets the ADC1/ADC2 peripheral.
  424. *
  425. * @api
  426. */
  427. #define rccResetADC12() rccResetAHB1(RCC_AHB1RSTR_ADC12RST)
  428. /**
  429. * @brief Enables the ADC3 peripheral clock.
  430. *
  431. * @param[in] lp low power enable flag
  432. *
  433. * @api
  434. */
  435. #define rccEnableADC3(lp) rccEnableAHB4(RCC_AHB4ENR_ADC3EN, lp)
  436. /**
  437. * @brief Disables the ADC3 peripheral clock.
  438. *
  439. * @api
  440. */
  441. #define rccDisableADC3() rccDisableAHB4(RCC_AHB4ENR_ADC3EN)
  442. /**
  443. * @brief Resets the ADC3 peripheral.
  444. *
  445. * @api
  446. */
  447. #define rccResetADC3() rccResetAHB4(RCC_AHB4RSTR_ADC3RST)
  448. /** @} */
  449. /**
  450. * @name DAC peripheral specific RCC operations
  451. * @{
  452. */
  453. /**
  454. * @brief Enables the DAC1 peripheral clock.
  455. *
  456. * @param[in] lp low power enable flag
  457. *
  458. * @api
  459. */
  460. #define rccEnableDAC1(lp) rccEnableAPB1L(RCC_APB1LENR_DAC12EN, lp)
  461. /**
  462. * @brief Disables the DAC1 peripheral clock.
  463. *
  464. * @api
  465. */
  466. #define rccDisableDAC1() rccDisableAPB1L(RCC_APB1LENR_DAC12EN)
  467. /**
  468. * @brief Resets the DAC1 peripheral.
  469. *
  470. * @api
  471. */
  472. #define rccResetDAC1() rccResetAPB1L(RCC_APB1LRSTR_DAC12RST)
  473. /** @} */
  474. /**
  475. * @name DMA peripheral specific RCC operations
  476. * @{
  477. */
  478. /**
  479. * @brief Enables the BDMA1 peripheral clock.
  480. *
  481. * @param[in] lp low power enable flag
  482. *
  483. * @api
  484. */
  485. #define rccEnableBDMA1(lp) rccEnableAHB4(RCC_AHB4ENR_BDMAEN, lp)
  486. /**
  487. * @brief Disables the BDMA1 peripheral clock.
  488. *
  489. * @api
  490. */
  491. #define rccDisableBDMA1() rccDisableAHB4(RCC_AHB4ENR_BDMAEN)
  492. /**
  493. * @brief Resets the BDMA1 peripheral.
  494. *
  495. * @api
  496. */
  497. #define rccResetBDMA1() rccResetAHB4(RCC_AHB4RSTR_BDMARST)
  498. /**
  499. * @brief Enables the DMA1 peripheral clock.
  500. *
  501. * @param[in] lp low power enable flag
  502. *
  503. * @api
  504. */
  505. #define rccEnableDMA1(lp) rccEnableAHB1(RCC_AHB1ENR_DMA1EN, lp)
  506. /**
  507. * @brief Disables the DMA1 peripheral clock.
  508. *
  509. * @api
  510. */
  511. #define rccDisableDMA1() rccDisableAHB1(RCC_AHB1ENR_DMA1EN)
  512. /**
  513. * @brief Resets the DMA1 peripheral.
  514. *
  515. * @api
  516. */
  517. #define rccResetDMA1() rccResetAHB1(RCC_AHB1RSTR_DMA1RST)
  518. /**
  519. * @brief Enables the DMA2 peripheral clock.
  520. *
  521. * @param[in] lp low power enable flag
  522. *
  523. * @api
  524. */
  525. #define rccEnableDMA2(lp) rccEnableAHB1(RCC_AHB1ENR_DMA2EN, lp)
  526. /**
  527. * @brief Disables the DMA2 peripheral clock.
  528. *
  529. * @api
  530. */
  531. #define rccDisableDMA2() rccDisableAHB1(RCC_AHB1ENR_DMA2EN)
  532. /**
  533. * @brief Resets the DMA2 peripheral.
  534. *
  535. * @api
  536. */
  537. #define rccResetDMA2() rccResetAHB1(RCC_AHB1RSTR_DMA2RST)
  538. /** @} */
  539. /**
  540. * @name RAM specific RCC operations
  541. * @{
  542. */
  543. /**
  544. * @brief Enables the BKPRAM clock.
  545. *
  546. * @param[in] lp low power enable flag
  547. *
  548. * @api
  549. */
  550. #define rccEnableBKPRAM(lp) rccEnableAHB4(RCC_AHB4ENR_BKPRAMEN, lp)
  551. /**
  552. * @brief Disables the BKPRAM clock.
  553. *
  554. * @api
  555. */
  556. #define rccDisableBKPRAM() rccDisableAHB4(RCC_AHB4ENR_BKPRAMEN)
  557. /**
  558. * @brief Enables the SRAM1 clock.
  559. *
  560. * @param[in] lp low power enable flag
  561. *
  562. * @api
  563. */
  564. #define rccEnableSRAM1(lp) rccEnableAHB2(RCC_AHB2ENR_D2SRAM1EN, lp)
  565. /**
  566. * @brief Disables the SRAM1 clock.
  567. *
  568. * @api
  569. */
  570. #define rccDisableSRAM1() rccDisableAHB2(RCC_AHB2ENR_D2SRAM1EN)
  571. /**
  572. * @brief Enables the SRAM2 clock.
  573. *
  574. * @param[in] lp low power enable flag
  575. *
  576. * @api
  577. */
  578. #define rccEnableSRAM2(lp) rccEnableAHB2(RCC_AHB2ENR_D2SRAM2EN, lp)
  579. /**
  580. * @brief Disables the SRAM2 clock.
  581. *
  582. * @api
  583. */
  584. #define rccDisableSRAM2() rccDisableAHB2(RCC_AHB2ENR_D2SRAM2EN)
  585. /**
  586. * @brief Enables the SRAM3 clock.
  587. *
  588. * @param[in] lp low power enable flag
  589. *
  590. * @api
  591. */
  592. #define rccEnableSRAM3(lp) rccEnableAHB2(RCC_AHB2ENR_D2SRAM3EN, lp)
  593. /**
  594. * @brief Disables the SRAM3 clock.
  595. *
  596. * @api
  597. */
  598. #define rccDisableSRAM3() rccDisableAHB2(RCC_AHB2ENR_D2SRAM3EN)
  599. /** @} */
  600. /**
  601. * @name ETH peripheral specific RCC operations
  602. * @{
  603. */
  604. /**
  605. * @brief Enables the ETH peripheral clock.
  606. *
  607. * @param[in] lp low power enable flag
  608. *
  609. * @api
  610. */
  611. #define rccEnableETH(lp) rccEnableAHB1(RCC_AHB1ENR_ETHMACEN | \
  612. RCC_AHB1ENR_ETHMACTXEN | \
  613. RCC_AHB1ENR_ETHMACRXEN, lp)
  614. /**
  615. * @brief Disables the ETH peripheral clock.
  616. *
  617. * @api
  618. */
  619. #define rccDisableETH() rccDisableAHB1(RCC_AHB1ENR_ETHMACEN | \
  620. RCC_AHB1ENR_ETHMACTXEN | \
  621. RCC_AHB1ENR_ETHMACRXEN)
  622. /**
  623. * @brief Resets the ETH peripheral.
  624. *
  625. * @api
  626. */
  627. #define rccResetETH() rccResetAHB1(RCC_AHB1RSTR_ETHMACRST)
  628. /** @} */
  629. /**
  630. * @name I2C peripherals specific RCC operations
  631. * @{
  632. */
  633. /**
  634. * @brief Enables the I2C1 peripheral clock.
  635. *
  636. * @param[in] lp low power enable flag
  637. *
  638. * @api
  639. */
  640. #define rccEnableI2C1(lp) rccEnableAPB1L(RCC_APB1LENR_I2C1EN, lp)
  641. /**
  642. * @brief Disables the I2C1 peripheral clock.
  643. *
  644. * @api
  645. */
  646. #define rccDisableI2C1() rccDisableAPB1L(RCC_APB1LENR_I2C1EN)
  647. /**
  648. * @brief Resets the I2C1 peripheral.
  649. *
  650. * @api
  651. */
  652. #define rccResetI2C1() rccResetAPB1L(RCC_APB1LRSTR_I2C1RST)
  653. /**
  654. * @brief Enables the I2C2 peripheral clock.
  655. *
  656. * @param[in] lp low power enable flag
  657. *
  658. * @api
  659. */
  660. #define rccEnableI2C2(lp) rccEnableAPB1L(RCC_APB1LENR_I2C2EN, lp)
  661. /**
  662. * @brief Disables the I2C2 peripheral clock.
  663. *
  664. * @api
  665. */
  666. #define rccDisableI2C2() rccDisableAPB1L(RCC_APB1LENR_I2C2EN)
  667. /**
  668. * @brief Resets the I2C2 peripheral.
  669. *
  670. * @api
  671. */
  672. #define rccResetI2C2() rccResetAPB1L(RCC_APB1LRSTR_I2C2RST)
  673. /**
  674. * @brief Enables the I2C3 peripheral clock.
  675. *
  676. * @param[in] lp low power enable flag
  677. *
  678. * @api
  679. */
  680. #define rccEnableI2C3(lp) rccEnableAPB1L(RCC_APB1LENR_I2C3EN, lp)
  681. /**
  682. * @brief Disables the I2C3 peripheral clock.
  683. *
  684. * @api
  685. */
  686. #define rccDisableI2C3() rccDisableAPB1L(RCC_APB1LENR_I2C3EN)
  687. /**
  688. * @brief Resets the I2C3 peripheral.
  689. *
  690. * @api
  691. */
  692. #define rccResetI2C3() rccResetAPB1L(RCC_APB1LRSTR_I2C3RST)
  693. /**
  694. * @brief Enables the I2C4 peripheral clock.
  695. *
  696. * @param[in] lp low power enable flag
  697. *
  698. * @api
  699. */
  700. #define rccEnableI2C4(lp) rccEnableAPB4(RCC_APB4ENR_I2C4EN, lp)
  701. /**
  702. * @brief Disables the I2C4 peripheral clock.
  703. *
  704. * @api
  705. */
  706. #define rccDisableI2C4() rccDisableAPB4(RCC_APB4ENR_I2C4EN)
  707. /**
  708. * @brief Resets the I2C4 peripheral.
  709. *
  710. * @api
  711. */
  712. #define rccResetI2C4() rccResetAPB4(RCC_APB4RSTR_I2C4RST)
  713. /** @} */
  714. /**
  715. * @name OTG peripherals specific RCC operations
  716. * @{
  717. */
  718. /**
  719. * @brief Enables the USB1_OTG_HS peripheral clock.
  720. *
  721. * @param[in] lp low power enable flag
  722. *
  723. * @api
  724. */
  725. #define rccEnableUSB1_OTG_HS(lp) rccEnableAHB1(RCC_AHB1ENR_USB1OTGHSEN, lp)
  726. /**
  727. * @brief Disables the USB1_OTG_HS peripheral clock.
  728. *
  729. * @api
  730. */
  731. #define rccDisableUSB1_OTG_HS() rccDisableAHB1(RCC_AHB1ENR_USB1OTGHSEN)
  732. /**
  733. * @brief Resets the USB1_OTG_HS peripheral.
  734. *
  735. * @api
  736. */
  737. #define rccResetUSB1_OTG_HS() rccResetAHB1(RCC_AHB1RSTR_USB1OTGHSRST)
  738. /**
  739. * @brief Enables the USB2_OTG_HS peripheral clock.
  740. *
  741. * @param[in] lp low power enable flag
  742. *
  743. * @api
  744. */
  745. #define rccEnableUSB2_OTG_HS(lp) rccEnableAHB1(RCC_AHB1ENR_USB2OTGHSEN, lp)
  746. /**
  747. * @brief Disables the USB2_OTG_HS peripheral clock.
  748. *
  749. * @api
  750. */
  751. #define rccDisableUSB2_OTG_HS() rccDisableAHB1(RCC_AHB1ENR_USB2OTGHSEN)
  752. /**
  753. * @brief Resets the USB2_OTG_HS peripheral.
  754. *
  755. * @api
  756. */
  757. #define rccResetUSB2_OTG_HS() rccResetAHB1(RCC_AHB1RSTR_USB2OTGHSRST)
  758. /**
  759. * @brief Enables the USB1_OTG_HS ULPI peripheral clock.
  760. *
  761. * @param[in] lp low power enable flag
  762. *
  763. * @api
  764. */
  765. #define rccEnableUSB1_HSULPI(lp) rccEnableAHB1(RCC_AHB1ENR_USB1OTGHSULPIEN, lp)
  766. /**
  767. * @brief Disables the USB1_OTG_HS peripheral clock.
  768. *
  769. * @api
  770. */
  771. #define rccDisableUSB1_HSULPI() rccDisableAHB1(RCC_AHB1ENR_USB1OTGHSULPIEN)
  772. /**
  773. * @brief Enables the USB2_OTG_HS ULPI peripheral clock.
  774. *
  775. * @param[in] lp low power enable flag
  776. *
  777. * @api
  778. */
  779. #define rccEnableUSB2_HSULPI(lp) rccEnableAHB1(RCC_AHB1ENR_USB2OTGHSULPIEN, lp)
  780. /**
  781. * @brief Disables the USB2_OTG_HS peripheral clock.
  782. *
  783. * @api
  784. */
  785. #define rccDisableUSB2_HSULPI() rccDisableAHB1(RCC_AHB1ENR_USB2OTGHSULPIEN)
  786. /** @} */
  787. /**
  788. * @name QUADSPI peripherals specific RCC operations
  789. * @{
  790. */
  791. /**
  792. * @brief Enables the QUADSPI1 peripheral clock.
  793. *
  794. * @param[in] lp low power enable flag
  795. *
  796. * @api
  797. */
  798. #define rccEnableQUADSPI1(lp) rccEnableAHB3(RCC_AHB3ENR_QSPIEN, lp)
  799. /**
  800. * @brief Disables the QUADSPI1 peripheral clock.
  801. *
  802. * @api
  803. */
  804. #define rccDisableQUADSPI1() rccDisableAHB3(RCC_AHB3ENR_QSPIEN)
  805. /**
  806. * @brief Resets the QUADSPI1 peripheral.
  807. *
  808. * @api
  809. */
  810. #define rccResetQUADSPI1() rccResetAHB3(RCC_AHB3RSTR_QSPIRST)
  811. /** @} */
  812. /**
  813. * @name SDMMC peripheral specific RCC operations
  814. * @{
  815. */
  816. /**
  817. * @brief Enables the SDMMC1 peripheral clock.
  818. *
  819. * @param[in] lp low power enable flag
  820. *
  821. * @api
  822. */
  823. #define rccEnableSDMMC1(lp) rccEnableAHB3(RCC_AHB3ENR_SDMMC1EN, lp)
  824. /**
  825. * @brief Disables the SDMMC1 peripheral clock.
  826. *
  827. * @api
  828. */
  829. #define rccDisableSDMMC1() rccDisableAHB3(RCC_AHB3ENR_SDMMC1EN)
  830. /**
  831. * @brief Resets the SDMMC1 peripheral.
  832. *
  833. * @api
  834. */
  835. #define rccResetSDMMC1() rccResetAHB3(RCC_AHB3RSTR_SDMMC1RST)
  836. /**
  837. * @brief Enables the SDMMC2 peripheral clock.
  838. *
  839. * @param[in] lp low power enable flag
  840. *
  841. * @api
  842. */
  843. #define rccEnableSDMMC2(lp) rccEnableAHB3(RCC_AHB3ENR_SDMMC2EN, lp)
  844. /**
  845. * @brief Disables the SDMMC2 peripheral clock.
  846. *
  847. * @api
  848. */
  849. #define rccDisableSDMMC2() rccDisableAHB3(RCC_AHB3ENR_SDMMC2EN)
  850. /**
  851. * @brief Resets the SDMMC2 peripheral.
  852. *
  853. * @api
  854. */
  855. #define rccResetSDMMC2() rccResetAHB3(RCC_AHB3RSTR_SDMMC2RST)
  856. /** @} */
  857. /**
  858. * @name SPI peripherals specific RCC operations
  859. * @{
  860. */
  861. /**
  862. * @brief Enables the SPI1 peripheral clock.
  863. *
  864. * @param[in] lp low power enable flag
  865. *
  866. * @api
  867. */
  868. #define rccEnableSPI1(lp) rccEnableAPB2(RCC_APB2ENR_SPI1EN, lp)
  869. /**
  870. * @brief Disables the SPI1 peripheral clock.
  871. *
  872. * @api
  873. */
  874. #define rccDisableSPI1() rccDisableAPB2(RCC_APB2ENR_SPI1EN)
  875. /**
  876. * @brief Resets the SPI1 peripheral.
  877. *
  878. * @api
  879. */
  880. #define rccResetSPI1() rccResetAPB2(RCC_APB2RSTR_SPI1RST)
  881. /**
  882. * @brief Enables the SPI2 peripheral clock.
  883. *
  884. * @param[in] lp low power enable flag
  885. *
  886. * @api
  887. */
  888. #define rccEnableSPI2(lp) rccEnableAPB1L(RCC_APB1LENR_SPI2EN, lp)
  889. /**
  890. * @brief Disables the SPI2 peripheral clock.
  891. *
  892. * @api
  893. */
  894. #define rccDisableSPI2() rccDisableAPB1L(RCC_APB1LENR_SPI2EN)
  895. /**
  896. * @brief Resets the SPI2 peripheral.
  897. *
  898. * @api
  899. */
  900. #define rccResetSPI2() rccResetAPB1L(RCC_APB1LRSTR_SPI2RST)
  901. /**
  902. * @brief Enables the SPI3 peripheral clock.
  903. *
  904. * @param[in] lp low power enable flag
  905. *
  906. * @api
  907. */
  908. #define rccEnableSPI3(lp) rccEnableAPB1L(RCC_APB1LENR_SPI3EN, lp)
  909. /**
  910. * @brief Disables the SPI3 peripheral clock.
  911. *
  912. * @api
  913. */
  914. #define rccDisableSPI3() rccDisableAPB1L(RCC_APB1LENR_SPI3EN)
  915. /**
  916. * @brief Resets the SPI3 peripheral.
  917. *
  918. * @api
  919. */
  920. #define rccResetSPI3() rccResetAPB1L(RCC_APB1LRSTR_SPI3RST)
  921. /**
  922. * @brief Enables the SPI4 peripheral clock.
  923. *
  924. * @param[in] lp low power enable flag
  925. *
  926. * @api
  927. */
  928. #define rccEnableSPI4(lp) rccEnableAPB2(RCC_APB2ENR_SPI4EN, lp)
  929. /**
  930. * @brief Disables the SPI4 peripheral clock.
  931. *
  932. * @api
  933. */
  934. #define rccDisableSPI4() rccDisableAPB2(RCC_APB2ENR_SPI4EN)
  935. /**
  936. * @brief Resets the SPI4 peripheral.
  937. *
  938. * @api
  939. */
  940. #define rccResetSPI4() rccResetAPB2(RCC_APB2RSTR_SPI4RST)
  941. /**
  942. * @brief Enables the SPI5 peripheral clock.
  943. *
  944. * @param[in] lp low power enable flag
  945. *
  946. * @api
  947. */
  948. #define rccEnableSPI5(lp) rccEnableAPB2(RCC_APB2ENR_SPI5EN, lp)
  949. /**
  950. * @brief Disables the SPI5 peripheral clock.
  951. *
  952. * @api
  953. */
  954. #define rccDisableSPI5() rccDisableAPB2(RCC_APB2ENR_SPI5EN)
  955. /**
  956. * @brief Resets the SPI5 peripheral.
  957. *
  958. * @api
  959. */
  960. #define rccResetSPI5() rccResetAPB2(RCC_APB2RSTR_SPI5RST)
  961. /**
  962. * @brief Enables the SPI6 peripheral clock.
  963. *
  964. * @param[in] lp low power enable flag
  965. *
  966. * @api
  967. */
  968. #define rccEnableSPI6(lp) rccEnableAPB4(RCC_APB4ENR_SPI6EN, lp)
  969. /**
  970. * @brief Disables the SPI6 peripheral clock.
  971. *
  972. * @api
  973. */
  974. #define rccDisableSPI6() rccDisableAPB4(RCC_APB4ENR_SPI6EN)
  975. /**
  976. * @brief Resets the SPI6 peripheral.
  977. *
  978. * @api
  979. */
  980. #define rccResetSPI6() rccResetAPB4(RCC_APB4RSTR_SPI6RST)
  981. /** @} */
  982. /**
  983. * @name TIM peripherals specific RCC operations
  984. * @{
  985. */
  986. /**
  987. * @brief Enables the TIM1 peripheral clock.
  988. *
  989. * @param[in] lp low power enable flag
  990. *
  991. * @api
  992. */
  993. #define rccEnableTIM1(lp) rccEnableAPB2(RCC_APB2ENR_TIM1EN, lp)
  994. /**
  995. * @brief Disables the TIM1 peripheral clock.
  996. *
  997. * @api
  998. */
  999. #define rccDisableTIM1() rccDisableAPB2(RCC_APB2ENR_TIM1EN)
  1000. /**
  1001. * @brief Resets the TIM1 peripheral.
  1002. *
  1003. * @api
  1004. */
  1005. #define rccResetTIM1() rccResetAPB2(RCC_APB2RSTR_TIM1RST)
  1006. /**
  1007. * @brief Enables the TIM2 peripheral clock.
  1008. *
  1009. * @param[in] lp low power enable flag
  1010. *
  1011. * @api
  1012. */
  1013. #define rccEnableTIM2(lp) rccEnableAPB1L(RCC_APB1LENR_TIM2EN, lp)
  1014. /**
  1015. * @brief Disables the TIM2 peripheral clock.
  1016. *
  1017. * @api
  1018. */
  1019. #define rccDisableTIM2() rccDisableAPB1L(RCC_APB1LENR_TIM2EN)
  1020. /**
  1021. * @brief Resets the TIM2 peripheral.
  1022. *
  1023. * @api
  1024. */
  1025. #define rccResetTIM2() rccResetAPB1L(RCC_APB1LRSTR_TIM2RST)
  1026. /**
  1027. * @brief Enables the TIM3 peripheral clock.
  1028. *
  1029. * @param[in] lp low power enable flag
  1030. *
  1031. * @api
  1032. */
  1033. #define rccEnableTIM3(lp) rccEnableAPB1L(RCC_APB1LENR_TIM3EN, lp)
  1034. /**
  1035. * @brief Disables the TIM3 peripheral clock.
  1036. *
  1037. * @api
  1038. */
  1039. #define rccDisableTIM3() rccDisableAPB1L(RCC_APB1LENR_TIM3EN)
  1040. /**
  1041. * @brief Resets the TIM3 peripheral.
  1042. *
  1043. * @api
  1044. */
  1045. #define rccResetTIM3() rccResetAPB1L(RCC_APB1LRSTR_TIM3RST)
  1046. /**
  1047. * @brief Enables the TIM4 peripheral clock.
  1048. *
  1049. * @param[in] lp low power enable flag
  1050. *
  1051. * @api
  1052. */
  1053. #define rccEnableTIM4(lp) rccEnableAPB1L(RCC_APB1LENR_TIM4EN, lp)
  1054. /**
  1055. * @brief Disables the TIM4 peripheral clock.
  1056. *
  1057. * @api
  1058. */
  1059. #define rccDisableTIM4() rccDisableAPB1L(RCC_APB1LENR_TIM4EN)
  1060. /**
  1061. * @brief Resets the TIM4 peripheral.
  1062. *
  1063. * @api
  1064. */
  1065. #define rccResetTIM4() rccResetAPB1L(RCC_APB1LRSTR_TIM4RST)
  1066. /**
  1067. * @brief Enables the TIM5 peripheral clock.
  1068. *
  1069. * @param[in] lp low power enable flag
  1070. *
  1071. * @api
  1072. */
  1073. #define rccEnableTIM5(lp) rccEnableAPB1L(RCC_APB1LENR_TIM5EN, lp)
  1074. /**
  1075. * @brief Disables the TIM5 peripheral clock.
  1076. *
  1077. * @api
  1078. */
  1079. #define rccDisableTIM5() rccDisableAPB1L(RCC_APB1LENR_TIM5EN)
  1080. /**
  1081. * @brief Resets the TIM5 peripheral.
  1082. *
  1083. * @api
  1084. */
  1085. #define rccResetTIM5() rccResetAPB1L(RCC_APB1LRSTR_TIM5RST)
  1086. /**
  1087. * @brief Enables the TIM6 peripheral clock.
  1088. *
  1089. * @param[in] lp low power enable flag
  1090. *
  1091. * @api
  1092. */
  1093. #define rccEnableTIM6(lp) rccEnableAPB1L(RCC_APB1LENR_TIM6EN, lp)
  1094. /**
  1095. * @brief Disables the TIM6 peripheral clock.
  1096. *
  1097. * @api
  1098. */
  1099. #define rccDisableTIM6() rccDisableAPB1L(RCC_APB1LENR_TIM6EN)
  1100. /**
  1101. * @brief Resets the TIM6 peripheral.
  1102. *
  1103. * @api
  1104. */
  1105. #define rccResetTIM6() rccResetAPB1L(RCC_APB1LRSTR_TIM6RST)
  1106. /**
  1107. * @brief Enables the TIM7 peripheral clock.
  1108. *
  1109. * @param[in] lp low power enable flag
  1110. *
  1111. * @api
  1112. */
  1113. #define rccEnableTIM7(lp) rccEnableAPB1L(RCC_APB1LENR_TIM7EN, lp)
  1114. /**
  1115. * @brief Disables the TIM7 peripheral clock.
  1116. *
  1117. * @api
  1118. */
  1119. #define rccDisableTIM7() rccDisableAPB1L(RCC_APB1LENR_TIM7EN)
  1120. /**
  1121. * @brief Resets the TIM7 peripheral.
  1122. *
  1123. * @api
  1124. */
  1125. #define rccResetTIM7() rccResetAPB1L(RCC_APB1LRSTR_TIM7RST)
  1126. /**
  1127. * @brief Enables the TIM8 peripheral clock.
  1128. *
  1129. * @param[in] lp low power enable flag
  1130. *
  1131. * @api
  1132. */
  1133. #define rccEnableTIM8(lp) rccEnableAPB2(RCC_APB2ENR_TIM8EN, lp)
  1134. /**
  1135. * @brief Disables the TIM8 peripheral clock.
  1136. *
  1137. * @api
  1138. */
  1139. #define rccDisableTIM8() rccDisableAPB2(RCC_APB2ENR_TIM8EN)
  1140. /**
  1141. * @brief Resets the TIM8 peripheral.
  1142. *
  1143. * @api
  1144. */
  1145. #define rccResetTIM8() rccResetAPB2(RCC_APB2RSTR_TIM8RST)
  1146. /**
  1147. * @brief Enables the TIM12 peripheral clock.
  1148. *
  1149. * @param[in] lp low power enable flag
  1150. *
  1151. * @api
  1152. */
  1153. #define rccEnableTIM12(lp) rccEnableAPB1L(RCC_APB1LENR_TIM12EN, lp)
  1154. /**
  1155. * @brief Disables the TIM12 peripheral clock.
  1156. *
  1157. * @api
  1158. */
  1159. #define rccDisableTIM12() rccDisableAPB1L(RCC_APB1LENR_TIM12EN)
  1160. /**
  1161. * @brief Resets the TIM12 peripheral.
  1162. *
  1163. * @api
  1164. */
  1165. #define rccResetTIM12() rccResetAPB1L(RCC_APB1LRSTR_TIM12RST)
  1166. /**
  1167. * @brief Enables the TIM13 peripheral clock.
  1168. *
  1169. * @param[in] lp low power enable flag
  1170. *
  1171. * @api
  1172. */
  1173. #define rccEnableTIM13(lp) rccEnableAPB1L(RCC_APB1LENR_TIM13EN, lp)
  1174. /**
  1175. * @brief Disables the TIM13 peripheral clock.
  1176. *
  1177. * @api
  1178. */
  1179. #define rccDisableTIM13() rccDisableAPB1L(RCC_APB1LENR_TIM13EN)
  1180. /**
  1181. * @brief Resets the TIM13 peripheral.
  1182. *
  1183. * @api
  1184. */
  1185. #define rccResetTIM13() rccResetAPB1L(RCC_APB1LRSTR_TIM13RST)
  1186. /**
  1187. * @brief Enables the TIM14 peripheral clock.
  1188. *
  1189. * @param[in] lp low power enable flag
  1190. *
  1191. * @api
  1192. */
  1193. #define rccEnableTIM14(lp) rccEnableAPB1L(RCC_APB1LENR_TIM14EN, lp)
  1194. /**
  1195. * @brief Disables the TIM14 peripheral clock.
  1196. *
  1197. * @api
  1198. */
  1199. #define rccDisableTIM14() rccDisableAPB1L(RCC_APB1LENR_TIM14EN)
  1200. /**
  1201. * @brief Resets the TIM14 peripheral.
  1202. *
  1203. * @api
  1204. */
  1205. #define rccResetTIM14() rccResetAPB1L(RCC_APB1LRSTR_TIM14RST)
  1206. /**
  1207. * @brief Enables the TIM15 peripheral clock.
  1208. *
  1209. * @param[in] lp low power enable flag
  1210. *
  1211. * @api
  1212. */
  1213. #define rccEnableTIM15(lp) rccEnableAPB2(RCC_APB2ENR_TIM15EN, lp)
  1214. /**
  1215. * @brief Disables the TIM15 peripheral clock.
  1216. *
  1217. * @api
  1218. */
  1219. #define rccDisableTIM15() rccDisableAPB2(RCC_APB2ENR_TIM15EN)
  1220. /**
  1221. * @brief Resets the TIM15 peripheral.
  1222. *
  1223. * @api
  1224. */
  1225. #define rccResetTIM15() rccResetAPB2(RCC_APB2RSTR_TIM15RST)
  1226. /**
  1227. * @brief Enables the TIM16 peripheral clock.
  1228. *
  1229. * @param[in] lp low power enable flag
  1230. *
  1231. * @api
  1232. */
  1233. #define rccEnableTIM16(lp) rccEnableAPB2(RCC_APB2ENR_TIM16EN, lp)
  1234. /**
  1235. * @brief Disables the TIM16 peripheral clock.
  1236. *
  1237. * @api
  1238. */
  1239. #define rccDisableTIM16() rccDisableAPB2(RCC_APB2ENR_TIM16EN)
  1240. /**
  1241. * @brief Resets the TIM16 peripheral.
  1242. *
  1243. * @api
  1244. */
  1245. #define rccResetTIM16() rccResetAPB2(RCC_APB2RSTR_TIM16RST)
  1246. /**
  1247. * @brief Enables the TIM17 peripheral clock.
  1248. *
  1249. * @param[in] lp low power enable flag
  1250. *
  1251. * @api
  1252. */
  1253. #define rccEnableTIM17(lp) rccEnableAPB2(RCC_APB2ENR_TIM17EN, lp)
  1254. /**
  1255. * @brief Disables the TIM17 peripheral clock.
  1256. *
  1257. * @api
  1258. */
  1259. #define rccDisableTIM17() rccDisableAPB2(RCC_APB2ENR_TIM17EN)
  1260. /**
  1261. * @brief Resets the TIM17 peripheral.
  1262. *
  1263. * @api
  1264. */
  1265. #define rccResetTIM17() rccResetAPB2(RCC_APB2RSTR_TIM17RST)
  1266. /** @} */
  1267. /**
  1268. * @name USART/UART peripherals specific RCC operations
  1269. * @{
  1270. */
  1271. /**
  1272. * @brief Enables the USART1 peripheral clock.
  1273. *
  1274. * @param[in] lp low power enable flag
  1275. *
  1276. * @api
  1277. */
  1278. #define rccEnableUSART1(lp) rccEnableAPB2(RCC_APB2ENR_USART1EN, lp)
  1279. /**
  1280. * @brief Disables the USART1 peripheral clock.
  1281. *
  1282. * @api
  1283. */
  1284. #define rccDisableUSART1() rccDisableAPB2(RCC_APB2ENR_USART1EN)
  1285. /**
  1286. * @brief Resets the USART1 peripheral.
  1287. *
  1288. * @api
  1289. */
  1290. #define rccResetUSART1() rccResetAPB2(RCC_APB2RSTR_USART1RST)
  1291. /**
  1292. * @brief Enables the USART2 peripheral clock.
  1293. *
  1294. * @param[in] lp low power enable flag
  1295. *
  1296. * @api
  1297. */
  1298. #define rccEnableUSART2(lp) rccEnableAPB1L(RCC_APB1LENR_USART2EN, lp)
  1299. /**
  1300. * @brief Disables the USART2 peripheral clock.
  1301. *
  1302. * @api
  1303. */
  1304. #define rccDisableUSART2() rccDisableAPB1L(RCC_APB1LENR_USART2EN)
  1305. /**
  1306. * @brief Resets the USART2 peripheral.
  1307. *
  1308. * @api
  1309. */
  1310. #define rccResetUSART2() rccResetAPB1L(RCC_APB1LRSTR_USART2RST)
  1311. /**
  1312. * @brief Enables the USART3 peripheral clock.
  1313. *
  1314. * @param[in] lp low power enable flag
  1315. *
  1316. * @api
  1317. */
  1318. #define rccEnableUSART3(lp) rccEnableAPB1L(RCC_APB1LENR_USART3EN, lp)
  1319. /**
  1320. * @brief Disables the USART3 peripheral clock.
  1321. *
  1322. * @api
  1323. */
  1324. #define rccDisableUSART3() rccDisableAPB1L(RCC_APB1LENR_USART3EN)
  1325. /**
  1326. * @brief Resets the USART3 peripheral.
  1327. *
  1328. * @api
  1329. */
  1330. #define rccResetUSART3() rccResetAPB1L(RCC_APB1LRSTR_USART3RST)
  1331. /**
  1332. * @brief Enables the UART4 peripheral clock.
  1333. *
  1334. * @param[in] lp low power enable flag
  1335. *
  1336. * @api
  1337. */
  1338. #define rccEnableUART4(lp) rccEnableAPB1L(RCC_APB1LENR_UART4EN, lp)
  1339. /**
  1340. * @brief Disables the UART4 peripheral clock.
  1341. *
  1342. * @api
  1343. */
  1344. #define rccDisableUART4() rccDisableAPB1L(RCC_APB1LENR_UART4EN)
  1345. /**
  1346. * @brief Resets the UART4 peripheral.
  1347. *
  1348. * @api
  1349. */
  1350. #define rccResetUART4() rccResetAPB1L(RCC_APB1LRSTR_UART4RST)
  1351. /**
  1352. * @brief Enables the UART5 peripheral clock.
  1353. *
  1354. * @param[in] lp low power enable flag
  1355. *
  1356. * @api
  1357. */
  1358. #define rccEnableUART5(lp) rccEnableAPB1L(RCC_APB1LENR_UART5EN, lp)
  1359. /**
  1360. * @brief Disables the UART5 peripheral clock.
  1361. *
  1362. * @api
  1363. */
  1364. #define rccDisableUART5() rccDisableAPB1L(RCC_APB1LENR_UART5EN)
  1365. /**
  1366. * @brief Resets the UART5 peripheral.
  1367. *
  1368. * @api
  1369. */
  1370. #define rccResetUART5() rccResetAPB1L(RCC_APB1LRSTR_UART5RST)
  1371. /**
  1372. * @brief Enables the USART6 peripheral clock.
  1373. *
  1374. * @param[in] lp low power enable flag
  1375. *
  1376. * @api
  1377. */
  1378. #define rccEnableUSART6(lp) rccEnableAPB2(RCC_APB2ENR_USART6EN, lp)
  1379. /**
  1380. * @brief Disables the USART6 peripheral clock.
  1381. *
  1382. * @api
  1383. */
  1384. #define rccDisableUSART6() rccDisableAPB2(RCC_APB2ENR_USART6EN)
  1385. /**
  1386. * @brief Resets the USART6 peripheral.
  1387. *
  1388. * @api
  1389. */
  1390. #define rccResetUSART6() rccResetAPB2(RCC_APB2RSTR_USART6RST)
  1391. /**
  1392. * @brief Enables the UART7 peripheral clock.
  1393. *
  1394. * @param[in] lp low power enable flag
  1395. *
  1396. * @api
  1397. */
  1398. #define rccEnableUART7(lp) rccEnableAPB1L(RCC_APB1LENR_UART7EN, lp)
  1399. /**
  1400. * @brief Disables the UART7 peripheral clock.
  1401. *
  1402. * @api
  1403. */
  1404. #define rccDisableUART7() rccDisableAPB1L(RCC_APB1LENR_UART7EN)
  1405. /**
  1406. * @brief Resets the UART7 peripheral.
  1407. *
  1408. * @api
  1409. */
  1410. #define rccResetUART7() rccResetAPB1L(RCC_APB1LRSTR_UART7RST)
  1411. /**
  1412. * @brief Enables the UART8 peripheral clock.
  1413. *
  1414. * @param[in] lp low power enable flag
  1415. *
  1416. * @api
  1417. */
  1418. #define rccEnableUART8(lp) rccEnableAPB1L(RCC_APB1LENR_UART8EN, lp)
  1419. /**
  1420. * @brief Disables the UART8 peripheral clock.
  1421. *
  1422. * @api
  1423. */
  1424. #define rccDisableUART8() rccDisableAPB1L(RCC_APB1LENR_UART8EN)
  1425. /**
  1426. * @brief Resets the UART8 peripheral.
  1427. *
  1428. * @api
  1429. */
  1430. #define rccResetUART8() rccResetAPB1L(RCC_APB1LRSTR_UART8RST)
  1431. /** @} */
  1432. /**
  1433. * @name LTDC peripheral specific RCC operations
  1434. * @{
  1435. */
  1436. /**
  1437. * @brief Enables the LTDC peripheral clock.
  1438. *
  1439. * @param[in] lp low power enable flag
  1440. *
  1441. * @api
  1442. */
  1443. #define rccEnableLTDC(lp) rccEnableAPB3(RCC_APB3ENR_LTDCEN, lp)
  1444. /**
  1445. * @brief Disables the LTDC peripheral clock.
  1446. . *
  1447. * @api
  1448. */
  1449. #define rccDisableLTDC() rccDisableAPB3(RCC_APB3ENR_LTDCEN)
  1450. /**
  1451. * @brief Resets the LTDC peripheral.
  1452. *
  1453. * @api
  1454. */
  1455. #define rccResetLTDC() rccResetAPB3(RCC_APB3RSTR_LTDCRST)
  1456. /**
  1457. * @name DMA2D peripheral specific RCC operations
  1458. * @{
  1459. */
  1460. /**
  1461. * @brief Enables the DMA2D peripheral clock.
  1462. *
  1463. * @param[in] lp low power enable flag
  1464. *
  1465. * @api
  1466. */
  1467. #define rccEnableDMA2D(lp) rccEnableAHB3(RCC_AHB3ENR_DMA2DEN, lp)
  1468. /**
  1469. * @brief Disables the DMA2D peripheral clock.
  1470. *
  1471. * @api
  1472. */
  1473. #define rccDisableDMA2D() rccDisableAHB3(RCC_AHB3ENR_DMA2DEN)
  1474. /**
  1475. * @brief Resets the DMA2D peripheral.
  1476. *
  1477. * @api
  1478. */
  1479. #define rccResetDMA2D() rccResetAHB3(RCC_AHB3RSTR_DMA2DRST)
  1480. /** @} */
  1481. /**
  1482. * @name FSMC peripherals specific RCC operations
  1483. * @{
  1484. */
  1485. /**
  1486. * @brief Enables the FSMC peripheral clock.
  1487. *
  1488. * @param[in] lp low power enable flag
  1489. *
  1490. * @api
  1491. */
  1492. #if defined(STM32_FSMC_IS_FMC)
  1493. #define rccEnableFSMC(lp) rccEnableAHB3(RCC_AHB3ENR_FMCEN, lp)
  1494. #else
  1495. #define rccEnableFSMC(lp) rccEnableAHB3(RCC_AHB3ENR_FSMCEN, lp)
  1496. #endif
  1497. /**
  1498. * @brief Disables the FSMC peripheral clock.
  1499. *
  1500. * @api
  1501. */
  1502. #if defined(STM32_FSMC_IS_FMC)
  1503. #define rccDisableFSMC() rccDisableAHB3(RCC_AHB3ENR_FMCEN)
  1504. #else
  1505. #define rccDisableFSMC() rccDisableAHB3(RCC_AHB3ENR_FSMCEN)
  1506. #endif
  1507. /**
  1508. * @brief Resets the FSMC peripheral.
  1509. *
  1510. * @api
  1511. */
  1512. #if defined(STM32_FSMC_IS_FMC)
  1513. #define rccResetFSMC() rccResetAHB3(RCC_AHB3RSTR_FMCRST)
  1514. #else
  1515. #define rccResetFSMC() rccResetAHB3(RCC_AHB3RSTR_FSMCRST)
  1516. #endif
  1517. /** @} */
  1518. /*===========================================================================*/
  1519. /* External declarations. */
  1520. /*===========================================================================*/
  1521. #ifdef __cplusplus
  1522. extern "C" {
  1523. #endif
  1524. #ifdef __cplusplus
  1525. }
  1526. #endif
  1527. #endif /* STM32_RCC_H */
  1528. /** @} */