stm32f4xx_hal_rcc_ex.h 431 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_rcc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F4xx_HAL_RCC_EX_H
  37. #define __STM32F4xx_HAL_RCC_EX_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f4xx_hal_def.h"
  43. /** @addtogroup STM32F4xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup RCCEx
  47. * @{
  48. */
  49. /* Exported types ------------------------------------------------------------*/
  50. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  51. * @{
  52. */
  53. /**
  54. * @brief RCC PLL configuration structure definition
  55. */
  56. typedef struct
  57. {
  58. uint32_t PLLState; /*!< The new state of the PLL.
  59. This parameter can be a value of @ref RCC_PLL_Config */
  60. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  61. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  62. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  63. This parameter must be a number between Min_Data = 0 and Max_Data = 63 */
  64. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  65. This parameter must be a number between Min_Data = 50 and Max_Data = 432
  66. except for STM32F411xE devices where the Min_Data = 192 */
  67. uint32_t PLLP; /*!< PLLP: Division factor for main system clock (SYSCLK).
  68. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  69. uint32_t PLLQ; /*!< PLLQ: Division factor for OTG FS, SDIO and RNG clocks.
  70. This parameter must be a number between Min_Data = 2 and Max_Data = 15 */
  71. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  72. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  73. defined(STM32F413xx) || defined(STM32F423xx)
  74. uint32_t PLLR; /*!< PLLR: PLL division factor for I2S, SAI, SYSTEM, SPDIFRX clocks.
  75. This parameter is only available in STM32F410xx/STM32F446xx/STM32F469xx/STM32F479xx
  76. and STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F413xx/STM32F423xx devices.
  77. This parameter must be a number between Min_Data = 2 and Max_Data = 7 */
  78. #endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  79. }RCC_PLLInitTypeDef;
  80. #if defined(STM32F446xx)
  81. /**
  82. * @brief PLLI2S Clock structure definition
  83. */
  84. typedef struct
  85. {
  86. uint32_t PLLI2SM; /*!< Specifies division factor for PLL VCO input clock.
  87. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  88. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  89. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  90. uint32_t PLLI2SP; /*!< Specifies division factor for SPDIFRX Clock.
  91. This parameter must be a value of @ref RCCEx_PLLI2SP_Clock_Divider */
  92. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI clock.
  93. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  94. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  95. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  96. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  97. This parameter will be used only when PLLI2S is selected as Clock Source I2S */
  98. }RCC_PLLI2SInitTypeDef;
  99. /**
  100. * @brief PLLSAI Clock structure definition
  101. */
  102. typedef struct
  103. {
  104. uint32_t PLLSAIM; /*!< Spcifies division factor for PLL VCO input clock.
  105. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  106. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  107. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  108. uint32_t PLLSAIP; /*!< Specifies division factor for OTG FS, SDIO and RNG clocks.
  109. This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider */
  110. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI clock.
  111. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  112. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  113. }RCC_PLLSAIInitTypeDef;
  114. /**
  115. * @brief RCC extended clocks structure definition
  116. */
  117. typedef struct
  118. {
  119. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  120. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  121. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  122. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  123. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  124. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  125. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  126. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  127. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  128. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  129. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  130. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  131. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 Clock Source Selection.
  132. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  133. uint32_t Sai2ClockSelection; /*!< Specifies SAI2 Clock Source Selection.
  134. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */
  135. uint32_t I2sApb1ClockSelection; /*!< Specifies I2S APB1 Clock Source Selection.
  136. This parameter can be a value of @ref RCCEx_I2SAPB1_Clock_Source */
  137. uint32_t I2sApb2ClockSelection; /*!< Specifies I2S APB2 Clock Source Selection.
  138. This parameter can be a value of @ref RCCEx_I2SAPB2_Clock_Source */
  139. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection.
  140. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  141. uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection.
  142. This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */
  143. uint32_t CecClockSelection; /*!< Specifies CEC Clock Source Selection.
  144. This parameter can be a value of @ref RCCEx_CEC_Clock_Source */
  145. uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection.
  146. This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */
  147. uint32_t SpdifClockSelection; /*!< Specifies SPDIFRX Clock Source Selection.
  148. This parameter can be a value of @ref RCCEx_SPDIFRX_Clock_Source */
  149. uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks.
  150. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  151. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  152. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  153. }RCC_PeriphCLKInitTypeDef;
  154. #endif /* STM32F446xx */
  155. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  156. /**
  157. * @brief RCC extended clocks structure definition
  158. */
  159. typedef struct
  160. {
  161. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  162. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  163. uint32_t I2SClockSelection; /*!< Specifies RTC Clock Source Selection.
  164. This parameter can be a value of @ref RCCEx_I2S_APB_Clock_Source */
  165. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection.
  166. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  167. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 Clock Source Selection.
  168. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  169. uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection.
  170. This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */
  171. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  172. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  173. }RCC_PeriphCLKInitTypeDef;
  174. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  175. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  176. /**
  177. * @brief PLLI2S Clock structure definition
  178. */
  179. typedef struct
  180. {
  181. uint32_t PLLI2SM; /*!< Specifies division factor for PLL VCO input clock.
  182. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  183. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  184. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  185. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI clock.
  186. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  187. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  188. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  189. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  190. This parameter will be used only when PLLI2S is selected as Clock Source I2S */
  191. }RCC_PLLI2SInitTypeDef;
  192. /**
  193. * @brief RCC extended clocks structure definition
  194. */
  195. typedef struct
  196. {
  197. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  198. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  199. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  200. This parameter will be used only when PLLI2S is selected as Clock Source I2S */
  201. #if defined(STM32F413xx) || defined(STM32F423xx)
  202. uint32_t PLLDivR; /*!< Specifies the PLL division factor for SAI1 clock.
  203. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  204. This parameter will be used only when PLL is selected as Clock Source SAI */
  205. uint32_t PLLI2SDivR; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  206. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  207. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  208. #endif /* STM32F413xx || STM32F423xx */
  209. uint32_t I2sApb1ClockSelection; /*!< Specifies I2S APB1 Clock Source Selection.
  210. This parameter can be a value of @ref RCCEx_I2SAPB1_Clock_Source */
  211. uint32_t I2sApb2ClockSelection; /*!< Specifies I2S APB2 Clock Source Selection.
  212. This parameter can be a value of @ref RCCEx_I2SAPB2_Clock_Source */
  213. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection.
  214. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  215. uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection.
  216. This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */
  217. uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection.
  218. This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */
  219. uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks.
  220. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  221. uint32_t Dfsdm1ClockSelection; /*!< Specifies DFSDM1 Clock Selection.
  222. This parameter can be a value of @ref RCCEx_DFSDM1_Kernel_Clock_Source */
  223. uint32_t Dfsdm1AudioClockSelection;/*!< Specifies DFSDM1 Audio Clock Selection.
  224. This parameter can be a value of @ref RCCEx_DFSDM1_Audio_Clock_Source */
  225. #if defined(STM32F413xx) || defined(STM32F423xx)
  226. uint32_t Dfsdm2ClockSelection; /*!< Specifies DFSDM2 Clock Selection.
  227. This parameter can be a value of @ref RCCEx_DFSDM2_Kernel_Clock_Source */
  228. uint32_t Dfsdm2AudioClockSelection;/*!< Specifies DFSDM2 Audio Clock Selection.
  229. This parameter can be a value of @ref RCCEx_DFSDM2_Audio_Clock_Source */
  230. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 Clock Source Selection.
  231. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  232. uint32_t SaiAClockSelection; /*!< Specifies SAI1_A Clock Prescalers Selection
  233. This parameter can be a value of @ref RCCEx_SAI1_BlockA_Clock_Source */
  234. uint32_t SaiBClockSelection; /*!< Specifies SAI1_B Clock Prescalers Selection
  235. This parameter can be a value of @ref RCCEx_SAI1_BlockB_Clock_Source */
  236. #endif /* STM32F413xx || STM32F423xx */
  237. uint32_t PLLI2SSelection; /*!< Specifies PLL I2S Clock Source Selection.
  238. This parameter can be a value of @ref RCCEx_PLL_I2S_Clock_Source */
  239. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  240. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  241. }RCC_PeriphCLKInitTypeDef;
  242. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  243. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  244. /**
  245. * @brief PLLI2S Clock structure definition
  246. */
  247. typedef struct
  248. {
  249. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  250. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  251. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  252. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  253. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  254. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  255. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI1 clock.
  256. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  257. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  258. }RCC_PLLI2SInitTypeDef;
  259. /**
  260. * @brief PLLSAI Clock structure definition
  261. */
  262. typedef struct
  263. {
  264. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  265. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  266. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  267. #if defined(STM32F469xx) || defined(STM32F479xx)
  268. uint32_t PLLSAIP; /*!< Specifies division factor for OTG FS and SDIO clocks.
  269. This parameter is only available in STM32F469xx/STM32F479xx devices.
  270. This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider */
  271. #endif /* STM32F469xx || STM32F479xx */
  272. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI1 clock.
  273. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  274. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  275. uint32_t PLLSAIR; /*!< specifies the division factor for LTDC clock
  276. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  277. This parameter will be used only when PLLSAI is selected as Clock Source LTDC */
  278. }RCC_PLLSAIInitTypeDef;
  279. /**
  280. * @brief RCC extended clocks structure definition
  281. */
  282. typedef struct
  283. {
  284. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  285. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  286. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  287. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  288. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  289. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  290. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  291. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  292. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  293. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  294. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  295. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  296. uint32_t PLLSAIDivR; /*!< Specifies the PLLSAI division factor for LTDC clock.
  297. This parameter must be one value of @ref RCCEx_PLLSAI_DIVR */
  298. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection.
  299. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  300. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection.
  301. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  302. #if defined(STM32F469xx) || defined(STM32F479xx)
  303. uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks.
  304. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  305. uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection.
  306. This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */
  307. #endif /* STM32F469xx || STM32F479xx */
  308. }RCC_PeriphCLKInitTypeDef;
  309. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  310. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
  311. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  312. /**
  313. * @brief PLLI2S Clock structure definition
  314. */
  315. typedef struct
  316. {
  317. #if defined(STM32F411xE)
  318. uint32_t PLLI2SM; /*!< PLLM: Division factor for PLLI2S VCO input clock.
  319. This parameter must be a number between Min_Data = 2 and Max_Data = 62 */
  320. #endif /* STM32F411xE */
  321. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  322. This parameter must be a number between Min_Data = 50 and Max_Data = 432
  323. Except for STM32F411xE devices where the Min_Data = 192.
  324. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  325. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  326. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  327. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  328. }RCC_PLLI2SInitTypeDef;
  329. /**
  330. * @brief RCC extended clocks structure definition
  331. */
  332. typedef struct
  333. {
  334. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  335. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  336. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  337. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  338. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection.
  339. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  340. #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  341. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  342. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  343. #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
  344. }RCC_PeriphCLKInitTypeDef;
  345. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
  346. /**
  347. * @}
  348. */
  349. /* Exported constants --------------------------------------------------------*/
  350. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  351. * @{
  352. */
  353. /** @defgroup RCCEx_Periph_Clock_Selection RCC Periph Clock Selection
  354. * @{
  355. */
  356. /* Peripheral Clock source for STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx */
  357. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  358. defined(STM32F413xx) || defined(STM32F423xx)
  359. #define RCC_PERIPHCLK_I2S_APB1 0x00000001U
  360. #define RCC_PERIPHCLK_I2S_APB2 0x00000002U
  361. #define RCC_PERIPHCLK_TIM 0x00000004U
  362. #define RCC_PERIPHCLK_RTC 0x00000008U
  363. #define RCC_PERIPHCLK_FMPI2C1 0x00000010U
  364. #define RCC_PERIPHCLK_CLK48 0x00000020U
  365. #define RCC_PERIPHCLK_SDIO 0x00000040U
  366. #define RCC_PERIPHCLK_PLLI2S 0x00000080U
  367. #define RCC_PERIPHCLK_DFSDM1 0x00000100U
  368. #define RCC_PERIPHCLK_DFSDM1_AUDIO 0x00000200U
  369. #endif /* STM32F412Zx || STM32F412Vx) || STM32F412Rx || STM32F412Cx */
  370. #if defined(STM32F413xx) || defined(STM32F423xx)
  371. #define RCC_PERIPHCLK_DFSDM2 0x00000400U
  372. #define RCC_PERIPHCLK_DFSDM2_AUDIO 0x00000800U
  373. #define RCC_PERIPHCLK_LPTIM1 0x00001000U
  374. #define RCC_PERIPHCLK_SAIA 0x00002000U
  375. #define RCC_PERIPHCLK_SAIB 0x00004000U
  376. #endif /* STM32F413xx || STM32F423xx */
  377. /*----------------------------------------------------------------------------*/
  378. /*------------------- Peripheral Clock source for STM32F410xx ----------------*/
  379. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  380. #define RCC_PERIPHCLK_I2S 0x00000001U
  381. #define RCC_PERIPHCLK_TIM 0x00000002U
  382. #define RCC_PERIPHCLK_RTC 0x00000004U
  383. #define RCC_PERIPHCLK_FMPI2C1 0x00000008U
  384. #define RCC_PERIPHCLK_LPTIM1 0x00000010U
  385. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  386. /*----------------------------------------------------------------------------*/
  387. /*------------------- Peripheral Clock source for STM32F446xx ----------------*/
  388. #if defined(STM32F446xx)
  389. #define RCC_PERIPHCLK_I2S_APB1 0x00000001U
  390. #define RCC_PERIPHCLK_I2S_APB2 0x00000002U
  391. #define RCC_PERIPHCLK_SAI1 0x00000004U
  392. #define RCC_PERIPHCLK_SAI2 0x00000008U
  393. #define RCC_PERIPHCLK_TIM 0x00000010U
  394. #define RCC_PERIPHCLK_RTC 0x00000020U
  395. #define RCC_PERIPHCLK_CEC 0x00000040U
  396. #define RCC_PERIPHCLK_FMPI2C1 0x00000080U
  397. #define RCC_PERIPHCLK_CLK48 0x00000100U
  398. #define RCC_PERIPHCLK_SDIO 0x00000200U
  399. #define RCC_PERIPHCLK_SPDIFRX 0x00000400U
  400. #define RCC_PERIPHCLK_PLLI2S 0x00000800U
  401. #endif /* STM32F446xx */
  402. /*-----------------------------------------------------------------------------*/
  403. /*----------- Peripheral Clock source for STM32F469xx/STM32F479xx -------------*/
  404. #if defined(STM32F469xx) || defined(STM32F479xx)
  405. #define RCC_PERIPHCLK_I2S 0x00000001U
  406. #define RCC_PERIPHCLK_SAI_PLLI2S 0x00000002U
  407. #define RCC_PERIPHCLK_SAI_PLLSAI 0x00000004U
  408. #define RCC_PERIPHCLK_LTDC 0x00000008U
  409. #define RCC_PERIPHCLK_TIM 0x00000010U
  410. #define RCC_PERIPHCLK_RTC 0x00000020U
  411. #define RCC_PERIPHCLK_PLLI2S 0x00000040U
  412. #define RCC_PERIPHCLK_CLK48 0x00000080U
  413. #define RCC_PERIPHCLK_SDIO 0x00000100U
  414. #endif /* STM32F469xx || STM32F479xx */
  415. /*----------------------------------------------------------------------------*/
  416. /*-------- Peripheral Clock source for STM32F42xxx/STM32F43xxx ---------------*/
  417. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
  418. #define RCC_PERIPHCLK_I2S 0x00000001U
  419. #define RCC_PERIPHCLK_SAI_PLLI2S 0x00000002U
  420. #define RCC_PERIPHCLK_SAI_PLLSAI 0x00000004U
  421. #define RCC_PERIPHCLK_LTDC 0x00000008U
  422. #define RCC_PERIPHCLK_TIM 0x00000010U
  423. #define RCC_PERIPHCLK_RTC 0x00000020U
  424. #define RCC_PERIPHCLK_PLLI2S 0x00000040U
  425. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
  426. /*----------------------------------------------------------------------------*/
  427. /*-------- Peripheral Clock source for STM32F40xxx/STM32F41xxx ---------------*/
  428. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) ||\
  429. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  430. #define RCC_PERIPHCLK_I2S 0x00000001U
  431. #define RCC_PERIPHCLK_RTC 0x00000002U
  432. #define RCC_PERIPHCLK_PLLI2S 0x00000004U
  433. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
  434. #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  435. #define RCC_PERIPHCLK_TIM 0x00000008U
  436. #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
  437. /*----------------------------------------------------------------------------*/
  438. /**
  439. * @}
  440. */
  441. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  442. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  443. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \
  444. defined(STM32F479xx)
  445. /** @defgroup RCCEx_I2S_Clock_Source I2S Clock Source
  446. * @{
  447. */
  448. #define RCC_I2SCLKSOURCE_PLLI2S 0x00000000U
  449. #define RCC_I2SCLKSOURCE_EXT 0x00000001U
  450. /**
  451. * @}
  452. */
  453. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  454. STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */
  455. /** @defgroup RCCEx_PLLSAI_DIVR RCC PLLSAI DIVR
  456. * @{
  457. */
  458. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
  459. defined(STM32F469xx) || defined(STM32F479xx)
  460. #define RCC_PLLSAIDIVR_2 0x00000000U
  461. #define RCC_PLLSAIDIVR_4 0x00010000U
  462. #define RCC_PLLSAIDIVR_8 0x00020000U
  463. #define RCC_PLLSAIDIVR_16 0x00030000U
  464. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  465. /**
  466. * @}
  467. */
  468. /** @defgroup RCCEx_PLLI2SP_Clock_Divider RCC PLLI2SP Clock Divider
  469. * @{
  470. */
  471. #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  472. defined(STM32F412Rx) || defined(STM32F412Cx)
  473. #define RCC_PLLI2SP_DIV2 0x00000002U
  474. #define RCC_PLLI2SP_DIV4 0x00000004U
  475. #define RCC_PLLI2SP_DIV6 0x00000006U
  476. #define RCC_PLLI2SP_DIV8 0x00000008U
  477. #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  478. /**
  479. * @}
  480. */
  481. /** @defgroup RCCEx_PLLSAIP_Clock_Divider RCC PLLSAIP Clock Divider
  482. * @{
  483. */
  484. #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  485. #define RCC_PLLSAIP_DIV2 0x00000002U
  486. #define RCC_PLLSAIP_DIV4 0x00000004U
  487. #define RCC_PLLSAIP_DIV6 0x00000006U
  488. #define RCC_PLLSAIP_DIV8 0x00000008U
  489. #endif /* STM32F446xx || STM32F469xx || STM32F479xx */
  490. /**
  491. * @}
  492. */
  493. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  494. /** @defgroup RCCEx_SAI_BlockA_Clock_Source RCC SAI BlockA Clock Source
  495. * @{
  496. */
  497. #define RCC_SAIACLKSOURCE_PLLSAI 0x00000000U
  498. #define RCC_SAIACLKSOURCE_PLLI2S 0x00100000U
  499. #define RCC_SAIACLKSOURCE_EXT 0x00200000U
  500. /**
  501. * @}
  502. */
  503. /** @defgroup RCCEx_SAI_BlockB_Clock_Source RCC SAI BlockB Clock Source
  504. * @{
  505. */
  506. #define RCC_SAIBCLKSOURCE_PLLSAI 0x00000000U
  507. #define RCC_SAIBCLKSOURCE_PLLI2S 0x00400000U
  508. #define RCC_SAIBCLKSOURCE_EXT 0x00800000U
  509. /**
  510. * @}
  511. */
  512. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  513. #if defined(STM32F469xx) || defined(STM32F479xx)
  514. /** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source
  515. * @{
  516. */
  517. #define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U
  518. #define RCC_CLK48CLKSOURCE_PLLSAIP ((uint32_t)RCC_DCKCFGR_CK48MSEL)
  519. /**
  520. * @}
  521. */
  522. /** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source
  523. * @{
  524. */
  525. #define RCC_SDIOCLKSOURCE_CLK48 0x00000000U
  526. #define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_SDIOSEL)
  527. /**
  528. * @}
  529. */
  530. /** @defgroup RCCEx_DSI_Clock_Source RCC DSI Clock Source
  531. * @{
  532. */
  533. #define RCC_DSICLKSOURCE_DSIPHY 0x00000000U
  534. #define RCC_DSICLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_DSISEL)
  535. /**
  536. * @}
  537. */
  538. #endif /* STM32F469xx || STM32F479xx */
  539. #if defined(STM32F446xx)
  540. /** @defgroup RCCEx_SAI1_Clock_Source RCC SAI1 Clock Source
  541. * @{
  542. */
  543. #define RCC_SAI1CLKSOURCE_PLLSAI 0x00000000U
  544. #define RCC_SAI1CLKSOURCE_PLLI2S ((uint32_t)RCC_DCKCFGR_SAI1SRC_0)
  545. #define RCC_SAI1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1SRC_1)
  546. #define RCC_SAI1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1SRC)
  547. /**
  548. * @}
  549. */
  550. /** @defgroup RCCEx_SAI2_Clock_Source RCC SAI2 Clock Source
  551. * @{
  552. */
  553. #define RCC_SAI2CLKSOURCE_PLLSAI 0x00000000U
  554. #define RCC_SAI2CLKSOURCE_PLLI2S ((uint32_t)RCC_DCKCFGR_SAI2SRC_0)
  555. #define RCC_SAI2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI2SRC_1)
  556. #define RCC_SAI2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI2SRC)
  557. /**
  558. * @}
  559. */
  560. /** @defgroup RCCEx_I2SAPB1_Clock_Source RCC I2S APB1 Clock Source
  561. * @{
  562. */
  563. #define RCC_I2SAPB1CLKSOURCE_PLLI2S 0x00000000U
  564. #define RCC_I2SAPB1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S1SRC_0)
  565. #define RCC_I2SAPB1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S1SRC_1)
  566. #define RCC_I2SAPB1CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S1SRC)
  567. /**
  568. * @}
  569. */
  570. /** @defgroup RCCEx_I2SAPB2_Clock_Source RCC I2S APB2 Clock Source
  571. * @{
  572. */
  573. #define RCC_I2SAPB2CLKSOURCE_PLLI2S 0x00000000U
  574. #define RCC_I2SAPB2CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S2SRC_0)
  575. #define RCC_I2SAPB2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S2SRC_1)
  576. #define RCC_I2SAPB2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S2SRC)
  577. /**
  578. * @}
  579. */
  580. /** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source
  581. * @{
  582. */
  583. #define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U
  584. #define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0)
  585. #define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1)
  586. /**
  587. * @}
  588. */
  589. /** @defgroup RCCEx_CEC_Clock_Source RCC CEC Clock Source
  590. * @{
  591. */
  592. #define RCC_CECCLKSOURCE_HSI 0x00000000U
  593. #define RCC_CECCLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_CECSEL)
  594. /**
  595. * @}
  596. */
  597. /** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source
  598. * @{
  599. */
  600. #define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U
  601. #define RCC_CLK48CLKSOURCE_PLLSAIP ((uint32_t)RCC_DCKCFGR2_CK48MSEL)
  602. /**
  603. * @}
  604. */
  605. /** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source
  606. * @{
  607. */
  608. #define RCC_SDIOCLKSOURCE_CLK48 0x00000000U
  609. #define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_SDIOSEL)
  610. /**
  611. * @}
  612. */
  613. /** @defgroup RCCEx_SPDIFRX_Clock_Source RCC SPDIFRX Clock Source
  614. * @{
  615. */
  616. #define RCC_SPDIFRXCLKSOURCE_PLLR 0x00000000U
  617. #define RCC_SPDIFRXCLKSOURCE_PLLI2SP ((uint32_t)RCC_DCKCFGR2_SPDIFRXSEL)
  618. /**
  619. * @}
  620. */
  621. #endif /* STM32F446xx */
  622. #if defined(STM32F413xx) || defined(STM32F423xx)
  623. /** @defgroup RCCEx_SAI1_BlockA_Clock_Source RCC SAI BlockA Clock Source
  624. * @{
  625. */
  626. #define RCC_SAIACLKSOURCE_PLLI2SR 0x00000000U
  627. #define RCC_SAIACLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1ASRC_0)
  628. #define RCC_SAIACLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1ASRC_1)
  629. #define RCC_SAIACLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI1ASRC_0 | RCC_DCKCFGR_SAI1ASRC_1)
  630. /**
  631. * @}
  632. */
  633. /** @defgroup RCCEx_SAI1_BlockB_Clock_Source RCC SAI BlockB Clock Source
  634. * @{
  635. */
  636. #define RCC_SAIBCLKSOURCE_PLLI2SR 0x00000000U
  637. #define RCC_SAIBCLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1BSRC_0)
  638. #define RCC_SAIBCLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1BSRC_1)
  639. #define RCC_SAIBCLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI1BSRC_0 | RCC_DCKCFGR_SAI1BSRC_1)
  640. /**
  641. * @}
  642. */
  643. /** @defgroup RCCEx_LPTIM1_Clock_Source RCC LPTIM1 Clock Source
  644. * @{
  645. */
  646. #define RCC_LPTIM1CLKSOURCE_PCLK1 0x00000000U
  647. #define RCC_LPTIM1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0)
  648. #define RCC_LPTIM1CLKSOURCE_LSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_1)
  649. #define RCC_LPTIM1CLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0 | RCC_DCKCFGR2_LPTIM1SEL_1)
  650. /**
  651. * @}
  652. */
  653. /** @defgroup RCCEx_DFSDM2_Audio_Clock_Source RCC DFSDM2 Audio Clock Source
  654. * @{
  655. */
  656. #define RCC_DFSDM2AUDIOCLKSOURCE_I2S1 0x00000000U
  657. #define RCC_DFSDM2AUDIOCLKSOURCE_I2S2 ((uint32_t)RCC_DCKCFGR_CKDFSDM2ASEL)
  658. /**
  659. * @}
  660. */
  661. /** @defgroup RCCEx_DFSDM2_Kernel_Clock_Source RCC DFSDM2 Kernel Clock Source
  662. * @{
  663. */
  664. #define RCC_DFSDM2CLKSOURCE_PCLK2 0x00000000U
  665. #define RCC_DFSDM2CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_CKDFSDM1SEL)
  666. /**
  667. * @}
  668. */
  669. #endif /* STM32F413xx || STM32F423xx */
  670. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  671. /** @defgroup RCCEx_PLL_I2S_Clock_Source PLL I2S Clock Source
  672. * @{
  673. */
  674. #define RCC_PLLI2SCLKSOURCE_PLLSRC 0x00000000U
  675. #define RCC_PLLI2SCLKSOURCE_EXT ((uint32_t)RCC_PLLI2SCFGR_PLLI2SSRC)
  676. /**
  677. * @}
  678. */
  679. /** @defgroup RCCEx_DFSDM1_Audio_Clock_Source RCC DFSDM1 Audio Clock Source
  680. * @{
  681. */
  682. #define RCC_DFSDM1AUDIOCLKSOURCE_I2S1 0x00000000U
  683. #define RCC_DFSDM1AUDIOCLKSOURCE_I2S2 ((uint32_t)RCC_DCKCFGR_CKDFSDM1ASEL)
  684. /**
  685. * @}
  686. */
  687. /** @defgroup RCCEx_DFSDM1_Kernel_Clock_Source RCC DFSDM1 Kernel Clock Source
  688. * @{
  689. */
  690. #define RCC_DFSDM1CLKSOURCE_PCLK2 0x00000000U
  691. #define RCC_DFSDM1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_CKDFSDM1SEL)
  692. /**
  693. * @}
  694. */
  695. /** @defgroup RCCEx_I2SAPB1_Clock_Source RCC I2S APB1 Clock Source
  696. * @{
  697. */
  698. #define RCC_I2SAPB1CLKSOURCE_PLLI2S 0x00000000U
  699. #define RCC_I2SAPB1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S1SRC_0)
  700. #define RCC_I2SAPB1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S1SRC_1)
  701. #define RCC_I2SAPB1CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S1SRC)
  702. /**
  703. * @}
  704. */
  705. /** @defgroup RCCEx_I2SAPB2_Clock_Source RCC I2S APB2 Clock Source
  706. * @{
  707. */
  708. #define RCC_I2SAPB2CLKSOURCE_PLLI2S 0x00000000U
  709. #define RCC_I2SAPB2CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S2SRC_0)
  710. #define RCC_I2SAPB2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S2SRC_1)
  711. #define RCC_I2SAPB2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S2SRC)
  712. /**
  713. * @}
  714. */
  715. /** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source
  716. * @{
  717. */
  718. #define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U
  719. #define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0)
  720. #define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1)
  721. /**
  722. * @}
  723. */
  724. /** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source
  725. * @{
  726. */
  727. #define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U
  728. #define RCC_CLK48CLKSOURCE_PLLI2SQ ((uint32_t)RCC_DCKCFGR2_CK48MSEL)
  729. /**
  730. * @}
  731. */
  732. /** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source
  733. * @{
  734. */
  735. #define RCC_SDIOCLKSOURCE_CLK48 0x00000000U
  736. #define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_SDIOSEL)
  737. /**
  738. * @}
  739. */
  740. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  741. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  742. /** @defgroup RCCEx_I2S_APB_Clock_Source RCC I2S APB Clock Source
  743. * @{
  744. */
  745. #define RCC_I2SAPBCLKSOURCE_PLLR 0x00000000U
  746. #define RCC_I2SAPBCLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2SSRC_0)
  747. #define RCC_I2SAPBCLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2SSRC_1)
  748. /**
  749. * @}
  750. */
  751. /** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source
  752. * @{
  753. */
  754. #define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U
  755. #define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0)
  756. #define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1)
  757. /**
  758. * @}
  759. */
  760. /** @defgroup RCCEx_LPTIM1_Clock_Source RCC LPTIM1 Clock Source
  761. * @{
  762. */
  763. #define RCC_LPTIM1CLKSOURCE_PCLK1 0x00000000U
  764. #define RCC_LPTIM1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0)
  765. #define RCC_LPTIM1CLKSOURCE_LSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_1)
  766. #define RCC_LPTIM1CLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0 | RCC_DCKCFGR2_LPTIM1SEL_1)
  767. /**
  768. * @}
  769. */
  770. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  771. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  772. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
  773. defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  774. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
  775. defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  776. /** @defgroup RCCEx_TIM_PRescaler_Selection RCC TIM PRescaler Selection
  777. * @{
  778. */
  779. #define RCC_TIMPRES_DESACTIVATED ((uint8_t)0x00)
  780. #define RCC_TIMPRES_ACTIVATED ((uint8_t)0x01)
  781. /**
  782. * @}
  783. */
  784. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
  785. STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
  786. STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  787. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\
  788. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
  789. defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
  790. defined(STM32F423xx)
  791. /** @defgroup RCCEx_LSE_Dual_Mode_Selection RCC LSE Dual Mode Selection
  792. * @{
  793. */
  794. #define RCC_LSE_LOWPOWER_MODE ((uint8_t)0x00)
  795. #define RCC_LSE_HIGHDRIVE_MODE ((uint8_t)0x01)
  796. /**
  797. * @}
  798. */
  799. #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||\
  800. STM32F412Rx || STM32F412Cx */
  801. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  802. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  803. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  804. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  805. defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  806. /** @defgroup RCC_MCO2_Clock_Source MCO2 Clock Source
  807. * @{
  808. */
  809. #define RCC_MCO2SOURCE_SYSCLK 0x00000000U
  810. #define RCC_MCO2SOURCE_PLLI2SCLK RCC_CFGR_MCO2_0
  811. #define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1
  812. #define RCC_MCO2SOURCE_PLLCLK RCC_CFGR_MCO2
  813. /**
  814. * @}
  815. */
  816. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  817. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  818. STM32F412Rx || STM32F413xx | STM32F423xx */
  819. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  820. /** @defgroup RCC_MCO2_Clock_Source MCO2 Clock Source
  821. * @{
  822. */
  823. #define RCC_MCO2SOURCE_SYSCLK 0x00000000U
  824. #define RCC_MCO2SOURCE_I2SCLK RCC_CFGR_MCO2_0
  825. #define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1
  826. #define RCC_MCO2SOURCE_PLLCLK RCC_CFGR_MCO2
  827. /**
  828. * @}
  829. */
  830. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  831. /**
  832. * @}
  833. */
  834. /* Exported macro ------------------------------------------------------------*/
  835. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  836. * @{
  837. */
  838. /*------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx --------*/
  839. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  840. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  841. * @brief Enables or disables the AHB1 peripheral clock.
  842. * @note After reset, the peripheral clock (used for registers read/write access)
  843. * is disabled and the application software has to enable this clock before
  844. * using it.
  845. * @{
  846. */
  847. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  848. __IO uint32_t tmpreg = 0x00U; \
  849. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  850. /* Delay after an RCC peripheral clock enabling */ \
  851. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  852. UNUSED(tmpreg); \
  853. } while(0U)
  854. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  855. __IO uint32_t tmpreg = 0x00U; \
  856. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  857. /* Delay after an RCC peripheral clock enabling */ \
  858. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  859. UNUSED(tmpreg); \
  860. } while(0U)
  861. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  862. __IO uint32_t tmpreg = 0x00U; \
  863. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  864. /* Delay after an RCC peripheral clock enabling */ \
  865. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  866. UNUSED(tmpreg); \
  867. } while(0U)
  868. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  869. __IO uint32_t tmpreg = 0x00U; \
  870. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  871. /* Delay after an RCC peripheral clock enabling */ \
  872. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  873. UNUSED(tmpreg); \
  874. } while(0U)
  875. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  876. __IO uint32_t tmpreg = 0x00U; \
  877. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  878. /* Delay after an RCC peripheral clock enabling */ \
  879. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  880. UNUSED(tmpreg); \
  881. } while(0U)
  882. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  883. __IO uint32_t tmpreg = 0x00U; \
  884. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  885. /* Delay after an RCC peripheral clock enabling */ \
  886. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  887. UNUSED(tmpreg); \
  888. } while(0U)
  889. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  890. __IO uint32_t tmpreg = 0x00U; \
  891. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  892. /* Delay after an RCC peripheral clock enabling */ \
  893. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  894. UNUSED(tmpreg); \
  895. } while(0U)
  896. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  897. __IO uint32_t tmpreg = 0x00U; \
  898. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  899. /* Delay after an RCC peripheral clock enabling */ \
  900. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  901. UNUSED(tmpreg); \
  902. } while(0U)
  903. #define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \
  904. __IO uint32_t tmpreg = 0x00U; \
  905. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  906. /* Delay after an RCC peripheral clock enabling */ \
  907. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  908. UNUSED(tmpreg); \
  909. } while(0U)
  910. #define __HAL_RCC_GPIOK_CLK_ENABLE() do { \
  911. __IO uint32_t tmpreg = 0x00U; \
  912. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  913. /* Delay after an RCC peripheral clock enabling */ \
  914. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  915. UNUSED(tmpreg); \
  916. } while(0U)
  917. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  918. __IO uint32_t tmpreg = 0x00U; \
  919. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  920. /* Delay after an RCC peripheral clock enabling */ \
  921. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  922. UNUSED(tmpreg); \
  923. } while(0U)
  924. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  925. __IO uint32_t tmpreg = 0x00U; \
  926. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  927. /* Delay after an RCC peripheral clock enabling */ \
  928. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  929. UNUSED(tmpreg); \
  930. } while(0U)
  931. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  932. __IO uint32_t tmpreg = 0x00U; \
  933. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  934. /* Delay after an RCC peripheral clock enabling */ \
  935. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  936. UNUSED(tmpreg); \
  937. } while(0U)
  938. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  939. __IO uint32_t tmpreg = 0x00U; \
  940. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  941. /* Delay after an RCC peripheral clock enabling */ \
  942. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  943. UNUSED(tmpreg); \
  944. } while(0U)
  945. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  946. __IO uint32_t tmpreg = 0x00U; \
  947. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  948. /* Delay after an RCC peripheral clock enabling */ \
  949. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  950. UNUSED(tmpreg); \
  951. } while(0U)
  952. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  953. __IO uint32_t tmpreg = 0x00U; \
  954. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  955. /* Delay after an RCC peripheral clock enabling */ \
  956. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  957. UNUSED(tmpreg); \
  958. } while(0U)
  959. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  960. __IO uint32_t tmpreg = 0x00U; \
  961. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  962. /* Delay after an RCC peripheral clock enabling */ \
  963. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  964. UNUSED(tmpreg); \
  965. } while(0U)
  966. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  967. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  968. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  969. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  970. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  971. #define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOJEN))
  972. #define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOKEN))
  973. #define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2DEN))
  974. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  975. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  976. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  977. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  978. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  979. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  980. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  981. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  982. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  983. /**
  984. * @brief Enable ETHERNET clock.
  985. */
  986. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  987. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  988. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  989. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  990. } while(0U)
  991. /**
  992. * @brief Disable ETHERNET clock.
  993. */
  994. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  995. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  996. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  997. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  998. } while(0U)
  999. /**
  1000. * @}
  1001. */
  1002. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  1003. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  1004. * @note After reset, the peripheral clock (used for registers read/write access)
  1005. * is disabled and the application software has to enable this clock before
  1006. * using it.
  1007. * @{
  1008. */
  1009. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1010. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1011. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1012. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1013. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1014. #define __HAL_RCC_GPIOJ_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) != RESET)
  1015. #define __HAL_RCC_GPIOK_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) != RESET)
  1016. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) != RESET)
  1017. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1018. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  1019. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  1020. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  1021. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1022. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1023. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1024. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  1025. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  1026. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  1027. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  1028. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  1029. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1030. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1031. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1032. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1033. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1034. #define __HAL_RCC_GPIOJ_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) == RESET)
  1035. #define __HAL_RCC_GPIOK_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) == RESET)
  1036. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) == RESET)
  1037. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  1038. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  1039. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  1040. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  1041. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1042. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  1043. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1044. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  1045. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  1046. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  1047. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  1048. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  1049. /**
  1050. * @}
  1051. */
  1052. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  1053. * @brief Enable or disable the AHB2 peripheral clock.
  1054. * @note After reset, the peripheral clock (used for registers read/write access)
  1055. * is disabled and the application software has to enable this clock before
  1056. * using it.
  1057. * @{
  1058. */
  1059. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  1060. __IO uint32_t tmpreg = 0x00U; \
  1061. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  1062. /* Delay after an RCC peripheral clock enabling */ \
  1063. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  1064. UNUSED(tmpreg); \
  1065. } while(0U)
  1066. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  1067. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1068. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  1069. __IO uint32_t tmpreg = 0x00U; \
  1070. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  1071. /* Delay after an RCC peripheral clock enabling */ \
  1072. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  1073. UNUSED(tmpreg); \
  1074. } while(0U)
  1075. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  1076. __IO uint32_t tmpreg = 0x00U; \
  1077. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  1078. /* Delay after an RCC peripheral clock enabling */ \
  1079. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  1080. UNUSED(tmpreg); \
  1081. } while(0U)
  1082. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  1083. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  1084. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1085. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  1086. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  1087. }while(0U)
  1088. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  1089. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  1090. __IO uint32_t tmpreg = 0x00U; \
  1091. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  1092. /* Delay after an RCC peripheral clock enabling */ \
  1093. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  1094. UNUSED(tmpreg); \
  1095. } while(0U)
  1096. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  1097. /**
  1098. * @}
  1099. */
  1100. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  1101. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  1102. * @note After reset, the peripheral clock (used for registers read/write access)
  1103. * is disabled and the application software has to enable this clock before
  1104. * using it.
  1105. * @{
  1106. */
  1107. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  1108. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  1109. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1110. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  1111. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  1112. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  1113. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  1114. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1115. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  1116. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  1117. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  1118. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  1119. /**
  1120. * @}
  1121. */
  1122. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  1123. * @brief Enables or disables the AHB3 peripheral clock.
  1124. * @note After reset, the peripheral clock (used for registers read/write access)
  1125. * is disabled and the application software has to enable this clock before
  1126. * using it.
  1127. * @{
  1128. */
  1129. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  1130. __IO uint32_t tmpreg = 0x00U; \
  1131. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  1132. /* Delay after an RCC peripheral clock enabling */ \
  1133. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  1134. UNUSED(tmpreg); \
  1135. } while(0U)
  1136. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  1137. #if defined(STM32F469xx) || defined(STM32F479xx)
  1138. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  1139. __IO uint32_t tmpreg = 0x00U; \
  1140. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  1141. /* Delay after an RCC peripheral clock enabling */ \
  1142. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  1143. UNUSED(tmpreg); \
  1144. } while(0U)
  1145. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  1146. #endif /* STM32F469xx || STM32F479xx */
  1147. /**
  1148. * @}
  1149. */
  1150. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  1151. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  1152. * @note After reset, the peripheral clock (used for registers read/write access)
  1153. * is disabled and the application software has to enable this clock before
  1154. * using it.
  1155. * @{
  1156. */
  1157. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  1158. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  1159. #if defined(STM32F469xx) || defined(STM32F479xx)
  1160. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  1161. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  1162. #endif /* STM32F469xx || STM32F479xx */
  1163. /**
  1164. * @}
  1165. */
  1166. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  1167. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  1168. * @note After reset, the peripheral clock (used for registers read/write access)
  1169. * is disabled and the application software has to enable this clock before
  1170. * using it.
  1171. * @{
  1172. */
  1173. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  1174. __IO uint32_t tmpreg = 0x00U; \
  1175. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  1176. /* Delay after an RCC peripheral clock enabling */ \
  1177. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  1178. UNUSED(tmpreg); \
  1179. } while(0U)
  1180. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  1181. __IO uint32_t tmpreg = 0x00U; \
  1182. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  1183. /* Delay after an RCC peripheral clock enabling */ \
  1184. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  1185. UNUSED(tmpreg); \
  1186. } while(0U)
  1187. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  1188. __IO uint32_t tmpreg = 0x00U; \
  1189. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  1190. /* Delay after an RCC peripheral clock enabling */ \
  1191. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  1192. UNUSED(tmpreg); \
  1193. } while(0U)
  1194. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  1195. __IO uint32_t tmpreg = 0x00U; \
  1196. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  1197. /* Delay after an RCC peripheral clock enabling */ \
  1198. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  1199. UNUSED(tmpreg); \
  1200. } while(0U)
  1201. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  1202. __IO uint32_t tmpreg = 0x00U; \
  1203. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1204. /* Delay after an RCC peripheral clock enabling */ \
  1205. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1206. UNUSED(tmpreg); \
  1207. } while(0U)
  1208. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  1209. __IO uint32_t tmpreg = 0x00U; \
  1210. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1211. /* Delay after an RCC peripheral clock enabling */ \
  1212. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1213. UNUSED(tmpreg); \
  1214. } while(0U)
  1215. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  1216. __IO uint32_t tmpreg = 0x00U; \
  1217. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  1218. /* Delay after an RCC peripheral clock enabling */ \
  1219. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  1220. UNUSED(tmpreg); \
  1221. } while(0U)
  1222. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  1223. __IO uint32_t tmpreg = 0x00U; \
  1224. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  1225. /* Delay after an RCC peripheral clock enabling */ \
  1226. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  1227. UNUSED(tmpreg); \
  1228. } while(0U)
  1229. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  1230. __IO uint32_t tmpreg = 0x00U; \
  1231. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  1232. /* Delay after an RCC peripheral clock enabling */ \
  1233. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  1234. UNUSED(tmpreg); \
  1235. } while(0U)
  1236. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  1237. __IO uint32_t tmpreg = 0x00U; \
  1238. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  1239. /* Delay after an RCC peripheral clock enabling */ \
  1240. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  1241. UNUSED(tmpreg); \
  1242. } while(0U)
  1243. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  1244. __IO uint32_t tmpreg = 0x00U; \
  1245. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  1246. /* Delay after an RCC peripheral clock enabling */ \
  1247. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  1248. UNUSED(tmpreg); \
  1249. } while(0U)
  1250. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  1251. __IO uint32_t tmpreg = 0x00U; \
  1252. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  1253. /* Delay after an RCC peripheral clock enabling */ \
  1254. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  1255. UNUSED(tmpreg); \
  1256. } while(0U)
  1257. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  1258. __IO uint32_t tmpreg = 0x00U; \
  1259. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  1260. /* Delay after an RCC peripheral clock enabling */ \
  1261. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  1262. UNUSED(tmpreg); \
  1263. } while(0U)
  1264. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  1265. __IO uint32_t tmpreg = 0x00U; \
  1266. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  1267. /* Delay after an RCC peripheral clock enabling */ \
  1268. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  1269. UNUSED(tmpreg); \
  1270. } while(0U)
  1271. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  1272. __IO uint32_t tmpreg = 0x00U; \
  1273. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  1274. /* Delay after an RCC peripheral clock enabling */ \
  1275. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  1276. UNUSED(tmpreg); \
  1277. } while(0U)
  1278. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  1279. __IO uint32_t tmpreg = 0x00U; \
  1280. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  1281. /* Delay after an RCC peripheral clock enabling */ \
  1282. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  1283. UNUSED(tmpreg); \
  1284. } while(0U)
  1285. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  1286. __IO uint32_t tmpreg = 0x00U; \
  1287. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  1288. /* Delay after an RCC peripheral clock enabling */ \
  1289. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  1290. UNUSED(tmpreg); \
  1291. } while(0U)
  1292. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  1293. __IO uint32_t tmpreg = 0x00U; \
  1294. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  1295. /* Delay after an RCC peripheral clock enabling */ \
  1296. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  1297. UNUSED(tmpreg); \
  1298. } while(0U)
  1299. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  1300. __IO uint32_t tmpreg = 0x00U; \
  1301. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  1302. /* Delay after an RCC peripheral clock enabling */ \
  1303. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  1304. UNUSED(tmpreg); \
  1305. } while(0U)
  1306. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  1307. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  1308. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  1309. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  1310. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  1311. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  1312. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  1313. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  1314. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  1315. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  1316. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  1317. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  1318. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  1319. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  1320. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  1321. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  1322. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  1323. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  1324. /**
  1325. * @}
  1326. */
  1327. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  1328. * @brief Get the enable or disable status of the APB1 peripheral clock.
  1329. * @note After reset, the peripheral clock (used for registers read/write access)
  1330. * is disabled and the application software has to enable this clock before
  1331. * using it.
  1332. * @{
  1333. */
  1334. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  1335. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  1336. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  1337. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  1338. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  1339. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  1340. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  1341. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  1342. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  1343. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  1344. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  1345. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  1346. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  1347. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  1348. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  1349. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  1350. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  1351. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  1352. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  1353. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  1354. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  1355. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  1356. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  1357. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  1358. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  1359. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  1360. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  1361. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  1362. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  1363. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  1364. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  1365. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  1366. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  1367. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  1368. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  1369. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  1370. /**
  1371. * @}
  1372. */
  1373. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  1374. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  1375. * @note After reset, the peripheral clock (used for registers read/write access)
  1376. * is disabled and the application software has to enable this clock before
  1377. * using it.
  1378. * @{
  1379. */
  1380. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1381. __IO uint32_t tmpreg = 0x00U; \
  1382. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1383. /* Delay after an RCC peripheral clock enabling */ \
  1384. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1385. UNUSED(tmpreg); \
  1386. } while(0U)
  1387. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  1388. __IO uint32_t tmpreg = 0x00U; \
  1389. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1390. /* Delay after an RCC peripheral clock enabling */ \
  1391. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1392. UNUSED(tmpreg); \
  1393. } while(0U)
  1394. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  1395. __IO uint32_t tmpreg = 0x00U; \
  1396. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1397. /* Delay after an RCC peripheral clock enabling */ \
  1398. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1399. UNUSED(tmpreg); \
  1400. } while(0U)
  1401. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  1402. __IO uint32_t tmpreg = 0x00U; \
  1403. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1404. /* Delay after an RCC peripheral clock enabling */ \
  1405. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1406. UNUSED(tmpreg); \
  1407. } while(0U)
  1408. #define __HAL_RCC_SPI6_CLK_ENABLE() do { \
  1409. __IO uint32_t tmpreg = 0x00U; \
  1410. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1411. /* Delay after an RCC peripheral clock enabling */ \
  1412. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1413. UNUSED(tmpreg); \
  1414. } while(0U)
  1415. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1416. __IO uint32_t tmpreg = 0x00U; \
  1417. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1418. /* Delay after an RCC peripheral clock enabling */ \
  1419. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1420. UNUSED(tmpreg); \
  1421. } while(0U)
  1422. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  1423. __IO uint32_t tmpreg = 0x00U; \
  1424. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  1425. /* Delay after an RCC peripheral clock enabling */ \
  1426. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  1427. UNUSED(tmpreg); \
  1428. } while(0U)
  1429. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  1430. __IO uint32_t tmpreg = 0x00U; \
  1431. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1432. /* Delay after an RCC peripheral clock enabling */ \
  1433. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1434. UNUSED(tmpreg); \
  1435. } while(0U)
  1436. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  1437. __IO uint32_t tmpreg = 0x00U; \
  1438. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1439. /* Delay after an RCC peripheral clock enabling */ \
  1440. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1441. UNUSED(tmpreg); \
  1442. } while(0U)
  1443. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  1444. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  1445. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  1446. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  1447. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  1448. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  1449. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  1450. #define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI6EN))
  1451. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  1452. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1453. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  1454. __IO uint32_t tmpreg = 0x00U; \
  1455. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1456. /* Delay after an RCC peripheral clock enabling */ \
  1457. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1458. UNUSED(tmpreg); \
  1459. } while(0U)
  1460. #define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_LTDCEN))
  1461. #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  1462. #if defined(STM32F469xx) || defined(STM32F479xx)
  1463. #define __HAL_RCC_DSI_CLK_ENABLE() do { \
  1464. __IO uint32_t tmpreg = 0x00U; \
  1465. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1466. /* Delay after an RCC peripheral clock enabling */ \
  1467. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1468. UNUSED(tmpreg); \
  1469. } while(0U)
  1470. #define __HAL_RCC_DSI_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DSIEN))
  1471. #endif /* STM32F469xx || STM32F479xx */
  1472. /**
  1473. * @}
  1474. */
  1475. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  1476. * @brief Get the enable or disable status of the APB2 peripheral clock.
  1477. * @note After reset, the peripheral clock (used for registers read/write access)
  1478. * is disabled and the application software has to enable this clock before
  1479. * using it.
  1480. * @{
  1481. */
  1482. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  1483. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  1484. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  1485. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  1486. #define __HAL_RCC_SPI6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) != RESET)
  1487. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  1488. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  1489. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  1490. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN))!= RESET)
  1491. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  1492. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  1493. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN))== RESET)
  1494. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  1495. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  1496. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  1497. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  1498. #define __HAL_RCC_SPI6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) == RESET)
  1499. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  1500. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1501. #define __HAL_RCC_LTDC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) != RESET)
  1502. #define __HAL_RCC_LTDC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) == RESET)
  1503. #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  1504. #if defined(STM32F469xx) || defined(STM32F479xx)
  1505. #define __HAL_RCC_DSI_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) != RESET)
  1506. #define __HAL_RCC_DSI_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) == RESET)
  1507. #endif /* STM32F469xx || STM32F479xx */
  1508. /**
  1509. * @}
  1510. */
  1511. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  1512. * @brief Force or release AHB1 peripheral reset.
  1513. * @{
  1514. */
  1515. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  1516. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  1517. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  1518. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  1519. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  1520. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  1521. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  1522. #define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOJRST))
  1523. #define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOKRST))
  1524. #define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2DRST))
  1525. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  1526. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  1527. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  1528. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  1529. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  1530. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  1531. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  1532. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  1533. #define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOJRST))
  1534. #define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOKRST))
  1535. #define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2DRST))
  1536. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  1537. /**
  1538. * @}
  1539. */
  1540. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  1541. * @brief Force or release AHB2 peripheral reset.
  1542. * @{
  1543. */
  1544. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  1545. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  1546. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  1547. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  1548. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  1549. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  1550. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  1551. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  1552. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1553. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  1554. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  1555. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  1556. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  1557. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1558. /**
  1559. * @}
  1560. */
  1561. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  1562. * @brief Force or release AHB3 peripheral reset.
  1563. * @{
  1564. */
  1565. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  1566. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  1567. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  1568. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  1569. #if defined(STM32F469xx) || defined(STM32F479xx)
  1570. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  1571. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  1572. #endif /* STM32F469xx || STM32F479xx */
  1573. /**
  1574. * @}
  1575. */
  1576. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  1577. * @brief Force or release APB1 peripheral reset.
  1578. * @{
  1579. */
  1580. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  1581. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  1582. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  1583. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  1584. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  1585. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  1586. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  1587. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  1588. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  1589. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  1590. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  1591. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  1592. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  1593. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  1594. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  1595. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  1596. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  1597. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  1598. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  1599. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  1600. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  1601. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  1602. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  1603. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  1604. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  1605. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  1606. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  1607. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  1608. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  1609. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  1610. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  1611. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  1612. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  1613. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  1614. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  1615. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  1616. /**
  1617. * @}
  1618. */
  1619. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  1620. * @brief Force or release APB2 peripheral reset.
  1621. * @{
  1622. */
  1623. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  1624. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  1625. #define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI6RST))
  1626. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  1627. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  1628. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  1629. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  1630. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  1631. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  1632. #define __HAL_RCC_TIM10_RELEASE_RESET()(RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  1633. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  1634. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  1635. #define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI6RST))
  1636. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  1637. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1638. #define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_LTDCRST))
  1639. #define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_LTDCRST))
  1640. #endif /* STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
  1641. #if defined(STM32F469xx) || defined(STM32F479xx)
  1642. #define __HAL_RCC_DSI_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DSIRST))
  1643. #define __HAL_RCC_DSI_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DSIRST))
  1644. #endif /* STM32F469xx || STM32F479xx */
  1645. /**
  1646. * @}
  1647. */
  1648. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  1649. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1650. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1651. * power consumption.
  1652. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1653. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1654. * @{
  1655. */
  1656. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  1657. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  1658. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  1659. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  1660. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  1661. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  1662. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  1663. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  1664. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  1665. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  1666. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  1667. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  1668. #define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOJLPEN))
  1669. #define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOKLPEN))
  1670. #define __HAL_RCC_SRAM3_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM3LPEN))
  1671. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2DLPEN))
  1672. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  1673. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  1674. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  1675. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  1676. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  1677. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  1678. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  1679. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  1680. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  1681. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  1682. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  1683. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  1684. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  1685. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  1686. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  1687. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  1688. #define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOJLPEN))
  1689. #define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOKLPEN))
  1690. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2DLPEN))
  1691. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  1692. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  1693. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  1694. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  1695. /**
  1696. * @}
  1697. */
  1698. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  1699. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1700. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1701. * power consumption.
  1702. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  1703. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1704. * @{
  1705. */
  1706. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  1707. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  1708. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  1709. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  1710. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  1711. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  1712. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1713. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  1714. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  1715. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  1716. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  1717. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1718. /**
  1719. * @}
  1720. */
  1721. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  1722. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1723. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1724. * power consumption.
  1725. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1726. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1727. * @{
  1728. */
  1729. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  1730. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  1731. #if defined(STM32F469xx) || defined(STM32F479xx)
  1732. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  1733. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  1734. #endif /* STM32F469xx || STM32F479xx */
  1735. /**
  1736. * @}
  1737. */
  1738. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  1739. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1740. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1741. * power consumption.
  1742. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1743. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1744. * @{
  1745. */
  1746. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  1747. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  1748. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  1749. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  1750. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  1751. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  1752. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  1753. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  1754. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  1755. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  1756. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  1757. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  1758. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  1759. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  1760. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  1761. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  1762. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  1763. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  1764. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  1765. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  1766. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  1767. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  1768. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  1769. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  1770. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  1771. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  1772. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  1773. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  1774. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  1775. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  1776. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  1777. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  1778. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  1779. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  1780. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  1781. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  1782. /**
  1783. * @}
  1784. */
  1785. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  1786. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1787. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1788. * power consumption.
  1789. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1790. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1791. * @{
  1792. */
  1793. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  1794. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  1795. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  1796. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  1797. #define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI6LPEN))
  1798. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  1799. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  1800. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  1801. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  1802. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  1803. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  1804. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  1805. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  1806. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  1807. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  1808. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  1809. #define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI6LPEN))
  1810. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  1811. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1812. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_LTDCLPEN))
  1813. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_LTDCLPEN))
  1814. #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  1815. #if defined(STM32F469xx) || defined(STM32F479xx)
  1816. #define __HAL_RCC_DSI_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DSILPEN))
  1817. #define __HAL_RCC_DSI_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DSILPEN))
  1818. #endif /* STM32F469xx || STM32F479xx */
  1819. /**
  1820. * @}
  1821. */
  1822. #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
  1823. /*----------------------------------------------------------------------------*/
  1824. /*----------------------------------- STM32F40xxx/STM32F41xxx-----------------*/
  1825. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
  1826. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  1827. * @brief Enables or disables the AHB1 peripheral clock.
  1828. * @note After reset, the peripheral clock (used for registers read/write access)
  1829. * is disabled and the application software has to enable this clock before
  1830. * using it.
  1831. * @{
  1832. */
  1833. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  1834. __IO uint32_t tmpreg = 0x00U; \
  1835. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  1836. /* Delay after an RCC peripheral clock enabling */ \
  1837. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  1838. UNUSED(tmpreg); \
  1839. } while(0U)
  1840. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  1841. __IO uint32_t tmpreg = 0x00U; \
  1842. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  1843. /* Delay after an RCC peripheral clock enabling */ \
  1844. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  1845. UNUSED(tmpreg); \
  1846. } while(0U)
  1847. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  1848. __IO uint32_t tmpreg = 0x00U; \
  1849. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  1850. /* Delay after an RCC peripheral clock enabling */ \
  1851. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  1852. UNUSED(tmpreg); \
  1853. } while(0U)
  1854. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  1855. __IO uint32_t tmpreg = 0x00U; \
  1856. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  1857. /* Delay after an RCC peripheral clock enabling */ \
  1858. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  1859. UNUSED(tmpreg); \
  1860. } while(0U)
  1861. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  1862. __IO uint32_t tmpreg = 0x00U; \
  1863. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  1864. /* Delay after an RCC peripheral clock enabling */ \
  1865. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  1866. UNUSED(tmpreg); \
  1867. } while(0U)
  1868. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  1869. __IO uint32_t tmpreg = 0x00U; \
  1870. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  1871. /* Delay after an RCC peripheral clock enabling */ \
  1872. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  1873. UNUSED(tmpreg); \
  1874. } while(0U)
  1875. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  1876. __IO uint32_t tmpreg = 0x00U; \
  1877. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  1878. /* Delay after an RCC peripheral clock enabling */ \
  1879. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  1880. UNUSED(tmpreg); \
  1881. } while(0U)
  1882. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  1883. __IO uint32_t tmpreg = 0x00U; \
  1884. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  1885. /* Delay after an RCC peripheral clock enabling */ \
  1886. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  1887. UNUSED(tmpreg); \
  1888. } while(0U)
  1889. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  1890. __IO uint32_t tmpreg = 0x00U; \
  1891. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  1892. /* Delay after an RCC peripheral clock enabling */ \
  1893. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  1894. UNUSED(tmpreg); \
  1895. } while(0U)
  1896. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  1897. __IO uint32_t tmpreg = 0x00U; \
  1898. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  1899. /* Delay after an RCC peripheral clock enabling */ \
  1900. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  1901. UNUSED(tmpreg); \
  1902. } while(0U)
  1903. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  1904. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  1905. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  1906. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  1907. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  1908. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  1909. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  1910. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  1911. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  1912. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  1913. #if defined(STM32F407xx)|| defined(STM32F417xx)
  1914. /**
  1915. * @brief Enable ETHERNET clock.
  1916. */
  1917. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  1918. __IO uint32_t tmpreg = 0x00U; \
  1919. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  1920. /* Delay after an RCC peripheral clock enabling */ \
  1921. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  1922. UNUSED(tmpreg); \
  1923. } while(0U)
  1924. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  1925. __IO uint32_t tmpreg = 0x00U; \
  1926. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  1927. /* Delay after an RCC peripheral clock enabling */ \
  1928. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  1929. UNUSED(tmpreg); \
  1930. } while(0U)
  1931. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  1932. __IO uint32_t tmpreg = 0x00U; \
  1933. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  1934. /* Delay after an RCC peripheral clock enabling */ \
  1935. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  1936. UNUSED(tmpreg); \
  1937. } while(0U)
  1938. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  1939. __IO uint32_t tmpreg = 0x00U; \
  1940. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  1941. /* Delay after an RCC peripheral clock enabling */ \
  1942. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  1943. UNUSED(tmpreg); \
  1944. } while(0U)
  1945. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  1946. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  1947. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  1948. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  1949. } while(0U)
  1950. /**
  1951. * @brief Disable ETHERNET clock.
  1952. */
  1953. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  1954. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  1955. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  1956. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  1957. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  1958. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  1959. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  1960. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  1961. } while(0U)
  1962. #endif /* STM32F407xx || STM32F417xx */
  1963. /**
  1964. * @}
  1965. */
  1966. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  1967. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  1968. * @note After reset, the peripheral clock (used for registers read/write access)
  1969. * is disabled and the application software has to enable this clock before
  1970. * using it.
  1971. * @{
  1972. */
  1973. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1974. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  1975. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  1976. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1977. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1978. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1979. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1980. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1981. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1982. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1983. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1984. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1985. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1986. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1987. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1988. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1989. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN))== RESET)
  1990. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1991. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  1992. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  1993. #if defined(STM32F407xx)|| defined(STM32F417xx)
  1994. /**
  1995. * @brief Enable ETHERNET clock.
  1996. */
  1997. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1998. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  1999. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  2000. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  2001. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  2002. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  2003. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  2004. /**
  2005. * @brief Disable ETHERNET clock.
  2006. */
  2007. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  2008. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  2009. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  2010. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  2011. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  2012. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  2013. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  2014. #endif /* STM32F407xx || STM32F417xx */
  2015. /**
  2016. * @}
  2017. */
  2018. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  2019. * @brief Enable or disable the AHB2 peripheral clock.
  2020. * @note After reset, the peripheral clock (used for registers read/write access)
  2021. * is disabled and the application software has to enable this clock before
  2022. * using it.
  2023. * @{
  2024. */
  2025. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  2026. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  2027. }while(0U)
  2028. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  2029. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  2030. __IO uint32_t tmpreg = 0x00U; \
  2031. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  2032. /* Delay after an RCC peripheral clock enabling */ \
  2033. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  2034. UNUSED(tmpreg); \
  2035. } while(0U)
  2036. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  2037. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2038. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  2039. __IO uint32_t tmpreg = 0x00U; \
  2040. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  2041. /* Delay after an RCC peripheral clock enabling */ \
  2042. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  2043. UNUSED(tmpreg); \
  2044. } while(0U)
  2045. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  2046. #endif /* STM32F407xx || STM32F417xx */
  2047. #if defined(STM32F415xx) || defined(STM32F417xx)
  2048. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  2049. __IO uint32_t tmpreg = 0x00U; \
  2050. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  2051. /* Delay after an RCC peripheral clock enabling */ \
  2052. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  2053. UNUSED(tmpreg); \
  2054. } while(0U)
  2055. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  2056. __IO uint32_t tmpreg = 0x00U; \
  2057. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  2058. /* Delay after an RCC peripheral clock enabling */ \
  2059. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  2060. UNUSED(tmpreg); \
  2061. } while(0U)
  2062. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  2063. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  2064. #endif /* STM32F415xx || STM32F417xx */
  2065. /**
  2066. * @}
  2067. */
  2068. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  2069. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  2070. * @note After reset, the peripheral clock (used for registers read/write access)
  2071. * is disabled and the application software has to enable this clock before
  2072. * using it.
  2073. * @{
  2074. */
  2075. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  2076. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  2077. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  2078. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  2079. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2080. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  2081. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  2082. #endif /* STM32F407xx || STM32F417xx */
  2083. #if defined(STM32F415xx) || defined(STM32F417xx)
  2084. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  2085. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  2086. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  2087. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  2088. #endif /* STM32F415xx || STM32F417xx */
  2089. /**
  2090. * @}
  2091. */
  2092. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  2093. * @brief Enables or disables the AHB3 peripheral clock.
  2094. * @note After reset, the peripheral clock (used for registers read/write access)
  2095. * is disabled and the application software has to enable this clock before
  2096. * using it.
  2097. * @{
  2098. */
  2099. #define __HAL_RCC_FSMC_CLK_ENABLE() do { \
  2100. __IO uint32_t tmpreg = 0x00U; \
  2101. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  2102. /* Delay after an RCC peripheral clock enabling */ \
  2103. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  2104. UNUSED(tmpreg); \
  2105. } while(0U)
  2106. #define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FSMCEN))
  2107. /**
  2108. * @}
  2109. */
  2110. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  2111. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  2112. * @note After reset, the peripheral clock (used for registers read/write access)
  2113. * is disabled and the application software has to enable this clock before
  2114. * using it.
  2115. * @{
  2116. */
  2117. #define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) != RESET)
  2118. #define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) == RESET)
  2119. /**
  2120. * @}
  2121. */
  2122. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  2123. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  2124. * @note After reset, the peripheral clock (used for registers read/write access)
  2125. * is disabled and the application software has to enable this clock before
  2126. * using it.
  2127. * @{
  2128. */
  2129. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  2130. __IO uint32_t tmpreg = 0x00U; \
  2131. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  2132. /* Delay after an RCC peripheral clock enabling */ \
  2133. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  2134. UNUSED(tmpreg); \
  2135. } while(0U)
  2136. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  2137. __IO uint32_t tmpreg = 0x00U; \
  2138. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  2139. /* Delay after an RCC peripheral clock enabling */ \
  2140. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  2141. UNUSED(tmpreg); \
  2142. } while(0U)
  2143. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  2144. __IO uint32_t tmpreg = 0x00U; \
  2145. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  2146. /* Delay after an RCC peripheral clock enabling */ \
  2147. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  2148. UNUSED(tmpreg); \
  2149. } while(0U)
  2150. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  2151. __IO uint32_t tmpreg = 0x00U; \
  2152. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  2153. /* Delay after an RCC peripheral clock enabling */ \
  2154. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  2155. UNUSED(tmpreg); \
  2156. } while(0U)
  2157. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  2158. __IO uint32_t tmpreg = 0x00U; \
  2159. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  2160. /* Delay after an RCC peripheral clock enabling */ \
  2161. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  2162. UNUSED(tmpreg); \
  2163. } while(0U)
  2164. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  2165. __IO uint32_t tmpreg = 0x00U; \
  2166. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  2167. /* Delay after an RCC peripheral clock enabling */ \
  2168. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  2169. UNUSED(tmpreg); \
  2170. } while(0U)
  2171. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  2172. __IO uint32_t tmpreg = 0x00U; \
  2173. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  2174. /* Delay after an RCC peripheral clock enabling */ \
  2175. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  2176. UNUSED(tmpreg); \
  2177. } while(0U)
  2178. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  2179. __IO uint32_t tmpreg = 0x00U; \
  2180. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  2181. /* Delay after an RCC peripheral clock enabling */ \
  2182. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  2183. UNUSED(tmpreg); \
  2184. } while(0U)
  2185. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  2186. __IO uint32_t tmpreg = 0x00U; \
  2187. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  2188. /* Delay after an RCC peripheral clock enabling */ \
  2189. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  2190. UNUSED(tmpreg); \
  2191. } while(0U)
  2192. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  2193. __IO uint32_t tmpreg = 0x00U; \
  2194. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  2195. /* Delay after an RCC peripheral clock enabling */ \
  2196. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  2197. UNUSED(tmpreg); \
  2198. } while(0U)
  2199. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  2200. __IO uint32_t tmpreg = 0x00U; \
  2201. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  2202. /* Delay after an RCC peripheral clock enabling */ \
  2203. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  2204. UNUSED(tmpreg); \
  2205. } while(0U)
  2206. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  2207. __IO uint32_t tmpreg = 0x00U; \
  2208. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2209. /* Delay after an RCC peripheral clock enabling */ \
  2210. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2211. UNUSED(tmpreg); \
  2212. } while(0U)
  2213. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  2214. __IO uint32_t tmpreg = 0x00U; \
  2215. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2216. /* Delay after an RCC peripheral clock enabling */ \
  2217. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2218. UNUSED(tmpreg); \
  2219. } while(0U)
  2220. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  2221. __IO uint32_t tmpreg = 0x00U; \
  2222. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2223. /* Delay after an RCC peripheral clock enabling */ \
  2224. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2225. UNUSED(tmpreg); \
  2226. } while(0U)
  2227. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  2228. __IO uint32_t tmpreg = 0x00U; \
  2229. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2230. /* Delay after an RCC peripheral clock enabling */ \
  2231. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2232. UNUSED(tmpreg); \
  2233. } while(0U)
  2234. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  2235. __IO uint32_t tmpreg = 0x00U; \
  2236. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2237. /* Delay after an RCC peripheral clock enabling */ \
  2238. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2239. UNUSED(tmpreg); \
  2240. } while(0U)
  2241. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  2242. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  2243. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  2244. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  2245. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  2246. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  2247. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  2248. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  2249. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  2250. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  2251. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  2252. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  2253. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  2254. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  2255. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  2256. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  2257. /**
  2258. * @}
  2259. */
  2260. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  2261. * @brief Get the enable or disable status of the APB1 peripheral clock.
  2262. * @note After reset, the peripheral clock (used for registers read/write access)
  2263. * is disabled and the application software has to enable this clock before
  2264. * using it.
  2265. * @{
  2266. */
  2267. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  2268. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  2269. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  2270. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  2271. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  2272. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  2273. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  2274. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  2275. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  2276. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  2277. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  2278. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  2279. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  2280. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  2281. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  2282. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  2283. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  2284. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  2285. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  2286. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  2287. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  2288. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  2289. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  2290. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  2291. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  2292. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  2293. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  2294. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  2295. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  2296. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  2297. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  2298. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  2299. /**
  2300. * @}
  2301. */
  2302. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  2303. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  2304. * @note After reset, the peripheral clock (used for registers read/write access)
  2305. * is disabled and the application software has to enable this clock before
  2306. * using it.
  2307. * @{
  2308. */
  2309. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  2310. __IO uint32_t tmpreg = 0x00U; \
  2311. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  2312. /* Delay after an RCC peripheral clock enabling */ \
  2313. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  2314. UNUSED(tmpreg); \
  2315. } while(0U)
  2316. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  2317. __IO uint32_t tmpreg = 0x00U; \
  2318. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  2319. /* Delay after an RCC peripheral clock enabling */ \
  2320. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  2321. UNUSED(tmpreg); \
  2322. } while(0U)
  2323. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  2324. __IO uint32_t tmpreg = 0x00U; \
  2325. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  2326. /* Delay after an RCC peripheral clock enabling */ \
  2327. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  2328. UNUSED(tmpreg); \
  2329. } while(0U)
  2330. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  2331. __IO uint32_t tmpreg = 0x00U; \
  2332. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2333. /* Delay after an RCC peripheral clock enabling */ \
  2334. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2335. UNUSED(tmpreg); \
  2336. } while(0U)
  2337. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  2338. __IO uint32_t tmpreg = 0x00U; \
  2339. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2340. /* Delay after an RCC peripheral clock enabling */ \
  2341. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2342. UNUSED(tmpreg); \
  2343. } while(0U)
  2344. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  2345. __IO uint32_t tmpreg = 0x00U; \
  2346. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2347. /* Delay after an RCC peripheral clock enabling */ \
  2348. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2349. UNUSED(tmpreg); \
  2350. } while(0U)
  2351. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  2352. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  2353. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  2354. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  2355. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  2356. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  2357. /**
  2358. * @}
  2359. */
  2360. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  2361. * @brief Get the enable or disable status of the APB2 peripheral clock.
  2362. * @note After reset, the peripheral clock (used for registers read/write access)
  2363. * is disabled and the application software has to enable this clock before
  2364. * using it.
  2365. * @{
  2366. */
  2367. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  2368. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  2369. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  2370. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  2371. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  2372. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  2373. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  2374. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  2375. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  2376. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  2377. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  2378. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  2379. /**
  2380. * @}
  2381. */
  2382. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  2383. * @brief Force or release AHB1 peripheral reset.
  2384. * @{
  2385. */
  2386. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  2387. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  2388. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  2389. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  2390. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  2391. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  2392. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  2393. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  2394. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  2395. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  2396. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  2397. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  2398. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  2399. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  2400. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  2401. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  2402. /**
  2403. * @}
  2404. */
  2405. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  2406. * @brief Force or release AHB2 peripheral reset.
  2407. * @{
  2408. */
  2409. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  2410. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  2411. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2412. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  2413. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  2414. #endif /* STM32F407xx || STM32F417xx */
  2415. #if defined(STM32F415xx) || defined(STM32F417xx)
  2416. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  2417. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  2418. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  2419. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  2420. #endif /* STM32F415xx || STM32F417xx */
  2421. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  2422. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  2423. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  2424. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  2425. /**
  2426. * @}
  2427. */
  2428. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  2429. * @brief Force or release AHB3 peripheral reset.
  2430. * @{
  2431. */
  2432. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  2433. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  2434. #define __HAL_RCC_FSMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FSMCRST))
  2435. #define __HAL_RCC_FSMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FSMCRST))
  2436. /**
  2437. * @}
  2438. */
  2439. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  2440. * @brief Force or release APB1 peripheral reset.
  2441. * @{
  2442. */
  2443. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  2444. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  2445. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  2446. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  2447. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  2448. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  2449. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  2450. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  2451. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  2452. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  2453. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  2454. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  2455. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  2456. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  2457. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  2458. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  2459. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  2460. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  2461. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  2462. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  2463. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  2464. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  2465. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  2466. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  2467. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  2468. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  2469. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  2470. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  2471. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  2472. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  2473. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  2474. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  2475. /**
  2476. * @}
  2477. */
  2478. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  2479. * @brief Force or release APB2 peripheral reset.
  2480. * @{
  2481. */
  2482. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  2483. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  2484. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  2485. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  2486. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  2487. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  2488. #define __HAL_RCC_TIM10_RELEASE_RESET()(RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  2489. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  2490. /**
  2491. * @}
  2492. */
  2493. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  2494. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  2495. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2496. * power consumption.
  2497. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2498. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2499. * @{
  2500. */
  2501. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  2502. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  2503. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  2504. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  2505. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  2506. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  2507. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  2508. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  2509. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  2510. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  2511. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  2512. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  2513. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  2514. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  2515. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  2516. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  2517. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  2518. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  2519. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  2520. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  2521. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  2522. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  2523. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  2524. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  2525. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  2526. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  2527. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  2528. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  2529. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  2530. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  2531. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  2532. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  2533. /**
  2534. * @}
  2535. */
  2536. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  2537. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  2538. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2539. * power consumption.
  2540. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2541. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2542. * @{
  2543. */
  2544. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  2545. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  2546. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  2547. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  2548. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2549. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  2550. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  2551. #endif /* STM32F407xx || STM32F417xx */
  2552. #if defined(STM32F415xx) || defined(STM32F417xx)
  2553. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  2554. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  2555. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  2556. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  2557. #endif /* STM32F415xx || STM32F417xx */
  2558. /**
  2559. * @}
  2560. */
  2561. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  2562. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  2563. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2564. * power consumption.
  2565. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2566. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2567. * @{
  2568. */
  2569. #define __HAL_RCC_FSMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FSMCLPEN))
  2570. #define __HAL_RCC_FSMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FSMCLPEN))
  2571. /**
  2572. * @}
  2573. */
  2574. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  2575. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  2576. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2577. * power consumption.
  2578. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2579. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2580. * @{
  2581. */
  2582. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  2583. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  2584. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  2585. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  2586. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  2587. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  2588. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  2589. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  2590. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  2591. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  2592. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  2593. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  2594. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  2595. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  2596. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  2597. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  2598. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  2599. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  2600. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  2601. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  2602. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  2603. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  2604. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  2605. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  2606. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  2607. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  2608. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  2609. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  2610. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  2611. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  2612. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  2613. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  2614. /**
  2615. * @}
  2616. */
  2617. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  2618. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  2619. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2620. * power consumption.
  2621. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2622. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2623. * @{
  2624. */
  2625. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  2626. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  2627. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  2628. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  2629. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  2630. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  2631. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  2632. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  2633. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  2634. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  2635. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  2636. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  2637. /**
  2638. * @}
  2639. */
  2640. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
  2641. /*----------------------------------------------------------------------------*/
  2642. /*------------------------- STM32F401xE/STM32F401xC --------------------------*/
  2643. #if defined(STM32F401xC) || defined(STM32F401xE)
  2644. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  2645. * @brief Enable or disable the AHB1 peripheral clock.
  2646. * @note After reset, the peripheral clock (used for registers read/write access)
  2647. * is disabled and the application software has to enable this clock before
  2648. * using it.
  2649. * @{
  2650. */
  2651. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  2652. __IO uint32_t tmpreg = 0x00U; \
  2653. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  2654. /* Delay after an RCC peripheral clock enabling */ \
  2655. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  2656. UNUSED(tmpreg); \
  2657. } while(0U)
  2658. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  2659. __IO uint32_t tmpreg = 0x00U; \
  2660. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  2661. /* Delay after an RCC peripheral clock enabling */ \
  2662. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  2663. UNUSED(tmpreg); \
  2664. } while(0U)
  2665. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  2666. __IO uint32_t tmpreg = 0x00U; \
  2667. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  2668. /* Delay after an RCC peripheral clock enabling */ \
  2669. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  2670. UNUSED(tmpreg); \
  2671. } while(0U)
  2672. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  2673. __IO uint32_t tmpreg = 0x00U; \
  2674. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  2675. /* Delay after an RCC peripheral clock enabling */ \
  2676. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  2677. UNUSED(tmpreg); \
  2678. } while(0U)
  2679. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  2680. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  2681. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  2682. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  2683. /**
  2684. * @}
  2685. */
  2686. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  2687. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  2688. * @note After reset, the peripheral clock (used for registers read/write access)
  2689. * is disabled and the application software has to enable this clock before
  2690. * using it.
  2691. * @{
  2692. */
  2693. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  2694. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  2695. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  2696. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  2697. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  2698. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  2699. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  2700. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  2701. /**
  2702. * @}
  2703. */
  2704. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  2705. * @brief Enable or disable the AHB2 peripheral clock.
  2706. * @note After reset, the peripheral clock (used for registers read/write access)
  2707. * is disabled and the application software has to enable this clock before
  2708. * using it.
  2709. * @{
  2710. */
  2711. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  2712. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  2713. }while(0U)
  2714. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  2715. /**
  2716. * @}
  2717. */
  2718. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  2719. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  2720. * @note After reset, the peripheral clock (used for registers read/write access)
  2721. * is disabled and the application software has to enable this clock before
  2722. * using it.
  2723. * @{
  2724. */
  2725. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  2726. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  2727. /**
  2728. * @}
  2729. */
  2730. /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  2731. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  2732. * @note After reset, the peripheral clock (used for registers read/write access)
  2733. * is disabled and the application software has to enable this clock before
  2734. * using it.
  2735. * @{
  2736. */
  2737. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  2738. __IO uint32_t tmpreg = 0x00U; \
  2739. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2740. /* Delay after an RCC peripheral clock enabling */ \
  2741. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2742. UNUSED(tmpreg); \
  2743. } while(0U)
  2744. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  2745. __IO uint32_t tmpreg = 0x00U; \
  2746. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2747. /* Delay after an RCC peripheral clock enabling */ \
  2748. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2749. UNUSED(tmpreg); \
  2750. } while(0U)
  2751. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  2752. __IO uint32_t tmpreg = 0x00U; \
  2753. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2754. /* Delay after an RCC peripheral clock enabling */ \
  2755. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2756. UNUSED(tmpreg); \
  2757. } while(0U)
  2758. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  2759. __IO uint32_t tmpreg = 0x00U; \
  2760. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2761. /* Delay after an RCC peripheral clock enabling */ \
  2762. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2763. UNUSED(tmpreg); \
  2764. } while(0U)
  2765. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  2766. __IO uint32_t tmpreg = 0x00U; \
  2767. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2768. /* Delay after an RCC peripheral clock enabling */ \
  2769. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2770. UNUSED(tmpreg); \
  2771. } while(0U)
  2772. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  2773. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  2774. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  2775. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  2776. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  2777. /**
  2778. * @}
  2779. */
  2780. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  2781. * @brief Get the enable or disable status of the APB1 peripheral clock.
  2782. * @note After reset, the peripheral clock (used for registers read/write access)
  2783. * is disabled and the application software has to enable this clock before
  2784. * using it.
  2785. * @{
  2786. */
  2787. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  2788. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  2789. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  2790. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  2791. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  2792. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  2793. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  2794. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  2795. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  2796. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  2797. /**
  2798. * @}
  2799. */
  2800. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  2801. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  2802. * @note After reset, the peripheral clock (used for registers read/write access)
  2803. * is disabled and the application software has to enable this clock before
  2804. * using it.
  2805. * @{
  2806. */
  2807. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  2808. __IO uint32_t tmpreg = 0x00U; \
  2809. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2810. /* Delay after an RCC peripheral clock enabling */ \
  2811. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2812. UNUSED(tmpreg); \
  2813. } while(0U)
  2814. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  2815. __IO uint32_t tmpreg = 0x00U; \
  2816. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2817. /* Delay after an RCC peripheral clock enabling */ \
  2818. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2819. UNUSED(tmpreg); \
  2820. } while(0U)
  2821. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  2822. __IO uint32_t tmpreg = 0x00U; \
  2823. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2824. /* Delay after an RCC peripheral clock enabling */ \
  2825. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2826. UNUSED(tmpreg); \
  2827. } while(0U)
  2828. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  2829. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  2830. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  2831. /**
  2832. * @}
  2833. */
  2834. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  2835. * @brief Get the enable or disable status of the APB2 peripheral clock.
  2836. * @note After reset, the peripheral clock (used for registers read/write access)
  2837. * is disabled and the application software has to enable this clock before
  2838. * using it.
  2839. * @{
  2840. */
  2841. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  2842. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  2843. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  2844. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  2845. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  2846. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  2847. /**
  2848. * @}
  2849. */
  2850. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  2851. * @brief Force or release AHB1 peripheral reset.
  2852. * @{
  2853. */
  2854. #define __HAL_RCC_AHB1_FORCE_RESET() (RCC->AHB1RSTR = 0xFFFFFFFFU)
  2855. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  2856. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  2857. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  2858. #define __HAL_RCC_AHB1_RELEASE_RESET() (RCC->AHB1RSTR = 0x00U)
  2859. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  2860. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  2861. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  2862. /**
  2863. * @}
  2864. */
  2865. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  2866. * @brief Force or release AHB2 peripheral reset.
  2867. * @{
  2868. */
  2869. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  2870. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  2871. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  2872. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  2873. /**
  2874. * @}
  2875. */
  2876. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  2877. * @brief Force or release APB1 peripheral reset.
  2878. * @{
  2879. */
  2880. #define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB1RSTR = 0xFFFFFFFFU)
  2881. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  2882. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  2883. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  2884. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  2885. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  2886. #define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00U)
  2887. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  2888. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  2889. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  2890. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  2891. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  2892. /**
  2893. * @}
  2894. */
  2895. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  2896. * @brief Force or release APB2 peripheral reset.
  2897. * @{
  2898. */
  2899. #define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU)
  2900. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  2901. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  2902. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  2903. #define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00U)
  2904. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  2905. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  2906. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  2907. /**
  2908. * @}
  2909. */
  2910. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  2911. * @brief Force or release AHB3 peripheral reset.
  2912. * @{
  2913. */
  2914. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  2915. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  2916. /**
  2917. * @}
  2918. */
  2919. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  2920. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  2921. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2922. * power consumption.
  2923. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2924. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2925. * @{
  2926. */
  2927. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  2928. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  2929. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  2930. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  2931. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  2932. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  2933. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  2934. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  2935. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  2936. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  2937. /**
  2938. * @}
  2939. */
  2940. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  2941. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  2942. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2943. * power consumption.
  2944. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2945. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2946. * @{
  2947. */
  2948. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  2949. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  2950. /**
  2951. * @}
  2952. */
  2953. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  2954. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  2955. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2956. * power consumption.
  2957. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2958. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2959. * @{
  2960. */
  2961. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  2962. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  2963. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  2964. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  2965. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  2966. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  2967. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  2968. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  2969. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  2970. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  2971. /**
  2972. * @}
  2973. */
  2974. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  2975. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  2976. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2977. * power consumption.
  2978. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2979. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2980. * @{
  2981. */
  2982. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  2983. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  2984. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  2985. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  2986. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  2987. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  2988. /**
  2989. * @}
  2990. */
  2991. #endif /* STM32F401xC || STM32F401xE*/
  2992. /*----------------------------------------------------------------------------*/
  2993. /*-------------------------------- STM32F410xx -------------------------------*/
  2994. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  2995. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  2996. * @brief Enables or disables the AHB1 peripheral clock.
  2997. * @note After reset, the peripheral clock (used for registers read/write access)
  2998. * is disabled and the application software has to enable this clock before
  2999. * using it.
  3000. * @{
  3001. */
  3002. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  3003. __IO uint32_t tmpreg = 0x00U; \
  3004. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3005. /* Delay after an RCC peripheral clock enabling */ \
  3006. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3007. UNUSED(tmpreg); \
  3008. } while(0U)
  3009. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  3010. __IO uint32_t tmpreg = 0x00U; \
  3011. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_RNGEN);\
  3012. /* Delay after an RCC peripheral clock enabling */ \
  3013. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_RNGEN);\
  3014. UNUSED(tmpreg); \
  3015. } while(0U)
  3016. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  3017. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_RNGEN))
  3018. /**
  3019. * @}
  3020. */
  3021. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  3022. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  3023. * @note After reset, the peripheral clock (used for registers read/write access)
  3024. * is disabled and the application software has to enable this clock before
  3025. * using it.
  3026. * @{
  3027. */
  3028. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  3029. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_RNGEN)) != RESET)
  3030. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  3031. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_RNGEN)) == RESET)
  3032. /**
  3033. * @}
  3034. */
  3035. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  3036. * @brief Enable or disable the High Speed APB (APB1) peripheral clock.
  3037. * @{
  3038. */
  3039. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  3040. __IO uint32_t tmpreg = 0x00U; \
  3041. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3042. /* Delay after an RCC peripheral clock enabling */ \
  3043. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3044. UNUSED(tmpreg); \
  3045. } while(0U)
  3046. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  3047. __IO uint32_t tmpreg = 0x00U; \
  3048. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  3049. /* Delay after an RCC peripheral clock enabling */ \
  3050. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  3051. UNUSED(tmpreg); \
  3052. } while(0U)
  3053. #define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \
  3054. __IO uint32_t tmpreg = 0x00U; \
  3055. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  3056. /* Delay after an RCC peripheral clock enabling */ \
  3057. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  3058. UNUSED(tmpreg); \
  3059. } while(0U)
  3060. #define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \
  3061. __IO uint32_t tmpreg = 0x00U; \
  3062. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3063. /* Delay after an RCC peripheral clock enabling */ \
  3064. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3065. UNUSED(tmpreg); \
  3066. } while(0U)
  3067. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  3068. __IO uint32_t tmpreg = 0x00U; \
  3069. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3070. /* Delay after an RCC peripheral clock enabling */ \
  3071. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3072. UNUSED(tmpreg); \
  3073. } while(0U)
  3074. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  3075. #define __HAL_RCC_RTCAPB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCAPBEN))
  3076. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  3077. #define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN))
  3078. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  3079. /**
  3080. * @}
  3081. */
  3082. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  3083. * @brief Get the enable or disable status of the APB1 peripheral clock.
  3084. * @note After reset, the peripheral clock (used for registers read/write access)
  3085. * is disabled and the application software has to enable this clock before
  3086. * using it.
  3087. * @{
  3088. */
  3089. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  3090. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) != RESET)
  3091. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  3092. #define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET)
  3093. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  3094. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  3095. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) == RESET)
  3096. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  3097. #define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET)
  3098. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  3099. /**
  3100. * @}
  3101. */
  3102. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  3103. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  3104. * @{
  3105. */
  3106. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  3107. __IO uint32_t tmpreg = 0x00U; \
  3108. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3109. /* Delay after an RCC peripheral clock enabling */ \
  3110. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3111. UNUSED(tmpreg); \
  3112. } while(0U)
  3113. #define __HAL_RCC_EXTIT_CLK_ENABLE() do { \
  3114. __IO uint32_t tmpreg = 0x00U; \
  3115. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  3116. /* Delay after an RCC peripheral clock enabling */ \
  3117. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  3118. UNUSED(tmpreg); \
  3119. } while(0U)
  3120. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  3121. #define __HAL_RCC_EXTIT_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_EXTITEN))
  3122. /**
  3123. * @}
  3124. */
  3125. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  3126. * @brief Get the enable or disable status of the APB2 peripheral clock.
  3127. * @note After reset, the peripheral clock (used for registers read/write access)
  3128. * is disabled and the application software has to enable this clock before
  3129. * using it.
  3130. * @{
  3131. */
  3132. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  3133. #define __HAL_RCC_EXTIT_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) != RESET)
  3134. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  3135. #define __HAL_RCC_EXTIT_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) == RESET)
  3136. /**
  3137. * @}
  3138. */
  3139. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  3140. * @brief Force or release AHB1 peripheral reset.
  3141. * @{
  3142. */
  3143. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  3144. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_RNGRST))
  3145. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  3146. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_RNGRST))
  3147. /**
  3148. * @}
  3149. */
  3150. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  3151. * @brief Force or release AHB2 peripheral reset.
  3152. * @{
  3153. */
  3154. #define __HAL_RCC_AHB2_FORCE_RESET()
  3155. #define __HAL_RCC_AHB2_RELEASE_RESET()
  3156. /**
  3157. * @}
  3158. */
  3159. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  3160. * @brief Force or release AHB3 peripheral reset.
  3161. * @{
  3162. */
  3163. #define __HAL_RCC_AHB3_FORCE_RESET()
  3164. #define __HAL_RCC_AHB3_RELEASE_RESET()
  3165. /**
  3166. * @}
  3167. */
  3168. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  3169. * @brief Force or release APB1 peripheral reset.
  3170. * @{
  3171. */
  3172. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  3173. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  3174. #define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST))
  3175. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  3176. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  3177. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  3178. #define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST))
  3179. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  3180. /**
  3181. * @}
  3182. */
  3183. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  3184. * @brief Force or release APB2 peripheral reset.
  3185. * @{
  3186. */
  3187. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  3188. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  3189. /**
  3190. * @}
  3191. */
  3192. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  3193. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  3194. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  3195. * power consumption.
  3196. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  3197. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  3198. * @{
  3199. */
  3200. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_RNGLPEN))
  3201. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  3202. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  3203. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  3204. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_RNGLPEN))
  3205. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  3206. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  3207. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  3208. /**
  3209. * @}
  3210. */
  3211. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  3212. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  3213. * @{
  3214. */
  3215. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  3216. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  3217. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCAPBLPEN))
  3218. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN))
  3219. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  3220. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  3221. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  3222. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCAPBLPEN))
  3223. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN))
  3224. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  3225. /**
  3226. * @}
  3227. */
  3228. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  3229. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  3230. * @{
  3231. */
  3232. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  3233. #define __HAL_RCC_EXTIT_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_EXTITLPEN))
  3234. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  3235. #define __HAL_RCC_EXTIT_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_EXTITLPEN))
  3236. /**
  3237. * @}
  3238. */
  3239. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  3240. /*----------------------------------------------------------------------------*/
  3241. /*-------------------------------- STM32F411xx -------------------------------*/
  3242. #if defined(STM32F411xE)
  3243. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  3244. * @brief Enables or disables the AHB1 peripheral clock.
  3245. * @note After reset, the peripheral clock (used for registers read/write access)
  3246. * is disabled and the application software has to enable this clock before
  3247. * using it.
  3248. * @{
  3249. */
  3250. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  3251. __IO uint32_t tmpreg = 0x00U; \
  3252. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3253. /* Delay after an RCC peripheral clock enabling */ \
  3254. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3255. UNUSED(tmpreg); \
  3256. } while(0U)
  3257. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  3258. __IO uint32_t tmpreg = 0x00U; \
  3259. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3260. /* Delay after an RCC peripheral clock enabling */ \
  3261. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3262. UNUSED(tmpreg); \
  3263. } while(0U)
  3264. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  3265. __IO uint32_t tmpreg = 0x00U; \
  3266. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3267. /* Delay after an RCC peripheral clock enabling */ \
  3268. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3269. UNUSED(tmpreg); \
  3270. } while(0U)
  3271. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  3272. __IO uint32_t tmpreg = 0x00U; \
  3273. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3274. /* Delay after an RCC peripheral clock enabling */ \
  3275. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3276. UNUSED(tmpreg); \
  3277. } while(0U)
  3278. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  3279. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  3280. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  3281. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  3282. /**
  3283. * @}
  3284. */
  3285. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  3286. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  3287. * @note After reset, the peripheral clock (used for registers read/write access)
  3288. * is disabled and the application software has to enable this clock before
  3289. * using it.
  3290. * @{
  3291. */
  3292. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  3293. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  3294. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  3295. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  3296. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  3297. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  3298. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  3299. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  3300. /**
  3301. * @}
  3302. */
  3303. /** @defgroup RCCEX_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  3304. * @brief Enable or disable the AHB2 peripheral clock.
  3305. * @note After reset, the peripheral clock (used for registers read/write access)
  3306. * is disabled and the application software has to enable this clock before
  3307. * using it.
  3308. * @{
  3309. */
  3310. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  3311. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  3312. }while(0U)
  3313. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  3314. /**
  3315. * @}
  3316. */
  3317. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  3318. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  3319. * @note After reset, the peripheral clock (used for registers read/write access)
  3320. * is disabled and the application software has to enable this clock before
  3321. * using it.
  3322. * @{
  3323. */
  3324. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  3325. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  3326. /**
  3327. * @}
  3328. */
  3329. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  3330. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  3331. * @note After reset, the peripheral clock (used for registers read/write access)
  3332. * is disabled and the application software has to enable this clock before
  3333. * using it.
  3334. * @{
  3335. */
  3336. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  3337. __IO uint32_t tmpreg = 0x00U; \
  3338. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3339. /* Delay after an RCC peripheral clock enabling */ \
  3340. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3341. UNUSED(tmpreg); \
  3342. } while(0U)
  3343. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  3344. __IO uint32_t tmpreg = 0x00U; \
  3345. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3346. /* Delay after an RCC peripheral clock enabling */ \
  3347. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3348. UNUSED(tmpreg); \
  3349. } while(0U)
  3350. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  3351. __IO uint32_t tmpreg = 0x00U; \
  3352. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3353. /* Delay after an RCC peripheral clock enabling */ \
  3354. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3355. UNUSED(tmpreg); \
  3356. } while(0U)
  3357. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  3358. __IO uint32_t tmpreg = 0x00U; \
  3359. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3360. /* Delay after an RCC peripheral clock enabling */ \
  3361. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3362. UNUSED(tmpreg); \
  3363. } while(0U)
  3364. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  3365. __IO uint32_t tmpreg = 0x00U; \
  3366. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3367. /* Delay after an RCC peripheral clock enabling */ \
  3368. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3369. UNUSED(tmpreg); \
  3370. } while(0U)
  3371. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  3372. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  3373. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  3374. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  3375. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  3376. /**
  3377. * @}
  3378. */
  3379. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  3380. * @brief Get the enable or disable status of the APB1 peripheral clock.
  3381. * @note After reset, the peripheral clock (used for registers read/write access)
  3382. * is disabled and the application software has to enable this clock before
  3383. * using it.
  3384. * @{
  3385. */
  3386. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  3387. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  3388. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  3389. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  3390. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  3391. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  3392. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  3393. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  3394. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  3395. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  3396. /**
  3397. * @}
  3398. */
  3399. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  3400. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  3401. * @{
  3402. */
  3403. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  3404. __IO uint32_t tmpreg = 0x00U; \
  3405. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3406. /* Delay after an RCC peripheral clock enabling */ \
  3407. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3408. UNUSED(tmpreg); \
  3409. } while(0U)
  3410. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  3411. __IO uint32_t tmpreg = 0x00U; \
  3412. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  3413. /* Delay after an RCC peripheral clock enabling */ \
  3414. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  3415. UNUSED(tmpreg); \
  3416. } while(0U)
  3417. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  3418. __IO uint32_t tmpreg = 0x00U; \
  3419. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  3420. /* Delay after an RCC peripheral clock enabling */ \
  3421. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  3422. UNUSED(tmpreg); \
  3423. } while(0U)
  3424. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  3425. __IO uint32_t tmpreg = 0x00U; \
  3426. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  3427. /* Delay after an RCC peripheral clock enabling */ \
  3428. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  3429. UNUSED(tmpreg); \
  3430. } while(0U)
  3431. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  3432. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  3433. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  3434. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  3435. /**
  3436. * @}
  3437. */
  3438. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  3439. * @brief Get the enable or disable status of the APB2 peripheral clock.
  3440. * @note After reset, the peripheral clock (used for registers read/write access)
  3441. * is disabled and the application software has to enable this clock before
  3442. * using it.
  3443. * @{
  3444. */
  3445. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  3446. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  3447. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  3448. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  3449. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  3450. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  3451. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  3452. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  3453. /**
  3454. * @}
  3455. */
  3456. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  3457. * @brief Force or release AHB1 peripheral reset.
  3458. * @{
  3459. */
  3460. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  3461. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  3462. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  3463. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  3464. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  3465. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  3466. /**
  3467. * @}
  3468. */
  3469. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  3470. * @brief Force or release AHB2 peripheral reset.
  3471. * @{
  3472. */
  3473. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  3474. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  3475. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  3476. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  3477. /**
  3478. * @}
  3479. */
  3480. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  3481. * @brief Force or release AHB3 peripheral reset.
  3482. * @{
  3483. */
  3484. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  3485. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  3486. /**
  3487. * @}
  3488. */
  3489. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  3490. * @brief Force or release APB1 peripheral reset.
  3491. * @{
  3492. */
  3493. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  3494. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  3495. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  3496. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  3497. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  3498. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  3499. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  3500. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  3501. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  3502. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  3503. /**
  3504. * @}
  3505. */
  3506. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  3507. * @brief Force or release APB2 peripheral reset.
  3508. * @{
  3509. */
  3510. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  3511. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  3512. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  3513. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  3514. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  3515. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  3516. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  3517. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  3518. /**
  3519. * @}
  3520. */
  3521. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  3522. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  3523. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  3524. * power consumption.
  3525. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  3526. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  3527. * @{
  3528. */
  3529. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  3530. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  3531. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  3532. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  3533. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  3534. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  3535. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  3536. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  3537. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  3538. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  3539. /**
  3540. * @}
  3541. */
  3542. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  3543. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  3544. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  3545. * power consumption.
  3546. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  3547. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  3548. * @{
  3549. */
  3550. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  3551. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  3552. /**
  3553. * @}
  3554. */
  3555. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  3556. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  3557. * @{
  3558. */
  3559. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  3560. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  3561. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  3562. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  3563. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  3564. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  3565. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  3566. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  3567. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  3568. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  3569. /**
  3570. * @}
  3571. */
  3572. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  3573. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  3574. * @{
  3575. */
  3576. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  3577. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  3578. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  3579. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  3580. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  3581. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  3582. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  3583. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  3584. /**
  3585. * @}
  3586. */
  3587. #endif /* STM32F411xE */
  3588. /*----------------------------------------------------------------------------*/
  3589. /*---------------------------------- STM32F446xx -----------------------------*/
  3590. #if defined(STM32F446xx)
  3591. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  3592. * @brief Enables or disables the AHB1 peripheral clock.
  3593. * @note After reset, the peripheral clock (used for registers read/write access)
  3594. * is disabled and the application software has to enable this clock before
  3595. * using it.
  3596. * @{
  3597. */
  3598. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  3599. __IO uint32_t tmpreg = 0x00U; \
  3600. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  3601. /* Delay after an RCC peripheral clock enabling */ \
  3602. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  3603. UNUSED(tmpreg); \
  3604. } while(0U)
  3605. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  3606. __IO uint32_t tmpreg = 0x00U; \
  3607. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3608. /* Delay after an RCC peripheral clock enabling */ \
  3609. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3610. UNUSED(tmpreg); \
  3611. } while(0U)
  3612. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  3613. __IO uint32_t tmpreg = 0x00U; \
  3614. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3615. /* Delay after an RCC peripheral clock enabling */ \
  3616. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3617. UNUSED(tmpreg); \
  3618. } while(0U)
  3619. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  3620. __IO uint32_t tmpreg = 0x00U; \
  3621. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3622. /* Delay after an RCC peripheral clock enabling */ \
  3623. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3624. UNUSED(tmpreg); \
  3625. } while(0U)
  3626. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  3627. __IO uint32_t tmpreg = 0x00U; \
  3628. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3629. /* Delay after an RCC peripheral clock enabling */ \
  3630. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3631. UNUSED(tmpreg); \
  3632. } while(0U)
  3633. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  3634. __IO uint32_t tmpreg = 0x00U; \
  3635. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  3636. /* Delay after an RCC peripheral clock enabling */ \
  3637. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  3638. UNUSED(tmpreg); \
  3639. } while(0U)
  3640. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  3641. __IO uint32_t tmpreg = 0x00U; \
  3642. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  3643. /* Delay after an RCC peripheral clock enabling */ \
  3644. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  3645. UNUSED(tmpreg); \
  3646. } while(0U)
  3647. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  3648. __IO uint32_t tmpreg = 0x00U; \
  3649. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  3650. /* Delay after an RCC peripheral clock enabling */ \
  3651. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  3652. UNUSED(tmpreg); \
  3653. } while(0U)
  3654. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  3655. __IO uint32_t tmpreg = 0x00U; \
  3656. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  3657. /* Delay after an RCC peripheral clock enabling */ \
  3658. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  3659. UNUSED(tmpreg); \
  3660. } while(0U)
  3661. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  3662. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  3663. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  3664. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  3665. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  3666. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  3667. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  3668. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  3669. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  3670. /**
  3671. * @}
  3672. */
  3673. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  3674. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  3675. * @note After reset, the peripheral clock (used for registers read/write access)
  3676. * is disabled and the application software has to enable this clock before
  3677. * using it.
  3678. * @{
  3679. */
  3680. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  3681. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  3682. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  3683. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  3684. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  3685. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  3686. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  3687. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN))!= RESET)
  3688. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  3689. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  3690. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  3691. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  3692. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  3693. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  3694. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  3695. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  3696. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  3697. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  3698. /**
  3699. * @}
  3700. */
  3701. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  3702. * @brief Enable or disable the AHB2 peripheral clock.
  3703. * @note After reset, the peripheral clock (used for registers read/write access)
  3704. * is disabled and the application software has to enable this clock before
  3705. * using it.
  3706. * @{
  3707. */
  3708. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  3709. __IO uint32_t tmpreg = 0x00U; \
  3710. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  3711. /* Delay after an RCC peripheral clock enabling */ \
  3712. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  3713. UNUSED(tmpreg); \
  3714. } while(0U)
  3715. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  3716. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  3717. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  3718. }while(0U)
  3719. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  3720. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  3721. __IO uint32_t tmpreg = 0x00U; \
  3722. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  3723. /* Delay after an RCC peripheral clock enabling */ \
  3724. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  3725. UNUSED(tmpreg); \
  3726. } while(0U)
  3727. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  3728. /**
  3729. * @}
  3730. */
  3731. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  3732. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  3733. * @note After reset, the peripheral clock (used for registers read/write access)
  3734. * is disabled and the application software has to enable this clock before
  3735. * using it.
  3736. * @{
  3737. */
  3738. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  3739. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  3740. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  3741. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  3742. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  3743. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  3744. /**
  3745. * @}
  3746. */
  3747. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  3748. * @brief Enables or disables the AHB3 peripheral clock.
  3749. * @note After reset, the peripheral clock (used for registers read/write access)
  3750. * is disabled and the application software has to enable this clock before
  3751. * using it.
  3752. * @{
  3753. */
  3754. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  3755. __IO uint32_t tmpreg = 0x00U; \
  3756. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  3757. /* Delay after an RCC peripheral clock enabling */ \
  3758. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  3759. UNUSED(tmpreg); \
  3760. } while(0U)
  3761. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  3762. __IO uint32_t tmpreg = 0x00U; \
  3763. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  3764. /* Delay after an RCC peripheral clock enabling */ \
  3765. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  3766. UNUSED(tmpreg); \
  3767. } while(0U)
  3768. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  3769. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  3770. /**
  3771. * @}
  3772. */
  3773. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  3774. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  3775. * @note After reset, the peripheral clock (used for registers read/write access)
  3776. * is disabled and the application software has to enable this clock before
  3777. * using it.
  3778. * @{
  3779. */
  3780. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  3781. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  3782. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  3783. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  3784. /**
  3785. * @}
  3786. */
  3787. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  3788. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  3789. * @note After reset, the peripheral clock (used for registers read/write access)
  3790. * is disabled and the application software has to enable this clock before
  3791. * using it.
  3792. * @{
  3793. */
  3794. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  3795. __IO uint32_t tmpreg = 0x00U; \
  3796. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3797. /* Delay after an RCC peripheral clock enabling */ \
  3798. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3799. UNUSED(tmpreg); \
  3800. } while(0U)
  3801. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  3802. __IO uint32_t tmpreg = 0x00U; \
  3803. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  3804. /* Delay after an RCC peripheral clock enabling */ \
  3805. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  3806. UNUSED(tmpreg); \
  3807. } while(0U)
  3808. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  3809. __IO uint32_t tmpreg = 0x00U; \
  3810. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  3811. /* Delay after an RCC peripheral clock enabling */ \
  3812. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  3813. UNUSED(tmpreg); \
  3814. } while(0U)
  3815. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  3816. __IO uint32_t tmpreg = 0x00U; \
  3817. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  3818. /* Delay after an RCC peripheral clock enabling */ \
  3819. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  3820. UNUSED(tmpreg); \
  3821. } while(0U)
  3822. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  3823. __IO uint32_t tmpreg = 0x00U; \
  3824. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  3825. /* Delay after an RCC peripheral clock enabling */ \
  3826. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  3827. UNUSED(tmpreg); \
  3828. } while(0U)
  3829. #define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \
  3830. __IO uint32_t tmpreg = 0x00U; \
  3831. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  3832. /* Delay after an RCC peripheral clock enabling */ \
  3833. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  3834. UNUSED(tmpreg); \
  3835. } while(0U)
  3836. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  3837. __IO uint32_t tmpreg = 0x00U; \
  3838. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  3839. /* Delay after an RCC peripheral clock enabling */ \
  3840. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  3841. UNUSED(tmpreg); \
  3842. } while(0U)
  3843. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  3844. __IO uint32_t tmpreg = 0x00U; \
  3845. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  3846. /* Delay after an RCC peripheral clock enabling */ \
  3847. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  3848. UNUSED(tmpreg); \
  3849. } while(0U)
  3850. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  3851. __IO uint32_t tmpreg = 0x00U; \
  3852. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  3853. /* Delay after an RCC peripheral clock enabling */ \
  3854. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  3855. UNUSED(tmpreg); \
  3856. } while(0U)
  3857. #define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \
  3858. __IO uint32_t tmpreg = 0x00U; \
  3859. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3860. /* Delay after an RCC peripheral clock enabling */ \
  3861. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3862. UNUSED(tmpreg); \
  3863. } while(0U)
  3864. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  3865. __IO uint32_t tmpreg = 0x00U; \
  3866. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  3867. /* Delay after an RCC peripheral clock enabling */ \
  3868. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  3869. UNUSED(tmpreg); \
  3870. } while(0U)
  3871. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  3872. __IO uint32_t tmpreg = 0x00U; \
  3873. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  3874. /* Delay after an RCC peripheral clock enabling */ \
  3875. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  3876. UNUSED(tmpreg); \
  3877. } while(0U)
  3878. #define __HAL_RCC_CEC_CLK_ENABLE() do { \
  3879. __IO uint32_t tmpreg = 0x00U; \
  3880. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  3881. /* Delay after an RCC peripheral clock enabling */ \
  3882. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  3883. UNUSED(tmpreg); \
  3884. } while(0U)
  3885. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  3886. __IO uint32_t tmpreg = 0x00U; \
  3887. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3888. /* Delay after an RCC peripheral clock enabling */ \
  3889. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3890. UNUSED(tmpreg); \
  3891. } while(0U)
  3892. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  3893. __IO uint32_t tmpreg = 0x00U; \
  3894. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3895. /* Delay after an RCC peripheral clock enabling */ \
  3896. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3897. UNUSED(tmpreg); \
  3898. } while(0U)
  3899. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  3900. __IO uint32_t tmpreg = 0x00U; \
  3901. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3902. /* Delay after an RCC peripheral clock enabling */ \
  3903. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3904. UNUSED(tmpreg); \
  3905. } while(0U)
  3906. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  3907. __IO uint32_t tmpreg = 0x00U; \
  3908. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3909. /* Delay after an RCC peripheral clock enabling */ \
  3910. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3911. UNUSED(tmpreg); \
  3912. } while(0U)
  3913. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  3914. __IO uint32_t tmpreg = 0x00U; \
  3915. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3916. /* Delay after an RCC peripheral clock enabling */ \
  3917. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3918. UNUSED(tmpreg); \
  3919. } while(0U)
  3920. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  3921. __IO uint32_t tmpreg = 0x00U; \
  3922. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3923. /* Delay after an RCC peripheral clock enabling */ \
  3924. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3925. UNUSED(tmpreg); \
  3926. } while(0U)
  3927. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  3928. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  3929. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  3930. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  3931. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  3932. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  3933. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  3934. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  3935. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  3936. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  3937. #define __HAL_RCC_SPDIFRX_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPDIFRXEN))
  3938. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  3939. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  3940. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  3941. #define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN))
  3942. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  3943. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  3944. #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN))
  3945. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  3946. /**
  3947. * @}
  3948. */
  3949. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  3950. * @brief Get the enable or disable status of the APB1 peripheral clock.
  3951. * @note After reset, the peripheral clock (used for registers read/write access)
  3952. * is disabled and the application software has to enable this clock before
  3953. * using it.
  3954. * @{
  3955. */
  3956. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  3957. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  3958. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  3959. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  3960. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  3961. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  3962. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  3963. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  3964. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  3965. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  3966. #define __HAL_RCC_SPDIFRX_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) != RESET)
  3967. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  3968. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  3969. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  3970. #define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET)
  3971. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  3972. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  3973. #define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET)
  3974. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  3975. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  3976. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  3977. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  3978. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  3979. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  3980. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  3981. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  3982. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  3983. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  3984. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  3985. #define __HAL_RCC_SPDIFRX_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) == RESET)
  3986. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  3987. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  3988. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  3989. #define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET)
  3990. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  3991. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  3992. #define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET)
  3993. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  3994. /**
  3995. * @}
  3996. */
  3997. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  3998. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  3999. * @note After reset, the peripheral clock (used for registers read/write access)
  4000. * is disabled and the application software has to enable this clock before
  4001. * using it.
  4002. * @{
  4003. */
  4004. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  4005. __IO uint32_t tmpreg = 0x00U; \
  4006. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4007. /* Delay after an RCC peripheral clock enabling */ \
  4008. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4009. UNUSED(tmpreg); \
  4010. } while(0U)
  4011. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  4012. __IO uint32_t tmpreg = 0x00U; \
  4013. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  4014. /* Delay after an RCC peripheral clock enabling */ \
  4015. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  4016. UNUSED(tmpreg); \
  4017. } while(0U)
  4018. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  4019. __IO uint32_t tmpreg = 0x00U; \
  4020. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  4021. /* Delay after an RCC peripheral clock enabling */ \
  4022. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  4023. UNUSED(tmpreg); \
  4024. } while(0U)
  4025. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  4026. __IO uint32_t tmpreg = 0x00U; \
  4027. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4028. /* Delay after an RCC peripheral clock enabling */ \
  4029. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4030. UNUSED(tmpreg); \
  4031. } while(0U)
  4032. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  4033. __IO uint32_t tmpreg = 0x00U; \
  4034. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  4035. /* Delay after an RCC peripheral clock enabling */ \
  4036. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  4037. UNUSED(tmpreg); \
  4038. } while(0U)
  4039. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  4040. __IO uint32_t tmpreg = 0x00U; \
  4041. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4042. /* Delay after an RCC peripheral clock enabling */ \
  4043. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4044. UNUSED(tmpreg); \
  4045. } while(0U)
  4046. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  4047. __IO uint32_t tmpreg = 0x00U; \
  4048. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4049. /* Delay after an RCC peripheral clock enabling */ \
  4050. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4051. UNUSED(tmpreg); \
  4052. } while(0U)
  4053. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  4054. __IO uint32_t tmpreg = 0x00U; \
  4055. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4056. /* Delay after an RCC peripheral clock enabling */ \
  4057. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4058. UNUSED(tmpreg); \
  4059. } while(0U)
  4060. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  4061. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  4062. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  4063. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  4064. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  4065. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  4066. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  4067. #define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI2EN))
  4068. /**
  4069. * @}
  4070. */
  4071. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  4072. * @brief Get the enable or disable status of the APB2 peripheral clock.
  4073. * @note After reset, the peripheral clock (used for registers read/write access)
  4074. * is disabled and the application software has to enable this clock before
  4075. * using it.
  4076. * @{
  4077. */
  4078. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  4079. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  4080. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  4081. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  4082. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  4083. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  4084. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  4085. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) != RESET)
  4086. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  4087. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  4088. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  4089. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  4090. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  4091. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  4092. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  4093. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) == RESET)
  4094. /**
  4095. * @}
  4096. */
  4097. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  4098. * @brief Force or release AHB1 peripheral reset.
  4099. * @{
  4100. */
  4101. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  4102. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  4103. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  4104. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  4105. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  4106. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  4107. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  4108. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  4109. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  4110. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  4111. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  4112. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  4113. /**
  4114. * @}
  4115. */
  4116. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  4117. * @brief Force or release AHB2 peripheral reset.
  4118. * @{
  4119. */
  4120. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  4121. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  4122. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  4123. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  4124. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  4125. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  4126. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  4127. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  4128. /**
  4129. * @}
  4130. */
  4131. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  4132. * @brief Force or release AHB3 peripheral reset.
  4133. * @{
  4134. */
  4135. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  4136. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  4137. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  4138. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  4139. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  4140. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  4141. /**
  4142. * @}
  4143. */
  4144. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  4145. * @brief Force or release APB1 peripheral reset.
  4146. * @{
  4147. */
  4148. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  4149. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  4150. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  4151. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  4152. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  4153. #define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPDIFRXRST))
  4154. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  4155. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  4156. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  4157. #define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST))
  4158. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  4159. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  4160. #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST))
  4161. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  4162. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  4163. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  4164. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  4165. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  4166. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  4167. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  4168. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  4169. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  4170. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  4171. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  4172. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  4173. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  4174. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  4175. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  4176. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  4177. #define __HAL_RCC_SPDIFRX_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPDIFRXRST))
  4178. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  4179. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  4180. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  4181. #define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST))
  4182. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  4183. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  4184. #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST))
  4185. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  4186. /**
  4187. * @}
  4188. */
  4189. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  4190. * @brief Force or release APB2 peripheral reset.
  4191. * @{
  4192. */
  4193. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  4194. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  4195. #define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI2RST))
  4196. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  4197. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  4198. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  4199. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  4200. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  4201. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  4202. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  4203. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  4204. #define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI2RST))
  4205. /**
  4206. * @}
  4207. */
  4208. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  4209. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  4210. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4211. * power consumption.
  4212. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4213. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4214. * @{
  4215. */
  4216. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  4217. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  4218. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  4219. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  4220. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  4221. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  4222. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  4223. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  4224. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  4225. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  4226. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  4227. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  4228. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  4229. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  4230. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  4231. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  4232. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  4233. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  4234. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  4235. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  4236. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  4237. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  4238. /**
  4239. * @}
  4240. */
  4241. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  4242. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  4243. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4244. * power consumption.
  4245. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  4246. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4247. * @{
  4248. */
  4249. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  4250. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  4251. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  4252. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  4253. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  4254. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  4255. /**
  4256. * @}
  4257. */
  4258. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  4259. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  4260. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4261. * power consumption.
  4262. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4263. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4264. * @{
  4265. */
  4266. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  4267. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  4268. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  4269. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  4270. /**
  4271. * @}
  4272. */
  4273. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  4274. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  4275. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4276. * power consumption.
  4277. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4278. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4279. * @{
  4280. */
  4281. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  4282. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  4283. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  4284. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  4285. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  4286. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPDIFRXLPEN))
  4287. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  4288. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  4289. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  4290. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN))
  4291. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  4292. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  4293. #define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CECLPEN))
  4294. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  4295. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  4296. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  4297. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  4298. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  4299. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  4300. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  4301. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  4302. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  4303. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  4304. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  4305. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  4306. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  4307. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  4308. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  4309. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  4310. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPDIFRXLPEN))
  4311. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  4312. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  4313. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  4314. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN))
  4315. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  4316. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  4317. #define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CECLPEN))
  4318. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  4319. /**
  4320. * @}
  4321. */
  4322. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  4323. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  4324. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4325. * power consumption.
  4326. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4327. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4328. * @{
  4329. */
  4330. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  4331. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  4332. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  4333. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  4334. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI2LPEN))
  4335. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  4336. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  4337. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  4338. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  4339. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  4340. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  4341. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  4342. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  4343. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  4344. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  4345. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI2LPEN))
  4346. /**
  4347. * @}
  4348. */
  4349. #endif /* STM32F446xx */
  4350. /*----------------------------------------------------------------------------*/
  4351. /*-------STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx-------*/
  4352. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  4353. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  4354. * @brief Enables or disables the AHB1 peripheral clock.
  4355. * @note After reset, the peripheral clock (used for registers read/write access)
  4356. * is disabled and the application software has to enable this clock before
  4357. * using it.
  4358. * @{
  4359. */
  4360. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  4361. __IO uint32_t tmpreg = 0x00U; \
  4362. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  4363. /* Delay after an RCC peripheral clock enabling */ \
  4364. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  4365. UNUSED(tmpreg); \
  4366. } while(0U)
  4367. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  4368. __IO uint32_t tmpreg = 0x00U; \
  4369. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  4370. /* Delay after an RCC peripheral clock enabling */ \
  4371. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  4372. UNUSED(tmpreg); \
  4373. } while(0U)
  4374. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  4375. __IO uint32_t tmpreg = 0x00U; \
  4376. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  4377. /* Delay after an RCC peripheral clock enabling */ \
  4378. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  4379. UNUSED(tmpreg); \
  4380. } while(0U)
  4381. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  4382. __IO uint32_t tmpreg = 0x00U; \
  4383. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  4384. /* Delay after an RCC peripheral clock enabling */ \
  4385. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  4386. UNUSED(tmpreg); \
  4387. } while(0U)
  4388. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  4389. __IO uint32_t tmpreg = 0x00U; \
  4390. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  4391. /* Delay after an RCC peripheral clock enabling */ \
  4392. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  4393. UNUSED(tmpreg); \
  4394. } while(0U)
  4395. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  4396. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  4397. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  4398. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  4399. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  4400. /**
  4401. * @}
  4402. */
  4403. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  4404. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  4405. * @note After reset, the peripheral clock (used for registers read/write access)
  4406. * is disabled and the application software has to enable this clock before
  4407. * using it.
  4408. * @{
  4409. */
  4410. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  4411. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  4412. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  4413. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  4414. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  4415. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  4416. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  4417. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  4418. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  4419. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  4420. /**
  4421. * @}
  4422. */
  4423. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  4424. * @brief Enable or disable the AHB2 peripheral clock.
  4425. * @note After reset, the peripheral clock (used for registers read/write access)
  4426. * is disabled and the application software has to enable this clock before
  4427. * using it.
  4428. * @{
  4429. */
  4430. #if defined(STM32F423xx)
  4431. #define __HAL_RCC_AES_CLK_ENABLE() do { \
  4432. __IO uint32_t tmpreg = 0x00U; \
  4433. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  4434. /* Delay after an RCC peripheral clock enabling */ \
  4435. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  4436. UNUSED(tmpreg); \
  4437. } while(0U)
  4438. #define __HAL_RCC_AES_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_AESEN))
  4439. #endif /* STM32F423xx */
  4440. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  4441. __IO uint32_t tmpreg = 0x00U; \
  4442. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  4443. /* Delay after an RCC peripheral clock enabling */ \
  4444. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  4445. UNUSED(tmpreg); \
  4446. } while(0U)
  4447. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  4448. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  4449. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  4450. }while(0U)
  4451. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  4452. /**
  4453. * @}
  4454. */
  4455. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  4456. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  4457. * @note After reset, the peripheral clock (used for registers read/write access)
  4458. * is disabled and the application software has to enable this clock before
  4459. * using it.
  4460. * @{
  4461. */
  4462. #if defined(STM32F423xx)
  4463. #define __HAL_RCC_AES_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) != RESET)
  4464. #define __HAL_RCC_AES_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) == RESET)
  4465. #endif /* STM32F423xx */
  4466. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  4467. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  4468. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  4469. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  4470. /**
  4471. * @}
  4472. */
  4473. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  4474. * @brief Enables or disables the AHB3 peripheral clock.
  4475. * @note After reset, the peripheral clock (used for registers read/write access)
  4476. * is disabled and the application software has to enable this clock before
  4477. * using it.
  4478. * @{
  4479. */
  4480. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4481. #define __HAL_RCC_FSMC_CLK_ENABLE() do { \
  4482. __IO uint32_t tmpreg = 0x00U; \
  4483. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  4484. /* Delay after an RCC peripheral clock enabling */ \
  4485. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  4486. UNUSED(tmpreg); \
  4487. } while(0U)
  4488. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  4489. __IO uint32_t tmpreg = 0x00U; \
  4490. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  4491. /* Delay after an RCC peripheral clock enabling */ \
  4492. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  4493. UNUSED(tmpreg); \
  4494. } while(0U)
  4495. #define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FSMCEN))
  4496. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  4497. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4498. /**
  4499. * @}
  4500. */
  4501. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  4502. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  4503. * @note After reset, the peripheral clock (used for registers read/write access)
  4504. * is disabled and the application software has to enable this clock before
  4505. * using it.
  4506. * @{
  4507. */
  4508. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4509. #define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) != RESET)
  4510. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  4511. #define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) == RESET)
  4512. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  4513. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4514. /**
  4515. * @}
  4516. */
  4517. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  4518. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  4519. * @note After reset, the peripheral clock (used for registers read/write access)
  4520. * is disabled and the application software has to enable this clock before
  4521. * using it.
  4522. * @{
  4523. */
  4524. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  4525. __IO uint32_t tmpreg = 0x00U; \
  4526. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  4527. /* Delay after an RCC peripheral clock enabling */ \
  4528. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  4529. UNUSED(tmpreg); \
  4530. } while(0U)
  4531. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  4532. __IO uint32_t tmpreg = 0x00U; \
  4533. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  4534. /* Delay after an RCC peripheral clock enabling */ \
  4535. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  4536. UNUSED(tmpreg); \
  4537. } while(0U)
  4538. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  4539. __IO uint32_t tmpreg = 0x00U; \
  4540. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  4541. /* Delay after an RCC peripheral clock enabling */ \
  4542. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  4543. UNUSED(tmpreg); \
  4544. } while(0U)
  4545. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  4546. __IO uint32_t tmpreg = 0x00U; \
  4547. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  4548. /* Delay after an RCC peripheral clock enabling */ \
  4549. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  4550. UNUSED(tmpreg); \
  4551. } while(0U)
  4552. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  4553. __IO uint32_t tmpreg = 0x00U; \
  4554. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  4555. /* Delay after an RCC peripheral clock enabling */ \
  4556. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  4557. UNUSED(tmpreg); \
  4558. } while(0U)
  4559. #if defined(STM32F413xx) || defined(STM32F423xx)
  4560. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  4561. __IO uint32_t tmpreg = 0x00U; \
  4562. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  4563. /* Delay after an RCC peripheral clock enabling */ \
  4564. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  4565. UNUSED(tmpreg); \
  4566. } while(0U)
  4567. #endif /* STM32F413xx || STM32F423xx */
  4568. #define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \
  4569. __IO uint32_t tmpreg = 0x00U; \
  4570. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  4571. /* Delay after an RCC peripheral clock enabling */ \
  4572. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  4573. UNUSED(tmpreg); \
  4574. } while(0U)
  4575. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4576. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  4577. __IO uint32_t tmpreg = 0x00U; \
  4578. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  4579. /* Delay after an RCC peripheral clock enabling */ \
  4580. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  4581. UNUSED(tmpreg); \
  4582. } while(0U)
  4583. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4584. #if defined(STM32F413xx) || defined(STM32F423xx)
  4585. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  4586. __IO uint32_t tmpreg = 0x00U; \
  4587. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  4588. /* Delay after an RCC peripheral clock enabling */ \
  4589. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  4590. UNUSED(tmpreg); \
  4591. } while(0U)
  4592. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  4593. __IO uint32_t tmpreg = 0x00U; \
  4594. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  4595. /* Delay after an RCC peripheral clock enabling */ \
  4596. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  4597. UNUSED(tmpreg); \
  4598. } while(0U)
  4599. #endif /* STM32F413xx || STM32F423xx */
  4600. #define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \
  4601. __IO uint32_t tmpreg = 0x00U; \
  4602. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  4603. /* Delay after an RCC peripheral clock enabling */ \
  4604. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  4605. UNUSED(tmpreg); \
  4606. } while(0U)
  4607. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  4608. __IO uint32_t tmpreg = 0x00U; \
  4609. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  4610. /* Delay after an RCC peripheral clock enabling */ \
  4611. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  4612. UNUSED(tmpreg); \
  4613. } while(0U)
  4614. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  4615. __IO uint32_t tmpreg = 0x00U; \
  4616. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  4617. /* Delay after an RCC peripheral clock enabling */ \
  4618. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  4619. UNUSED(tmpreg); \
  4620. } while(0U)
  4621. #if defined(STM32F413xx) || defined(STM32F423xx)
  4622. #define __HAL_RCC_CAN3_CLK_ENABLE() do { \
  4623. __IO uint32_t tmpreg = 0x00U; \
  4624. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  4625. /* Delay after an RCC peripheral clock enabling */ \
  4626. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  4627. UNUSED(tmpreg); \
  4628. } while(0U)
  4629. #endif /* STM32F413xx || STM32F423xx */
  4630. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  4631. __IO uint32_t tmpreg = 0x00U; \
  4632. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  4633. /* Delay after an RCC peripheral clock enabling */ \
  4634. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  4635. UNUSED(tmpreg); \
  4636. } while(0U)
  4637. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  4638. __IO uint32_t tmpreg = 0x00U; \
  4639. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  4640. /* Delay after an RCC peripheral clock enabling */ \
  4641. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  4642. UNUSED(tmpreg); \
  4643. } while(0U)
  4644. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  4645. __IO uint32_t tmpreg = 0x00U; \
  4646. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  4647. /* Delay after an RCC peripheral clock enabling */ \
  4648. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  4649. UNUSED(tmpreg); \
  4650. } while(0U)
  4651. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  4652. __IO uint32_t tmpreg = 0x00U; \
  4653. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  4654. /* Delay after an RCC peripheral clock enabling */ \
  4655. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  4656. UNUSED(tmpreg); \
  4657. } while(0U)
  4658. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  4659. __IO uint32_t tmpreg = 0x00U; \
  4660. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  4661. /* Delay after an RCC peripheral clock enabling */ \
  4662. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  4663. UNUSED(tmpreg); \
  4664. } while(0U)
  4665. #if defined(STM32F413xx) || defined(STM32F423xx)
  4666. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  4667. __IO uint32_t tmpreg = 0x00U; \
  4668. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  4669. /* Delay after an RCC peripheral clock enabling */ \
  4670. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  4671. UNUSED(tmpreg); \
  4672. } while(0U)
  4673. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  4674. __IO uint32_t tmpreg = 0x00U; \
  4675. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  4676. /* Delay after an RCC peripheral clock enabling */ \
  4677. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  4678. UNUSED(tmpreg); \
  4679. } while(0U)
  4680. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  4681. __IO uint32_t tmpreg = 0x00U; \
  4682. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  4683. /* Delay after an RCC peripheral clock enabling */ \
  4684. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  4685. UNUSED(tmpreg); \
  4686. } while(0U)
  4687. #endif /* STM32F413xx || STM32F423xx */
  4688. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  4689. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  4690. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  4691. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  4692. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  4693. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  4694. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  4695. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  4696. #if defined(STM32F413xx) || defined(STM32F423xx)
  4697. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  4698. #endif /* STM32F413xx || STM32F423xx */
  4699. #define __HAL_RCC_RTCAPB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCAPBEN))
  4700. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  4701. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4702. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  4703. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4704. #if defined(STM32F413xx) || defined(STM32F423xx)
  4705. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  4706. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  4707. #endif /* STM32F413xx || STM32F423xx */
  4708. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  4709. #define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN))
  4710. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  4711. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  4712. #if defined(STM32F413xx) || defined(STM32F423xx)
  4713. #define __HAL_RCC_CAN3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN3EN))
  4714. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  4715. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  4716. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  4717. #endif /* STM32F413xx || STM32F423xx */
  4718. /**
  4719. * @}
  4720. */
  4721. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  4722. * @brief Get the enable or disable status of the APB1 peripheral clock.
  4723. * @note After reset, the peripheral clock (used for registers read/write access)
  4724. * is disabled and the application software has to enable this clock before
  4725. * using it.
  4726. * @{
  4727. */
  4728. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  4729. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  4730. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  4731. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  4732. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  4733. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  4734. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  4735. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  4736. #if defined(STM32F413xx) || defined(STM32F423xx)
  4737. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  4738. #endif /* STM32F413xx || STM32F423xx */
  4739. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) != RESET)
  4740. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  4741. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4742. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  4743. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx | STM32F423xx */
  4744. #if defined(STM32F413xx) || defined(STM32F423xx)
  4745. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  4746. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  4747. #endif /* STM32F413xx || STM32F423xx */
  4748. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  4749. #define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET)
  4750. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN))!= RESET)
  4751. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  4752. #if defined(STM32F413xx) || defined(STM32F423xx)
  4753. #define __HAL_RCC_CAN3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) != RESET)
  4754. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  4755. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  4756. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  4757. #endif /* STM32F413xx || STM32F423xx */
  4758. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  4759. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  4760. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  4761. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  4762. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  4763. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  4764. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  4765. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  4766. #if defined(STM32F413xx) || defined(STM32F423xx)
  4767. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  4768. #endif /* STM32F413xx || STM32F423xx */
  4769. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) == RESET)
  4770. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  4771. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4772. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  4773. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx | STM32F423xx */
  4774. #if defined(STM32F413xx) || defined(STM32F423xx)
  4775. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  4776. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  4777. #endif /* STM32F413xx || STM32F423xx */
  4778. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  4779. #define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET)
  4780. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  4781. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  4782. #if defined(STM32F413xx) || defined(STM32F423xx)
  4783. #define __HAL_RCC_CAN3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) == RESET)
  4784. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  4785. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  4786. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  4787. #endif /* STM32F413xx || STM32F423xx */
  4788. /**
  4789. * @}
  4790. */
  4791. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  4792. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  4793. * @note After reset, the peripheral clock (used for registers read/write access)
  4794. * is disabled and the application software has to enable this clock before
  4795. * using it.
  4796. * @{
  4797. */
  4798. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  4799. __IO uint32_t tmpreg = 0x00U; \
  4800. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4801. /* Delay after an RCC peripheral clock enabling */ \
  4802. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4803. UNUSED(tmpreg); \
  4804. } while(0U)
  4805. #if defined(STM32F413xx) || defined(STM32F423xx)
  4806. #define __HAL_RCC_UART9_CLK_ENABLE() do { \
  4807. __IO uint32_t tmpreg = 0x00U; \
  4808. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_UART9EN);\
  4809. /* Delay after an RCC peripheral clock enabling */ \
  4810. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_UART9EN);\
  4811. UNUSED(tmpreg); \
  4812. } while(0U)
  4813. #define __HAL_RCC_UART10_CLK_ENABLE() do { \
  4814. __IO uint32_t tmpreg = 0x00U; \
  4815. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_UART10EN);\
  4816. /* Delay after an RCC peripheral clock enabling */ \
  4817. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_UART10EN);\
  4818. UNUSED(tmpreg); \
  4819. } while(0U)
  4820. #endif /* STM32F413xx || STM32F423xx */
  4821. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  4822. __IO uint32_t tmpreg = 0x00U; \
  4823. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4824. /* Delay after an RCC peripheral clock enabling */ \
  4825. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4826. UNUSED(tmpreg); \
  4827. } while(0U)
  4828. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  4829. __IO uint32_t tmpreg = 0x00U; \
  4830. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4831. /* Delay after an RCC peripheral clock enabling */ \
  4832. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4833. UNUSED(tmpreg); \
  4834. } while(0U)
  4835. #define __HAL_RCC_EXTIT_CLK_ENABLE() do { \
  4836. __IO uint32_t tmpreg = 0x00U; \
  4837. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  4838. /* Delay after an RCC peripheral clock enabling */ \
  4839. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  4840. UNUSED(tmpreg); \
  4841. } while(0U)
  4842. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  4843. __IO uint32_t tmpreg = 0x00U; \
  4844. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4845. /* Delay after an RCC peripheral clock enabling */ \
  4846. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4847. UNUSED(tmpreg); \
  4848. } while(0U)
  4849. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  4850. __IO uint32_t tmpreg = 0x00U; \
  4851. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  4852. /* Delay after an RCC peripheral clock enabling */ \
  4853. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  4854. UNUSED(tmpreg); \
  4855. } while(0U)
  4856. #if defined(STM32F413xx) || defined(STM32F423xx)
  4857. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  4858. __IO uint32_t tmpreg = 0x00U; \
  4859. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4860. /* Delay after an RCC peripheral clock enabling */ \
  4861. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4862. UNUSED(tmpreg); \
  4863. } while(0U)
  4864. #endif /* STM32F413xx || STM32F423xx */
  4865. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  4866. __IO uint32_t tmpreg = 0x00U; \
  4867. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  4868. /* Delay after an RCC peripheral clock enabling */ \
  4869. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  4870. UNUSED(tmpreg); \
  4871. } while(0U)
  4872. #if defined(STM32F413xx) || defined(STM32F423xx)
  4873. #define __HAL_RCC_DFSDM2_CLK_ENABLE() do { \
  4874. __IO uint32_t tmpreg = 0x00U; \
  4875. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM2EN);\
  4876. /* Delay after an RCC peripheral clock enabling */ \
  4877. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM2EN);\
  4878. UNUSED(tmpreg); \
  4879. } while(0U)
  4880. #endif /* STM32F413xx || STM32F423xx */
  4881. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  4882. #if defined(STM32F413xx) || defined(STM32F423xx)
  4883. #define __HAL_RCC_UART9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_UART9EN))
  4884. #define __HAL_RCC_UART10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_UART10EN))
  4885. #endif /* STM32F413xx || STM32F423xx */
  4886. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  4887. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  4888. #define __HAL_RCC_EXTIT_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_EXTITEN))
  4889. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  4890. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  4891. #if defined(STM32F413xx) || defined(STM32F423xx)
  4892. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  4893. #endif /* STM32F413xx || STM32F423xx */
  4894. #define __HAL_RCC_DFSDM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM1EN))
  4895. #if defined(STM32F413xx) || defined(STM32F423xx)
  4896. #define __HAL_RCC_DFSDM2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM2EN))
  4897. #endif /* STM32F413xx || STM32F423xx */
  4898. /**
  4899. * @}
  4900. */
  4901. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  4902. * @brief Get the enable or disable status of the APB2 peripheral clock.
  4903. * @note After reset, the peripheral clock (used for registers read/write access)
  4904. * is disabled and the application software has to enable this clock before
  4905. * using it.
  4906. * @{
  4907. */
  4908. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  4909. #if defined(STM32F413xx) || defined(STM32F423xx)
  4910. #define __HAL_RCC_UART9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART9EN)) != RESET)
  4911. #define __HAL_RCC_UART10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART10EN)) != RESET)
  4912. #endif /* STM32F413xx || STM32F423xx */
  4913. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  4914. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  4915. #define __HAL_RCC_EXTIT_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) != RESET)
  4916. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  4917. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  4918. #if defined(STM32F413xx) || defined(STM32F423xx)
  4919. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  4920. #endif /* STM32F413xx || STM32F423xx */
  4921. #define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) != RESET)
  4922. #if defined(STM32F413xx) || defined(STM32F423xx)
  4923. #define __HAL_RCC_DFSDM2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM2EN)) != RESET)
  4924. #endif /* STM32F413xx || STM32F423xx */
  4925. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  4926. #if defined(STM32F413xx) || defined(STM32F423xx)
  4927. #define __HAL_RCC_UART9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART9EN)) == RESET)
  4928. #define __HAL_RCC_UART10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART10EN)) == RESET)
  4929. #endif /* STM32F413xx || STM32F423xx */
  4930. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  4931. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  4932. #define __HAL_RCC_EXTIT_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) == RESET)
  4933. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  4934. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  4935. #if defined(STM32F413xx) || defined(STM32F423xx)
  4936. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  4937. #endif /* STM32F413xx || STM32F423xx */
  4938. #define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) == RESET)
  4939. #if defined(STM32F413xx) || defined(STM32F423xx)
  4940. #define __HAL_RCC_DFSDM2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM2EN)) == RESET)
  4941. #endif /* STM32F413xx || STM32F423xx */
  4942. /**
  4943. * @}
  4944. */
  4945. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  4946. * @brief Force or release AHB1 peripheral reset.
  4947. * @{
  4948. */
  4949. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  4950. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  4951. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  4952. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  4953. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  4954. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  4955. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  4956. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  4957. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  4958. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  4959. /**
  4960. * @}
  4961. */
  4962. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  4963. * @brief Force or release AHB2 peripheral reset.
  4964. * @{
  4965. */
  4966. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  4967. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  4968. #if defined(STM32F423xx)
  4969. #define __HAL_RCC_AES_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_AESRST))
  4970. #define __HAL_RCC_AES_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_AESRST))
  4971. #endif /* STM32F423xx */
  4972. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  4973. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  4974. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  4975. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  4976. /**
  4977. * @}
  4978. */
  4979. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  4980. * @brief Force or release AHB3 peripheral reset.
  4981. * @{
  4982. */
  4983. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4984. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  4985. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  4986. #define __HAL_RCC_FSMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FSMCRST))
  4987. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  4988. #define __HAL_RCC_FSMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FSMCRST))
  4989. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  4990. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4991. #if defined(STM32F412Cx)
  4992. #define __HAL_RCC_AHB3_FORCE_RESET()
  4993. #define __HAL_RCC_AHB3_RELEASE_RESET()
  4994. #define __HAL_RCC_FSMC_FORCE_RESET()
  4995. #define __HAL_RCC_QSPI_FORCE_RESET()
  4996. #define __HAL_RCC_FSMC_RELEASE_RESET()
  4997. #define __HAL_RCC_QSPI_RELEASE_RESET()
  4998. #endif /* STM32F412Cx */
  4999. /**
  5000. * @}
  5001. */
  5002. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  5003. * @brief Force or release APB1 peripheral reset.
  5004. * @{
  5005. */
  5006. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  5007. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  5008. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  5009. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  5010. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  5011. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  5012. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  5013. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  5014. #if defined(STM32F413xx) || defined(STM32F423xx)
  5015. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  5016. #endif /* STM32F413xx || STM32F423xx */
  5017. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  5018. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5019. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  5020. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5021. #if defined(STM32F413xx) || defined(STM32F423xx)
  5022. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  5023. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  5024. #endif /* STM32F413xx || STM32F423xx */
  5025. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  5026. #define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST))
  5027. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  5028. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  5029. #if defined(STM32F413xx) || defined(STM32F423xx)
  5030. #define __HAL_RCC_CAN3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN3RST))
  5031. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  5032. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  5033. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  5034. #endif /* STM32F413xx || STM32F423xx */
  5035. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  5036. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  5037. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  5038. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  5039. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  5040. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  5041. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  5042. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  5043. #if defined(STM32F413xx) || defined(STM32F423xx)
  5044. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  5045. #endif /* STM32F413xx || STM32F423xx */
  5046. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  5047. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5048. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  5049. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5050. #if defined(STM32F413xx) || defined(STM32F423xx)
  5051. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  5052. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  5053. #endif /* STM32F413xx || STM32F423xx */
  5054. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  5055. #define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST))
  5056. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  5057. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  5058. #if defined(STM32F413xx) || defined(STM32F423xx)
  5059. #define __HAL_RCC_CAN3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN3RST))
  5060. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  5061. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  5062. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  5063. #endif /* STM32F413xx || STM32F423xx */
  5064. /**
  5065. * @}
  5066. */
  5067. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  5068. * @brief Force or release APB2 peripheral reset.
  5069. * @{
  5070. */
  5071. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  5072. #if defined(STM32F413xx) || defined(STM32F423xx)
  5073. #define __HAL_RCC_UART9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_UART9RST))
  5074. #define __HAL_RCC_UART10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_UART10RST))
  5075. #endif /* STM32F413xx || STM32F423xx */
  5076. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  5077. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  5078. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  5079. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  5080. #if defined(STM32F413xx) || defined(STM32F423xx)
  5081. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  5082. #endif /* STM32F413xx || STM32F423xx */
  5083. #define __HAL_RCC_DFSDM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM1RST))
  5084. #if defined(STM32F413xx) || defined(STM32F423xx)
  5085. #define __HAL_RCC_DFSDM2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM2RST))
  5086. #endif /* STM32F413xx || STM32F423xx */
  5087. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  5088. #if defined(STM32F413xx) || defined(STM32F423xx)
  5089. #define __HAL_RCC_UART9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_UART9RST))
  5090. #define __HAL_RCC_UART10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_UART10RST))
  5091. #endif /* STM32F413xx || STM32F423xx */
  5092. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  5093. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  5094. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  5095. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  5096. #if defined(STM32F413xx) || defined(STM32F423xx)
  5097. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  5098. #endif /* STM32F413xx || STM32F423xx */
  5099. #define __HAL_RCC_DFSDM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM1RST))
  5100. #if defined(STM32F413xx) || defined(STM32F423xx)
  5101. #define __HAL_RCC_DFSDM2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM2RST))
  5102. #endif /* STM32F413xx || STM32F423xx */
  5103. /**
  5104. * @}
  5105. */
  5106. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  5107. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  5108. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5109. * power consumption.
  5110. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5111. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5112. * @{
  5113. */
  5114. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  5115. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  5116. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  5117. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  5118. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  5119. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  5120. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  5121. #if defined(STM32F413xx) || defined(STM32F423xx)
  5122. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  5123. #endif /* STM32F413xx || STM32F423xx */
  5124. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  5125. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  5126. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  5127. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  5128. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  5129. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  5130. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  5131. #if defined(STM32F413xx) || defined(STM32F423xx)
  5132. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  5133. #endif /* STM32F413xx || STM32F423xx */
  5134. /**
  5135. * @}
  5136. */
  5137. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  5138. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  5139. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5140. * power consumption.
  5141. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  5142. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5143. * @{
  5144. */
  5145. #if defined(STM32F423xx)
  5146. #define __HAL_RCC_AES_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_AESLPEN))
  5147. #define __HAL_RCC_AES_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_AESLPEN))
  5148. #endif /* STM32F423xx */
  5149. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  5150. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  5151. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  5152. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  5153. /**
  5154. * @}
  5155. */
  5156. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  5157. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  5158. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5159. * power consumption.
  5160. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5161. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5162. * @{
  5163. */
  5164. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5165. #define __HAL_RCC_FSMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FSMCLPEN))
  5166. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  5167. #define __HAL_RCC_FSMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FSMCLPEN))
  5168. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  5169. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5170. /**
  5171. * @}
  5172. */
  5173. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  5174. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  5175. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5176. * power consumption.
  5177. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5178. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5179. * @{
  5180. */
  5181. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  5182. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  5183. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  5184. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  5185. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  5186. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  5187. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  5188. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  5189. #if defined(STM32F413xx) || defined(STM32F423xx)
  5190. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  5191. #endif /* STM32F413xx || STM32F423xx */
  5192. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCAPBLPEN))
  5193. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  5194. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5195. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  5196. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5197. #if defined(STM32F413xx) || defined(STM32F423xx)
  5198. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  5199. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  5200. #endif /* STM32F413xx || STM32F423xx */
  5201. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  5202. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN))
  5203. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  5204. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  5205. #if defined(STM32F413xx) || defined(STM32F423xx)
  5206. #define __HAL_RCC_CAN3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN3LPEN))
  5207. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  5208. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  5209. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  5210. #endif /* STM32F413xx || STM32F423xx */
  5211. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  5212. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  5213. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  5214. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  5215. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  5216. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  5217. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  5218. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  5219. #if defined(STM32F413xx) || defined(STM32F423xx)
  5220. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  5221. #endif /* STM32F413xx || STM32F423xx */
  5222. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCAPBLPEN))
  5223. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  5224. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5225. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  5226. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5227. #if defined(STM32F413xx) || defined(STM32F423xx)
  5228. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  5229. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  5230. #endif /* STM32F413xx || STM32F423xx */
  5231. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  5232. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN))
  5233. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  5234. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  5235. #if defined(STM32F413xx) || defined(STM32F423xx)
  5236. #define __HAL_RCC_CAN3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN3LPEN))
  5237. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  5238. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  5239. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  5240. #endif /* STM32F413xx || STM32F423xx */
  5241. /**
  5242. * @}
  5243. */
  5244. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  5245. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  5246. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5247. * power consumption.
  5248. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5249. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5250. * @{
  5251. */
  5252. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  5253. #if defined(STM32F413xx) || defined(STM32F423xx)
  5254. #define __HAL_RCC_UART9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_UART9LPEN))
  5255. #define __HAL_RCC_UART10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_UART10LPEN))
  5256. #endif /* STM32F413xx || STM32F423xx */
  5257. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  5258. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  5259. #define __HAL_RCC_EXTIT_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_EXTITLPEN))
  5260. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  5261. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  5262. #if defined(STM32F413xx) || defined(STM32F423xx)
  5263. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  5264. #endif /* STM32F413xx || STM32F423xx */
  5265. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM1LPEN))
  5266. #if defined(STM32F413xx) || defined(STM32F423xx)
  5267. #define __HAL_RCC_DFSDM2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM2LPEN))
  5268. #endif /* STM32F413xx || STM32F423xx */
  5269. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  5270. #if defined(STM32F413xx) || defined(STM32F423xx)
  5271. #define __HAL_RCC_UART9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_UART9LPEN))
  5272. #define __HAL_RCC_UART10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_UART10LPEN))
  5273. #endif /* STM32F413xx || STM32F423xx */
  5274. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  5275. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  5276. #define __HAL_RCC_EXTIT_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_EXTITLPEN))
  5277. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  5278. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  5279. #if defined(STM32F413xx) || defined(STM32F423xx)
  5280. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  5281. #endif /* STM32F413xx || STM32F423xx */
  5282. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM1LPEN))
  5283. #if defined(STM32F413xx) || defined(STM32F423xx)
  5284. #define __HAL_RCC_DFSDM2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM2LPEN))
  5285. #endif /* STM32F413xx || STM32F423xx */
  5286. /**
  5287. * @}
  5288. */
  5289. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  5290. /*----------------------------------------------------------------------------*/
  5291. /*------------------------------- PLL Configuration --------------------------*/
  5292. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) ||\
  5293. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  5294. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  5295. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  5296. * @note This function must be used only when the main PLL is disabled.
  5297. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  5298. * This parameter can be one of the following values:
  5299. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  5300. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  5301. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  5302. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  5303. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5304. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  5305. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5306. * of 2 MHz to limit PLL jitter.
  5307. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  5308. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5309. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  5310. * output frequency is between 100 and 432 MHz.
  5311. *
  5312. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  5313. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5314. *
  5315. * @param __PLLQ__ specifies the division factor for OTG FS, SDIO and RNG clocks
  5316. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5317. * @note If the USB OTG FS is used in your application, you have to set the
  5318. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  5319. * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work
  5320. * correctly.
  5321. *
  5322. * @param __PLLR__ PLL division factor for I2S, SAI, SYSTEM, SPDIFRX clocks.
  5323. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5324. * @note This parameter is only available in STM32F446xx/STM32F469xx/STM32F479xx/
  5325. STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F413xx/STM32F423xx devices.
  5326. *
  5327. */
  5328. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__) \
  5329. (RCC->PLLCFGR = ((__RCC_PLLSource__) | (__PLLM__) | \
  5330. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  5331. ((((__PLLP__) >> 1U) -1U) << RCC_PLLCFGR_PLLP_Pos) | \
  5332. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos) | \
  5333. ((__PLLR__) << RCC_PLLCFGR_PLLR_Pos)))
  5334. #else
  5335. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  5336. * @note This function must be used only when the main PLL is disabled.
  5337. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  5338. * This parameter can be one of the following values:
  5339. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  5340. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  5341. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  5342. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  5343. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5344. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  5345. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5346. * of 2 MHz to limit PLL jitter.
  5347. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  5348. * This parameter must be a number between Min_Data = 50 and Max_Data = 432
  5349. * Except for STM32F411xE devices where Min_Data = 192.
  5350. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  5351. * output frequency is between 100 and 432 MHz, Except for STM32F411xE devices
  5352. * where frequency is between 192 and 432 MHz.
  5353. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  5354. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5355. *
  5356. * @param __PLLQ__ specifies the division factor for OTG FS, SDIO and RNG clocks
  5357. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5358. * @note If the USB OTG FS is used in your application, you have to set the
  5359. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  5360. * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work
  5361. * correctly.
  5362. *
  5363. */
  5364. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__) \
  5365. (RCC->PLLCFGR = (0x20000000U | (__RCC_PLLSource__) | (__PLLM__)| \
  5366. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  5367. ((((__PLLP__) >> 1U) -1U) << RCC_PLLCFGR_PLLP_Pos) | \
  5368. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos)))
  5369. #endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  5370. /*----------------------------------------------------------------------------*/
  5371. /*----------------------------PLLI2S Configuration ---------------------------*/
  5372. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  5373. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  5374. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  5375. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  5376. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  5377. /** @brief Macros to enable or disable the PLLI2S.
  5378. * @note The PLLI2S is disabled by hardware when entering STOP and STANDBY modes.
  5379. */
  5380. #define __HAL_RCC_PLLI2S_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE)
  5381. #define __HAL_RCC_PLLI2S_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE)
  5382. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  5383. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  5384. STM32F412Rx || STM32F412Cx */
  5385. #if defined(STM32F446xx)
  5386. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5387. * @note This macro must be used only when the PLLI2S is disabled.
  5388. * @note PLLI2S clock source is common with the main PLL (configured in
  5389. * HAL_RCC_ClockConfig() API).
  5390. * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock
  5391. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5392. * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input
  5393. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5394. * of 1 MHz to limit PLLI2S jitter.
  5395. *
  5396. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5397. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5398. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5399. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5400. *
  5401. * @param __PLLI2SP__ specifies division factor for SPDIFRX Clock.
  5402. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5403. * @note the PLLI2SP parameter is only available with STM32F446xx Devices
  5404. *
  5405. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5406. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5407. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5408. * on the I2S clock frequency.
  5409. *
  5410. * @param __PLLI2SQ__ specifies the division factor for SAI clock
  5411. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5412. */
  5413. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SP__, __PLLI2SQ__, __PLLI2SR__) \
  5414. (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\
  5415. ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5416. ((((__PLLI2SP__) >> 1U) -1U) << RCC_PLLI2SCFGR_PLLI2SP_Pos) |\
  5417. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  5418. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5419. #elif defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  5420. defined(STM32F413xx) || defined(STM32F423xx)
  5421. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5422. * @note This macro must be used only when the PLLI2S is disabled.
  5423. * @note PLLI2S clock source is common with the main PLL (configured in
  5424. * HAL_RCC_ClockConfig() API).
  5425. * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock
  5426. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5427. * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input
  5428. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5429. * of 1 MHz to limit PLLI2S jitter.
  5430. *
  5431. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5432. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5433. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5434. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5435. *
  5436. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5437. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5438. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5439. * on the I2S clock frequency.
  5440. *
  5441. * @param __PLLI2SQ__ specifies the division factor for SAI clock
  5442. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5443. */
  5444. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) \
  5445. (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\
  5446. ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5447. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  5448. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5449. #else
  5450. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5451. * @note This macro must be used only when the PLLI2S is disabled.
  5452. * @note PLLI2S clock source is common with the main PLL (configured in
  5453. * HAL_RCC_ClockConfig() API).
  5454. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5455. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5456. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5457. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5458. *
  5459. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5460. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5461. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5462. * on the I2S clock frequency.
  5463. *
  5464. */
  5465. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SR__) \
  5466. (RCC->PLLI2SCFGR = (((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5467. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5468. #endif /* STM32F446xx */
  5469. #if defined(STM32F411xE)
  5470. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5471. * @note This macro must be used only when the PLLI2S is disabled.
  5472. * @note This macro must be used only when the PLLI2S is disabled.
  5473. * @note PLLI2S clock source is common with the main PLL (configured in
  5474. * HAL_RCC_ClockConfig() API).
  5475. * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock
  5476. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5477. * @note The PLLI2SM parameter is only used with STM32F411xE/STM32F410xx Devices
  5478. * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input
  5479. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5480. * of 2 MHz to limit PLLI2S jitter.
  5481. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5482. * This parameter must be a number between Min_Data = 192 and Max_Data = 432.
  5483. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5484. * output frequency is between Min_Data = 192 and Max_Data = 432 MHz.
  5485. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5486. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5487. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5488. * on the I2S clock frequency.
  5489. */
  5490. #define __HAL_RCC_PLLI2S_I2SCLK_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\
  5491. ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5492. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5493. #endif /* STM32F411xE */
  5494. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5495. /** @brief Macro used by the SAI HAL driver to configure the PLLI2S clock multiplication and division factors.
  5496. * @note This macro must be used only when the PLLI2S is disabled.
  5497. * @note PLLI2S clock source is common with the main PLL (configured in
  5498. * HAL_RCC_ClockConfig() API)
  5499. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock.
  5500. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5501. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5502. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5503. * @param __PLLI2SQ__ specifies the division factor for SAI1 clock.
  5504. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5505. * @note the PLLI2SQ parameter is only available with STM32F427xx/437xx/429xx/439xx/469xx/479xx
  5506. * Devices and can be configured using the __HAL_RCC_PLLI2S_PLLSAICLK_CONFIG() macro
  5507. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5508. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5509. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5510. * on the I2S clock frequency.
  5511. */
  5512. #define __HAL_RCC_PLLI2S_SAICLK_CONFIG(__PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SN__) << 6U) |\
  5513. ((__PLLI2SQ__) << 24U) |\
  5514. ((__PLLI2SR__) << 28U))
  5515. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  5516. /*----------------------------------------------------------------------------*/
  5517. /*------------------------------ PLLSAI Configuration ------------------------*/
  5518. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5519. /** @brief Macros to Enable or Disable the PLLISAI.
  5520. * @note The PLLSAI is only available with STM32F429x/439x Devices.
  5521. * @note The PLLSAI is disabled by hardware when entering STOP and STANDBY modes.
  5522. */
  5523. #define __HAL_RCC_PLLSAI_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLSAION_BB = ENABLE)
  5524. #define __HAL_RCC_PLLSAI_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLSAION_BB = DISABLE)
  5525. #if defined(STM32F446xx)
  5526. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  5527. *
  5528. * @param __PLLSAIM__ specifies the division factor for PLLSAI VCO input clock
  5529. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5530. * @note You have to set the PLLSAIM parameter correctly to ensure that the VCO input
  5531. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5532. * of 1 MHz to limit PLLI2S jitter.
  5533. * @note The PLLSAIM parameter is only used with STM32F446xx Devices
  5534. *
  5535. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  5536. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5537. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  5538. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5539. *
  5540. * @param __PLLSAIP__ specifies division factor for OTG FS, SDIO and RNG clocks.
  5541. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5542. * @note the PLLSAIP parameter is only available with STM32F446xx Devices
  5543. *
  5544. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  5545. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5546. *
  5547. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  5548. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5549. * @note the PLLI2SR parameter is only available with STM32F427/437/429/439xx Devices
  5550. */
  5551. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIM__, __PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \
  5552. (RCC->PLLSAICFGR = ((__PLLSAIM__) | \
  5553. ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) | \
  5554. ((((__PLLSAIP__) >> 1U) -1U) << RCC_PLLSAICFGR_PLLSAIP_Pos) | \
  5555. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos)))
  5556. #endif /* STM32F446xx */
  5557. #if defined(STM32F469xx) || defined(STM32F479xx)
  5558. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  5559. *
  5560. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  5561. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5562. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  5563. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5564. *
  5565. * @param __PLLSAIP__ specifies division factor for SDIO and CLK48 clocks.
  5566. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5567. *
  5568. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  5569. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5570. *
  5571. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  5572. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5573. */
  5574. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \
  5575. (RCC->PLLSAICFGR = (((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\
  5576. ((((__PLLSAIP__) >> 1U) -1U) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\
  5577. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) |\
  5578. ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos)))
  5579. #endif /* STM32F469xx || STM32F479xx */
  5580. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
  5581. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  5582. *
  5583. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  5584. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5585. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  5586. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5587. *
  5588. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  5589. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5590. *
  5591. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  5592. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5593. * @note the PLLI2SR parameter is only available with STM32F427/437/429/439xx Devices
  5594. */
  5595. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIQ__, __PLLSAIR__) \
  5596. (RCC->PLLSAICFGR = (((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) | \
  5597. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) | \
  5598. ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos)))
  5599. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
  5600. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  5601. /*----------------------------------------------------------------------------*/
  5602. /*------------------- PLLSAI/PLLI2S Dividers Configuration -------------------*/
  5603. #if defined(STM32F413xx) || defined(STM32F423xx)
  5604. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  5605. * @note This function must be called before enabling the PLLI2S.
  5606. * @param __PLLI2SDivR__ specifies the PLLI2S division factor for SAI1 clock.
  5607. * This parameter must be a number between 1 and 32.
  5608. * SAI1 clock frequency = f(PLLI2SR) / __PLLI2SDivR__
  5609. */
  5610. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVR_CONFIG(__PLLI2SDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVR, (__PLLI2SDivR__)-1U))
  5611. /** @brief Macro to configure the SAI clock Divider coming from PLL.
  5612. * @param __PLLDivR__ specifies the PLL division factor for SAI1 clock.
  5613. * This parameter must be a number between 1 and 32.
  5614. * SAI1 clock frequency = f(PLLR) / __PLLDivR__
  5615. */
  5616. #define __HAL_RCC_PLL_PLLSAICLKDIVR_CONFIG(__PLLDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLDIVR, ((__PLLDivR__)-1U)<<8U))
  5617. #endif /* STM32F413xx || STM32F423xx */
  5618. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
  5619. defined(STM32F469xx) || defined(STM32F479xx)
  5620. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  5621. * @note This function must be called before enabling the PLLI2S.
  5622. * @param __PLLI2SDivQ__ specifies the PLLI2S division factor for SAI1 clock.
  5623. * This parameter must be a number between 1 and 32.
  5624. * SAI1 clock frequency = f(PLLI2SQ) / __PLLI2SDivQ__
  5625. */
  5626. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(__PLLI2SDivQ__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVQ, (__PLLI2SDivQ__)-1U))
  5627. /** @brief Macro to configure the SAI clock Divider coming from PLLSAI.
  5628. * @note This function must be called before enabling the PLLSAI.
  5629. * @param __PLLSAIDivQ__ specifies the PLLSAI division factor for SAI1 clock .
  5630. * This parameter must be a number between Min_Data = 1 and Max_Data = 32.
  5631. * SAI1 clock frequency = f(PLLSAIQ) / __PLLSAIDivQ__
  5632. */
  5633. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(__PLLSAIDivQ__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVQ, ((__PLLSAIDivQ__)-1U)<<8U))
  5634. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  5635. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5636. /** @brief Macro to configure the LTDC clock Divider coming from PLLSAI.
  5637. *
  5638. * @note The LTDC peripheral is only available with STM32F427/437/429/439/469/479xx Devices.
  5639. * @note This function must be called before enabling the PLLSAI.
  5640. * @param __PLLSAIDivR__ specifies the PLLSAI division factor for LTDC clock .
  5641. * This parameter must be a number between Min_Data = 2 and Max_Data = 16.
  5642. * LTDC clock frequency = f(PLLSAIR) / __PLLSAIDivR__
  5643. */
  5644. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(__PLLSAIDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVR, (__PLLSAIDivR__)))
  5645. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  5646. /*----------------------------------------------------------------------------*/
  5647. /*------------------------- Peripheral Clock selection -----------------------*/
  5648. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
  5649. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  5650. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) ||\
  5651. defined(STM32F479xx)
  5652. /** @brief Macro to configure the I2S clock source (I2SCLK).
  5653. * @note This function must be called before enabling the I2S APB clock.
  5654. * @param __SOURCE__ specifies the I2S clock source.
  5655. * This parameter can be one of the following values:
  5656. * @arg RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source.
  5657. * @arg RCC_I2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin
  5658. * used as I2S clock source.
  5659. */
  5660. #define __HAL_RCC_I2S_CONFIG(__SOURCE__) (*(__IO uint32_t *) RCC_CFGR_I2SSRC_BB = (__SOURCE__))
  5661. /** @brief Macro to get the I2S clock source (I2SCLK).
  5662. * @retval The clock source can be one of the following values:
  5663. * @arg @ref RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source.
  5664. * @arg @ref RCC_I2SCLKSOURCE_EXT External clock mapped on the I2S_CKIN pin
  5665. * used as I2S clock source
  5666. */
  5667. #define __HAL_RCC_GET_I2S_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC)))
  5668. #endif /* STM32F40xxx || STM32F41xxx || STM32F42xxx || STM32F43xxx || STM32F469xx || STM32F479xx */
  5669. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5670. /** @brief Macro to configure SAI1BlockA clock source selection.
  5671. * @note The SAI peripheral is only available with STM32F427/437/429/439/469/479xx Devices.
  5672. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5673. * the SAI clock.
  5674. * @param __SOURCE__ specifies the SAI Block A clock source.
  5675. * This parameter can be one of the following values:
  5676. * @arg RCC_SAIACLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  5677. * as SAI1 Block A clock.
  5678. * @arg RCC_SAIACLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  5679. * as SAI1 Block A clock.
  5680. * @arg RCC_SAIACLKSOURCE_Ext: External clock mapped on the I2S_CKIN pin
  5681. * used as SAI1 Block A clock.
  5682. */
  5683. #define __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC, (__SOURCE__)))
  5684. /** @brief Macro to configure SAI1BlockB clock source selection.
  5685. * @note The SAI peripheral is only available with STM32F427/437/429/439/469/479xx Devices.
  5686. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5687. * the SAI clock.
  5688. * @param __SOURCE__ specifies the SAI Block B clock source.
  5689. * This parameter can be one of the following values:
  5690. * @arg RCC_SAIBCLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  5691. * as SAI1 Block B clock.
  5692. * @arg RCC_SAIBCLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  5693. * as SAI1 Block B clock.
  5694. * @arg RCC_SAIBCLKSOURCE_Ext: External clock mapped on the I2S_CKIN pin
  5695. * used as SAI1 Block B clock.
  5696. */
  5697. #define __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC, (__SOURCE__)))
  5698. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  5699. #if defined(STM32F446xx)
  5700. /** @brief Macro to configure SAI1 clock source selection.
  5701. * @note This configuration is only available with STM32F446xx Devices.
  5702. * @note This function must be called before enabling PLL, PLLSAI, PLLI2S and
  5703. * the SAI clock.
  5704. * @param __SOURCE__ specifies the SAI1 clock source.
  5705. * This parameter can be one of the following values:
  5706. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI1 clock.
  5707. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI1 clock.
  5708. * @arg RCC_SAI1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI1 clock.
  5709. * @arg RCC_SAI1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 clock.
  5710. */
  5711. #define __HAL_RCC_SAI1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1SRC, (__SOURCE__)))
  5712. /** @brief Macro to Get SAI1 clock source selection.
  5713. * @note This configuration is only available with STM32F446xx Devices.
  5714. * @retval The clock source can be one of the following values:
  5715. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI1 clock.
  5716. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI1 clock.
  5717. * @arg RCC_SAI1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI1 clock.
  5718. * @arg RCC_SAI1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 clock.
  5719. */
  5720. #define __HAL_RCC_GET_SAI1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1SRC))
  5721. /** @brief Macro to configure SAI2 clock source selection.
  5722. * @note This configuration is only available with STM32F446xx Devices.
  5723. * @note This function must be called before enabling PLL, PLLSAI, PLLI2S and
  5724. * the SAI clock.
  5725. * @param __SOURCE__ specifies the SAI2 clock source.
  5726. * This parameter can be one of the following values:
  5727. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI2 clock.
  5728. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI2 clock.
  5729. * @arg RCC_SAI2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI2 clock.
  5730. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock used as SAI2 clock.
  5731. */
  5732. #define __HAL_RCC_SAI2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI2SRC, (__SOURCE__)))
  5733. /** @brief Macro to Get SAI2 clock source selection.
  5734. * @note This configuration is only available with STM32F446xx Devices.
  5735. * @retval The clock source can be one of the following values:
  5736. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI2 clock.
  5737. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI2 clock.
  5738. * @arg RCC_SAI2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI2 clock.
  5739. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock used as SAI2 clock.
  5740. */
  5741. #define __HAL_RCC_GET_SAI2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI2SRC))
  5742. /** @brief Macro to configure I2S APB1 clock source selection.
  5743. * @note This function must be called before enabling PLL, PLLI2S and the I2S clock.
  5744. * @param __SOURCE__ specifies the I2S APB1 clock source.
  5745. * This parameter can be one of the following values:
  5746. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5747. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB1 clock.
  5748. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB1 clock.
  5749. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5750. */
  5751. #define __HAL_RCC_I2S_APB1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC, (__SOURCE__)))
  5752. /** @brief Macro to Get I2S APB1 clock source selection.
  5753. * @retval The clock source can be one of the following values:
  5754. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5755. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB1 clock.
  5756. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB1 clock.
  5757. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5758. */
  5759. #define __HAL_RCC_GET_I2S_APB1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC))
  5760. /** @brief Macro to configure I2S APB2 clock source selection.
  5761. * @note This function must be called before enabling PLL, PLLI2S and the I2S clock.
  5762. * @param __SOURCE__ specifies the SAI Block A clock source.
  5763. * This parameter can be one of the following values:
  5764. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5765. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB2 clock.
  5766. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB2 clock.
  5767. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5768. */
  5769. #define __HAL_RCC_I2S_APB2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC, (__SOURCE__)))
  5770. /** @brief Macro to Get I2S APB2 clock source selection.
  5771. * @retval The clock source can be one of the following values:
  5772. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5773. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB2 clock.
  5774. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB2 clock.
  5775. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5776. */
  5777. #define __HAL_RCC_GET_I2S_APB2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC))
  5778. /** @brief Macro to configure the CEC clock.
  5779. * @param __SOURCE__ specifies the CEC clock source.
  5780. * This parameter can be one of the following values:
  5781. * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock
  5782. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  5783. */
  5784. #define __HAL_RCC_CEC_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, (uint32_t)(__SOURCE__)))
  5785. /** @brief Macro to Get the CEC clock.
  5786. * @retval The clock source can be one of the following values:
  5787. * @arg RCC_CECCLKSOURCE_HSI488: HSI selected as CEC clock
  5788. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  5789. */
  5790. #define __HAL_RCC_GET_CEC_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL))
  5791. /** @brief Macro to configure the FMPI2C1 clock.
  5792. * @param __SOURCE__ specifies the FMPI2C1 clock source.
  5793. * This parameter can be one of the following values:
  5794. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  5795. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  5796. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  5797. */
  5798. #define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__)))
  5799. /** @brief Macro to Get the FMPI2C1 clock.
  5800. * @retval The clock source can be one of the following values:
  5801. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  5802. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  5803. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  5804. */
  5805. #define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL))
  5806. /** @brief Macro to configure the CLK48 clock.
  5807. * @param __SOURCE__ specifies the CLK48 clock source.
  5808. * This parameter can be one of the following values:
  5809. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5810. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5811. */
  5812. #define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__SOURCE__)))
  5813. /** @brief Macro to Get the CLK48 clock.
  5814. * @retval The clock source can be one of the following values:
  5815. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5816. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5817. */
  5818. #define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL))
  5819. /** @brief Macro to configure the SDIO clock.
  5820. * @param __SOURCE__ specifies the SDIO clock source.
  5821. * This parameter can be one of the following values:
  5822. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5823. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5824. */
  5825. #define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, (uint32_t)(__SOURCE__)))
  5826. /** @brief Macro to Get the SDIO clock.
  5827. * @retval The clock source can be one of the following values:
  5828. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5829. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5830. */
  5831. #define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL))
  5832. /** @brief Macro to configure the SPDIFRX clock.
  5833. * @param __SOURCE__ specifies the SPDIFRX clock source.
  5834. * This parameter can be one of the following values:
  5835. * @arg RCC_SPDIFRXCLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SPDIFRX clock.
  5836. * @arg RCC_SPDIFRXCLKSOURCE_PLLI2SP: PLLI2S VCO Output divided by PLLI2SP used as SPDIFRX clock.
  5837. */
  5838. #define __HAL_RCC_SPDIFRX_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL, (uint32_t)(__SOURCE__)))
  5839. /** @brief Macro to Get the SPDIFRX clock.
  5840. * @retval The clock source can be one of the following values:
  5841. * @arg RCC_SPDIFRXCLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SPDIFRX clock.
  5842. * @arg RCC_SPDIFRXCLKSOURCE_PLLI2SP: PLLI2S VCO Output divided by PLLI2SP used as SPDIFRX clock.
  5843. */
  5844. #define __HAL_RCC_GET_SPDIFRX_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL))
  5845. #endif /* STM32F446xx */
  5846. #if defined(STM32F469xx) || defined(STM32F479xx)
  5847. /** @brief Macro to configure the CLK48 clock.
  5848. * @param __SOURCE__ specifies the CLK48 clock source.
  5849. * This parameter can be one of the following values:
  5850. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5851. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5852. */
  5853. #define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL, (uint32_t)(__SOURCE__)))
  5854. /** @brief Macro to Get the CLK48 clock.
  5855. * @retval The clock source can be one of the following values:
  5856. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5857. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5858. */
  5859. #define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL))
  5860. /** @brief Macro to configure the SDIO clock.
  5861. * @param __SOURCE__ specifies the SDIO clock source.
  5862. * This parameter can be one of the following values:
  5863. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5864. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5865. */
  5866. #define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL, (uint32_t)(__SOURCE__)))
  5867. /** @brief Macro to Get the SDIO clock.
  5868. * @retval The clock source can be one of the following values:
  5869. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5870. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5871. */
  5872. #define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL))
  5873. /** @brief Macro to configure the DSI clock.
  5874. * @param __SOURCE__ specifies the DSI clock source.
  5875. * This parameter can be one of the following values:
  5876. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  5877. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  5878. */
  5879. #define __HAL_RCC_DSI_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL, (uint32_t)(__SOURCE__)))
  5880. /** @brief Macro to Get the DSI clock.
  5881. * @retval The clock source can be one of the following values:
  5882. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  5883. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  5884. */
  5885. #define __HAL_RCC_GET_DSI_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL))
  5886. #endif /* STM32F469xx || STM32F479xx */
  5887. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  5888. defined(STM32F413xx) || defined(STM32F423xx)
  5889. /** @brief Macro to configure the DFSDM1 clock.
  5890. * @param __DFSDM1_CLKSOURCE__ specifies the DFSDM1 clock source.
  5891. * This parameter can be one of the following values:
  5892. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5893. * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5894. * @retval None
  5895. */
  5896. #define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1_CLKSOURCE__) MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, (__DFSDM1_CLKSOURCE__))
  5897. /** @brief Macro to get the DFSDM1 clock source.
  5898. * @retval The clock source can be one of the following values:
  5899. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5900. * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5901. */
  5902. #define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL)))
  5903. /** @brief Macro to configure DFSDM1 Audio clock source selection.
  5904. * @note This configuration is only available with STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/
  5905. STM32F413xx/STM32F423xx Devices.
  5906. * @param __SOURCE__ specifies the DFSDM1 Audio clock source.
  5907. * This parameter can be one of the following values:
  5908. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5909. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5910. */
  5911. #define __HAL_RCC_DFSDM1AUDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1ASEL, (__SOURCE__)))
  5912. /** @brief Macro to Get DFSDM1 Audio clock source selection.
  5913. * @note This configuration is only available with STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/
  5914. STM32F413xx/STM32F423xx Devices.
  5915. * @retval The clock source can be one of the following values:
  5916. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5917. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5918. */
  5919. #define __HAL_RCC_GET_DFSDM1AUDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1ASEL))
  5920. #if defined(STM32F413xx) || defined(STM32F423xx)
  5921. /** @brief Macro to configure the DFSDM2 clock.
  5922. * @param __DFSDM2_CLKSOURCE__ specifies the DFSDM1 clock source.
  5923. * This parameter can be one of the following values:
  5924. * @arg RCC_DFSDM2CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5925. * @arg RCC_DFSDM2CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5926. * @retval None
  5927. */
  5928. #define __HAL_RCC_DFSDM2_CONFIG(__DFSDM2_CLKSOURCE__) MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, (__DFSDM2_CLKSOURCE__))
  5929. /** @brief Macro to get the DFSDM2 clock source.
  5930. * @retval The clock source can be one of the following values:
  5931. * @arg RCC_DFSDM2CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5932. * @arg RCC_DFSDM2CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5933. */
  5934. #define __HAL_RCC_GET_DFSDM2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL)))
  5935. /** @brief Macro to configure DFSDM1 Audio clock source selection.
  5936. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5937. * @param __SOURCE__ specifies the DFSDM2 Audio clock source.
  5938. * This parameter can be one of the following values:
  5939. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5940. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5941. */
  5942. #define __HAL_RCC_DFSDM2AUDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM2ASEL, (__SOURCE__)))
  5943. /** @brief Macro to Get DFSDM2 Audio clock source selection.
  5944. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5945. * @retval The clock source can be one of the following values:
  5946. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5947. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5948. */
  5949. #define __HAL_RCC_GET_DFSDM2AUDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM2ASEL))
  5950. /** @brief Macro to configure SAI1BlockA clock source selection.
  5951. * @note The SAI peripheral is only available with STM32F413xx/STM32F423xx Devices.
  5952. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5953. * the SAI clock.
  5954. * @param __SOURCE__ specifies the SAI Block A clock source.
  5955. * This parameter can be one of the following values:
  5956. * @arg RCC_SAIACLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5957. * @arg RCC_SAIACLKSOURCE_EXT: External clock mapped on the I2S_CKIN pinused as SAI1 Block A clock.
  5958. * @arg RCC_SAIACLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5959. * @arg RCC_SAIACLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5960. */
  5961. #define __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC, (__SOURCE__)))
  5962. /** @brief Macro to Get SAI1 BlockA clock source selection.
  5963. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5964. * @retval The clock source can be one of the following values:
  5965. * @arg RCC_SAIACLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5966. * @arg RCC_SAIACLKSOURCE_EXT: External clock mapped on the I2S_CKIN pinused as SAI1 Block A clock.
  5967. * @arg RCC_SAIACLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5968. * @arg RCC_SAIACLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5969. */
  5970. #define __HAL_RCC_GET_SAI_BLOCKA_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC))
  5971. /** @brief Macro to configure SAI1 BlockB clock source selection.
  5972. * @note The SAI peripheral is only available with STM32F413xx/STM32F423xx Devices.
  5973. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5974. * the SAI clock.
  5975. * @param __SOURCE__ specifies the SAI Block B clock source.
  5976. * This parameter can be one of the following values:
  5977. * @arg RCC_SAIBCLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5978. * @arg RCC_SAIBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 Block A clock.
  5979. * @arg RCC_SAIBCLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5980. * @arg RCC_SAIBCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5981. */
  5982. #define __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC, (__SOURCE__)))
  5983. /** @brief Macro to Get SAI1 BlockB clock source selection.
  5984. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5985. * @retval The clock source can be one of the following values:
  5986. * @arg RCC_SAIBCLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5987. * @arg RCC_SAIBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 Block A clock.
  5988. * @arg RCC_SAIBCLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5989. * @arg RCC_SAIBCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5990. */
  5991. #define __HAL_RCC_GET_SAI_BLOCKB_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC))
  5992. /** @brief Macro to configure the LPTIM1 clock.
  5993. * @param __SOURCE__ specifies the LPTIM1 clock source.
  5994. * This parameter can be one of the following values:
  5995. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  5996. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  5997. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  5998. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  5999. */
  6000. #define __HAL_RCC_LPTIM1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__SOURCE__)))
  6001. /** @brief Macro to Get the LPTIM1 clock.
  6002. * @retval The clock source can be one of the following values:
  6003. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  6004. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  6005. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  6006. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6007. */
  6008. #define __HAL_RCC_GET_LPTIM1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL))
  6009. #endif /* STM32F413xx || STM32F423xx */
  6010. /** @brief Macro to configure I2S APB1 clock source selection.
  6011. * @param __SOURCE__ specifies the I2S APB1 clock source.
  6012. * This parameter can be one of the following values:
  6013. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6014. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6015. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6016. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6017. */
  6018. #define __HAL_RCC_I2S_APB1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC, (__SOURCE__)))
  6019. /** @brief Macro to Get I2S APB1 clock source selection.
  6020. * @retval The clock source can be one of the following values:
  6021. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6022. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6023. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6024. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6025. */
  6026. #define __HAL_RCC_GET_I2S_APB1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC))
  6027. /** @brief Macro to configure I2S APB2 clock source selection.
  6028. * @param __SOURCE__ specifies the I2S APB2 clock source.
  6029. * This parameter can be one of the following values:
  6030. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6031. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6032. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6033. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6034. */
  6035. #define __HAL_RCC_I2S_APB2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC, (__SOURCE__)))
  6036. /** @brief Macro to Get I2S APB2 clock source selection.
  6037. * @retval The clock source can be one of the following values:
  6038. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6039. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6040. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6041. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6042. */
  6043. #define __HAL_RCC_GET_I2S_APB2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC))
  6044. /** @brief Macro to configure the PLL I2S clock source (PLLI2SCLK).
  6045. * @note This macro must be called before enabling the I2S APB clock.
  6046. * @param __SOURCE__ specifies the I2S clock source.
  6047. * This parameter can be one of the following values:
  6048. * @arg RCC_PLLI2SCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6049. * @arg RCC_PLLI2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin
  6050. * used as I2S clock source.
  6051. */
  6052. #define __HAL_RCC_PLL_I2S_CONFIG(__SOURCE__) (*(__IO uint32_t *) RCC_PLLI2SCFGR_PLLI2SSRC_BB = (__SOURCE__))
  6053. /** @brief Macro to configure the FMPI2C1 clock.
  6054. * @param __SOURCE__ specifies the FMPI2C1 clock source.
  6055. * This parameter can be one of the following values:
  6056. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6057. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6058. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6059. */
  6060. #define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__)))
  6061. /** @brief Macro to Get the FMPI2C1 clock.
  6062. * @retval The clock source can be one of the following values:
  6063. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6064. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6065. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6066. */
  6067. #define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL))
  6068. /** @brief Macro to configure the CLK48 clock.
  6069. * @param __SOURCE__ specifies the CLK48 clock source.
  6070. * This parameter can be one of the following values:
  6071. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  6072. * @arg RCC_CLK48CLKSOURCE_PLLI2SQ: PLLI2S VCO Output divided by PLLI2SQ used as CLK48 clock.
  6073. */
  6074. #define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__SOURCE__)))
  6075. /** @brief Macro to Get the CLK48 clock.
  6076. * @retval The clock source can be one of the following values:
  6077. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  6078. * @arg RCC_CLK48CLKSOURCE_PLLI2SQ: PLLI2S VCO Output divided by PLLI2SQ used as CLK48 clock
  6079. */
  6080. #define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL))
  6081. /** @brief Macro to configure the SDIO clock.
  6082. * @param __SOURCE__ specifies the SDIO clock source.
  6083. * This parameter can be one of the following values:
  6084. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  6085. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  6086. */
  6087. #define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, (uint32_t)(__SOURCE__)))
  6088. /** @brief Macro to Get the SDIO clock.
  6089. * @retval The clock source can be one of the following values:
  6090. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  6091. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  6092. */
  6093. #define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL))
  6094. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  6095. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6096. /** @brief Macro to configure I2S clock source selection.
  6097. * @param __SOURCE__ specifies the I2S clock source.
  6098. * This parameter can be one of the following values:
  6099. * @arg RCC_I2SAPBCLKSOURCE_PLLR: PLL VCO output clock divided by PLLR.
  6100. * @arg RCC_I2SAPBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6101. * @arg RCC_I2SAPBCLKSOURCE_PLLSRC: HSI/HSE depends on PLLSRC.
  6102. */
  6103. #define __HAL_RCC_I2S_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2SSRC, (__SOURCE__)))
  6104. /** @brief Macro to Get I2S clock source selection.
  6105. * @retval The clock source can be one of the following values:
  6106. * @arg RCC_I2SAPBCLKSOURCE_PLLR: PLL VCO output clock divided by PLLR.
  6107. * @arg RCC_I2SAPBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6108. * @arg RCC_I2SAPBCLKSOURCE_PLLSRC: HSI/HSE depends on PLLSRC.
  6109. */
  6110. #define __HAL_RCC_GET_I2S_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2SSRC))
  6111. /** @brief Macro to configure the FMPI2C1 clock.
  6112. * @param __SOURCE__ specifies the FMPI2C1 clock source.
  6113. * This parameter can be one of the following values:
  6114. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6115. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6116. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6117. */
  6118. #define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__)))
  6119. /** @brief Macro to Get the FMPI2C1 clock.
  6120. * @retval The clock source can be one of the following values:
  6121. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6122. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6123. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6124. */
  6125. #define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL))
  6126. /** @brief Macro to configure the LPTIM1 clock.
  6127. * @param __SOURCE__ specifies the LPTIM1 clock source.
  6128. * This parameter can be one of the following values:
  6129. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK1 selected as LPTIM1 clock
  6130. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  6131. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  6132. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6133. */
  6134. #define __HAL_RCC_LPTIM1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__SOURCE__)))
  6135. /** @brief Macro to Get the LPTIM1 clock.
  6136. * @retval The clock source can be one of the following values:
  6137. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK1 selected as LPTIM1 clock
  6138. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  6139. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  6140. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6141. */
  6142. #define __HAL_RCC_GET_LPTIM1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL))
  6143. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6144. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  6145. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
  6146. defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  6147. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
  6148. defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6149. /** @brief Macro to configure the Timers clocks prescalers
  6150. * @note This feature is only available with STM32F429x/439x Devices.
  6151. * @param __PRESC__ specifies the Timers clocks prescalers selection
  6152. * This parameter can be one of the following values:
  6153. * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is
  6154. * equal to HPRE if PPREx is corresponding to division by 1 or 2,
  6155. * else it is equal to [(HPRE * PPREx) / 2] if PPREx is corresponding to
  6156. * division by 4 or more.
  6157. * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is
  6158. * equal to HPRE if PPREx is corresponding to division by 1, 2 or 4,
  6159. * else it is equal to [(HPRE * PPREx) / 4] if PPREx is corresponding
  6160. * to division by 8 or more.
  6161. */
  6162. #define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) (*(__IO uint32_t *) RCC_DCKCFGR_TIMPRE_BB = (__PRESC__))
  6163. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx) || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE ||\
  6164. STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx ||\
  6165. STM32F423xx */
  6166. /*----------------------------------------------------------------------------*/
  6167. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  6168. /** @brief Enable PLLSAI_RDY interrupt.
  6169. */
  6170. #define __HAL_RCC_PLLSAI_ENABLE_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYIE))
  6171. /** @brief Disable PLLSAI_RDY interrupt.
  6172. */
  6173. #define __HAL_RCC_PLLSAI_DISABLE_IT() (RCC->CIR &= ~(RCC_CIR_PLLSAIRDYIE))
  6174. /** @brief Clear the PLLSAI RDY interrupt pending bits.
  6175. */
  6176. #define __HAL_RCC_PLLSAI_CLEAR_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYF))
  6177. /** @brief Check the PLLSAI RDY interrupt has occurred or not.
  6178. * @retval The new state (TRUE or FALSE).
  6179. */
  6180. #define __HAL_RCC_PLLSAI_GET_IT() ((RCC->CIR & (RCC_CIR_PLLSAIRDYIE)) == (RCC_CIR_PLLSAIRDYIE))
  6181. /** @brief Check PLLSAI RDY flag is set or not.
  6182. * @retval The new state (TRUE or FALSE).
  6183. */
  6184. #define __HAL_RCC_PLLSAI_GET_FLAG() ((RCC->CR & (RCC_CR_PLLSAIRDY)) == (RCC_CR_PLLSAIRDY))
  6185. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  6186. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6187. /** @brief Macros to enable or disable the RCC MCO1 feature.
  6188. */
  6189. #define __HAL_RCC_MCO1_ENABLE() (*(__IO uint32_t *) RCC_CFGR_MCO1EN_BB = ENABLE)
  6190. #define __HAL_RCC_MCO1_DISABLE() (*(__IO uint32_t *) RCC_CFGR_MCO1EN_BB = DISABLE)
  6191. /** @brief Macros to enable or disable the RCC MCO2 feature.
  6192. */
  6193. #define __HAL_RCC_MCO2_ENABLE() (*(__IO uint32_t *) RCC_CFGR_MCO2EN_BB = ENABLE)
  6194. #define __HAL_RCC_MCO2_DISABLE() (*(__IO uint32_t *) RCC_CFGR_MCO2EN_BB = DISABLE)
  6195. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6196. /**
  6197. * @}
  6198. */
  6199. /* Exported functions --------------------------------------------------------*/
  6200. /** @addtogroup RCCEx_Exported_Functions
  6201. * @{
  6202. */
  6203. /** @addtogroup RCCEx_Exported_Functions_Group1
  6204. * @{
  6205. */
  6206. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  6207. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  6208. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  6209. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\
  6210. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
  6211. defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
  6212. defined(STM32F423xx)
  6213. void HAL_RCCEx_SelectLSEMode(uint8_t Mode);
  6214. #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6215. #if defined(RCC_PLLI2S_SUPPORT)
  6216. HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit);
  6217. HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void);
  6218. #endif /* RCC_PLLI2S_SUPPORT */
  6219. #if defined(RCC_PLLSAI_SUPPORT)
  6220. HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI(RCC_PLLSAIInitTypeDef *PLLSAIInit);
  6221. HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI(void);
  6222. #endif /* RCC_PLLSAI_SUPPORT */
  6223. /**
  6224. * @}
  6225. */
  6226. /**
  6227. * @}
  6228. */
  6229. /* Private types -------------------------------------------------------------*/
  6230. /* Private variables ---------------------------------------------------------*/
  6231. /* Private constants ---------------------------------------------------------*/
  6232. /** @defgroup RCCEx_Private_Constants RCCEx Private Constants
  6233. * @{
  6234. */
  6235. /** @defgroup RCCEx_BitAddress_AliasRegion RCC BitAddress AliasRegion
  6236. * @brief RCC registers bit address in the alias region
  6237. * @{
  6238. */
  6239. /* --- CR Register ---*/
  6240. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  6241. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  6242. /* Alias word address of PLLSAION bit */
  6243. #define RCC_PLLSAION_BIT_NUMBER 0x1CU
  6244. #define RCC_CR_PLLSAION_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLSAION_BIT_NUMBER * 4U))
  6245. #define PLLSAI_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */
  6246. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  6247. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  6248. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  6249. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  6250. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  6251. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6252. /* Alias word address of PLLI2SON bit */
  6253. #define RCC_PLLI2SON_BIT_NUMBER 0x1AU
  6254. #define RCC_CR_PLLI2SON_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLI2SON_BIT_NUMBER * 4U))
  6255. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  6256. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  6257. STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6258. /* --- DCKCFGR Register ---*/
  6259. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  6260. defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
  6261. defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  6262. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
  6263. defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6264. /* Alias word address of TIMPRE bit */
  6265. #define RCC_DCKCFGR_OFFSET (RCC_OFFSET + 0x8CU)
  6266. #define RCC_TIMPRE_BIT_NUMBER 0x18U
  6267. #define RCC_DCKCFGR_TIMPRE_BB (PERIPH_BB_BASE + (RCC_DCKCFGR_OFFSET * 32U) + (RCC_TIMPRE_BIT_NUMBER * 4U))
  6268. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F410xx || STM32F401xC ||\
  6269. STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
  6270. STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6271. /* --- CFGR Register ---*/
  6272. #define RCC_CFGR_OFFSET (RCC_OFFSET + 0x08U)
  6273. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  6274. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  6275. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  6276. defined(STM32F469xx) || defined(STM32F479xx)
  6277. /* Alias word address of I2SSRC bit */
  6278. #define RCC_I2SSRC_BIT_NUMBER 0x17U
  6279. #define RCC_CFGR_I2SSRC_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_I2SSRC_BIT_NUMBER * 4U))
  6280. #define PLLI2S_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */
  6281. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  6282. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
  6283. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  6284. defined(STM32F413xx) || defined(STM32F423xx)
  6285. /* --- PLLI2SCFGR Register ---*/
  6286. #define RCC_PLLI2SCFGR_OFFSET (RCC_OFFSET + 0x84U)
  6287. /* Alias word address of PLLI2SSRC bit */
  6288. #define RCC_PLLI2SSRC_BIT_NUMBER 0x16U
  6289. #define RCC_PLLI2SCFGR_PLLI2SSRC_BB (PERIPH_BB_BASE + (RCC_PLLI2SCFGR_OFFSET * 32U) + (RCC_PLLI2SSRC_BIT_NUMBER * 4U))
  6290. #define PLLI2S_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */
  6291. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx | STM32F423xx */
  6292. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6293. /* Alias word address of MCO1EN bit */
  6294. #define RCC_MCO1EN_BIT_NUMBER 0x8U
  6295. #define RCC_CFGR_MCO1EN_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_MCO1EN_BIT_NUMBER * 4U))
  6296. /* Alias word address of MCO2EN bit */
  6297. #define RCC_MCO2EN_BIT_NUMBER 0x9U
  6298. #define RCC_CFGR_MCO2EN_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_MCO2EN_BIT_NUMBER * 4U))
  6299. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6300. #define PLL_TIMEOUT_VALUE 2U /* 2 ms */
  6301. /**
  6302. * @}
  6303. */
  6304. /**
  6305. * @}
  6306. */
  6307. /* Private macros ------------------------------------------------------------*/
  6308. /** @defgroup RCCEx_Private_Macros RCCEx Private Macros
  6309. * @{
  6310. */
  6311. /** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters
  6312. * @{
  6313. */
  6314. #if defined(STM32F411xE)
  6315. #define IS_RCC_PLLN_VALUE(VALUE) ((192U <= (VALUE)) && ((VALUE) <= 432U))
  6316. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((192U <= (VALUE)) && ((VALUE) <= 432U))
  6317. #else /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||
  6318. STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410Tx || STM32F410Cx ||
  6319. STM32F410Rx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Cx || STM32F412Rx ||
  6320. STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */
  6321. #define IS_RCC_PLLN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U))
  6322. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U))
  6323. #endif /* STM32F411xE */
  6324. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
  6325. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000007FU))
  6326. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
  6327. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
  6328. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00000007U))
  6329. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
  6330. #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  6331. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000000FU))
  6332. #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
  6333. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6334. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000001FU))
  6335. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6336. #if defined(STM32F446xx)
  6337. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00000FFFU))
  6338. #endif /* STM32F446xx */
  6339. #if defined(STM32F469xx) || defined(STM32F479xx)
  6340. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x000001FFU))
  6341. #endif /* STM32F469xx || STM32F479xx */
  6342. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
  6343. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x000003FFU))
  6344. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  6345. #if defined(STM32F413xx) || defined(STM32F423xx)
  6346. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00007FFFU))
  6347. #endif /* STM32F413xx || STM32F423xx */
  6348. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6349. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
  6350. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  6351. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U))
  6352. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U))
  6353. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U))
  6354. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6355. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6356. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6357. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDIVR_2) ||\
  6358. ((VALUE) == RCC_PLLSAIDIVR_4) ||\
  6359. ((VALUE) == RCC_PLLSAIDIVR_8) ||\
  6360. ((VALUE) == RCC_PLLSAIDIVR_16))
  6361. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  6362. #if defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  6363. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6364. #define IS_RCC_PLLI2SM_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 63U))
  6365. #define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\
  6366. ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
  6367. #endif /* STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6368. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6369. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6370. #define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\
  6371. ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
  6372. #define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\
  6373. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\
  6374. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI))
  6375. #define IS_RCC_LPTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) ||\
  6376. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) ||\
  6377. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) ||\
  6378. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  6379. #define IS_RCC_I2SAPBCLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPBCLKSOURCE_PLLR) ||\
  6380. ((SOURCE) == RCC_I2SAPBCLKSOURCE_EXT) ||\
  6381. ((SOURCE) == RCC_I2SAPBCLKSOURCE_PLLSRC))
  6382. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6383. #if defined(STM32F446xx)
  6384. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6385. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == RCC_PLLI2SP_DIV2) ||\
  6386. ((VALUE) == RCC_PLLI2SP_DIV4) ||\
  6387. ((VALUE) == RCC_PLLI2SP_DIV6) ||\
  6388. ((VALUE) == RCC_PLLI2SP_DIV8))
  6389. #define IS_RCC_PLLSAIM_VALUE(VALUE) ((VALUE) <= 63U)
  6390. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\
  6391. ((VALUE) == RCC_PLLSAIP_DIV4) ||\
  6392. ((VALUE) == RCC_PLLSAIP_DIV6) ||\
  6393. ((VALUE) == RCC_PLLSAIP_DIV8))
  6394. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) ||\
  6395. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) ||\
  6396. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLR) ||\
  6397. ((SOURCE) == RCC_SAI1CLKSOURCE_EXT))
  6398. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) ||\
  6399. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) ||\
  6400. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLR) ||\
  6401. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLSRC))
  6402. #define IS_RCC_I2SAPB1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLI2S) ||\
  6403. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_EXT) ||\
  6404. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLR) ||\
  6405. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLSRC))
  6406. #define IS_RCC_I2SAPB2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLI2S) ||\
  6407. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_EXT) ||\
  6408. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLR) ||\
  6409. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLSRC))
  6410. #define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\
  6411. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\
  6412. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI))
  6413. #define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_HSI) ||\
  6414. ((SOURCE) == RCC_CECCLKSOURCE_LSE))
  6415. #define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\
  6416. ((SOURCE) == RCC_CLK48CLKSOURCE_PLLSAIP))
  6417. #define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\
  6418. ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK))
  6419. #define IS_RCC_SPDIFRXCLKSOURCE(SOURCE) (((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLLR) ||\
  6420. ((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLLI2SP))
  6421. #endif /* STM32F446xx */
  6422. #if defined(STM32F469xx) || defined(STM32F479xx)
  6423. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6424. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\
  6425. ((VALUE) == RCC_PLLSAIP_DIV4) ||\
  6426. ((VALUE) == RCC_PLLSAIP_DIV6) ||\
  6427. ((VALUE) == RCC_PLLSAIP_DIV8))
  6428. #define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\
  6429. ((SOURCE) == RCC_CLK48CLKSOURCE_PLLSAIP))
  6430. #define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\
  6431. ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK))
  6432. #define IS_RCC_DSIBYTELANECLKSOURCE(SOURCE) (((SOURCE) == RCC_DSICLKSOURCE_PLLR) ||\
  6433. ((SOURCE) == RCC_DSICLKSOURCE_DSIPHY))
  6434. #define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\
  6435. ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
  6436. #endif /* STM32F469xx || STM32F479xx */
  6437. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  6438. defined(STM32F413xx) || defined(STM32F423xx)
  6439. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U))
  6440. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6441. #define IS_RCC_PLLI2SCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLI2SCLKSOURCE_PLLSRC) || \
  6442. ((__SOURCE__) == RCC_PLLI2SCLKSOURCE_EXT))
  6443. #define IS_RCC_I2SAPB1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLI2S) ||\
  6444. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_EXT) ||\
  6445. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLR) ||\
  6446. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLSRC))
  6447. #define IS_RCC_I2SAPB2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLI2S) ||\
  6448. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_EXT) ||\
  6449. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLR) ||\
  6450. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLSRC))
  6451. #define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\
  6452. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\
  6453. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI))
  6454. #define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\
  6455. ((SOURCE) == RCC_CLK48CLKSOURCE_PLLI2SQ))
  6456. #define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\
  6457. ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK))
  6458. #define IS_RCC_DFSDM1CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM1CLKSOURCE_PCLK2) || \
  6459. ((__SOURCE__) == RCC_DFSDM1CLKSOURCE_SYSCLK))
  6460. #define IS_RCC_DFSDM1AUDIOCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM1AUDIOCLKSOURCE_I2S1) || \
  6461. ((__SOURCE__) == RCC_DFSDM1AUDIOCLKSOURCE_I2S2))
  6462. #if defined(STM32F413xx) || defined(STM32F423xx)
  6463. #define IS_RCC_DFSDM2CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM2CLKSOURCE_PCLK2) || \
  6464. ((__SOURCE__) == RCC_DFSDM2CLKSOURCE_SYSCLK))
  6465. #define IS_RCC_DFSDM2AUDIOCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM2AUDIOCLKSOURCE_I2S1) || \
  6466. ((__SOURCE__) == RCC_DFSDM2AUDIOCLKSOURCE_I2S2))
  6467. #define IS_RCC_LPTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) ||\
  6468. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) ||\
  6469. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) ||\
  6470. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  6471. #define IS_RCC_SAIACLKSOURCE(SOURCE) (((SOURCE) == RCC_SAIACLKSOURCE_PLLI2SR) ||\
  6472. ((SOURCE) == RCC_SAIACLKSOURCE_EXT) ||\
  6473. ((SOURCE) == RCC_SAIACLKSOURCE_PLLR) ||\
  6474. ((SOURCE) == RCC_SAIACLKSOURCE_PLLSRC))
  6475. #define IS_RCC_SAIBCLKSOURCE(SOURCE) (((SOURCE) == RCC_SAIBCLKSOURCE_PLLI2SR) ||\
  6476. ((SOURCE) == RCC_SAIBCLKSOURCE_EXT) ||\
  6477. ((SOURCE) == RCC_SAIBCLKSOURCE_PLLR) ||\
  6478. ((SOURCE) == RCC_SAIBCLKSOURCE_PLLSRC))
  6479. #define IS_RCC_PLL_DIVR_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6480. #define IS_RCC_PLLI2S_DIVR_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6481. #endif /* STM32F413xx || STM32F423xx */
  6482. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6483. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  6484. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  6485. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  6486. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  6487. defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  6488. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_PLLI2SCLK)|| \
  6489. ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK))
  6490. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  6491. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || \
  6492. STM32F412Rx */
  6493. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6494. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_I2SCLK)|| \
  6495. ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK))
  6496. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6497. /**
  6498. * @}
  6499. */
  6500. /**
  6501. * @}
  6502. */
  6503. /**
  6504. * @}
  6505. */
  6506. /**
  6507. * @}
  6508. */
  6509. #ifdef __cplusplus
  6510. }
  6511. #endif
  6512. #endif /* __STM32F4xx_HAL_RCC_EX_H */
  6513. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/