stm32l4xx_hal_rcc.h 219 KB

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