stm32l4xx_hal_rcc.h 197 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_rcc.h
  4. * @author MCD Application Team
  5. * @version V1.7.2
  6. * @date 16-June-2017
  7. * @brief Header file of RCC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_RCC_H
  39. #define __STM32L4xx_HAL_RCC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32l4xx_hal_def.h"
  45. /** @addtogroup STM32L4xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup RCC
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup RCC_Exported_Types RCC 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 = 1 and Max_Data = 8 */
  66. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  67. This parameter must be a number between Min_Data = 8 and Max_Data = 86 */
  68. uint32_t PLLP; /*!< PLLP: Division factor for SAI clock.
  69. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  70. uint32_t PLLQ; /*!< PLLQ: Division factor for SDMMC1, RNG and USB clocks.
  71. This parameter must be a value of @ref RCC_PLLQ_Clock_Divider */
  72. uint32_t PLLR; /*!< PLLR: Division for the main system clock.
  73. User have to set the PLLR parameter correctly to not exceed max frequency 80MHZ.
  74. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */
  75. }RCC_PLLInitTypeDef;
  76. /**
  77. * @brief RCC Internal/External Oscillator (HSE, HSI, MSI, LSE and LSI) configuration structure definition
  78. */
  79. typedef struct
  80. {
  81. uint32_t OscillatorType; /*!< The oscillators to be configured.
  82. This parameter can be a value of @ref RCC_Oscillator_Type */
  83. uint32_t HSEState; /*!< The new state of the HSE.
  84. This parameter can be a value of @ref RCC_HSE_Config */
  85. uint32_t LSEState; /*!< The new state of the LSE.
  86. This parameter can be a value of @ref RCC_LSE_Config */
  87. uint32_t HSIState; /*!< The new state of the HSI.
  88. This parameter can be a value of @ref RCC_HSI_Config */
  89. uint32_t HSICalibrationValue; /*!< The calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT).
  90. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F on STM32L43x/STM32L44x/STM32L47x/STM32L48x devices.
  91. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F on the other devices */
  92. uint32_t LSIState; /*!< The new state of the LSI.
  93. This parameter can be a value of @ref RCC_LSI_Config */
  94. uint32_t MSIState; /*!< The new state of the MSI.
  95. This parameter can be a value of @ref RCC_MSI_Config */
  96. uint32_t MSICalibrationValue; /*!< The calibration trimming value (default is RCC_MSICALIBRATION_DEFAULT).
  97. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
  98. uint32_t MSIClockRange; /*!< The MSI frequency range.
  99. This parameter can be a value of @ref RCC_MSI_Clock_Range */
  100. uint32_t HSI48State; /*!< The new state of the HSI48 (only applicable to STM32L43x/STM32L44x/STM32L45x/STM32L46x/STM32L49x/STM32L4Ax devices).
  101. This parameter can be a value of @ref RCC_HSI48_Config */
  102. RCC_PLLInitTypeDef PLL; /*!< Main PLL structure parameters */
  103. }RCC_OscInitTypeDef;
  104. /**
  105. * @brief RCC System, AHB and APB busses clock configuration structure definition
  106. */
  107. typedef struct
  108. {
  109. uint32_t ClockType; /*!< The clock to be configured.
  110. This parameter can be a value of @ref RCC_System_Clock_Type */
  111. uint32_t SYSCLKSource; /*!< The clock source used as system clock (SYSCLK).
  112. This parameter can be a value of @ref RCC_System_Clock_Source */
  113. uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
  114. This parameter can be a value of @ref RCC_AHB_Clock_Source */
  115. uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
  116. This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */
  117. uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK).
  118. This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */
  119. }RCC_ClkInitTypeDef;
  120. /**
  121. * @}
  122. */
  123. /* Exported constants --------------------------------------------------------*/
  124. /** @defgroup RCC_Exported_Constants RCC Exported Constants
  125. * @{
  126. */
  127. /** @defgroup RCC_Timeout_Value Timeout Values
  128. * @{
  129. */
  130. #define RCC_DBP_TIMEOUT_VALUE ((uint32_t)2U) /* 2 ms (minimum Tick + 1) */
  131. #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT
  132. /**
  133. * @}
  134. */
  135. /** @defgroup RCC_Oscillator_Type Oscillator Type
  136. * @{
  137. */
  138. #define RCC_OSCILLATORTYPE_NONE ((uint32_t)0x00000000U) /*!< Oscillator configuration unchanged */
  139. #define RCC_OSCILLATORTYPE_HSE ((uint32_t)0x00000001U) /*!< HSE to configure */
  140. #define RCC_OSCILLATORTYPE_HSI ((uint32_t)0x00000002U) /*!< HSI to configure */
  141. #define RCC_OSCILLATORTYPE_LSE ((uint32_t)0x00000004U) /*!< LSE to configure */
  142. #define RCC_OSCILLATORTYPE_LSI ((uint32_t)0x00000008U) /*!< LSI to configure */
  143. #define RCC_OSCILLATORTYPE_MSI ((uint32_t)0x00000010U) /*!< MSI to configure */
  144. #if defined(RCC_HSI48_SUPPORT)
  145. #define RCC_OSCILLATORTYPE_HSI48 ((uint32_t)0x00000020U) /*!< HSI48 to configure */
  146. #endif /* RCC_HSI48_SUPPORT */
  147. /**
  148. * @}
  149. */
  150. /** @defgroup RCC_HSE_Config HSE Config
  151. * @{
  152. */
  153. #define RCC_HSE_OFF ((uint32_t)0x00000000U) /*!< HSE clock deactivation */
  154. #define RCC_HSE_ON RCC_CR_HSEON /*!< HSE clock activation */
  155. #define RCC_HSE_BYPASS ((uint32_t)(RCC_CR_HSEBYP | RCC_CR_HSEON)) /*!< External clock source for HSE clock */
  156. /**
  157. * @}
  158. */
  159. /** @defgroup RCC_LSE_Config LSE Config
  160. * @{
  161. */
  162. #define RCC_LSE_OFF ((uint32_t)0x00000000U) /*!< LSE clock deactivation */
  163. #define RCC_LSE_ON RCC_BDCR_LSEON /*!< LSE clock activation */
  164. #define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON)) /*!< External clock source for LSE clock */
  165. /**
  166. * @}
  167. */
  168. /** @defgroup RCC_HSI_Config HSI Config
  169. * @{
  170. */
  171. #define RCC_HSI_OFF ((uint32_t)0x00000000U) /*!< HSI clock deactivation */
  172. #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */
  173. #if defined(STM32L431xx) || defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx) || \
  174. defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
  175. #define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10U) /* Default HSI calibration trimming value */
  176. #else
  177. #define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x40U) /* Default HSI calibration trimming value */
  178. #endif /* STM32L431xx || STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx || */
  179. /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
  180. /**
  181. * @}
  182. */
  183. /** @defgroup RCC_LSI_Config LSI Config
  184. * @{
  185. */
  186. #define RCC_LSI_OFF ((uint32_t)0x00000000U) /*!< LSI clock deactivation */
  187. #define RCC_LSI_ON RCC_CSR_LSION /*!< LSI clock activation */
  188. /**
  189. * @}
  190. */
  191. /** @defgroup RCC_MSI_Config MSI Config
  192. * @{
  193. */
  194. #define RCC_MSI_OFF ((uint32_t)0x00000000U) /*!< MSI clock deactivation */
  195. #define RCC_MSI_ON RCC_CR_MSION /*!< MSI clock activation */
  196. #define RCC_MSICALIBRATION_DEFAULT ((uint32_t)0) /*!< Default MSI calibration trimming value */
  197. /**
  198. * @}
  199. */
  200. #if defined(RCC_HSI48_SUPPORT)
  201. /** @defgroup RCC_HSI48_Config HSI48 Config
  202. * @{
  203. */
  204. #define RCC_HSI48_OFF ((uint32_t)0x00000000U) /*!< HSI48 clock deactivation */
  205. #define RCC_HSI48_ON RCC_CRRCR_HSI48ON /*!< HSI48 clock activation */
  206. /**
  207. * @}
  208. */
  209. #else
  210. /** @defgroup RCC_HSI48_Config HSI48 Config
  211. * @{
  212. */
  213. #define RCC_HSI48_OFF ((uint32_t)0x00000000U) /*!< HSI48 clock deactivation */
  214. /**
  215. * @}
  216. */
  217. #endif /* RCC_HSI48_SUPPORT */
  218. /** @defgroup RCC_PLL_Config PLL Config
  219. * @{
  220. */
  221. #define RCC_PLL_NONE ((uint32_t)0x00000000U) /*!< PLL configuration unchanged */
  222. #define RCC_PLL_OFF ((uint32_t)0x00000001U) /*!< PLL deactivation */
  223. #define RCC_PLL_ON ((uint32_t)0x00000002U) /*!< PLL activation */
  224. /**
  225. * @}
  226. */
  227. /** @defgroup RCC_PLLP_Clock_Divider PLLP Clock Divider
  228. * @{
  229. */
  230. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  231. #define RCC_PLLP_DIV2 ((uint32_t)0x00000002U) /*!< PLLP division factor = 2 */
  232. #define RCC_PLLP_DIV3 ((uint32_t)0x00000003U) /*!< PLLP division factor = 3 */
  233. #define RCC_PLLP_DIV4 ((uint32_t)0x00000004U) /*!< PLLP division factor = 4 */
  234. #define RCC_PLLP_DIV5 ((uint32_t)0x00000005U) /*!< PLLP division factor = 5 */
  235. #define RCC_PLLP_DIV6 ((uint32_t)0x00000006U) /*!< PLLP division factor = 6 */
  236. #define RCC_PLLP_DIV7 ((uint32_t)0x00000007U) /*!< PLLP division factor = 7 */
  237. #define RCC_PLLP_DIV8 ((uint32_t)0x00000008U) /*!< PLLP division factor = 8 */
  238. #define RCC_PLLP_DIV9 ((uint32_t)0x00000009U) /*!< PLLP division factor = 9 */
  239. #define RCC_PLLP_DIV10 ((uint32_t)0x0000000AU) /*!< PLLP division factor = 10 */
  240. #define RCC_PLLP_DIV11 ((uint32_t)0x0000000BU) /*!< PLLP division factor = 11 */
  241. #define RCC_PLLP_DIV12 ((uint32_t)0x0000000CU) /*!< PLLP division factor = 12 */
  242. #define RCC_PLLP_DIV13 ((uint32_t)0x0000000DU) /*!< PLLP division factor = 13 */
  243. #define RCC_PLLP_DIV14 ((uint32_t)0x0000000EU) /*!< PLLP division factor = 14 */
  244. #define RCC_PLLP_DIV15 ((uint32_t)0x0000000FU) /*!< PLLP division factor = 15 */
  245. #define RCC_PLLP_DIV16 ((uint32_t)0x00000010U) /*!< PLLP division factor = 16 */
  246. #define RCC_PLLP_DIV17 ((uint32_t)0x00000011U) /*!< PLLP division factor = 17 */
  247. #define RCC_PLLP_DIV18 ((uint32_t)0x00000012U) /*!< PLLP division factor = 18 */
  248. #define RCC_PLLP_DIV19 ((uint32_t)0x00000013U) /*!< PLLP division factor = 19 */
  249. #define RCC_PLLP_DIV20 ((uint32_t)0x00000014U) /*!< PLLP division factor = 20 */
  250. #define RCC_PLLP_DIV21 ((uint32_t)0x00000015U) /*!< PLLP division factor = 21 */
  251. #define RCC_PLLP_DIV22 ((uint32_t)0x00000016U) /*!< PLLP division factor = 22 */
  252. #define RCC_PLLP_DIV23 ((uint32_t)0x00000017U) /*!< PLLP division factor = 23 */
  253. #define RCC_PLLP_DIV24 ((uint32_t)0x00000018U) /*!< PLLP division factor = 24 */
  254. #define RCC_PLLP_DIV25 ((uint32_t)0x00000019U) /*!< PLLP division factor = 25 */
  255. #define RCC_PLLP_DIV26 ((uint32_t)0x0000001AU) /*!< PLLP division factor = 26 */
  256. #define RCC_PLLP_DIV27 ((uint32_t)0x0000001BU) /*!< PLLP division factor = 27 */
  257. #define RCC_PLLP_DIV28 ((uint32_t)0x0000001CU) /*!< PLLP division factor = 28 */
  258. #define RCC_PLLP_DIV29 ((uint32_t)0x0000001DU) /*!< PLLP division factor = 29 */
  259. #define RCC_PLLP_DIV30 ((uint32_t)0x0000001EU) /*!< PLLP division factor = 30 */
  260. #define RCC_PLLP_DIV31 ((uint32_t)0x0000001FU) /*!< PLLP division factor = 31 */
  261. #else
  262. #define RCC_PLLP_DIV7 ((uint32_t)0x00000007U) /*!< PLLP division factor = 7 */
  263. #define RCC_PLLP_DIV17 ((uint32_t)0x00000011U) /*!< PLLP division factor = 17 */
  264. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  265. /**
  266. * @}
  267. */
  268. /** @defgroup RCC_PLLQ_Clock_Divider PLLQ Clock Divider
  269. * @{
  270. */
  271. #define RCC_PLLQ_DIV2 ((uint32_t)0x00000002U) /*!< PLLQ division factor = 2 */
  272. #define RCC_PLLQ_DIV4 ((uint32_t)0x00000004U) /*!< PLLQ division factor = 4 */
  273. #define RCC_PLLQ_DIV6 ((uint32_t)0x00000006U) /*!< PLLQ division factor = 6 */
  274. #define RCC_PLLQ_DIV8 ((uint32_t)0x00000008U) /*!< PLLQ division factor = 8 */
  275. /**
  276. * @}
  277. */
  278. /** @defgroup RCC_PLLR_Clock_Divider PLLR Clock Divider
  279. * @{
  280. */
  281. #define RCC_PLLR_DIV2 ((uint32_t)0x00000002U) /*!< PLLR division factor = 2 */
  282. #define RCC_PLLR_DIV4 ((uint32_t)0x00000004U) /*!< PLLR division factor = 4 */
  283. #define RCC_PLLR_DIV6 ((uint32_t)0x00000006U) /*!< PLLR division factor = 6 */
  284. #define RCC_PLLR_DIV8 ((uint32_t)0x00000008U) /*!< PLLR division factor = 8 */
  285. /**
  286. * @}
  287. */
  288. /** @defgroup RCC_PLL_Clock_Source PLL Clock Source
  289. * @{
  290. */
  291. #define RCC_PLLSOURCE_NONE ((uint32_t)0x00000000U) /*!< No clock selected as PLL entry clock source */
  292. #define RCC_PLLSOURCE_MSI RCC_PLLCFGR_PLLSRC_MSI /*!< MSI clock selected as PLL entry clock source */
  293. #define RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI /*!< HSI clock selected as PLL entry clock source */
  294. #define RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE /*!< HSE clock selected as PLL entry clock source */
  295. /**
  296. * @}
  297. */
  298. /** @defgroup RCC_PLL_Clock_Output PLL Clock Output
  299. * @{
  300. */
  301. #if defined(RCC_PLLSAI2_SUPPORT)
  302. #define RCC_PLL_SAI3CLK RCC_PLLCFGR_PLLPEN /*!< PLLSAI3CLK selection from main PLL (for devices with PLLSAI2) */
  303. #else
  304. #define RCC_PLL_SAI2CLK RCC_PLLCFGR_PLLPEN /*!< PLLSAI2CLK selection from main PLL (for devices without PLLSAI2) */
  305. #endif /* RCC_PLLSAI2_SUPPORT */
  306. #define RCC_PLL_48M1CLK RCC_PLLCFGR_PLLQEN /*!< PLL48M1CLK selection from main PLL */
  307. #define RCC_PLL_SYSCLK RCC_PLLCFGR_PLLREN /*!< PLLCLK selection from main PLL */
  308. /**
  309. * @}
  310. */
  311. /** @defgroup RCC_PLLSAI1_Clock_Output PLLSAI1 Clock Output
  312. * @{
  313. */
  314. #define RCC_PLLSAI1_SAI1CLK RCC_PLLSAI1CFGR_PLLSAI1PEN /*!< PLLSAI1CLK selection from PLLSAI1 */
  315. #define RCC_PLLSAI1_48M2CLK RCC_PLLSAI1CFGR_PLLSAI1QEN /*!< PLL48M2CLK selection from PLLSAI1 */
  316. #define RCC_PLLSAI1_ADC1CLK RCC_PLLSAI1CFGR_PLLSAI1REN /*!< PLLADC1CLK selection from PLLSAI1 */
  317. /**
  318. * @}
  319. */
  320. #if defined(RCC_PLLSAI2_SUPPORT)
  321. /** @defgroup RCC_PLLSAI2_Clock_Output PLLSAI2 Clock Output
  322. * @{
  323. */
  324. #define RCC_PLLSAI2_SAI2CLK RCC_PLLSAI2CFGR_PLLSAI2PEN /*!< PLLSAI2CLK selection from PLLSAI2 */
  325. #define RCC_PLLSAI2_ADC2CLK RCC_PLLSAI2CFGR_PLLSAI2REN /*!< PLLADC2CLK selection from PLLSAI2 */
  326. /**
  327. * @}
  328. */
  329. #endif /* RCC_PLLSAI2_SUPPORT */
  330. /** @defgroup RCC_MSI_Clock_Range MSI Clock Range
  331. * @{
  332. */
  333. #define RCC_MSIRANGE_0 RCC_CR_MSIRANGE_0 /*!< MSI = 100 KHz */
  334. #define RCC_MSIRANGE_1 RCC_CR_MSIRANGE_1 /*!< MSI = 200 KHz */
  335. #define RCC_MSIRANGE_2 RCC_CR_MSIRANGE_2 /*!< MSI = 400 KHz */
  336. #define RCC_MSIRANGE_3 RCC_CR_MSIRANGE_3 /*!< MSI = 800 KHz */
  337. #define RCC_MSIRANGE_4 RCC_CR_MSIRANGE_4 /*!< MSI = 1 MHz */
  338. #define RCC_MSIRANGE_5 RCC_CR_MSIRANGE_5 /*!< MSI = 2 MHz */
  339. #define RCC_MSIRANGE_6 RCC_CR_MSIRANGE_6 /*!< MSI = 4 MHz */
  340. #define RCC_MSIRANGE_7 RCC_CR_MSIRANGE_7 /*!< MSI = 8 MHz */
  341. #define RCC_MSIRANGE_8 RCC_CR_MSIRANGE_8 /*!< MSI = 16 MHz */
  342. #define RCC_MSIRANGE_9 RCC_CR_MSIRANGE_9 /*!< MSI = 24 MHz */
  343. #define RCC_MSIRANGE_10 RCC_CR_MSIRANGE_10 /*!< MSI = 32 MHz */
  344. #define RCC_MSIRANGE_11 RCC_CR_MSIRANGE_11 /*!< MSI = 48 MHz */
  345. /**
  346. * @}
  347. */
  348. /** @defgroup RCC_System_Clock_Type System Clock Type
  349. * @{
  350. */
  351. #define RCC_CLOCKTYPE_SYSCLK ((uint32_t)0x00000001U) /*!< SYSCLK to configure */
  352. #define RCC_CLOCKTYPE_HCLK ((uint32_t)0x00000002U) /*!< HCLK to configure */
  353. #define RCC_CLOCKTYPE_PCLK1 ((uint32_t)0x00000004U) /*!< PCLK1 to configure */
  354. #define RCC_CLOCKTYPE_PCLK2 ((uint32_t)0x00000008U) /*!< PCLK2 to configure */
  355. /**
  356. * @}
  357. */
  358. /** @defgroup RCC_System_Clock_Source System Clock Source
  359. * @{
  360. */
  361. #define RCC_SYSCLKSOURCE_MSI RCC_CFGR_SW_MSI /*!< MSI selection as system clock */
  362. #define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selection as system clock */
  363. #define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selection as system clock */
  364. #define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL /*!< PLL selection as system clock */
  365. /**
  366. * @}
  367. */
  368. /** @defgroup RCC_System_Clock_Source_Status System Clock Source Status
  369. * @{
  370. */
  371. #define RCC_SYSCLKSOURCE_STATUS_MSI RCC_CFGR_SWS_MSI /*!< MSI used as system clock */
  372. #define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
  373. #define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
  374. #define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */
  375. /**
  376. * @}
  377. */
  378. /** @defgroup RCC_AHB_Clock_Source AHB Clock Source
  379. * @{
  380. */
  381. #define RCC_SYSCLK_DIV1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */
  382. #define RCC_SYSCLK_DIV2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */
  383. #define RCC_SYSCLK_DIV4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */
  384. #define RCC_SYSCLK_DIV8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */
  385. #define RCC_SYSCLK_DIV16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */
  386. #define RCC_SYSCLK_DIV64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */
  387. #define RCC_SYSCLK_DIV128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
  388. #define RCC_SYSCLK_DIV256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
  389. #define RCC_SYSCLK_DIV512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
  390. /**
  391. * @}
  392. */
  393. /** @defgroup RCC_APB1_APB2_Clock_Source APB1 APB2 Clock Source
  394. * @{
  395. */
  396. #define RCC_HCLK_DIV1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */
  397. #define RCC_HCLK_DIV2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */
  398. #define RCC_HCLK_DIV4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */
  399. #define RCC_HCLK_DIV8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */
  400. #define RCC_HCLK_DIV16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */
  401. /**
  402. * @}
  403. */
  404. /** @defgroup RCC_RTC_Clock_Source RTC Clock Source
  405. * @{
  406. */
  407. #define RCC_RTCCLKSOURCE_NO_CLK ((uint32_t)0x00000000U) /*!< No clock used as RTC clock */
  408. #define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */
  409. #define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */
  410. #define RCC_RTCCLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 32 used as RTC clock */
  411. /**
  412. * @}
  413. */
  414. /** @defgroup RCC_MCO_Index MCO Index
  415. * @{
  416. */
  417. #define RCC_MCO1 ((uint32_t)0x00000000U)
  418. #define RCC_MCO RCC_MCO1 /*!< MCO1 to be compliant with other families with 2 MCOs*/
  419. /**
  420. * @}
  421. */
  422. /** @defgroup RCC_MCO1_Clock_Source MCO1 Clock Source
  423. * @{
  424. */
  425. #define RCC_MCO1SOURCE_NOCLOCK ((uint32_t)0x00000000U) /*!< MCO1 output disabled, no clock on MCO1 */
  426. #define RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCOSEL_0 /*!< SYSCLK selection as MCO1 source */
  427. #define RCC_MCO1SOURCE_MSI RCC_CFGR_MCOSEL_1 /*!< MSI selection as MCO1 source */
  428. #define RCC_MCO1SOURCE_HSI (RCC_CFGR_MCOSEL_0| RCC_CFGR_MCOSEL_1) /*!< HSI selection as MCO1 source */
  429. #define RCC_MCO1SOURCE_HSE RCC_CFGR_MCOSEL_2 /*!< HSE selection as MCO1 source */
  430. #define RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_2) /*!< PLLCLK selection as MCO1 source */
  431. #define RCC_MCO1SOURCE_LSI (RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSI selection as MCO1 source */
  432. #define RCC_MCO1SOURCE_LSE (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSE selection as MCO1 source */
  433. #if defined(RCC_HSI48_SUPPORT)
  434. #define RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCOSEL_3 /*!< HSI48 selection as MCO1 source (STM32L43x/STM32L44x devices) */
  435. #endif /* RCC_HSI48_SUPPORT */
  436. /**
  437. * @}
  438. */
  439. /** @defgroup RCC_MCOx_Clock_Prescaler MCO1 Clock Prescaler
  440. * @{
  441. */
  442. #define RCC_MCODIV_1 RCC_CFGR_MCOPRE_DIV1 /*!< MCO not divided */
  443. #define RCC_MCODIV_2 RCC_CFGR_MCOPRE_DIV2 /*!< MCO divided by 2 */
  444. #define RCC_MCODIV_4 RCC_CFGR_MCOPRE_DIV4 /*!< MCO divided by 4 */
  445. #define RCC_MCODIV_8 RCC_CFGR_MCOPRE_DIV8 /*!< MCO divided by 8 */
  446. #define RCC_MCODIV_16 RCC_CFGR_MCOPRE_DIV16 /*!< MCO divided by 16 */
  447. /**
  448. * @}
  449. */
  450. /** @defgroup RCC_Interrupt Interrupts
  451. * @{
  452. */
  453. #define RCC_IT_LSIRDY RCC_CIFR_LSIRDYF /*!< LSI Ready Interrupt flag */
  454. #define RCC_IT_LSERDY RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
  455. #define RCC_IT_MSIRDY RCC_CIFR_MSIRDYF /*!< MSI Ready Interrupt flag */
  456. #define RCC_IT_HSIRDY RCC_CIFR_HSIRDYF /*!< HSI16 Ready Interrupt flag */
  457. #define RCC_IT_HSERDY RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
  458. #define RCC_IT_PLLRDY RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
  459. #define RCC_IT_PLLSAI1RDY RCC_CIFR_PLLSAI1RDYF /*!< PLLSAI1 Ready Interrupt flag */
  460. #if defined(RCC_PLLSAI2_SUPPORT)
  461. #define RCC_IT_PLLSAI2RDY RCC_CIFR_PLLSAI2RDYF /*!< PLLSAI2 Ready Interrupt flag */
  462. #endif /* RCC_PLLSAI2_SUPPORT */
  463. #define RCC_IT_CSS RCC_CIFR_CSSF /*!< Clock Security System Interrupt flag */
  464. #define RCC_IT_LSECSS RCC_CIFR_LSECSSF /*!< LSE Clock Security System Interrupt flag */
  465. #if defined(RCC_HSI48_SUPPORT)
  466. #define RCC_IT_HSI48RDY RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
  467. #endif /* RCC_HSI48_SUPPORT */
  468. /**
  469. * @}
  470. */
  471. /** @defgroup RCC_Flag Flags
  472. * Elements values convention: XXXYYYYYb
  473. * - YYYYY : Flag position in the register
  474. * - XXX : Register index
  475. * - 001: CR register
  476. * - 010: BDCR register
  477. * - 011: CSR register
  478. * - 100: CRRCR register
  479. * @{
  480. */
  481. /* Flags in the CR register */
  482. #define RCC_FLAG_MSIRDY ((uint32_t)((CR_REG_INDEX << 5U) | RCC_CR_MSIRDY_Pos)) /*!< MSI Ready flag */
  483. #define RCC_FLAG_HSIRDY ((uint32_t)((CR_REG_INDEX << 5U) | RCC_CR_HSIRDY_Pos)) /*!< HSI Ready flag */
  484. #define RCC_FLAG_HSERDY ((uint32_t)((CR_REG_INDEX << 5U) | RCC_CR_HSERDY_Pos)) /*!< HSE Ready flag */
  485. #define RCC_FLAG_PLLRDY ((uint32_t)((CR_REG_INDEX << 5U) | RCC_CR_PLLRDY_Pos)) /*!< PLL Ready flag */
  486. #define RCC_FLAG_PLLSAI1RDY ((uint32_t)((CR_REG_INDEX << 5U) | RCC_CR_PLLSAI1RDY_Pos)) /*!< PLLSAI1 Ready flag */
  487. #if defined(RCC_PLLSAI2_SUPPORT)
  488. #define RCC_FLAG_PLLSAI2RDY ((uint32_t)((CR_REG_INDEX << 5U) | RCC_CR_PLLSAI2RDY_Pos)) /*!< PLLSAI2 Ready flag */
  489. #endif /* RCC_PLLSAI2_SUPPORT */
  490. /* Flags in the BDCR register */
  491. #define RCC_FLAG_LSERDY ((uint32_t)((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSERDY_Pos)) /*!< LSE Ready flag */
  492. #define RCC_FLAG_LSECSSD ((uint32_t)((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSECSSD_Pos)) /*!< LSE Clock Security System Interrupt flag */
  493. /* Flags in the CSR register */
  494. #define RCC_FLAG_LSIRDY ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LSIRDY_Pos)) /*!< LSI Ready flag */
  495. #define RCC_FLAG_RMVF ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_RMVF_Pos)) /*!< Remove reset flag */
  496. #define RCC_FLAG_FWRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_FWRSTF_Pos)) /*!< Firewall reset flag */
  497. #define RCC_FLAG_OBLRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_OBLRSTF_Pos)) /*!< Option Byte Loader reset flag */
  498. #define RCC_FLAG_PINRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PINRSTF_Pos)) /*!< PIN reset flag */
  499. #define RCC_FLAG_BORRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_BORRSTF_Pos)) /*!< BOR reset flag */
  500. #define RCC_FLAG_SFTRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_SFTRSTF_Pos)) /*!< Software Reset flag */
  501. #define RCC_FLAG_IWDGRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_IWDGRSTF_Pos)) /*!< Independent Watchdog reset flag */
  502. #define RCC_FLAG_WWDGRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_WWDGRSTF_Pos)) /*!< Window watchdog reset flag */
  503. #define RCC_FLAG_LPWRRST ((uint32_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LPWRRSTF_Pos)) /*!< Low-Power reset flag */
  504. #if defined(RCC_HSI48_SUPPORT)
  505. /* Flags in the CRRCR register */
  506. #define RCC_FLAG_HSI48RDY ((uint32_t)((CRRCR_REG_INDEX << 5U) | RCC_CRRCR_HSI48RDY_Pos)) /*!< HSI48 Ready flag */
  507. #endif /* RCC_HSI48_SUPPORT */
  508. /**
  509. * @}
  510. */
  511. /** @defgroup RCC_LSEDrive_Config LSE Drive Config
  512. * @{
  513. */
  514. #define RCC_LSEDRIVE_LOW ((uint32_t)0x00000000U) /*!< LSE low drive capability */
  515. #define RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< LSE medium low drive capability */
  516. #define RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< LSE medium high drive capability */
  517. #define RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< LSE high drive capability */
  518. /**
  519. * @}
  520. */
  521. /** @defgroup RCC_Stop_WakeUpClock Wake-Up from STOP Clock
  522. * @{
  523. */
  524. #define RCC_STOP_WAKEUPCLOCK_MSI ((uint32_t)0x00000000U) /*!< MSI selection after wake-up from STOP */
  525. #define RCC_STOP_WAKEUPCLOCK_HSI RCC_CFGR_STOPWUCK /*!< HSI selection after wake-up from STOP */
  526. /**
  527. * @}
  528. */
  529. /**
  530. * @}
  531. */
  532. /* Exported macros -----------------------------------------------------------*/
  533. /** @defgroup RCC_Exported_Macros RCC Exported Macros
  534. * @{
  535. */
  536. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  537. * @brief Enable or disable the AHB1 peripheral clock.
  538. * @note After reset, the peripheral clock (used for registers read/write access)
  539. * is disabled and the application software has to enable this clock before
  540. * using it.
  541. * @{
  542. */
  543. #define __HAL_RCC_DMA1_CLK_ENABLE() do { \
  544. __IO uint32_t tmpreg; \
  545. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN); \
  546. /* Delay after an RCC peripheral clock enabling */ \
  547. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN); \
  548. UNUSED(tmpreg); \
  549. } while(0)
  550. #define __HAL_RCC_DMA2_CLK_ENABLE() do { \
  551. __IO uint32_t tmpreg; \
  552. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN); \
  553. /* Delay after an RCC peripheral clock enabling */ \
  554. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN); \
  555. UNUSED(tmpreg); \
  556. } while(0)
  557. #define __HAL_RCC_FLASH_CLK_ENABLE() do { \
  558. __IO uint32_t tmpreg; \
  559. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN); \
  560. /* Delay after an RCC peripheral clock enabling */ \
  561. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN); \
  562. UNUSED(tmpreg); \
  563. } while(0)
  564. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  565. __IO uint32_t tmpreg; \
  566. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN); \
  567. /* Delay after an RCC peripheral clock enabling */ \
  568. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN); \
  569. UNUSED(tmpreg); \
  570. } while(0)
  571. #define __HAL_RCC_TSC_CLK_ENABLE() do { \
  572. __IO uint32_t tmpreg; \
  573. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN); \
  574. /* Delay after an RCC peripheral clock enabling */ \
  575. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN); \
  576. UNUSED(tmpreg); \
  577. } while(0)
  578. #if defined(DMA2D)
  579. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  580. __IO uint32_t tmpreg; \
  581. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN); \
  582. /* Delay after an RCC peripheral clock enabling */ \
  583. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN); \
  584. UNUSED(tmpreg); \
  585. } while(0)
  586. #endif /* DMA2D */
  587. #define __HAL_RCC_DMA1_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN)
  588. #define __HAL_RCC_DMA2_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN)
  589. #define __HAL_RCC_FLASH_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN)
  590. #define __HAL_RCC_CRC_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN)
  591. #define __HAL_RCC_TSC_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN)
  592. #if defined(DMA2D)
  593. #define __HAL_RCC_DMA2D_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN)
  594. #endif /* DMA2D */
  595. /**
  596. * @}
  597. */
  598. /** @defgroup RCC_AHB2_Peripheral_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  599. * @brief Enable or disable the AHB2 peripheral clock.
  600. * @note After reset, the peripheral clock (used for registers read/write access)
  601. * is disabled and the application software has to enable this clock before
  602. * using it.
  603. * @{
  604. */
  605. #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
  606. __IO uint32_t tmpreg; \
  607. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN); \
  608. /* Delay after an RCC peripheral clock enabling */ \
  609. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN); \
  610. UNUSED(tmpreg); \
  611. } while(0)
  612. #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
  613. __IO uint32_t tmpreg; \
  614. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN); \
  615. /* Delay after an RCC peripheral clock enabling */ \
  616. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN); \
  617. UNUSED(tmpreg); \
  618. } while(0)
  619. #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
  620. __IO uint32_t tmpreg; \
  621. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN); \
  622. /* Delay after an RCC peripheral clock enabling */ \
  623. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN); \
  624. UNUSED(tmpreg); \
  625. } while(0)
  626. #if defined(GPIOD)
  627. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  628. __IO uint32_t tmpreg; \
  629. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN); \
  630. /* Delay after an RCC peripheral clock enabling */ \
  631. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN); \
  632. UNUSED(tmpreg); \
  633. } while(0)
  634. #endif /* GPIOD */
  635. #if defined(GPIOE)
  636. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  637. __IO uint32_t tmpreg; \
  638. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN); \
  639. /* Delay after an RCC peripheral clock enabling */ \
  640. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN); \
  641. UNUSED(tmpreg); \
  642. } while(0)
  643. #endif /* GPIOE */
  644. #if defined(GPIOF)
  645. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  646. __IO uint32_t tmpreg; \
  647. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN); \
  648. /* Delay after an RCC peripheral clock enabling */ \
  649. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN); \
  650. UNUSED(tmpreg); \
  651. } while(0)
  652. #endif /* GPIOF */
  653. #if defined(GPIOG)
  654. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  655. __IO uint32_t tmpreg; \
  656. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN); \
  657. /* Delay after an RCC peripheral clock enabling */ \
  658. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN); \
  659. UNUSED(tmpreg); \
  660. } while(0)
  661. #endif /* GPIOG */
  662. #define __HAL_RCC_GPIOH_CLK_ENABLE() do { \
  663. __IO uint32_t tmpreg; \
  664. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN); \
  665. /* Delay after an RCC peripheral clock enabling */ \
  666. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN); \
  667. UNUSED(tmpreg); \
  668. } while(0)
  669. #if defined(GPIOI)
  670. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  671. __IO uint32_t tmpreg; \
  672. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN); \
  673. /* Delay after an RCC peripheral clock enabling */ \
  674. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN); \
  675. UNUSED(tmpreg); \
  676. } while(0)
  677. #endif /* GPIOI */
  678. #if defined(USB_OTG_FS)
  679. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \
  680. __IO uint32_t tmpreg; \
  681. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN); \
  682. /* Delay after an RCC peripheral clock enabling */ \
  683. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN); \
  684. UNUSED(tmpreg); \
  685. } while(0)
  686. #endif /* USB_OTG_FS */
  687. #define __HAL_RCC_ADC_CLK_ENABLE() do { \
  688. __IO uint32_t tmpreg; \
  689. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN); \
  690. /* Delay after an RCC peripheral clock enabling */ \
  691. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN); \
  692. UNUSED(tmpreg); \
  693. } while(0)
  694. #if defined(DCMI)
  695. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  696. __IO uint32_t tmpreg; \
  697. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN); \
  698. /* Delay after an RCC peripheral clock enabling */ \
  699. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN); \
  700. UNUSED(tmpreg); \
  701. } while(0)
  702. #endif /* DCMI */
  703. #if defined(AES)
  704. #define __HAL_RCC_AES_CLK_ENABLE() do { \
  705. __IO uint32_t tmpreg; \
  706. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN); \
  707. /* Delay after an RCC peripheral clock enabling */ \
  708. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN); \
  709. UNUSED(tmpreg); \
  710. } while(0)
  711. #endif /* AES */
  712. #if defined(HASH)
  713. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  714. __IO uint32_t tmpreg; \
  715. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN); \
  716. /* Delay after an RCC peripheral clock enabling */ \
  717. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN); \
  718. UNUSED(tmpreg); \
  719. } while(0)
  720. #endif /* HASH */
  721. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  722. __IO uint32_t tmpreg; \
  723. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN); \
  724. /* Delay after an RCC peripheral clock enabling */ \
  725. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN); \
  726. UNUSED(tmpreg); \
  727. } while(0)
  728. #define __HAL_RCC_GPIOA_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN)
  729. #define __HAL_RCC_GPIOB_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN)
  730. #define __HAL_RCC_GPIOC_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN)
  731. #if defined(GPIOD)
  732. #define __HAL_RCC_GPIOD_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN)
  733. #endif /* GPIOD */
  734. #if defined(GPIOE)
  735. #define __HAL_RCC_GPIOE_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN)
  736. #endif /* GPIOE */
  737. #if defined(GPIOF)
  738. #define __HAL_RCC_GPIOF_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN)
  739. #endif /* GPIOF */
  740. #if defined(GPIOG)
  741. #define __HAL_RCC_GPIOG_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN)
  742. #endif /* GPIOG */
  743. #define __HAL_RCC_GPIOH_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN)
  744. #if defined(GPIOI)
  745. #define __HAL_RCC_GPIOI_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN)
  746. #endif /* GPIOI */
  747. #if defined(USB_OTG_FS)
  748. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);
  749. #endif /* USB_OTG_FS */
  750. #define __HAL_RCC_ADC_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN)
  751. #if defined(DCMI)
  752. #define __HAL_RCC_DCMI_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN)
  753. #endif /* DCMI */
  754. #if defined(AES)
  755. #define __HAL_RCC_AES_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);
  756. #endif /* AES */
  757. #if defined(HASH)
  758. #define __HAL_RCC_HASH_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN)
  759. #endif /* HASH */
  760. #define __HAL_RCC_RNG_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN)
  761. /**
  762. * @}
  763. */
  764. /** @defgroup RCC_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  765. * @brief Enable or disable the AHB3 peripheral clock.
  766. * @note After reset, the peripheral clock (used for registers read/write access)
  767. * is disabled and the application software has to enable this clock before
  768. * using it.
  769. * @{
  770. */
  771. #if defined(FMC_BANK1)
  772. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  773. __IO uint32_t tmpreg; \
  774. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); \
  775. /* Delay after an RCC peripheral clock enabling */ \
  776. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); \
  777. UNUSED(tmpreg); \
  778. } while(0)
  779. #endif /* FMC_BANK1 */
  780. #if defined(QUADSPI)
  781. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  782. __IO uint32_t tmpreg; \
  783. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN); \
  784. /* Delay after an RCC peripheral clock enabling */ \
  785. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN); \
  786. UNUSED(tmpreg); \
  787. } while(0)
  788. #endif /* QUADSPI */
  789. #if defined(FMC_BANK1)
  790. #define __HAL_RCC_FMC_CLK_DISABLE() CLEAR_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN)
  791. #endif /* FMC_BANK1 */
  792. #if defined(QUADSPI)
  793. #define __HAL_RCC_QSPI_CLK_DISABLE() CLEAR_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN)
  794. #endif /* QUADSPI */
  795. /**
  796. * @}
  797. */
  798. /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  799. * @brief Enable or disable the APB1 peripheral clock.
  800. * @note After reset, the peripheral clock (used for registers read/write access)
  801. * is disabled and the application software has to enable this clock before
  802. * using it.
  803. * @{
  804. */
  805. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  806. __IO uint32_t tmpreg; \
  807. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN); \
  808. /* Delay after an RCC peripheral clock enabling */ \
  809. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN); \
  810. UNUSED(tmpreg); \
  811. } while(0)
  812. #if defined(TIM3)
  813. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  814. __IO uint32_t tmpreg; \
  815. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN); \
  816. /* Delay after an RCC peripheral clock enabling */ \
  817. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN); \
  818. UNUSED(tmpreg); \
  819. } while(0)
  820. #endif /* TIM3 */
  821. #if defined(TIM4)
  822. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  823. __IO uint32_t tmpreg; \
  824. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN); \
  825. /* Delay after an RCC peripheral clock enabling */ \
  826. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN); \
  827. UNUSED(tmpreg); \
  828. } while(0)
  829. #endif /* TIM4 */
  830. #if defined(TIM5)
  831. #define __HAL_RCC_TIM5_CLK_ENABLE() do { \
  832. __IO uint32_t tmpreg; \
  833. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN); \
  834. /* Delay after an RCC peripheral clock enabling */ \
  835. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN); \
  836. UNUSED(tmpreg); \
  837. } while(0)
  838. #endif /* TIM5 */
  839. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  840. __IO uint32_t tmpreg; \
  841. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN); \
  842. /* Delay after an RCC peripheral clock enabling */ \
  843. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN); \
  844. UNUSED(tmpreg); \
  845. } while(0)
  846. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  847. __IO uint32_t tmpreg; \
  848. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN); \
  849. /* Delay after an RCC peripheral clock enabling */ \
  850. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN); \
  851. UNUSED(tmpreg); \
  852. } while(0)
  853. #if defined(LCD)
  854. #define __HAL_RCC_LCD_CLK_ENABLE() do { \
  855. __IO uint32_t tmpreg; \
  856. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN); \
  857. /* Delay after an RCC peripheral clock enabling */ \
  858. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN); \
  859. UNUSED(tmpreg); \
  860. } while(0)
  861. #endif /* LCD */
  862. #if defined(RCC_APB1ENR1_RTCAPBEN)
  863. #define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \
  864. __IO uint32_t tmpreg; \
  865. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN); \
  866. /* Delay after an RCC peripheral clock enabling */ \
  867. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN); \
  868. UNUSED(tmpreg); \
  869. } while(0)
  870. #endif /* RCC_APB1ENR1_RTCAPBEN */
  871. #define __HAL_RCC_WWDG_CLK_ENABLE() do { \
  872. __IO uint32_t tmpreg; \
  873. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN); \
  874. /* Delay after an RCC peripheral clock enabling */ \
  875. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN); \
  876. UNUSED(tmpreg); \
  877. } while(0)
  878. #if defined(SPI2)
  879. #define __HAL_RCC_SPI2_CLK_ENABLE() do { \
  880. __IO uint32_t tmpreg; \
  881. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN); \
  882. /* Delay after an RCC peripheral clock enabling */ \
  883. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN); \
  884. UNUSED(tmpreg); \
  885. } while(0)
  886. #endif /* SPI2 */
  887. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  888. __IO uint32_t tmpreg; \
  889. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN); \
  890. /* Delay after an RCC peripheral clock enabling */ \
  891. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN); \
  892. UNUSED(tmpreg); \
  893. } while(0)
  894. #define __HAL_RCC_USART2_CLK_ENABLE() do { \
  895. __IO uint32_t tmpreg; \
  896. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN); \
  897. /* Delay after an RCC peripheral clock enabling */ \
  898. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN); \
  899. UNUSED(tmpreg); \
  900. } while(0)
  901. #if defined(USART3)
  902. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  903. __IO uint32_t tmpreg; \
  904. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN); \
  905. /* Delay after an RCC peripheral clock enabling */ \
  906. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN); \
  907. UNUSED(tmpreg); \
  908. } while(0)
  909. #endif /* USART3 */
  910. #if defined(UART4)
  911. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  912. __IO uint32_t tmpreg; \
  913. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN); \
  914. /* Delay after an RCC peripheral clock enabling */ \
  915. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN); \
  916. UNUSED(tmpreg); \
  917. } while(0)
  918. #endif /* UART4 */
  919. #if defined(UART5)
  920. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  921. __IO uint32_t tmpreg; \
  922. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN); \
  923. /* Delay after an RCC peripheral clock enabling */ \
  924. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN); \
  925. UNUSED(tmpreg); \
  926. } while(0)
  927. #endif /* UART5 */
  928. #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
  929. __IO uint32_t tmpreg; \
  930. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN); \
  931. /* Delay after an RCC peripheral clock enabling */ \
  932. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN); \
  933. UNUSED(tmpreg); \
  934. } while(0)
  935. #if defined(I2C2)
  936. #define __HAL_RCC_I2C2_CLK_ENABLE() do { \
  937. __IO uint32_t tmpreg; \
  938. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN); \
  939. /* Delay after an RCC peripheral clock enabling */ \
  940. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN); \
  941. UNUSED(tmpreg); \
  942. } while(0)
  943. #endif /* I2C2 */
  944. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  945. __IO uint32_t tmpreg; \
  946. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN); \
  947. /* Delay after an RCC peripheral clock enabling */ \
  948. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN); \
  949. UNUSED(tmpreg); \
  950. } while(0)
  951. #if defined(I2C4)
  952. #define __HAL_RCC_I2C4_CLK_ENABLE() do { \
  953. __IO uint32_t tmpreg; \
  954. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN); \
  955. /* Delay after an RCC peripheral clock enabling */ \
  956. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN); \
  957. UNUSED(tmpreg); \
  958. } while(0)
  959. #endif /* I2C4 */
  960. #if defined(CRS)
  961. #define __HAL_RCC_CRS_CLK_ENABLE() do { \
  962. __IO uint32_t tmpreg; \
  963. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN); \
  964. /* Delay after an RCC peripheral clock enabling */ \
  965. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN); \
  966. UNUSED(tmpreg); \
  967. } while(0)
  968. #endif /* CRS */
  969. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  970. __IO uint32_t tmpreg; \
  971. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN); \
  972. /* Delay after an RCC peripheral clock enabling */ \
  973. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN); \
  974. UNUSED(tmpreg); \
  975. } while(0)
  976. #if defined(CAN2)
  977. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  978. __IO uint32_t tmpreg; \
  979. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN); \
  980. /* Delay after an RCC peripheral clock enabling */ \
  981. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN); \
  982. UNUSED(tmpreg); \
  983. } while(0)
  984. #endif /* CAN2 */
  985. #if defined(USB)
  986. #define __HAL_RCC_USB_CLK_ENABLE() do { \
  987. __IO uint32_t tmpreg; \
  988. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN); \
  989. /* Delay after an RCC peripheral clock enabling */ \
  990. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN); \
  991. UNUSED(tmpreg); \
  992. } while(0)
  993. #endif /* USB */
  994. #define __HAL_RCC_PWR_CLK_ENABLE() do { \
  995. __IO uint32_t tmpreg; \
  996. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN); \
  997. /* Delay after an RCC peripheral clock enabling */ \
  998. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN); \
  999. UNUSED(tmpreg); \
  1000. } while(0)
  1001. #define __HAL_RCC_DAC1_CLK_ENABLE() do { \
  1002. __IO uint32_t tmpreg; \
  1003. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN); \
  1004. /* Delay after an RCC peripheral clock enabling */ \
  1005. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN); \
  1006. UNUSED(tmpreg); \
  1007. } while(0)
  1008. #define __HAL_RCC_OPAMP_CLK_ENABLE() do { \
  1009. __IO uint32_t tmpreg; \
  1010. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN); \
  1011. /* Delay after an RCC peripheral clock enabling */ \
  1012. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN); \
  1013. UNUSED(tmpreg); \
  1014. } while(0)
  1015. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  1016. __IO uint32_t tmpreg; \
  1017. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN); \
  1018. /* Delay after an RCC peripheral clock enabling */ \
  1019. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN); \
  1020. UNUSED(tmpreg); \
  1021. } while(0)
  1022. #define __HAL_RCC_LPUART1_CLK_ENABLE() do { \
  1023. __IO uint32_t tmpreg; \
  1024. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN); \
  1025. /* Delay after an RCC peripheral clock enabling */ \
  1026. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN); \
  1027. UNUSED(tmpreg); \
  1028. } while(0)
  1029. #if defined(SWPMI1)
  1030. #define __HAL_RCC_SWPMI1_CLK_ENABLE() do { \
  1031. __IO uint32_t tmpreg; \
  1032. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN); \
  1033. /* Delay after an RCC peripheral clock enabling */ \
  1034. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN); \
  1035. UNUSED(tmpreg); \
  1036. } while(0)
  1037. #endif /* SWPMI1 */
  1038. #define __HAL_RCC_LPTIM2_CLK_ENABLE() do { \
  1039. __IO uint32_t tmpreg; \
  1040. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN); \
  1041. /* Delay after an RCC peripheral clock enabling */ \
  1042. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN); \
  1043. UNUSED(tmpreg); \
  1044. } while(0)
  1045. #define __HAL_RCC_TIM2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN)
  1046. #if defined(TIM3)
  1047. #define __HAL_RCC_TIM3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN)
  1048. #endif /* TIM3 */
  1049. #if defined(TIM4)
  1050. #define __HAL_RCC_TIM4_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN)
  1051. #endif /* TIM4 */
  1052. #if defined(TIM5)
  1053. #define __HAL_RCC_TIM5_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN)
  1054. #endif /* TIM5 */
  1055. #define __HAL_RCC_TIM6_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN)
  1056. #define __HAL_RCC_TIM7_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN)
  1057. #if defined(LCD)
  1058. #define __HAL_RCC_LCD_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN);
  1059. #endif /* LCD */
  1060. #if defined(RCC_APB1ENR1_RTCAPBEN)
  1061. #define __HAL_RCC_RTCAPB_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN);
  1062. #endif /* RCC_APB1ENR1_RTCAPBEN */
  1063. #if defined(SPI2)
  1064. #define __HAL_RCC_SPI2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN)
  1065. #endif /* SPI2 */
  1066. #define __HAL_RCC_SPI3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN)
  1067. #define __HAL_RCC_USART2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN)
  1068. #if defined(USART3)
  1069. #define __HAL_RCC_USART3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN)
  1070. #endif /* USART3 */
  1071. #if defined(UART4)
  1072. #define __HAL_RCC_UART4_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN)
  1073. #endif /* UART4 */
  1074. #if defined(UART5)
  1075. #define __HAL_RCC_UART5_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN)
  1076. #endif /* UART5 */
  1077. #define __HAL_RCC_I2C1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN)
  1078. #if defined(I2C2)
  1079. #define __HAL_RCC_I2C2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN)
  1080. #endif /* I2C2 */
  1081. #define __HAL_RCC_I2C3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN)
  1082. #if defined(I2C4)
  1083. #define __HAL_RCC_I2C4_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN)
  1084. #endif /* I2C4 */
  1085. #if defined(CRS)
  1086. #define __HAL_RCC_CRS_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN);
  1087. #endif /* CRS */
  1088. #define __HAL_RCC_CAN1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN)
  1089. #if defined(CAN2)
  1090. #define __HAL_RCC_CAN2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN)
  1091. #endif /* CAN2 */
  1092. #if defined(USB)
  1093. #define __HAL_RCC_USB_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN);
  1094. #endif /* USB */
  1095. #define __HAL_RCC_PWR_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN)
  1096. #define __HAL_RCC_DAC1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN)
  1097. #define __HAL_RCC_OPAMP_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN)
  1098. #define __HAL_RCC_LPTIM1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN)
  1099. #define __HAL_RCC_LPUART1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN)
  1100. #if defined(SWPMI1)
  1101. #define __HAL_RCC_SWPMI1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN)
  1102. #endif /* SWPMI1 */
  1103. #define __HAL_RCC_LPTIM2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN)
  1104. /**
  1105. * @}
  1106. */
  1107. /** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  1108. * @brief Enable or disable the APB2 peripheral clock.
  1109. * @note After reset, the peripheral clock (used for registers read/write access)
  1110. * is disabled and the application software has to enable this clock before
  1111. * using it.
  1112. * @{
  1113. */
  1114. #define __HAL_RCC_SYSCFG_CLK_ENABLE() do { \
  1115. __IO uint32_t tmpreg; \
  1116. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN); \
  1117. /* Delay after an RCC peripheral clock enabling */ \
  1118. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN); \
  1119. UNUSED(tmpreg); \
  1120. } while(0)
  1121. #define __HAL_RCC_FIREWALL_CLK_ENABLE() do { \
  1122. __IO uint32_t tmpreg; \
  1123. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_FWEN); \
  1124. /* Delay after an RCC peripheral clock enabling */ \
  1125. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_FWEN); \
  1126. UNUSED(tmpreg); \
  1127. } while(0)
  1128. #if defined(SDMMC1)
  1129. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  1130. __IO uint32_t tmpreg; \
  1131. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN); \
  1132. /* Delay after an RCC peripheral clock enabling */ \
  1133. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN); \
  1134. UNUSED(tmpreg); \
  1135. } while(0)
  1136. #endif /* SDMMC1 */
  1137. #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
  1138. __IO uint32_t tmpreg; \
  1139. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN); \
  1140. /* Delay after an RCC peripheral clock enabling */ \
  1141. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN); \
  1142. UNUSED(tmpreg); \
  1143. } while(0)
  1144. #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
  1145. __IO uint32_t tmpreg; \
  1146. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN); \
  1147. /* Delay after an RCC peripheral clock enabling */ \
  1148. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN); \
  1149. UNUSED(tmpreg); \
  1150. } while(0)
  1151. #if defined(TIM8)
  1152. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1153. __IO uint32_t tmpreg; \
  1154. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN); \
  1155. /* Delay after an RCC peripheral clock enabling */ \
  1156. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN); \
  1157. UNUSED(tmpreg); \
  1158. } while(0)
  1159. #endif /* TIM8 */
  1160. #define __HAL_RCC_USART1_CLK_ENABLE() do { \
  1161. __IO uint32_t tmpreg; \
  1162. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN); \
  1163. /* Delay after an RCC peripheral clock enabling */ \
  1164. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN); \
  1165. UNUSED(tmpreg); \
  1166. } while(0)
  1167. #define __HAL_RCC_TIM15_CLK_ENABLE() do { \
  1168. __IO uint32_t tmpreg; \
  1169. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN); \
  1170. /* Delay after an RCC peripheral clock enabling */ \
  1171. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN); \
  1172. UNUSED(tmpreg); \
  1173. } while(0)
  1174. #define __HAL_RCC_TIM16_CLK_ENABLE() do { \
  1175. __IO uint32_t tmpreg; \
  1176. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN); \
  1177. /* Delay after an RCC peripheral clock enabling */ \
  1178. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN); \
  1179. UNUSED(tmpreg); \
  1180. } while(0)
  1181. #if defined(TIM17)
  1182. #define __HAL_RCC_TIM17_CLK_ENABLE() do { \
  1183. __IO uint32_t tmpreg; \
  1184. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN); \
  1185. /* Delay after an RCC peripheral clock enabling */ \
  1186. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN); \
  1187. UNUSED(tmpreg); \
  1188. } while(0)
  1189. #endif /* TIM17 */
  1190. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1191. __IO uint32_t tmpreg; \
  1192. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN); \
  1193. /* Delay after an RCC peripheral clock enabling */ \
  1194. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN); \
  1195. UNUSED(tmpreg); \
  1196. } while(0)
  1197. #if defined(SAI2)
  1198. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  1199. __IO uint32_t tmpreg; \
  1200. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN); \
  1201. /* Delay after an RCC peripheral clock enabling */ \
  1202. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN); \
  1203. UNUSED(tmpreg); \
  1204. } while(0)
  1205. #endif /* SAI2 */
  1206. #if defined(DFSDM1_Filter0)
  1207. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  1208. __IO uint32_t tmpreg; \
  1209. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN); \
  1210. /* Delay after an RCC peripheral clock enabling */ \
  1211. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN); \
  1212. UNUSED(tmpreg); \
  1213. } while(0)
  1214. #endif /* DFSDM1_Filter0 */
  1215. #define __HAL_RCC_SYSCFG_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN)
  1216. #if defined(SDMMC1)
  1217. #define __HAL_RCC_SDMMC1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN)
  1218. #endif /* SDMMC1 */
  1219. #define __HAL_RCC_TIM1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN)
  1220. #define __HAL_RCC_SPI1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN)
  1221. #if defined(TIM8)
  1222. #define __HAL_RCC_TIM8_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN)
  1223. #endif /* TIM8 */
  1224. #define __HAL_RCC_USART1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN)
  1225. #define __HAL_RCC_TIM15_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN)
  1226. #define __HAL_RCC_TIM16_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN)
  1227. #if defined(TIM17)
  1228. #define __HAL_RCC_TIM17_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN)
  1229. #endif /* TIM17 */
  1230. #define __HAL_RCC_SAI1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN)
  1231. #if defined(SAI2)
  1232. #define __HAL_RCC_SAI2_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN)
  1233. #endif /* SAI2 */
  1234. #if defined(DFSDM1_Filter0)
  1235. #define __HAL_RCC_DFSDM1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN)
  1236. #endif /* DFSDM1_Filter0 */
  1237. /**
  1238. * @}
  1239. */
  1240. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enabled or Disabled Status
  1241. * @brief Check whether the AHB1 peripheral clock is enabled or not.
  1242. * @note After reset, the peripheral clock (used for registers read/write access)
  1243. * is disabled and the application software has to enable this clock before
  1244. * using it.
  1245. * @{
  1246. */
  1247. #define __HAL_RCC_DMA1_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN) != RESET)
  1248. #define __HAL_RCC_DMA2_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN) != RESET)
  1249. #define __HAL_RCC_FLASH_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN) != RESET)
  1250. #define __HAL_RCC_CRC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN) != RESET)
  1251. #define __HAL_RCC_TSC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN) != RESET)
  1252. #if defined(DMA2D)
  1253. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN) != RESET)
  1254. #endif /* DMA2D */
  1255. #define __HAL_RCC_DMA1_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN) == RESET)
  1256. #define __HAL_RCC_DMA2_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN) == RESET)
  1257. #define __HAL_RCC_FLASH_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN) == RESET)
  1258. #define __HAL_RCC_CRC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN) == RESET)
  1259. #define __HAL_RCC_TSC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN) == RESET)
  1260. #if defined(DMA2D)
  1261. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN) == RESET)
  1262. #endif /* DMA2D */
  1263. /**
  1264. * @}
  1265. */
  1266. /** @defgroup RCC_AHB2_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enabled or Disabled Status
  1267. * @brief Check whether the AHB2 peripheral clock is enabled or not.
  1268. * @note After reset, the peripheral clock (used for registers read/write access)
  1269. * is disabled and the application software has to enable this clock before
  1270. * using it.
  1271. * @{
  1272. */
  1273. #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN) != RESET)
  1274. #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN) != RESET)
  1275. #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN) != RESET)
  1276. #if defined(GPIOD)
  1277. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN) != RESET)
  1278. #endif /* GPIOD */
  1279. #if defined(GPIOE)
  1280. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN) != RESET)
  1281. #endif /* GPIOE */
  1282. #if defined(GPIOF)
  1283. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN) != RESET)
  1284. #endif /* GPIOF */
  1285. #if defined(GPIOG)
  1286. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN) != RESET)
  1287. #endif /* GPIOG */
  1288. #define __HAL_RCC_GPIOH_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN) != RESET)
  1289. #if defined(GPIOI)
  1290. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN) != RESET)
  1291. #endif /* GPIOI */
  1292. #if defined(USB_OTG_FS)
  1293. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN) != RESET)
  1294. #endif /* USB_OTG_FS */
  1295. #define __HAL_RCC_ADC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN) != RESET)
  1296. #if defined(DCMI)
  1297. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN) != RESET)
  1298. #endif /* DCMI */
  1299. #if defined(AES)
  1300. #define __HAL_RCC_AES_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN) != RESET)
  1301. #endif /* AES */
  1302. #if defined(HASH)
  1303. #define __HAL_RCC_HASH_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN) != RESET)
  1304. #endif /* HASH */
  1305. #define __HAL_RCC_RNG_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN) != RESET)
  1306. #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN) == RESET)
  1307. #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN) == RESET)
  1308. #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN) == RESET)
  1309. #if defined(GPIOD)
  1310. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN) == RESET)
  1311. #endif /* GPIOD */
  1312. #if defined(GPIOE)
  1313. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN) == RESET)
  1314. #endif /* GPIOE */
  1315. #if defined(GPIOF)
  1316. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN) == RESET)
  1317. #endif /* GPIOF */
  1318. #if defined(GPIOG)
  1319. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN) == RESET)
  1320. #endif /* GPIOG */
  1321. #define __HAL_RCC_GPIOH_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN) == RESET)
  1322. #if defined(GPIOI)
  1323. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN) == RESET)
  1324. #endif /* GPIOI */
  1325. #if defined(USB_OTG_FS)
  1326. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN) == RESET)
  1327. #endif /* USB_OTG_FS */
  1328. #define __HAL_RCC_ADC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN) == RESET)
  1329. #if defined(DCMI)
  1330. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN) == RESET)
  1331. #endif /* DCMI */
  1332. #if defined(AES)
  1333. #define __HAL_RCC_AES_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN) == RESET)
  1334. #endif /* AES */
  1335. #if defined(HASH)
  1336. #define __HAL_RCC_HASH_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN) == RESET)
  1337. #endif /* HASH */
  1338. #define __HAL_RCC_RNG_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN) == RESET)
  1339. /**
  1340. * @}
  1341. */
  1342. /** @defgroup RCC_AHB3_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enabled or Disabled Status
  1343. * @brief Check whether the AHB3 peripheral clock is enabled or not.
  1344. * @note After reset, the peripheral clock (used for registers read/write access)
  1345. * is disabled and the application software has to enable this clock before
  1346. * using it.
  1347. * @{
  1348. */
  1349. #if defined(FMC_BANK1)
  1350. #define __HAL_RCC_FMC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN) != RESET)
  1351. #endif /* FMC_BANK1 */
  1352. #if defined(QUADSPI)
  1353. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN) != RESET)
  1354. #endif /* QUADSPI */
  1355. #if defined(FMC_BANK1)
  1356. #define __HAL_RCC_FMC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN) == RESET)
  1357. #endif /* FMC_BANK1 */
  1358. #if defined(QUADSPI)
  1359. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN) == RESET)
  1360. #endif /* QUADSPI */
  1361. /**
  1362. * @}
  1363. */
  1364. /** @defgroup RCC_APB1_Clock_Enable_Disable_Status APB1 Peripheral Clock Enabled or Disabled Status
  1365. * @brief Check whether the APB1 peripheral clock is enabled or not.
  1366. * @note After reset, the peripheral clock (used for registers read/write access)
  1367. * is disabled and the application software has to enable this clock before
  1368. * using it.
  1369. * @{
  1370. */
  1371. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN) != RESET)
  1372. #if defined(TIM3)
  1373. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN) != RESET)
  1374. #endif /* TIM3 */
  1375. #if defined(TIM4)
  1376. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN) != RESET)
  1377. #endif /* TIM4 */
  1378. #if defined(TIM5)
  1379. #define __HAL_RCC_TIM5_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN) != RESET)
  1380. #endif /* TIM5 */
  1381. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN) != RESET)
  1382. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN) != RESET)
  1383. #if defined(LCD)
  1384. #define __HAL_RCC_LCD_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN) != RESET)
  1385. #endif /* LCD */
  1386. #if defined(RCC_APB1ENR1_RTCAPBEN)
  1387. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN) != RESET)
  1388. #endif /* RCC_APB1ENR1_RTCAPBEN */
  1389. #define __HAL_RCC_WWDG_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN) != RESET)
  1390. #if defined(SPI2)
  1391. #define __HAL_RCC_SPI2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN) != RESET)
  1392. #endif /* SPI2 */
  1393. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN) != RESET)
  1394. #define __HAL_RCC_USART2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN) != RESET)
  1395. #if defined(USART3)
  1396. #define __HAL_RCC_USART3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN) != RESET)
  1397. #endif /* USART3 */
  1398. #if defined(UART4)
  1399. #define __HAL_RCC_UART4_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN) != RESET)
  1400. #endif /* UART4 */
  1401. #if defined(UART5)
  1402. #define __HAL_RCC_UART5_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN) != RESET)
  1403. #endif /* UART5 */
  1404. #define __HAL_RCC_I2C1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN) != RESET)
  1405. #if defined(I2C2)
  1406. #define __HAL_RCC_I2C2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN) != RESET)
  1407. #endif /* I2C2 */
  1408. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN) != RESET)
  1409. #if defined(I2C4)
  1410. #define __HAL_RCC_I2C4_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN) != RESET)
  1411. #endif /* I2C4 */
  1412. #if defined(CRS)
  1413. #define __HAL_RCC_CRS_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN) != RESET)
  1414. #endif /* CRS */
  1415. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN) != RESET)
  1416. #if defined(CAN2)
  1417. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN) != RESET)
  1418. #endif /* CAN2 */
  1419. #if defined(USB)
  1420. #define __HAL_RCC_USB_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN) != RESET)
  1421. #endif /* USB */
  1422. #define __HAL_RCC_PWR_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN) != RESET)
  1423. #define __HAL_RCC_DAC1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN) != RESET)
  1424. #define __HAL_RCC_OPAMP_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN) != RESET)
  1425. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN) != RESET)
  1426. #define __HAL_RCC_LPUART1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN) != RESET)
  1427. #if defined(SWPMI1)
  1428. #define __HAL_RCC_SWPMI1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN) != RESET)
  1429. #endif /* SWPMI1 */
  1430. #define __HAL_RCC_LPTIM2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN) != RESET)
  1431. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN) == RESET)
  1432. #if defined(TIM3)
  1433. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN) == RESET)
  1434. #endif /* TIM3 */
  1435. #if defined(TIM4)
  1436. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN) == RESET)
  1437. #endif /* TIM4 */
  1438. #if defined(TIM5)
  1439. #define __HAL_RCC_TIM5_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN) == RESET)
  1440. #endif /* TIM5 */
  1441. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN) == RESET)
  1442. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN) == RESET)
  1443. #if defined(LCD)
  1444. #define __HAL_RCC_LCD_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN) == RESET)
  1445. #endif /* LCD */
  1446. #if defined(RCC_APB1ENR1_RTCAPBEN)
  1447. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN) == RESET)
  1448. #endif /* RCC_APB1ENR1_RTCAPBEN */
  1449. #define __HAL_RCC_WWDG_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN) == RESET)
  1450. #if defined(SPI2)
  1451. #define __HAL_RCC_SPI2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN) == RESET)
  1452. #endif /* SPI2 */
  1453. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN) == RESET)
  1454. #define __HAL_RCC_USART2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN) == RESET)
  1455. #if defined(USART3)
  1456. #define __HAL_RCC_USART3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN) == RESET)
  1457. #endif /* USART3 */
  1458. #if defined(UART4)
  1459. #define __HAL_RCC_UART4_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN) == RESET)
  1460. #endif /* UART4 */
  1461. #if defined(UART5)
  1462. #define __HAL_RCC_UART5_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN) == RESET)
  1463. #endif /* UART5 */
  1464. #define __HAL_RCC_I2C1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN) == RESET)
  1465. #if defined(I2C2)
  1466. #define __HAL_RCC_I2C2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN) == RESET)
  1467. #endif /* I2C2 */
  1468. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN) == RESET)
  1469. #if defined(I2C4)
  1470. #define __HAL_RCC_I2C4_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN) == RESET)
  1471. #endif /* I2C4 */
  1472. #if defined(CRS)
  1473. #define __HAL_RCC_CRS_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN) == RESET)
  1474. #endif /* CRS */
  1475. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN) == RESET)
  1476. #if defined(CAN2)
  1477. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN) == RESET)
  1478. #endif /* CAN2 */
  1479. #if defined(USB)
  1480. #define __HAL_RCC_USB_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN) == RESET)
  1481. #endif /* USB */
  1482. #define __HAL_RCC_PWR_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN) == RESET)
  1483. #define __HAL_RCC_DAC1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN) == RESET)
  1484. #define __HAL_RCC_OPAMP_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN) == RESET)
  1485. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN) == RESET)
  1486. #define __HAL_RCC_LPUART1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN) == RESET)
  1487. #if defined(SWPMI1)
  1488. #define __HAL_RCC_SWPMI1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN) == RESET)
  1489. #endif /* SWPMI1 */
  1490. #define __HAL_RCC_LPTIM2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN) == RESET)
  1491. /**
  1492. * @}
  1493. */
  1494. /** @defgroup RCC_APB2_Clock_Enable_Disable_Status APB2 Peripheral Clock Enabled or Disabled Status
  1495. * @brief Check whether the APB2 peripheral clock is enabled or not.
  1496. * @note After reset, the peripheral clock (used for registers read/write access)
  1497. * is disabled and the application software has to enable this clock before
  1498. * using it.
  1499. * @{
  1500. */
  1501. #define __HAL_RCC_SYSCFG_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN) != RESET)
  1502. #define __HAL_RCC_FIREWALL_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_FWEN) != RESET)
  1503. #if defined(SDMMC1)
  1504. #define __HAL_RCC_SDMMC1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN) != RESET)
  1505. #endif /* SDMMC1 */
  1506. #define __HAL_RCC_TIM1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN) != RESET)
  1507. #define __HAL_RCC_SPI1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN) != RESET)
  1508. #if defined(TIM8)
  1509. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN) != RESET)
  1510. #endif /* TIM8 */
  1511. #define __HAL_RCC_USART1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN) != RESET)
  1512. #define __HAL_RCC_TIM15_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN) != RESET)
  1513. #define __HAL_RCC_TIM16_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN) != RESET)
  1514. #if defined(TIM17)
  1515. #define __HAL_RCC_TIM17_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN) != RESET)
  1516. #endif /* TIM17 */
  1517. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN) != RESET)
  1518. #if defined(SAI2)
  1519. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN) != RESET)
  1520. #endif /* SAI2 */
  1521. #if defined(DFSDM1_Filter0)
  1522. #define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN) != RESET)
  1523. #endif /* DFSDM1_Filter0 */
  1524. #define __HAL_RCC_SYSCFG_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN) == RESET)
  1525. #if defined(SDMMC1)
  1526. #define __HAL_RCC_SDMMC1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN) == RESET)
  1527. #endif /* SDMMC1 */
  1528. #define __HAL_RCC_TIM1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN) == RESET)
  1529. #define __HAL_RCC_SPI1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN) == RESET)
  1530. #if defined(TIM8)
  1531. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN) == RESET)
  1532. #endif /* TIM8 */
  1533. #define __HAL_RCC_USART1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN) == RESET)
  1534. #define __HAL_RCC_TIM15_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN) == RESET)
  1535. #define __HAL_RCC_TIM16_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN) == RESET)
  1536. #if defined(TIM17)
  1537. #define __HAL_RCC_TIM17_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN) == RESET)
  1538. #endif /* TIM17 */
  1539. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN) == RESET)
  1540. #if defined(SAI2)
  1541. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN) == RESET)
  1542. #endif /* SAI2 */
  1543. #if defined(DFSDM1_Filter0)
  1544. #define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN) == RESET)
  1545. #endif /* DFSDM1_Filter0 */
  1546. /**
  1547. * @}
  1548. */
  1549. /** @defgroup RCC_AHB1_Force_Release_Reset AHB1 Peripheral Force Release Reset
  1550. * @brief Force or release AHB1 peripheral reset.
  1551. * @{
  1552. */
  1553. #define __HAL_RCC_AHB1_FORCE_RESET() WRITE_REG(RCC->AHB1RSTR, 0xFFFFFFFFU)
  1554. #define __HAL_RCC_DMA1_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA1RST)
  1555. #define __HAL_RCC_DMA2_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2RST)
  1556. #define __HAL_RCC_FLASH_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_FLASHRST)
  1557. #define __HAL_RCC_CRC_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_CRCRST)
  1558. #define __HAL_RCC_TSC_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_TSCRST)
  1559. #if defined(DMA2D)
  1560. #define __HAL_RCC_DMA2D_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2DRST)
  1561. #endif /* DMA2D */
  1562. #define __HAL_RCC_AHB1_RELEASE_RESET() WRITE_REG(RCC->AHB1RSTR, 0x00000000U)
  1563. #define __HAL_RCC_DMA1_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA1RST)
  1564. #define __HAL_RCC_DMA2_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2RST)
  1565. #define __HAL_RCC_FLASH_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_FLASHRST)
  1566. #define __HAL_RCC_CRC_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_CRCRST)
  1567. #define __HAL_RCC_TSC_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_TSCRST)
  1568. #if defined(DMA2D)
  1569. #define __HAL_RCC_DMA2D_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2DRST)
  1570. #endif /* DMA2D */
  1571. /**
  1572. * @}
  1573. */
  1574. /** @defgroup RCC_AHB2_Force_Release_Reset AHB2 Peripheral Force Release Reset
  1575. * @brief Force or release AHB2 peripheral reset.
  1576. * @{
  1577. */
  1578. #define __HAL_RCC_AHB2_FORCE_RESET() WRITE_REG(RCC->AHB2RSTR, 0xFFFFFFFFU)
  1579. #define __HAL_RCC_GPIOA_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOARST)
  1580. #define __HAL_RCC_GPIOB_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOBRST)
  1581. #define __HAL_RCC_GPIOC_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOCRST)
  1582. #if defined(GPIOD)
  1583. #define __HAL_RCC_GPIOD_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIODRST)
  1584. #endif /* GPIOD */
  1585. #if defined(GPIOE)
  1586. #define __HAL_RCC_GPIOE_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOERST)
  1587. #endif /* GPIOE */
  1588. #if defined(GPIOF)
  1589. #define __HAL_RCC_GPIOF_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOFRST)
  1590. #endif /* GPIOF */
  1591. #if defined(GPIOG)
  1592. #define __HAL_RCC_GPIOG_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOGRST)
  1593. #endif /* GPIOG */
  1594. #define __HAL_RCC_GPIOH_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOHRST)
  1595. #if defined(GPIOI)
  1596. #define __HAL_RCC_GPIOI_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOIRST)
  1597. #endif /* GPIOI */
  1598. #if defined(USB_OTG_FS)
  1599. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_OTGFSRST)
  1600. #endif /* USB_OTG_FS */
  1601. #define __HAL_RCC_ADC_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_ADCRST)
  1602. #if defined(DCMI)
  1603. #define __HAL_RCC_DCMI_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_DCMIRST)
  1604. #endif /* DCMI */
  1605. #if defined(AES)
  1606. #define __HAL_RCC_AES_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_AESRST)
  1607. #endif /* AES */
  1608. #if defined(HASH)
  1609. #define __HAL_RCC_HASH_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_HASHRST)
  1610. #endif /* HASH */
  1611. #define __HAL_RCC_RNG_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_RNGRST)
  1612. #define __HAL_RCC_AHB2_RELEASE_RESET() WRITE_REG(RCC->AHB2RSTR, 0x00000000U)
  1613. #define __HAL_RCC_GPIOA_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOARST)
  1614. #define __HAL_RCC_GPIOB_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOBRST)
  1615. #define __HAL_RCC_GPIOC_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOCRST)
  1616. #if defined(GPIOD)
  1617. #define __HAL_RCC_GPIOD_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIODRST)
  1618. #endif /* GPIOD */
  1619. #if defined(GPIOE)
  1620. #define __HAL_RCC_GPIOE_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOERST)
  1621. #endif /* GPIOE */
  1622. #if defined(GPIOF)
  1623. #define __HAL_RCC_GPIOF_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOFRST)
  1624. #endif /* GPIOF */
  1625. #if defined(GPIOG)
  1626. #define __HAL_RCC_GPIOG_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOGRST)
  1627. #endif /* GPIOG */
  1628. #define __HAL_RCC_GPIOH_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOHRST)
  1629. #if defined(GPIOI)
  1630. #define __HAL_RCC_GPIOI_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOIRST)
  1631. #endif /* GPIOI */
  1632. #if defined(USB_OTG_FS)
  1633. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_OTGFSRST)
  1634. #endif /* USB_OTG_FS */
  1635. #define __HAL_RCC_ADC_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_ADCRST)
  1636. #if defined(DCMI)
  1637. #define __HAL_RCC_DCMI_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_DCMIRST)
  1638. #endif /* DCMI */
  1639. #if defined(AES)
  1640. #define __HAL_RCC_AES_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_AESRST)
  1641. #endif /* AES */
  1642. #if defined(HASH)
  1643. #define __HAL_RCC_HASH_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_HASHRST)
  1644. #endif /* HASH */
  1645. #define __HAL_RCC_RNG_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_RNGRST)
  1646. /**
  1647. * @}
  1648. */
  1649. /** @defgroup RCC_AHB3_Force_Release_Reset AHB3 Peripheral Force Release Reset
  1650. * @brief Force or release AHB3 peripheral reset.
  1651. * @{
  1652. */
  1653. #define __HAL_RCC_AHB3_FORCE_RESET() WRITE_REG(RCC->AHB3RSTR, 0xFFFFFFFFU)
  1654. #if defined(FMC_BANK1)
  1655. #define __HAL_RCC_FMC_FORCE_RESET() SET_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_FMCRST)
  1656. #endif /* FMC_BANK1 */
  1657. #if defined(QUADSPI)
  1658. #define __HAL_RCC_QSPI_FORCE_RESET() SET_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_QSPIRST)
  1659. #endif /* QUADSPI */
  1660. #define __HAL_RCC_AHB3_RELEASE_RESET() WRITE_REG(RCC->AHB3RSTR, 0x00000000U)
  1661. #if defined(FMC_BANK1)
  1662. #define __HAL_RCC_FMC_RELEASE_RESET() CLEAR_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_FMCRST)
  1663. #endif /* FMC_BANK1 */
  1664. #if defined(QUADSPI)
  1665. #define __HAL_RCC_QSPI_RELEASE_RESET() CLEAR_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_QSPIRST)
  1666. #endif /* QUADSPI */
  1667. /**
  1668. * @}
  1669. */
  1670. /** @defgroup RCC_APB1_Force_Release_Reset APB1 Peripheral Force Release Reset
  1671. * @brief Force or release APB1 peripheral reset.
  1672. * @{
  1673. */
  1674. #define __HAL_RCC_APB1_FORCE_RESET() WRITE_REG(RCC->APB1RSTR1, 0xFFFFFFFFU)
  1675. #define __HAL_RCC_TIM2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM2RST)
  1676. #if defined(TIM3)
  1677. #define __HAL_RCC_TIM3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM3RST)
  1678. #endif /* TIM3 */
  1679. #if defined(TIM4)
  1680. #define __HAL_RCC_TIM4_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM4RST)
  1681. #endif /* TIM4 */
  1682. #if defined(TIM5)
  1683. #define __HAL_RCC_TIM5_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM5RST)
  1684. #endif /* TIM5 */
  1685. #define __HAL_RCC_TIM6_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM6RST)
  1686. #define __HAL_RCC_TIM7_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM7RST)
  1687. #if defined(LCD)
  1688. #define __HAL_RCC_LCD_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LCDRST)
  1689. #endif /* LCD */
  1690. #if defined(SPI2)
  1691. #define __HAL_RCC_SPI2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI2RST)
  1692. #endif /* SPI2 */
  1693. #define __HAL_RCC_SPI3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI3RST)
  1694. #define __HAL_RCC_USART2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART2RST)
  1695. #if defined(USART3)
  1696. #define __HAL_RCC_USART3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART3RST)
  1697. #endif /* USART3 */
  1698. #if defined(UART4)
  1699. #define __HAL_RCC_UART4_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART4RST)
  1700. #endif /* UART4 */
  1701. #if defined(UART5)
  1702. #define __HAL_RCC_UART5_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART5RST)
  1703. #endif /* UART5 */
  1704. #define __HAL_RCC_I2C1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C1RST)
  1705. #if defined(I2C2)
  1706. #define __HAL_RCC_I2C2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C2RST)
  1707. #endif /* I2C2 */
  1708. #define __HAL_RCC_I2C3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C3RST)
  1709. #if defined(I2C4)
  1710. #define __HAL_RCC_I2C4_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_I2C4RST)
  1711. #endif /* I2C4 */
  1712. #if defined(CRS)
  1713. #define __HAL_RCC_CRS_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CRSRST)
  1714. #endif /* CRS */
  1715. #define __HAL_RCC_CAN1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN1RST)
  1716. #if defined(CAN2)
  1717. #define __HAL_RCC_CAN2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN2RST)
  1718. #endif /* CAN2 */
  1719. #if defined(USB)
  1720. #define __HAL_RCC_USB_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USBFSRST)
  1721. #endif /* USB */
  1722. #define __HAL_RCC_PWR_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_PWRRST)
  1723. #define __HAL_RCC_DAC1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_DAC1RST)
  1724. #define __HAL_RCC_OPAMP_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_OPAMPRST)
  1725. #define __HAL_RCC_LPTIM1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LPTIM1RST)
  1726. #define __HAL_RCC_LPUART1_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPUART1RST)
  1727. #if defined(SWPMI1)
  1728. #define __HAL_RCC_SWPMI1_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_SWPMI1RST)
  1729. #endif /* SWPMI1 */
  1730. #define __HAL_RCC_LPTIM2_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPTIM2RST)
  1731. #define __HAL_RCC_APB1_RELEASE_RESET() WRITE_REG(RCC->APB1RSTR1, 0x00000000U)
  1732. #define __HAL_RCC_TIM2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM2RST)
  1733. #if defined(TIM3)
  1734. #define __HAL_RCC_TIM3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM3RST)
  1735. #endif /* TIM3 */
  1736. #if defined(TIM4)
  1737. #define __HAL_RCC_TIM4_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM4RST)
  1738. #endif /* TIM4 */
  1739. #if defined(TIM5)
  1740. #define __HAL_RCC_TIM5_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM5RST)
  1741. #endif /* TIM5 */
  1742. #define __HAL_RCC_TIM6_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM6RST)
  1743. #define __HAL_RCC_TIM7_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM7RST)
  1744. #if defined(LCD)
  1745. #define __HAL_RCC_LCD_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LCDRST)
  1746. #endif /* LCD */
  1747. #if defined(SPI2)
  1748. #define __HAL_RCC_SPI2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI2RST)
  1749. #endif /* SPI2 */
  1750. #define __HAL_RCC_SPI3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI3RST)
  1751. #define __HAL_RCC_USART2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART2RST)
  1752. #if defined(USART3)
  1753. #define __HAL_RCC_USART3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART3RST)
  1754. #endif /* USART3 */
  1755. #if defined(UART4)
  1756. #define __HAL_RCC_UART4_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART4RST)
  1757. #endif /* UART4 */
  1758. #if defined(UART5)
  1759. #define __HAL_RCC_UART5_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART5RST)
  1760. #endif /* UART5 */
  1761. #define __HAL_RCC_I2C1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C1RST)
  1762. #if defined(I2C2)
  1763. #define __HAL_RCC_I2C2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C2RST)
  1764. #endif /* I2C2 */
  1765. #define __HAL_RCC_I2C3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C3RST)
  1766. #if defined(I2C4)
  1767. #define __HAL_RCC_I2C4_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_I2C4RST)
  1768. #endif /* I2C4 */
  1769. #if defined(CRS)
  1770. #define __HAL_RCC_CRS_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CRSRST)
  1771. #endif /* CRS */
  1772. #define __HAL_RCC_CAN1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN1RST)
  1773. #if defined(CAN2)
  1774. #define __HAL_RCC_CAN2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN2RST)
  1775. #endif /* CAN2 */
  1776. #if defined(USB)
  1777. #define __HAL_RCC_USB_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USBFSRST)
  1778. #endif /* USB */
  1779. #define __HAL_RCC_PWR_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_PWRRST)
  1780. #define __HAL_RCC_DAC1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_DAC1RST)
  1781. #define __HAL_RCC_OPAMP_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_OPAMPRST)
  1782. #define __HAL_RCC_LPTIM1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LPTIM1RST)
  1783. #define __HAL_RCC_LPUART1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPUART1RST)
  1784. #if defined(SWPMI1)
  1785. #define __HAL_RCC_SWPMI1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_SWPMI1RST)
  1786. #endif /* SWPMI1 */
  1787. #define __HAL_RCC_LPTIM2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPTIM2RST)
  1788. /**
  1789. * @}
  1790. */
  1791. /** @defgroup RCC_APB2_Force_Release_Reset APB2 Peripheral Force Release Reset
  1792. * @brief Force or release APB2 peripheral reset.
  1793. * @{
  1794. */
  1795. #define __HAL_RCC_APB2_FORCE_RESET() WRITE_REG(RCC->APB2RSTR, 0xFFFFFFFFU)
  1796. #define __HAL_RCC_SYSCFG_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SYSCFGRST)
  1797. #if defined(SDMMC1)
  1798. #define __HAL_RCC_SDMMC1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SDMMC1RST)
  1799. #endif /* SDMMC1 */
  1800. #define __HAL_RCC_TIM1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM1RST)
  1801. #define __HAL_RCC_SPI1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SPI1RST)
  1802. #if defined(TIM8)
  1803. #define __HAL_RCC_TIM8_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM8RST)
  1804. #endif /* TIM8 */
  1805. #define __HAL_RCC_USART1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_USART1RST)
  1806. #define __HAL_RCC_TIM15_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM15RST)
  1807. #define __HAL_RCC_TIM16_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM16RST)
  1808. #if defined(TIM17)
  1809. #define __HAL_RCC_TIM17_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM17RST)
  1810. #endif /* TIM17 */
  1811. #define __HAL_RCC_SAI1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI1RST)
  1812. #if defined(SAI2)
  1813. #define __HAL_RCC_SAI2_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI2RST)
  1814. #endif /* SAI2 */
  1815. #if defined(DFSDM1_Filter0)
  1816. #define __HAL_RCC_DFSDM1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_DFSDM1RST)
  1817. #endif /* DFSDM1_Filter0 */
  1818. #define __HAL_RCC_APB2_RELEASE_RESET() WRITE_REG(RCC->APB2RSTR, 0x00000000U)
  1819. #define __HAL_RCC_SYSCFG_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SYSCFGRST)
  1820. #if defined(SDMMC1)
  1821. #define __HAL_RCC_SDMMC1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SDMMC1RST)
  1822. #endif /* SDMMC1 */
  1823. #define __HAL_RCC_TIM1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM1RST)
  1824. #define __HAL_RCC_SPI1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SPI1RST)
  1825. #if defined(TIM8)
  1826. #define __HAL_RCC_TIM8_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM8RST)
  1827. #endif /* TIM8 */
  1828. #define __HAL_RCC_USART1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_USART1RST)
  1829. #define __HAL_RCC_TIM15_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM15RST)
  1830. #define __HAL_RCC_TIM16_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM16RST)
  1831. #if defined(TIM17)
  1832. #define __HAL_RCC_TIM17_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM17RST)
  1833. #endif /* TIM17 */
  1834. #define __HAL_RCC_SAI1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI1RST)
  1835. #if defined(SAI2)
  1836. #define __HAL_RCC_SAI2_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI2RST)
  1837. #endif /* SAI2 */
  1838. #if defined(DFSDM1_Filter0)
  1839. #define __HAL_RCC_DFSDM1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_DFSDM1RST)
  1840. #endif /* DFSDM1_Filter0 */
  1841. /**
  1842. * @}
  1843. */
  1844. /** @defgroup RCC_AHB1_Clock_Sleep_Enable_Disable AHB1 Peripheral Clock Sleep Enable Disable
  1845. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1846. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1847. * power consumption.
  1848. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1849. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1850. * @{
  1851. */
  1852. #define __HAL_RCC_DMA1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN)
  1853. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN)
  1854. #define __HAL_RCC_FLASH_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN)
  1855. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN)
  1856. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN)
  1857. #define __HAL_RCC_TSC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN)
  1858. #if defined(DMA2D)
  1859. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN)
  1860. #endif /* DMA2D */
  1861. #define __HAL_RCC_DMA1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN)
  1862. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN)
  1863. #define __HAL_RCC_FLASH_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN)
  1864. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN)
  1865. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN)
  1866. #define __HAL_RCC_TSC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN)
  1867. #if defined(DMA2D)
  1868. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN)
  1869. #endif /* DMA2D */
  1870. /**
  1871. * @}
  1872. */
  1873. /** @defgroup RCC_AHB2_Clock_Sleep_Enable_Disable AHB2 Peripheral Clock Sleep Enable Disable
  1874. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1875. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1876. * power consumption.
  1877. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1878. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1879. * @{
  1880. */
  1881. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN)
  1882. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN)
  1883. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN)
  1884. #if defined(GPIOD)
  1885. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN)
  1886. #endif /* GPIOD */
  1887. #if defined(GPIOE)
  1888. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN)
  1889. #endif /* GPIOE */
  1890. #if defined(GPIOF)
  1891. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN)
  1892. #endif /* GPIOF */
  1893. #if defined(GPIOG)
  1894. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN)
  1895. #endif /* GPIOG */
  1896. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN)
  1897. #if defined(GPIOI)
  1898. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN)
  1899. #endif /* GPIOI */
  1900. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN)
  1901. #if defined(USB_OTG_FS)
  1902. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN)
  1903. #endif /* USB_OTG_FS */
  1904. #define __HAL_RCC_ADC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN)
  1905. #if defined(DCMI)
  1906. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN)
  1907. #endif /* DCMI */
  1908. #if defined(AES)
  1909. #define __HAL_RCC_AES_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN)
  1910. #endif /* AES */
  1911. #if defined(HASH)
  1912. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN)
  1913. #endif /* HASH */
  1914. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN)
  1915. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN)
  1916. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN)
  1917. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN)
  1918. #if defined(GPIOD)
  1919. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN)
  1920. #endif /* GPIOD */
  1921. #if defined(GPIOE)
  1922. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN)
  1923. #endif /* GPIOE */
  1924. #if defined(GPIOF)
  1925. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN)
  1926. #endif /* GPIOF */
  1927. #if defined(GPIOG)
  1928. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN)
  1929. #endif /* GPIOG */
  1930. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN)
  1931. #if defined(GPIOI)
  1932. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN)
  1933. #endif /* GPIOI */
  1934. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN)
  1935. #if defined(USB_OTG_FS)
  1936. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN)
  1937. #endif /* USB_OTG_FS */
  1938. #define __HAL_RCC_ADC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN)
  1939. #if defined(DCMI)
  1940. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN)
  1941. #endif /* DCMI */
  1942. #if defined(AES)
  1943. #define __HAL_RCC_AES_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN)
  1944. #endif /* AES */
  1945. #if defined(HASH)
  1946. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN)
  1947. #endif /* HASH */
  1948. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN)
  1949. /**
  1950. * @}
  1951. */
  1952. /** @defgroup RCC_AHB3_Clock_Sleep_Enable_Disable AHB3 Peripheral Clock Sleep Enable Disable
  1953. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1954. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1955. * power consumption.
  1956. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1957. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1958. * @{
  1959. */
  1960. #if defined(QUADSPI)
  1961. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN)
  1962. #endif /* QUADSPI */
  1963. #if defined(FMC_BANK1)
  1964. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN)
  1965. #endif /* FMC_BANK1 */
  1966. #if defined(QUADSPI)
  1967. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN)
  1968. #endif /* QUADSPI */
  1969. #if defined(FMC_BANK1)
  1970. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN)
  1971. #endif /* FMC_BANK1 */
  1972. /**
  1973. * @}
  1974. */
  1975. /** @defgroup RCC_APB1_Clock_Sleep_Enable_Disable APB1 Peripheral Clock Sleep Enable Disable
  1976. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1977. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1978. * power consumption.
  1979. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1980. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1981. * @{
  1982. */
  1983. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN)
  1984. #if defined(TIM3)
  1985. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN)
  1986. #endif /* TIM3 */
  1987. #if defined(TIM4)
  1988. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN)
  1989. #endif /* TIM4 */
  1990. #if defined(TIM5)
  1991. #define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN)
  1992. #endif /* TIM5 */
  1993. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN)
  1994. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN)
  1995. #if defined(LCD)
  1996. #define __HAL_RCC_LCD_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN)
  1997. #endif /* LCD */
  1998. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  1999. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN)
  2000. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2001. #define __HAL_RCC_WWDG_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN)
  2002. #if defined(SPI2)
  2003. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN)
  2004. #endif /* SPI2 */
  2005. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN)
  2006. #define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN)
  2007. #if defined(USART3)
  2008. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN)
  2009. #endif /* USART3 */
  2010. #if defined(UART4)
  2011. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN)
  2012. #endif /* UART4 */
  2013. #if defined(UART5)
  2014. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN)
  2015. #endif /* UART5 */
  2016. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN)
  2017. #if defined(I2C2)
  2018. #define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN)
  2019. #endif /* I2C2 */
  2020. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN)
  2021. #if defined(I2C4)
  2022. #define __HAL_RCC_I2C4_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN)
  2023. #endif /* I2C4 */
  2024. #if defined(CRS)
  2025. #define __HAL_RCC_CRS_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN)
  2026. #endif /* CRS */
  2027. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN)
  2028. #if defined(CAN2)
  2029. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN)
  2030. #endif /* CAN2 */
  2031. #if defined(USB)
  2032. #define __HAL_RCC_USB_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN)
  2033. #endif /* USB */
  2034. #define __HAL_RCC_PWR_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN)
  2035. #define __HAL_RCC_DAC1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN)
  2036. #define __HAL_RCC_OPAMP_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN)
  2037. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN)
  2038. #define __HAL_RCC_LPUART1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN)
  2039. #if defined(SWPMI1)
  2040. #define __HAL_RCC_SWPMI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN)
  2041. #endif /* SWPMI1 */
  2042. #define __HAL_RCC_LPTIM2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN)
  2043. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN)
  2044. #if defined(TIM3)
  2045. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN)
  2046. #endif /* TIM3 */
  2047. #if defined(TIM4)
  2048. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN)
  2049. #endif /* TIM4 */
  2050. #if defined(TIM5)
  2051. #define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN)
  2052. #endif /* TIM5 */
  2053. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN)
  2054. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN)
  2055. #if defined(LCD)
  2056. #define __HAL_RCC_LCD_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN)
  2057. #endif /* LCD */
  2058. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2059. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN)
  2060. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2061. #define __HAL_RCC_WWDG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN)
  2062. #if defined(SPI2)
  2063. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN)
  2064. #endif /* SPI2 */
  2065. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN)
  2066. #define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN)
  2067. #if defined(USART3)
  2068. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN)
  2069. #endif /* USART3 */
  2070. #if defined(UART4)
  2071. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN)
  2072. #endif /* UART4 */
  2073. #if defined(UART5)
  2074. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN)
  2075. #endif /* UART5 */
  2076. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN)
  2077. #if defined(I2C2)
  2078. #define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN)
  2079. #endif /* I2C2 */
  2080. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN)
  2081. #if defined(I2C4)
  2082. #define __HAL_RCC_I2C4_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN)
  2083. #endif /* I2C4 */
  2084. #if defined(CRS)
  2085. #define __HAL_RCC_CRS_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN)
  2086. #endif /* CRS */
  2087. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN)
  2088. #if defined(CAN2)
  2089. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN)
  2090. #endif /* CAN2 */
  2091. #if defined(USB)
  2092. #define __HAL_RCC_USB_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN)
  2093. #endif /* USB */
  2094. #define __HAL_RCC_PWR_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN)
  2095. #define __HAL_RCC_DAC1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN)
  2096. #define __HAL_RCC_OPAMP_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN)
  2097. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN)
  2098. #define __HAL_RCC_LPUART1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN)
  2099. #if defined(SWPMI1)
  2100. #define __HAL_RCC_SWPMI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN)
  2101. #endif /* SWPMI1 */
  2102. #define __HAL_RCC_LPTIM2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN)
  2103. /**
  2104. * @}
  2105. */
  2106. /** @defgroup RCC_APB2_Clock_Sleep_Enable_Disable APB2 Peripheral Clock Sleep Enable Disable
  2107. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  2108. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2109. * power consumption.
  2110. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2111. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2112. * @{
  2113. */
  2114. #define __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN)
  2115. #if defined(SDMMC1)
  2116. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN)
  2117. #endif /* SDMMC1 */
  2118. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN)
  2119. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN)
  2120. #if defined(TIM8)
  2121. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN)
  2122. #endif /* TIM8 */
  2123. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN)
  2124. #define __HAL_RCC_TIM15_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN)
  2125. #define __HAL_RCC_TIM16_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN)
  2126. #if defined(TIM17)
  2127. #define __HAL_RCC_TIM17_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN)
  2128. #endif /* TIM17 */
  2129. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN)
  2130. #if defined(SAI2)
  2131. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN)
  2132. #endif /* SAI2 */
  2133. #if defined(DFSDM1_Filter0)
  2134. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN)
  2135. #endif /* DFSDM1_Filter0 */
  2136. #define __HAL_RCC_SYSCFG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN)
  2137. #if defined(SDMMC1)
  2138. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN)
  2139. #endif /* SDMMC1 */
  2140. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN)
  2141. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN)
  2142. #if defined(TIM8)
  2143. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN)
  2144. #endif /* TIM8 */
  2145. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN)
  2146. #define __HAL_RCC_TIM15_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN)
  2147. #define __HAL_RCC_TIM16_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN)
  2148. #if defined(TIM17)
  2149. #define __HAL_RCC_TIM17_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN)
  2150. #endif /* TIM17 */
  2151. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN)
  2152. #if defined(SAI2)
  2153. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN)
  2154. #endif /* SAI2 */
  2155. #if defined(DFSDM1_Filter0)
  2156. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN)
  2157. #endif /* DFSDM1_Filter0 */
  2158. /**
  2159. * @}
  2160. */
  2161. /** @defgroup RCC_AHB1_Clock_Sleep_Enable_Disable_Status AHB1 Peripheral Clock Sleep Enabled or Disabled Status
  2162. * @brief Check whether the AHB1 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2163. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2164. * power consumption.
  2165. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2166. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2167. * @{
  2168. */
  2169. #define __HAL_RCC_DMA1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN) != RESET)
  2170. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN) != RESET)
  2171. #define __HAL_RCC_FLASH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN) != RESET)
  2172. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN) != RESET)
  2173. #define __HAL_RCC_CRC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN) != RESET)
  2174. #define __HAL_RCC_TSC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN) != RESET)
  2175. #if defined(DMA2D)
  2176. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN) != RESET)
  2177. #endif /* DMA2D */
  2178. #define __HAL_RCC_DMA1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN) == RESET)
  2179. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN) == RESET)
  2180. #define __HAL_RCC_FLASH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN) == RESET)
  2181. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN) == RESET)
  2182. #define __HAL_RCC_CRC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN) == RESET)
  2183. #define __HAL_RCC_TSC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN) == RESET)
  2184. #if defined(DMA2D)
  2185. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN) == RESET)
  2186. #endif /* DMA2D */
  2187. /**
  2188. * @}
  2189. */
  2190. /** @defgroup RCC_AHB2_Clock_Sleep_Enable_Disable_Status AHB2 Peripheral Clock Sleep Enabled or Disabled Status
  2191. * @brief Check whether the AHB2 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2192. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2193. * power consumption.
  2194. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2195. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2196. * @{
  2197. */
  2198. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN) != RESET)
  2199. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN) != RESET)
  2200. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN) != RESET)
  2201. #if defined(GPIOD)
  2202. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN) != RESET)
  2203. #endif /* GPIOD */
  2204. #if defined(GPIOE)
  2205. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN) != RESET)
  2206. #endif /* GPIOE */
  2207. #if defined(GPIOF)
  2208. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN) != RESET)
  2209. #endif /* GPIOF */
  2210. #if defined(GPIOG)
  2211. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN) != RESET)
  2212. #endif /* GPIOG */
  2213. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN) != RESET)
  2214. #if defined(GPIOI)
  2215. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN) != RESET)
  2216. #endif /* GPIOI */
  2217. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN) != RESET)
  2218. #if defined(USB_OTG_FS)
  2219. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN) != RESET)
  2220. #endif /* USB_OTG_FS */
  2221. #define __HAL_RCC_ADC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN) != RESET)
  2222. #if defined(DCMI)
  2223. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN) != RESET)
  2224. #endif /* DCMI */
  2225. #if defined(AES)
  2226. #define __HAL_RCC_AES_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN) != RESET)
  2227. #endif /* AES */
  2228. #if defined(HASH)
  2229. #define __HAL_RCC_HASH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN) != RESET)
  2230. #endif /* HASH */
  2231. #define __HAL_RCC_RNG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN) != RESET)
  2232. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN) == RESET)
  2233. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN) == RESET)
  2234. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN) == RESET)
  2235. #if defined(GPIOD)
  2236. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN) == RESET)
  2237. #endif /* GPIOD */
  2238. #if defined(GPIOE)
  2239. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN) == RESET)
  2240. #endif /* GPIOE */
  2241. #if defined(GPIOF)
  2242. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN) == RESET)
  2243. #endif /* GPIOF */
  2244. #if defined(GPIOG)
  2245. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN) == RESET)
  2246. #endif /* GPIOG */
  2247. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN) == RESET)
  2248. #if defined(GPIOI)
  2249. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN) == RESET)
  2250. #endif /* GPIOI */
  2251. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN) == RESET)
  2252. #if defined(USB_OTG_FS)
  2253. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN) == RESET)
  2254. #endif /* USB_OTG_FS */
  2255. #define __HAL_RCC_ADC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN) == RESET)
  2256. #if defined(DCMI)
  2257. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN) == RESET)
  2258. #endif /* DCMI */
  2259. #if defined(AES)
  2260. #define __HAL_RCC_AES_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN) == RESET)
  2261. #endif /* AES */
  2262. #if defined(HASH)
  2263. #define __HAL_RCC_HASH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN) == RESET)
  2264. #endif /* HASH */
  2265. #define __HAL_RCC_RNG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN) == RESET)
  2266. /**
  2267. * @}
  2268. */
  2269. /** @defgroup RCC_AHB3_Clock_Sleep_Enable_Disable_Status AHB3 Peripheral Clock Sleep Enabled or Disabled Status
  2270. * @brief Check whether the AHB3 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2271. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2272. * power consumption.
  2273. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2274. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2275. * @{
  2276. */
  2277. #if defined(QUADSPI)
  2278. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN) != RESET)
  2279. #endif /* QUADSPI */
  2280. #if defined(FMC_BANK1)
  2281. #define __HAL_RCC_FMC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN) != RESET)
  2282. #endif /* FMC_BANK1 */
  2283. #if defined(QUADSPI)
  2284. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN) == RESET)
  2285. #endif /* QUADSPI */
  2286. #if defined(FMC_BANK1)
  2287. #define __HAL_RCC_FMC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN) == RESET)
  2288. #endif /* FMC_BANK1 */
  2289. /**
  2290. * @}
  2291. */
  2292. /** @defgroup RCC_APB1_Clock_Sleep_Enable_Disable_Status APB1 Peripheral Clock Sleep Enabled or Disabled Status
  2293. * @brief Check whether the APB1 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2294. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2295. * power consumption.
  2296. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2297. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2298. * @{
  2299. */
  2300. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN) != RESET)
  2301. #if defined(TIM3)
  2302. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN) != RESET)
  2303. #endif /* TIM3 */
  2304. #if defined(TIM4)
  2305. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN) != RESET)
  2306. #endif /* TIM4 */
  2307. #if defined(TIM5)
  2308. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN) != RESET)
  2309. #endif /* TIM5 */
  2310. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN) != RESET)
  2311. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN) != RESET)
  2312. #if defined(LCD)
  2313. #define __HAL_RCC_LCD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN) != RESET)
  2314. #endif /* LCD */
  2315. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2316. #define __HAL_RCC_RTCAPB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN) != RESET)
  2317. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2318. #define __HAL_RCC_WWDG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN) != RESET)
  2319. #if defined(SPI2)
  2320. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN) != RESET)
  2321. #endif /* SPI2 */
  2322. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN) != RESET)
  2323. #define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN) != RESET)
  2324. #if defined(USART3)
  2325. #define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN) != RESET)
  2326. #endif /* USART3 */
  2327. #if defined(UART4)
  2328. #define __HAL_RCC_UART4_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN) != RESET)
  2329. #endif /* UART4 */
  2330. #if defined(UART5)
  2331. #define __HAL_RCC_UART5_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN) != RESET)
  2332. #endif /* UART5 */
  2333. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN) != RESET)
  2334. #if defined(I2C2)
  2335. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN) != RESET)
  2336. #endif /* I2C2 */
  2337. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN) != RESET)
  2338. #if defined(I2C4)
  2339. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN) != RESET)
  2340. #endif /* I2C4 */
  2341. #if defined(CRS)
  2342. #define __HAL_RCC_CRS_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN) != RESET)
  2343. #endif /* CRS */
  2344. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN) != RESET)
  2345. #if defined(CAN2)
  2346. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN) != RESET)
  2347. #endif /* CAN2 */
  2348. #if defined(USB)
  2349. #define __HAL_RCC_USB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN) != RESET)
  2350. #endif /* USB */
  2351. #define __HAL_RCC_PWR_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN) != RESET)
  2352. #define __HAL_RCC_DAC1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN) != RESET)
  2353. #define __HAL_RCC_OPAMP_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN) != RESET)
  2354. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN) != RESET)
  2355. #define __HAL_RCC_LPUART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN) != RESET)
  2356. #if defined(SWPMI1)
  2357. #define __HAL_RCC_SWPMI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN) != RESET)
  2358. #endif /* SWPMI1 */
  2359. #define __HAL_RCC_LPTIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN) != RESET)
  2360. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN) == RESET)
  2361. #if defined(TIM3)
  2362. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN) == RESET)
  2363. #endif /* TIM3 */
  2364. #if defined(TIM4)
  2365. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN) == RESET)
  2366. #endif /* TIM4 */
  2367. #if defined(TIM5)
  2368. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN) == RESET)
  2369. #endif /* TIM5 */
  2370. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN) == RESET)
  2371. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN) == RESET)
  2372. #if defined(LCD)
  2373. #define __HAL_RCC_LCD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN) == RESET)
  2374. #endif /* LCD */
  2375. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2376. #define __HAL_RCC_RTCAPB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN) == RESET)
  2377. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2378. #define __HAL_RCC_WWDG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN) == RESET)
  2379. #if defined(SPI2)
  2380. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN) == RESET)
  2381. #endif /* SPI2 */
  2382. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN) == RESET)
  2383. #define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN) == RESET)
  2384. #if defined(USART3)
  2385. #define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN) == RESET)
  2386. #endif /* USART3 */
  2387. #if defined(UART4)
  2388. #define __HAL_RCC_UART4_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN) == RESET)
  2389. #endif /* UART4 */
  2390. #if defined(UART5)
  2391. #define __HAL_RCC_UART5_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN) == RESET)
  2392. #endif /* UART5 */
  2393. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN) == RESET)
  2394. #if defined(I2C2)
  2395. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN) == RESET)
  2396. #endif /* I2C2 */
  2397. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN) == RESET)
  2398. #if defined(I2C4)
  2399. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN) == RESET)
  2400. #endif /* I2C4 */
  2401. #if defined(CRS)
  2402. #define __HAL_RCC_CRS_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN) == RESET)
  2403. #endif /* CRS */
  2404. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN) == RESET)
  2405. #if defined(CAN2)
  2406. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN) == RESET)
  2407. #endif /* CAN2 */
  2408. #if defined(USB)
  2409. #define __HAL_RCC_USB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN) == RESET)
  2410. #endif /* USB */
  2411. #define __HAL_RCC_PWR_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN) == RESET)
  2412. #define __HAL_RCC_DAC1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN) == RESET)
  2413. #define __HAL_RCC_OPAMP_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN) == RESET)
  2414. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN) == RESET)
  2415. #define __HAL_RCC_LPUART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN) == RESET)
  2416. #if defined(SWPMI1)
  2417. #define __HAL_RCC_SWPMI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN) == RESET)
  2418. #endif /* SWPMI1 */
  2419. #define __HAL_RCC_LPTIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN) == RESET)
  2420. /**
  2421. * @}
  2422. */
  2423. /** @defgroup RCC_APB2_Clock_Sleep_Enable_Disable_Status APB2 Peripheral Clock Sleep Enabled or Disabled Status
  2424. * @brief Check whether the APB2 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2425. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2426. * power consumption.
  2427. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2428. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2429. * @{
  2430. */
  2431. #define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN) != RESET)
  2432. #if defined(SDMMC1)
  2433. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN) != RESET)
  2434. #endif /* SDMMC1 */
  2435. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN) != RESET)
  2436. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN) != RESET)
  2437. #if defined(TIM8)
  2438. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN) != RESET)
  2439. #endif /* TIM8 */
  2440. #define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN) != RESET)
  2441. #define __HAL_RCC_TIM15_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN) != RESET)
  2442. #define __HAL_RCC_TIM16_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN) != RESET)
  2443. #if defined(TIM17)
  2444. #define __HAL_RCC_TIM17_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN) != RESET)
  2445. #endif /* TIM17 */
  2446. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN) != RESET)
  2447. #if defined(SAI2)
  2448. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN) != RESET)
  2449. #endif /* SAI2 */
  2450. #if defined(DFSDM1_Filter0)
  2451. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN) != RESET)
  2452. #endif /* DFSDM1_Filter0 */
  2453. #define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN) == RESET)
  2454. #if defined(SDMMC1)
  2455. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN) == RESET)
  2456. #endif /* SDMMC1 */
  2457. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN) == RESET)
  2458. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN) == RESET)
  2459. #if defined(TIM8)
  2460. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN) == RESET)
  2461. #endif /* TIM8 */
  2462. #define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN) == RESET)
  2463. #define __HAL_RCC_TIM15_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN) == RESET)
  2464. #define __HAL_RCC_TIM16_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN) == RESET)
  2465. #if defined(TIM17)
  2466. #define __HAL_RCC_TIM17_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN) == RESET)
  2467. #endif /* TIM17 */
  2468. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN) == RESET)
  2469. #if defined(SAI2)
  2470. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN) == RESET)
  2471. #endif /* SAI2 */
  2472. #if defined(DFSDM1_Filter0)
  2473. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN) == RESET)
  2474. #endif /* DFSDM1_Filter0 */
  2475. /**
  2476. * @}
  2477. */
  2478. /** @defgroup RCC_Backup_Domain_Reset RCC Backup Domain Reset
  2479. * @{
  2480. */
  2481. /** @brief Macros to force or release the Backup domain reset.
  2482. * @note This function resets the RTC peripheral (including the backup registers)
  2483. * and the RTC clock source selection in RCC_CSR register.
  2484. * @note The BKPSRAM is not affected by this reset.
  2485. * @retval None
  2486. */
  2487. #define __HAL_RCC_BACKUPRESET_FORCE() SET_BIT(RCC->BDCR, RCC_BDCR_BDRST)
  2488. #define __HAL_RCC_BACKUPRESET_RELEASE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST)
  2489. /**
  2490. * @}
  2491. */
  2492. /** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
  2493. * @{
  2494. */
  2495. /** @brief Macros to enable or disable the RTC clock.
  2496. * @note As the RTC is in the Backup domain and write access is denied to
  2497. * this domain after reset, you have to enable write access using
  2498. * HAL_PWR_EnableBkUpAccess() function before to configure the RTC
  2499. * (to be done once after reset).
  2500. * @note These macros must be used after the RTC clock source was selected.
  2501. * @retval None
  2502. */
  2503. #define __HAL_RCC_RTC_ENABLE() SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
  2504. #define __HAL_RCC_RTC_DISABLE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
  2505. /**
  2506. * @}
  2507. */
  2508. /** @brief Macros to enable or disable the Internal High Speed 16MHz oscillator (HSI).
  2509. * @note The HSI is stopped by hardware when entering STOP and STANDBY modes.
  2510. * It is used (enabled by hardware) as system clock source after startup
  2511. * from Reset, wakeup from STOP and STANDBY mode, or in case of failure
  2512. * of the HSE used directly or indirectly as system clock (if the Clock
  2513. * Security System CSS is enabled).
  2514. * @note HSI can not be stopped if it is used as system clock source. In this case,
  2515. * you have to select another source of the system clock then stop the HSI.
  2516. * @note After enabling the HSI, the application software should wait on HSIRDY
  2517. * flag to be set indicating that HSI clock is stable and can be used as
  2518. * system clock source.
  2519. * This parameter can be: ENABLE or DISABLE.
  2520. * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
  2521. * clock cycles.
  2522. * @retval None
  2523. */
  2524. #define __HAL_RCC_HSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSION)
  2525. #define __HAL_RCC_HSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSION)
  2526. /** @brief Macro to adjust the Internal High Speed 16MHz oscillator (HSI) calibration value.
  2527. * @note The calibration is used to compensate for the variations in voltage
  2528. * and temperature that influence the frequency of the internal HSI RC.
  2529. * @param __HSICALIBRATIONVALUE__: specifies the calibration trimming value
  2530. * (default is RCC_HSICALIBRATION_DEFAULT).
  2531. * This parameter must be a number between 0 and 0x1F (STM32L43x/STM32L44x/STM32L47x/STM32L48x) or 0x7F (for other devices).
  2532. * @retval None
  2533. */
  2534. #define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(__HSICALIBRATIONVALUE__) \
  2535. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, (uint32_t)(__HSICALIBRATIONVALUE__) << RCC_ICSCR_HSITRIM_Pos)
  2536. /**
  2537. * @brief Macros to enable or disable the wakeup the Internal High Speed oscillator (HSI)
  2538. * in parallel to the Internal Multi Speed oscillator (MSI) used at system wakeup.
  2539. * @note The enable of this function has not effect on the HSION bit.
  2540. * This parameter can be: ENABLE or DISABLE.
  2541. * @retval None
  2542. */
  2543. #define __HAL_RCC_HSIAUTOMATIC_START_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSIASFS)
  2544. #define __HAL_RCC_HSIAUTOMATIC_START_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSIASFS)
  2545. /**
  2546. * @brief Macros to enable or disable the force of the Internal High Speed oscillator (HSI)
  2547. * in STOP mode to be quickly available as kernel clock for USARTs and I2Cs.
  2548. * @note Keeping the HSI ON in STOP mode allows to avoid slowing down the communication
  2549. * speed because of the HSI startup time.
  2550. * @note The enable of this function has not effect on the HSION bit.
  2551. * This parameter can be: ENABLE or DISABLE.
  2552. * @retval None
  2553. */
  2554. #define __HAL_RCC_HSISTOP_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSIKERON)
  2555. #define __HAL_RCC_HSISTOP_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON)
  2556. /**
  2557. * @brief Macros to enable or disable the Internal Multi Speed oscillator (MSI).
  2558. * @note The MSI is stopped by hardware when entering STOP and STANDBY modes.
  2559. * It is used (enabled by hardware) as system clock source after
  2560. * startup from Reset, wakeup from STOP and STANDBY mode, or in case
  2561. * of failure of the HSE used directly or indirectly as system clock
  2562. * (if the Clock Security System CSS is enabled).
  2563. * @note MSI can not be stopped if it is used as system clock source.
  2564. * In this case, you have to select another source of the system
  2565. * clock then stop the MSI.
  2566. * @note After enabling the MSI, the application software should wait on
  2567. * MSIRDY flag to be set indicating that MSI clock is stable and can
  2568. * be used as system clock source.
  2569. * @note When the MSI is stopped, MSIRDY flag goes low after 6 MSI oscillator
  2570. * clock cycles.
  2571. * @retval None
  2572. */
  2573. #define __HAL_RCC_MSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_MSION)
  2574. #define __HAL_RCC_MSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_MSION)
  2575. /** @brief Macro Adjusts the Internal Multi Speed oscillator (MSI) calibration value.
  2576. * @note The calibration is used to compensate for the variations in voltage
  2577. * and temperature that influence the frequency of the internal MSI RC.
  2578. * Refer to the Application Note AN3300 for more details on how to
  2579. * calibrate the MSI.
  2580. * @param __MSICALIBRATIONVALUE__: specifies the calibration trimming value
  2581. * (default is RCC_MSICALIBRATION_DEFAULT).
  2582. * This parameter must be a number between 0 and 255.
  2583. * @retval None
  2584. */
  2585. #define __HAL_RCC_MSI_CALIBRATIONVALUE_ADJUST(__MSICALIBRATIONVALUE__) \
  2586. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_MSITRIM, (uint32_t)(__MSICALIBRATIONVALUE__) << 8)
  2587. /**
  2588. * @brief Macro configures the Internal Multi Speed oscillator (MSI) clock range in run mode
  2589. * @note After restart from Reset , the MSI clock is around 4 MHz.
  2590. * After stop the startup clock can be MSI (at any of its possible
  2591. * frequencies, the one that was used before entering stop mode) or HSI.
  2592. * After Standby its frequency can be selected between 4 possible values
  2593. * (1, 2, 4 or 8 MHz).
  2594. * @note MSIRANGE can be modified when MSI is OFF (MSION=0) or when MSI is ready
  2595. * (MSIRDY=1).
  2596. * @note The MSI clock range after reset can be modified on the fly.
  2597. * @param __MSIRANGEVALUE__: specifies the MSI clock range.
  2598. * This parameter must be one of the following values:
  2599. * @arg @ref RCC_MSIRANGE_0 MSI clock is around 100 KHz
  2600. * @arg @ref RCC_MSIRANGE_1 MSI clock is around 200 KHz
  2601. * @arg @ref RCC_MSIRANGE_2 MSI clock is around 400 KHz
  2602. * @arg @ref RCC_MSIRANGE_3 MSI clock is around 800 KHz
  2603. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2604. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2605. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2606. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2607. * @arg @ref RCC_MSIRANGE_8 MSI clock is around 16 MHz
  2608. * @arg @ref RCC_MSIRANGE_9 MSI clock is around 24 MHz
  2609. * @arg @ref RCC_MSIRANGE_10 MSI clock is around 32 MHz
  2610. * @arg @ref RCC_MSIRANGE_11 MSI clock is around 48 MHz
  2611. * @retval None
  2612. */
  2613. #define __HAL_RCC_MSI_RANGE_CONFIG(__MSIRANGEVALUE__) \
  2614. do { \
  2615. SET_BIT(RCC->CR, RCC_CR_MSIRGSEL); \
  2616. MODIFY_REG(RCC->CR, RCC_CR_MSIRANGE, (__MSIRANGEVALUE__)); \
  2617. } while(0)
  2618. /**
  2619. * @brief Macro configures the Internal Multi Speed oscillator (MSI) clock range after Standby mode
  2620. * After Standby its frequency can be selected between 4 possible values (1, 2, 4 or 8 MHz).
  2621. * @param __MSIRANGEVALUE__: specifies the MSI clock range.
  2622. * This parameter must be one of the following values:
  2623. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2624. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2625. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2626. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2627. * @retval None
  2628. */
  2629. #define __HAL_RCC_MSI_STANDBY_RANGE_CONFIG(__MSIRANGEVALUE__) \
  2630. MODIFY_REG(RCC->CSR, RCC_CSR_MSISRANGE, (__MSIRANGEVALUE__) << 4U)
  2631. /** @brief Macro to get the Internal Multi Speed oscillator (MSI) clock range in run mode
  2632. * @retval MSI clock range.
  2633. * This parameter must be one of the following values:
  2634. * @arg @ref RCC_MSIRANGE_0 MSI clock is around 100 KHz
  2635. * @arg @ref RCC_MSIRANGE_1 MSI clock is around 200 KHz
  2636. * @arg @ref RCC_MSIRANGE_2 MSI clock is around 400 KHz
  2637. * @arg @ref RCC_MSIRANGE_3 MSI clock is around 800 KHz
  2638. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2639. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2640. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2641. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2642. * @arg @ref RCC_MSIRANGE_8 MSI clock is around 16 MHz
  2643. * @arg @ref RCC_MSIRANGE_9 MSI clock is around 24 MHz
  2644. * @arg @ref RCC_MSIRANGE_10 MSI clock is around 32 MHz
  2645. * @arg @ref RCC_MSIRANGE_11 MSI clock is around 48 MHz
  2646. */
  2647. #define __HAL_RCC_GET_MSI_RANGE() \
  2648. ((READ_BIT(RCC->CR, RCC_CR_MSIRGSEL) != RESET) ? \
  2649. (uint32_t)(READ_BIT(RCC->CR, RCC_CR_MSIRANGE)) : \
  2650. (uint32_t)(READ_BIT(RCC->CSR, RCC_CSR_MSISRANGE) >> 4))
  2651. /** @brief Macros to enable or disable the Internal Low Speed oscillator (LSI).
  2652. * @note After enabling the LSI, the application software should wait on
  2653. * LSIRDY flag to be set indicating that LSI clock is stable and can
  2654. * be used to clock the IWDG and/or the RTC.
  2655. * @note LSI can not be disabled if the IWDG is running.
  2656. * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
  2657. * clock cycles.
  2658. * @retval None
  2659. */
  2660. #define __HAL_RCC_LSI_ENABLE() SET_BIT(RCC->CSR, RCC_CSR_LSION)
  2661. #define __HAL_RCC_LSI_DISABLE() CLEAR_BIT(RCC->CSR, RCC_CSR_LSION)
  2662. /**
  2663. * @brief Macro to configure the External High Speed oscillator (HSE).
  2664. * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not
  2665. * supported by this macro. User should request a transition to HSE Off
  2666. * first and then HSE On or HSE Bypass.
  2667. * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application
  2668. * software should wait on HSERDY flag to be set indicating that HSE clock
  2669. * is stable and can be used to clock the PLL and/or system clock.
  2670. * @note HSE state can not be changed if it is used directly or through the
  2671. * PLL as system clock. In this case, you have to select another source
  2672. * of the system clock then change the HSE state (ex. disable it).
  2673. * @note The HSE is stopped by hardware when entering STOP and STANDBY modes.
  2674. * @note This function reset the CSSON bit, so if the clock security system(CSS)
  2675. * was previously enabled you have to enable it again after calling this
  2676. * function.
  2677. * @param __STATE__: specifies the new state of the HSE.
  2678. * This parameter can be one of the following values:
  2679. * @arg @ref RCC_HSE_OFF Turn OFF the HSE oscillator, HSERDY flag goes low after
  2680. * 6 HSE oscillator clock cycles.
  2681. * @arg @ref RCC_HSE_ON Turn ON the HSE oscillator.
  2682. * @arg @ref RCC_HSE_BYPASS HSE oscillator bypassed with external clock.
  2683. * @retval None
  2684. */
  2685. #define __HAL_RCC_HSE_CONFIG(__STATE__) \
  2686. do { \
  2687. if((__STATE__) == RCC_HSE_ON) \
  2688. { \
  2689. SET_BIT(RCC->CR, RCC_CR_HSEON); \
  2690. } \
  2691. else if((__STATE__) == RCC_HSE_BYPASS) \
  2692. { \
  2693. SET_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2694. SET_BIT(RCC->CR, RCC_CR_HSEON); \
  2695. } \
  2696. else \
  2697. { \
  2698. CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
  2699. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2700. } \
  2701. } while(0)
  2702. /**
  2703. * @brief Macro to configure the External Low Speed oscillator (LSE).
  2704. * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not
  2705. * supported by this macro. User should request a transition to LSE Off
  2706. * first and then LSE On or LSE Bypass.
  2707. * @note As the LSE is in the Backup domain and write access is denied to
  2708. * this domain after reset, you have to enable write access using
  2709. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2710. * (to be done once after reset).
  2711. * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
  2712. * software should wait on LSERDY flag to be set indicating that LSE clock
  2713. * is stable and can be used to clock the RTC.
  2714. * @param __STATE__: specifies the new state of the LSE.
  2715. * This parameter can be one of the following values:
  2716. * @arg @ref RCC_LSE_OFF Turn OFF the LSE oscillator, LSERDY flag goes low after
  2717. * 6 LSE oscillator clock cycles.
  2718. * @arg @ref RCC_LSE_ON Turn ON the LSE oscillator.
  2719. * @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock.
  2720. * @retval None
  2721. */
  2722. #define __HAL_RCC_LSE_CONFIG(__STATE__) \
  2723. do { \
  2724. if((__STATE__) == RCC_LSE_ON) \
  2725. { \
  2726. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2727. } \
  2728. else if((__STATE__) == RCC_LSE_BYPASS) \
  2729. { \
  2730. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  2731. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2732. } \
  2733. else \
  2734. { \
  2735. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2736. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  2737. } \
  2738. } while(0)
  2739. #if defined(RCC_HSI48_SUPPORT)
  2740. /** @brief Macros to enable or disable the Internal High Speed 48MHz oscillator (HSI48).
  2741. * @note The HSI48 is stopped by hardware when entering STOP and STANDBY modes.
  2742. * @note After enabling the HSI48, the application software should wait on HSI48RDY
  2743. * flag to be set indicating that HSI48 clock is stable.
  2744. * This parameter can be: ENABLE or DISABLE.
  2745. * @retval None
  2746. */
  2747. #define __HAL_RCC_HSI48_ENABLE() SET_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON)
  2748. #define __HAL_RCC_HSI48_DISABLE() CLEAR_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON)
  2749. #endif /* RCC_HSI48_SUPPORT */
  2750. /** @brief Macros to configure the RTC clock (RTCCLK).
  2751. * @note As the RTC clock configuration bits are in the Backup domain and write
  2752. * access is denied to this domain after reset, you have to enable write
  2753. * access using the Power Backup Access macro before to configure
  2754. * the RTC clock source (to be done once after reset).
  2755. * @note Once the RTC clock is configured it cannot be changed unless the
  2756. * Backup domain is reset using __HAL_RCC_BACKUPRESET_FORCE() macro, or by
  2757. * a Power On Reset (POR).
  2758. *
  2759. * @param __RTC_CLKSOURCE__: specifies the RTC clock source.
  2760. * This parameter can be one of the following values:
  2761. * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock.
  2762. * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock.
  2763. * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock.
  2764. * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32 selected
  2765. *
  2766. * @note If the LSE or LSI is used as RTC clock source, the RTC continues to
  2767. * work in STOP and STANDBY modes, and can be used as wakeup source.
  2768. * However, when the HSE clock is used as RTC clock source, the RTC
  2769. * cannot be used in STOP and STANDBY modes.
  2770. * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as
  2771. * RTC clock source).
  2772. * @retval None
  2773. */
  2774. #define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) \
  2775. MODIFY_REG( RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__))
  2776. /** @brief Macro to get the RTC clock source.
  2777. * @retval The returned value can be one of the following:
  2778. * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock.
  2779. * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock.
  2780. * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock.
  2781. * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32 selected
  2782. */
  2783. #define __HAL_RCC_GET_RTC_SOURCE() ((uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)))
  2784. /** @brief Macros to enable or disable the main PLL.
  2785. * @note After enabling the main PLL, the application software should wait on
  2786. * PLLRDY flag to be set indicating that PLL clock is stable and can
  2787. * be used as system clock source.
  2788. * @note The main PLL can not be disabled if it is used as system clock source
  2789. * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes.
  2790. * @retval None
  2791. */
  2792. #define __HAL_RCC_PLL_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLON)
  2793. #define __HAL_RCC_PLL_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLON)
  2794. /** @brief Macro to configure the PLL clock source.
  2795. * @note This function must be used only when the main PLL is disabled.
  2796. * @param __PLLSOURCE__: specifies the PLL entry clock source.
  2797. * This parameter can be one of the following values:
  2798. * @arg @ref RCC_PLLSOURCE_NONE No clock selected as PLL clock entry
  2799. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator clock selected as PLL clock entry
  2800. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
  2801. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
  2802. * @note This clock source is common for the main PLL and audio PLL (PLLSAI1 and PLLSAI2).
  2803. * @retval None
  2804. *
  2805. */
  2806. #define __HAL_RCC_PLL_PLLSOURCE_CONFIG(__PLLSOURCE__) \
  2807. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
  2808. /** @brief Macro to configure the PLL source division factor M.
  2809. * @note This function must be used only when the main PLL is disabled.
  2810. * @param __PLLM__: specifies the division factor for PLL VCO input clock
  2811. * This parameter must be a number between Min_Data = 1 and Max_Data = 8.
  2812. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2813. * frequency ranges from 4 to 16 MHz. It is recommended to select a frequency
  2814. * of 16 MHz to limit PLL jitter.
  2815. * @retval None
  2816. *
  2817. */
  2818. #define __HAL_RCC_PLL_PLLM_CONFIG(__PLLM__) \
  2819. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, ((__PLLM__) - 1) << 4U)
  2820. /**
  2821. * @brief Macro to configure the main PLL clock source, multiplication and division factors.
  2822. * @note This function must be used only when the main PLL is disabled.
  2823. *
  2824. * @param __PLLSOURCE__: specifies the PLL entry clock source.
  2825. * This parameter can be one of the following values:
  2826. * @arg @ref RCC_PLLSOURCE_NONE No clock selected as PLL clock entry
  2827. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator clock selected as PLL clock entry
  2828. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
  2829. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
  2830. * @note This clock source is common for the main PLL and audio PLL (PLLSAI1 and PLLSAI2).
  2831. *
  2832. * @param __PLLM__: specifies the division factor for PLL VCO input clock.
  2833. * This parameter must be a number between 1 and 8.
  2834. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2835. * frequency ranges from 4 to 16 MHz. It is recommended to select a frequency
  2836. * of 16 MHz to limit PLL jitter.
  2837. *
  2838. * @param __PLLN__: specifies the multiplication factor for PLL VCO output clock.
  2839. * This parameter must be a number between 8 and 86.
  2840. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2841. * output frequency is between 64 and 344 MHz.
  2842. *
  2843. * @param __PLLP__: specifies the division factor for SAI clock.
  2844. * This parameter must be a number in the range (7 or 17) for STM32L47x/STM32L48x
  2845. * else (2 to 31).
  2846. *
  2847. * @param __PLLQ__: specifies the division factor for OTG FS, SDMMC1 and RNG clocks.
  2848. * This parameter must be in the range (2, 4, 6 or 8).
  2849. * @note If the USB OTG FS is used in your application, you have to set the
  2850. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  2851. * the SDMMC1 and RNG need a frequency lower than or equal to 48 MHz to work
  2852. * correctly.
  2853. * @param __PLLR__: specifies the division factor for the main system clock.
  2854. * @note You have to set the PLLR parameter correctly to not exceed 80MHZ.
  2855. * This parameter must be in the range (2, 4, 6 or 8).
  2856. * @retval None
  2857. */
  2858. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  2859. #define __HAL_RCC_PLL_CONFIG(__PLLSOURCE__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__ ) \
  2860. (RCC->PLLCFGR = (uint32_t)(((__PLLM__) - 1U) << 4U) | (uint32_t)((__PLLN__) << 8U) | \
  2861. (uint32_t)(__PLLSOURCE__) | (uint32_t)((((__PLLQ__) >> 1U) - 1U) << 21U) | (uint32_t)((((__PLLR__) >> 1U) - 1U) << 25U) | \
  2862. (uint32_t)((__PLLP__) << 27U))
  2863. #else
  2864. #define __HAL_RCC_PLL_CONFIG(__PLLSOURCE__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__ ) \
  2865. (RCC->PLLCFGR = (uint32_t)(((__PLLM__) - 1U) << 4U) | (uint32_t)((__PLLN__) << 8U) | (uint32_t)(((__PLLP__) >> 4U ) << 17U) | \
  2866. (uint32_t)(__PLLSOURCE__) | (uint32_t)((((__PLLQ__) >> 1U) - 1U) << 21U) | (uint32_t)((((__PLLR__) >> 1U) - 1U) << 25U))
  2867. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  2868. /** @brief Macro to get the oscillator used as PLL clock source.
  2869. * @retval The oscillator used as PLL clock source. The returned value can be one
  2870. * of the following:
  2871. * - RCC_PLLSOURCE_NONE: No oscillator is used as PLL clock source.
  2872. * - RCC_PLLSOURCE_MSI: MSI oscillator is used as PLL clock source.
  2873. * - RCC_PLLSOURCE_HSI: HSI oscillator is used as PLL clock source.
  2874. * - RCC_PLLSOURCE_HSE: HSE oscillator is used as PLL clock source.
  2875. */
  2876. #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC))
  2877. /**
  2878. * @brief Enable or disable each clock output (RCC_PLL_SYSCLK, RCC_PLL_48M1CLK, RCC_PLL_SAI3CLK)
  2879. * @note Enabling/disabling clock outputs RCC_PLL_SAI3CLK and RCC_PLL_48M1CLK can be done at anytime
  2880. * without the need to stop the PLL in order to save power. But RCC_PLL_SYSCLK cannot
  2881. * be stopped if used as System Clock.
  2882. * @param __PLLCLOCKOUT__: specifies the PLL clock to be output.
  2883. * This parameter can be one or a combination of the following values:
  2884. * @arg @ref RCC_PLL_SAI3CLK This clock is used to generate an accurate clock to achieve
  2885. * high-quality audio performance on SAI interface in case.
  2886. * @arg @ref RCC_PLL_48M1CLK This Clock is used to generate the clock for the USB OTG FS (48 MHz),
  2887. * the random analog generator (<=48 MHz) and the SDMMC1 (<= 48 MHz).
  2888. * @arg @ref RCC_PLL_SYSCLK This Clock is used to generate the high speed system clock (up to 80MHz)
  2889. * @retval None
  2890. */
  2891. #define __HAL_RCC_PLLCLKOUT_ENABLE(__PLLCLOCKOUT__) SET_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  2892. #define __HAL_RCC_PLLCLKOUT_DISABLE(__PLLCLOCKOUT__) CLEAR_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  2893. /**
  2894. * @brief Get clock output enable status (RCC_PLL_SYSCLK, RCC_PLL_48M1CLK, RCC_PLL_SAI3CLK)
  2895. * @param __PLLCLOCKOUT__: specifies the output PLL clock to be checked.
  2896. * This parameter can be one of the following values:
  2897. * @arg @ref RCC_PLL_SAI3CLK This clock is used to generate an accurate clock to achieve
  2898. * high-quality audio performance on SAI interface in case.
  2899. * @arg @ref RCC_PLL_48M1CLK This Clock is used to generate the clock for the USB OTG FS (48 MHz),
  2900. * the random analog generator (<=48 MHz) and the SDMMC1 (<= 48 MHz).
  2901. * @arg @ref RCC_PLL_SYSCLK This Clock is used to generate the high speed system clock (up to 80MHz)
  2902. * @retval SET / RESET
  2903. */
  2904. #define __HAL_RCC_GET_PLLCLKOUT_CONFIG(__PLLCLOCKOUT__) READ_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  2905. /**
  2906. * @brief Macro to configure the system clock source.
  2907. * @param __SYSCLKSOURCE__: specifies the system clock source.
  2908. * This parameter can be one of the following values:
  2909. * - RCC_SYSCLKSOURCE_MSI: MSI oscillator is used as system clock source.
  2910. * - RCC_SYSCLKSOURCE_HSI: HSI oscillator is used as system clock source.
  2911. * - RCC_SYSCLKSOURCE_HSE: HSE oscillator is used as system clock source.
  2912. * - RCC_SYSCLKSOURCE_PLLCLK: PLL output is used as system clock source.
  2913. * @retval None
  2914. */
  2915. #define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) \
  2916. MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__SYSCLKSOURCE__))
  2917. /** @brief Macro to get the clock source used as system clock.
  2918. * @retval The clock source used as system clock. The returned value can be one
  2919. * of the following:
  2920. * - RCC_SYSCLKSOURCE_STATUS_MSI: MSI used as system clock.
  2921. * - RCC_SYSCLKSOURCE_STATUS_HSI: HSI used as system clock.
  2922. * - RCC_SYSCLKSOURCE_STATUS_HSE: HSE used as system clock.
  2923. * - RCC_SYSCLKSOURCE_STATUS_PLLCLK: PLL used as system clock.
  2924. */
  2925. #define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(RCC->CFGR & RCC_CFGR_SWS))
  2926. /**
  2927. * @brief Macro to configure the External Low Speed oscillator (LSE) drive capability.
  2928. * @note As the LSE is in the Backup domain and write access is denied to
  2929. * this domain after reset, you have to enable write access using
  2930. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2931. * (to be done once after reset).
  2932. * @param __LSEDRIVE__: specifies the new state of the LSE drive capability.
  2933. * This parameter can be one of the following values:
  2934. * @arg @ref RCC_LSEDRIVE_LOW LSE oscillator low drive capability.
  2935. * @arg @ref RCC_LSEDRIVE_MEDIUMLOW LSE oscillator medium low drive capability.
  2936. * @arg @ref RCC_LSEDRIVE_MEDIUMHIGH LSE oscillator medium high drive capability.
  2937. * @arg @ref RCC_LSEDRIVE_HIGH LSE oscillator high drive capability.
  2938. * @retval None
  2939. */
  2940. #define __HAL_RCC_LSEDRIVE_CONFIG(__LSEDRIVE__) \
  2941. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, (uint32_t)(__LSEDRIVE__))
  2942. /**
  2943. * @brief Macro to configure the wake up from stop clock.
  2944. * @param __STOPWUCLK__: specifies the clock source used after wake up from stop.
  2945. * This parameter can be one of the following values:
  2946. * @arg @ref RCC_STOP_WAKEUPCLOCK_MSI MSI selected as system clock source
  2947. * @arg @ref RCC_STOP_WAKEUPCLOCK_HSI HSI selected as system clock source
  2948. * @retval None
  2949. */
  2950. #define __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(__STOPWUCLK__) \
  2951. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPWUCK, (__STOPWUCLK__))
  2952. /** @brief Macro to configure the MCO clock.
  2953. * @param __MCOCLKSOURCE__ specifies the MCO clock source.
  2954. * This parameter can be one of the following values:
  2955. * @arg @ref RCC_MCO1SOURCE_NOCLOCK MCO output disabled
  2956. * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock selected as MCO source
  2957. * @arg @ref RCC_MCO1SOURCE_MSI MSI clock selected as MCO source
  2958. * @arg @ref RCC_MCO1SOURCE_HSI HSI clock selected as MCO source
  2959. * @arg @ref RCC_MCO1SOURCE_HSE HSE clock selected as MCO sourcee
  2960. * @arg @ref RCC_MCO1SOURCE_PLLCLK Main PLL clock selected as MCO source
  2961. * @arg @ref RCC_MCO1SOURCE_LSI LSI clock selected as MCO source
  2962. * @arg @ref RCC_MCO1SOURCE_LSE LSE clock selected as MCO source
  2963. @if STM32L443xx
  2964. * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 clock selected as MCO source for devices with HSI48
  2965. @endif
  2966. @if STM32L462xx
  2967. * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 clock selected as MCO source for devices with HSI48
  2968. @endif
  2969. @if STM32L4A6xx
  2970. * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 clock selected as MCO source for devices with HSI48
  2971. @endif
  2972. * @param __MCODIV__ specifies the MCO clock prescaler.
  2973. * This parameter can be one of the following values:
  2974. * @arg @ref RCC_MCODIV_1 MCO clock source is divided by 1
  2975. * @arg @ref RCC_MCODIV_2 MCO clock source is divided by 2
  2976. * @arg @ref RCC_MCODIV_4 MCO clock source is divided by 4
  2977. * @arg @ref RCC_MCODIV_8 MCO clock source is divided by 8
  2978. * @arg @ref RCC_MCODIV_16 MCO clock source is divided by 16
  2979. */
  2980. #define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \
  2981. MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE), ((__MCOCLKSOURCE__) | (__MCODIV__)))
  2982. /** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management
  2983. * @brief macros to manage the specified RCC Flags and interrupts.
  2984. * @{
  2985. */
  2986. /** @brief Enable RCC interrupt (Perform Byte access to RCC_CIR[14:8] bits to enable
  2987. * the selected interrupts).
  2988. * @param __INTERRUPT__: specifies the RCC interrupt sources to be enabled.
  2989. * This parameter can be any combination of the following values:
  2990. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  2991. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  2992. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt
  2993. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  2994. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  2995. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  2996. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  2997. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  2998. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  2999. @if STM32L443xx
  3000. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3001. @endif
  3002. @if STM32L462xx
  3003. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3004. @endif
  3005. @if STM32L4A6xx
  3006. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3007. @endif
  3008. * @retval None
  3009. */
  3010. #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) SET_BIT(RCC->CIER, (__INTERRUPT__))
  3011. /** @brief Disable RCC interrupt (Perform Byte access to RCC_CIR[14:8] bits to disable
  3012. * the selected interrupts).
  3013. * @param __INTERRUPT__: specifies the RCC interrupt sources to be disabled.
  3014. * This parameter can be any combination of the following values:
  3015. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3016. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3017. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt
  3018. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3019. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3020. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3021. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3022. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3023. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3024. @if STM32L443xx
  3025. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3026. @endif
  3027. @if STM32L462xx
  3028. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3029. @endif
  3030. @if STM32L4A6xx
  3031. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3032. @endif
  3033. * @retval None
  3034. */
  3035. #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(RCC->CIER, (__INTERRUPT__))
  3036. /** @brief Clear the RCC's interrupt pending bits (Perform Byte access to RCC_CIR[23:16]
  3037. * bits to clear the selected interrupt pending bits.
  3038. * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
  3039. * This parameter can be any combination of the following values:
  3040. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3041. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3042. * @arg @ref RCC_IT_MSIRDY MSI ready interrupt
  3043. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3044. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3045. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3046. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3047. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3048. * @arg @ref RCC_IT_CSS HSE Clock security system interrupt
  3049. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3050. @if STM32L443xx
  3051. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3052. @endif
  3053. @if STM32L462xx
  3054. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3055. @endif
  3056. @if STM32L4A6xx
  3057. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3058. @endif
  3059. * @retval None
  3060. */
  3061. #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (RCC->CICR = (__INTERRUPT__))
  3062. /** @brief Check whether the RCC interrupt has occurred or not.
  3063. * @param __INTERRUPT__: specifies the RCC interrupt source to check.
  3064. * This parameter can be one of the following values:
  3065. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3066. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3067. * @arg @ref RCC_IT_MSIRDY MSI ready interrupt
  3068. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3069. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3070. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3071. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3072. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3073. * @arg @ref RCC_IT_CSS HSE Clock security system interrupt
  3074. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3075. @if STM32L443xx
  3076. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3077. @endif
  3078. @if STM32L462xx
  3079. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3080. @endif
  3081. @if STM32L4A6xx
  3082. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3083. @endif
  3084. * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
  3085. */
  3086. #define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIFR & (__INTERRUPT__)) == (__INTERRUPT__))
  3087. /** @brief Set RMVF bit to clear the reset flags.
  3088. * The reset flags are: RCC_FLAG_FWRRST, RCC_FLAG_OBLRST, RCC_FLAG_PINRST, RCC_FLAG_BORRST,
  3089. * RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST and RCC_FLAG_LPWRRST.
  3090. * @retval None
  3091. */
  3092. #define __HAL_RCC_CLEAR_RESET_FLAGS() (RCC->CSR |= RCC_CSR_RMVF)
  3093. /** @brief Check whether the selected RCC flag is set or not.
  3094. * @param __FLAG__: specifies the flag to check.
  3095. * This parameter can be one of the following values:
  3096. * @arg @ref RCC_FLAG_MSIRDY MSI oscillator clock ready
  3097. * @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready
  3098. * @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready
  3099. * @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready
  3100. * @arg @ref RCC_FLAG_PLLSAI1RDY PLLSAI1 clock ready
  3101. * @arg @ref RCC_FLAG_PLLSAI2RDY PLLSAI2 clock ready for devices with PLLSAI2
  3102. @if STM32L443xx
  3103. * @arg @ref RCC_FLAG_HSI48RDY HSI48 clock ready for devices with HSI48
  3104. @endif
  3105. @if STM32L462xx
  3106. * @arg @ref RCC_FLAG_HSI48RDY HSI48 clock ready for devices with HSI48
  3107. @endif
  3108. @if STM32L4A6xx
  3109. * @arg @ref RCC_FLAG_HSI48RDY HSI48 clock ready for devices with HSI48
  3110. @endif
  3111. * @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready
  3112. * @arg @ref RCC_FLAG_LSECSSD Clock security system failure on LSE oscillator detection
  3113. * @arg @ref RCC_FLAG_LSIRDY LSI oscillator clock ready
  3114. * @arg @ref RCC_FLAG_BORRST BOR reset
  3115. * @arg @ref RCC_FLAG_OBLRST OBLRST reset
  3116. * @arg @ref RCC_FLAG_PINRST Pin reset
  3117. * @arg @ref RCC_FLAG_FWRST FIREWALL reset
  3118. * @arg @ref RCC_FLAG_RMVF Remove reset Flag
  3119. * @arg @ref RCC_FLAG_SFTRST Software reset
  3120. * @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset
  3121. * @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset
  3122. * @arg @ref RCC_FLAG_LPWRRST Low Power reset
  3123. * @retval The new state of __FLAG__ (TRUE or FALSE).
  3124. */
  3125. #if defined(RCC_HSI48_SUPPORT)
  3126. #define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5U) == 1U) ? RCC->CR : \
  3127. ((((__FLAG__) >> 5U) == 4U) ? RCC->CRRCR : \
  3128. ((((__FLAG__) >> 5U) == 2U) ? RCC->BDCR : \
  3129. ((((__FLAG__) >> 5U) == 3U) ? RCC->CSR : RCC->CIFR)))) & \
  3130. ((uint32_t)1U << ((__FLAG__) & RCC_FLAG_MASK))) != RESET) \
  3131. ? 1U : 0U)
  3132. #else
  3133. #define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5U) == 1U) ? RCC->CR : \
  3134. ((((__FLAG__) >> 5U) == 2U) ? RCC->BDCR : \
  3135. ((((__FLAG__) >> 5U) == 3U) ? RCC->CSR : RCC->CIFR))) & \
  3136. ((uint32_t)1 << ((__FLAG__) & RCC_FLAG_MASK))) != RESET) \
  3137. ? 1U : 0U)
  3138. #endif /* RCC_HSI48_SUPPORT */
  3139. /**
  3140. * @}
  3141. */
  3142. /**
  3143. * @}
  3144. */
  3145. /* Private constants ---------------------------------------------------------*/
  3146. /** @defgroup RCC_Private_Constants RCC Private Constants
  3147. * @{
  3148. */
  3149. /* Defines used for Flags */
  3150. #define CR_REG_INDEX ((uint32_t)1U)
  3151. #define BDCR_REG_INDEX ((uint32_t)2U)
  3152. #define CSR_REG_INDEX ((uint32_t)3U)
  3153. #if defined(RCC_HSI48_SUPPORT)
  3154. #define CRRCR_REG_INDEX ((uint32_t)4U)
  3155. #endif /* RCC_HSI48_SUPPORT */
  3156. #define RCC_FLAG_MASK ((uint32_t)0x1FU)
  3157. /**
  3158. * @}
  3159. */
  3160. /* Private macros ------------------------------------------------------------*/
  3161. /** @addtogroup RCC_Private_Macros
  3162. * @{
  3163. */
  3164. #if defined(RCC_HSI48_SUPPORT)
  3165. #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
  3166. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  3167. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  3168. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI48) == RCC_OSCILLATORTYPE_HSI48) || \
  3169. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_MSI) == RCC_OSCILLATORTYPE_MSI) || \
  3170. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \
  3171. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
  3172. #else
  3173. #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
  3174. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  3175. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  3176. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_MSI) == RCC_OSCILLATORTYPE_MSI) || \
  3177. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \
  3178. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
  3179. #endif /* RCC_HSI48_SUPPORT */
  3180. #define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \
  3181. ((__HSE__) == RCC_HSE_BYPASS))
  3182. #define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
  3183. ((__LSE__) == RCC_LSE_BYPASS))
  3184. #define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
  3185. #define IS_RCC_HSI_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= (uint32_t)( RCC_ICSCR_HSITRIM >> RCC_ICSCR_HSITRIM_Pos))
  3186. #define IS_RCC_LSI(__LSI__) (((__LSI__) == RCC_LSI_OFF) || ((__LSI__) == RCC_LSI_ON))
  3187. #define IS_RCC_MSI(__MSI__) (((__MSI__) == RCC_MSI_OFF) || ((__MSI__) == RCC_MSI_ON))
  3188. #define IS_RCC_MSICALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= (uint32_t)255U)
  3189. #if defined(RCC_HSI48_SUPPORT)
  3190. #define IS_RCC_HSI48(__HSI48__) (((__HSI48__) == RCC_HSI48_OFF) || ((__HSI48__) == RCC_HSI48_ON))
  3191. #endif /* RCC_HSI48_SUPPORT */
  3192. #define IS_RCC_PLL(__PLL__) (((__PLL__) == RCC_PLL_NONE) ||((__PLL__) == RCC_PLL_OFF) || \
  3193. ((__PLL__) == RCC_PLL_ON))
  3194. #define IS_RCC_PLLSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLSOURCE_NONE) || \
  3195. ((__SOURCE__) == RCC_PLLSOURCE_MSI) || \
  3196. ((__SOURCE__) == RCC_PLLSOURCE_HSI) || \
  3197. ((__SOURCE__) == RCC_PLLSOURCE_HSE))
  3198. #define IS_RCC_PLLM_VALUE(__VALUE__) ((1U <= (__VALUE__)) && ((__VALUE__) <= 8U))
  3199. #define IS_RCC_PLLN_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U))
  3200. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  3201. #define IS_RCC_PLLP_VALUE(__VALUE__) (((__VALUE__) >= 2U) && ((__VALUE__) <= 31U))
  3202. #else
  3203. #define IS_RCC_PLLP_VALUE(__VALUE__) (((__VALUE__) == 7U) || ((__VALUE__) == 17U))
  3204. #endif /*RCC_PLLP_DIV_2_31_SUPPORT */
  3205. #define IS_RCC_PLLQ_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  3206. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  3207. #define IS_RCC_PLLR_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  3208. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  3209. #define IS_RCC_PLLSAI1CLOCKOUT_VALUE(__VALUE__) (((((__VALUE__) & RCC_PLLSAI1_SAI1CLK) == RCC_PLLSAI1_SAI1CLK) || \
  3210. (((__VALUE__) & RCC_PLLSAI1_48M2CLK) == RCC_PLLSAI1_48M2CLK) || \
  3211. (((__VALUE__) & RCC_PLLSAI1_ADC1CLK) == RCC_PLLSAI1_ADC1CLK)) && \
  3212. (((__VALUE__) & ~(RCC_PLLSAI1_SAI1CLK|RCC_PLLSAI1_48M2CLK|RCC_PLLSAI1_ADC1CLK)) == 0U))
  3213. #if defined(RCC_PLLSAI2_SUPPORT)
  3214. #define IS_RCC_PLLSAI2CLOCKOUT_VALUE(__VALUE__) (((((__VALUE__) & RCC_PLLSAI2_SAI2CLK) == RCC_PLLSAI2_SAI2CLK) || \
  3215. (((__VALUE__) & RCC_PLLSAI2_ADC2CLK) == RCC_PLLSAI2_ADC2CLK)) && \
  3216. (((__VALUE__) & ~(RCC_PLLSAI2_SAI2CLK|RCC_PLLSAI2_ADC2CLK)) == 0U))
  3217. #endif /* RCC_PLLSAI2_SUPPORT */
  3218. #define IS_RCC_MSI_CLOCK_RANGE(__RANGE__) (((__RANGE__) == RCC_MSIRANGE_0) || \
  3219. ((__RANGE__) == RCC_MSIRANGE_1) || \
  3220. ((__RANGE__) == RCC_MSIRANGE_2) || \
  3221. ((__RANGE__) == RCC_MSIRANGE_3) || \
  3222. ((__RANGE__) == RCC_MSIRANGE_4) || \
  3223. ((__RANGE__) == RCC_MSIRANGE_5) || \
  3224. ((__RANGE__) == RCC_MSIRANGE_6) || \
  3225. ((__RANGE__) == RCC_MSIRANGE_7) || \
  3226. ((__RANGE__) == RCC_MSIRANGE_8) || \
  3227. ((__RANGE__) == RCC_MSIRANGE_9) || \
  3228. ((__RANGE__) == RCC_MSIRANGE_10) || \
  3229. ((__RANGE__) == RCC_MSIRANGE_11))
  3230. #define IS_RCC_MSI_STANDBY_CLOCK_RANGE(__RANGE__) (((__RANGE__) == RCC_MSIRANGE_4) || \
  3231. ((__RANGE__) == RCC_MSIRANGE_5) || \
  3232. ((__RANGE__) == RCC_MSIRANGE_6) || \
  3233. ((__RANGE__) == RCC_MSIRANGE_7))
  3234. #define IS_RCC_CLOCKTYPE(__CLK__) ((1U <= (__CLK__)) && ((__CLK__) <= 15U))
  3235. #define IS_RCC_SYSCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_MSI) || \
  3236. ((__SOURCE__) == RCC_SYSCLKSOURCE_HSI) || \
  3237. ((__SOURCE__) == RCC_SYSCLKSOURCE_HSE) || \
  3238. ((__SOURCE__) == RCC_SYSCLKSOURCE_PLLCLK))
  3239. #define IS_RCC_HCLK(__HCLK__) (((__HCLK__) == RCC_SYSCLK_DIV1) || ((__HCLK__) == RCC_SYSCLK_DIV2) || \
  3240. ((__HCLK__) == RCC_SYSCLK_DIV4) || ((__HCLK__) == RCC_SYSCLK_DIV8) || \
  3241. ((__HCLK__) == RCC_SYSCLK_DIV16) || ((__HCLK__) == RCC_SYSCLK_DIV64) || \
  3242. ((__HCLK__) == RCC_SYSCLK_DIV128) || ((__HCLK__) == RCC_SYSCLK_DIV256) || \
  3243. ((__HCLK__) == RCC_SYSCLK_DIV512))
  3244. #define IS_RCC_PCLK(__PCLK__) (((__PCLK__) == RCC_HCLK_DIV1) || ((__PCLK__) == RCC_HCLK_DIV2) || \
  3245. ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
  3246. ((__PCLK__) == RCC_HCLK_DIV16))
  3247. #define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NO_CLK) || \
  3248. ((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \
  3249. ((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \
  3250. ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV32))
  3251. #define IS_RCC_MCO(__MCOX__) ((__MCOX__) == RCC_MCO1)
  3252. #if defined(RCC_HSI48_SUPPORT)
  3253. #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK) || \
  3254. ((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || \
  3255. ((__SOURCE__) == RCC_MCO1SOURCE_MSI) || \
  3256. ((__SOURCE__) == RCC_MCO1SOURCE_HSI) || \
  3257. ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || \
  3258. ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || \
  3259. ((__SOURCE__) == RCC_MCO1SOURCE_LSI) || \
  3260. ((__SOURCE__) == RCC_MCO1SOURCE_LSE) || \
  3261. ((__SOURCE__) == RCC_MCO1SOURCE_HSI48))
  3262. #else
  3263. #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK) || \
  3264. ((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || \
  3265. ((__SOURCE__) == RCC_MCO1SOURCE_MSI) || \
  3266. ((__SOURCE__) == RCC_MCO1SOURCE_HSI) || \
  3267. ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || \
  3268. ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || \
  3269. ((__SOURCE__) == RCC_MCO1SOURCE_LSI) || \
  3270. ((__SOURCE__) == RCC_MCO1SOURCE_LSE))
  3271. #endif /* RCC_HSI48_SUPPORT */
  3272. #define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1) || ((__DIV__) == RCC_MCODIV_2) || \
  3273. ((__DIV__) == RCC_MCODIV_4) || ((__DIV__) == RCC_MCODIV_8) || \
  3274. ((__DIV__) == RCC_MCODIV_16))
  3275. #define IS_RCC_LSE_DRIVE(__DRIVE__) (((__DRIVE__) == RCC_LSEDRIVE_LOW) || \
  3276. ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMLOW) || \
  3277. ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMHIGH) || \
  3278. ((__DRIVE__) == RCC_LSEDRIVE_HIGH))
  3279. #define IS_RCC_STOP_WAKEUPCLOCK(__SOURCE__) (((__SOURCE__) == RCC_STOP_WAKEUPCLOCK_MSI) || \
  3280. ((__SOURCE__) == RCC_STOP_WAKEUPCLOCK_HSI))
  3281. /**
  3282. * @}
  3283. */
  3284. /* Include RCC HAL Extended module */
  3285. #include "stm32l4xx_hal_rcc_ex.h"
  3286. /* Exported functions --------------------------------------------------------*/
  3287. /** @addtogroup RCC_Exported_Functions
  3288. * @{
  3289. */
  3290. /** @addtogroup RCC_Exported_Functions_Group1
  3291. * @{
  3292. */
  3293. /* Initialization and de-initialization functions ******************************/
  3294. void HAL_RCC_DeInit(void);
  3295. HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  3296. HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency);
  3297. /**
  3298. * @}
  3299. */
  3300. /** @addtogroup RCC_Exported_Functions_Group2
  3301. * @{
  3302. */
  3303. /* Peripheral Control functions ************************************************/
  3304. void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
  3305. void HAL_RCC_EnableCSS(void);
  3306. uint32_t HAL_RCC_GetSysClockFreq(void);
  3307. uint32_t HAL_RCC_GetHCLKFreq(void);
  3308. uint32_t HAL_RCC_GetPCLK1Freq(void);
  3309. uint32_t HAL_RCC_GetPCLK2Freq(void);
  3310. void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  3311. void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency);
  3312. /* CSS NMI IRQ handler */
  3313. void HAL_RCC_NMI_IRQHandler(void);
  3314. /* User Callbacks in non blocking mode (IT mode) */
  3315. void HAL_RCC_CSSCallback(void);
  3316. /**
  3317. * @}
  3318. */
  3319. /**
  3320. * @}
  3321. */
  3322. /**
  3323. * @}
  3324. */
  3325. /**
  3326. * @}
  3327. */
  3328. #ifdef __cplusplus
  3329. }
  3330. #endif
  3331. #endif /* __STM32L4xx_HAL_RCC_H */
  3332. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/