stm32f7xx_hal_rcc_ex.h 226 KB

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