stm32f7xx_hal_rcc_ex.h 229 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_rcc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file in
  13. * the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. ******************************************************************************
  16. */
  17. /* Define to prevent recursive inclusion -------------------------------------*/
  18. #ifndef __STM32F7xx_HAL_RCC_EX_H
  19. #define __STM32F7xx_HAL_RCC_EX_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32f7xx_hal_def.h"
  25. /** @addtogroup STM32F7xx_HAL_Driver
  26. * @{
  27. */
  28. /** @addtogroup RCCEx
  29. * @{
  30. */
  31. /* Exported types ------------------------------------------------------------*/
  32. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  33. * @{
  34. */
  35. /**
  36. * @brief RCC PLL configuration structure definition
  37. */
  38. typedef struct
  39. {
  40. uint32_t PLLState; /*!< The new state of the PLL.
  41. This parameter can be a value of @ref RCC_PLL_Config */
  42. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  43. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  44. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  45. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  46. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  47. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  48. uint32_t PLLP; /*!< PLLP: Division factor for main system clock (SYSCLK).
  49. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  50. uint32_t PLLQ; /*!< PLLQ: Division factor for OTG FS, SDMMC and RNG clocks.
  51. This parameter must be a number between Min_Data = 2 and Max_Data = 15 */
  52. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  53. uint32_t PLLR; /*!< PLLR: Division factor for DSI clock.
  54. This parameter must be a number between Min_Data = 2 and Max_Data = 7 */
  55. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  56. }RCC_PLLInitTypeDef;
  57. /**
  58. * @brief PLLI2S Clock structure definition
  59. */
  60. typedef struct
  61. {
  62. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  63. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  64. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  65. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  66. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  67. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  68. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI1 clock.
  69. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  70. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  71. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  72. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  73. uint32_t PLLI2SP; /*!< Specifies the division factor for SPDIF-RX clock.
  74. This parameter must be a value of @ref RCCEx_PLLI2SP_Clock_Divider.
  75. This parameter will be used only when PLLI2S is selected as Clock Source SPDIF-RX */
  76. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  77. }RCC_PLLI2SInitTypeDef;
  78. /**
  79. * @brief PLLSAI Clock structure definition
  80. */
  81. typedef struct
  82. {
  83. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  84. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  85. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  86. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI1 clock.
  87. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  88. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  89. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  90. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  91. uint32_t PLLSAIR; /*!< specifies the division factor for LTDC clock
  92. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  93. This parameter will be used only when PLLSAI is selected as Clock Source LTDC */
  94. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  95. uint32_t PLLSAIP; /*!< Specifies the division factor for 48MHz clock.
  96. This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider
  97. This parameter will be used only when PLLSAI is disabled */
  98. }RCC_PLLSAIInitTypeDef;
  99. /**
  100. * @brief RCC extended clocks structure definition
  101. */
  102. typedef struct
  103. {
  104. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  105. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  106. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  107. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  108. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  109. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  110. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  111. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  112. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  113. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  114. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  115. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  116. uint32_t PLLSAIDivR; /*!< Specifies the PLLSAI division factor for LTDC clock.
  117. This parameter must be one value of @ref RCCEx_PLLSAI_DIVR */
  118. uint32_t RTCClockSelection; /*!< Specifies RTC Clock source Selection.
  119. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  120. uint32_t I2sClockSelection; /*!< Specifies I2S Clock source Selection.
  121. This parameter can be a value of @ref RCCEx_I2S_Clock_Source */
  122. uint32_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection.
  123. This parameter can be a value of @ref RCCEx_TIM_Prescaler_Selection */
  124. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 Clock Prescalers Selection
  125. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  126. uint32_t Sai2ClockSelection; /*!< Specifies SAI2 Clock Prescalers Selection
  127. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */
  128. uint32_t Usart1ClockSelection; /*!< USART1 clock source
  129. This parameter can be a value of @ref RCCEx_USART1_Clock_Source */
  130. uint32_t Usart2ClockSelection; /*!< USART2 clock source
  131. This parameter can be a value of @ref RCCEx_USART2_Clock_Source */
  132. uint32_t Usart3ClockSelection; /*!< USART3 clock source
  133. This parameter can be a value of @ref RCCEx_USART3_Clock_Source */
  134. uint32_t Uart4ClockSelection; /*!< UART4 clock source
  135. This parameter can be a value of @ref RCCEx_UART4_Clock_Source */
  136. uint32_t Uart5ClockSelection; /*!< UART5 clock source
  137. This parameter can be a value of @ref RCCEx_UART5_Clock_Source */
  138. uint32_t Usart6ClockSelection; /*!< USART6 clock source
  139. This parameter can be a value of @ref RCCEx_USART6_Clock_Source */
  140. uint32_t Uart7ClockSelection; /*!< UART7 clock source
  141. This parameter can be a value of @ref RCCEx_UART7_Clock_Source */
  142. uint32_t Uart8ClockSelection; /*!< UART8 clock source
  143. This parameter can be a value of @ref RCCEx_UART8_Clock_Source */
  144. uint32_t I2c1ClockSelection; /*!< I2C1 clock source
  145. This parameter can be a value of @ref RCCEx_I2C1_Clock_Source */
  146. uint32_t I2c2ClockSelection; /*!< I2C2 clock source
  147. This parameter can be a value of @ref RCCEx_I2C2_Clock_Source */
  148. uint32_t I2c3ClockSelection; /*!< I2C3 clock source
  149. This parameter can be a value of @ref RCCEx_I2C3_Clock_Source */
  150. uint32_t I2c4ClockSelection; /*!< I2C4 clock source
  151. This parameter can be a value of @ref RCCEx_I2C4_Clock_Source */
  152. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 clock source
  153. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  154. uint32_t CecClockSelection; /*!< CEC clock source
  155. This parameter can be a value of @ref RCCEx_CEC_Clock_Source */
  156. uint32_t Clk48ClockSelection; /*!< Specifies 48Mhz clock source used by USB OTG FS, RNG and SDMMC
  157. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  158. uint32_t Sdmmc1ClockSelection; /*!< SDMMC1 clock source
  159. This parameter can be a value of @ref RCCEx_SDMMC1_Clock_Source */
  160. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  161. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  162. uint32_t Sdmmc2ClockSelection; /*!< SDMMC2 clock source
  163. This parameter can be a value of @ref RCCEx_SDMMC2_Clock_Source */
  164. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  165. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  166. uint32_t Dfsdm1ClockSelection; /*!< DFSDM1 clock source
  167. This parameter can be a value of @ref RCCEx_DFSDM1_Kernel_Clock_Source */
  168. uint32_t Dfsdm1AudioClockSelection; /*!< DFSDM1 clock source
  169. This parameter can be a value of @ref RCCEx_DFSDM1_AUDIO_Clock_Source */
  170. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  171. }RCC_PeriphCLKInitTypeDef;
  172. /**
  173. * @}
  174. */
  175. /* Exported constants --------------------------------------------------------*/
  176. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  177. * @{
  178. */
  179. /** @defgroup RCCEx_Periph_Clock_Selection RCC Periph Clock Selection
  180. * @{
  181. */
  182. #define RCC_PERIPHCLK_I2S ((uint32_t)0x00000001U)
  183. #if defined(STM32F746xx) || defined(STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  184. #define RCC_PERIPHCLK_LTDC ((uint32_t)0x00000008U)
  185. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  186. #define RCC_PERIPHCLK_TIM ((uint32_t)0x00000010U)
  187. #define RCC_PERIPHCLK_RTC ((uint32_t)0x00000020U)
  188. #define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000040U)
  189. #define RCC_PERIPHCLK_USART2 ((uint32_t)0x00000080U)
  190. #define RCC_PERIPHCLK_USART3 ((uint32_t)0x00000100U)
  191. #define RCC_PERIPHCLK_UART4 ((uint32_t)0x00000200U)
  192. #define RCC_PERIPHCLK_UART5 ((uint32_t)0x00000400U)
  193. #define RCC_PERIPHCLK_USART6 ((uint32_t)0x00000800U)
  194. #define RCC_PERIPHCLK_UART7 ((uint32_t)0x00001000U)
  195. #define RCC_PERIPHCLK_UART8 ((uint32_t)0x00002000U)
  196. #define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00004000U)
  197. #define RCC_PERIPHCLK_I2C2 ((uint32_t)0x00008000U)
  198. #define RCC_PERIPHCLK_I2C3 ((uint32_t)0x00010000U)
  199. #define RCC_PERIPHCLK_I2C4 ((uint32_t)0x00020000U)
  200. #define RCC_PERIPHCLK_LPTIM1 ((uint32_t)0x00040000U)
  201. #define RCC_PERIPHCLK_SAI1 ((uint32_t)0x00080000U)
  202. #define RCC_PERIPHCLK_SAI2 ((uint32_t)0x00100000U)
  203. #define RCC_PERIPHCLK_CLK48 ((uint32_t)0x00200000U)
  204. #define RCC_PERIPHCLK_CEC ((uint32_t)0x00400000U)
  205. #define RCC_PERIPHCLK_SDMMC1 ((uint32_t)0x00800000U)
  206. #define RCC_PERIPHCLK_SPDIFRX ((uint32_t)0x01000000U)
  207. #define RCC_PERIPHCLK_PLLI2S ((uint32_t)0x02000000U)
  208. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  209. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  210. #define RCC_PERIPHCLK_SDMMC2 ((uint32_t)0x04000000U)
  211. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  212. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  213. #define RCC_PERIPHCLK_DFSDM1 ((uint32_t)0x08000000U)
  214. #define RCC_PERIPHCLK_DFSDM1_AUDIO ((uint32_t)0x10000000U)
  215. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  216. /**
  217. * @}
  218. */
  219. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  220. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  221. /** @defgroup RCCEx_PLLI2SP_Clock_Divider RCCEx PLLI2SP Clock Divider
  222. * @{
  223. */
  224. #define RCC_PLLI2SP_DIV2 ((uint32_t)0x00000000U)
  225. #define RCC_PLLI2SP_DIV4 ((uint32_t)0x00000001U)
  226. #define RCC_PLLI2SP_DIV6 ((uint32_t)0x00000002U)
  227. #define RCC_PLLI2SP_DIV8 ((uint32_t)0x00000003U)
  228. /**
  229. * @}
  230. */
  231. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  232. /** @defgroup RCCEx_PLLSAIP_Clock_Divider RCCEx PLLSAIP Clock Divider
  233. * @{
  234. */
  235. #define RCC_PLLSAIP_DIV2 ((uint32_t)0x00000000U)
  236. #define RCC_PLLSAIP_DIV4 ((uint32_t)0x00000001U)
  237. #define RCC_PLLSAIP_DIV6 ((uint32_t)0x00000002U)
  238. #define RCC_PLLSAIP_DIV8 ((uint32_t)0x00000003U)
  239. /**
  240. * @}
  241. */
  242. /** @defgroup RCCEx_PLLSAI_DIVR RCCEx PLLSAI DIVR
  243. * @{
  244. */
  245. #define RCC_PLLSAIDIVR_2 ((uint32_t)0x00000000U)
  246. #define RCC_PLLSAIDIVR_4 RCC_DCKCFGR1_PLLSAIDIVR_0
  247. #define RCC_PLLSAIDIVR_8 RCC_DCKCFGR1_PLLSAIDIVR_1
  248. #define RCC_PLLSAIDIVR_16 RCC_DCKCFGR1_PLLSAIDIVR
  249. /**
  250. * @}
  251. */
  252. /** @defgroup RCCEx_I2S_Clock_Source RCCEx I2S Clock Source
  253. * @{
  254. */
  255. #define RCC_I2SCLKSOURCE_PLLI2S ((uint32_t)0x00000000U)
  256. #define RCC_I2SCLKSOURCE_EXT RCC_CFGR_I2SSRC
  257. /**
  258. * @}
  259. */
  260. /** @defgroup RCCEx_SAI1_Clock_Source RCCEx SAI1 Clock Source
  261. * @{
  262. */
  263. #define RCC_SAI1CLKSOURCE_PLLSAI ((uint32_t)0x00000000U)
  264. #define RCC_SAI1CLKSOURCE_PLLI2S RCC_DCKCFGR1_SAI1SEL_0
  265. #define RCC_SAI1CLKSOURCE_PIN RCC_DCKCFGR1_SAI1SEL_1
  266. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  267. #define RCC_SAI1CLKSOURCE_PLLSRC RCC_DCKCFGR1_SAI1SEL
  268. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  269. /**
  270. * @}
  271. */
  272. /** @defgroup RCCEx_SAI2_Clock_Source RCCEx SAI2 Clock Source
  273. * @{
  274. */
  275. #define RCC_SAI2CLKSOURCE_PLLSAI ((uint32_t)0x00000000U)
  276. #define RCC_SAI2CLKSOURCE_PLLI2S RCC_DCKCFGR1_SAI2SEL_0
  277. #define RCC_SAI2CLKSOURCE_PIN RCC_DCKCFGR1_SAI2SEL_1
  278. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  279. #define RCC_SAI2CLKSOURCE_PLLSRC RCC_DCKCFGR1_SAI2SEL
  280. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  281. /**
  282. * @}
  283. */
  284. /** @defgroup RCCEx_CEC_Clock_Source RCCEx CEC Clock Source
  285. * @{
  286. */
  287. #define RCC_CECCLKSOURCE_LSE ((uint32_t)0x00000000U)
  288. #define RCC_CECCLKSOURCE_HSI RCC_DCKCFGR2_CECSEL /* CEC clock is HSI/488*/
  289. /**
  290. * @}
  291. */
  292. /** @defgroup RCCEx_USART1_Clock_Source RCCEx USART1 Clock Source
  293. * @{
  294. */
  295. #define RCC_USART1CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  296. #define RCC_USART1CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART1SEL_0
  297. #define RCC_USART1CLKSOURCE_HSI RCC_DCKCFGR2_USART1SEL_1
  298. #define RCC_USART1CLKSOURCE_LSE RCC_DCKCFGR2_USART1SEL
  299. /**
  300. * @}
  301. */
  302. /** @defgroup RCCEx_USART2_Clock_Source RCCEx USART2 Clock Source
  303. * @{
  304. */
  305. #define RCC_USART2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  306. #define RCC_USART2CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART2SEL_0
  307. #define RCC_USART2CLKSOURCE_HSI RCC_DCKCFGR2_USART2SEL_1
  308. #define RCC_USART2CLKSOURCE_LSE RCC_DCKCFGR2_USART2SEL
  309. /**
  310. * @}
  311. */
  312. /** @defgroup RCCEx_USART3_Clock_Source RCCEx USART3 Clock Source
  313. * @{
  314. */
  315. #define RCC_USART3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  316. #define RCC_USART3CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART3SEL_0
  317. #define RCC_USART3CLKSOURCE_HSI RCC_DCKCFGR2_USART3SEL_1
  318. #define RCC_USART3CLKSOURCE_LSE RCC_DCKCFGR2_USART3SEL
  319. /**
  320. * @}
  321. */
  322. /** @defgroup RCCEx_UART4_Clock_Source RCCEx UART4 Clock Source
  323. * @{
  324. */
  325. #define RCC_UART4CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  326. #define RCC_UART4CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART4SEL_0
  327. #define RCC_UART4CLKSOURCE_HSI RCC_DCKCFGR2_UART4SEL_1
  328. #define RCC_UART4CLKSOURCE_LSE RCC_DCKCFGR2_UART4SEL
  329. /**
  330. * @}
  331. */
  332. /** @defgroup RCCEx_UART5_Clock_Source RCCEx UART5 Clock Source
  333. * @{
  334. */
  335. #define RCC_UART5CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  336. #define RCC_UART5CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART5SEL_0
  337. #define RCC_UART5CLKSOURCE_HSI RCC_DCKCFGR2_UART5SEL_1
  338. #define RCC_UART5CLKSOURCE_LSE RCC_DCKCFGR2_UART5SEL
  339. /**
  340. * @}
  341. */
  342. /** @defgroup RCCEx_USART6_Clock_Source RCCEx USART6 Clock Source
  343. * @{
  344. */
  345. #define RCC_USART6CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  346. #define RCC_USART6CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART6SEL_0
  347. #define RCC_USART6CLKSOURCE_HSI RCC_DCKCFGR2_USART6SEL_1
  348. #define RCC_USART6CLKSOURCE_LSE RCC_DCKCFGR2_USART6SEL
  349. /**
  350. * @}
  351. */
  352. /** @defgroup RCCEx_UART7_Clock_Source RCCEx UART7 Clock Source
  353. * @{
  354. */
  355. #define RCC_UART7CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  356. #define RCC_UART7CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART7SEL_0
  357. #define RCC_UART7CLKSOURCE_HSI RCC_DCKCFGR2_UART7SEL_1
  358. #define RCC_UART7CLKSOURCE_LSE RCC_DCKCFGR2_UART7SEL
  359. /**
  360. * @}
  361. */
  362. /** @defgroup RCCEx_UART8_Clock_Source RCCEx UART8 Clock Source
  363. * @{
  364. */
  365. #define RCC_UART8CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  366. #define RCC_UART8CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART8SEL_0
  367. #define RCC_UART8CLKSOURCE_HSI RCC_DCKCFGR2_UART8SEL_1
  368. #define RCC_UART8CLKSOURCE_LSE RCC_DCKCFGR2_UART8SEL
  369. /**
  370. * @}
  371. */
  372. /** @defgroup RCCEx_I2C1_Clock_Source RCCEx I2C1 Clock Source
  373. * @{
  374. */
  375. #define RCC_I2C1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  376. #define RCC_I2C1CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C1SEL_0
  377. #define RCC_I2C1CLKSOURCE_HSI RCC_DCKCFGR2_I2C1SEL_1
  378. /**
  379. * @}
  380. */
  381. /** @defgroup RCCEx_I2C2_Clock_Source RCCEx I2C2 Clock Source
  382. * @{
  383. */
  384. #define RCC_I2C2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  385. #define RCC_I2C2CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C2SEL_0
  386. #define RCC_I2C2CLKSOURCE_HSI RCC_DCKCFGR2_I2C2SEL_1
  387. /**
  388. * @}
  389. */
  390. /** @defgroup RCCEx_I2C3_Clock_Source RCCEx I2C3 Clock Source
  391. * @{
  392. */
  393. #define RCC_I2C3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  394. #define RCC_I2C3CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C3SEL_0
  395. #define RCC_I2C3CLKSOURCE_HSI RCC_DCKCFGR2_I2C3SEL_1
  396. /**
  397. * @}
  398. */
  399. /** @defgroup RCCEx_I2C4_Clock_Source RCCEx I2C4 Clock Source
  400. * @{
  401. */
  402. #define RCC_I2C4CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  403. #define RCC_I2C4CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C4SEL_0
  404. #define RCC_I2C4CLKSOURCE_HSI RCC_DCKCFGR2_I2C4SEL_1
  405. /**
  406. * @}
  407. */
  408. /** @defgroup RCCEx_LPTIM1_Clock_Source RCCEx LPTIM1 Clock Source
  409. * @{
  410. */
  411. #define RCC_LPTIM1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  412. #define RCC_LPTIM1CLKSOURCE_LSI RCC_DCKCFGR2_LPTIM1SEL_0
  413. #define RCC_LPTIM1CLKSOURCE_HSI RCC_DCKCFGR2_LPTIM1SEL_1
  414. #define RCC_LPTIM1CLKSOURCE_LSE RCC_DCKCFGR2_LPTIM1SEL
  415. /**
  416. * @}
  417. */
  418. /** @defgroup RCCEx_CLK48_Clock_Source RCCEx CLK48 Clock Source
  419. * @{
  420. */
  421. #define RCC_CLK48SOURCE_PLL ((uint32_t)0x00000000U)
  422. #define RCC_CLK48SOURCE_PLLSAIP RCC_DCKCFGR2_CK48MSEL
  423. /**
  424. * @}
  425. */
  426. /** @defgroup RCCEx_TIM_Prescaler_Selection RCCEx TIM Prescaler Selection
  427. * @{
  428. */
  429. #define RCC_TIMPRES_DESACTIVATED ((uint32_t)0x00000000U)
  430. #define RCC_TIMPRES_ACTIVATED RCC_DCKCFGR1_TIMPRE
  431. /**
  432. * @}
  433. */
  434. /** @defgroup RCCEx_SDMMC1_Clock_Source RCCEx SDMMC1 Clock Source
  435. * @{
  436. */
  437. #define RCC_SDMMC1CLKSOURCE_CLK48 ((uint32_t)0x00000000U)
  438. #define RCC_SDMMC1CLKSOURCE_SYSCLK RCC_DCKCFGR2_SDMMC1SEL
  439. /**
  440. * @}
  441. */
  442. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  443. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  444. /** @defgroup RCCEx_SDMMC2_Clock_Source RCCEx SDMMC2 Clock Source
  445. * @{
  446. */
  447. #define RCC_SDMMC2CLKSOURCE_CLK48 ((uint32_t)0x00000000U)
  448. #define RCC_SDMMC2CLKSOURCE_SYSCLK RCC_DCKCFGR2_SDMMC2SEL
  449. /**
  450. * @}
  451. */
  452. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  453. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  454. /** @defgroup RCCEx_DFSDM1_Kernel_Clock_Source RCCEx DFSDM1 Kernel Clock Source
  455. * @{
  456. */
  457. #define RCC_DFSDM1CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  458. #define RCC_DFSDM1CLKSOURCE_SYSCLK RCC_DCKCFGR1_DFSDM1SEL
  459. /**
  460. * @}
  461. */
  462. /** @defgroup RCCEx_DFSDM1_AUDIO_Clock_Source RCCEx DFSDM1 AUDIO Clock Source
  463. * @{
  464. */
  465. #define RCC_DFSDM1AUDIOCLKSOURCE_SAI1 ((uint32_t)0x00000000U)
  466. #define RCC_DFSDM1AUDIOCLKSOURCE_SAI2 RCC_DCKCFGR1_ADFSDM1SEL
  467. /**
  468. * @}
  469. */
  470. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  471. #if defined (STM32F769xx) || defined (STM32F779xx)
  472. /** @defgroup RCCEx_DSI_Clock_Source RCC DSI Clock Source
  473. * @{
  474. */
  475. #define RCC_DSICLKSOURCE_DSIPHY ((uint32_t)0x00000000U)
  476. #define RCC_DSICLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR2_DSISEL)
  477. /**
  478. * @}
  479. */
  480. #endif /* STM32F769xx || STM32F779xx */
  481. /**
  482. * @}
  483. */
  484. /* Exported macro ------------------------------------------------------------*/
  485. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  486. * @{
  487. */
  488. /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable RCCEx_Peripheral_Clock_Enable_Disable
  489. * @brief Enables or disables the AHB/APB peripheral clock.
  490. * @note After reset, the peripheral clock (used for registers read/write access)
  491. * is disabled and the application software has to enable this clock before
  492. * using it.
  493. * @{
  494. */
  495. /** @brief Enables or disables the AHB1 peripheral clock.
  496. * @note After reset, the peripheral clock (used for registers read/write access)
  497. * is disabled and the application software has to enable this clock before
  498. * using it.
  499. */
  500. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  501. __IO uint32_t tmpreg; \
  502. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  503. /* Delay after an RCC peripheral clock enabling */ \
  504. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  505. UNUSED(tmpreg); \
  506. } while(0)
  507. #define __HAL_RCC_DTCMRAMEN_CLK_ENABLE() do { \
  508. __IO uint32_t tmpreg; \
  509. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DTCMRAMEN);\
  510. /* Delay after an RCC peripheral clock enabling */ \
  511. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DTCMRAMEN);\
  512. UNUSED(tmpreg); \
  513. } while(0)
  514. #define __HAL_RCC_DMA2_CLK_ENABLE() do { \
  515. __IO uint32_t tmpreg; \
  516. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  517. /* Delay after an RCC peripheral clock enabling */ \
  518. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  519. UNUSED(tmpreg); \
  520. } while(0)
  521. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  522. __IO uint32_t tmpreg; \
  523. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  524. /* Delay after an RCC peripheral clock enabling */ \
  525. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  526. UNUSED(tmpreg); \
  527. } while(0)
  528. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  529. __IO uint32_t tmpreg; \
  530. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  531. /* Delay after an RCC peripheral clock enabling */ \
  532. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  533. UNUSED(tmpreg); \
  534. } while(0)
  535. #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
  536. __IO uint32_t tmpreg; \
  537. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
  538. /* Delay after an RCC peripheral clock enabling */ \
  539. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
  540. UNUSED(tmpreg); \
  541. } while(0)
  542. #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
  543. __IO uint32_t tmpreg; \
  544. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\
  545. /* Delay after an RCC peripheral clock enabling */ \
  546. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\
  547. UNUSED(tmpreg); \
  548. } while(0)
  549. #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
  550. __IO uint32_t tmpreg; \
  551. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\
  552. /* Delay after an RCC peripheral clock enabling */ \
  553. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\
  554. UNUSED(tmpreg); \
  555. } while(0)
  556. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  557. __IO uint32_t tmpreg; \
  558. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  559. /* Delay after an RCC peripheral clock enabling */ \
  560. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  561. UNUSED(tmpreg); \
  562. } while(0)
  563. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  564. __IO uint32_t tmpreg; \
  565. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  566. /* Delay after an RCC peripheral clock enabling */ \
  567. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  568. UNUSED(tmpreg); \
  569. } while(0)
  570. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  571. __IO uint32_t tmpreg; \
  572. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  573. /* Delay after an RCC peripheral clock enabling */ \
  574. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  575. UNUSED(tmpreg); \
  576. } while(0)
  577. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  578. __IO uint32_t tmpreg; \
  579. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  580. /* Delay after an RCC peripheral clock enabling */ \
  581. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  582. UNUSED(tmpreg); \
  583. } while(0)
  584. #define __HAL_RCC_GPIOH_CLK_ENABLE() do { \
  585. __IO uint32_t tmpreg; \
  586. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\
  587. /* Delay after an RCC peripheral clock enabling */ \
  588. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\
  589. UNUSED(tmpreg); \
  590. } while(0)
  591. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  592. __IO uint32_t tmpreg; \
  593. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  594. /* Delay after an RCC peripheral clock enabling */ \
  595. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  596. UNUSED(tmpreg); \
  597. } while(0)
  598. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  599. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  600. defined (STM32F750xx)
  601. #define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \
  602. __IO uint32_t tmpreg; \
  603. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  604. /* Delay after an RCC peripheral clock enabling */ \
  605. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  606. UNUSED(tmpreg); \
  607. } while(0)
  608. #define __HAL_RCC_GPIOK_CLK_ENABLE() do { \
  609. __IO uint32_t tmpreg; \
  610. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  611. /* Delay after an RCC peripheral clock enabling */ \
  612. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  613. UNUSED(tmpreg); \
  614. } while(0)
  615. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  616. __IO uint32_t tmpreg; \
  617. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  618. /* Delay after an RCC peripheral clock enabling */ \
  619. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  620. UNUSED(tmpreg); \
  621. } while(0)
  622. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  623. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  624. #define __HAL_RCC_DTCMRAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DTCMRAMEN))
  625. #define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2EN))
  626. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  627. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  628. #define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOAEN))
  629. #define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOBEN))
  630. #define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOCEN))
  631. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  632. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  633. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  634. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  635. #define __HAL_RCC_GPIOH_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOHEN))
  636. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  637. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  638. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  639. defined (STM32F750xx)
  640. #define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOJEN))
  641. #define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOKEN))
  642. #define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2DEN))
  643. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  644. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  645. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  646. defined (STM32F750xx)
  647. /**
  648. * @brief Enable ETHERNET clock.
  649. */
  650. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  651. __IO uint32_t tmpreg; \
  652. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  653. /* Delay after an RCC peripheral clock enabling */ \
  654. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  655. UNUSED(tmpreg); \
  656. } while(0)
  657. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  658. __IO uint32_t tmpreg; \
  659. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  660. /* Delay after an RCC peripheral clock enabling */ \
  661. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  662. UNUSED(tmpreg); \
  663. } while(0)
  664. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  665. __IO uint32_t tmpreg; \
  666. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  667. /* Delay after an RCC peripheral clock enabling */ \
  668. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  669. UNUSED(tmpreg); \
  670. } while(0)
  671. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  672. __IO uint32_t tmpreg; \
  673. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  674. /* Delay after an RCC peripheral clock enabling */ \
  675. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  676. UNUSED(tmpreg); \
  677. } while(0)
  678. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  679. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  680. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  681. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  682. } while(0)
  683. /**
  684. * @brief Disable ETHERNET clock.
  685. */
  686. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  687. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  688. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  689. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  690. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  691. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  692. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  693. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  694. } while(0)
  695. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  696. /** @brief Enable or disable the AHB2 peripheral clock.
  697. * @note After reset, the peripheral clock (used for registers read/write access)
  698. * is disabled and the application software has to enable this clock before
  699. * using it.
  700. */
  701. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  702. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  703. defined (STM32F750xx)
  704. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  705. __IO uint32_t tmpreg; \
  706. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  707. /* Delay after an RCC peripheral clock enabling */ \
  708. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  709. UNUSED(tmpreg); \
  710. } while(0)
  711. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  712. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  713. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  714. #define __HAL_RCC_JPEG_CLK_ENABLE() do { \
  715. __IO uint32_t tmpreg; \
  716. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_JPEGEN);\
  717. /* Delay after an RCC peripheral clock enabling */ \
  718. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_JPEGEN);\
  719. UNUSED(tmpreg); \
  720. } while(0)
  721. #define __HAL_RCC_JPEG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_JPEGEN))
  722. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  723. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  724. __IO uint32_t tmpreg; \
  725. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  726. /* Delay after an RCC peripheral clock enabling */ \
  727. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  728. UNUSED(tmpreg); \
  729. } while(0)
  730. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \
  731. __IO uint32_t tmpreg; \
  732. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);\
  733. /* Delay after an RCC peripheral clock enabling */ \
  734. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);\
  735. UNUSED(tmpreg); \
  736. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  737. } while(0)
  738. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  739. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  740. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  741. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  742. __IO uint32_t tmpreg; \
  743. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  744. /* Delay after an RCC peripheral clock enabling */ \
  745. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  746. UNUSED(tmpreg); \
  747. } while(0)
  748. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  749. __IO uint32_t tmpreg; \
  750. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  751. /* Delay after an RCC peripheral clock enabling */ \
  752. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  753. UNUSED(tmpreg); \
  754. } while(0)
  755. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  756. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  757. #endif /* STM32F756x || STM32F777xx || STM32F779xx || STM32F750xx */
  758. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  759. #define __HAL_RCC_AES_CLK_ENABLE() do { \
  760. __IO uint32_t tmpreg; \
  761. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  762. /* Delay after an RCC peripheral clock enabling */ \
  763. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  764. UNUSED(tmpreg); \
  765. } while(0)
  766. #define __HAL_RCC_AES_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_AESEN))
  767. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  768. /** @brief Enables or disables the AHB3 peripheral clock.
  769. * @note After reset, the peripheral clock (used for registers read/write access)
  770. * is disabled and the application software has to enable this clock before
  771. * using it.
  772. */
  773. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  774. __IO uint32_t tmpreg; \
  775. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  776. /* Delay after an RCC peripheral clock enabling */ \
  777. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  778. UNUSED(tmpreg); \
  779. } while(0)
  780. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  781. __IO uint32_t tmpreg; \
  782. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  783. /* Delay after an RCC peripheral clock enabling */ \
  784. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  785. UNUSED(tmpreg); \
  786. } while(0)
  787. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  788. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  789. /** @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  790. * @note After reset, the peripheral clock (used for registers read/write access)
  791. * is disabled and the application software has to enable this clock before
  792. * using it.
  793. */
  794. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  795. __IO uint32_t tmpreg; \
  796. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  797. /* Delay after an RCC peripheral clock enabling */ \
  798. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  799. UNUSED(tmpreg); \
  800. } while(0)
  801. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  802. __IO uint32_t tmpreg; \
  803. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  804. /* Delay after an RCC peripheral clock enabling */ \
  805. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  806. UNUSED(tmpreg); \
  807. } while(0)
  808. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  809. __IO uint32_t tmpreg; \
  810. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  811. /* Delay after an RCC peripheral clock enabling */ \
  812. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  813. UNUSED(tmpreg); \
  814. } while(0)
  815. #define __HAL_RCC_TIM5_CLK_ENABLE() do { \
  816. __IO uint32_t tmpreg; \
  817. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
  818. /* Delay after an RCC peripheral clock enabling */ \
  819. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
  820. UNUSED(tmpreg); \
  821. } while(0)
  822. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  823. __IO uint32_t tmpreg; \
  824. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  825. /* Delay after an RCC peripheral clock enabling */ \
  826. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  827. UNUSED(tmpreg); \
  828. } while(0)
  829. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  830. __IO uint32_t tmpreg; \
  831. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  832. /* Delay after an RCC peripheral clock enabling */ \
  833. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  834. UNUSED(tmpreg); \
  835. } while(0)
  836. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  837. __IO uint32_t tmpreg; \
  838. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  839. /* Delay after an RCC peripheral clock enabling */ \
  840. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  841. UNUSED(tmpreg); \
  842. } while(0)
  843. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  844. __IO uint32_t tmpreg; \
  845. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  846. /* Delay after an RCC peripheral clock enabling */ \
  847. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  848. UNUSED(tmpreg); \
  849. } while(0)
  850. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  851. __IO uint32_t tmpreg; \
  852. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  853. /* Delay after an RCC peripheral clock enabling */ \
  854. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  855. UNUSED(tmpreg); \
  856. } while(0)
  857. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  858. __IO uint32_t tmpreg; \
  859. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  860. /* Delay after an RCC peripheral clock enabling */ \
  861. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  862. UNUSED(tmpreg); \
  863. } while(0)
  864. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  865. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  866. defined (STM32F779xx) || defined (STM32F730xx)
  867. #define __HAL_RCC_RTC_CLK_ENABLE() do { \
  868. __IO uint32_t tmpreg; \
  869. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCEN);\
  870. /* Delay after an RCC peripheral clock enabling */ \
  871. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCEN);\
  872. UNUSED(tmpreg); \
  873. } while(0)
  874. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  875. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  876. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  877. #define __HAL_RCC_CAN3_CLK_ENABLE() do { \
  878. __IO uint32_t tmpreg; \
  879. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  880. /* Delay after an RCC peripheral clock enabling */ \
  881. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  882. UNUSED(tmpreg); \
  883. } while(0)
  884. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  885. #define __HAL_RCC_SPI2_CLK_ENABLE() do { \
  886. __IO uint32_t tmpreg; \
  887. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
  888. /* Delay after an RCC peripheral clock enabling */ \
  889. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
  890. UNUSED(tmpreg); \
  891. } while(0)
  892. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  893. __IO uint32_t tmpreg; \
  894. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  895. /* Delay after an RCC peripheral clock enabling */ \
  896. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  897. UNUSED(tmpreg); \
  898. } while(0)
  899. #define __HAL_RCC_USART2_CLK_ENABLE() do { \
  900. __IO uint32_t tmpreg; \
  901. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
  902. /* Delay after an RCC peripheral clock enabling */ \
  903. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
  904. UNUSED(tmpreg); \
  905. } while(0)
  906. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  907. __IO uint32_t tmpreg; \
  908. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  909. /* Delay after an RCC peripheral clock enabling */ \
  910. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  911. UNUSED(tmpreg); \
  912. } while(0)
  913. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  914. __IO uint32_t tmpreg; \
  915. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  916. /* Delay after an RCC peripheral clock enabling */ \
  917. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  918. UNUSED(tmpreg); \
  919. } while(0)
  920. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  921. __IO uint32_t tmpreg; \
  922. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  923. /* Delay after an RCC peripheral clock enabling */ \
  924. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  925. UNUSED(tmpreg); \
  926. } while(0)
  927. #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
  928. __IO uint32_t tmpreg; \
  929. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
  930. /* Delay after an RCC peripheral clock enabling */ \
  931. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
  932. UNUSED(tmpreg); \
  933. } while(0)
  934. #define __HAL_RCC_I2C2_CLK_ENABLE() do { \
  935. __IO uint32_t tmpreg; \
  936. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
  937. /* Delay after an RCC peripheral clock enabling */ \
  938. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
  939. UNUSED(tmpreg); \
  940. } while(0)
  941. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  942. __IO uint32_t tmpreg; \
  943. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  944. /* Delay after an RCC peripheral clock enabling */ \
  945. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  946. UNUSED(tmpreg); \
  947. } while(0)
  948. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  949. __IO uint32_t tmpreg; \
  950. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  951. /* Delay after an RCC peripheral clock enabling */ \
  952. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  953. UNUSED(tmpreg); \
  954. } while(0)
  955. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  956. __IO uint32_t tmpreg; \
  957. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  958. /* Delay after an RCC peripheral clock enabling */ \
  959. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  960. UNUSED(tmpreg); \
  961. } while(0)
  962. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  963. __IO uint32_t tmpreg; \
  964. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  965. /* Delay after an RCC peripheral clock enabling */ \
  966. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  967. UNUSED(tmpreg); \
  968. } while(0)
  969. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  970. __IO uint32_t tmpreg; \
  971. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  972. /* Delay after an RCC peripheral clock enabling */ \
  973. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  974. UNUSED(tmpreg); \
  975. } while(0)
  976. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  977. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  978. defined (STM32F750xx)
  979. #define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \
  980. __IO uint32_t tmpreg; \
  981. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  982. /* Delay after an RCC peripheral clock enabling */ \
  983. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  984. UNUSED(tmpreg); \
  985. } while(0)
  986. #define __HAL_RCC_I2C4_CLK_ENABLE() do { \
  987. __IO uint32_t tmpreg; \
  988. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C4EN);\
  989. /* Delay after an RCC peripheral clock enabling */ \
  990. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C4EN);\
  991. UNUSED(tmpreg); \
  992. } while(0)
  993. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  994. __IO uint32_t tmpreg; \
  995. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  996. /* Delay after an RCC peripheral clock enabling */ \
  997. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  998. UNUSED(tmpreg); \
  999. } while(0)
  1000. #define __HAL_RCC_CEC_CLK_ENABLE() do { \
  1001. __IO uint32_t tmpreg; \
  1002. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  1003. /* Delay after an RCC peripheral clock enabling */ \
  1004. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  1005. UNUSED(tmpreg); \
  1006. } while(0)
  1007. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1008. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  1009. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  1010. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  1011. #define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN))
  1012. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  1013. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  1014. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  1015. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  1016. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  1017. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  1018. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  1019. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  1020. defined (STM32F779xx) || defined (STM32F730xx)
  1021. #define __HAL_RCC_RTC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCEN))
  1022. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  1023. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1024. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1025. #define __HAL_RCC_CAN3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN3EN))
  1026. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1027. #define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN))
  1028. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  1029. #define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART2EN))
  1030. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  1031. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  1032. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  1033. #define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
  1034. #define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN))
  1035. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  1036. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  1037. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  1038. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  1039. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  1040. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1041. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1042. defined (STM32F750xx)
  1043. #define __HAL_RCC_SPDIFRX_CLK_DISABLE()(RCC->APB1ENR &= ~(RCC_APB1ENR_SPDIFRXEN))
  1044. #define __HAL_RCC_I2C4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C4EN))
  1045. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  1046. #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN))
  1047. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || || STM32F750xx */
  1048. /** @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  1049. * @note After reset, the peripheral clock (used for registers read/write access)
  1050. * is disabled and the application software has to enable this clock before
  1051. * using it.
  1052. */
  1053. #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
  1054. __IO uint32_t tmpreg; \
  1055. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  1056. /* Delay after an RCC peripheral clock enabling */ \
  1057. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  1058. UNUSED(tmpreg); \
  1059. } while(0)
  1060. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1061. __IO uint32_t tmpreg; \
  1062. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1063. /* Delay after an RCC peripheral clock enabling */ \
  1064. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1065. UNUSED(tmpreg); \
  1066. } while(0)
  1067. #define __HAL_RCC_USART1_CLK_ENABLE() do { \
  1068. __IO uint32_t tmpreg; \
  1069. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  1070. /* Delay after an RCC peripheral clock enabling */ \
  1071. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  1072. UNUSED(tmpreg); \
  1073. } while(0)
  1074. #define __HAL_RCC_USART6_CLK_ENABLE() do { \
  1075. __IO uint32_t tmpreg; \
  1076. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  1077. /* Delay after an RCC peripheral clock enabling */ \
  1078. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  1079. UNUSED(tmpreg); \
  1080. } while(0)
  1081. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1082. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1083. #define __HAL_RCC_SDMMC2_CLK_ENABLE() do { \
  1084. __IO uint32_t tmpreg; \
  1085. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC2EN);\
  1086. /* Delay after an RCC peripheral clock enabling */ \
  1087. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC2EN);\
  1088. UNUSED(tmpreg); \
  1089. } while(0)
  1090. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || || STM32F730xx */
  1091. #define __HAL_RCC_ADC1_CLK_ENABLE() do { \
  1092. __IO uint32_t tmpreg; \
  1093. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
  1094. /* Delay after an RCC peripheral clock enabling */ \
  1095. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
  1096. UNUSED(tmpreg); \
  1097. } while(0)
  1098. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  1099. __IO uint32_t tmpreg; \
  1100. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1101. /* Delay after an RCC peripheral clock enabling */ \
  1102. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1103. UNUSED(tmpreg); \
  1104. } while(0)
  1105. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  1106. __IO uint32_t tmpreg; \
  1107. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1108. /* Delay after an RCC peripheral clock enabling */ \
  1109. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1110. UNUSED(tmpreg); \
  1111. } while(0)
  1112. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  1113. __IO uint32_t tmpreg; \
  1114. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN);\
  1115. /* Delay after an RCC peripheral clock enabling */ \
  1116. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN);\
  1117. UNUSED(tmpreg); \
  1118. } while(0)
  1119. #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
  1120. __IO uint32_t tmpreg; \
  1121. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  1122. /* Delay after an RCC peripheral clock enabling */ \
  1123. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  1124. UNUSED(tmpreg); \
  1125. } while(0)
  1126. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  1127. __IO uint32_t tmpreg; \
  1128. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1129. /* Delay after an RCC peripheral clock enabling */ \
  1130. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1131. UNUSED(tmpreg); \
  1132. } while(0)
  1133. #define __HAL_RCC_TIM9_CLK_ENABLE() do { \
  1134. __IO uint32_t tmpreg; \
  1135. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
  1136. /* Delay after an RCC peripheral clock enabling */ \
  1137. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
  1138. UNUSED(tmpreg); \
  1139. } while(0)
  1140. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  1141. __IO uint32_t tmpreg; \
  1142. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1143. /* Delay after an RCC peripheral clock enabling */ \
  1144. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1145. UNUSED(tmpreg); \
  1146. } while(0)
  1147. #define __HAL_RCC_TIM11_CLK_ENABLE() do { \
  1148. __IO uint32_t tmpreg; \
  1149. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
  1150. /* Delay after an RCC peripheral clock enabling */ \
  1151. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
  1152. UNUSED(tmpreg); \
  1153. } while(0)
  1154. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  1155. __IO uint32_t tmpreg; \
  1156. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1157. /* Delay after an RCC peripheral clock enabling */ \
  1158. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1159. UNUSED(tmpreg); \
  1160. } while(0)
  1161. #define __HAL_RCC_SPI6_CLK_ENABLE() do { \
  1162. __IO uint32_t tmpreg; \
  1163. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1164. /* Delay after an RCC peripheral clock enabling */ \
  1165. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1166. UNUSED(tmpreg); \
  1167. } while(0)
  1168. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1169. __IO uint32_t tmpreg; \
  1170. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1171. /* Delay after an RCC peripheral clock enabling */ \
  1172. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1173. UNUSED(tmpreg); \
  1174. } while(0)
  1175. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  1176. __IO uint32_t tmpreg; \
  1177. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1178. /* Delay after an RCC peripheral clock enabling */ \
  1179. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1180. UNUSED(tmpreg); \
  1181. } while(0)
  1182. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1183. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  1184. __IO uint32_t tmpreg; \
  1185. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1186. /* Delay after an RCC peripheral clock enabling */ \
  1187. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1188. UNUSED(tmpreg); \
  1189. } while(0)
  1190. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1191. #if defined (STM32F769xx) || defined (STM32F779xx)
  1192. #define __HAL_RCC_DSI_CLK_ENABLE() do { \
  1193. __IO uint32_t tmpreg; \
  1194. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1195. /* Delay after an RCC peripheral clock enabling */ \
  1196. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1197. UNUSED(tmpreg); \
  1198. } while(0)
  1199. #endif /* STM32F769xx || STM32F779xx */
  1200. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1201. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  1202. __IO uint32_t tmpreg; \
  1203. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  1204. /* Delay after an RCC peripheral clock enabling */ \
  1205. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  1206. UNUSED(tmpreg); \
  1207. } while(0)
  1208. #define __HAL_RCC_MDIO_CLK_ENABLE() do { \
  1209. __IO uint32_t tmpreg; \
  1210. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_MDIOEN);\
  1211. /* Delay after an RCC peripheral clock enabling */ \
  1212. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_MDIOEN);\
  1213. UNUSED(tmpreg); \
  1214. } while(0)
  1215. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1216. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1217. #define __HAL_RCC_OTGPHYC_CLK_ENABLE() do { \
  1218. __IO uint32_t tmpreg; \
  1219. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_OTGPHYCEN);\
  1220. /* Delay after an RCC peripheral clock enabling */ \
  1221. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_OTGPHYCEN);\
  1222. UNUSED(tmpreg); \
  1223. } while(0)
  1224. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1225. #define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN))
  1226. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  1227. #define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN))
  1228. #define __HAL_RCC_USART6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART6EN))
  1229. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1230. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1231. #define __HAL_RCC_SDMMC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDMMC2EN))
  1232. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1233. #define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN))
  1234. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  1235. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  1236. #define __HAL_RCC_SDMMC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDMMC1EN))
  1237. #define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN))
  1238. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  1239. #define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN))
  1240. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  1241. #define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN))
  1242. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  1243. #define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI6EN))
  1244. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  1245. #define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI2EN))
  1246. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1247. #define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_LTDCEN))
  1248. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1249. #if defined (STM32F769xx) || defined (STM32F779xx)
  1250. #define __HAL_RCC_DSI_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DSIEN))
  1251. #endif /* STM32F769xx || STM32F779xx */
  1252. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1253. #define __HAL_RCC_DFSDM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM1EN))
  1254. #define __HAL_RCC_MDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_MDIOEN))
  1255. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1256. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1257. #define __HAL_RCC_OTGPHYC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_OTGPHYCEN))
  1258. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1259. /**
  1260. * @}
  1261. */
  1262. /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable_Status Peripheral Clock Enable Disable Status
  1263. * @brief Get the enable or disable status of the AHB/APB peripheral clock.
  1264. * @note After reset, the peripheral clock (used for registers read/write access)
  1265. * is disabled and the application software has to enable this clock before
  1266. * using it.
  1267. * @{
  1268. */
  1269. /** @brief Get the enable or disable status of the AHB1 peripheral clock.
  1270. * @note After reset, the peripheral clock (used for registers read/write access)
  1271. * is disabled and the application software has to enable this clock before
  1272. * using it.
  1273. */
  1274. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1275. #define __HAL_RCC_DTCMRAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DTCMRAMEN)) != RESET)
  1276. #define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2EN)) != RESET)
  1277. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1278. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1279. #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOAEN)) != RESET)
  1280. #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOBEN)) != RESET)
  1281. #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOCEN)) != RESET)
  1282. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1283. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1284. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1285. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1286. #define __HAL_RCC_GPIOH_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOHEN)) != RESET)
  1287. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1288. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1289. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1290. defined (STM32F750xx)
  1291. #define __HAL_RCC_GPIOJ_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) != RESET)
  1292. #define __HAL_RCC_GPIOK_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) != RESET)
  1293. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) != RESET)
  1294. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1295. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1296. #define __HAL_RCC_DTCMRAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DTCMRAMEN)) == RESET)
  1297. #define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2EN)) == RESET)
  1298. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1299. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  1300. #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOAEN)) == RESET)
  1301. #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOBEN)) == RESET)
  1302. #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOCEN)) == RESET)
  1303. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1304. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1305. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1306. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1307. #define __HAL_RCC_GPIOH_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOHEN)) == RESET)
  1308. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1309. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1310. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1311. defined (STM32F750xx)
  1312. #define __HAL_RCC_GPIOJ_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) == RESET)
  1313. #define __HAL_RCC_GPIOK_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) == RESET)
  1314. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) == RESET)
  1315. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1316. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1317. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1318. defined (STM32F750xx)
  1319. /**
  1320. * @brief Enable ETHERNET clock.
  1321. */
  1322. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1323. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  1324. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  1325. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  1326. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  1327. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  1328. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  1329. /**
  1330. * @brief Disable ETHERNET clock.
  1331. */
  1332. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  1333. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  1334. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  1335. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  1336. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  1337. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  1338. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  1339. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1340. /** @brief Get the enable or disable status of the AHB2 peripheral clock.
  1341. * @note After reset, the peripheral clock (used for registers read/write access)
  1342. * is disabled and the application software has to enable this clock before
  1343. * using it.
  1344. */
  1345. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  1346. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  1347. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  1348. #define __HAL_RCC_USB_IS_OTG_FS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  1349. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1350. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  1351. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  1352. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  1353. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  1354. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1355. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1356. #define __HAL_RCC_AES_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) != RESET)
  1357. #define __HAL_RCC_AES_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) == RESET)
  1358. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  1359. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1360. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1361. defined (STM32F750xx)
  1362. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  1363. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  1364. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1365. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1366. #define __HAL_RCC_JPEG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_JPEGEN)) != RESET)
  1367. #define __HAL_RCC_JPEG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_JPEGEN)) == RESET)
  1368. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1369. /** @brief Get the enable or disable status of the AHB3 peripheral clock.
  1370. * @note After reset, the peripheral clock (used for registers read/write access)
  1371. * is disabled and the application software has to enable this clock before
  1372. * using it.
  1373. */
  1374. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  1375. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  1376. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  1377. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  1378. /** @brief Get the enable or disable status of the APB1 peripheral clock.
  1379. * @note After reset, the peripheral clock (used for registers read/write access)
  1380. * is disabled and the application software has to enable this clock before
  1381. * using it.
  1382. */
  1383. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  1384. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  1385. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  1386. #define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET)
  1387. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  1388. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  1389. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  1390. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  1391. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  1392. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  1393. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1394. #define __HAL_RCC_CAN3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) != RESET)
  1395. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1396. #define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET)
  1397. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  1398. #define __HAL_RCC_USART2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET)
  1399. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  1400. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  1401. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  1402. #define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET)
  1403. #define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET)
  1404. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  1405. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  1406. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  1407. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  1408. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  1409. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  1410. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  1411. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  1412. #define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET)
  1413. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  1414. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  1415. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  1416. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  1417. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  1418. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  1419. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1420. #define __HAL_RCC_CAN3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) == RESET)
  1421. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1422. #define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET)
  1423. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  1424. #define __HAL_RCC_USART2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET)
  1425. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  1426. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  1427. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  1428. #define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET)
  1429. #define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET)
  1430. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  1431. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  1432. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  1433. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  1434. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  1435. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1436. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1437. defined (STM32F750xx)
  1438. #define __HAL_RCC_SPDIFRX_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) != RESET)
  1439. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  1440. #define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET)
  1441. #define __HAL_RCC_I2C4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C4EN)) != RESET)
  1442. #define __HAL_RCC_SPDIFRX_IS_CLK_DISABLED()((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) == RESET)
  1443. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  1444. #define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET)
  1445. #define __HAL_RCC_I2C4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C4EN)) == RESET)
  1446. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1447. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  1448. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  1449. defined (STM32F779xx) || defined (STM32F730xx)
  1450. #define __HAL_RCC_RTC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCEN)) != RESET)
  1451. #define __HAL_RCC_RTC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCEN)) == RESET)
  1452. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  1453. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1454. /** @brief Get the enable or disable status of the APB2 peripheral clock.
  1455. * @note After reset, the peripheral clock (used for registers read/write access)
  1456. * is disabled and the application software has to enable this clock before
  1457. * using it.
  1458. */
  1459. #define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET)
  1460. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  1461. #define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET)
  1462. #define __HAL_RCC_USART6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) != RESET)
  1463. #define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET)
  1464. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  1465. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  1466. #define __HAL_RCC_SDMMC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC1EN)) != RESET)
  1467. #define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET)
  1468. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  1469. #define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET)
  1470. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  1471. #define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET)
  1472. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  1473. #define __HAL_RCC_SPI6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) != RESET)
  1474. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  1475. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) != RESET)
  1476. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1477. #define __HAL_RCC_LTDC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) != RESET)
  1478. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1479. #if defined (STM32F769xx) || defined (STM32F779xx)
  1480. #define __HAL_RCC_DSI_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) != RESET)
  1481. #endif /* STM32F769xx || STM32F779xx */
  1482. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1483. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1484. #define __HAL_RCC_SDMMC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC2EN)) != RESET)
  1485. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1486. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1487. #define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) != RESET)
  1488. #define __HAL_RCC_MDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_MDIOEN)) != RESET)
  1489. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1490. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1491. #define __HAL_RCC_OTGPHYC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_OTGPHYCEN)) != RESET)
  1492. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1493. #define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET)
  1494. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  1495. #define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET)
  1496. #define __HAL_RCC_USART6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) == RESET)
  1497. #define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET)
  1498. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  1499. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  1500. #define __HAL_RCC_SDMMC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC1EN)) == RESET)
  1501. #define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET)
  1502. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  1503. #define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET)
  1504. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  1505. #define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET)
  1506. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  1507. #define __HAL_RCC_SPI6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) == RESET)
  1508. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  1509. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) == RESET)
  1510. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1511. #define __HAL_RCC_LTDC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) == RESET)
  1512. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1513. #if defined (STM32F769xx) || defined (STM32F779xx)
  1514. #define __HAL_RCC_DSI_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) == RESET)
  1515. #endif /* STM32F769xx || STM32F779xx */
  1516. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1517. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1518. #define __HAL_RCC_SDMMC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC2EN)) == RESET)
  1519. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1520. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1521. #define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) == RESET)
  1522. #define __HAL_RCC_MDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_MDIOEN)) == RESET)
  1523. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1524. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1525. #define __HAL_RCC_OTGPHYC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_OTGPHYCEN)) == RESET)
  1526. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1527. /**
  1528. * @}
  1529. */
  1530. /** @defgroup RCCEx_Force_Release_Peripheral_Reset RCCEx Force Release Peripheral Reset
  1531. * @brief Forces or releases AHB/APB peripheral reset.
  1532. * @{
  1533. */
  1534. /** @brief Force or release AHB1 peripheral reset.
  1535. */
  1536. #define __HAL_RCC_DMA2_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2RST))
  1537. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  1538. #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOARST))
  1539. #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOBRST))
  1540. #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOCRST))
  1541. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  1542. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  1543. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  1544. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  1545. #define __HAL_RCC_GPIOH_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOHRST))
  1546. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  1547. #define __HAL_RCC_DMA2_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2RST))
  1548. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  1549. #define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOARST))
  1550. #define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOBRST))
  1551. #define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOCRST))
  1552. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  1553. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  1554. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  1555. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  1556. #define __HAL_RCC_GPIOH_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOHRST))
  1557. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  1558. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1559. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1560. defined (STM32F750xx)
  1561. #define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2DRST))
  1562. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  1563. #define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOJRST))
  1564. #define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOKRST))
  1565. #define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2DRST))
  1566. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  1567. #define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOJRST))
  1568. #define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOKRST))
  1569. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1570. /** @brief Force or release AHB2 peripheral reset.
  1571. */
  1572. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  1573. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  1574. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  1575. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  1576. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  1577. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  1578. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1579. #define __HAL_RCC_JPEG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_JPEGRST))
  1580. #define __HAL_RCC_JPEG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_JPEGRST))
  1581. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1582. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1583. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  1584. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  1585. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  1586. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  1587. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1588. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1589. #define __HAL_RCC_AES_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_AESRST))
  1590. #define __HAL_RCC_AES_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_AESRST))
  1591. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  1592. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1593. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1594. defined (STM32F750xx)
  1595. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  1596. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  1597. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1598. /** @brief Force or release AHB3 peripheral reset
  1599. */
  1600. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  1601. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  1602. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  1603. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  1604. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  1605. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  1606. /** @brief Force or release APB1 peripheral reset.
  1607. */
  1608. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  1609. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  1610. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  1611. #define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST))
  1612. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  1613. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  1614. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  1615. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  1616. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  1617. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  1618. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1619. #define __HAL_RCC_CAN3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN3RST))
  1620. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1621. #define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST))
  1622. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  1623. #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST))
  1624. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  1625. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  1626. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  1627. #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST))
  1628. #define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST))
  1629. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  1630. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  1631. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  1632. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  1633. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  1634. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  1635. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  1636. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  1637. #define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST))
  1638. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  1639. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  1640. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  1641. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  1642. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  1643. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  1644. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1645. #define __HAL_RCC_CAN3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN3RST))
  1646. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1647. #define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST))
  1648. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  1649. #define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST))
  1650. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  1651. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  1652. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  1653. #define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST))
  1654. #define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST))
  1655. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  1656. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  1657. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  1658. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  1659. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  1660. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1661. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1662. defined (STM32F750xx)
  1663. #define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPDIFRXRST))
  1664. #define __HAL_RCC_I2C4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C4RST))
  1665. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  1666. #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST))
  1667. #define __HAL_RCC_SPDIFRX_RELEASE_RESET()(RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPDIFRXRST))
  1668. #define __HAL_RCC_I2C4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C4RST))
  1669. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  1670. #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST))
  1671. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1672. /** @brief Force or release APB2 peripheral reset.
  1673. */
  1674. #define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST))
  1675. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  1676. #define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST))
  1677. #define __HAL_RCC_USART6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART6RST))
  1678. #define __HAL_RCC_ADC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADCRST))
  1679. #define __HAL_RCC_SDMMC1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDMMC1RST))
  1680. #define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST))
  1681. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  1682. #define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST))
  1683. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  1684. #define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST))
  1685. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  1686. #define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI6RST))
  1687. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  1688. #define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI2RST))
  1689. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1690. #define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_LTDCRST))
  1691. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1692. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1693. #define __HAL_RCC_OTGPHYC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_OTGPHYCRST))
  1694. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1695. #define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST))
  1696. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  1697. #define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST))
  1698. #define __HAL_RCC_USART6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART6RST))
  1699. #define __HAL_RCC_ADC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADCRST))
  1700. #define __HAL_RCC_SDMMC1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDMMC1RST))
  1701. #define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST))
  1702. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  1703. #define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST))
  1704. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  1705. #define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST))
  1706. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  1707. #define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI6RST))
  1708. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  1709. #define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI2RST))
  1710. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1711. #define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_LTDCRST))
  1712. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1713. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1714. #define __HAL_RCC_OTGPHYC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_OTGPHYCRST))
  1715. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1716. #if defined (STM32F769xx) || defined (STM32F779xx)
  1717. #define __HAL_RCC_DSI_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DSIRST))
  1718. #define __HAL_RCC_DSI_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DSIRST))
  1719. #endif /* STM32F769xx || STM32F779xx */
  1720. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1721. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1722. #define __HAL_RCC_SDMMC2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDMMC2RST))
  1723. #define __HAL_RCC_SDMMC2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDMMC2RST))
  1724. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1725. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1726. #define __HAL_RCC_DFSDM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM1RST))
  1727. #define __HAL_RCC_MDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_MDIORST))
  1728. #define __HAL_RCC_DFSDM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM1RST))
  1729. #define __HAL_RCC_MDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_MDIORST))
  1730. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1731. /**
  1732. * @}
  1733. */
  1734. /** @defgroup RCCEx_Peripheral_Clock_Sleep_Enable_Disable RCCEx Peripheral Clock Sleep Enable Disable
  1735. * @brief Enables or disables the AHB/APB peripheral clock during Low Power (Sleep) mode.
  1736. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1737. * power consumption.
  1738. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1739. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1740. * @{
  1741. */
  1742. /** @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1743. */
  1744. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  1745. #define __HAL_RCC_AXI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_AXILPEN))
  1746. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  1747. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  1748. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  1749. #define __HAL_RCC_DTCM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DTCMLPEN))
  1750. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2LPEN))
  1751. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  1752. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  1753. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOALPEN))
  1754. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOBLPEN))
  1755. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOCLPEN))
  1756. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  1757. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  1758. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  1759. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  1760. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOHLPEN))
  1761. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  1762. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  1763. #define __HAL_RCC_AXI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_AXILPEN))
  1764. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  1765. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  1766. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  1767. #define __HAL_RCC_DTCM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DTCMLPEN))
  1768. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2LPEN))
  1769. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  1770. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  1771. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOALPEN))
  1772. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOBLPEN))
  1773. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOCLPEN))
  1774. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  1775. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  1776. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  1777. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  1778. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOHLPEN))
  1779. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  1780. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1781. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1782. defined (STM32F750xx)
  1783. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2DLPEN))
  1784. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  1785. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  1786. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  1787. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  1788. #define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOJLPEN))
  1789. #define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOKLPEN))
  1790. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2DLPEN))
  1791. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  1792. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  1793. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  1794. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  1795. #define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOJLPEN))
  1796. #define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOKLPEN))
  1797. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1798. /** @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1799. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1800. * power consumption.
  1801. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1802. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1803. */
  1804. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1805. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1806. defined (STM32F750xx)
  1807. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  1808. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  1809. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1810. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1811. #define __HAL_RCC_JPEG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_JPEGLPEN))
  1812. #define __HAL_RCC_JPEG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_JPEGLPEN))
  1813. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1814. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  1815. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  1816. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  1817. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  1818. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1819. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  1820. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  1821. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  1822. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  1823. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1824. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1825. #define __HAL_RCC_AES_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_AESLPEN))
  1826. #define __HAL_RCC_AES_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_AESLPEN))
  1827. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  1828. /** @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1829. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1830. * power consumption.
  1831. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1832. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1833. */
  1834. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  1835. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  1836. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  1837. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  1838. /** @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1839. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1840. * power consumption.
  1841. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1842. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1843. */
  1844. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  1845. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  1846. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  1847. #define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM5LPEN))
  1848. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  1849. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  1850. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  1851. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  1852. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  1853. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  1854. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1855. #define __HAL_RCC_CAN3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN3LPEN))
  1856. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1857. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI2LPEN))
  1858. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  1859. #define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART2LPEN))
  1860. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  1861. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  1862. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  1863. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C1LPEN))
  1864. #define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C2LPEN))
  1865. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  1866. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  1867. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  1868. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  1869. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  1870. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  1871. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  1872. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  1873. #define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM5LPEN))
  1874. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  1875. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  1876. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  1877. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  1878. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  1879. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  1880. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1881. #define __HAL_RCC_CAN3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN3LPEN))
  1882. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1883. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI2LPEN))
  1884. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  1885. #define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART2LPEN))
  1886. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  1887. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  1888. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  1889. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C1LPEN))
  1890. #define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C2LPEN))
  1891. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  1892. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  1893. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  1894. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  1895. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  1896. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  1897. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  1898. defined (STM32F779xx) || defined (STM32F730xx)
  1899. #define __HAL_RCC_RTC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCLPEN))
  1900. #define __HAL_RCC_RTC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCLPEN))
  1901. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  1902. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1903. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1904. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1905. defined (STM32F750xx)
  1906. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPDIFRXLPEN))
  1907. #define __HAL_RCC_I2C4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C4LPEN))
  1908. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  1909. #define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CECLPEN))
  1910. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPDIFRXLPEN))
  1911. #define __HAL_RCC_I2C4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C4LPEN))
  1912. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  1913. #define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CECLPEN))
  1914. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1915. /** @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1916. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1917. * power consumption.
  1918. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1919. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1920. */
  1921. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM1LPEN))
  1922. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  1923. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART1LPEN))
  1924. #define __HAL_RCC_USART6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART6LPEN))
  1925. #define __HAL_RCC_ADC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC1LPEN))
  1926. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  1927. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  1928. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDMMC1LPEN))
  1929. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI1LPEN))
  1930. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  1931. #define __HAL_RCC_TIM9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM9LPEN))
  1932. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  1933. #define __HAL_RCC_TIM11_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM11LPEN))
  1934. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  1935. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  1936. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI2LPEN))
  1937. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1938. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_LTDCLPEN))
  1939. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1940. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM1LPEN))
  1941. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  1942. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART1LPEN))
  1943. #define __HAL_RCC_USART6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART6LPEN))
  1944. #define __HAL_RCC_ADC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC1LPEN))
  1945. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  1946. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  1947. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDMMC1LPEN))
  1948. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI1LPEN))
  1949. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  1950. #define __HAL_RCC_TIM9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM9LPEN))
  1951. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  1952. #define __HAL_RCC_TIM11_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM11LPEN))
  1953. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  1954. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  1955. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI2LPEN))
  1956. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)|| defined (STM32F750xx)
  1957. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_LTDCLPEN))
  1958. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1959. #if defined (STM32F769xx) || defined (STM32F779xx)
  1960. #define __HAL_RCC_DSI_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DSILPEN))
  1961. #define __HAL_RCC_DSI_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DSILPEN))
  1962. #endif /* STM32F769xx || STM32F779xx */
  1963. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1964. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM1LPEN))
  1965. #define __HAL_RCC_MDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_MDIOLPEN))
  1966. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM1LPEN))
  1967. #define __HAL_RCC_MDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_MDIOLPEN))
  1968. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1969. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1970. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1971. #define __HAL_RCC_SDMMC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDMMC2LPEN))
  1972. #define __HAL_RCC_SDMMC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDMMC2LPEN))
  1973. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1974. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1975. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1976. defined (STM32F750xx)
  1977. #define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI6LPEN))
  1978. #define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI6LPEN))
  1979. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1980. /**
  1981. * @}
  1982. */
  1983. /** @defgroup RCC_Clock_Sleep_Enable_Disable_Status AHB/APB Peripheral Clock Sleep Enable Disable Status
  1984. * @brief Get the enable or disable status of the AHB/APB peripheral clock during Low Power (Sleep) mode.
  1985. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1986. * power consumption.
  1987. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1988. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1989. * @{
  1990. */
  1991. /** @brief Get the enable or disable status of the AHB1 peripheral clock during Low Power (Sleep) mode.
  1992. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1993. * power consumption.
  1994. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1995. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1996. */
  1997. #define __HAL_RCC_FLITF_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_FLITFLPEN)) != RESET)
  1998. #define __HAL_RCC_AXI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_AXILPEN)) != RESET)
  1999. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM1LPEN)) != RESET)
  2000. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM2LPEN)) != RESET)
  2001. #define __HAL_RCC_BKPSRAM_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_BKPSRAMLPEN)) != RESET)
  2002. #define __HAL_RCC_DTCM_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DTCMLPEN)) != RESET)
  2003. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2LPEN)) != RESET)
  2004. #define __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSLPEN)) != RESET)
  2005. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSULPILPEN)) != RESET)
  2006. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOALPEN)) != RESET)
  2007. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOBLPEN)) != RESET)
  2008. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOCLPEN)) != RESET)
  2009. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIODLPEN)) != RESET)
  2010. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOELPEN)) != RESET)
  2011. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOFLPEN)) != RESET)
  2012. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOGLPEN)) != RESET)
  2013. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOHLPEN)) != RESET)
  2014. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOILPEN)) != RESET)
  2015. #define __HAL_RCC_FLITF_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_FLITFLPEN)) == RESET)
  2016. #define __HAL_RCC_AXI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_AXILPEN)) == RESET)
  2017. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM1LPEN)) == RESET)
  2018. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM2LPEN)) == RESET)
  2019. #define __HAL_RCC_BKPSRAM_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_BKPSRAMLPEN)) == RESET)
  2020. #define __HAL_RCC_DTCM_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DTCMLPEN)) == RESET)
  2021. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2LPEN)) == RESET)
  2022. #define __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSLPEN)) == RESET)
  2023. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSULPILPEN)) == RESET)
  2024. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOALPEN)) == RESET)
  2025. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOBLPEN)) == RESET)
  2026. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOCLPEN)) == RESET)
  2027. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIODLPEN)) == RESET)
  2028. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOELPEN)) == RESET)
  2029. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOFLPEN)) == RESET)
  2030. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOGLPEN)) == RESET)
  2031. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOHLPEN)) == RESET)
  2032. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOILPEN)) == RESET)
  2033. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2034. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2035. defined (STM32F750xx)
  2036. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2DLPEN)) != RESET)
  2037. #define __HAL_RCC_ETHMAC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACLPEN)) != RESET)
  2038. #define __HAL_RCC_ETHMACTX_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACTXLPEN)) != RESET)
  2039. #define __HAL_RCC_ETHMACRX_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACRXLPEN)) != RESET)
  2040. #define __HAL_RCC_ETHMACPTP_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACPTPLPEN)) != RESET)
  2041. #define __HAL_RCC_GPIOJ_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOJLPEN)) != RESET)
  2042. #define __HAL_RCC_GPIOK_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOKLPEN)) != RESET)
  2043. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2DLPEN)) == RESET)
  2044. #define __HAL_RCC_ETHMAC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACLPEN)) == RESET)
  2045. #define __HAL_RCC_ETHMACTX_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACTXLPEN)) == RESET)
  2046. #define __HAL_RCC_ETHMACRX_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACRXLPEN)) == RESET)
  2047. #define __HAL_RCC_ETHMACPTP_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACPTPLPEN)) == RESET)
  2048. #define __HAL_RCC_GPIOJ_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOJLPEN)) == RESET)
  2049. #define __HAL_RCC_GPIOK_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOKLPEN)) == RESET)
  2050. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2051. /** @brief Get the enable or disable status of the AHB2 peripheral clock during Low Power (Sleep) mode.
  2052. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2053. * power consumption.
  2054. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2055. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2056. */
  2057. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2058. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2059. defined (STM32F750xx)
  2060. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_DCMILPEN)) != RESET)
  2061. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_DCMILPEN)) == RESET)
  2062. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2063. #if defined(STM32F767xx) || defined(STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2064. #define __HAL_RCC_JPEG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_JPEGLPEN)) != RESET)
  2065. #define __HAL_RCC_JPEG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_JPEGLPEN)) == RESET)
  2066. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2067. #define __HAL_RCC_RNG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_RNGLPEN)) != RESET)
  2068. #define __HAL_RCC_RNG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_RNGLPEN)) == RESET)
  2069. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_OTGFSLPEN)) != RESET)
  2070. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_OTGFSLPEN)) == RESET)
  2071. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  2072. #define __HAL_RCC_CRYP_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_CRYPLPEN)) != RESET)
  2073. #define __HAL_RCC_HASH_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_HASHLPEN)) != RESET)
  2074. #define __HAL_RCC_CRYP_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_CRYPLPEN)) == RESET)
  2075. #define __HAL_RCC_HASH_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_HASHLPEN)) == RESET)
  2076. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2077. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  2078. #define __HAL_RCC_AES_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_AESLPEN)) != RESET)
  2079. #define __HAL_RCC_AES_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_AESLPEN)) == RESET)
  2080. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  2081. /** @brief Get the enable or disable status of the AHB3 peripheral clock during Low Power (Sleep) mode.
  2082. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2083. * power consumption.
  2084. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2085. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2086. */
  2087. #define __HAL_RCC_FMC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_FMCLPEN)) != RESET)
  2088. #define __HAL_RCC_FMC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_FMCLPEN)) == RESET)
  2089. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_QSPILPEN)) != RESET)
  2090. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_QSPILPEN)) == RESET)
  2091. /** @brief Get the enable or disable status of the APB1 peripheral clock during Low Power (Sleep) mode.
  2092. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2093. * power consumption.
  2094. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2095. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2096. */
  2097. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) != RESET)
  2098. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) != RESET)
  2099. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) != RESET)
  2100. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM5LPEN)) != RESET)
  2101. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) != RESET)
  2102. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) != RESET)
  2103. #define __HAL_RCC_TIM12_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM12LPEN)) != RESET)
  2104. #define __HAL_RCC_TIM13_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM13LPEN)) != RESET)
  2105. #define __HAL_RCC_TIM14_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM14LPEN)) != RESET)
  2106. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_LPTIM1LPEN)) != RESET)
  2107. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  2108. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  2109. defined (STM32F779xx) || defined (STM32F730xx)
  2110. #define __HAL_RCC_RTC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_RTCLPEN)) != RESET)
  2111. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  2112. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2113. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2114. #define __HAL_RCC_CAN3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN3LPEN)) != RESET)
  2115. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2116. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) != RESET)
  2117. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI3LPEN)) != RESET)
  2118. #define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) != RESET)
  2119. #define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) != RESET)
  2120. #define __HAL_RCC_UART4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART4LPEN)) != RESET)
  2121. #define __HAL_RCC_UART5_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART5LPEN)) != RESET)
  2122. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) != RESET)
  2123. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) != RESET)
  2124. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C3LPEN)) != RESET)
  2125. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN1LPEN)) != RESET)
  2126. #define __HAL_RCC_DAC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) != RESET)
  2127. #define __HAL_RCC_UART7_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART7LPEN)) != RESET)
  2128. #define __HAL_RCC_UART8_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART8LPEN)) != RESET)
  2129. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) == RESET)
  2130. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) == RESET)
  2131. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) == RESET)
  2132. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM5LPEN)) == RESET)
  2133. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) == RESET)
  2134. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) == RESET)
  2135. #define __HAL_RCC_TIM12_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM12LPEN)) == RESET)
  2136. #define __HAL_RCC_TIM13_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM13LPEN)) == RESET)
  2137. #define __HAL_RCC_TIM14_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM14LPEN)) == RESET)
  2138. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_LPTIM1LPEN)) == RESET)
  2139. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  2140. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  2141. defined (STM32F779xx) || defined (STM32F730xx)
  2142. #define __HAL_RCC_RTC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_RTCLPEN)) == RESET)
  2143. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  2144. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2145. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2146. #define __HAL_RCC_CAN3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN3LPEN)) == RESET)
  2147. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2148. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) == RESET)
  2149. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI3LPEN)) == RESET)
  2150. #define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) == RESET)
  2151. #define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) == RESET)
  2152. #define __HAL_RCC_UART4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART4LPEN)) == RESET)
  2153. #define __HAL_RCC_UART5_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART5LPEN)) == RESET)
  2154. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) == RESET)
  2155. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) == RESET)
  2156. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C3LPEN)) == RESET)
  2157. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN1LPEN)) == RESET)
  2158. #define __HAL_RCC_DAC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) == RESET)
  2159. #define __HAL_RCC_UART7_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART7LPEN)) == RESET)
  2160. #define __HAL_RCC_UART8_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART8LPEN)) == RESET)
  2161. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2162. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2163. defined (STM32F750xx)
  2164. #define __HAL_RCC_SPDIFRX_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPDIFRXLPEN)) != RESET)
  2165. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C4LPEN)) != RESET)
  2166. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN2LPEN)) != RESET)
  2167. #define __HAL_RCC_CEC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CECLPEN)) != RESET)
  2168. #define __HAL_RCC_SPDIFRX_IS_CLK_SLEEP_DISABLED()((RCC->APB1LPENR & (RCC_APB1LPENR_SPDIFRXLPEN)) == RESET)
  2169. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C4LPEN)) == RESET)
  2170. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN2LPEN)) == RESET)
  2171. #define __HAL_RCC_CEC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CECLPEN)) == RESET)
  2172. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2173. /** @brief Get the enable or disable status of the APB2 peripheral clock during Low Power (Sleep) mode.
  2174. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2175. * power consumption.
  2176. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2177. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2178. */
  2179. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM1LPEN)) != RESET)
  2180. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM8LPEN)) != RESET)
  2181. #define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) != RESET)
  2182. #define __HAL_RCC_USART6_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART6LPEN)) != RESET)
  2183. #define __HAL_RCC_ADC1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) != RESET)
  2184. #define __HAL_RCC_ADC2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC2LPEN)) != RESET)
  2185. #define __HAL_RCC_ADC3_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC3LPEN)) != RESET)
  2186. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC1LPEN)) != RESET)
  2187. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) != RESET)
  2188. #define __HAL_RCC_SPI4_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI4LPEN)) != RESET)
  2189. #define __HAL_RCC_TIM9_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) != RESET)
  2190. #define __HAL_RCC_TIM10_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) != RESET)
  2191. #define __HAL_RCC_TIM11_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) != RESET)
  2192. #define __HAL_RCC_SPI5_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI5LPEN)) != RESET)
  2193. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI1LPEN)) != RESET)
  2194. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI2LPEN)) != RESET)
  2195. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  2196. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_LTDCLPEN)) != RESET)
  2197. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2198. #if defined (STM32F769xx) || defined (STM32F779xx)
  2199. #define __HAL_RCC_DSI_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DSILPEN)) != RESET)
  2200. #endif /* STM32F769xx || STM32F779xx */
  2201. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  2202. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  2203. #define __HAL_RCC_SDMMC2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC2LPEN)) != RESET)
  2204. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2205. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2206. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DFSDM1LPEN)) != RESET)
  2207. #define __HAL_RCC_MDIO_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_MDIOLPEN)) != RESET)
  2208. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2209. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM1LPEN)) == RESET)
  2210. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM8LPEN)) == RESET)
  2211. #define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) == RESET)
  2212. #define __HAL_RCC_USART6_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART6LPEN)) == RESET)
  2213. #define __HAL_RCC_ADC1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) == RESET)
  2214. #define __HAL_RCC_ADC2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC2LPEN)) == RESET)
  2215. #define __HAL_RCC_ADC3_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC3LPEN)) == RESET)
  2216. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC1LPEN)) == RESET)
  2217. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) == RESET)
  2218. #define __HAL_RCC_SPI4_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI4LPEN)) == RESET)
  2219. #define __HAL_RCC_TIM9_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) == RESET)
  2220. #define __HAL_RCC_TIM10_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) == RESET)
  2221. #define __HAL_RCC_TIM11_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) == RESET)
  2222. #define __HAL_RCC_SPI5_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI5LPEN)) == RESET)
  2223. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI1LPEN)) == RESET)
  2224. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI2LPEN)) == RESET)
  2225. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  2226. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_LTDCLPEN)) == RESET)
  2227. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2228. #if defined (STM32F769xx) || defined (STM32F779xx)
  2229. #define __HAL_RCC_DSI_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DSILPEN)) == RESET)
  2230. #endif /* STM32F769xx || STM32F779xx */
  2231. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  2232. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  2233. #define __HAL_RCC_SDMMC2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC2LPEN)) == RESET)
  2234. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2235. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2236. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DFSDM1LPEN)) == RESET)
  2237. #define __HAL_RCC_MDIO_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_MDIOLPEN)) == RESET)
  2238. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2239. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2240. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2241. defined (STM32F750xx)
  2242. #define __HAL_RCC_SPI6_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI6LPEN)) != RESET)
  2243. #define __HAL_RCC_SPI6_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI6LPEN)) == RESET)
  2244. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2245. /**
  2246. * @}
  2247. */
  2248. /*------------------------------- PLL Configuration --------------------------*/
  2249. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2250. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  2251. * @note This function must be used only when the main PLL is disabled.
  2252. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  2253. * This parameter can be one of the following values:
  2254. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  2255. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  2256. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  2257. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  2258. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  2259. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2260. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  2261. * of 2 MHz to limit PLL jitter.
  2262. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  2263. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2264. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2265. * output frequency is between 100 and 432 MHz.
  2266. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  2267. * This parameter must be a number in the range {2, 4, 6, or 8}.
  2268. * @note You have to set the PLLP parameter correctly to not exceed 216 MHz on
  2269. * the System clock frequency.
  2270. * @param __PLLQ__ specifies the division factor for OTG FS, SDMMC and RNG clocks
  2271. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2272. * @note If the USB OTG FS is used in your application, you have to set the
  2273. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  2274. * the SDMMC and RNG need a frequency lower than or equal to 48 MHz to work
  2275. * correctly.
  2276. * @param __PLLR__ specifies the division factor for DSI clock
  2277. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2278. */
  2279. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__) \
  2280. (RCC->PLLCFGR = ((__RCC_PLLSource__) | (__PLLM__) | \
  2281. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  2282. ((((__PLLP__) >> 1) -1) << RCC_PLLCFGR_PLLP_Pos) | \
  2283. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos) | \
  2284. ((__PLLR__) << RCC_PLLCFGR_PLLR_Pos)))
  2285. #else
  2286. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  2287. * @note This function must be used only when the main PLL is disabled.
  2288. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  2289. * This parameter can be one of the following values:
  2290. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  2291. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  2292. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  2293. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  2294. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  2295. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2296. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  2297. * of 2 MHz to limit PLL jitter.
  2298. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  2299. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2300. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2301. * output frequency is between 100 and 432 MHz.
  2302. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  2303. * This parameter must be a number in the range {2, 4, 6, or 8}.
  2304. * @note You have to set the PLLP parameter correctly to not exceed 216 MHz on
  2305. * the System clock frequency.
  2306. * @param __PLLQ__ specifies the division factor for OTG FS, SDMMC and RNG clocks
  2307. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2308. * @note If the USB OTG FS is used in your application, you have to set the
  2309. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  2310. * the SDMMC and RNG need a frequency lower than or equal to 48 MHz to work
  2311. * correctly.
  2312. */
  2313. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__) \
  2314. (RCC->PLLCFGR = (0x20000000 | (__RCC_PLLSource__) | (__PLLM__)| \
  2315. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  2316. ((((__PLLP__) >> 1) -1) << RCC_PLLCFGR_PLLP_Pos) | \
  2317. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos)))
  2318. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2319. /*---------------------------------------------------------------------------------------------*/
  2320. /** @brief Macro to configure the Timers clocks prescalers
  2321. * @param __PRESC__ specifies the Timers clocks prescalers selection
  2322. * This parameter can be one of the following values:
  2323. * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is
  2324. * equal to HPRE if PPREx is corresponding to division by 1 or 2,
  2325. * else it is equal to [(HPRE * PPREx) / 2] if PPREx is corresponding to
  2326. * division by 4 or more.
  2327. * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is
  2328. * equal to HPRE if PPREx is corresponding to division by 1, 2 or 4,
  2329. * else it is equal to [(HPRE * PPREx) / 4] if PPREx is corresponding
  2330. * to division by 8 or more.
  2331. */
  2332. #define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) do {RCC->DCKCFGR1 &= ~(RCC_DCKCFGR1_TIMPRE);\
  2333. RCC->DCKCFGR1 |= (__PRESC__); \
  2334. }while(0)
  2335. /** @brief Macros to Enable or Disable the PLLISAI.
  2336. * @note The PLLSAI is disabled by hardware when entering STOP and STANDBY modes.
  2337. */
  2338. #define __HAL_RCC_PLLSAI_ENABLE() (RCC->CR |= (RCC_CR_PLLSAION))
  2339. #define __HAL_RCC_PLLSAI_DISABLE() (RCC->CR &= ~(RCC_CR_PLLSAION))
  2340. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  2341. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  2342. * @note This function must be used only when the PLLSAI is disabled.
  2343. * @note PLLSAI clock source is common with the main PLL (configured in
  2344. * RCC_PLLConfig function )
  2345. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  2346. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2347. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  2348. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2349. * @param __PLLSAIP__ specifies the division factor for USB, RNG, SDMMC clocks
  2350. * This parameter can be a value of @ref RCCEx_PLLSAIP_Clock_Divider.
  2351. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  2352. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2353. */
  2354. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__) \
  2355. (RCC->PLLSAICFGR = ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\
  2356. ((__PLLSAIP__) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\
  2357. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos))
  2358. /** @brief Macro to configure the PLLI2S clock multiplication and division factors.
  2359. * @note This macro must be used only when the PLLI2S is disabled.
  2360. * @note PLLI2S clock source is common with the main PLL (configured in
  2361. * HAL_RCC_ClockConfig() API)
  2362. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock.
  2363. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2364. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  2365. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2366. * @param __PLLI2SQ__ specifies the division factor for SAI clock.
  2367. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2368. * @param __PLLI2SR__ specifies the division factor for I2S clock
  2369. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2370. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  2371. * on the I2S clock frequency.
  2372. */
  2373. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) \
  2374. (RCC->PLLI2SCFGR = ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  2375. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  2376. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))
  2377. #else
  2378. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  2379. * @note This function must be used only when the PLLSAI is disabled.
  2380. * @note PLLSAI clock source is common with the main PLL (configured in
  2381. * RCC_PLLConfig function )
  2382. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  2383. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2384. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  2385. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2386. * @param __PLLSAIP__ specifies the division factor for USB, RNG, SDMMC clocks
  2387. * This parameter can be a value of @ref RCCEx_PLLSAIP_Clock_Divider.
  2388. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  2389. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2390. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  2391. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2392. */
  2393. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \
  2394. (RCC->PLLSAICFGR = ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\
  2395. ((__PLLSAIP__) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\
  2396. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) |\
  2397. ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos))
  2398. /** @brief Macro to configure the PLLI2S clock multiplication and division factors.
  2399. * @note This macro must be used only when the PLLI2S is disabled.
  2400. * @note PLLI2S clock source is common with the main PLL (configured in
  2401. * HAL_RCC_ClockConfig() API)
  2402. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock.
  2403. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2404. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  2405. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2406. * @param __PLLI2SP__ specifies the division factor for SPDDIF-RX clock.
  2407. * This parameter can be a value of @ref RCCEx_PLLI2SP_Clock_Divider.
  2408. * @param __PLLI2SQ__ specifies the division factor for SAI clock.
  2409. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2410. * @param __PLLI2SR__ specifies the division factor for I2S clock
  2411. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2412. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  2413. * on the I2S clock frequency.
  2414. */
  2415. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SP__, __PLLI2SQ__, __PLLI2SR__) \
  2416. (RCC->PLLI2SCFGR = ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  2417. ((__PLLI2SP__) << RCC_PLLI2SCFGR_PLLI2SP_Pos) |\
  2418. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  2419. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))
  2420. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F730xx */
  2421. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  2422. * @note This function must be called before enabling the PLLI2S.
  2423. * @param __PLLI2SDivQ__ specifies the PLLI2S division factor for SAI1 clock .
  2424. * This parameter must be a number between 1 and 32.
  2425. * SAI1 clock frequency = f(PLLI2SQ) / __PLLI2SDivQ__
  2426. */
  2427. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(__PLLI2SDivQ__) (MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLI2SDIVQ, (__PLLI2SDivQ__)-1))
  2428. /** @brief Macro to configure the SAI clock Divider coming from PLLSAI.
  2429. * @note This function must be called before enabling the PLLSAI.
  2430. * @param __PLLSAIDivQ__ specifies the PLLSAI division factor for SAI1 clock .
  2431. * This parameter must be a number between Min_Data = 1 and Max_Data = 32.
  2432. * SAI1 clock frequency = f(PLLSAIQ) / __PLLSAIDivQ__
  2433. */
  2434. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(__PLLSAIDivQ__) (MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLSAIDIVQ, ((__PLLSAIDivQ__)-1)<<8))
  2435. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2436. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2437. defined (STM32F750xx)
  2438. /** @brief Macro to configure the LTDC clock Divider coming from PLLSAI.
  2439. * @note This function must be called before enabling the PLLSAI.
  2440. * @param __PLLSAIDivR__ specifies the PLLSAI division factor for LTDC clock .
  2441. * This parameter can be a value of @ref RCCEx_PLLSAI_DIVR.
  2442. * LTDC clock frequency = f(PLLSAIR) / __PLLSAIDivR__
  2443. */
  2444. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(__PLLSAIDivR__)\
  2445. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLSAIDIVR, (uint32_t)(__PLLSAIDivR__))
  2446. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2447. /** @brief Macro to configure SAI1 clock source selection.
  2448. * @note This function must be called before enabling PLLSAI, PLLI2S and
  2449. * the SAI clock.
  2450. * @param __SOURCE__ specifies the SAI1 clock source.
  2451. * This parameter can be one of the following values:
  2452. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2453. * as SAI1 clock.
  2454. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2455. * as SAI1 clock.
  2456. * @arg RCC_SAI1CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2457. * used as SAI1 clock.
  2458. * @arg RCC_SAI1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2459. * used as SAI1 clock.
  2460. * @note The RCC_SAI1CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2461. */
  2462. #define __HAL_RCC_SAI1_CONFIG(__SOURCE__)\
  2463. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI1SEL, (uint32_t)(__SOURCE__))
  2464. /** @brief Macro to get the SAI1 clock source.
  2465. * @retval The clock source can be one of the following values:
  2466. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2467. * as SAI1 clock.
  2468. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2469. * as SAI1 clock.
  2470. * @arg RCC_SAI1CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2471. * used as SAI1 clock.
  2472. * @arg RCC_SAI1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2473. * used as SAI1 clock.
  2474. * @note The RCC_SAI1CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2475. */
  2476. #define __HAL_RCC_GET_SAI1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI1SEL)))
  2477. /** @brief Macro to configure SAI2 clock source selection.
  2478. * @note This function must be called before enabling PLLSAI, PLLI2S and
  2479. * the SAI clock.
  2480. * @param __SOURCE__ specifies the SAI2 clock source.
  2481. * This parameter can be one of the following values:
  2482. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2483. * as SAI2 clock.
  2484. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2485. * as SAI2 clock.
  2486. * @arg RCC_SAI2CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2487. * used as SAI2 clock.
  2488. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2489. * used as SAI2 clock.
  2490. * @note The RCC_SAI2CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2491. */
  2492. #define __HAL_RCC_SAI2_CONFIG(__SOURCE__)\
  2493. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI2SEL, (uint32_t)(__SOURCE__))
  2494. /** @brief Macro to get the SAI2 clock source.
  2495. * @retval The clock source can be one of the following values:
  2496. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2497. * as SAI2 clock.
  2498. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2499. * as SAI2 clock.
  2500. * @arg RCC_SAI2CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2501. * used as SAI2 clock.
  2502. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2503. * used as SAI2 clock.
  2504. * @note The RCC_SAI2CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2505. */
  2506. #define __HAL_RCC_GET_SAI2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI2SEL)))
  2507. /** @brief Enable PLLSAI_RDY interrupt.
  2508. */
  2509. #define __HAL_RCC_PLLSAI_ENABLE_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYIE))
  2510. /** @brief Disable PLLSAI_RDY interrupt.
  2511. */
  2512. #define __HAL_RCC_PLLSAI_DISABLE_IT() (RCC->CIR &= ~(RCC_CIR_PLLSAIRDYIE))
  2513. /** @brief Clear the PLLSAI RDY interrupt pending bits.
  2514. */
  2515. #define __HAL_RCC_PLLSAI_CLEAR_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYF))
  2516. /** @brief Check the PLLSAI RDY interrupt has occurred or not.
  2517. * @retval The new state (TRUE or FALSE).
  2518. */
  2519. #define __HAL_RCC_PLLSAI_GET_IT() ((RCC->CIR & (RCC_CIR_PLLSAIRDYIE)) == (RCC_CIR_PLLSAIRDYIE))
  2520. /** @brief Check PLLSAI RDY flag is set or not.
  2521. * @retval The new state (TRUE or FALSE).
  2522. */
  2523. #define __HAL_RCC_PLLSAI_GET_FLAG() ((RCC->CR & (RCC_CR_PLLSAIRDY)) == (RCC_CR_PLLSAIRDY))
  2524. /** @brief Macro to Get I2S clock source selection.
  2525. * @retval The clock source can be one of the following values:
  2526. * @arg RCC_I2SCLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  2527. * @arg RCC_I2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S clock source
  2528. */
  2529. #define __HAL_RCC_GET_I2SCLKSOURCE() (READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC))
  2530. /** @brief Macro to configure the I2C1 clock (I2C1CLK).
  2531. *
  2532. * @param __I2C1_CLKSOURCE__ specifies the I2C1 clock source.
  2533. * This parameter can be one of the following values:
  2534. * @arg RCC_I2C1CLKSOURCE_PCLK1: PCLK1 selected as I2C1 clock
  2535. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  2536. * @arg RCC_I2C1CLKSOURCE_SYSCLK: System Clock selected as I2C1 clock
  2537. */
  2538. #define __HAL_RCC_I2C1_CONFIG(__I2C1_CLKSOURCE__) \
  2539. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C1SEL, (uint32_t)(__I2C1_CLKSOURCE__))
  2540. /** @brief Macro to get the I2C1 clock source.
  2541. * @retval The clock source can be one of the following values:
  2542. * @arg RCC_I2C1CLKSOURCE_PCLK1: PCLK1 selected as I2C1 clock
  2543. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  2544. * @arg RCC_I2C1CLKSOURCE_SYSCLK: System Clock selected as I2C1 clock
  2545. */
  2546. #define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C1SEL)))
  2547. /** @brief Macro to configure the I2C2 clock (I2C2CLK).
  2548. *
  2549. * @param __I2C2_CLKSOURCE__ specifies the I2C2 clock source.
  2550. * This parameter can be one of the following values:
  2551. * @arg RCC_I2C2CLKSOURCE_PCLK1: PCLK1 selected as I2C2 clock
  2552. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  2553. * @arg RCC_I2C2CLKSOURCE_SYSCLK: System Clock selected as I2C2 clock
  2554. */
  2555. #define __HAL_RCC_I2C2_CONFIG(__I2C2_CLKSOURCE__) \
  2556. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C2SEL, (uint32_t)(__I2C2_CLKSOURCE__))
  2557. /** @brief Macro to get the I2C2 clock source.
  2558. * @retval The clock source can be one of the following values:
  2559. * @arg RCC_I2C2CLKSOURCE_PCLK1: PCLK1 selected as I2C2 clock
  2560. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  2561. * @arg RCC_I2C2CLKSOURCE_SYSCLK: System Clock selected as I2C2 clock
  2562. */
  2563. #define __HAL_RCC_GET_I2C2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C2SEL)))
  2564. /** @brief Macro to configure the I2C3 clock (I2C3CLK).
  2565. *
  2566. * @param __I2C3_CLKSOURCE__ specifies the I2C3 clock source.
  2567. * This parameter can be one of the following values:
  2568. * @arg RCC_I2C3CLKSOURCE_PCLK1: PCLK1 selected as I2C3 clock
  2569. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  2570. * @arg RCC_I2C3CLKSOURCE_SYSCLK: System Clock selected as I2C3 clock
  2571. */
  2572. #define __HAL_RCC_I2C3_CONFIG(__I2C3_CLKSOURCE__) \
  2573. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C3SEL, (uint32_t)(__I2C3_CLKSOURCE__))
  2574. /** @brief macro to get the I2C3 clock source.
  2575. * @retval The clock source can be one of the following values:
  2576. * @arg RCC_I2C3CLKSOURCE_PCLK1: PCLK1 selected as I2C3 clock
  2577. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  2578. * @arg RCC_I2C3CLKSOURCE_SYSCLK: System Clock selected as I2C3 clock
  2579. */
  2580. #define __HAL_RCC_GET_I2C3_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C3SEL)))
  2581. /** @brief Macro to configure the I2C4 clock (I2C4CLK).
  2582. *
  2583. * @param __I2C4_CLKSOURCE__ specifies the I2C4 clock source.
  2584. * This parameter can be one of the following values:
  2585. * @arg RCC_I2C4CLKSOURCE_PCLK1: PCLK1 selected as I2C4 clock
  2586. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  2587. * @arg RCC_I2C4CLKSOURCE_SYSCLK: System Clock selected as I2C4 clock
  2588. */
  2589. #define __HAL_RCC_I2C4_CONFIG(__I2C4_CLKSOURCE__) \
  2590. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C4SEL, (uint32_t)(__I2C4_CLKSOURCE__))
  2591. /** @brief macro to get the I2C4 clock source.
  2592. * @retval The clock source can be one of the following values:
  2593. * @arg RCC_I2C4CLKSOURCE_PCLK1: PCLK1 selected as I2C4 clock
  2594. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  2595. * @arg RCC_I2C4CLKSOURCE_SYSCLK: System Clock selected as I2C4 clock
  2596. */
  2597. #define __HAL_RCC_GET_I2C4_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C4SEL)))
  2598. /** @brief Macro to configure the USART1 clock (USART1CLK).
  2599. *
  2600. * @param __USART1_CLKSOURCE__ specifies the USART1 clock source.
  2601. * This parameter can be one of the following values:
  2602. * @arg RCC_USART1CLKSOURCE_PCLK2: PCLK2 selected as USART1 clock
  2603. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  2604. * @arg RCC_USART1CLKSOURCE_SYSCLK: System Clock selected as USART1 clock
  2605. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  2606. */
  2607. #define __HAL_RCC_USART1_CONFIG(__USART1_CLKSOURCE__) \
  2608. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART1SEL, (uint32_t)(__USART1_CLKSOURCE__))
  2609. /** @brief macro to get the USART1 clock source.
  2610. * @retval The clock source can be one of the following values:
  2611. * @arg RCC_USART1CLKSOURCE_PCLK2: PCLK2 selected as USART1 clock
  2612. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  2613. * @arg RCC_USART1CLKSOURCE_SYSCLK: System Clock selected as USART1 clock
  2614. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  2615. */
  2616. #define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART1SEL)))
  2617. /** @brief Macro to configure the USART2 clock (USART2CLK).
  2618. *
  2619. * @param __USART2_CLKSOURCE__ specifies the USART2 clock source.
  2620. * This parameter can be one of the following values:
  2621. * @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
  2622. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  2623. * @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
  2624. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  2625. */
  2626. #define __HAL_RCC_USART2_CONFIG(__USART2_CLKSOURCE__) \
  2627. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART2SEL, (uint32_t)(__USART2_CLKSOURCE__))
  2628. /** @brief macro to get the USART2 clock source.
  2629. * @retval The clock source can be one of the following values:
  2630. * @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
  2631. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  2632. * @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
  2633. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  2634. */
  2635. #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART2SEL)))
  2636. /** @brief Macro to configure the USART3 clock (USART3CLK).
  2637. *
  2638. * @param __USART3_CLKSOURCE__ specifies the USART3 clock source.
  2639. * This parameter can be one of the following values:
  2640. * @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock
  2641. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  2642. * @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock
  2643. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  2644. */
  2645. #define __HAL_RCC_USART3_CONFIG(__USART3_CLKSOURCE__) \
  2646. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART3SEL, (uint32_t)(__USART3_CLKSOURCE__))
  2647. /** @brief macro to get the USART3 clock source.
  2648. * @retval The clock source can be one of the following values:
  2649. * @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock
  2650. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  2651. * @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock
  2652. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  2653. */
  2654. #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART3SEL)))
  2655. /** @brief Macro to configure the UART4 clock (UART4CLK).
  2656. *
  2657. * @param __UART4_CLKSOURCE__ specifies the UART4 clock source.
  2658. * This parameter can be one of the following values:
  2659. * @arg RCC_UART4CLKSOURCE_PCLK1: PCLK1 selected as UART4 clock
  2660. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  2661. * @arg RCC_UART4CLKSOURCE_SYSCLK: System Clock selected as UART4 clock
  2662. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  2663. */
  2664. #define __HAL_RCC_UART4_CONFIG(__UART4_CLKSOURCE__) \
  2665. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART4SEL, (uint32_t)(__UART4_CLKSOURCE__))
  2666. /** @brief macro to get the UART4 clock source.
  2667. * @retval The clock source can be one of the following values:
  2668. * @arg RCC_UART4CLKSOURCE_PCLK1: PCLK1 selected as UART4 clock
  2669. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  2670. * @arg RCC_UART4CLKSOURCE_SYSCLK: System Clock selected as UART4 clock
  2671. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  2672. */
  2673. #define __HAL_RCC_GET_UART4_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART4SEL)))
  2674. /** @brief Macro to configure the UART5 clock (UART5CLK).
  2675. *
  2676. * @param __UART5_CLKSOURCE__ specifies the UART5 clock source.
  2677. * This parameter can be one of the following values:
  2678. * @arg RCC_UART5CLKSOURCE_PCLK1: PCLK1 selected as UART5 clock
  2679. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  2680. * @arg RCC_UART5CLKSOURCE_SYSCLK: System Clock selected as UART5 clock
  2681. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  2682. */
  2683. #define __HAL_RCC_UART5_CONFIG(__UART5_CLKSOURCE__) \
  2684. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART5SEL, (uint32_t)(__UART5_CLKSOURCE__))
  2685. /** @brief macro to get the UART5 clock source.
  2686. * @retval The clock source can be one of the following values:
  2687. * @arg RCC_UART5CLKSOURCE_PCLK1: PCLK1 selected as UART5 clock
  2688. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  2689. * @arg RCC_UART5CLKSOURCE_SYSCLK: System Clock selected as UART5 clock
  2690. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  2691. */
  2692. #define __HAL_RCC_GET_UART5_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART5SEL)))
  2693. /** @brief Macro to configure the USART6 clock (USART6CLK).
  2694. *
  2695. * @param __USART6_CLKSOURCE__ specifies the USART6 clock source.
  2696. * This parameter can be one of the following values:
  2697. * @arg RCC_USART6CLKSOURCE_PCLK1: PCLK1 selected as USART6 clock
  2698. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  2699. * @arg RCC_USART6CLKSOURCE_SYSCLK: System Clock selected as USART6 clock
  2700. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  2701. */
  2702. #define __HAL_RCC_USART6_CONFIG(__USART6_CLKSOURCE__) \
  2703. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART6SEL, (uint32_t)(__USART6_CLKSOURCE__))
  2704. /** @brief macro to get the USART6 clock source.
  2705. * @retval The clock source can be one of the following values:
  2706. * @arg RCC_USART6CLKSOURCE_PCLK1: PCLK1 selected as USART6 clock
  2707. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  2708. * @arg RCC_USART6CLKSOURCE_SYSCLK: System Clock selected as USART6 clock
  2709. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  2710. */
  2711. #define __HAL_RCC_GET_USART6_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART6SEL)))
  2712. /** @brief Macro to configure the UART7 clock (UART7CLK).
  2713. *
  2714. * @param __UART7_CLKSOURCE__ specifies the UART7 clock source.
  2715. * This parameter can be one of the following values:
  2716. * @arg RCC_UART7CLKSOURCE_PCLK1: PCLK1 selected as UART7 clock
  2717. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  2718. * @arg RCC_UART7CLKSOURCE_SYSCLK: System Clock selected as UART7 clock
  2719. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  2720. */
  2721. #define __HAL_RCC_UART7_CONFIG(__UART7_CLKSOURCE__) \
  2722. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART7SEL, (uint32_t)(__UART7_CLKSOURCE__))
  2723. /** @brief macro to get the UART7 clock source.
  2724. * @retval The clock source can be one of the following values:
  2725. * @arg RCC_UART7CLKSOURCE_PCLK1: PCLK1 selected as UART7 clock
  2726. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  2727. * @arg RCC_UART7CLKSOURCE_SYSCLK: System Clock selected as UART7 clock
  2728. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  2729. */
  2730. #define __HAL_RCC_GET_UART7_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART7SEL)))
  2731. /** @brief Macro to configure the UART8 clock (UART8CLK).
  2732. *
  2733. * @param __UART8_CLKSOURCE__ specifies the UART8 clock source.
  2734. * This parameter can be one of the following values:
  2735. * @arg RCC_UART8CLKSOURCE_PCLK1: PCLK1 selected as UART8 clock
  2736. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  2737. * @arg RCC_UART8CLKSOURCE_SYSCLK: System Clock selected as UART8 clock
  2738. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  2739. */
  2740. #define __HAL_RCC_UART8_CONFIG(__UART8_CLKSOURCE__) \
  2741. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART8SEL, (uint32_t)(__UART8_CLKSOURCE__))
  2742. /** @brief macro to get the UART8 clock source.
  2743. * @retval The clock source can be one of the following values:
  2744. * @arg RCC_UART8CLKSOURCE_PCLK1: PCLK1 selected as UART8 clock
  2745. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  2746. * @arg RCC_UART8CLKSOURCE_SYSCLK: System Clock selected as UART8 clock
  2747. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  2748. */
  2749. #define __HAL_RCC_GET_UART8_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART8SEL)))
  2750. /** @brief Macro to configure the LPTIM1 clock (LPTIM1CLK).
  2751. *
  2752. * @param __LPTIM1_CLKSOURCE__ specifies the LPTIM1 clock source.
  2753. * This parameter can be one of the following values:
  2754. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  2755. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI selected as LPTIM1 clock
  2756. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  2757. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  2758. */
  2759. #define __HAL_RCC_LPTIM1_CONFIG(__LPTIM1_CLKSOURCE__) \
  2760. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__LPTIM1_CLKSOURCE__))
  2761. /** @brief macro to get the LPTIM1 clock source.
  2762. * @retval The clock source can be one of the following values:
  2763. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  2764. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI selected as LPTIM1 clock
  2765. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  2766. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  2767. */
  2768. #define __HAL_RCC_GET_LPTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL)))
  2769. /** @brief Macro to configure the CEC clock (CECCLK).
  2770. *
  2771. * @param __CEC_CLKSOURCE__ specifies the CEC clock source.
  2772. * This parameter can be one of the following values:
  2773. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  2774. * @arg RCC_CECCLKSOURCE_HSI: HSI divided by 488 selected as CEC clock
  2775. */
  2776. #define __HAL_RCC_CEC_CONFIG(__CEC_CLKSOURCE__) \
  2777. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, (uint32_t)(__CEC_CLKSOURCE__))
  2778. /** @brief macro to get the CEC clock source.
  2779. * @retval The clock source can be one of the following values:
  2780. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  2781. * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock
  2782. */
  2783. #define __HAL_RCC_GET_CEC_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL)))
  2784. /** @brief Macro to configure the CLK48 source (CLK48CLK).
  2785. *
  2786. * @param __CLK48_SOURCE__ specifies the CLK48 clock source.
  2787. * This parameter can be one of the following values:
  2788. * @arg RCC_CLK48SOURCE_PLL: PLL selected as CLK48 source
  2789. * @arg RCC_CLK48SOURCE_PLLSAIP: PLLSAIP selected as CLK48 source
  2790. */
  2791. #define __HAL_RCC_CLK48_CONFIG(__CLK48_SOURCE__) \
  2792. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__CLK48_SOURCE__))
  2793. /** @brief macro to get the CLK48 source.
  2794. * @retval The clock source can be one of the following values:
  2795. * @arg RCC_CLK48SOURCE_PLL: PLL used as CLK48 source
  2796. * @arg RCC_CLK48SOURCE_PLLSAIP: PLLSAIP used as CLK48 source
  2797. */
  2798. #define __HAL_RCC_GET_CLK48_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL)))
  2799. /** @brief Macro to configure the SDMMC1 clock (SDMMC1CLK).
  2800. *
  2801. * @param __SDMMC1_CLKSOURCE__ specifies the SDMMC1 clock source.
  2802. * This parameter can be one of the following values:
  2803. * @arg RCC_SDMMC1CLKSOURCE_CLK48: CLK48 selected as SDMMC clock
  2804. * @arg RCC_SDMMC1CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC clock
  2805. */
  2806. #define __HAL_RCC_SDMMC1_CONFIG(__SDMMC1_CLKSOURCE__) \
  2807. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC1SEL, (uint32_t)(__SDMMC1_CLKSOURCE__))
  2808. /** @brief macro to get the SDMMC1 clock source.
  2809. * @retval The clock source can be one of the following values:
  2810. * @arg RCC_SDMMC1CLKSOURCE_CLK48: CLK48 selected as SDMMC1 clock
  2811. * @arg RCC_SDMMC1CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC1 clock
  2812. */
  2813. #define __HAL_RCC_GET_SDMMC1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC1SEL)))
  2814. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  2815. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  2816. /** @brief Macro to configure the SDMMC2 clock (SDMMC2CLK).
  2817. * @param __SDMMC2_CLKSOURCE__ specifies the SDMMC2 clock source.
  2818. * This parameter can be one of the following values:
  2819. * @arg RCC_SDMMC2CLKSOURCE_CLK48: CLK48 selected as SDMMC2 clock
  2820. * @arg RCC_SDMMC2CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC2 clock
  2821. */
  2822. #define __HAL_RCC_SDMMC2_CONFIG(__SDMMC2_CLKSOURCE__) \
  2823. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC2SEL, (uint32_t)(__SDMMC2_CLKSOURCE__))
  2824. /** @brief macro to get the SDMMC2 clock source.
  2825. * @retval The clock source can be one of the following values:
  2826. * @arg RCC_SDMMC2CLKSOURCE_CLK48: CLK48 selected as SDMMC2 clock
  2827. * @arg RCC_SDMMC2CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC2 clock
  2828. */
  2829. #define __HAL_RCC_GET_SDMMC2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC2SEL)))
  2830. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2831. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2832. /** @brief Macro to configure the DFSDM1 clock
  2833. * @param __DFSDM1_CLKSOURCE__ specifies the DFSDM1 clock source.
  2834. * This parameter can be one of the following values:
  2835. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 Clock selected as DFSDM clock
  2836. * @arg RCC_DFSDMCLKSOURCE_SYSCLK: System Clock selected as DFSDM clock
  2837. */
  2838. #define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1_CLKSOURCE__) \
  2839. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_DFSDM1SEL, (uint32_t)(__DFSDM1_CLKSOURCE__))
  2840. /** @brief Macro to get the DFSDM1 clock source.
  2841. * @retval The clock source can be one of the following values:
  2842. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 Clock selected as DFSDM1 clock
  2843. * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System Clock selected as DFSDM1 clock
  2844. */
  2845. #define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_DFSDM1SEL)))
  2846. /** @brief Macro to configure the DFSDM1 Audio clock
  2847. * @param __DFSDM1AUDIO_CLKSOURCE__ specifies the DFSDM1 Audio clock source.
  2848. * This parameter can be one of the following values:
  2849. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI1: SAI1 Clock selected as DFSDM1 Audio clock
  2850. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI2: SAI2 Clock selected as DFSDM1 Audio clock
  2851. */
  2852. #define __HAL_RCC_DFSDM1AUDIO_CONFIG(__DFSDM1AUDIO_CLKSOURCE__) \
  2853. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_ADFSDM1SEL, (uint32_t)(__DFSDM1AUDIO_CLKSOURCE__))
  2854. /** @brief Macro to get the DFSDM1 Audio clock source.
  2855. * @retval The clock source can be one of the following values:
  2856. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI1: SAI1 Clock selected as DFSDM1 Audio clock
  2857. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI2: SAI2 Clock selected as DFSDM1 Audio clock
  2858. */
  2859. #define __HAL_RCC_GET_DFSDM1AUDIO_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_ADFSDM1SEL)))
  2860. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2861. #if defined (STM32F769xx) || defined (STM32F779xx)
  2862. /** @brief Macro to configure the DSI clock.
  2863. * @param __DSI_CLKSOURCE__ specifies the DSI clock source.
  2864. * This parameter can be one of the following values:
  2865. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  2866. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  2867. */
  2868. #define __HAL_RCC_DSI_CONFIG(__DSI_CLKSOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_DSISEL, (uint32_t)(__DSI_CLKSOURCE__)))
  2869. /** @brief Macro to Get the DSI clock.
  2870. * @retval The clock source can be one of the following values:
  2871. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  2872. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  2873. */
  2874. #define __HAL_RCC_GET_DSI_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_DSISEL))
  2875. #endif /* STM32F769xx || STM32F779xx */
  2876. /**
  2877. * @}
  2878. */
  2879. /* Exported functions --------------------------------------------------------*/
  2880. /** @addtogroup RCCEx_Exported_Functions_Group1
  2881. * @{
  2882. */
  2883. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2884. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2885. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  2886. HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit);
  2887. HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void);
  2888. HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI(RCC_PLLSAIInitTypeDef *PLLSAIInit);
  2889. HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI(void);
  2890. /**
  2891. * @}
  2892. */
  2893. /* Private macros ------------------------------------------------------------*/
  2894. /** @addtogroup RCCEx_Private_Macros RCCEx Private Macros
  2895. * @{
  2896. */
  2897. /** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters
  2898. * @{
  2899. */
  2900. #if defined(STM32F756xx) || defined(STM32F746xx) || defined(STM32F750xx)
  2901. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2902. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2903. (((SELECTION) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC) || \
  2904. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2905. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2906. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2907. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2908. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2909. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2910. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2911. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2912. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2913. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2914. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2915. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2916. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2917. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2918. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2919. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2920. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2921. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2922. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2923. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2924. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2925. #elif defined(STM32F745xx)
  2926. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2927. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2928. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2929. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2930. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2931. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2932. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2933. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2934. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2935. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2936. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2937. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2938. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2939. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2940. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2941. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2942. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2943. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2944. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2945. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2946. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2947. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2948. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2949. #elif defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2950. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2951. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2952. (((SELECTION) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC) || \
  2953. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2954. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2955. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2956. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2957. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2958. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2959. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2960. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2961. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2962. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2963. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2964. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2965. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2966. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2967. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2968. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2969. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2970. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2971. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2972. (((SELECTION) & RCC_PERIPHCLK_SDMMC2) == RCC_PERIPHCLK_SDMMC2) || \
  2973. (((SELECTION) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) || \
  2974. (((SELECTION) & RCC_PERIPHCLK_DFSDM1_AUDIO) == RCC_PERIPHCLK_DFSDM1_AUDIO) || \
  2975. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2976. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2977. #elif defined (STM32F765xx)
  2978. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2979. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2980. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2981. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2982. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2983. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2984. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2985. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2986. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2987. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2988. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2989. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2990. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2991. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2992. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2993. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2994. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2995. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2996. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2997. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2998. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2999. (((SELECTION) & RCC_PERIPHCLK_SDMMC2) == RCC_PERIPHCLK_SDMMC2) || \
  3000. (((SELECTION) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) || \
  3001. (((SELECTION) & RCC_PERIPHCLK_DFSDM1_AUDIO) == RCC_PERIPHCLK_DFSDM1_AUDIO) || \
  3002. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  3003. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  3004. #elif defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  3005. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  3006. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  3007. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  3008. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  3009. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  3010. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  3011. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  3012. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  3013. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  3014. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  3015. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  3016. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  3017. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  3018. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  3019. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  3020. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  3021. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  3022. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  3023. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  3024. (((SELECTION) & RCC_PERIPHCLK_SDMMC2) == RCC_PERIPHCLK_SDMMC2) || \
  3025. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  3026. #endif /* STM32F746xx || STM32F756xx || STM32F750xx */
  3027. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
  3028. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  3029. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  3030. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == RCC_PLLI2SP_DIV2) ||\
  3031. ((VALUE) == RCC_PLLI2SP_DIV4) ||\
  3032. ((VALUE) == RCC_PLLI2SP_DIV6) ||\
  3033. ((VALUE) == RCC_PLLI2SP_DIV8))
  3034. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  3035. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
  3036. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  3037. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
  3038. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\
  3039. ((VALUE) == RCC_PLLSAIP_DIV4) ||\
  3040. ((VALUE) == RCC_PLLSAIP_DIV6) ||\
  3041. ((VALUE) == RCC_PLLSAIP_DIV8))
  3042. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
  3043. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  3044. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
  3045. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
  3046. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDIVR_2) ||\
  3047. ((VALUE) == RCC_PLLSAIDIVR_4) ||\
  3048. ((VALUE) == RCC_PLLSAIDIVR_8) ||\
  3049. ((VALUE) == RCC_PLLSAIDIVR_16))
  3050. #define IS_RCC_I2SCLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SCLKSOURCE_PLLI2S) || \
  3051. ((SOURCE) == RCC_I2SCLKSOURCE_EXT))
  3052. #define IS_RCC_SDMMC1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SDMMC1CLKSOURCE_SYSCLK) || \
  3053. ((SOURCE) == RCC_SDMMC1CLKSOURCE_CLK48))
  3054. #define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_HSI) || \
  3055. ((SOURCE) == RCC_CECCLKSOURCE_LSE))
  3056. #define IS_RCC_USART1CLKSOURCE(SOURCE) \
  3057. (((SOURCE) == RCC_USART1CLKSOURCE_PCLK2) || \
  3058. ((SOURCE) == RCC_USART1CLKSOURCE_SYSCLK) || \
  3059. ((SOURCE) == RCC_USART1CLKSOURCE_LSE) || \
  3060. ((SOURCE) == RCC_USART1CLKSOURCE_HSI))
  3061. #define IS_RCC_USART2CLKSOURCE(SOURCE) \
  3062. (((SOURCE) == RCC_USART2CLKSOURCE_PCLK1) || \
  3063. ((SOURCE) == RCC_USART2CLKSOURCE_SYSCLK) || \
  3064. ((SOURCE) == RCC_USART2CLKSOURCE_LSE) || \
  3065. ((SOURCE) == RCC_USART2CLKSOURCE_HSI))
  3066. #define IS_RCC_USART3CLKSOURCE(SOURCE) \
  3067. (((SOURCE) == RCC_USART3CLKSOURCE_PCLK1) || \
  3068. ((SOURCE) == RCC_USART3CLKSOURCE_SYSCLK) || \
  3069. ((SOURCE) == RCC_USART3CLKSOURCE_LSE) || \
  3070. ((SOURCE) == RCC_USART3CLKSOURCE_HSI))
  3071. #define IS_RCC_UART4CLKSOURCE(SOURCE) \
  3072. (((SOURCE) == RCC_UART4CLKSOURCE_PCLK1) || \
  3073. ((SOURCE) == RCC_UART4CLKSOURCE_SYSCLK) || \
  3074. ((SOURCE) == RCC_UART4CLKSOURCE_LSE) || \
  3075. ((SOURCE) == RCC_UART4CLKSOURCE_HSI))
  3076. #define IS_RCC_UART5CLKSOURCE(SOURCE) \
  3077. (((SOURCE) == RCC_UART5CLKSOURCE_PCLK1) || \
  3078. ((SOURCE) == RCC_UART5CLKSOURCE_SYSCLK) || \
  3079. ((SOURCE) == RCC_UART5CLKSOURCE_LSE) || \
  3080. ((SOURCE) == RCC_UART5CLKSOURCE_HSI))
  3081. #define IS_RCC_USART6CLKSOURCE(SOURCE) \
  3082. (((SOURCE) == RCC_USART6CLKSOURCE_PCLK2) || \
  3083. ((SOURCE) == RCC_USART6CLKSOURCE_SYSCLK) || \
  3084. ((SOURCE) == RCC_USART6CLKSOURCE_LSE) || \
  3085. ((SOURCE) == RCC_USART6CLKSOURCE_HSI))
  3086. #define IS_RCC_UART7CLKSOURCE(SOURCE) \
  3087. (((SOURCE) == RCC_UART7CLKSOURCE_PCLK1) || \
  3088. ((SOURCE) == RCC_UART7CLKSOURCE_SYSCLK) || \
  3089. ((SOURCE) == RCC_UART7CLKSOURCE_LSE) || \
  3090. ((SOURCE) == RCC_UART7CLKSOURCE_HSI))
  3091. #define IS_RCC_UART8CLKSOURCE(SOURCE) \
  3092. (((SOURCE) == RCC_UART8CLKSOURCE_PCLK1) || \
  3093. ((SOURCE) == RCC_UART8CLKSOURCE_SYSCLK) || \
  3094. ((SOURCE) == RCC_UART8CLKSOURCE_LSE) || \
  3095. ((SOURCE) == RCC_UART8CLKSOURCE_HSI))
  3096. #define IS_RCC_I2C1CLKSOURCE(SOURCE) \
  3097. (((SOURCE) == RCC_I2C1CLKSOURCE_PCLK1) || \
  3098. ((SOURCE) == RCC_I2C1CLKSOURCE_SYSCLK)|| \
  3099. ((SOURCE) == RCC_I2C1CLKSOURCE_HSI))
  3100. #define IS_RCC_I2C2CLKSOURCE(SOURCE) \
  3101. (((SOURCE) == RCC_I2C2CLKSOURCE_PCLK1) || \
  3102. ((SOURCE) == RCC_I2C2CLKSOURCE_SYSCLK)|| \
  3103. ((SOURCE) == RCC_I2C2CLKSOURCE_HSI))
  3104. #define IS_RCC_I2C3CLKSOURCE(SOURCE) \
  3105. (((SOURCE) == RCC_I2C3CLKSOURCE_PCLK1) || \
  3106. ((SOURCE) == RCC_I2C3CLKSOURCE_SYSCLK)|| \
  3107. ((SOURCE) == RCC_I2C3CLKSOURCE_HSI))
  3108. #define IS_RCC_I2C4CLKSOURCE(SOURCE) \
  3109. (((SOURCE) == RCC_I2C4CLKSOURCE_PCLK1) || \
  3110. ((SOURCE) == RCC_I2C4CLKSOURCE_SYSCLK)|| \
  3111. ((SOURCE) == RCC_I2C4CLKSOURCE_HSI))
  3112. #define IS_RCC_LPTIM1CLK(SOURCE) \
  3113. (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) || \
  3114. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) || \
  3115. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) || \
  3116. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  3117. #define IS_RCC_CLK48SOURCE(SOURCE) \
  3118. (((SOURCE) == RCC_CLK48SOURCE_PLLSAIP) || \
  3119. ((SOURCE) == RCC_CLK48SOURCE_PLL))
  3120. #define IS_RCC_TIMPRES(VALUE) \
  3121. (((VALUE) == RCC_TIMPRES_DESACTIVATED) || \
  3122. ((VALUE) == RCC_TIMPRES_ACTIVATED))
  3123. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F745xx) ||\
  3124. defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F730xx) || defined (STM32F750xx)
  3125. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) || \
  3126. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) || \
  3127. ((SOURCE) == RCC_SAI1CLKSOURCE_PIN))
  3128. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) || \
  3129. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) || \
  3130. ((SOURCE) == RCC_SAI2CLKSOURCE_PIN))
  3131. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F745xx || STM32F746xx || STM32F756xx || STM32F750xx || STM32F730xx */
  3132. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  3133. #define IS_RCC_PLLR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  3134. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) || \
  3135. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) || \
  3136. ((SOURCE) == RCC_SAI1CLKSOURCE_PIN) || \
  3137. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLSRC))
  3138. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) || \
  3139. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) || \
  3140. ((SOURCE) == RCC_SAI2CLKSOURCE_PIN) || \
  3141. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLSRC))
  3142. #define IS_RCC_DFSDM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_DFSDM1CLKSOURCE_PCLK2) || \
  3143. ((SOURCE) == RCC_DFSDM1CLKSOURCE_SYSCLK))
  3144. #define IS_RCC_DFSDM1AUDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_DFSDM1AUDIOCLKSOURCE_SAI1) || \
  3145. ((SOURCE) == RCC_DFSDM1AUDIOCLKSOURCE_SAI2))
  3146. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  3147. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  3148. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  3149. #define IS_RCC_SDMMC2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SDMMC2CLKSOURCE_SYSCLK) || \
  3150. ((SOURCE) == RCC_SDMMC2CLKSOURCE_CLK48))
  3151. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  3152. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  3153. #define IS_RCC_DSIBYTELANECLKSOURCE(SOURCE) (((SOURCE) == RCC_DSICLKSOURCE_PLLR) ||\
  3154. ((SOURCE) == RCC_DSICLKSOURCE_DSIPHY))
  3155. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  3156. /**
  3157. * @}
  3158. */
  3159. /**
  3160. * @}
  3161. */
  3162. /**
  3163. * @}
  3164. */
  3165. /**
  3166. * @}
  3167. */
  3168. #ifdef __cplusplus
  3169. }
  3170. #endif
  3171. #endif /* __STM32F7xx_HAL_RCC_EX_H */