stm32l4xx_hal_rcc.h 219 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883
  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 source
  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 */