stm32l4xx_ll_rcc.h 252 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_rcc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file in
  13. * the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. ******************************************************************************
  16. */
  17. /* Define to prevent recursive inclusion -------------------------------------*/
  18. #ifndef STM32L4xx_LL_RCC_H
  19. #define STM32L4xx_LL_RCC_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32l4xx.h"
  25. /** @addtogroup STM32L4xx_LL_Driver
  26. * @{
  27. */
  28. #if defined(RCC)
  29. /** @defgroup RCC_LL RCC
  30. * @{
  31. */
  32. /* Private types -------------------------------------------------------------*/
  33. /* Private variables ---------------------------------------------------------*/
  34. /* Private constants ---------------------------------------------------------*/
  35. /** @defgroup RCC_LL_Private_Constants RCC Private Constants
  36. * @{
  37. */
  38. /* Defines used to perform offsets*/
  39. /* Offset used to access to RCC_CCIPR and RCC_CCIPR2 registers */
  40. #define RCC_OFFSET_CCIPR 0U
  41. #define RCC_OFFSET_CCIPR2 0x14U
  42. /**
  43. * @}
  44. */
  45. /* Private macros ------------------------------------------------------------*/
  46. #if defined(USE_FULL_LL_DRIVER)
  47. /** @defgroup RCC_LL_Private_Macros RCC Private Macros
  48. * @{
  49. */
  50. /**
  51. * @}
  52. */
  53. #endif /*USE_FULL_LL_DRIVER*/
  54. /* Exported types ------------------------------------------------------------*/
  55. #if defined(USE_FULL_LL_DRIVER)
  56. /** @defgroup RCC_LL_Exported_Types RCC Exported Types
  57. * @{
  58. */
  59. /** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure
  60. * @{
  61. */
  62. /**
  63. * @brief RCC Clocks Frequency Structure
  64. */
  65. typedef struct
  66. {
  67. uint32_t SYSCLK_Frequency; /*!< SYSCLK clock frequency */
  68. uint32_t HCLK_Frequency; /*!< HCLK clock frequency */
  69. uint32_t PCLK1_Frequency; /*!< PCLK1 clock frequency */
  70. uint32_t PCLK2_Frequency; /*!< PCLK2 clock frequency */
  71. } LL_RCC_ClocksTypeDef;
  72. /**
  73. * @}
  74. */
  75. /**
  76. * @}
  77. */
  78. #endif /* USE_FULL_LL_DRIVER */
  79. /* Exported constants --------------------------------------------------------*/
  80. /** @defgroup RCC_LL_Exported_Constants RCC Exported Constants
  81. * @{
  82. */
  83. /** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation
  84. * @brief Defines used to adapt values of different oscillators
  85. * @note These values could be modified in the user environment according to
  86. * HW set-up.
  87. * @{
  88. */
  89. #if !defined (HSE_VALUE)
  90. #define HSE_VALUE 8000000U /*!< Value of the HSE oscillator in Hz */
  91. #endif /* HSE_VALUE */
  92. #if !defined (HSI_VALUE)
  93. #define HSI_VALUE 16000000U /*!< Value of the HSI oscillator in Hz */
  94. #endif /* HSI_VALUE */
  95. #if !defined (LSE_VALUE)
  96. #define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */
  97. #endif /* LSE_VALUE */
  98. #if !defined (LSI_VALUE)
  99. #define LSI_VALUE 32000U /*!< Value of the LSI oscillator in Hz */
  100. #endif /* LSI_VALUE */
  101. #if defined(RCC_HSI48_SUPPORT)
  102. #if !defined (HSI48_VALUE)
  103. #define HSI48_VALUE 48000000U /*!< Value of the HSI48 oscillator in Hz */
  104. #endif /* HSI48_VALUE */
  105. #endif /* RCC_HSI48_SUPPORT */
  106. #if !defined (EXTERNAL_SAI1_CLOCK_VALUE)
  107. #define EXTERNAL_SAI1_CLOCK_VALUE 48000U /*!< Value of the SAI1_EXTCLK external oscillator in Hz */
  108. #endif /* EXTERNAL_SAI1_CLOCK_VALUE */
  109. #if !defined (EXTERNAL_SAI2_CLOCK_VALUE)
  110. #define EXTERNAL_SAI2_CLOCK_VALUE 48000U /*!< Value of the SAI2_EXTCLK external oscillator in Hz */
  111. #endif /* EXTERNAL_SAI2_CLOCK_VALUE */
  112. /**
  113. * @}
  114. */
  115. /** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines
  116. * @brief Flags defines which can be used with LL_RCC_WriteReg function
  117. * @{
  118. */
  119. #define LL_RCC_CICR_LSIRDYC RCC_CICR_LSIRDYC /*!< LSI Ready Interrupt Clear */
  120. #define LL_RCC_CICR_LSERDYC RCC_CICR_LSERDYC /*!< LSE Ready Interrupt Clear */
  121. #define LL_RCC_CICR_MSIRDYC RCC_CICR_MSIRDYC /*!< MSI Ready Interrupt Clear */
  122. #define LL_RCC_CICR_HSIRDYC RCC_CICR_HSIRDYC /*!< HSI Ready Interrupt Clear */
  123. #define LL_RCC_CICR_HSERDYC RCC_CICR_HSERDYC /*!< HSE Ready Interrupt Clear */
  124. #define LL_RCC_CICR_PLLRDYC RCC_CICR_PLLRDYC /*!< PLL Ready Interrupt Clear */
  125. #if defined(RCC_HSI48_SUPPORT)
  126. #define LL_RCC_CICR_HSI48RDYC RCC_CICR_HSI48RDYC /*!< HSI48 Ready Interrupt Clear */
  127. #endif /* RCC_HSI48_SUPPORT */
  128. #if defined(RCC_PLLSAI1_SUPPORT)
  129. #define LL_RCC_CICR_PLLSAI1RDYC RCC_CICR_PLLSAI1RDYC /*!< PLLSAI1 Ready Interrupt Clear */
  130. #endif /* RCC_PLLSAI1_SUPPORT */
  131. #if defined(RCC_PLLSAI2_SUPPORT)
  132. #define LL_RCC_CICR_PLLSAI2RDYC RCC_CICR_PLLSAI2RDYC /*!< PLLSAI2 Ready Interrupt Clear */
  133. #endif /* RCC_PLLSAI2_SUPPORT */
  134. #define LL_RCC_CICR_LSECSSC RCC_CICR_LSECSSC /*!< LSE Clock Security System Interrupt Clear */
  135. #define LL_RCC_CICR_CSSC RCC_CICR_CSSC /*!< Clock Security System Interrupt Clear */
  136. /**
  137. * @}
  138. */
  139. /** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines
  140. * @brief Flags defines which can be used with LL_RCC_ReadReg function
  141. * @{
  142. */
  143. #define LL_RCC_CIFR_LSIRDYF RCC_CIFR_LSIRDYF /*!< LSI Ready Interrupt flag */
  144. #define LL_RCC_CIFR_LSERDYF RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
  145. #define LL_RCC_CIFR_MSIRDYF RCC_CIFR_MSIRDYF /*!< MSI Ready Interrupt flag */
  146. #define LL_RCC_CIFR_HSIRDYF RCC_CIFR_HSIRDYF /*!< HSI Ready Interrupt flag */
  147. #define LL_RCC_CIFR_HSERDYF RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
  148. #define LL_RCC_CIFR_PLLRDYF RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
  149. #if defined(RCC_HSI48_SUPPORT)
  150. #define LL_RCC_CIFR_HSI48RDYF RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
  151. #endif /* RCC_HSI48_SUPPORT */
  152. #if defined(RCC_PLLSAI1_SUPPORT)
  153. #define LL_RCC_CIFR_PLLSAI1RDYF RCC_CIFR_PLLSAI1RDYF /*!< PLLSAI1 Ready Interrupt flag */
  154. #endif /* RCC_PLLSAI1_SUPPORT */
  155. #if defined(RCC_PLLSAI2_SUPPORT)
  156. #define LL_RCC_CIFR_PLLSAI2RDYF RCC_CIFR_PLLSAI2RDYF /*!< PLLSAI2 Ready Interrupt flag */
  157. #endif /* RCC_PLLSAI2_SUPPORT */
  158. #define LL_RCC_CIFR_LSECSSF RCC_CIFR_LSECSSF /*!< LSE Clock Security System Interrupt flag */
  159. #define LL_RCC_CIFR_CSSF RCC_CIFR_CSSF /*!< Clock Security System Interrupt flag */
  160. #define LL_RCC_CSR_FWRSTF RCC_CSR_FWRSTF /*!< Firewall reset flag */
  161. #define LL_RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF /*!< Low-Power reset flag */
  162. #define LL_RCC_CSR_OBLRSTF RCC_CSR_OBLRSTF /*!< OBL reset flag */
  163. #define LL_RCC_CSR_PINRSTF RCC_CSR_PINRSTF /*!< PIN reset flag */
  164. #define LL_RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF /*!< Software Reset flag */
  165. #define LL_RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF /*!< Independent Watchdog reset flag */
  166. #define LL_RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF /*!< Window watchdog reset flag */
  167. #define LL_RCC_CSR_BORRSTF RCC_CSR_BORRSTF /*!< BOR reset flag */
  168. /**
  169. * @}
  170. */
  171. /** @defgroup RCC_LL_EC_IT IT Defines
  172. * @brief IT defines which can be used with LL_RCC_ReadReg and LL_RCC_WriteReg functions
  173. * @{
  174. */
  175. #define LL_RCC_CIER_LSIRDYIE RCC_CIER_LSIRDYIE /*!< LSI Ready Interrupt Enable */
  176. #define LL_RCC_CIER_LSERDYIE RCC_CIER_LSERDYIE /*!< LSE Ready Interrupt Enable */
  177. #define LL_RCC_CIER_MSIRDYIE RCC_CIER_MSIRDYIE /*!< MSI Ready Interrupt Enable */
  178. #define LL_RCC_CIER_HSIRDYIE RCC_CIER_HSIRDYIE /*!< HSI Ready Interrupt Enable */
  179. #define LL_RCC_CIER_HSERDYIE RCC_CIER_HSERDYIE /*!< HSE Ready Interrupt Enable */
  180. #define LL_RCC_CIER_PLLRDYIE RCC_CIER_PLLRDYIE /*!< PLL Ready Interrupt Enable */
  181. #if defined(RCC_HSI48_SUPPORT)
  182. #define LL_RCC_CIER_HSI48RDYIE RCC_CIER_HSI48RDYIE /*!< HSI48 Ready Interrupt Enable */
  183. #endif /* RCC_HSI48_SUPPORT */
  184. #if defined(RCC_PLLSAI1_SUPPORT)
  185. #define LL_RCC_CIER_PLLSAI1RDYIE RCC_CIER_PLLSAI1RDYIE /*!< PLLSAI1 Ready Interrupt Enable */
  186. #endif /* RCC_PLLSAI1_SUPPORT */
  187. #if defined(RCC_PLLSAI2_SUPPORT)
  188. #define LL_RCC_CIER_PLLSAI2RDYIE RCC_CIER_PLLSAI2RDYIE /*!< PLLSAI2 Ready Interrupt Enable */
  189. #endif /* RCC_PLLSAI2_SUPPORT */
  190. #define LL_RCC_CIER_LSECSSIE RCC_CIER_LSECSSIE /*!< LSE CSS Interrupt Enable */
  191. /**
  192. * @}
  193. */
  194. /** @defgroup RCC_LL_EC_LSEDRIVE LSE oscillator drive capability
  195. * @{
  196. */
  197. #define LL_RCC_LSEDRIVE_LOW 0x00000000U /*!< Xtal mode lower driving capability */
  198. #define LL_RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< Xtal mode medium low driving capability */
  199. #define LL_RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< Xtal mode medium high driving capability */
  200. #define LL_RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< Xtal mode higher driving capability */
  201. /**
  202. * @}
  203. */
  204. /** @defgroup RCC_LL_EC_MSIRANGE MSI clock ranges
  205. * @{
  206. */
  207. #define LL_RCC_MSIRANGE_0 RCC_CR_MSIRANGE_0 /*!< MSI = 100 KHz */
  208. #define LL_RCC_MSIRANGE_1 RCC_CR_MSIRANGE_1 /*!< MSI = 200 KHz */
  209. #define LL_RCC_MSIRANGE_2 RCC_CR_MSIRANGE_2 /*!< MSI = 400 KHz */
  210. #define LL_RCC_MSIRANGE_3 RCC_CR_MSIRANGE_3 /*!< MSI = 800 KHz */
  211. #define LL_RCC_MSIRANGE_4 RCC_CR_MSIRANGE_4 /*!< MSI = 1 MHz */
  212. #define LL_RCC_MSIRANGE_5 RCC_CR_MSIRANGE_5 /*!< MSI = 2 MHz */
  213. #define LL_RCC_MSIRANGE_6 RCC_CR_MSIRANGE_6 /*!< MSI = 4 MHz */
  214. #define LL_RCC_MSIRANGE_7 RCC_CR_MSIRANGE_7 /*!< MSI = 8 MHz */
  215. #define LL_RCC_MSIRANGE_8 RCC_CR_MSIRANGE_8 /*!< MSI = 16 MHz */
  216. #define LL_RCC_MSIRANGE_9 RCC_CR_MSIRANGE_9 /*!< MSI = 24 MHz */
  217. #define LL_RCC_MSIRANGE_10 RCC_CR_MSIRANGE_10 /*!< MSI = 32 MHz */
  218. #define LL_RCC_MSIRANGE_11 RCC_CR_MSIRANGE_11 /*!< MSI = 48 MHz */
  219. /**
  220. * @}
  221. */
  222. /** @defgroup RCC_LL_EC_MSISRANGE MSI range after Standby mode
  223. * @{
  224. */
  225. #define LL_RCC_MSISRANGE_4 RCC_CSR_MSISRANGE_1 /*!< MSI = 1 MHz */
  226. #define LL_RCC_MSISRANGE_5 RCC_CSR_MSISRANGE_2 /*!< MSI = 2 MHz */
  227. #define LL_RCC_MSISRANGE_6 RCC_CSR_MSISRANGE_4 /*!< MSI = 4 MHz */
  228. #define LL_RCC_MSISRANGE_7 RCC_CSR_MSISRANGE_8 /*!< MSI = 8 MHz */
  229. /**
  230. * @}
  231. */
  232. /** @defgroup RCC_LL_EC_LSCO_CLKSOURCE LSCO Selection
  233. * @{
  234. */
  235. #define LL_RCC_LSCO_CLKSOURCE_LSI 0x00000000U /*!< LSI selection for low speed clock */
  236. #define LL_RCC_LSCO_CLKSOURCE_LSE RCC_BDCR_LSCOSEL /*!< LSE selection for low speed clock */
  237. /**
  238. * @}
  239. */
  240. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch
  241. * @{
  242. */
  243. #define LL_RCC_SYS_CLKSOURCE_MSI RCC_CFGR_SW_MSI /*!< MSI selection as system clock */
  244. #define LL_RCC_SYS_CLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selection as system clock */
  245. #define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selection as system clock */
  246. #define LL_RCC_SYS_CLKSOURCE_PLL RCC_CFGR_SW_PLL /*!< PLL selection as system clock */
  247. /**
  248. * @}
  249. */
  250. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status
  251. * @{
  252. */
  253. #define LL_RCC_SYS_CLKSOURCE_STATUS_MSI RCC_CFGR_SWS_MSI /*!< MSI used as system clock */
  254. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
  255. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
  256. #define LL_RCC_SYS_CLKSOURCE_STATUS_PLL RCC_CFGR_SWS_PLL /*!< PLL used as system clock */
  257. /**
  258. * @}
  259. */
  260. /** @defgroup RCC_LL_EC_SYSCLK_DIV AHB prescaler
  261. * @{
  262. */
  263. #define LL_RCC_SYSCLK_DIV_1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */
  264. #define LL_RCC_SYSCLK_DIV_2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */
  265. #define LL_RCC_SYSCLK_DIV_4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */
  266. #define LL_RCC_SYSCLK_DIV_8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */
  267. #define LL_RCC_SYSCLK_DIV_16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */
  268. #define LL_RCC_SYSCLK_DIV_64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */
  269. #define LL_RCC_SYSCLK_DIV_128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
  270. #define LL_RCC_SYSCLK_DIV_256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
  271. #define LL_RCC_SYSCLK_DIV_512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
  272. /**
  273. * @}
  274. */
  275. /** @defgroup RCC_LL_EC_APB1_DIV APB low-speed prescaler (APB1)
  276. * @{
  277. */
  278. #define LL_RCC_APB1_DIV_1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */
  279. #define LL_RCC_APB1_DIV_2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */
  280. #define LL_RCC_APB1_DIV_4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */
  281. #define LL_RCC_APB1_DIV_8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */
  282. #define LL_RCC_APB1_DIV_16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */
  283. /**
  284. * @}
  285. */
  286. /** @defgroup RCC_LL_EC_APB2_DIV APB high-speed prescaler (APB2)
  287. * @{
  288. */
  289. #define LL_RCC_APB2_DIV_1 RCC_CFGR_PPRE2_DIV1 /*!< HCLK not divided */
  290. #define LL_RCC_APB2_DIV_2 RCC_CFGR_PPRE2_DIV2 /*!< HCLK divided by 2 */
  291. #define LL_RCC_APB2_DIV_4 RCC_CFGR_PPRE2_DIV4 /*!< HCLK divided by 4 */
  292. #define LL_RCC_APB2_DIV_8 RCC_CFGR_PPRE2_DIV8 /*!< HCLK divided by 8 */
  293. #define LL_RCC_APB2_DIV_16 RCC_CFGR_PPRE2_DIV16 /*!< HCLK divided by 16 */
  294. /**
  295. * @}
  296. */
  297. /** @defgroup RCC_LL_EC_STOP_WAKEUPCLOCK Wakeup from Stop and CSS backup clock selection
  298. * @{
  299. */
  300. #define LL_RCC_STOP_WAKEUPCLOCK_MSI 0x00000000U /*!< MSI selection after wake-up from STOP */
  301. #define LL_RCC_STOP_WAKEUPCLOCK_HSI RCC_CFGR_STOPWUCK /*!< HSI selection after wake-up from STOP */
  302. /**
  303. * @}
  304. */
  305. /** @defgroup RCC_LL_EC_MCO1SOURCE MCO1 SOURCE selection
  306. * @{
  307. */
  308. #define LL_RCC_MCO1SOURCE_NOCLOCK 0x00000000U /*!< MCO output disabled, no clock on MCO */
  309. #define LL_RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCOSEL_0 /*!< SYSCLK selection as MCO1 source */
  310. #define LL_RCC_MCO1SOURCE_MSI RCC_CFGR_MCOSEL_1 /*!< MSI selection as MCO1 source */
  311. #define LL_RCC_MCO1SOURCE_HSI (RCC_CFGR_MCOSEL_0| RCC_CFGR_MCOSEL_1) /*!< HSI16 selection as MCO1 source */
  312. #define LL_RCC_MCO1SOURCE_HSE RCC_CFGR_MCOSEL_2 /*!< HSE selection as MCO1 source */
  313. #define LL_RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_2) /*!< Main PLL selection as MCO1 source */
  314. #define LL_RCC_MCO1SOURCE_LSI (RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSI selection as MCO1 source */
  315. #define LL_RCC_MCO1SOURCE_LSE (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSE selection as MCO1 source */
  316. #if defined(RCC_HSI48_SUPPORT)
  317. #define LL_RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCOSEL_3 /*!< HSI48 selection as MCO1 source */
  318. #endif /* RCC_HSI48_SUPPORT */
  319. /**
  320. * @}
  321. */
  322. /** @defgroup RCC_LL_EC_MCO1_DIV MCO1 prescaler
  323. * @{
  324. */
  325. #define LL_RCC_MCO1_DIV_1 RCC_CFGR_MCOPRE_DIV1 /*!< MCO not divided */
  326. #define LL_RCC_MCO1_DIV_2 RCC_CFGR_MCOPRE_DIV2 /*!< MCO divided by 2 */
  327. #define LL_RCC_MCO1_DIV_4 RCC_CFGR_MCOPRE_DIV4 /*!< MCO divided by 4 */
  328. #define LL_RCC_MCO1_DIV_8 RCC_CFGR_MCOPRE_DIV8 /*!< MCO divided by 8 */
  329. #define LL_RCC_MCO1_DIV_16 RCC_CFGR_MCOPRE_DIV16 /*!< MCO divided by 16 */
  330. /**
  331. * @}
  332. */
  333. #if defined(USE_FULL_LL_DRIVER)
  334. /** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency
  335. * @{
  336. */
  337. #define LL_RCC_PERIPH_FREQUENCY_NO 0x00000000U /*!< No clock enabled for the peripheral */
  338. #define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFU /*!< Frequency cannot be provided as external clock */
  339. /**
  340. * @}
  341. */
  342. #endif /* USE_FULL_LL_DRIVER */
  343. /** @defgroup RCC_LL_EC_USART1_CLKSOURCE Peripheral USART clock source selection
  344. * @{
  345. */
  346. #define LL_RCC_USART1_CLKSOURCE_PCLK2 (RCC_CCIPR_USART1SEL << 16U) /*!< PCLK2 clock used as USART1 clock source */
  347. #define LL_RCC_USART1_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL_0) /*!< SYSCLK clock used as USART1 clock source */
  348. #define LL_RCC_USART1_CLKSOURCE_HSI ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL_1) /*!< HSI clock used as USART1 clock source */
  349. #define LL_RCC_USART1_CLKSOURCE_LSE ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL) /*!< LSE clock used as USART1 clock source */
  350. #define LL_RCC_USART2_CLKSOURCE_PCLK1 (RCC_CCIPR_USART2SEL << 16U) /*!< PCLK1 clock used as USART2 clock source */
  351. #define LL_RCC_USART2_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL_0) /*!< SYSCLK clock used as USART2 clock source */
  352. #define LL_RCC_USART2_CLKSOURCE_HSI ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL_1) /*!< HSI clock used as USART2 clock source */
  353. #define LL_RCC_USART2_CLKSOURCE_LSE ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL) /*!< LSE clock used as USART2 clock source */
  354. #if defined(RCC_CCIPR_USART3SEL)
  355. #define LL_RCC_USART3_CLKSOURCE_PCLK1 (RCC_CCIPR_USART3SEL << 16U) /*!< PCLK1 clock used as USART3 clock source */
  356. #define LL_RCC_USART3_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL_0) /*!< SYSCLK clock used as USART3 clock source */
  357. #define LL_RCC_USART3_CLKSOURCE_HSI ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL_1) /*!< HSI clock used as USART3 clock source */
  358. #define LL_RCC_USART3_CLKSOURCE_LSE ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL) /*!< LSE clock used as USART3 clock source */
  359. #endif /* RCC_CCIPR_USART3SEL */
  360. /**
  361. * @}
  362. */
  363. #if defined(RCC_CCIPR_UART4SEL) || defined(RCC_CCIPR_UART5SEL)
  364. /** @defgroup RCC_LL_EC_UART4_CLKSOURCE Peripheral UART clock source selection
  365. * @{
  366. */
  367. #if defined(RCC_CCIPR_UART4SEL)
  368. #define LL_RCC_UART4_CLKSOURCE_PCLK1 (RCC_CCIPR_UART4SEL << 16U) /*!< PCLK1 clock used as UART4 clock source */
  369. #define LL_RCC_UART4_CLKSOURCE_SYSCLK ((RCC_CCIPR_UART4SEL << 16U) | RCC_CCIPR_UART4SEL_0) /*!< SYSCLK clock used as UART4 clock source */
  370. #define LL_RCC_UART4_CLKSOURCE_HSI ((RCC_CCIPR_UART4SEL << 16U) | RCC_CCIPR_UART4SEL_1) /*!< HSI clock used as UART4 clock source */
  371. #define LL_RCC_UART4_CLKSOURCE_LSE ((RCC_CCIPR_UART4SEL << 16U) | RCC_CCIPR_UART4SEL) /*!< LSE clock used as UART4 clock source */
  372. #endif /* RCC_CCIPR_UART4SEL */
  373. #if defined(RCC_CCIPR_UART5SEL)
  374. #define LL_RCC_UART5_CLKSOURCE_PCLK1 (RCC_CCIPR_UART5SEL << 16U) /*!< PCLK1 clock used as UART5 clock source */
  375. #define LL_RCC_UART5_CLKSOURCE_SYSCLK ((RCC_CCIPR_UART5SEL << 16U) | RCC_CCIPR_UART5SEL_0) /*!< SYSCLK clock used as UART5 clock source */
  376. #define LL_RCC_UART5_CLKSOURCE_HSI ((RCC_CCIPR_UART5SEL << 16U) | RCC_CCIPR_UART5SEL_1) /*!< HSI clock used as UART5 clock source */
  377. #define LL_RCC_UART5_CLKSOURCE_LSE ((RCC_CCIPR_UART5SEL << 16U) | RCC_CCIPR_UART5SEL) /*!< LSE clock used as UART5 clock source */
  378. #endif /* RCC_CCIPR_UART5SEL */
  379. /**
  380. * @}
  381. */
  382. #endif /* RCC_CCIPR_UART4SEL || RCC_CCIPR_UART5SEL */
  383. /** @defgroup RCC_LL_EC_LPUART1_CLKSOURCE Peripheral LPUART clock source selection
  384. * @{
  385. */
  386. #define LL_RCC_LPUART1_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 clock used as LPUART1 clock source */
  387. #define LL_RCC_LPUART1_CLKSOURCE_SYSCLK RCC_CCIPR_LPUART1SEL_0 /*!< SYSCLK clock used as LPUART1 clock source */
  388. #define LL_RCC_LPUART1_CLKSOURCE_HSI RCC_CCIPR_LPUART1SEL_1 /*!< HSI clock used as LPUART1 clock source */
  389. #define LL_RCC_LPUART1_CLKSOURCE_LSE RCC_CCIPR_LPUART1SEL /*!< LSE clock used as LPUART1 clock source */
  390. /**
  391. * @}
  392. */
  393. /** @defgroup RCC_LL_EC_I2C1_CLKSOURCE Peripheral I2C clock source selection
  394. * @{
  395. */
  396. #define LL_RCC_I2C1_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C1 clock source */
  397. #define LL_RCC_I2C1_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U) | (RCC_CCIPR_I2C1SEL_0 >> RCC_CCIPR_I2C1SEL_Pos)) /*!< SYSCLK clock used as I2C1 clock source */
  398. #define LL_RCC_I2C1_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U) | (RCC_CCIPR_I2C1SEL_1 >> RCC_CCIPR_I2C1SEL_Pos)) /*!< HSI clock used as I2C1 clock source */
  399. #if defined(RCC_CCIPR_I2C2SEL)
  400. #define LL_RCC_I2C2_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C2 clock source */
  401. #define LL_RCC_I2C2_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U) | (RCC_CCIPR_I2C2SEL_0 >> RCC_CCIPR_I2C2SEL_Pos)) /*!< SYSCLK clock used as I2C2 clock source */
  402. #define LL_RCC_I2C2_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U) | (RCC_CCIPR_I2C2SEL_1 >> RCC_CCIPR_I2C2SEL_Pos)) /*!< HSI clock used as I2C2 clock source */
  403. #endif /* RCC_CCIPR_I2C2SEL */
  404. #define LL_RCC_I2C3_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C3 clock source */
  405. #define LL_RCC_I2C3_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U) | (RCC_CCIPR_I2C3SEL_0 >> RCC_CCIPR_I2C3SEL_Pos)) /*!< SYSCLK clock used as I2C3 clock source */
  406. #define LL_RCC_I2C3_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U) | (RCC_CCIPR_I2C3SEL_1 >> RCC_CCIPR_I2C3SEL_Pos)) /*!< HSI clock used as I2C3 clock source */
  407. #if defined(RCC_CCIPR2_I2C4SEL)
  408. #define LL_RCC_I2C4_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C4 clock source */
  409. #define LL_RCC_I2C4_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL_0 >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< SYSCLK clock used as I2C4 clock source */
  410. #define LL_RCC_I2C4_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL_1 >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< HSI clock used as I2C4 clock source */
  411. #endif /* RCC_CCIPR2_I2C4SEL */
  412. /**
  413. * @}
  414. */
  415. /** @defgroup RCC_LL_EC_LPTIM1_CLKSOURCE Peripheral LPTIM clock source selection
  416. * @{
  417. */
  418. #define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 RCC_CCIPR_LPTIM1SEL /*!< PCLK1 clock used as LPTIM1 clock source */
  419. #define LL_RCC_LPTIM1_CLKSOURCE_LSI (RCC_CCIPR_LPTIM1SEL | (RCC_CCIPR_LPTIM1SEL_0 >> 16U)) /*!< LSI clock used as LPTIM1 clock source */
  420. #define LL_RCC_LPTIM1_CLKSOURCE_HSI (RCC_CCIPR_LPTIM1SEL | (RCC_CCIPR_LPTIM1SEL_1 >> 16U)) /*!< HSI clock used as LPTIM1 clock source */
  421. #define LL_RCC_LPTIM1_CLKSOURCE_LSE (RCC_CCIPR_LPTIM1SEL | (RCC_CCIPR_LPTIM1SEL >> 16U)) /*!< LSE clock used as LPTIM1 clock source */
  422. #define LL_RCC_LPTIM2_CLKSOURCE_PCLK1 RCC_CCIPR_LPTIM2SEL /*!< PCLK1 clock used as LPTIM2 clock source */
  423. #define LL_RCC_LPTIM2_CLKSOURCE_LSI (RCC_CCIPR_LPTIM2SEL | (RCC_CCIPR_LPTIM2SEL_0 >> 16U)) /*!< LSI clock used as LPTIM2 clock source */
  424. #define LL_RCC_LPTIM2_CLKSOURCE_HSI (RCC_CCIPR_LPTIM2SEL | (RCC_CCIPR_LPTIM2SEL_1 >> 16U)) /*!< HSI clock used as LPTIM2 clock source */
  425. #define LL_RCC_LPTIM2_CLKSOURCE_LSE (RCC_CCIPR_LPTIM2SEL | (RCC_CCIPR_LPTIM2SEL >> 16U)) /*!< LSE clock used as LPTIM2 clock source */
  426. /**
  427. * @}
  428. */
  429. /** @defgroup RCC_LL_EC_SAI1_CLKSOURCE Peripheral SAI clock source selection
  430. * @{
  431. */
  432. #if defined(RCC_CCIPR2_SAI1SEL)
  433. #define LL_RCC_SAI1_CLKSOURCE_PLLSAI1 (RCC_CCIPR2_SAI1SEL << 16U) /*!< PLLSAI1 (PLLSAI1CLK) clock used as SAI1 clock source */
  434. #define LL_RCC_SAI1_CLKSOURCE_PLLSAI2 ((RCC_CCIPR2_SAI1SEL << 16U) | RCC_CCIPR2_SAI1SEL_0) /*!< PLLSAI2 (PLLSAI2CLK) clock used as SAI1 clock source */
  435. #define LL_RCC_SAI1_CLKSOURCE_PLL ((RCC_CCIPR2_SAI1SEL << 16U) | RCC_CCIPR2_SAI1SEL_1) /*!< PLL (PLLSAI3CLK) clock used as SAI1 clock source */
  436. #define LL_RCC_SAI1_CLKSOURCE_PIN ((RCC_CCIPR2_SAI1SEL << 16U) | (RCC_CCIPR2_SAI1SEL_1 | RCC_CCIPR2_SAI1SEL_0)) /*!< External input clock used as SAI1 clock source */
  437. #define LL_RCC_SAI1_CLKSOURCE_HSI ((RCC_CCIPR2_SAI1SEL << 16U) | RCC_CCIPR2_SAI1SEL_2) /*!< HSI clock used as SAI1 clock source */
  438. #elif defined(RCC_CCIPR_SAI1SEL)
  439. #define LL_RCC_SAI1_CLKSOURCE_PLLSAI1 RCC_CCIPR_SAI1SEL /*!< PLLSAI1 clock used as SAI1 clock source */
  440. #if defined(RCC_PLLSAI2_SUPPORT)
  441. #define LL_RCC_SAI1_CLKSOURCE_PLLSAI2 (RCC_CCIPR_SAI1SEL | (RCC_CCIPR_SAI1SEL_0 >> 16U)) /*!< PLLSAI2 clock used as SAI1 clock source */
  442. #endif /* RCC_PLLSAI2_SUPPORT */
  443. #define LL_RCC_SAI1_CLKSOURCE_PLL (RCC_CCIPR_SAI1SEL | (RCC_CCIPR_SAI1SEL_1 >> 16U)) /*!< PLL clock used as SAI1 clock source */
  444. #define LL_RCC_SAI1_CLKSOURCE_PIN (RCC_CCIPR_SAI1SEL | (RCC_CCIPR_SAI1SEL >> 16U)) /*!< External input clock used as SAI1 clock source */
  445. #endif /* RCC_CCIPR2_SAI1SEL */
  446. #if defined(RCC_CCIPR2_SAI2SEL)
  447. #define LL_RCC_SAI2_CLKSOURCE_PLLSAI1 (RCC_CCIPR2_SAI2SEL << 16U) /*!< PLLSAI1 (PLLSAI1CLK) clock used as SAI2 clock source */
  448. #define LL_RCC_SAI2_CLKSOURCE_PLLSAI2 ((RCC_CCIPR2_SAI2SEL << 16U) | RCC_CCIPR2_SAI2SEL_0) /*!< PLLSAI2 (PLLSAI2CLK) clock used as SAI2 clock source */
  449. #define LL_RCC_SAI2_CLKSOURCE_PLL ((RCC_CCIPR2_SAI2SEL << 16U) | RCC_CCIPR2_SAI2SEL_1) /*!< PLL (PLLSAI3CLK) clock used as SAI2 clock source */
  450. #define LL_RCC_SAI2_CLKSOURCE_PIN ((RCC_CCIPR2_SAI2SEL << 16U) | (RCC_CCIPR2_SAI2SEL_1 | RCC_CCIPR2_SAI2SEL_0)) /*!< External input clock used as SAI2 clock source */
  451. #define LL_RCC_SAI2_CLKSOURCE_HSI ((RCC_CCIPR2_SAI2SEL << 16U) | RCC_CCIPR2_SAI2SEL_2) /*!< HSI clock used as SAI2 clock source */
  452. #elif defined(RCC_CCIPR_SAI2SEL)
  453. #define LL_RCC_SAI2_CLKSOURCE_PLLSAI1 RCC_CCIPR_SAI2SEL /*!< PLLSAI1 clock used as SAI2 clock source */
  454. #if defined(RCC_PLLSAI2_SUPPORT)
  455. #define LL_RCC_SAI2_CLKSOURCE_PLLSAI2 (RCC_CCIPR_SAI2SEL | (RCC_CCIPR_SAI2SEL_0 >> 16U)) /*!< PLLSAI2 clock used as SAI2 clock source */
  456. #endif /* RCC_PLLSAI2_SUPPORT */
  457. #define LL_RCC_SAI2_CLKSOURCE_PLL (RCC_CCIPR_SAI2SEL | (RCC_CCIPR_SAI2SEL_1 >> 16U)) /*!< PLL clock used as SAI2 clock source */
  458. #define LL_RCC_SAI2_CLKSOURCE_PIN (RCC_CCIPR_SAI2SEL | (RCC_CCIPR_SAI2SEL >> 16U)) /*!< External input clock used as SAI2 clock source */
  459. #endif /* RCC_CCIPR2_SAI2SEL */
  460. /**
  461. * @}
  462. */
  463. #if defined(RCC_CCIPR2_SDMMCSEL)
  464. /** @defgroup RCC_LL_EC_SDMMC1_KERNELCLKSOURCE Peripheral SDMMC kernel clock source selection
  465. * @{
  466. */
  467. #define LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK 0x00000000U /*!< 48MHz clock from internal multiplexor used as SDMMC1 clock source */
  468. #define LL_RCC_SDMMC1_KERNELCLKSOURCE_PLLP RCC_CCIPR2_SDMMCSEL /*!< PLLSAI3CLK clock used as SDMMC1 clock source */
  469. /**
  470. * @}
  471. */
  472. #endif /* RCC_CCIPR2_SDMMCSEL */
  473. #if defined(SDMMC1)
  474. /** @defgroup RCC_LL_EC_SDMMC1_CLKSOURCE Peripheral SDMMC clock source selection
  475. * @{
  476. */
  477. #if defined(RCC_HSI48_SUPPORT)
  478. #define LL_RCC_SDMMC1_CLKSOURCE_HSI48 0x00000000U /*!< HSI48 clock used as SDMMC1 clock source */
  479. #else
  480. #define LL_RCC_SDMMC1_CLKSOURCE_NONE 0x00000000U /*!< No clock used as SDMMC1 clock source */
  481. #endif
  482. #if defined(RCC_PLLSAI1_SUPPORT)
  483. #define LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0 /*!< PLLSAI1 clock used as SDMMC1 clock source */
  484. #endif /* RCC_PLLSAI1_SUPPORT */
  485. #define LL_RCC_SDMMC1_CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 /*!< PLL clock used as SDMMC1 clock source */
  486. #define LL_RCC_SDMMC1_CLKSOURCE_MSI RCC_CCIPR_CLK48SEL /*!< MSI clock used as SDMMC1 clock source */
  487. /**
  488. * @}
  489. */
  490. #endif /* SDMMC1 */
  491. /** @defgroup RCC_LL_EC_RNG_CLKSOURCE Peripheral RNG clock source selection
  492. * @{
  493. */
  494. #if defined(RCC_HSI48_SUPPORT)
  495. #define LL_RCC_RNG_CLKSOURCE_HSI48 0x00000000U /*!< HSI48 clock used as RNG clock source */
  496. #else
  497. #define LL_RCC_RNG_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RNG clock source */
  498. #endif
  499. #if defined(RCC_PLLSAI1_SUPPORT)
  500. #define LL_RCC_RNG_CLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0 /*!< PLLSAI1 clock used as RNG clock source */
  501. #endif /* RCC_PLLSAI1_SUPPORT */
  502. #define LL_RCC_RNG_CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 /*!< PLL clock used as RNG clock source */
  503. #define LL_RCC_RNG_CLKSOURCE_MSI RCC_CCIPR_CLK48SEL /*!< MSI clock used as RNG clock source */
  504. /**
  505. * @}
  506. */
  507. #if defined(USB_OTG_FS) || defined(USB)
  508. /** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection
  509. * @{
  510. */
  511. #if defined(RCC_HSI48_SUPPORT)
  512. #define LL_RCC_USB_CLKSOURCE_HSI48 0x00000000U /*!< HSI48 clock used as USB clock source */
  513. #else
  514. #define LL_RCC_USB_CLKSOURCE_NONE 0x00000000U /*!< No clock used as USB clock source */
  515. #endif
  516. #if defined(RCC_PLLSAI1_SUPPORT)
  517. #define LL_RCC_USB_CLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0 /*!< PLLSAI1 clock used as USB clock source */
  518. #endif /* RCC_PLLSAI1_SUPPORT */
  519. #define LL_RCC_USB_CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 /*!< PLL clock used as USB clock source */
  520. #define LL_RCC_USB_CLKSOURCE_MSI RCC_CCIPR_CLK48SEL /*!< MSI clock used as USB clock source */
  521. /**
  522. * @}
  523. */
  524. #endif /* USB_OTG_FS || USB */
  525. /** @defgroup RCC_LL_EC_ADC_CLKSOURCE Peripheral ADC clock source selection
  526. * @{
  527. */
  528. #define LL_RCC_ADC_CLKSOURCE_NONE 0x00000000U /*!< No clock used as ADC clock source */
  529. #if defined(RCC_PLLSAI1_SUPPORT)
  530. #define LL_RCC_ADC_CLKSOURCE_PLLSAI1 RCC_CCIPR_ADCSEL_0 /*!< PLLSAI1 clock used as ADC clock source */
  531. #endif /* RCC_PLLSAI1_SUPPORT */
  532. #if defined(RCC_PLLSAI2_SUPPORT) && !defined(LTDC)
  533. #define LL_RCC_ADC_CLKSOURCE_PLLSAI2 RCC_CCIPR_ADCSEL_1 /*!< PLLSAI2 clock used as ADC clock source */
  534. #endif /* RCC_PLLSAI2_SUPPORT */
  535. #if defined(RCC_CCIPR_ADCSEL)
  536. #define LL_RCC_ADC_CLKSOURCE_SYSCLK RCC_CCIPR_ADCSEL /*!< SYSCLK clock used as ADC clock source */
  537. #else
  538. #define LL_RCC_ADC_CLKSOURCE_SYSCLK 0x30000000U /*!< SYSCLK clock used as ADC clock source */
  539. #endif
  540. /**
  541. * @}
  542. */
  543. #if defined(SWPMI1)
  544. /** @defgroup RCC_LL_EC_SWPMI1_CLKSOURCE Peripheral SWPMI1 clock source selection
  545. * @{
  546. */
  547. #define LL_RCC_SWPMI1_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 used as SWPMI1 clock source */
  548. #define LL_RCC_SWPMI1_CLKSOURCE_HSI RCC_CCIPR_SWPMI1SEL /*!< HSI used as SWPMI1 clock source */
  549. /**
  550. * @}
  551. */
  552. #endif /* SWPMI1 */
  553. #if defined(DFSDM1_Channel0)
  554. #if defined(RCC_CCIPR2_ADFSDM1SEL)
  555. /** @defgroup RCC_LL_EC_DFSDM1_AUDIO_CLKSOURCE Peripheral DFSDM1 Audio clock source selection
  556. * @{
  557. */
  558. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1 0x00000000U /*!< SAI1 clock used as DFSDM1 Audio clock */
  559. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI RCC_CCIPR2_ADFSDM1SEL_0 /*!< HSI clock used as DFSDM1 Audio clock */
  560. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI RCC_CCIPR2_ADFSDM1SEL_1 /*!< MSI clock used as DFSDM1 Audio clock */
  561. /**
  562. * @}
  563. */
  564. #endif /* RCC_CCIPR2_ADFSDM1SEL */
  565. /** @defgroup RCC_LL_EC_DFSDM1_CLKSOURCE Peripheral DFSDM1 clock source selection
  566. * @{
  567. */
  568. #if defined(RCC_CCIPR2_DFSDM1SEL)
  569. #define LL_RCC_DFSDM1_CLKSOURCE_PCLK2 0x00000000U /*!< PCLK2 used as DFSDM1 clock source */
  570. #define LL_RCC_DFSDM1_CLKSOURCE_SYSCLK RCC_CCIPR2_DFSDM1SEL /*!< SYSCLK used as DFSDM1 clock source */
  571. #else
  572. #define LL_RCC_DFSDM1_CLKSOURCE_PCLK2 0x00000000U /*!< PCLK2 used as DFSDM1 clock source */
  573. #define LL_RCC_DFSDM1_CLKSOURCE_SYSCLK RCC_CCIPR_DFSDM1SEL /*!< SYSCLK used as DFSDM1 clock source */
  574. #endif /* RCC_CCIPR2_DFSDM1SEL */
  575. /**
  576. * @}
  577. */
  578. #endif /* DFSDM1_Channel0 */
  579. #if defined(DSI)
  580. /** @defgroup RCC_LL_EC_DSI_CLKSOURCE Peripheral DSI clock source selection
  581. * @{
  582. */
  583. #define LL_RCC_DSI_CLKSOURCE_PHY 0x00000000U /*!< DSI-PHY clock used as DSI byte lane clock source */
  584. #define LL_RCC_DSI_CLKSOURCE_PLL RCC_CCIPR2_DSISEL /*!< PLL clock used as DSI byte lane clock source */
  585. /**
  586. * @}
  587. */
  588. #endif /* DSI */
  589. #if defined(LTDC)
  590. /** @defgroup RCC_LL_EC_LTDC_CLKSOURCE Peripheral LTDC clock source selection
  591. * @{
  592. */
  593. #define LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV2 0x00000000U /*!< PLLSAI2DIVR divided by 2 used as LTDC clock source */
  594. #define LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV4 RCC_CCIPR2_PLLSAI2DIVR_0 /*!< PLLSAI2DIVR divided by 4 used as LTDC clock source */
  595. #define LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV8 RCC_CCIPR2_PLLSAI2DIVR_1 /*!< PLLSAI2DIVR divided by 8 used as LTDC clock source */
  596. #define LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV16 RCC_CCIPR2_PLLSAI2DIVR /*!< PLLSAI2DIVR divided by 16 used as LTDC clock source */
  597. /**
  598. * @}
  599. */
  600. #endif /* LTDC */
  601. #if defined(OCTOSPI1)
  602. /** @defgroup RCC_LL_EC_OCTOSPI Peripheral OCTOSPI get clock source
  603. * @{
  604. */
  605. #define LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK 0x00000000U /*!< SYSCLK used as OctoSPI clock source */
  606. #define LL_RCC_OCTOSPI_CLKSOURCE_MSI RCC_CCIPR2_OSPISEL_0 /*!< MSI used as OctoSPI clock source */
  607. #define LL_RCC_OCTOSPI_CLKSOURCE_PLL RCC_CCIPR2_OSPISEL_1 /*!< PLL used as OctoSPI clock source */
  608. /**
  609. * @}
  610. */
  611. #endif /* OCTOSPI1 */
  612. /** @defgroup RCC_LL_EC_USART1 Peripheral USART get clock source
  613. * @{
  614. */
  615. #define LL_RCC_USART1_CLKSOURCE RCC_CCIPR_USART1SEL /*!< USART1 Clock source selection */
  616. #define LL_RCC_USART2_CLKSOURCE RCC_CCIPR_USART2SEL /*!< USART2 Clock source selection */
  617. #if defined(RCC_CCIPR_USART3SEL)
  618. #define LL_RCC_USART3_CLKSOURCE RCC_CCIPR_USART3SEL /*!< USART3 Clock source selection */
  619. #endif /* RCC_CCIPR_USART3SEL */
  620. /**
  621. * @}
  622. */
  623. #if defined(RCC_CCIPR_UART4SEL) || defined(RCC_CCIPR_UART5SEL)
  624. /** @defgroup RCC_LL_EC_UART4 Peripheral UART get clock source
  625. * @{
  626. */
  627. #if defined(RCC_CCIPR_UART4SEL)
  628. #define LL_RCC_UART4_CLKSOURCE RCC_CCIPR_UART4SEL /*!< UART4 Clock source selection */
  629. #endif /* RCC_CCIPR_UART4SEL */
  630. #if defined(RCC_CCIPR_UART5SEL)
  631. #define LL_RCC_UART5_CLKSOURCE RCC_CCIPR_UART5SEL /*!< UART5 Clock source selection */
  632. #endif /* RCC_CCIPR_UART5SEL */
  633. /**
  634. * @}
  635. */
  636. #endif /* RCC_CCIPR_UART4SEL || RCC_CCIPR_UART5SEL */
  637. /** @defgroup RCC_LL_EC_LPUART1 Peripheral LPUART get clock source
  638. * @{
  639. */
  640. #define LL_RCC_LPUART1_CLKSOURCE RCC_CCIPR_LPUART1SEL /*!< LPUART1 Clock source selection */
  641. /**
  642. * @}
  643. */
  644. /** @defgroup RCC_LL_EC_I2C1 Peripheral I2C get clock source
  645. * @{
  646. */
  647. #define LL_RCC_I2C1_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U) | (RCC_CCIPR_I2C1SEL >> RCC_CCIPR_I2C1SEL_Pos)) /*!< I2C1 Clock source selection */
  648. #if defined(RCC_CCIPR_I2C2SEL)
  649. #define LL_RCC_I2C2_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U) | (RCC_CCIPR_I2C2SEL >> RCC_CCIPR_I2C2SEL_Pos)) /*!< I2C2 Clock source selection */
  650. #endif /* RCC_CCIPR_I2C2SEL */
  651. #define LL_RCC_I2C3_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U) | (RCC_CCIPR_I2C3SEL >> RCC_CCIPR_I2C3SEL_Pos)) /*!< I2C3 Clock source selection */
  652. #if defined(RCC_CCIPR2_I2C4SEL)
  653. #define LL_RCC_I2C4_CLKSOURCE ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< I2C4 Clock source selection */
  654. #endif /* RCC_CCIPR2_I2C4SEL */
  655. /**
  656. * @}
  657. */
  658. /** @defgroup RCC_LL_EC_LPTIM1 Peripheral LPTIM get clock source
  659. * @{
  660. */
  661. #define LL_RCC_LPTIM1_CLKSOURCE RCC_CCIPR_LPTIM1SEL /*!< LPTIM1 Clock source selection */
  662. #define LL_RCC_LPTIM2_CLKSOURCE RCC_CCIPR_LPTIM2SEL /*!< LPTIM2 Clock source selection */
  663. /**
  664. * @}
  665. */
  666. #if defined(RCC_CCIPR_SAI1SEL) || defined(RCC_CCIPR2_SAI1SEL)
  667. /** @defgroup RCC_LL_EC_SAI1 Peripheral SAI get clock source
  668. * @{
  669. */
  670. #if defined(RCC_CCIPR2_SAI1SEL)
  671. #define LL_RCC_SAI1_CLKSOURCE RCC_CCIPR2_SAI1SEL /*!< SAI1 Clock source selection */
  672. #else
  673. #define LL_RCC_SAI1_CLKSOURCE RCC_CCIPR_SAI1SEL /*!< SAI1 Clock source selection */
  674. #endif /* RCC_CCIPR2_SAI1SEL */
  675. #if defined(RCC_CCIPR2_SAI2SEL)
  676. #define LL_RCC_SAI2_CLKSOURCE RCC_CCIPR2_SAI2SEL /*!< SAI2 Clock source selection */
  677. #elif defined(RCC_CCIPR_SAI2SEL)
  678. #define LL_RCC_SAI2_CLKSOURCE RCC_CCIPR_SAI2SEL /*!< SAI2 Clock source selection */
  679. #endif /* RCC_CCIPR2_SAI2SEL */
  680. /**
  681. * @}
  682. */
  683. #endif /* RCC_CCIPR_SAI1SEL || RCC_CCIPR2_SAI1SEL */
  684. #if defined(SDMMC1)
  685. #if defined(RCC_CCIPR2_SDMMCSEL)
  686. /** @defgroup RCC_LL_EC_SDMMC1_KERNEL Peripheral SDMMC get kernel clock source
  687. * @{
  688. */
  689. #define LL_RCC_SDMMC1_KERNELCLKSOURCE RCC_CCIPR2_SDMMCSEL /*!< SDMMC1 Kernel Clock source selection */
  690. /**
  691. * @}
  692. */
  693. #endif /* RCC_CCIPR2_SDMMCSEL */
  694. /** @defgroup RCC_LL_EC_SDMMC1 Peripheral SDMMC get clock source
  695. * @{
  696. */
  697. #define LL_RCC_SDMMC1_CLKSOURCE RCC_CCIPR_CLK48SEL /*!< SDMMC1 Clock source selection */
  698. /**
  699. * @}
  700. */
  701. #endif /* SDMMC1 */
  702. /** @defgroup RCC_LL_EC_RNG Peripheral RNG get clock source
  703. * @{
  704. */
  705. #define LL_RCC_RNG_CLKSOURCE RCC_CCIPR_CLK48SEL /*!< RNG Clock source selection */
  706. /**
  707. * @}
  708. */
  709. #if defined(USB_OTG_FS) || defined(USB)
  710. /** @defgroup RCC_LL_EC_USB Peripheral USB get clock source
  711. * @{
  712. */
  713. #define LL_RCC_USB_CLKSOURCE RCC_CCIPR_CLK48SEL /*!< USB Clock source selection */
  714. /**
  715. * @}
  716. */
  717. #endif /* USB_OTG_FS || USB */
  718. /** @defgroup RCC_LL_EC_ADC Peripheral ADC get clock source
  719. * @{
  720. */
  721. #if defined(RCC_CCIPR_ADCSEL)
  722. #define LL_RCC_ADC_CLKSOURCE RCC_CCIPR_ADCSEL /*!< ADC Clock source selection */
  723. #else
  724. #define LL_RCC_ADC_CLKSOURCE 0x30000000U /*!< ADC Clock source selection */
  725. #endif
  726. /**
  727. * @}
  728. */
  729. #if defined(SWPMI1)
  730. /** @defgroup RCC_LL_EC_SWPMI1 Peripheral SWPMI1 get clock source
  731. * @{
  732. */
  733. #define LL_RCC_SWPMI1_CLKSOURCE RCC_CCIPR_SWPMI1SEL /*!< SWPMI1 Clock source selection */
  734. /**
  735. * @}
  736. */
  737. #endif /* SWPMI1 */
  738. #if defined(DFSDM1_Channel0)
  739. #if defined(RCC_CCIPR2_ADFSDM1SEL)
  740. /** @defgroup RCC_LL_EC_DFSDM1_AUDIO Peripheral DFSDM1 Audio get clock source
  741. * @{
  742. */
  743. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE RCC_CCIPR2_ADFSDM1SEL /* DFSDM1 Audio Clock source selection */
  744. /**
  745. * @}
  746. */
  747. #endif /* RCC_CCIPR2_ADFSDM1SEL */
  748. /** @defgroup RCC_LL_EC_DFSDM1 Peripheral DFSDM1 get clock source
  749. * @{
  750. */
  751. #if defined(RCC_CCIPR2_DFSDM1SEL)
  752. #define LL_RCC_DFSDM1_CLKSOURCE RCC_CCIPR2_DFSDM1SEL /*!< DFSDM1 Clock source selection */
  753. #else
  754. #define LL_RCC_DFSDM1_CLKSOURCE RCC_CCIPR_DFSDM1SEL /*!< DFSDM1 Clock source selection */
  755. #endif /* RCC_CCIPR2_DFSDM1SEL */
  756. /**
  757. * @}
  758. */
  759. #endif /* DFSDM1_Channel0 */
  760. #if defined(DSI)
  761. /** @defgroup RCC_LL_EC_DSI Peripheral DSI get clock source
  762. * @{
  763. */
  764. #define LL_RCC_DSI_CLKSOURCE RCC_CCIPR2_DSISEL /*!< DSI Clock source selection */
  765. /**
  766. * @}
  767. */
  768. #endif /* DSI */
  769. #if defined(LTDC)
  770. /** @defgroup RCC_LL_EC_LTDC Peripheral LTDC get clock source
  771. * @{
  772. */
  773. #define LL_RCC_LTDC_CLKSOURCE RCC_CCIPR2_PLLSAI2DIVR /*!< LTDC Clock source selection */
  774. /**
  775. * @}
  776. */
  777. #endif /* LTDC */
  778. #if defined(OCTOSPI1)
  779. /** @defgroup RCC_LL_EC_OCTOSPI Peripheral OCTOSPI get clock source
  780. * @{
  781. */
  782. #define LL_RCC_OCTOSPI_CLKSOURCE RCC_CCIPR2_OSPISEL /*!< OctoSPI Clock source selection */
  783. /**
  784. * @}
  785. */
  786. #endif /* OCTOSPI1 */
  787. /** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection
  788. * @{
  789. */
  790. #define LL_RCC_RTC_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RTC clock */
  791. #define LL_RCC_RTC_CLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */
  792. #define LL_RCC_RTC_CLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */
  793. #define LL_RCC_RTC_CLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 32 used as RTC clock */
  794. /**
  795. * @}
  796. */
  797. /** @defgroup RCC_LL_EC_PLLSOURCE PLL, PLLSAI1 and PLLSAI2 entry clock source
  798. * @{
  799. */
  800. #define LL_RCC_PLLSOURCE_NONE 0x00000000U /*!< No clock */
  801. #define LL_RCC_PLLSOURCE_MSI RCC_PLLCFGR_PLLSRC_MSI /*!< MSI clock selected as PLL entry clock source */
  802. #define LL_RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI /*!< HSI16 clock selected as PLL entry clock source */
  803. #define LL_RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE /*!< HSE clock selected as PLL entry clock source */
  804. /**
  805. * @}
  806. */
  807. /** @defgroup RCC_LL_EC_PLLM_DIV PLL division factor
  808. * @{
  809. */
  810. #define LL_RCC_PLLM_DIV_1 0x00000000U /*!< Main PLL division factor for PLLM input by 1 */
  811. #define LL_RCC_PLLM_DIV_2 (RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 2 */
  812. #define LL_RCC_PLLM_DIV_3 (RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 3 */
  813. #define LL_RCC_PLLM_DIV_4 (RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 4 */
  814. #define LL_RCC_PLLM_DIV_5 (RCC_PLLCFGR_PLLM_2) /*!< Main PLL division factor for PLLM input by 5 */
  815. #define LL_RCC_PLLM_DIV_6 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 6 */
  816. #define LL_RCC_PLLM_DIV_7 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 7 */
  817. #define LL_RCC_PLLM_DIV_8 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 8 */
  818. #if defined(RCC_PLLM_DIV_1_16_SUPPORT)
  819. #define LL_RCC_PLLM_DIV_9 (RCC_PLLCFGR_PLLM_3) /*!< Main PLL division factor for PLLM input by 9 */
  820. #define LL_RCC_PLLM_DIV_10 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 10 */
  821. #define LL_RCC_PLLM_DIV_11 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 11 */
  822. #define LL_RCC_PLLM_DIV_12 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 12 */
  823. #define LL_RCC_PLLM_DIV_13 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< Main PLL division factor for PLLM input by 13 */
  824. #define LL_RCC_PLLM_DIV_14 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 14 */
  825. #define LL_RCC_PLLM_DIV_15 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 15 */
  826. #define LL_RCC_PLLM_DIV_16 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 16 */
  827. #endif /* RCC_PLLM_DIV_1_16_SUPPORT */
  828. /**
  829. * @}
  830. */
  831. /** @defgroup RCC_LL_EC_PLLR_DIV PLL division factor (PLLR)
  832. * @{
  833. */
  834. #define LL_RCC_PLLR_DIV_2 0x00000000U /*!< Main PLL division factor for PLLCLK (system clock) by 2 */
  835. #define LL_RCC_PLLR_DIV_4 (RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 4 */
  836. #define LL_RCC_PLLR_DIV_6 (RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 6 */
  837. #define LL_RCC_PLLR_DIV_8 (RCC_PLLCFGR_PLLR) /*!< Main PLL division factor for PLLCLK (system clock) by 8 */
  838. /**
  839. * @}
  840. */
  841. #if defined(RCC_PLLP_SUPPORT)
  842. /** @defgroup RCC_LL_EC_PLLP_DIV PLL division factor (PLLP)
  843. * @{
  844. */
  845. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  846. #define LL_RCC_PLLP_DIV_2 (RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 2 */
  847. #define LL_RCC_PLLP_DIV_3 (RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 3 */
  848. #define LL_RCC_PLLP_DIV_4 (RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 4 */
  849. #define LL_RCC_PLLP_DIV_5 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 5 */
  850. #define LL_RCC_PLLP_DIV_6 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 6 */
  851. #define LL_RCC_PLLP_DIV_7 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 7 */
  852. #define LL_RCC_PLLP_DIV_8 (RCC_PLLCFGR_PLLPDIV_3) /*!< Main PLL division factor for PLLP output by 8 */
  853. #define LL_RCC_PLLP_DIV_9 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 9 */
  854. #define LL_RCC_PLLP_DIV_10 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 10 */
  855. #define LL_RCC_PLLP_DIV_11 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 11 */
  856. #define LL_RCC_PLLP_DIV_12 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 12 */
  857. #define LL_RCC_PLLP_DIV_13 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 13 */
  858. #define LL_RCC_PLLP_DIV_14 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 14 */
  859. #define LL_RCC_PLLP_DIV_15 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 15 */
  860. #define LL_RCC_PLLP_DIV_16 (RCC_PLLCFGR_PLLPDIV_4) /*!< Main PLL division factor for PLLP output by 16 */
  861. #define LL_RCC_PLLP_DIV_17 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 17 */
  862. #define LL_RCC_PLLP_DIV_18 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 18 */
  863. #define LL_RCC_PLLP_DIV_19 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 19 */
  864. #define LL_RCC_PLLP_DIV_20 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 20 */
  865. #define LL_RCC_PLLP_DIV_21 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 21 */
  866. #define LL_RCC_PLLP_DIV_22 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 22 */
  867. #define LL_RCC_PLLP_DIV_23 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 23 */
  868. #define LL_RCC_PLLP_DIV_24 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3) /*!< Main PLL division factor for PLLP output by 24 */
  869. #define LL_RCC_PLLP_DIV_25 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 25 */
  870. #define LL_RCC_PLLP_DIV_26 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 26 */
  871. #define LL_RCC_PLLP_DIV_27 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 27 */
  872. #define LL_RCC_PLLP_DIV_28 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 28 */
  873. #define LL_RCC_PLLP_DIV_29 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 29 */
  874. #define LL_RCC_PLLP_DIV_30 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 30 */
  875. #define LL_RCC_PLLP_DIV_31 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 31 */
  876. #else
  877. #define LL_RCC_PLLP_DIV_7 0x00000000U /*!< Main PLL division factor for PLLP output by 7 */
  878. #define LL_RCC_PLLP_DIV_17 (RCC_PLLCFGR_PLLP) /*!< Main PLL division factor for PLLP output by 17 */
  879. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  880. /**
  881. * @}
  882. */
  883. #endif /* RCC_PLLP_SUPPORT */
  884. /** @defgroup RCC_LL_EC_PLLQ_DIV PLL division factor (PLLQ)
  885. * @{
  886. */
  887. #define LL_RCC_PLLQ_DIV_2 0x00000000U /*!< Main PLL division factor for PLLQ output by 2 */
  888. #define LL_RCC_PLLQ_DIV_4 (RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 4 */
  889. #define LL_RCC_PLLQ_DIV_6 (RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 6 */
  890. #define LL_RCC_PLLQ_DIV_8 (RCC_PLLCFGR_PLLQ) /*!< Main PLL division factor for PLLQ output by 8 */
  891. /**
  892. * @}
  893. */
  894. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT)
  895. /** @defgroup RCC_LL_EC_PLLSAI1M PLLSAI1 division factor (PLLSAI1M)
  896. * @{
  897. */
  898. #define LL_RCC_PLLSAI1M_DIV_1 0x00000000U /*!< PLLSAI1 division factor for PLLSAI1M input by 1 */
  899. #define LL_RCC_PLLSAI1M_DIV_2 (RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 2 */
  900. #define LL_RCC_PLLSAI1M_DIV_3 (RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 3 */
  901. #define LL_RCC_PLLSAI1M_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 4 */
  902. #define LL_RCC_PLLSAI1M_DIV_5 (RCC_PLLSAI1CFGR_PLLSAI1M_2) /*!< PLLSAI1 division factor for PLLSAI1M input by 5 */
  903. #define LL_RCC_PLLSAI1M_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 6 */
  904. #define LL_RCC_PLLSAI1M_DIV_7 (RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 7 */
  905. #define LL_RCC_PLLSAI1M_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 8 */
  906. #define LL_RCC_PLLSAI1M_DIV_9 (RCC_PLLSAI1CFGR_PLLSAI1M_3) /*!< PLLSAI1 division factor for PLLSAI1M input by 9 */
  907. #define LL_RCC_PLLSAI1M_DIV_10 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 10 */
  908. #define LL_RCC_PLLSAI1M_DIV_11 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 11 */
  909. #define LL_RCC_PLLSAI1M_DIV_12 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 12 */
  910. #define LL_RCC_PLLSAI1M_DIV_13 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2) /*!< PLLSAI1 division factor for PLLSAI1M input by 13 */
  911. #define LL_RCC_PLLSAI1M_DIV_14 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 14 */
  912. #define LL_RCC_PLLSAI1M_DIV_15 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 15 */
  913. #define LL_RCC_PLLSAI1M_DIV_16 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 16 */
  914. /**
  915. * @}
  916. */
  917. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT */
  918. #if defined(RCC_PLLSAI1_SUPPORT)
  919. /** @defgroup RCC_LL_EC_PLLSAI1Q PLLSAI1 division factor (PLLSAI1Q)
  920. * @{
  921. */
  922. #define LL_RCC_PLLSAI1Q_DIV_2 0x00000000U /*!< PLLSAI1 division factor for PLLSAI1Q output by 2 */
  923. #define LL_RCC_PLLSAI1Q_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1Q_0) /*!< PLLSAI1 division factor for PLLSAI1Q output by 4 */
  924. #define LL_RCC_PLLSAI1Q_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1Q_1) /*!< PLLSAI1 division factor for PLLSAI1Q output by 6 */
  925. #define LL_RCC_PLLSAI1Q_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1Q) /*!< PLLSAI1 division factor for PLLSAI1Q output by 8 */
  926. /**
  927. * @}
  928. */
  929. /** @defgroup RCC_LL_EC_PLLSAI1P PLLSAI1 division factor (PLLSAI1P)
  930. * @{
  931. */
  932. #if defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT)
  933. #define LL_RCC_PLLSAI1P_DIV_2 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 2 */
  934. #define LL_RCC_PLLSAI1P_DIV_3 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 3 */
  935. #define LL_RCC_PLLSAI1P_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 4 */
  936. #define LL_RCC_PLLSAI1P_DIV_5 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 5 */
  937. #define LL_RCC_PLLSAI1P_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 6 */
  938. #define LL_RCC_PLLSAI1P_DIV_7 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 7 */
  939. #define LL_RCC_PLLSAI1P_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3) /*!< PLLSAI1 division factor for PLLSAI1P output by 8 */
  940. #define LL_RCC_PLLSAI1P_DIV_9 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 9 */
  941. #define LL_RCC_PLLSAI1P_DIV_10 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 10 */
  942. #define LL_RCC_PLLSAI1P_DIV_11 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 1 */
  943. #define LL_RCC_PLLSAI1P_DIV_12 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 12 */
  944. #define LL_RCC_PLLSAI1P_DIV_13 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 13 */
  945. #define LL_RCC_PLLSAI1P_DIV_14 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 14 */
  946. #define LL_RCC_PLLSAI1P_DIV_15 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 15 */
  947. #define LL_RCC_PLLSAI1P_DIV_16 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4) /*!< PLLSAI1 division factor for PLLSAI1P output by 16 */
  948. #define LL_RCC_PLLSAI1P_DIV_17 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 17 */
  949. #define LL_RCC_PLLSAI1P_DIV_18 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 18 */
  950. #define LL_RCC_PLLSAI1P_DIV_19 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 19 */
  951. #define LL_RCC_PLLSAI1P_DIV_20 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 20 */
  952. #define LL_RCC_PLLSAI1P_DIV_21 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division fctor for PLLSAI1P output by 21 */
  953. #define LL_RCC_PLLSAI1P_DIV_22 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 22 */
  954. #define LL_RCC_PLLSAI1P_DIV_23 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 23 */
  955. #define LL_RCC_PLLSAI1P_DIV_24 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3) /*!< PLLSAI1 division factor for PLLSAI1P output by 24 */
  956. #define LL_RCC_PLLSAI1P_DIV_25 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 25 */
  957. #define LL_RCC_PLLSAI1P_DIV_26 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 26 */
  958. #define LL_RCC_PLLSAI1P_DIV_27 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 27 */
  959. #define LL_RCC_PLLSAI1P_DIV_28 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 28 */
  960. #define LL_RCC_PLLSAI1P_DIV_29 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 29 */
  961. #define LL_RCC_PLLSAI1P_DIV_30 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 30 */
  962. #define LL_RCC_PLLSAI1P_DIV_31 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 31 */
  963. #else
  964. #define LL_RCC_PLLSAI1P_DIV_7 0x00000000U /*!< PLLSAI1 division factor for PLLSAI1P output by 7 */
  965. #define LL_RCC_PLLSAI1P_DIV_17 (RCC_PLLSAI1CFGR_PLLSAI1P) /*!< PLLSAI1 division factor for PLLSAI1P output by 17 */
  966. #endif /* RCC_PLLSAI1P_DIV_2_31_SUPPORT */
  967. /**
  968. * @}
  969. */
  970. /** @defgroup RCC_LL_EC_PLLSAI1R PLLSAI1 division factor (PLLSAI1R)
  971. * @{
  972. */
  973. #define LL_RCC_PLLSAI1R_DIV_2 0x00000000U /*!< PLLSAI1 division factor for PLLSAI1R output by 2 */
  974. #define LL_RCC_PLLSAI1R_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1R_0) /*!< PLLSAI1 division factor for PLLSAI1R output by 4 */
  975. #define LL_RCC_PLLSAI1R_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1R_1) /*!< PLLSAI1 division factor for PLLSAI1R output by 6 */
  976. #define LL_RCC_PLLSAI1R_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1R) /*!< PLLSAI1 division factor for PLLSAI1R output by 8 */
  977. /**
  978. * @}
  979. */
  980. #endif /* RCC_PLLSAI1_SUPPORT */
  981. #if defined(RCC_PLLSAI2_SUPPORT)
  982. #if defined(RCC_PLLSAI2M_DIV_1_16_SUPPORT)
  983. /** @defgroup RCC_LL_EC_PLLSAI2M PLLSAI1 division factor (PLLSAI2M)
  984. * @{
  985. */
  986. #define LL_RCC_PLLSAI2M_DIV_1 0x00000000U /*!< PLLSAI2 division factor for PLLSAI2M input by 1 */
  987. #define LL_RCC_PLLSAI2M_DIV_2 (RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 2 */
  988. #define LL_RCC_PLLSAI2M_DIV_3 (RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 3 */
  989. #define LL_RCC_PLLSAI2M_DIV_4 (RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 4 */
  990. #define LL_RCC_PLLSAI2M_DIV_5 (RCC_PLLSAI2CFGR_PLLSAI2M_2) /*!< PLLSAI2 division factor for PLLSAI2M input by 5 */
  991. #define LL_RCC_PLLSAI2M_DIV_6 (RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 6 */
  992. #define LL_RCC_PLLSAI2M_DIV_7 (RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 7 */
  993. #define LL_RCC_PLLSAI2M_DIV_8 (RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 8 */
  994. #define LL_RCC_PLLSAI2M_DIV_9 (RCC_PLLSAI2CFGR_PLLSAI2M_3) /*!< PLLSAI2 division factor for PLLSAI2M input by 9 */
  995. #define LL_RCC_PLLSAI2M_DIV_10 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 10 */
  996. #define LL_RCC_PLLSAI2M_DIV_11 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 11 */
  997. #define LL_RCC_PLLSAI2M_DIV_12 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 12 */
  998. #define LL_RCC_PLLSAI2M_DIV_13 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2) /*!< PLLSAI2 division factor for PLLSAI2M input by 13 */
  999. #define LL_RCC_PLLSAI2M_DIV_14 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 14 */
  1000. #define LL_RCC_PLLSAI2M_DIV_15 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 15 */
  1001. #define LL_RCC_PLLSAI2M_DIV_16 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 16 */
  1002. /**
  1003. * @}
  1004. */
  1005. #endif /* RCC_PLLSAI2M_DIV_1_16_SUPPORT */
  1006. #if defined(RCC_PLLSAI2Q_DIV_SUPPORT)
  1007. /** @defgroup RCC_LL_EC_PLLSAI2Q PLLSAI2 division factor (PLLSAI2Q)
  1008. * @{
  1009. */
  1010. #define LL_RCC_PLLSAI2Q_DIV_2 0x00000000U /*!< PLLSAI2 division factor for PLLSAI2Q output by 2 */
  1011. #define LL_RCC_PLLSAI2Q_DIV_4 (RCC_PLLSAI2CFGR_PLLSAI2Q_0) /*!< PLLSAI2 division factor for PLLSAI2Q output by 4 */
  1012. #define LL_RCC_PLLSAI2Q_DIV_6 (RCC_PLLSAI2CFGR_PLLSAI2Q_1) /*!< PLLSAI2 division factor for PLLSAI2Q output by 6 */
  1013. #define LL_RCC_PLLSAI2Q_DIV_8 (RCC_PLLSAI2CFGR_PLLSAI2Q) /*!< PLLSAI2 division factor for PLLSAI2Q output by 8 */
  1014. /**
  1015. * @}
  1016. */
  1017. #endif /* RCC_PLLSAI2Q_DIV_SUPPORT */
  1018. /** @defgroup RCC_LL_EC_PLLSAI2P PLLSAI2 division factor (PLLSAI2P)
  1019. * @{
  1020. */
  1021. #if defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT)
  1022. #define LL_RCC_PLLSAI2P_DIV_2 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 2 */
  1023. #define LL_RCC_PLLSAI2P_DIV_3 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 3 */
  1024. #define LL_RCC_PLLSAI2P_DIV_4 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 4 */
  1025. #define LL_RCC_PLLSAI2P_DIV_5 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 5 */
  1026. #define LL_RCC_PLLSAI2P_DIV_6 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 6 */
  1027. #define LL_RCC_PLLSAI2P_DIV_7 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 7 */
  1028. #define LL_RCC_PLLSAI2P_DIV_8 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3) /*!< PLLSAI2 division factor for PLLSAI2P output by 8 */
  1029. #define LL_RCC_PLLSAI2P_DIV_9 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 9 */
  1030. #define LL_RCC_PLLSAI2P_DIV_10 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 10 */
  1031. #define LL_RCC_PLLSAI2P_DIV_11 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 1 */
  1032. #define LL_RCC_PLLSAI2P_DIV_12 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 12 */
  1033. #define LL_RCC_PLLSAI2P_DIV_13 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 13 */
  1034. #define LL_RCC_PLLSAI2P_DIV_14 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 14 */
  1035. #define LL_RCC_PLLSAI2P_DIV_15 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 15 */
  1036. #define LL_RCC_PLLSAI2P_DIV_16 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4) /*!< PLLSAI2 division factor for PLLSAI2P output by 16 */
  1037. #define LL_RCC_PLLSAI2P_DIV_17 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 17 */
  1038. #define LL_RCC_PLLSAI2P_DIV_18 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 18 */
  1039. #define LL_RCC_PLLSAI2P_DIV_19 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 19 */
  1040. #define LL_RCC_PLLSAI2P_DIV_20 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 20 */
  1041. #define LL_RCC_PLLSAI2P_DIV_21 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division fctor for PLLSAI2P output by 21 */
  1042. #define LL_RCC_PLLSAI2P_DIV_22 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 22 */
  1043. #define LL_RCC_PLLSAI2P_DIV_23 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 23 */
  1044. #define LL_RCC_PLLSAI2P_DIV_24 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3) /*!< PLLSAI2 division factor for PLLSAI2P output by 24 */
  1045. #define LL_RCC_PLLSAI2P_DIV_25 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 25 */
  1046. #define LL_RCC_PLLSAI2P_DIV_26 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 26 */
  1047. #define LL_RCC_PLLSAI2P_DIV_27 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 27 */
  1048. #define LL_RCC_PLLSAI2P_DIV_28 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 28 */
  1049. #define LL_RCC_PLLSAI2P_DIV_29 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 29 */
  1050. #define LL_RCC_PLLSAI2P_DIV_30 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 30 */
  1051. #define LL_RCC_PLLSAI2P_DIV_31 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 31 */
  1052. #else
  1053. #define LL_RCC_PLLSAI2P_DIV_7 0x00000000U /*!< PLLSAI2 division factor for PLLSAI2P output by 7 */
  1054. #define LL_RCC_PLLSAI2P_DIV_17 (RCC_PLLSAI2CFGR_PLLSAI2P) /*!< PLLSAI2 division factor for PLLSAI2P output by 17 */
  1055. #endif /* RCC_PLLSAI2P_DIV_2_31_SUPPORT */
  1056. /**
  1057. * @}
  1058. */
  1059. /** @defgroup RCC_LL_EC_PLLSAI2R PLLSAI2 division factor (PLLSAI2R)
  1060. * @{
  1061. */
  1062. #define LL_RCC_PLLSAI2R_DIV_2 0x00000000U /*!< PLLSAI2 division factor for PLLSAI2R output by 2 */
  1063. #define LL_RCC_PLLSAI2R_DIV_4 (RCC_PLLSAI2CFGR_PLLSAI2R_0) /*!< PLLSAI2 division factor for PLLSAI2R output by 4 */
  1064. #define LL_RCC_PLLSAI2R_DIV_6 (RCC_PLLSAI2CFGR_PLLSAI2R_1) /*!< PLLSAI2 division factor for PLLSAI2R output by 6 */
  1065. #define LL_RCC_PLLSAI2R_DIV_8 (RCC_PLLSAI2CFGR_PLLSAI2R) /*!< PLLSAI2 division factor for PLLSAI2R output by 8 */
  1066. /**
  1067. * @}
  1068. */
  1069. #if defined(RCC_CCIPR2_PLLSAI2DIVR)
  1070. /** @defgroup RCC_LL_EC_PLLSAI2DIVR PLLSAI2DIVR division factor (PLLSAI2DIVR)
  1071. * @{
  1072. */
  1073. #define LL_RCC_PLLSAI2DIVR_DIV_2 0x00000000U /*!< PLLSAI2 division factor for PLLSAI2DIVR output by 2 */
  1074. #define LL_RCC_PLLSAI2DIVR_DIV_4 RCC_CCIPR2_PLLSAI2DIVR_0 /*!< PLLSAI2 division factor for PLLSAI2DIVR output by 4 */
  1075. #define LL_RCC_PLLSAI2DIVR_DIV_8 RCC_CCIPR2_PLLSAI2DIVR_1 /*!< PLLSAI2 division factor for PLLSAI2DIVR output by 8 */
  1076. #define LL_RCC_PLLSAI2DIVR_DIV_16 (RCC_CCIPR2_PLLSAI2DIVR_1 | RCC_CCIPR2_PLLSAI2DIVR_0) /*!< PLLSAI2 division factor for PLLSAI2DIVR output by 16 */
  1077. /**
  1078. * @}
  1079. */
  1080. #endif /* RCC_CCIPR2_PLLSAI2DIVR */
  1081. #endif /* RCC_PLLSAI2_SUPPORT */
  1082. /** @defgroup RCC_LL_EC_MSIRANGESEL MSI clock range selection
  1083. * @{
  1084. */
  1085. #define LL_RCC_MSIRANGESEL_STANDBY 0U /*!< MSI Range is provided by MSISRANGE */
  1086. #define LL_RCC_MSIRANGESEL_RUN 1U /*!< MSI Range is provided by MSIRANGE */
  1087. /**
  1088. * @}
  1089. */
  1090. #if defined(RCC_CSR_LSIPREDIV)
  1091. /** @defgroup RCC_LL_EC_LSIPREDIV LSI division factor
  1092. * @{
  1093. */
  1094. #define LL_RCC_LSI_PREDIV_1 0x00000000U /*!< LSI division factor by 1 */
  1095. #define LL_RCC_LSI_PREDIV_128 RCC_CSR_LSIPREDIV /*!< LSI division factor by 128 */
  1096. /**
  1097. * @}
  1098. */
  1099. #endif /* RCC_CSR_LSIPREDIV */
  1100. /** Legacy definitions for compatibility purpose
  1101. @cond 0
  1102. */
  1103. #if defined(DFSDM1_Channel0)
  1104. #define LL_RCC_DFSDM1_CLKSOURCE_PCLK LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  1105. #define LL_RCC_DFSDM_CLKSOURCE_PCLK LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  1106. #define LL_RCC_DFSDM_CLKSOURCE_SYSCLK LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  1107. #define LL_RCC_DFSDM_CLKSOURCE LL_RCC_DFSDM1_CLKSOURCE
  1108. #endif /* DFSDM1_Channel0 */
  1109. #if defined(SWPMI1)
  1110. #define LL_RCC_SWPMI1_CLKSOURCE_PCLK LL_RCC_SWPMI1_CLKSOURCE_PCLK1
  1111. #endif /* SWPMI1 */
  1112. /**
  1113. @endcond
  1114. */
  1115. /**
  1116. * @}
  1117. */
  1118. /* Exported macro ------------------------------------------------------------*/
  1119. /** @defgroup RCC_LL_Exported_Macros RCC Exported Macros
  1120. * @{
  1121. */
  1122. /** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros
  1123. * @{
  1124. */
  1125. /**
  1126. * @brief Write a value in RCC register
  1127. * @param __REG__ Register to be written
  1128. * @param __VALUE__ Value to be written in the register
  1129. * @retval None
  1130. */
  1131. #define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, (__VALUE__))
  1132. /**
  1133. * @brief Read a value in RCC register
  1134. * @param __REG__ Register to be read
  1135. * @retval Register value
  1136. */
  1137. #define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__)
  1138. /**
  1139. * @}
  1140. */
  1141. /** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies
  1142. * @{
  1143. */
  1144. /**
  1145. * @brief Helper macro to calculate the PLLCLK frequency on system domain
  1146. * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1147. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ());
  1148. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1149. * @param __PLLM__ This parameter can be one of the following values:
  1150. * @arg @ref LL_RCC_PLLM_DIV_1
  1151. * @arg @ref LL_RCC_PLLM_DIV_2
  1152. * @arg @ref LL_RCC_PLLM_DIV_3
  1153. * @arg @ref LL_RCC_PLLM_DIV_4
  1154. * @arg @ref LL_RCC_PLLM_DIV_5
  1155. * @arg @ref LL_RCC_PLLM_DIV_6
  1156. * @arg @ref LL_RCC_PLLM_DIV_7
  1157. * @arg @ref LL_RCC_PLLM_DIV_8
  1158. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  1159. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  1160. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  1161. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  1162. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  1163. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  1164. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  1165. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  1166. *
  1167. * (*) value not defined in all devices.
  1168. * @param __PLLN__ Between 8 and 86 or 127 depending on devices
  1169. * @param __PLLR__ This parameter can be one of the following values:
  1170. * @arg @ref LL_RCC_PLLR_DIV_2
  1171. * @arg @ref LL_RCC_PLLR_DIV_4
  1172. * @arg @ref LL_RCC_PLLR_DIV_6
  1173. * @arg @ref LL_RCC_PLLR_DIV_8
  1174. * @retval PLL clock frequency (in Hz)
  1175. */
  1176. #define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  1177. ((((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos) + 1U) * 2U))
  1178. #if defined(RCC_PLLSAI1_SUPPORT)
  1179. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  1180. /**
  1181. * @brief Helper macro to calculate the PLLCLK frequency used on SAI domain
  1182. * @note ex: @ref __LL_RCC_CALC_PLLCLK_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1183. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
  1184. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1185. * @param __PLLM__ This parameter can be one of the following values:
  1186. * @arg @ref LL_RCC_PLLM_DIV_1
  1187. * @arg @ref LL_RCC_PLLM_DIV_2
  1188. * @arg @ref LL_RCC_PLLM_DIV_3
  1189. * @arg @ref LL_RCC_PLLM_DIV_4
  1190. * @arg @ref LL_RCC_PLLM_DIV_5
  1191. * @arg @ref LL_RCC_PLLM_DIV_6
  1192. * @arg @ref LL_RCC_PLLM_DIV_7
  1193. * @arg @ref LL_RCC_PLLM_DIV_8
  1194. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  1195. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  1196. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  1197. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  1198. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  1199. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  1200. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  1201. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  1202. *
  1203. * (*) value not defined in all devices.
  1204. * @param __PLLN__ Between 8 and 86 or 127 depending on devices
  1205. * @param __PLLP__ This parameter can be one of the following values:
  1206. * @arg @ref LL_RCC_PLLP_DIV_2
  1207. * @arg @ref LL_RCC_PLLP_DIV_3
  1208. * @arg @ref LL_RCC_PLLP_DIV_4
  1209. * @arg @ref LL_RCC_PLLP_DIV_5
  1210. * @arg @ref LL_RCC_PLLP_DIV_6
  1211. * @arg @ref LL_RCC_PLLP_DIV_7
  1212. * @arg @ref LL_RCC_PLLP_DIV_8
  1213. * @arg @ref LL_RCC_PLLP_DIV_9
  1214. * @arg @ref LL_RCC_PLLP_DIV_10
  1215. * @arg @ref LL_RCC_PLLP_DIV_11
  1216. * @arg @ref LL_RCC_PLLP_DIV_12
  1217. * @arg @ref LL_RCC_PLLP_DIV_13
  1218. * @arg @ref LL_RCC_PLLP_DIV_14
  1219. * @arg @ref LL_RCC_PLLP_DIV_15
  1220. * @arg @ref LL_RCC_PLLP_DIV_16
  1221. * @arg @ref LL_RCC_PLLP_DIV_17
  1222. * @arg @ref LL_RCC_PLLP_DIV_18
  1223. * @arg @ref LL_RCC_PLLP_DIV_19
  1224. * @arg @ref LL_RCC_PLLP_DIV_20
  1225. * @arg @ref LL_RCC_PLLP_DIV_21
  1226. * @arg @ref LL_RCC_PLLP_DIV_22
  1227. * @arg @ref LL_RCC_PLLP_DIV_23
  1228. * @arg @ref LL_RCC_PLLP_DIV_24
  1229. * @arg @ref LL_RCC_PLLP_DIV_25
  1230. * @arg @ref LL_RCC_PLLP_DIV_26
  1231. * @arg @ref LL_RCC_PLLP_DIV_27
  1232. * @arg @ref LL_RCC_PLLP_DIV_28
  1233. * @arg @ref LL_RCC_PLLP_DIV_29
  1234. * @arg @ref LL_RCC_PLLP_DIV_30
  1235. * @arg @ref LL_RCC_PLLP_DIV_31
  1236. * @retval PLL clock frequency (in Hz)
  1237. */
  1238. #define __LL_RCC_CALC_PLLCLK_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  1239. ((__PLLP__) >> RCC_PLLCFGR_PLLPDIV_Pos))
  1240. #else
  1241. /**
  1242. * @brief Helper macro to calculate the PLLCLK frequency used on SAI domain
  1243. * @note ex: @ref __LL_RCC_CALC_PLLCLK_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1244. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
  1245. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1246. * @param __PLLM__ This parameter can be one of the following values:
  1247. * @arg @ref LL_RCC_PLLM_DIV_1
  1248. * @arg @ref LL_RCC_PLLM_DIV_2
  1249. * @arg @ref LL_RCC_PLLM_DIV_3
  1250. * @arg @ref LL_RCC_PLLM_DIV_4
  1251. * @arg @ref LL_RCC_PLLM_DIV_5
  1252. * @arg @ref LL_RCC_PLLM_DIV_6
  1253. * @arg @ref LL_RCC_PLLM_DIV_7
  1254. * @arg @ref LL_RCC_PLLM_DIV_8
  1255. * @param __PLLN__ Between 8 and 86
  1256. * @param __PLLP__ This parameter can be one of the following values:
  1257. * @arg @ref LL_RCC_PLLP_DIV_7
  1258. * @arg @ref LL_RCC_PLLP_DIV_17
  1259. * @retval PLL clock frequency (in Hz)
  1260. */
  1261. #define __LL_RCC_CALC_PLLCLK_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  1262. (((__PLLP__) == LL_RCC_PLLP_DIV_7) ? 7U : 17U))
  1263. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  1264. #endif /* RCC_PLLSAI1_SUPPORT */
  1265. /**
  1266. * @brief Helper macro to calculate the PLLCLK frequency used on 48M domain
  1267. * @note ex: @ref __LL_RCC_CALC_PLLCLK_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1268. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  1269. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1270. * @param __PLLM__ This parameter can be one of the following values:
  1271. * @arg @ref LL_RCC_PLLM_DIV_1
  1272. * @arg @ref LL_RCC_PLLM_DIV_2
  1273. * @arg @ref LL_RCC_PLLM_DIV_3
  1274. * @arg @ref LL_RCC_PLLM_DIV_4
  1275. * @arg @ref LL_RCC_PLLM_DIV_5
  1276. * @arg @ref LL_RCC_PLLM_DIV_6
  1277. * @arg @ref LL_RCC_PLLM_DIV_7
  1278. * @arg @ref LL_RCC_PLLM_DIV_8
  1279. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  1280. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  1281. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  1282. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  1283. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  1284. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  1285. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  1286. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  1287. *
  1288. * (*) value not defined in all devices.
  1289. * @param __PLLN__ Between 8 and 86 or 127 depending on devices
  1290. * @param __PLLQ__ This parameter can be one of the following values:
  1291. * @arg @ref LL_RCC_PLLQ_DIV_2
  1292. * @arg @ref LL_RCC_PLLQ_DIV_4
  1293. * @arg @ref LL_RCC_PLLQ_DIV_6
  1294. * @arg @ref LL_RCC_PLLQ_DIV_8
  1295. * @retval PLL clock frequency (in Hz)
  1296. */
  1297. #define __LL_RCC_CALC_PLLCLK_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  1298. ((((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U) << 1U))
  1299. #if defined(RCC_PLLSAI1_SUPPORT)
  1300. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT) && defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT)
  1301. /**
  1302. * @brief Helper macro to calculate the PLLSAI1 frequency used for SAI domain
  1303. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI1_GetDivider (),
  1304. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetP ());
  1305. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1306. * @param __PLLSAI1M__ This parameter can be one of the following values:
  1307. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  1308. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  1309. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  1310. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  1311. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  1312. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  1313. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  1314. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  1315. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  1316. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  1317. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  1318. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  1319. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  1320. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  1321. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  1322. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  1323. * @param __PLLSAI1N__ Between 8 and 86 or 127 depending on devices
  1324. * @param __PLLSAI1P__ This parameter can be one of the following values:
  1325. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  1326. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  1327. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  1328. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  1329. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  1330. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  1331. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  1332. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  1333. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  1334. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  1335. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  1336. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  1337. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  1338. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  1339. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  1340. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  1341. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  1342. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  1343. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  1344. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  1345. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  1346. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  1347. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  1348. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  1349. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  1350. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  1351. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  1352. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  1353. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  1354. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  1355. * @retval PLLSAI1 clock frequency (in Hz)
  1356. */
  1357. #define __LL_RCC_CALC_PLLSAI1_SAI_FREQ(__INPUTFREQ__, __PLLSAI1M__, __PLLSAI1N__, __PLLSAI1P__) \
  1358. ((__INPUTFREQ__) / ((((__PLLSAI1M__) >> RCC_PLLSAI1CFGR_PLLSAI1M_Pos) + 1U)) * (__PLLSAI1N__) / \
  1359. ((__PLLSAI1P__) >> RCC_PLLSAI1CFGR_PLLSAI1PDIV_Pos))
  1360. #elif defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT)
  1361. /**
  1362. * @brief Helper macro to calculate the PLLSAI1 frequency used for SAI domain
  1363. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1364. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetP ());
  1365. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1366. * @param __PLLM__ This parameter can be one of the following values:
  1367. * @arg @ref LL_RCC_PLLM_DIV_1
  1368. * @arg @ref LL_RCC_PLLM_DIV_2
  1369. * @arg @ref LL_RCC_PLLM_DIV_3
  1370. * @arg @ref LL_RCC_PLLM_DIV_4
  1371. * @arg @ref LL_RCC_PLLM_DIV_5
  1372. * @arg @ref LL_RCC_PLLM_DIV_6
  1373. * @arg @ref LL_RCC_PLLM_DIV_7
  1374. * @arg @ref LL_RCC_PLLM_DIV_8
  1375. * @param __PLLSAI1N__ Between 8 and 86 or 127 depending on devices
  1376. * @param __PLLSAI1P__ This parameter can be one of the following values:
  1377. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  1378. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  1379. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  1380. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  1381. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  1382. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  1383. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  1384. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  1385. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  1386. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  1387. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  1388. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  1389. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  1390. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  1391. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  1392. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  1393. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  1394. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  1395. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  1396. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  1397. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  1398. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  1399. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  1400. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  1401. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  1402. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  1403. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  1404. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  1405. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  1406. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  1407. * @retval PLLSAI1 clock frequency (in Hz)
  1408. */
  1409. #define __LL_RCC_CALC_PLLSAI1_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI1N__, __PLLSAI1P__) \
  1410. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLSAI1N__) / \
  1411. ((__PLLSAI1P__) >> RCC_PLLSAI1CFGR_PLLSAI1PDIV_Pos))
  1412. #else
  1413. /**
  1414. * @brief Helper macro to calculate the PLLSAI1 frequency used for SAI domain
  1415. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1416. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetP ());
  1417. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1418. * @param __PLLM__ This parameter can be one of the following values:
  1419. * @arg @ref LL_RCC_PLLM_DIV_1
  1420. * @arg @ref LL_RCC_PLLM_DIV_2
  1421. * @arg @ref LL_RCC_PLLM_DIV_3
  1422. * @arg @ref LL_RCC_PLLM_DIV_4
  1423. * @arg @ref LL_RCC_PLLM_DIV_5
  1424. * @arg @ref LL_RCC_PLLM_DIV_6
  1425. * @arg @ref LL_RCC_PLLM_DIV_7
  1426. * @arg @ref LL_RCC_PLLM_DIV_8
  1427. * @param __PLLSAI1N__ Between 8 and 86
  1428. * @param __PLLSAI1P__ This parameter can be one of the following values:
  1429. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  1430. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  1431. * @retval PLLSAI1 clock frequency (in Hz)
  1432. */
  1433. #define __LL_RCC_CALC_PLLSAI1_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI1N__, __PLLSAI1P__) \
  1434. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLSAI1N__) / \
  1435. (((__PLLSAI1P__) == LL_RCC_PLLSAI1P_DIV_7) ? 7U : 17U))
  1436. #endif /* RCC_PLLSAI1P_DIV_2_31_SUPPORT */
  1437. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT)
  1438. /**
  1439. * @brief Helper macro to calculate the PLLSAI1 frequency used on 48M domain
  1440. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI1_GetDivider (),
  1441. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetQ ());
  1442. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1443. * @param __PLLSAI1M__ This parameter can be one of the following values:
  1444. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  1445. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  1446. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  1447. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  1448. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  1449. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  1450. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  1451. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  1452. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  1453. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  1454. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  1455. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  1456. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  1457. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  1458. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  1459. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  1460. * @param __PLLSAI1N__ Between 8 and 86 or 127 depending on devices
  1461. * @param __PLLSAI1Q__ This parameter can be one of the following values:
  1462. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  1463. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  1464. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  1465. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  1466. * @retval PLLSAI1 clock frequency (in Hz)
  1467. */
  1468. #define __LL_RCC_CALC_PLLSAI1_48M_FREQ(__INPUTFREQ__, __PLLSAI1M__, __PLLSAI1N__, __PLLSAI1Q__) \
  1469. ((__INPUTFREQ__) / ((((__PLLSAI1M__) >> RCC_PLLSAI1CFGR_PLLSAI1M_Pos) + 1U)) * (__PLLSAI1N__) / \
  1470. ((((__PLLSAI1Q__) >> RCC_PLLSAI1CFGR_PLLSAI1Q_Pos) + 1U) << 1U))
  1471. #else
  1472. /**
  1473. * @brief Helper macro to calculate the PLLSAI1 frequency used on 48M domain
  1474. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1475. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetQ ());
  1476. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1477. * @param __PLLM__ This parameter can be one of the following values:
  1478. * @arg @ref LL_RCC_PLLM_DIV_1
  1479. * @arg @ref LL_RCC_PLLM_DIV_2
  1480. * @arg @ref LL_RCC_PLLM_DIV_3
  1481. * @arg @ref LL_RCC_PLLM_DIV_4
  1482. * @arg @ref LL_RCC_PLLM_DIV_5
  1483. * @arg @ref LL_RCC_PLLM_DIV_6
  1484. * @arg @ref LL_RCC_PLLM_DIV_7
  1485. * @arg @ref LL_RCC_PLLM_DIV_8
  1486. * @param __PLLSAI1N__ Between 8 and 86
  1487. * @param __PLLSAI1Q__ This parameter can be one of the following values:
  1488. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  1489. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  1490. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  1491. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  1492. * @retval PLLSAI1 clock frequency (in Hz)
  1493. */
  1494. #define __LL_RCC_CALC_PLLSAI1_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI1N__, __PLLSAI1Q__) \
  1495. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLSAI1N__) / \
  1496. ((((__PLLSAI1Q__) >> RCC_PLLSAI1CFGR_PLLSAI1Q_Pos) + 1U) << 1U))
  1497. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT */
  1498. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT)
  1499. /**
  1500. * @brief Helper macro to calculate the PLLSAI1 frequency used on ADC domain
  1501. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_ADC_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI1_GetDivider (),
  1502. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetR ());
  1503. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1504. * @param __PLLSAI1M__ This parameter can be one of the following values:
  1505. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  1506. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  1507. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  1508. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  1509. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  1510. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  1511. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  1512. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  1513. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  1514. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  1515. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  1516. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  1517. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  1518. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  1519. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  1520. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  1521. * @param __PLLSAI1N__ Between 8 and 86 or 127 depending on devices
  1522. * @param __PLLSAI1R__ This parameter can be one of the following values:
  1523. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  1524. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  1525. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  1526. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  1527. * @retval PLLSAI1 clock frequency (in Hz)
  1528. */
  1529. #define __LL_RCC_CALC_PLLSAI1_ADC_FREQ(__INPUTFREQ__, __PLLSAI1M__, __PLLSAI1N__, __PLLSAI1R__) \
  1530. ((__INPUTFREQ__) / ((((__PLLSAI1M__) >> RCC_PLLSAI1CFGR_PLLSAI1M_Pos) + 1U)) * (__PLLSAI1N__) / \
  1531. ((((__PLLSAI1R__) >> RCC_PLLSAI1CFGR_PLLSAI1R_Pos) + 1U) << 1U))
  1532. #else
  1533. /**
  1534. * @brief Helper macro to calculate the PLLSAI1 frequency used on ADC domain
  1535. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_ADC_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1536. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetR ());
  1537. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1538. * @param __PLLM__ This parameter can be one of the following values:
  1539. * @arg @ref LL_RCC_PLLM_DIV_1
  1540. * @arg @ref LL_RCC_PLLM_DIV_2
  1541. * @arg @ref LL_RCC_PLLM_DIV_3
  1542. * @arg @ref LL_RCC_PLLM_DIV_4
  1543. * @arg @ref LL_RCC_PLLM_DIV_5
  1544. * @arg @ref LL_RCC_PLLM_DIV_6
  1545. * @arg @ref LL_RCC_PLLM_DIV_7
  1546. * @arg @ref LL_RCC_PLLM_DIV_8
  1547. * @param __PLLSAI1N__ Between 8 and 86
  1548. * @param __PLLSAI1R__ This parameter can be one of the following values:
  1549. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  1550. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  1551. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  1552. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  1553. * @retval PLLSAI1 clock frequency (in Hz)
  1554. */
  1555. #define __LL_RCC_CALC_PLLSAI1_ADC_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI1N__, __PLLSAI1R__) \
  1556. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLSAI1N__) / \
  1557. ((((__PLLSAI1R__) >> RCC_PLLSAI1CFGR_PLLSAI1R_Pos) + 1U) << 1U))
  1558. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT */
  1559. #endif /* RCC_PLLSAI1_SUPPORT */
  1560. #if defined(RCC_PLLSAI2M_DIV_1_16_SUPPORT) && defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT)
  1561. /**
  1562. * @brief Helper macro to calculate the PLLSAI2 frequency used for SAI domain
  1563. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI2_GetDivider (),
  1564. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetP ());
  1565. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1566. * @param __PLLSAI2M__ This parameter can be one of the following values:
  1567. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  1568. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  1569. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  1570. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  1571. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  1572. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  1573. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  1574. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  1575. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  1576. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  1577. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  1578. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  1579. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  1580. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  1581. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  1582. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  1583. * @param __PLLSAI2N__ Between 8 and 86 or 127 depending on devices
  1584. * @param __PLLSAI2P__ This parameter can be one of the following values:
  1585. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  1586. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  1587. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  1588. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  1589. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  1590. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  1591. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  1592. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  1593. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  1594. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  1595. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  1596. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  1597. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  1598. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  1599. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  1600. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  1601. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  1602. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  1603. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  1604. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  1605. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  1606. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  1607. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  1608. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  1609. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  1610. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  1611. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  1612. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  1613. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  1614. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  1615. * @retval PLLSAI2 clock frequency (in Hz)
  1616. */
  1617. #define __LL_RCC_CALC_PLLSAI2_SAI_FREQ(__INPUTFREQ__, __PLLSAI2M__, __PLLSAI2N__, __PLLSAI2P__) \
  1618. ((__INPUTFREQ__) / ((((__PLLSAI2M__) >> RCC_PLLSAI2CFGR_PLLSAI2M_Pos) + 1U)) * (__PLLSAI2N__) / \
  1619. ((__PLLSAI2P__) >> RCC_PLLSAI2CFGR_PLLSAI2PDIV_Pos))
  1620. #elif defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT)
  1621. /**
  1622. * @brief Helper macro to calculate the PLLSAI2 frequency used for SAI domain
  1623. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1624. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetP ());
  1625. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1626. * @param __PLLM__ This parameter can be one of the following values:
  1627. * @arg @ref LL_RCC_PLLM_DIV_1
  1628. * @arg @ref LL_RCC_PLLM_DIV_2
  1629. * @arg @ref LL_RCC_PLLM_DIV_3
  1630. * @arg @ref LL_RCC_PLLM_DIV_4
  1631. * @arg @ref LL_RCC_PLLM_DIV_5
  1632. * @arg @ref LL_RCC_PLLM_DIV_6
  1633. * @arg @ref LL_RCC_PLLM_DIV_7
  1634. * @arg @ref LL_RCC_PLLM_DIV_8
  1635. * @param __PLLSAI2N__ Between 8 and 86 or 127 depending on devices
  1636. * @param __PLLSAI2P__ This parameter can be one of the following values:
  1637. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  1638. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  1639. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  1640. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  1641. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  1642. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  1643. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  1644. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  1645. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  1646. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  1647. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  1648. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  1649. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  1650. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  1651. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  1652. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  1653. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  1654. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  1655. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  1656. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  1657. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  1658. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  1659. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  1660. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  1661. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  1662. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  1663. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  1664. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  1665. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  1666. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  1667. * @retval PLLSAI2 clock frequency (in Hz)
  1668. */
  1669. #define __LL_RCC_CALC_PLLSAI2_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI2N__, __PLLSAI2P__) \
  1670. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLSAI2N__) / \
  1671. ((__PLLSAI2P__) >> RCC_PLLSAI2CFGR_PLLSAI2PDIV_Pos))
  1672. #else
  1673. /**
  1674. * @brief Helper macro to calculate the PLLSAI2 frequency used for SAI domain
  1675. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1676. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetP ());
  1677. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1678. * @param __PLLM__ This parameter can be one of the following values:
  1679. * @arg @ref LL_RCC_PLLM_DIV_1
  1680. * @arg @ref LL_RCC_PLLM_DIV_2
  1681. * @arg @ref LL_RCC_PLLM_DIV_3
  1682. * @arg @ref LL_RCC_PLLM_DIV_4
  1683. * @arg @ref LL_RCC_PLLM_DIV_5
  1684. * @arg @ref LL_RCC_PLLM_DIV_6
  1685. * @arg @ref LL_RCC_PLLM_DIV_7
  1686. * @arg @ref LL_RCC_PLLM_DIV_8
  1687. * @param __PLLSAI2N__ Between 8 and 86
  1688. * @param __PLLSAI2P__ This parameter can be one of the following values:
  1689. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  1690. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  1691. * @retval PLLSAI2 clock frequency (in Hz)
  1692. */
  1693. #define __LL_RCC_CALC_PLLSAI2_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI2N__, __PLLSAI2P__) \
  1694. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1)) * (__PLLSAI2N__) / \
  1695. (((__PLLSAI2P__) == LL_RCC_PLLSAI2P_DIV_7) ? 7U : 17U))
  1696. #endif /* RCC_PLLSAI2P_DIV_2_31_SUPPORT */
  1697. #if defined(LTDC)
  1698. /**
  1699. * @brief Helper macro to calculate the PLLSAI2 frequency used for LTDC domain
  1700. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_LTDC_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI2_GetDivider (),
  1701. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetR (), @ref LL_RCC_PLLSAI2_GetDIVR ());
  1702. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI/MSI)
  1703. * @param __PLLSAI2M__ This parameter can be one of the following values:
  1704. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  1705. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  1706. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  1707. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  1708. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  1709. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  1710. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  1711. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  1712. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  1713. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  1714. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  1715. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  1716. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  1717. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  1718. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  1719. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  1720. * @param __PLLSAI2N__ Between 8 and 127
  1721. * @param __PLLSAI2R__ This parameter can be one of the following values:
  1722. * @arg @ref LL_RCC_PLLSAI2R_DIV_2
  1723. * @arg @ref LL_RCC_PLLSAI2R_DIV_4
  1724. * @arg @ref LL_RCC_PLLSAI2R_DIV_6
  1725. * @arg @ref LL_RCC_PLLSAI2R_DIV_8
  1726. * @param __PLLSAI2DIVR__ This parameter can be one of the following values:
  1727. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_2
  1728. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_4
  1729. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_8
  1730. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_16
  1731. * @retval PLLSAI2 clock frequency (in Hz)
  1732. */
  1733. #define __LL_RCC_CALC_PLLSAI2_LTDC_FREQ(__INPUTFREQ__, __PLLSAI2M__, __PLLSAI2N__, __PLLSAI2R__, __PLLSAI2DIVR__) \
  1734. (((__INPUTFREQ__) / (((__PLLSAI2M__)>> RCC_PLLSAI2CFGR_PLLSAI2M_Pos) + 1U)) * (__PLLSAI2N__) / \
  1735. (((((__PLLSAI2R__) >> RCC_PLLSAI2CFGR_PLLSAI2R_Pos ) + 1U) << 1U) * (2UL << ((__PLLSAI2DIVR__) >> RCC_CCIPR2_PLLSAI2DIVR_Pos))))
  1736. #elif defined(RCC_PLLSAI2_SUPPORT)
  1737. /**
  1738. * @brief Helper macro to calculate the PLLSAI2 frequency used on ADC domain
  1739. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_ADC_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1740. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetR ());
  1741. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1742. * @param __PLLM__ This parameter can be one of the following values:
  1743. * @arg @ref LL_RCC_PLLM_DIV_1
  1744. * @arg @ref LL_RCC_PLLM_DIV_2
  1745. * @arg @ref LL_RCC_PLLM_DIV_3
  1746. * @arg @ref LL_RCC_PLLM_DIV_4
  1747. * @arg @ref LL_RCC_PLLM_DIV_5
  1748. * @arg @ref LL_RCC_PLLM_DIV_6
  1749. * @arg @ref LL_RCC_PLLM_DIV_7
  1750. * @arg @ref LL_RCC_PLLM_DIV_8
  1751. * @param __PLLSAI2N__ Between 8 and 86
  1752. * @param __PLLSAI2R__ This parameter can be one of the following values:
  1753. * @arg @ref LL_RCC_PLLSAI2R_DIV_2
  1754. * @arg @ref LL_RCC_PLLSAI2R_DIV_4
  1755. * @arg @ref LL_RCC_PLLSAI2R_DIV_6
  1756. * @arg @ref LL_RCC_PLLSAI2R_DIV_8
  1757. * @retval PLLSAI2 clock frequency (in Hz)
  1758. */
  1759. #define __LL_RCC_CALC_PLLSAI2_ADC_FREQ(__INPUTFREQ__, __PLLM__, __PLLSAI2N__, __PLLSAI2R__) \
  1760. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLSAI2N__) / \
  1761. ((((__PLLSAI2R__) >> RCC_PLLSAI2CFGR_PLLSAI2R_Pos ) + 1U) << 1U))
  1762. #endif /* LTDC */
  1763. #if defined(DSI)
  1764. /**
  1765. * @brief Helper macro to calculate the PLLDSICLK frequency used on DSI
  1766. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_DSI_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI2_GetDivider (),
  1767. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetQ ());
  1768. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI/MSI)
  1769. * @param __PLLSAI2M__ This parameter can be one of the following values:
  1770. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  1771. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  1772. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  1773. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  1774. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  1775. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  1776. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  1777. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  1778. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  1779. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  1780. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  1781. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  1782. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  1783. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  1784. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  1785. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  1786. * @param __PLLSAI2N__ Between 8 and 127
  1787. * @param __PLLSAI2Q__ This parameter can be one of the following values:
  1788. * @arg @ref LL_RCC_PLLSAI2Q_DIV_2
  1789. * @arg @ref LL_RCC_PLLSAI2Q_DIV_4
  1790. * @arg @ref LL_RCC_PLLSAI2Q_DIV_6
  1791. * @arg @ref LL_RCC_PLLSAI2Q_DIV_8
  1792. * @retval PLL clock frequency (in Hz)
  1793. */
  1794. #define __LL_RCC_CALC_PLLSAI2_DSI_FREQ(__INPUTFREQ__, __PLLSAI2M__, __PLLSAI2N__, __PLLSAI2Q__) \
  1795. ((__INPUTFREQ__) / ((((__PLLSAI2M__) >> RCC_PLLSAI2CFGR_PLLSAI2M_Pos) + 1U)) * (__PLLSAI2N__) / \
  1796. ((((__PLLSAI2Q__) >> RCC_PLLSAI2CFGR_PLLSAI2Q_Pos) + 1U) << 1U))
  1797. #endif /* DSI */
  1798. /**
  1799. * @brief Helper macro to calculate the HCLK frequency
  1800. * @param __SYSCLKFREQ__ SYSCLK frequency (based on MSI/HSE/HSI/PLLCLK)
  1801. * @param __AHBPRESCALER__ This parameter can be one of the following values:
  1802. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1803. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1804. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1805. * @arg @ref LL_RCC_SYSCLK_DIV_8
  1806. * @arg @ref LL_RCC_SYSCLK_DIV_16
  1807. * @arg @ref LL_RCC_SYSCLK_DIV_64
  1808. * @arg @ref LL_RCC_SYSCLK_DIV_128
  1809. * @arg @ref LL_RCC_SYSCLK_DIV_256
  1810. * @arg @ref LL_RCC_SYSCLK_DIV_512
  1811. * @retval HCLK clock frequency (in Hz)
  1812. */
  1813. #define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __AHBPRESCALER__) ((__SYSCLKFREQ__) >> AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos])
  1814. /**
  1815. * @brief Helper macro to calculate the PCLK1 frequency (ABP1)
  1816. * @param __HCLKFREQ__ HCLK frequency
  1817. * @param __APB1PRESCALER__ This parameter can be one of the following values:
  1818. * @arg @ref LL_RCC_APB1_DIV_1
  1819. * @arg @ref LL_RCC_APB1_DIV_2
  1820. * @arg @ref LL_RCC_APB1_DIV_4
  1821. * @arg @ref LL_RCC_APB1_DIV_8
  1822. * @arg @ref LL_RCC_APB1_DIV_16
  1823. * @retval PCLK1 clock frequency (in Hz)
  1824. */
  1825. #define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB1PRESCALER__) >> RCC_CFGR_PPRE1_Pos])
  1826. /**
  1827. * @brief Helper macro to calculate the PCLK2 frequency (ABP2)
  1828. * @param __HCLKFREQ__ HCLK frequency
  1829. * @param __APB2PRESCALER__ This parameter can be one of the following values:
  1830. * @arg @ref LL_RCC_APB2_DIV_1
  1831. * @arg @ref LL_RCC_APB2_DIV_2
  1832. * @arg @ref LL_RCC_APB2_DIV_4
  1833. * @arg @ref LL_RCC_APB2_DIV_8
  1834. * @arg @ref LL_RCC_APB2_DIV_16
  1835. * @retval PCLK2 clock frequency (in Hz)
  1836. */
  1837. #define __LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB2PRESCALER__) >> RCC_CFGR_PPRE2_Pos])
  1838. /**
  1839. * @brief Helper macro to calculate the MSI frequency (in Hz)
  1840. * @note __MSISEL__ can be retrieved thanks to function LL_RCC_MSI_IsEnabledRangeSelect()
  1841. * @note if __MSISEL__ is equal to LL_RCC_MSIRANGESEL_STANDBY,
  1842. * __MSIRANGE__can be retrieved by LL_RCC_MSI_GetRangeAfterStandby()
  1843. * else by LL_RCC_MSI_GetRange()
  1844. * ex: __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
  1845. * (LL_RCC_MSI_IsEnabledRangeSelect()?
  1846. * LL_RCC_MSI_GetRange():
  1847. * LL_RCC_MSI_GetRangeAfterStandby()))
  1848. * @param __MSISEL__ This parameter can be one of the following values:
  1849. * @arg @ref LL_RCC_MSIRANGESEL_STANDBY
  1850. * @arg @ref LL_RCC_MSIRANGESEL_RUN
  1851. * @param __MSIRANGE__ This parameter can be one of the following values:
  1852. * @arg @ref LL_RCC_MSIRANGE_0
  1853. * @arg @ref LL_RCC_MSIRANGE_1
  1854. * @arg @ref LL_RCC_MSIRANGE_2
  1855. * @arg @ref LL_RCC_MSIRANGE_3
  1856. * @arg @ref LL_RCC_MSIRANGE_4
  1857. * @arg @ref LL_RCC_MSIRANGE_5
  1858. * @arg @ref LL_RCC_MSIRANGE_6
  1859. * @arg @ref LL_RCC_MSIRANGE_7
  1860. * @arg @ref LL_RCC_MSIRANGE_8
  1861. * @arg @ref LL_RCC_MSIRANGE_9
  1862. * @arg @ref LL_RCC_MSIRANGE_10
  1863. * @arg @ref LL_RCC_MSIRANGE_11
  1864. * @arg @ref LL_RCC_MSISRANGE_4
  1865. * @arg @ref LL_RCC_MSISRANGE_5
  1866. * @arg @ref LL_RCC_MSISRANGE_6
  1867. * @arg @ref LL_RCC_MSISRANGE_7
  1868. * @retval MSI clock frequency (in Hz)
  1869. */
  1870. #define __LL_RCC_CALC_MSI_FREQ(__MSISEL__, __MSIRANGE__) (((__MSISEL__) == LL_RCC_MSIRANGESEL_STANDBY) ? \
  1871. (MSIRangeTable[(__MSIRANGE__) >> 8U]) : \
  1872. (MSIRangeTable[(__MSIRANGE__) >> 4U]))
  1873. /**
  1874. * @}
  1875. */
  1876. /**
  1877. * @}
  1878. */
  1879. /* Exported functions --------------------------------------------------------*/
  1880. /** @defgroup RCC_LL_Exported_Functions RCC Exported Functions
  1881. * @{
  1882. */
  1883. /** @defgroup RCC_LL_EF_HSE HSE
  1884. * @{
  1885. */
  1886. /**
  1887. * @brief Enable the Clock Security System.
  1888. * @rmtoll CR CSSON LL_RCC_HSE_EnableCSS
  1889. * @retval None
  1890. */
  1891. __STATIC_INLINE void LL_RCC_HSE_EnableCSS(void)
  1892. {
  1893. SET_BIT(RCC->CR, RCC_CR_CSSON);
  1894. }
  1895. /**
  1896. * @brief Enable HSE external oscillator (HSE Bypass)
  1897. * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass
  1898. * @retval None
  1899. */
  1900. __STATIC_INLINE void LL_RCC_HSE_EnableBypass(void)
  1901. {
  1902. SET_BIT(RCC->CR, RCC_CR_HSEBYP);
  1903. }
  1904. /**
  1905. * @brief Disable HSE external oscillator (HSE Bypass)
  1906. * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass
  1907. * @retval None
  1908. */
  1909. __STATIC_INLINE void LL_RCC_HSE_DisableBypass(void)
  1910. {
  1911. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);
  1912. }
  1913. /**
  1914. * @brief Enable HSE crystal oscillator (HSE ON)
  1915. * @rmtoll CR HSEON LL_RCC_HSE_Enable
  1916. * @retval None
  1917. */
  1918. __STATIC_INLINE void LL_RCC_HSE_Enable(void)
  1919. {
  1920. SET_BIT(RCC->CR, RCC_CR_HSEON);
  1921. }
  1922. /**
  1923. * @brief Disable HSE crystal oscillator (HSE ON)
  1924. * @rmtoll CR HSEON LL_RCC_HSE_Disable
  1925. * @retval None
  1926. */
  1927. __STATIC_INLINE void LL_RCC_HSE_Disable(void)
  1928. {
  1929. CLEAR_BIT(RCC->CR, RCC_CR_HSEON);
  1930. }
  1931. /**
  1932. * @brief Check if HSE oscillator Ready
  1933. * @rmtoll CR HSERDY LL_RCC_HSE_IsReady
  1934. * @retval State of bit (1 or 0).
  1935. */
  1936. __STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void)
  1937. {
  1938. return ((READ_BIT(RCC->CR, RCC_CR_HSERDY) == RCC_CR_HSERDY) ? 1UL : 0UL);
  1939. }
  1940. /**
  1941. * @}
  1942. */
  1943. /** @defgroup RCC_LL_EF_HSI HSI
  1944. * @{
  1945. */
  1946. /**
  1947. * @brief Enable HSI even in stop mode
  1948. * @note HSI oscillator is forced ON even in Stop mode
  1949. * @rmtoll CR HSIKERON LL_RCC_HSI_EnableInStopMode
  1950. * @retval None
  1951. */
  1952. __STATIC_INLINE void LL_RCC_HSI_EnableInStopMode(void)
  1953. {
  1954. SET_BIT(RCC->CR, RCC_CR_HSIKERON);
  1955. }
  1956. /**
  1957. * @brief Disable HSI in stop mode
  1958. * @rmtoll CR HSIKERON LL_RCC_HSI_DisableInStopMode
  1959. * @retval None
  1960. */
  1961. __STATIC_INLINE void LL_RCC_HSI_DisableInStopMode(void)
  1962. {
  1963. CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON);
  1964. }
  1965. /**
  1966. * @brief Check if HSI is enabled in stop mode
  1967. * @rmtoll CR HSIKERON LL_RCC_HSI_IsEnabledInStopMode
  1968. * @retval State of bit (1 or 0).
  1969. */
  1970. __STATIC_INLINE uint32_t LL_RCC_HSI_IsEnabledInStopMode(void)
  1971. {
  1972. return ((READ_BIT(RCC->CR, RCC_CR_HSIKERON) == RCC_CR_HSIKERON) ? 1UL : 0UL);
  1973. }
  1974. /**
  1975. * @brief Enable HSI oscillator
  1976. * @rmtoll CR HSION LL_RCC_HSI_Enable
  1977. * @retval None
  1978. */
  1979. __STATIC_INLINE void LL_RCC_HSI_Enable(void)
  1980. {
  1981. SET_BIT(RCC->CR, RCC_CR_HSION);
  1982. }
  1983. /**
  1984. * @brief Disable HSI oscillator
  1985. * @rmtoll CR HSION LL_RCC_HSI_Disable
  1986. * @retval None
  1987. */
  1988. __STATIC_INLINE void LL_RCC_HSI_Disable(void)
  1989. {
  1990. CLEAR_BIT(RCC->CR, RCC_CR_HSION);
  1991. }
  1992. /**
  1993. * @brief Check if HSI clock is ready
  1994. * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady
  1995. * @retval State of bit (1 or 0).
  1996. */
  1997. __STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
  1998. {
  1999. return ((READ_BIT(RCC->CR, RCC_CR_HSIRDY) == RCC_CR_HSIRDY) ? 1UL : 0UL);
  2000. }
  2001. /**
  2002. * @brief Enable HSI Automatic from stop mode
  2003. * @rmtoll CR HSIASFS LL_RCC_HSI_EnableAutoFromStop
  2004. * @retval None
  2005. */
  2006. __STATIC_INLINE void LL_RCC_HSI_EnableAutoFromStop(void)
  2007. {
  2008. SET_BIT(RCC->CR, RCC_CR_HSIASFS);
  2009. }
  2010. /**
  2011. * @brief Disable HSI Automatic from stop mode
  2012. * @rmtoll CR HSIASFS LL_RCC_HSI_DisableAutoFromStop
  2013. * @retval None
  2014. */
  2015. __STATIC_INLINE void LL_RCC_HSI_DisableAutoFromStop(void)
  2016. {
  2017. CLEAR_BIT(RCC->CR, RCC_CR_HSIASFS);
  2018. }
  2019. /**
  2020. * @brief Get HSI Calibration value
  2021. * @note When HSITRIM is written, HSICAL is updated with the sum of
  2022. * HSITRIM and the factory trim value
  2023. * @rmtoll ICSCR HSICAL LL_RCC_HSI_GetCalibration
  2024. * @retval Between Min_Data = 0x00 and Max_Data = 0xFF
  2025. */
  2026. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void)
  2027. {
  2028. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_HSICAL) >> RCC_ICSCR_HSICAL_Pos);
  2029. }
  2030. /**
  2031. * @brief Set HSI Calibration trimming
  2032. * @note user-programmable trimming value that is added to the HSICAL
  2033. * @note Default value is 16 on STM32L43x/STM32L44x/STM32L47x/STM32L48x or 64 on other devices,
  2034. * which, when added to the HSICAL value, should trim the HSI to 16 MHz +/- 1 %
  2035. * @rmtoll ICSCR HSITRIM LL_RCC_HSI_SetCalibTrimming
  2036. * @param Value Between Min_Data = 0 and Max_Data = 31 on STM32L43x/STM32L44x/STM32L47x/STM32L48x or
  2037. * between Min_Data = 0 and Max_Data = 127 on other devices
  2038. * @retval None
  2039. */
  2040. __STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value)
  2041. {
  2042. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, Value << RCC_ICSCR_HSITRIM_Pos);
  2043. }
  2044. /**
  2045. * @brief Get HSI Calibration trimming
  2046. * @rmtoll ICSCR HSITRIM LL_RCC_HSI_GetCalibTrimming
  2047. * @retval Between Min_Data = 0 and Max_Data = 31 on STM32L43x/STM32L44x/STM32L47x/STM32L48x or
  2048. * between Min_Data = 0 and Max_Data = 127 on other devices
  2049. */
  2050. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void)
  2051. {
  2052. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_HSITRIM) >> RCC_ICSCR_HSITRIM_Pos);
  2053. }
  2054. /**
  2055. * @}
  2056. */
  2057. #if defined(RCC_HSI48_SUPPORT)
  2058. /** @defgroup RCC_LL_EF_HSI48 HSI48
  2059. * @{
  2060. */
  2061. /**
  2062. * @brief Enable HSI48
  2063. * @rmtoll CRRCR HSI48ON LL_RCC_HSI48_Enable
  2064. * @retval None
  2065. */
  2066. __STATIC_INLINE void LL_RCC_HSI48_Enable(void)
  2067. {
  2068. SET_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON);
  2069. }
  2070. /**
  2071. * @brief Disable HSI48
  2072. * @rmtoll CRRCR HSI48ON LL_RCC_HSI48_Disable
  2073. * @retval None
  2074. */
  2075. __STATIC_INLINE void LL_RCC_HSI48_Disable(void)
  2076. {
  2077. CLEAR_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON);
  2078. }
  2079. /**
  2080. * @brief Check if HSI48 oscillator Ready
  2081. * @rmtoll CRRCR HSI48RDY LL_RCC_HSI48_IsReady
  2082. * @retval State of bit (1 or 0).
  2083. */
  2084. __STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
  2085. {
  2086. return ((READ_BIT(RCC->CRRCR, RCC_CRRCR_HSI48RDY) == RCC_CRRCR_HSI48RDY) ? 1UL : 0UL);
  2087. }
  2088. /**
  2089. * @brief Get HSI48 Calibration value
  2090. * @rmtoll CRRCR HSI48CAL LL_RCC_HSI48_GetCalibration
  2091. * @retval Between Min_Data = 0x00 and Max_Data = 0x1FF
  2092. */
  2093. __STATIC_INLINE uint32_t LL_RCC_HSI48_GetCalibration(void)
  2094. {
  2095. return (uint32_t)(READ_BIT(RCC->CRRCR, RCC_CRRCR_HSI48CAL) >> RCC_CRRCR_HSI48CAL_Pos);
  2096. }
  2097. /**
  2098. * @}
  2099. */
  2100. #endif /* RCC_HSI48_SUPPORT */
  2101. /** @defgroup RCC_LL_EF_LSE LSE
  2102. * @{
  2103. */
  2104. /**
  2105. * @brief Enable Low Speed External (LSE) crystal.
  2106. * @rmtoll BDCR LSEON LL_RCC_LSE_Enable
  2107. * @retval None
  2108. */
  2109. __STATIC_INLINE void LL_RCC_LSE_Enable(void)
  2110. {
  2111. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  2112. }
  2113. /**
  2114. * @brief Disable Low Speed External (LSE) crystal.
  2115. * @rmtoll BDCR LSEON LL_RCC_LSE_Disable
  2116. * @retval None
  2117. */
  2118. __STATIC_INLINE void LL_RCC_LSE_Disable(void)
  2119. {
  2120. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  2121. }
  2122. /**
  2123. * @brief Enable external clock source (LSE bypass).
  2124. * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass
  2125. * @retval None
  2126. */
  2127. __STATIC_INLINE void LL_RCC_LSE_EnableBypass(void)
  2128. {
  2129. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  2130. }
  2131. /**
  2132. * @brief Disable external clock source (LSE bypass).
  2133. * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass
  2134. * @retval None
  2135. */
  2136. __STATIC_INLINE void LL_RCC_LSE_DisableBypass(void)
  2137. {
  2138. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  2139. }
  2140. /**
  2141. * @brief Set LSE oscillator drive capability
  2142. * @note The oscillator is in Xtal mode when it is not in bypass mode.
  2143. * @rmtoll BDCR LSEDRV LL_RCC_LSE_SetDriveCapability
  2144. * @param LSEDrive This parameter can be one of the following values:
  2145. * @arg @ref LL_RCC_LSEDRIVE_LOW
  2146. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  2147. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  2148. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  2149. * @retval None
  2150. */
  2151. __STATIC_INLINE void LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive)
  2152. {
  2153. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, LSEDrive);
  2154. }
  2155. /**
  2156. * @brief Get LSE oscillator drive capability
  2157. * @rmtoll BDCR LSEDRV LL_RCC_LSE_GetDriveCapability
  2158. * @retval Returned value can be one of the following values:
  2159. * @arg @ref LL_RCC_LSEDRIVE_LOW
  2160. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  2161. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  2162. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  2163. */
  2164. __STATIC_INLINE uint32_t LL_RCC_LSE_GetDriveCapability(void)
  2165. {
  2166. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSEDRV));
  2167. }
  2168. /**
  2169. * @brief Enable Clock security system on LSE.
  2170. * @rmtoll BDCR LSECSSON LL_RCC_LSE_EnableCSS
  2171. * @retval None
  2172. */
  2173. __STATIC_INLINE void LL_RCC_LSE_EnableCSS(void)
  2174. {
  2175. SET_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  2176. }
  2177. /**
  2178. * @brief Disable Clock security system on LSE.
  2179. * @note Clock security system can be disabled only after a LSE
  2180. * failure detection. In that case it MUST be disabled by software.
  2181. * @rmtoll BDCR LSECSSON LL_RCC_LSE_DisableCSS
  2182. * @retval None
  2183. */
  2184. __STATIC_INLINE void LL_RCC_LSE_DisableCSS(void)
  2185. {
  2186. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  2187. }
  2188. /**
  2189. * @brief Check if LSE oscillator Ready
  2190. * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady
  2191. * @retval State of bit (1 or 0).
  2192. */
  2193. __STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
  2194. {
  2195. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == RCC_BDCR_LSERDY) ? 1UL : 0UL);
  2196. }
  2197. /**
  2198. * @brief Check if CSS on LSE failure Detection
  2199. * @rmtoll BDCR LSECSSD LL_RCC_LSE_IsCSSDetected
  2200. * @retval State of bit (1 or 0).
  2201. */
  2202. __STATIC_INLINE uint32_t LL_RCC_LSE_IsCSSDetected(void)
  2203. {
  2204. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSECSSD) == RCC_BDCR_LSECSSD) ? 1UL : 0UL);
  2205. }
  2206. #if defined(RCC_BDCR_LSESYSDIS)
  2207. /**
  2208. * @brief Disable LSE oscillator propagation
  2209. * @note LSE clock is not propagated to any peripheral except to RTC which remains clocked
  2210. * @note A 2 LSE-clock delay is needed for LSESYSDIS setting to be taken into account
  2211. * @rmtoll BDCR LSESYSDIS LL_RCC_LSE_DisablePropagation
  2212. * @retval None
  2213. */
  2214. __STATIC_INLINE void LL_RCC_LSE_DisablePropagation(void)
  2215. {
  2216. SET_BIT(RCC->BDCR, RCC_BDCR_LSESYSDIS);
  2217. }
  2218. /**
  2219. * @brief Enable LSE oscillator propagation
  2220. * @note A 2 LSE-clock delay is needed for LSESYSDIS resetting to be taken into account
  2221. * @rmtoll BDCR LSESYSDIS LL_RCC_LSE_EnablePropagation
  2222. * @retval None
  2223. */
  2224. __STATIC_INLINE void LL_RCC_LSE_EnablePropagation(void)
  2225. {
  2226. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSESYSDIS);
  2227. }
  2228. /**
  2229. * @brief Check if LSE oscillator propagation is enabled
  2230. * @rmtoll BDCR LSESYSDIS LL_RCC_LSE_IsPropagationEnabled
  2231. * @retval State of bit (1 or 0).
  2232. */
  2233. __STATIC_INLINE uint32_t LL_RCC_LSE_IsPropagationEnabled(void)
  2234. {
  2235. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSESYSDIS) == 0U) ? 1UL : 0UL);
  2236. }
  2237. #endif /* RCC_BDCR_LSESYSDIS */
  2238. /**
  2239. * @}
  2240. */
  2241. /** @defgroup RCC_LL_EF_LSI LSI
  2242. * @{
  2243. */
  2244. /**
  2245. * @brief Enable LSI Oscillator
  2246. * @rmtoll CSR LSION LL_RCC_LSI_Enable
  2247. * @retval None
  2248. */
  2249. __STATIC_INLINE void LL_RCC_LSI_Enable(void)
  2250. {
  2251. SET_BIT(RCC->CSR, RCC_CSR_LSION);
  2252. }
  2253. /**
  2254. * @brief Disable LSI Oscillator
  2255. * @rmtoll CSR LSION LL_RCC_LSI_Disable
  2256. * @retval None
  2257. */
  2258. __STATIC_INLINE void LL_RCC_LSI_Disable(void)
  2259. {
  2260. CLEAR_BIT(RCC->CSR, RCC_CSR_LSION);
  2261. }
  2262. /**
  2263. * @brief Check if LSI is Ready
  2264. * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady
  2265. * @retval State of bit (1 or 0).
  2266. */
  2267. __STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void)
  2268. {
  2269. return ((READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == RCC_CSR_LSIRDY) ? 1UL : 0UL);
  2270. }
  2271. #if defined(RCC_CSR_LSIPREDIV)
  2272. /**
  2273. * @brief Set LSI division factor
  2274. * @rmtoll CSR LSIPREDIV LL_RCC_LSI_SetPrediv
  2275. * @param LSI_PREDIV This parameter can be one of the following values:
  2276. * @arg @ref LL_RCC_LSI_PREDIV_1
  2277. * @arg @ref LL_RCC_LSI_PREDIV_128
  2278. * @retval None
  2279. */
  2280. __STATIC_INLINE void LL_RCC_LSI_SetPrediv(uint32_t LSI_PREDIV)
  2281. {
  2282. MODIFY_REG(RCC->CSR, RCC_CSR_LSIPREDIV, LSI_PREDIV);
  2283. }
  2284. /**
  2285. * @brief Get LSI division factor
  2286. * @rmtoll CSR LSIPREDIV LL_RCC_LSI_GetPrediv
  2287. * @retval Returned value can be one of the following values:
  2288. * @arg @ref LL_RCC_LSI_PREDIV_1
  2289. * @arg @ref LL_RCC_LSI_PREDIV_128
  2290. */
  2291. __STATIC_INLINE uint32_t LL_RCC_LSI_GetPrediv(void)
  2292. {
  2293. return (READ_BIT(RCC->CSR, RCC_CSR_LSIPREDIV));
  2294. }
  2295. #endif /* RCC_CSR_LSIPREDIV */
  2296. /**
  2297. * @}
  2298. */
  2299. /** @defgroup RCC_LL_EF_MSI MSI
  2300. * @{
  2301. */
  2302. /**
  2303. * @brief Enable MSI oscillator
  2304. * @rmtoll CR MSION LL_RCC_MSI_Enable
  2305. * @retval None
  2306. */
  2307. __STATIC_INLINE void LL_RCC_MSI_Enable(void)
  2308. {
  2309. SET_BIT(RCC->CR, RCC_CR_MSION);
  2310. }
  2311. /**
  2312. * @brief Disable MSI oscillator
  2313. * @rmtoll CR MSION LL_RCC_MSI_Disable
  2314. * @retval None
  2315. */
  2316. __STATIC_INLINE void LL_RCC_MSI_Disable(void)
  2317. {
  2318. CLEAR_BIT(RCC->CR, RCC_CR_MSION);
  2319. }
  2320. /**
  2321. * @brief Check if MSI oscillator Ready
  2322. * @rmtoll CR MSIRDY LL_RCC_MSI_IsReady
  2323. * @retval State of bit (1 or 0).
  2324. */
  2325. __STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
  2326. {
  2327. return ((READ_BIT(RCC->CR, RCC_CR_MSIRDY) == RCC_CR_MSIRDY) ? 1UL : 0UL);
  2328. }
  2329. /**
  2330. * @brief Enable MSI PLL-mode (Hardware auto calibration with LSE)
  2331. * @note MSIPLLEN must be enabled after LSE is enabled (LSEON enabled)
  2332. * and ready (LSERDY set by hardware)
  2333. * @note hardware protection to avoid enabling MSIPLLEN if LSE is not
  2334. * ready
  2335. * @rmtoll CR MSIPLLEN LL_RCC_MSI_EnablePLLMode
  2336. * @retval None
  2337. */
  2338. __STATIC_INLINE void LL_RCC_MSI_EnablePLLMode(void)
  2339. {
  2340. SET_BIT(RCC->CR, RCC_CR_MSIPLLEN);
  2341. }
  2342. /**
  2343. * @brief Disable MSI-PLL mode
  2344. * @note cleared by hardware when LSE is disabled (LSEON = 0) or when
  2345. * the Clock Security System on LSE detects a LSE failure
  2346. * @rmtoll CR MSIPLLEN LL_RCC_MSI_DisablePLLMode
  2347. * @retval None
  2348. */
  2349. __STATIC_INLINE void LL_RCC_MSI_DisablePLLMode(void)
  2350. {
  2351. CLEAR_BIT(RCC->CR, RCC_CR_MSIPLLEN);
  2352. }
  2353. /**
  2354. * @brief Enable MSI clock range selection with MSIRANGE register
  2355. * @note Write 0 has no effect. After a standby or a reset
  2356. * MSIRGSEL is at 0 and the MSI range value is provided by
  2357. * MSISRANGE
  2358. * @rmtoll CR MSIRGSEL LL_RCC_MSI_EnableRangeSelection
  2359. * @retval None
  2360. */
  2361. __STATIC_INLINE void LL_RCC_MSI_EnableRangeSelection(void)
  2362. {
  2363. SET_BIT(RCC->CR, RCC_CR_MSIRGSEL);
  2364. }
  2365. /**
  2366. * @brief Check if MSI clock range is selected with MSIRANGE register
  2367. * @rmtoll CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSelect
  2368. * @retval State of bit (1 or 0).
  2369. */
  2370. __STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
  2371. {
  2372. return ((READ_BIT(RCC->CR, RCC_CR_MSIRGSEL) == RCC_CR_MSIRGSEL) ? 1UL : 0UL);
  2373. }
  2374. /**
  2375. * @brief Configure the Internal Multi Speed oscillator (MSI) clock range in run mode.
  2376. * @rmtoll CR MSIRANGE LL_RCC_MSI_SetRange
  2377. * @param Range This parameter can be one of the following values:
  2378. * @arg @ref LL_RCC_MSIRANGE_0
  2379. * @arg @ref LL_RCC_MSIRANGE_1
  2380. * @arg @ref LL_RCC_MSIRANGE_2
  2381. * @arg @ref LL_RCC_MSIRANGE_3
  2382. * @arg @ref LL_RCC_MSIRANGE_4
  2383. * @arg @ref LL_RCC_MSIRANGE_5
  2384. * @arg @ref LL_RCC_MSIRANGE_6
  2385. * @arg @ref LL_RCC_MSIRANGE_7
  2386. * @arg @ref LL_RCC_MSIRANGE_8
  2387. * @arg @ref LL_RCC_MSIRANGE_9
  2388. * @arg @ref LL_RCC_MSIRANGE_10
  2389. * @arg @ref LL_RCC_MSIRANGE_11
  2390. * @retval None
  2391. */
  2392. __STATIC_INLINE void LL_RCC_MSI_SetRange(uint32_t Range)
  2393. {
  2394. MODIFY_REG(RCC->CR, RCC_CR_MSIRANGE, Range);
  2395. }
  2396. /**
  2397. * @brief Get the Internal Multi Speed oscillator (MSI) clock range in run mode.
  2398. * @rmtoll CR MSIRANGE LL_RCC_MSI_GetRange
  2399. * @retval Returned value can be one of the following values:
  2400. * @arg @ref LL_RCC_MSIRANGE_0
  2401. * @arg @ref LL_RCC_MSIRANGE_1
  2402. * @arg @ref LL_RCC_MSIRANGE_2
  2403. * @arg @ref LL_RCC_MSIRANGE_3
  2404. * @arg @ref LL_RCC_MSIRANGE_4
  2405. * @arg @ref LL_RCC_MSIRANGE_5
  2406. * @arg @ref LL_RCC_MSIRANGE_6
  2407. * @arg @ref LL_RCC_MSIRANGE_7
  2408. * @arg @ref LL_RCC_MSIRANGE_8
  2409. * @arg @ref LL_RCC_MSIRANGE_9
  2410. * @arg @ref LL_RCC_MSIRANGE_10
  2411. * @arg @ref LL_RCC_MSIRANGE_11
  2412. */
  2413. __STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
  2414. {
  2415. return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_MSIRANGE));
  2416. }
  2417. /**
  2418. * @brief Configure MSI range used after standby
  2419. * @rmtoll CSR MSISRANGE LL_RCC_MSI_SetRangeAfterStandby
  2420. * @param Range This parameter can be one of the following values:
  2421. * @arg @ref LL_RCC_MSISRANGE_4
  2422. * @arg @ref LL_RCC_MSISRANGE_5
  2423. * @arg @ref LL_RCC_MSISRANGE_6
  2424. * @arg @ref LL_RCC_MSISRANGE_7
  2425. * @retval None
  2426. */
  2427. __STATIC_INLINE void LL_RCC_MSI_SetRangeAfterStandby(uint32_t Range)
  2428. {
  2429. MODIFY_REG(RCC->CSR, RCC_CSR_MSISRANGE, Range);
  2430. }
  2431. /**
  2432. * @brief Get MSI range used after standby
  2433. * @rmtoll CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby
  2434. * @retval Returned value can be one of the following values:
  2435. * @arg @ref LL_RCC_MSISRANGE_4
  2436. * @arg @ref LL_RCC_MSISRANGE_5
  2437. * @arg @ref LL_RCC_MSISRANGE_6
  2438. * @arg @ref LL_RCC_MSISRANGE_7
  2439. */
  2440. __STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
  2441. {
  2442. return (uint32_t)(READ_BIT(RCC->CSR, RCC_CSR_MSISRANGE));
  2443. }
  2444. /**
  2445. * @brief Get MSI Calibration value
  2446. * @note When MSITRIM is written, MSICAL is updated with the sum of
  2447. * MSITRIM and the factory trim value
  2448. * @rmtoll ICSCR MSICAL LL_RCC_MSI_GetCalibration
  2449. * @retval Between Min_Data = 0 and Max_Data = 255
  2450. */
  2451. __STATIC_INLINE uint32_t LL_RCC_MSI_GetCalibration(void)
  2452. {
  2453. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_MSICAL) >> RCC_ICSCR_MSICAL_Pos);
  2454. }
  2455. /**
  2456. * @brief Set MSI Calibration trimming
  2457. * @note user-programmable trimming value that is added to the MSICAL
  2458. * @rmtoll ICSCR MSITRIM LL_RCC_MSI_SetCalibTrimming
  2459. * @param Value Between Min_Data = 0 and Max_Data = 255
  2460. * @retval None
  2461. */
  2462. __STATIC_INLINE void LL_RCC_MSI_SetCalibTrimming(uint32_t Value)
  2463. {
  2464. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_MSITRIM, Value << RCC_ICSCR_MSITRIM_Pos);
  2465. }
  2466. /**
  2467. * @brief Get MSI Calibration trimming
  2468. * @rmtoll ICSCR MSITRIM LL_RCC_MSI_GetCalibTrimming
  2469. * @retval Between 0 and 255
  2470. */
  2471. __STATIC_INLINE uint32_t LL_RCC_MSI_GetCalibTrimming(void)
  2472. {
  2473. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_MSITRIM) >> RCC_ICSCR_MSITRIM_Pos);
  2474. }
  2475. /**
  2476. * @}
  2477. */
  2478. /** @defgroup RCC_LL_EF_LSCO LSCO
  2479. * @{
  2480. */
  2481. /**
  2482. * @brief Enable Low speed clock
  2483. * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Enable
  2484. * @retval None
  2485. */
  2486. __STATIC_INLINE void LL_RCC_LSCO_Enable(void)
  2487. {
  2488. SET_BIT(RCC->BDCR, RCC_BDCR_LSCOEN);
  2489. }
  2490. /**
  2491. * @brief Disable Low speed clock
  2492. * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Disable
  2493. * @retval None
  2494. */
  2495. __STATIC_INLINE void LL_RCC_LSCO_Disable(void)
  2496. {
  2497. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSCOEN);
  2498. }
  2499. /**
  2500. * @brief Configure Low speed clock selection
  2501. * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_SetSource
  2502. * @param Source This parameter can be one of the following values:
  2503. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
  2504. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
  2505. * @retval None
  2506. */
  2507. __STATIC_INLINE void LL_RCC_LSCO_SetSource(uint32_t Source)
  2508. {
  2509. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSCOSEL, Source);
  2510. }
  2511. /**
  2512. * @brief Get Low speed clock selection
  2513. * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_GetSource
  2514. * @retval Returned value can be one of the following values:
  2515. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
  2516. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
  2517. */
  2518. __STATIC_INLINE uint32_t LL_RCC_LSCO_GetSource(void)
  2519. {
  2520. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSCOSEL));
  2521. }
  2522. /**
  2523. * @}
  2524. */
  2525. /** @defgroup RCC_LL_EF_System System
  2526. * @{
  2527. */
  2528. /**
  2529. * @brief Configure the system clock source
  2530. * @rmtoll CFGR SW LL_RCC_SetSysClkSource
  2531. * @param Source This parameter can be one of the following values:
  2532. * @arg @ref LL_RCC_SYS_CLKSOURCE_MSI
  2533. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI
  2534. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
  2535. * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL
  2536. * @retval None
  2537. */
  2538. __STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source)
  2539. {
  2540. MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source);
  2541. }
  2542. /**
  2543. * @brief Get the system clock source
  2544. * @rmtoll CFGR SWS LL_RCC_GetSysClkSource
  2545. * @retval Returned value can be one of the following values:
  2546. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_MSI
  2547. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
  2548. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
  2549. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL
  2550. */
  2551. __STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void)
  2552. {
  2553. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS));
  2554. }
  2555. /**
  2556. * @brief Set AHB prescaler
  2557. * @rmtoll CFGR HPRE LL_RCC_SetAHBPrescaler
  2558. * @param Prescaler This parameter can be one of the following values:
  2559. * @arg @ref LL_RCC_SYSCLK_DIV_1
  2560. * @arg @ref LL_RCC_SYSCLK_DIV_2
  2561. * @arg @ref LL_RCC_SYSCLK_DIV_4
  2562. * @arg @ref LL_RCC_SYSCLK_DIV_8
  2563. * @arg @ref LL_RCC_SYSCLK_DIV_16
  2564. * @arg @ref LL_RCC_SYSCLK_DIV_64
  2565. * @arg @ref LL_RCC_SYSCLK_DIV_128
  2566. * @arg @ref LL_RCC_SYSCLK_DIV_256
  2567. * @arg @ref LL_RCC_SYSCLK_DIV_512
  2568. * @retval None
  2569. */
  2570. __STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler)
  2571. {
  2572. MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler);
  2573. }
  2574. /**
  2575. * @brief Set APB1 prescaler
  2576. * @rmtoll CFGR PPRE1 LL_RCC_SetAPB1Prescaler
  2577. * @param Prescaler This parameter can be one of the following values:
  2578. * @arg @ref LL_RCC_APB1_DIV_1
  2579. * @arg @ref LL_RCC_APB1_DIV_2
  2580. * @arg @ref LL_RCC_APB1_DIV_4
  2581. * @arg @ref LL_RCC_APB1_DIV_8
  2582. * @arg @ref LL_RCC_APB1_DIV_16
  2583. * @retval None
  2584. */
  2585. __STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)
  2586. {
  2587. MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, Prescaler);
  2588. }
  2589. /**
  2590. * @brief Set APB2 prescaler
  2591. * @rmtoll CFGR PPRE2 LL_RCC_SetAPB2Prescaler
  2592. * @param Prescaler This parameter can be one of the following values:
  2593. * @arg @ref LL_RCC_APB2_DIV_1
  2594. * @arg @ref LL_RCC_APB2_DIV_2
  2595. * @arg @ref LL_RCC_APB2_DIV_4
  2596. * @arg @ref LL_RCC_APB2_DIV_8
  2597. * @arg @ref LL_RCC_APB2_DIV_16
  2598. * @retval None
  2599. */
  2600. __STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler)
  2601. {
  2602. MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, Prescaler);
  2603. }
  2604. /**
  2605. * @brief Get AHB prescaler
  2606. * @rmtoll CFGR HPRE LL_RCC_GetAHBPrescaler
  2607. * @retval Returned value can be one of the following values:
  2608. * @arg @ref LL_RCC_SYSCLK_DIV_1
  2609. * @arg @ref LL_RCC_SYSCLK_DIV_2
  2610. * @arg @ref LL_RCC_SYSCLK_DIV_4
  2611. * @arg @ref LL_RCC_SYSCLK_DIV_8
  2612. * @arg @ref LL_RCC_SYSCLK_DIV_16
  2613. * @arg @ref LL_RCC_SYSCLK_DIV_64
  2614. * @arg @ref LL_RCC_SYSCLK_DIV_128
  2615. * @arg @ref LL_RCC_SYSCLK_DIV_256
  2616. * @arg @ref LL_RCC_SYSCLK_DIV_512
  2617. */
  2618. __STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void)
  2619. {
  2620. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE));
  2621. }
  2622. /**
  2623. * @brief Get APB1 prescaler
  2624. * @rmtoll CFGR PPRE1 LL_RCC_GetAPB1Prescaler
  2625. * @retval Returned value can be one of the following values:
  2626. * @arg @ref LL_RCC_APB1_DIV_1
  2627. * @arg @ref LL_RCC_APB1_DIV_2
  2628. * @arg @ref LL_RCC_APB1_DIV_4
  2629. * @arg @ref LL_RCC_APB1_DIV_8
  2630. * @arg @ref LL_RCC_APB1_DIV_16
  2631. */
  2632. __STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void)
  2633. {
  2634. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE1));
  2635. }
  2636. /**
  2637. * @brief Get APB2 prescaler
  2638. * @rmtoll CFGR PPRE2 LL_RCC_GetAPB2Prescaler
  2639. * @retval Returned value can be one of the following values:
  2640. * @arg @ref LL_RCC_APB2_DIV_1
  2641. * @arg @ref LL_RCC_APB2_DIV_2
  2642. * @arg @ref LL_RCC_APB2_DIV_4
  2643. * @arg @ref LL_RCC_APB2_DIV_8
  2644. * @arg @ref LL_RCC_APB2_DIV_16
  2645. */
  2646. __STATIC_INLINE uint32_t LL_RCC_GetAPB2Prescaler(void)
  2647. {
  2648. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE2));
  2649. }
  2650. /**
  2651. * @brief Set Clock After Wake-Up From Stop mode
  2652. * @rmtoll CFGR STOPWUCK LL_RCC_SetClkAfterWakeFromStop
  2653. * @param Clock This parameter can be one of the following values:
  2654. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_MSI
  2655. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_HSI
  2656. * @retval None
  2657. */
  2658. __STATIC_INLINE void LL_RCC_SetClkAfterWakeFromStop(uint32_t Clock)
  2659. {
  2660. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPWUCK, Clock);
  2661. }
  2662. /**
  2663. * @brief Get Clock After Wake-Up From Stop mode
  2664. * @rmtoll CFGR STOPWUCK LL_RCC_GetClkAfterWakeFromStop
  2665. * @retval Returned value can be one of the following values:
  2666. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_MSI
  2667. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_HSI
  2668. */
  2669. __STATIC_INLINE uint32_t LL_RCC_GetClkAfterWakeFromStop(void)
  2670. {
  2671. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_STOPWUCK));
  2672. }
  2673. /**
  2674. * @}
  2675. */
  2676. /** @defgroup RCC_LL_EF_MCO MCO
  2677. * @{
  2678. */
  2679. /**
  2680. * @brief Configure MCOx
  2681. * @rmtoll CFGR MCOSEL LL_RCC_ConfigMCO\n
  2682. * CFGR MCOPRE LL_RCC_ConfigMCO
  2683. * @param MCOxSource This parameter can be one of the following values:
  2684. * @arg @ref LL_RCC_MCO1SOURCE_NOCLOCK
  2685. * @arg @ref LL_RCC_MCO1SOURCE_SYSCLK
  2686. * @arg @ref LL_RCC_MCO1SOURCE_MSI
  2687. * @arg @ref LL_RCC_MCO1SOURCE_HSI
  2688. * @arg @ref LL_RCC_MCO1SOURCE_HSE
  2689. * @arg @ref LL_RCC_MCO1SOURCE_HSI48 (*)
  2690. * @arg @ref LL_RCC_MCO1SOURCE_PLLCLK
  2691. * @arg @ref LL_RCC_MCO1SOURCE_LSI
  2692. * @arg @ref LL_RCC_MCO1SOURCE_LSE
  2693. *
  2694. * (*) value not defined in all devices.
  2695. * @param MCOxPrescaler This parameter can be one of the following values:
  2696. * @arg @ref LL_RCC_MCO1_DIV_1
  2697. * @arg @ref LL_RCC_MCO1_DIV_2
  2698. * @arg @ref LL_RCC_MCO1_DIV_4
  2699. * @arg @ref LL_RCC_MCO1_DIV_8
  2700. * @arg @ref LL_RCC_MCO1_DIV_16
  2701. * @retval None
  2702. */
  2703. __STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource, uint32_t MCOxPrescaler)
  2704. {
  2705. MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE, MCOxSource | MCOxPrescaler);
  2706. }
  2707. /**
  2708. * @}
  2709. */
  2710. /** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source
  2711. * @{
  2712. */
  2713. /**
  2714. * @brief Configure USARTx clock source
  2715. * @rmtoll CCIPR USARTxSEL LL_RCC_SetUSARTClockSource
  2716. * @param USARTxSource This parameter can be one of the following values:
  2717. * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK2
  2718. * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
  2719. * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
  2720. * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
  2721. * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
  2722. * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
  2723. * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
  2724. * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
  2725. * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1 (*)
  2726. * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK (*)
  2727. * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI (*)
  2728. * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE (*)
  2729. *
  2730. * (*) value not defined in all devices.
  2731. * @retval None
  2732. */
  2733. __STATIC_INLINE void LL_RCC_SetUSARTClockSource(uint32_t USARTxSource)
  2734. {
  2735. MODIFY_REG(RCC->CCIPR, (USARTxSource >> 16U), (USARTxSource & 0x0000FFFFU));
  2736. }
  2737. #if defined(UART4) || defined(UART5)
  2738. /**
  2739. * @brief Configure UARTx clock source
  2740. * @rmtoll CCIPR UARTxSEL LL_RCC_SetUARTClockSource
  2741. * @param UARTxSource This parameter can be one of the following values:
  2742. * @arg @ref LL_RCC_UART4_CLKSOURCE_PCLK1
  2743. * @arg @ref LL_RCC_UART4_CLKSOURCE_SYSCLK
  2744. * @arg @ref LL_RCC_UART4_CLKSOURCE_HSI
  2745. * @arg @ref LL_RCC_UART4_CLKSOURCE_LSE
  2746. * @arg @ref LL_RCC_UART5_CLKSOURCE_PCLK1
  2747. * @arg @ref LL_RCC_UART5_CLKSOURCE_SYSCLK
  2748. * @arg @ref LL_RCC_UART5_CLKSOURCE_HSI
  2749. * @arg @ref LL_RCC_UART5_CLKSOURCE_LSE
  2750. * @retval None
  2751. */
  2752. __STATIC_INLINE void LL_RCC_SetUARTClockSource(uint32_t UARTxSource)
  2753. {
  2754. MODIFY_REG(RCC->CCIPR, (UARTxSource >> 16U), (UARTxSource & 0x0000FFFFU));
  2755. }
  2756. #endif /* UART4 || UART5 */
  2757. /**
  2758. * @brief Configure LPUART1x clock source
  2759. * @rmtoll CCIPR LPUART1SEL LL_RCC_SetLPUARTClockSource
  2760. * @param LPUARTxSource This parameter can be one of the following values:
  2761. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
  2762. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
  2763. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  2764. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  2765. * @retval None
  2766. */
  2767. __STATIC_INLINE void LL_RCC_SetLPUARTClockSource(uint32_t LPUARTxSource)
  2768. {
  2769. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPUART1SEL, LPUARTxSource);
  2770. }
  2771. /**
  2772. * @brief Configure I2Cx clock source
  2773. * @rmtoll CCIPR I2CxSEL LL_RCC_SetI2CClockSource
  2774. * @param I2CxSource This parameter can be one of the following values:
  2775. * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
  2776. * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
  2777. * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
  2778. * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1 (*)
  2779. * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK (*)
  2780. * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI (*)
  2781. * @arg @ref LL_RCC_I2C3_CLKSOURCE_PCLK1
  2782. * @arg @ref LL_RCC_I2C3_CLKSOURCE_SYSCLK
  2783. * @arg @ref LL_RCC_I2C3_CLKSOURCE_HSI
  2784. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK1 (*)
  2785. * @arg @ref LL_RCC_I2C4_CLKSOURCE_SYSCLK (*)
  2786. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI (*)
  2787. *
  2788. * (*) value not defined in all devices.
  2789. * @retval None
  2790. */
  2791. __STATIC_INLINE void LL_RCC_SetI2CClockSource(uint32_t I2CxSource)
  2792. {
  2793. __IO uint32_t *reg = (__IO uint32_t *)(uint32_t)(RCC_BASE + 0x88U + (I2CxSource >> 24U));
  2794. MODIFY_REG(*reg, 3UL << ((I2CxSource & 0x001F0000U) >> 16U), ((I2CxSource & 0x000000FFU) << ((I2CxSource & 0x001F0000U) >> 16U)));
  2795. }
  2796. /**
  2797. * @brief Configure LPTIMx clock source
  2798. * @rmtoll CCIPR LPTIMxSEL LL_RCC_SetLPTIMClockSource
  2799. * @param LPTIMxSource This parameter can be one of the following values:
  2800. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  2801. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  2802. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
  2803. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  2804. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK1
  2805. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  2806. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_HSI
  2807. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  2808. * @retval None
  2809. */
  2810. __STATIC_INLINE void LL_RCC_SetLPTIMClockSource(uint32_t LPTIMxSource)
  2811. {
  2812. MODIFY_REG(RCC->CCIPR, (LPTIMxSource & 0xFFFF0000U), (LPTIMxSource << 16U));
  2813. }
  2814. #if defined(RCC_CCIPR_SAI1SEL) || defined(RCC_CCIPR2_SAI1SEL)
  2815. /**
  2816. * @brief Configure SAIx clock source
  2817. @if STM32L4S9xx
  2818. * @rmtoll CCIPR2 SAIxSEL LL_RCC_SetSAIClockSource
  2819. @else
  2820. * @rmtoll CCIPR SAIxSEL LL_RCC_SetSAIClockSource
  2821. @endif
  2822. * @param SAIxSource This parameter can be one of the following values:
  2823. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI1
  2824. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI2 (*)
  2825. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL
  2826. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN
  2827. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI1 (*)
  2828. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI2 (*)
  2829. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLL (*)
  2830. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PIN (*)
  2831. *
  2832. * (*) value not defined in all devices.
  2833. * @retval None
  2834. */
  2835. __STATIC_INLINE void LL_RCC_SetSAIClockSource(uint32_t SAIxSource)
  2836. {
  2837. #if defined(RCC_CCIPR2_SAI1SEL)
  2838. MODIFY_REG(RCC->CCIPR2, (SAIxSource >> 16U), (SAIxSource & 0x0000FFFFU));
  2839. #else
  2840. MODIFY_REG(RCC->CCIPR, (SAIxSource & 0xFFFF0000U), (SAIxSource << 16U));
  2841. #endif /* RCC_CCIPR2_SAI1SEL */
  2842. }
  2843. #endif /* RCC_CCIPR_SAI1SEL || RCC_CCIPR2_SAI1SEL */
  2844. #if defined(RCC_CCIPR2_SDMMCSEL)
  2845. /**
  2846. * @brief Configure SDMMC1 kernel clock source
  2847. * @rmtoll CCIPR2 SDMMCSEL LL_RCC_SetSDMMCKernelClockSource
  2848. * @param SDMMCxSource This parameter can be one of the following values:
  2849. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK (*)
  2850. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_PLLP (*)
  2851. *
  2852. * (*) value not defined in all devices.
  2853. * @retval None
  2854. */
  2855. __STATIC_INLINE void LL_RCC_SetSDMMCKernelClockSource(uint32_t SDMMCxSource)
  2856. {
  2857. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_SDMMCSEL, SDMMCxSource);
  2858. }
  2859. #endif /* RCC_CCIPR2_SDMMCSEL */
  2860. /**
  2861. * @brief Configure SDMMC1 clock source
  2862. * @rmtoll CCIPR CLK48SEL LL_RCC_SetSDMMCClockSource
  2863. * @param SDMMCxSource This parameter can be one of the following values:
  2864. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_NONE (*)
  2865. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_HSI48 (*)
  2866. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1 (*)
  2867. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLL
  2868. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_MSI (*)
  2869. *
  2870. * (*) value not defined in all devices.
  2871. * @retval None
  2872. */
  2873. __STATIC_INLINE void LL_RCC_SetSDMMCClockSource(uint32_t SDMMCxSource)
  2874. {
  2875. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, SDMMCxSource);
  2876. }
  2877. /**
  2878. * @brief Configure RNG clock source
  2879. * @rmtoll CCIPR CLK48SEL LL_RCC_SetRNGClockSource
  2880. * @param RNGxSource This parameter can be one of the following values:
  2881. * @arg @ref LL_RCC_RNG_CLKSOURCE_NONE (*)
  2882. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48 (*)
  2883. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLSAI1 (*)
  2884. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
  2885. * @arg @ref LL_RCC_RNG_CLKSOURCE_MSI
  2886. *
  2887. * (*) value not defined in all devices.
  2888. * @retval None
  2889. */
  2890. __STATIC_INLINE void LL_RCC_SetRNGClockSource(uint32_t RNGxSource)
  2891. {
  2892. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, RNGxSource);
  2893. }
  2894. #if defined(USB_OTG_FS) || defined(USB)
  2895. /**
  2896. * @brief Configure USB clock source
  2897. * @rmtoll CCIPR CLK48SEL LL_RCC_SetUSBClockSource
  2898. * @param USBxSource This parameter can be one of the following values:
  2899. * @arg @ref LL_RCC_USB_CLKSOURCE_NONE (*)
  2900. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48 (*)
  2901. * @arg @ref LL_RCC_USB_CLKSOURCE_PLLSAI1 (*)
  2902. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
  2903. * @arg @ref LL_RCC_USB_CLKSOURCE_MSI
  2904. *
  2905. * (*) value not defined in all devices.
  2906. * @retval None
  2907. */
  2908. __STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t USBxSource)
  2909. {
  2910. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, USBxSource);
  2911. }
  2912. #endif /* USB_OTG_FS || USB */
  2913. #if defined(RCC_CCIPR_ADCSEL)
  2914. /**
  2915. * @brief Configure ADC clock source
  2916. * @rmtoll CCIPR ADCSEL LL_RCC_SetADCClockSource
  2917. * @param ADCxSource This parameter can be one of the following values:
  2918. * @arg @ref LL_RCC_ADC_CLKSOURCE_NONE
  2919. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLLSAI1 (*)
  2920. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLLSAI2 (*)
  2921. * @arg @ref LL_RCC_ADC_CLKSOURCE_SYSCLK
  2922. *
  2923. * (*) value not defined in all devices.
  2924. * @retval None
  2925. */
  2926. __STATIC_INLINE void LL_RCC_SetADCClockSource(uint32_t ADCxSource)
  2927. {
  2928. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_ADCSEL, ADCxSource);
  2929. }
  2930. #endif /* RCC_CCIPR_ADCSEL */
  2931. #if defined(SWPMI1)
  2932. /**
  2933. * @brief Configure SWPMI clock source
  2934. * @rmtoll CCIPR SWPMI1SEL LL_RCC_SetSWPMIClockSource
  2935. * @param SWPMIxSource This parameter can be one of the following values:
  2936. * @arg @ref LL_RCC_SWPMI1_CLKSOURCE_PCLK1
  2937. * @arg @ref LL_RCC_SWPMI1_CLKSOURCE_HSI
  2938. * @retval None
  2939. */
  2940. __STATIC_INLINE void LL_RCC_SetSWPMIClockSource(uint32_t SWPMIxSource)
  2941. {
  2942. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SWPMI1SEL, SWPMIxSource);
  2943. }
  2944. #endif /* SWPMI1 */
  2945. #if defined(DFSDM1_Channel0)
  2946. #if defined(RCC_CCIPR2_ADFSDM1SEL)
  2947. /**
  2948. * @brief Configure DFSDM Audio clock source
  2949. * @rmtoll CCIPR2 ADFSDM1SEL LL_RCC_SetDFSDMAudioClockSource
  2950. * @param Source This parameter can be one of the following values:
  2951. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1
  2952. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI
  2953. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI
  2954. * @retval None
  2955. */
  2956. __STATIC_INLINE void LL_RCC_SetDFSDMAudioClockSource(uint32_t Source)
  2957. {
  2958. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_ADFSDM1SEL, Source);
  2959. }
  2960. #endif /* RCC_CCIPR2_ADFSDM1SEL */
  2961. /**
  2962. * @brief Configure DFSDM Kernel clock source
  2963. @if STM32L4S9xx
  2964. * @rmtoll CCIPR2 DFSDM1SEL LL_RCC_SetDFSDMClockSource
  2965. @else
  2966. * @rmtoll CCIPR DFSDM1SEL LL_RCC_SetDFSDMClockSource
  2967. @endif
  2968. * @param DFSDMxSource This parameter can be one of the following values:
  2969. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  2970. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  2971. * @retval None
  2972. */
  2973. __STATIC_INLINE void LL_RCC_SetDFSDMClockSource(uint32_t DFSDMxSource)
  2974. {
  2975. #if defined(RCC_CCIPR2_DFSDM1SEL)
  2976. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_DFSDM1SEL, DFSDMxSource);
  2977. #else
  2978. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_DFSDM1SEL, DFSDMxSource);
  2979. #endif /* RCC_CCIPR2_DFSDM1SEL */
  2980. }
  2981. #endif /* DFSDM1_Channel0 */
  2982. #if defined(DSI)
  2983. /**
  2984. * @brief Configure DSI clock source
  2985. * @rmtoll CCIPR2 DSISEL LL_RCC_SetDSIClockSource
  2986. * @param Source This parameter can be one of the following values:
  2987. * @arg @ref LL_RCC_DSI_CLKSOURCE_PHY
  2988. * @arg @ref LL_RCC_DSI_CLKSOURCE_PLL
  2989. * @retval None
  2990. */
  2991. __STATIC_INLINE void LL_RCC_SetDSIClockSource(uint32_t Source)
  2992. {
  2993. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_DSISEL, Source);
  2994. }
  2995. #endif /* DSI */
  2996. #if defined(LTDC)
  2997. /**
  2998. * @brief Configure LTDC Clock Source
  2999. * @rmtoll CCIPR2 PLLSAI2DIVR LL_RCC_SetLTDCClockSource
  3000. * @param Source This parameter can be one of the following values:
  3001. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV2
  3002. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV4
  3003. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV8
  3004. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV16
  3005. * @retval None
  3006. */
  3007. __STATIC_INLINE void LL_RCC_SetLTDCClockSource(uint32_t Source)
  3008. {
  3009. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_PLLSAI2DIVR, Source);
  3010. }
  3011. #endif /* LTDC */
  3012. #if defined(OCTOSPI1)
  3013. /**
  3014. * @brief Configure OCTOSPI clock source
  3015. * @rmtoll CCIPR2 OSPISEL LL_RCC_SetOCTOSPIClockSource
  3016. * @param Source This parameter can be one of the following values:
  3017. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK
  3018. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_MSI
  3019. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_PLL
  3020. * @retval None
  3021. */
  3022. __STATIC_INLINE void LL_RCC_SetOCTOSPIClockSource(uint32_t Source)
  3023. {
  3024. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_OSPISEL, Source);
  3025. }
  3026. #endif /* OCTOSPI1 */
  3027. /**
  3028. * @brief Get USARTx clock source
  3029. * @rmtoll CCIPR USARTxSEL LL_RCC_GetUSARTClockSource
  3030. * @param USARTx This parameter can be one of the following values:
  3031. * @arg @ref LL_RCC_USART1_CLKSOURCE
  3032. * @arg @ref LL_RCC_USART2_CLKSOURCE
  3033. * @arg @ref LL_RCC_USART3_CLKSOURCE (*)
  3034. *
  3035. * (*) value not defined in all devices.
  3036. * @retval Returned value can be one of the following values:
  3037. * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK2
  3038. * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
  3039. * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
  3040. * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
  3041. * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
  3042. * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
  3043. * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
  3044. * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
  3045. * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1 (*)
  3046. * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK (*)
  3047. * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI (*)
  3048. * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE (*)
  3049. *
  3050. * (*) value not defined in all devices.
  3051. */
  3052. __STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx)
  3053. {
  3054. return (uint32_t)(READ_BIT(RCC->CCIPR, USARTx) | (USARTx << 16U));
  3055. }
  3056. #if defined(UART4) || defined(UART5)
  3057. /**
  3058. * @brief Get UARTx clock source
  3059. * @rmtoll CCIPR UARTxSEL LL_RCC_GetUARTClockSource
  3060. * @param UARTx This parameter can be one of the following values:
  3061. * @arg @ref LL_RCC_UART4_CLKSOURCE
  3062. * @arg @ref LL_RCC_UART5_CLKSOURCE
  3063. * @retval Returned value can be one of the following values:
  3064. * @arg @ref LL_RCC_UART4_CLKSOURCE_PCLK1
  3065. * @arg @ref LL_RCC_UART4_CLKSOURCE_SYSCLK
  3066. * @arg @ref LL_RCC_UART4_CLKSOURCE_HSI
  3067. * @arg @ref LL_RCC_UART4_CLKSOURCE_LSE
  3068. * @arg @ref LL_RCC_UART5_CLKSOURCE_PCLK1
  3069. * @arg @ref LL_RCC_UART5_CLKSOURCE_SYSCLK
  3070. * @arg @ref LL_RCC_UART5_CLKSOURCE_HSI
  3071. * @arg @ref LL_RCC_UART5_CLKSOURCE_LSE
  3072. */
  3073. __STATIC_INLINE uint32_t LL_RCC_GetUARTClockSource(uint32_t UARTx)
  3074. {
  3075. return (uint32_t)(READ_BIT(RCC->CCIPR, UARTx) | (UARTx << 16U));
  3076. }
  3077. #endif /* UART4 || UART5 */
  3078. /**
  3079. * @brief Get LPUARTx clock source
  3080. * @rmtoll CCIPR LPUART1SEL LL_RCC_GetLPUARTClockSource
  3081. * @param LPUARTx This parameter can be one of the following values:
  3082. * @arg @ref LL_RCC_LPUART1_CLKSOURCE
  3083. * @retval Returned value can be one of the following values:
  3084. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
  3085. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
  3086. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  3087. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  3088. */
  3089. __STATIC_INLINE uint32_t LL_RCC_GetLPUARTClockSource(uint32_t LPUARTx)
  3090. {
  3091. return (uint32_t)(READ_BIT(RCC->CCIPR, LPUARTx));
  3092. }
  3093. /**
  3094. * @brief Get I2Cx clock source
  3095. * @rmtoll CCIPR I2CxSEL LL_RCC_GetI2CClockSource
  3096. * @param I2Cx This parameter can be one of the following values:
  3097. * @arg @ref LL_RCC_I2C1_CLKSOURCE
  3098. * @arg @ref LL_RCC_I2C2_CLKSOURCE (*)
  3099. * @arg @ref LL_RCC_I2C3_CLKSOURCE
  3100. * @arg @ref LL_RCC_I2C4_CLKSOURCE (*)
  3101. *
  3102. * (*) value not defined in all devices.
  3103. * @retval Returned value can be one of the following values:
  3104. * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
  3105. * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
  3106. * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
  3107. * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1 (*)
  3108. * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK (*)
  3109. * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI (*)
  3110. * @arg @ref LL_RCC_I2C3_CLKSOURCE_PCLK1
  3111. * @arg @ref LL_RCC_I2C3_CLKSOURCE_SYSCLK
  3112. * @arg @ref LL_RCC_I2C3_CLKSOURCE_HSI
  3113. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK1 (*)
  3114. * @arg @ref LL_RCC_I2C4_CLKSOURCE_SYSCLK (*)
  3115. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI (*)
  3116. *
  3117. * (*) value not defined in all devices.
  3118. */
  3119. __STATIC_INLINE uint32_t LL_RCC_GetI2CClockSource(uint32_t I2Cx)
  3120. {
  3121. __IO const uint32_t *reg = (__IO uint32_t *)(uint32_t)(RCC_BASE + 0x88U + (I2Cx >> 24U));
  3122. return (uint32_t)((READ_BIT(*reg, 3UL << ((I2Cx & 0x001F0000U) >> 16U)) >> ((I2Cx & 0x001F0000U) >> 16U)) | (I2Cx & 0xFFFF0000U));
  3123. }
  3124. /**
  3125. * @brief Get LPTIMx clock source
  3126. * @rmtoll CCIPR LPTIMxSEL LL_RCC_GetLPTIMClockSource
  3127. * @param LPTIMx This parameter can be one of the following values:
  3128. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
  3129. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE
  3130. * @retval Returned value can be one of the following values:
  3131. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  3132. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  3133. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
  3134. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  3135. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK1
  3136. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  3137. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_HSI
  3138. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  3139. */
  3140. __STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx)
  3141. {
  3142. return (uint32_t)((READ_BIT(RCC->CCIPR, LPTIMx) >> 16U) | LPTIMx);
  3143. }
  3144. #if defined(RCC_CCIPR_SAI1SEL) || defined(RCC_CCIPR2_SAI1SEL)
  3145. /**
  3146. * @brief Get SAIx clock source
  3147. @if STM32L4S9xx
  3148. * @rmtoll CCIPR2 SAIxSEL LL_RCC_GetSAIClockSource
  3149. @else
  3150. * @rmtoll CCIPR SAIxSEL LL_RCC_GetSAIClockSource
  3151. @endif
  3152. * @param SAIx This parameter can be one of the following values:
  3153. * @arg @ref LL_RCC_SAI1_CLKSOURCE
  3154. * @arg @ref LL_RCC_SAI2_CLKSOURCE (*)
  3155. *
  3156. * (*) value not defined in all devices.
  3157. * @retval Returned value can be one of the following values:
  3158. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI1
  3159. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI2 (*)
  3160. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL
  3161. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN
  3162. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI1 (*)
  3163. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI2 (*)
  3164. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLL (*)
  3165. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PIN (*)
  3166. *
  3167. * (*) value not defined in all devices.
  3168. */
  3169. __STATIC_INLINE uint32_t LL_RCC_GetSAIClockSource(uint32_t SAIx)
  3170. {
  3171. #if defined(RCC_CCIPR2_SAI1SEL)
  3172. return (uint32_t)(READ_BIT(RCC->CCIPR2, SAIx) | (SAIx << 16U));
  3173. #else
  3174. return (uint32_t)(READ_BIT(RCC->CCIPR, SAIx) >> 16U | SAIx);
  3175. #endif /* RCC_CCIPR2_SAI1SEL */
  3176. }
  3177. #endif /* RCC_CCIPR_SAI1SEL || RCC_CCIPR2_SAI1SEL */
  3178. #if defined(SDMMC1)
  3179. #if defined(RCC_CCIPR2_SDMMCSEL)
  3180. /**
  3181. * @brief Get SDMMCx kernel clock source
  3182. * @rmtoll CCIPR2 SDMMCSEL LL_RCC_GetSDMMCKernelClockSource
  3183. * @param SDMMCx This parameter can be one of the following values:
  3184. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE
  3185. * @retval Returned value can be one of the following values:
  3186. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK (*)
  3187. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_PLL (*)
  3188. *
  3189. * (*) value not defined in all devices.
  3190. */
  3191. __STATIC_INLINE uint32_t LL_RCC_GetSDMMCKernelClockSource(uint32_t SDMMCx)
  3192. {
  3193. return (uint32_t)(READ_BIT(RCC->CCIPR2, SDMMCx));
  3194. }
  3195. #endif /* RCC_CCIPR2_SDMMCSEL */
  3196. /**
  3197. * @brief Get SDMMCx clock source
  3198. * @rmtoll CCIPR CLK48SEL LL_RCC_GetSDMMCClockSource
  3199. * @param SDMMCx This parameter can be one of the following values:
  3200. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE
  3201. * @retval Returned value can be one of the following values:
  3202. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_NONE (*)
  3203. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_HSI48 (*)
  3204. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1 (*)
  3205. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLL
  3206. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_MSI (*)
  3207. *
  3208. * (*) value not defined in all devices.
  3209. */
  3210. __STATIC_INLINE uint32_t LL_RCC_GetSDMMCClockSource(uint32_t SDMMCx)
  3211. {
  3212. return (uint32_t)(READ_BIT(RCC->CCIPR, SDMMCx));
  3213. }
  3214. #endif /* SDMMC1 */
  3215. /**
  3216. * @brief Get RNGx clock source
  3217. * @rmtoll CCIPR CLK48SEL LL_RCC_GetRNGClockSource
  3218. * @param RNGx This parameter can be one of the following values:
  3219. * @arg @ref LL_RCC_RNG_CLKSOURCE
  3220. * @retval Returned value can be one of the following values:
  3221. * @arg @ref LL_RCC_RNG_CLKSOURCE_NONE (*)
  3222. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48 (*)
  3223. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLSAI1 (*)
  3224. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
  3225. * @arg @ref LL_RCC_RNG_CLKSOURCE_MSI
  3226. *
  3227. * (*) value not defined in all devices.
  3228. */
  3229. __STATIC_INLINE uint32_t LL_RCC_GetRNGClockSource(uint32_t RNGx)
  3230. {
  3231. return (uint32_t)(READ_BIT(RCC->CCIPR, RNGx));
  3232. }
  3233. #if defined(USB_OTG_FS) || defined(USB)
  3234. /**
  3235. * @brief Get USBx clock source
  3236. * @rmtoll CCIPR CLK48SEL LL_RCC_GetUSBClockSource
  3237. * @param USBx This parameter can be one of the following values:
  3238. * @arg @ref LL_RCC_USB_CLKSOURCE
  3239. * @retval Returned value can be one of the following values:
  3240. * @arg @ref LL_RCC_USB_CLKSOURCE_NONE (*)
  3241. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48 (*)
  3242. * @arg @ref LL_RCC_USB_CLKSOURCE_PLLSAI1 (*)
  3243. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
  3244. * @arg @ref LL_RCC_USB_CLKSOURCE_MSI
  3245. *
  3246. * (*) value not defined in all devices.
  3247. */
  3248. __STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx)
  3249. {
  3250. return (uint32_t)(READ_BIT(RCC->CCIPR, USBx));
  3251. }
  3252. #endif /* USB_OTG_FS || USB */
  3253. /**
  3254. * @brief Get ADCx clock source
  3255. * @rmtoll CCIPR ADCSEL LL_RCC_GetADCClockSource
  3256. * @param ADCx This parameter can be one of the following values:
  3257. * @arg @ref LL_RCC_ADC_CLKSOURCE
  3258. * @retval Returned value can be one of the following values:
  3259. * @arg @ref LL_RCC_ADC_CLKSOURCE_NONE
  3260. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLLSAI1 (*)
  3261. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLLSAI2 (*)
  3262. * @arg @ref LL_RCC_ADC_CLKSOURCE_SYSCLK
  3263. *
  3264. * (*) value not defined in all devices.
  3265. */
  3266. __STATIC_INLINE uint32_t LL_RCC_GetADCClockSource(uint32_t ADCx)
  3267. {
  3268. #if defined(RCC_CCIPR_ADCSEL)
  3269. return (uint32_t)(READ_BIT(RCC->CCIPR, ADCx));
  3270. #else
  3271. (void)ADCx; /* unused */
  3272. return ((READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN) != 0U) ? LL_RCC_ADC_CLKSOURCE_SYSCLK : LL_RCC_ADC_CLKSOURCE_NONE);
  3273. #endif /* RCC_CCIPR_ADCSEL */
  3274. }
  3275. #if defined(SWPMI1)
  3276. /**
  3277. * @brief Get SWPMIx clock source
  3278. * @rmtoll CCIPR SWPMI1SEL LL_RCC_GetSWPMIClockSource
  3279. * @param SPWMIx This parameter can be one of the following values:
  3280. * @arg @ref LL_RCC_SWPMI1_CLKSOURCE
  3281. * @retval Returned value can be one of the following values:
  3282. * @arg @ref LL_RCC_SWPMI1_CLKSOURCE_PCLK1
  3283. * @arg @ref LL_RCC_SWPMI1_CLKSOURCE_HSI
  3284. */
  3285. __STATIC_INLINE uint32_t LL_RCC_GetSWPMIClockSource(uint32_t SPWMIx)
  3286. {
  3287. return (uint32_t)(READ_BIT(RCC->CCIPR, SPWMIx));
  3288. }
  3289. #endif /* SWPMI1 */
  3290. #if defined(DFSDM1_Channel0)
  3291. #if defined(RCC_CCIPR2_ADFSDM1SEL)
  3292. /**
  3293. * @brief Get DFSDM Audio Clock Source
  3294. * @rmtoll CCIPR2 ADFSDM1SEL LL_RCC_GetDFSDMAudioClockSource
  3295. * @param DFSDMx This parameter can be one of the following values:
  3296. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE
  3297. * @retval Returned value can be one of the following values:
  3298. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1
  3299. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI
  3300. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI
  3301. */
  3302. __STATIC_INLINE uint32_t LL_RCC_GetDFSDMAudioClockSource(uint32_t DFSDMx)
  3303. {
  3304. return (uint32_t)(READ_BIT(RCC->CCIPR2, DFSDMx));
  3305. }
  3306. #endif /* RCC_CCIPR2_ADFSDM1SEL */
  3307. /**
  3308. * @brief Get DFSDMx Kernel clock source
  3309. @if STM32L4S9xx
  3310. * @rmtoll CCIPR2 DFSDM1SEL LL_RCC_GetDFSDMClockSource
  3311. @else
  3312. * @rmtoll CCIPR DFSDM1SEL LL_RCC_GetDFSDMClockSource
  3313. @endif
  3314. * @param DFSDMx This parameter can be one of the following values:
  3315. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE
  3316. * @retval Returned value can be one of the following values:
  3317. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  3318. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  3319. */
  3320. __STATIC_INLINE uint32_t LL_RCC_GetDFSDMClockSource(uint32_t DFSDMx)
  3321. {
  3322. #if defined(RCC_CCIPR2_DFSDM1SEL)
  3323. return (uint32_t)(READ_BIT(RCC->CCIPR2, DFSDMx));
  3324. #else
  3325. return (uint32_t)(READ_BIT(RCC->CCIPR, DFSDMx));
  3326. #endif /* RCC_CCIPR2_DFSDM1SEL */
  3327. }
  3328. #endif /* DFSDM1_Channel0 */
  3329. #if defined(DSI)
  3330. /**
  3331. * @brief Get DSI Clock Source
  3332. * @rmtoll CCIPR2 DSISEL LL_RCC_GetDSIClockSource
  3333. * @param DSIx This parameter can be one of the following values:
  3334. * @arg @ref LL_RCC_DSI_CLKSOURCE
  3335. * @retval Returned value can be one of the following values:
  3336. * @arg @ref LL_RCC_DSI_CLKSOURCE_PHY
  3337. * @arg @ref LL_RCC_DSI_CLKSOURCE_PLL
  3338. */
  3339. __STATIC_INLINE uint32_t LL_RCC_GetDSIClockSource(uint32_t DSIx)
  3340. {
  3341. return (uint32_t)(READ_BIT(RCC->CCIPR2, DSIx));
  3342. }
  3343. #endif /* DSI */
  3344. #if defined(LTDC)
  3345. /**
  3346. * @brief Get LTDC Clock Source
  3347. * @rmtoll CCIPR2 PLLSAI2DIVR LL_RCC_GetLTDCClockSource
  3348. * @param LTDCx This parameter can be one of the following values:
  3349. * @arg @ref LL_RCC_LTDC_CLKSOURCE
  3350. * @retval Returned value can be one of the following values:
  3351. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV2
  3352. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV4
  3353. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV8
  3354. * @arg @ref LL_RCC_LTDC_CLKSOURCE_PLLSAI2R_DIV16
  3355. */
  3356. __STATIC_INLINE uint32_t LL_RCC_GetLTDCClockSource(uint32_t LTDCx)
  3357. {
  3358. return (uint32_t)(READ_BIT(RCC->CCIPR2, LTDCx));
  3359. }
  3360. #endif /* LTDC */
  3361. #if defined(OCTOSPI1)
  3362. /**
  3363. * @brief Get OCTOSPI clock source
  3364. * @rmtoll CCIPR2 OSPISEL LL_RCC_GetOCTOSPIClockSource
  3365. * @param OCTOSPIx This parameter can be one of the following values:
  3366. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE
  3367. * @retval Returned value can be one of the following values:
  3368. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK
  3369. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_MSI
  3370. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_PLL
  3371. */
  3372. __STATIC_INLINE uint32_t LL_RCC_GetOCTOSPIClockSource(uint32_t OCTOSPIx)
  3373. {
  3374. return (uint32_t)(READ_BIT(RCC->CCIPR2, OCTOSPIx));
  3375. }
  3376. #endif /* OCTOSPI1 */
  3377. /**
  3378. * @}
  3379. */
  3380. /** @defgroup RCC_LL_EF_RTC RTC
  3381. * @{
  3382. */
  3383. /**
  3384. * @brief Set RTC Clock Source
  3385. * @note Once the RTC clock source has been selected, it cannot be changed anymore unless
  3386. * the Backup domain is reset, or unless a failure is detected on LSE (LSECSSD is
  3387. * set). The BDRST bit can be used to reset them.
  3388. * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource
  3389. * @param Source This parameter can be one of the following values:
  3390. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  3391. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  3392. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  3393. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
  3394. * @retval None
  3395. */
  3396. __STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source)
  3397. {
  3398. MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source);
  3399. }
  3400. /**
  3401. * @brief Get RTC Clock Source
  3402. * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource
  3403. * @retval Returned value can be one of the following values:
  3404. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  3405. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  3406. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  3407. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
  3408. */
  3409. __STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void)
  3410. {
  3411. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL));
  3412. }
  3413. /**
  3414. * @brief Enable RTC
  3415. * @rmtoll BDCR RTCEN LL_RCC_EnableRTC
  3416. * @retval None
  3417. */
  3418. __STATIC_INLINE void LL_RCC_EnableRTC(void)
  3419. {
  3420. SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  3421. }
  3422. /**
  3423. * @brief Disable RTC
  3424. * @rmtoll BDCR RTCEN LL_RCC_DisableRTC
  3425. * @retval None
  3426. */
  3427. __STATIC_INLINE void LL_RCC_DisableRTC(void)
  3428. {
  3429. CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  3430. }
  3431. /**
  3432. * @brief Check if RTC has been enabled or not
  3433. * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC
  3434. * @retval State of bit (1 or 0).
  3435. */
  3436. __STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void)
  3437. {
  3438. return ((READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == RCC_BDCR_RTCEN) ? 1UL : 0UL);
  3439. }
  3440. /**
  3441. * @brief Force the Backup domain reset
  3442. * @rmtoll BDCR BDRST LL_RCC_ForceBackupDomainReset
  3443. * @retval None
  3444. */
  3445. __STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void)
  3446. {
  3447. SET_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  3448. }
  3449. /**
  3450. * @brief Release the Backup domain reset
  3451. * @rmtoll BDCR BDRST LL_RCC_ReleaseBackupDomainReset
  3452. * @retval None
  3453. */
  3454. __STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void)
  3455. {
  3456. CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  3457. }
  3458. /**
  3459. * @}
  3460. */
  3461. /** @defgroup RCC_LL_EF_PLL PLL
  3462. * @{
  3463. */
  3464. /**
  3465. * @brief Enable PLL
  3466. * @rmtoll CR PLLON LL_RCC_PLL_Enable
  3467. * @retval None
  3468. */
  3469. __STATIC_INLINE void LL_RCC_PLL_Enable(void)
  3470. {
  3471. SET_BIT(RCC->CR, RCC_CR_PLLON);
  3472. }
  3473. /**
  3474. * @brief Disable PLL
  3475. * @note Cannot be disabled if the PLL clock is used as the system clock
  3476. * @rmtoll CR PLLON LL_RCC_PLL_Disable
  3477. * @retval None
  3478. */
  3479. __STATIC_INLINE void LL_RCC_PLL_Disable(void)
  3480. {
  3481. CLEAR_BIT(RCC->CR, RCC_CR_PLLON);
  3482. }
  3483. /**
  3484. * @brief Check if PLL Ready
  3485. * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady
  3486. * @retval State of bit (1 or 0).
  3487. */
  3488. __STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
  3489. {
  3490. return ((READ_BIT(RCC->CR, RCC_CR_PLLRDY) == RCC_CR_PLLRDY) ? 1UL : 0UL);
  3491. }
  3492. /**
  3493. * @brief Configure PLL used for SYSCLK Domain
  3494. * @note PLL Source and PLLM Divider can be written only when PLL,
  3495. * PLLSAI1 and PLLSAI2 (*) are disabled.
  3496. * @note PLLN/PLLR can be written only when PLL is disabled.
  3497. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SYS\n
  3498. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SYS\n
  3499. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SYS\n
  3500. * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SYS
  3501. * @param Source This parameter can be one of the following values:
  3502. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3503. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3504. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3505. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3506. * @param PLLM This parameter can be one of the following values:
  3507. * @arg @ref LL_RCC_PLLM_DIV_1
  3508. * @arg @ref LL_RCC_PLLM_DIV_2
  3509. * @arg @ref LL_RCC_PLLM_DIV_3
  3510. * @arg @ref LL_RCC_PLLM_DIV_4
  3511. * @arg @ref LL_RCC_PLLM_DIV_5
  3512. * @arg @ref LL_RCC_PLLM_DIV_6
  3513. * @arg @ref LL_RCC_PLLM_DIV_7
  3514. * @arg @ref LL_RCC_PLLM_DIV_8
  3515. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  3516. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  3517. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  3518. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  3519. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  3520. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  3521. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  3522. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  3523. *
  3524. * (*) value not defined in all devices.
  3525. * @param PLLN Between 8 and 86 or 127 depending on devices
  3526. * @param PLLR This parameter can be one of the following values:
  3527. * @arg @ref LL_RCC_PLLR_DIV_2
  3528. * @arg @ref LL_RCC_PLLR_DIV_4
  3529. * @arg @ref LL_RCC_PLLR_DIV_6
  3530. * @arg @ref LL_RCC_PLLR_DIV_8
  3531. * @retval None
  3532. */
  3533. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  3534. {
  3535. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR,
  3536. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLR);
  3537. }
  3538. #if defined(RCC_PLLP_SUPPORT)
  3539. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  3540. /**
  3541. * @brief Configure PLL used for SAI domain clock
  3542. * @note PLL Source and PLLM Divider can be written only when PLL,
  3543. * PLLSAI1 and PLLSAI2 (*) are disabled.
  3544. * @note PLLN/PLLP can be written only when PLL is disabled.
  3545. * @note This can be selected for SAI1 or SAI2 (*)
  3546. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SAI\n
  3547. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SAI\n
  3548. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SAI\n
  3549. * PLLCFGR PLLPDIV LL_RCC_PLL_ConfigDomain_SAI
  3550. * @param Source This parameter can be one of the following values:
  3551. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3552. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3553. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3554. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3555. * @param PLLM This parameter can be one of the following values:
  3556. * @arg @ref LL_RCC_PLLM_DIV_1
  3557. * @arg @ref LL_RCC_PLLM_DIV_2
  3558. * @arg @ref LL_RCC_PLLM_DIV_3
  3559. * @arg @ref LL_RCC_PLLM_DIV_4
  3560. * @arg @ref LL_RCC_PLLM_DIV_5
  3561. * @arg @ref LL_RCC_PLLM_DIV_6
  3562. * @arg @ref LL_RCC_PLLM_DIV_7
  3563. * @arg @ref LL_RCC_PLLM_DIV_8
  3564. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  3565. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  3566. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  3567. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  3568. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  3569. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  3570. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  3571. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  3572. *
  3573. * (*) value not defined in all devices.
  3574. * @param PLLN Between 8 and 86 or 127 depending on devices
  3575. * @param PLLP This parameter can be one of the following values:
  3576. * @arg @ref LL_RCC_PLLP_DIV_2
  3577. * @arg @ref LL_RCC_PLLP_DIV_3
  3578. * @arg @ref LL_RCC_PLLP_DIV_4
  3579. * @arg @ref LL_RCC_PLLP_DIV_5
  3580. * @arg @ref LL_RCC_PLLP_DIV_6
  3581. * @arg @ref LL_RCC_PLLP_DIV_7
  3582. * @arg @ref LL_RCC_PLLP_DIV_8
  3583. * @arg @ref LL_RCC_PLLP_DIV_9
  3584. * @arg @ref LL_RCC_PLLP_DIV_10
  3585. * @arg @ref LL_RCC_PLLP_DIV_11
  3586. * @arg @ref LL_RCC_PLLP_DIV_12
  3587. * @arg @ref LL_RCC_PLLP_DIV_13
  3588. * @arg @ref LL_RCC_PLLP_DIV_14
  3589. * @arg @ref LL_RCC_PLLP_DIV_15
  3590. * @arg @ref LL_RCC_PLLP_DIV_16
  3591. * @arg @ref LL_RCC_PLLP_DIV_17
  3592. * @arg @ref LL_RCC_PLLP_DIV_18
  3593. * @arg @ref LL_RCC_PLLP_DIV_19
  3594. * @arg @ref LL_RCC_PLLP_DIV_20
  3595. * @arg @ref LL_RCC_PLLP_DIV_21
  3596. * @arg @ref LL_RCC_PLLP_DIV_22
  3597. * @arg @ref LL_RCC_PLLP_DIV_23
  3598. * @arg @ref LL_RCC_PLLP_DIV_24
  3599. * @arg @ref LL_RCC_PLLP_DIV_25
  3600. * @arg @ref LL_RCC_PLLP_DIV_26
  3601. * @arg @ref LL_RCC_PLLP_DIV_27
  3602. * @arg @ref LL_RCC_PLLP_DIV_28
  3603. * @arg @ref LL_RCC_PLLP_DIV_29
  3604. * @arg @ref LL_RCC_PLLP_DIV_30
  3605. * @arg @ref LL_RCC_PLLP_DIV_31
  3606. * @retval None
  3607. */
  3608. #else
  3609. /**
  3610. * @brief Configure PLL used for SAI domain clock
  3611. * @note PLL Source and PLLM Divider can be written only when PLL,
  3612. * PLLSAI1 and PLLSAI2 (*) are disabled.
  3613. * @note PLLN/PLLP can be written only when PLL is disabled.
  3614. * @note This can be selected for SAI1 or SAI2 (*)
  3615. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SAI\n
  3616. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SAI\n
  3617. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SAI\n
  3618. * PLLCFGR PLLP LL_RCC_PLL_ConfigDomain_SAI
  3619. * @param Source This parameter can be one of the following values:
  3620. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3621. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3622. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3623. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3624. * @param PLLM This parameter can be one of the following values:
  3625. * @arg @ref LL_RCC_PLLM_DIV_1
  3626. * @arg @ref LL_RCC_PLLM_DIV_2
  3627. * @arg @ref LL_RCC_PLLM_DIV_3
  3628. * @arg @ref LL_RCC_PLLM_DIV_4
  3629. * @arg @ref LL_RCC_PLLM_DIV_5
  3630. * @arg @ref LL_RCC_PLLM_DIV_6
  3631. * @arg @ref LL_RCC_PLLM_DIV_7
  3632. * @arg @ref LL_RCC_PLLM_DIV_8
  3633. * @param PLLN Between 8 and 86
  3634. * @param PLLP This parameter can be one of the following values:
  3635. * @arg @ref LL_RCC_PLLP_DIV_7
  3636. * @arg @ref LL_RCC_PLLP_DIV_17
  3637. * @retval None
  3638. */
  3639. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  3640. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  3641. {
  3642. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  3643. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLPDIV,
  3644. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLP);
  3645. #else
  3646. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLP,
  3647. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLP);
  3648. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  3649. }
  3650. #endif /* RCC_PLLP_SUPPORT */
  3651. /**
  3652. * @brief Configure PLL used for 48Mhz domain clock
  3653. * @note PLL Source and PLLM Divider can be written only when PLL,
  3654. * PLLSAI1 and PLLSAI2 (*) are disabled.
  3655. * @note PLLN/PLLQ can be written only when PLL is disabled.
  3656. * @note This can be selected for USB, RNG, SDMMC
  3657. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_48M\n
  3658. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_48M\n
  3659. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_48M\n
  3660. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_48M
  3661. * @param Source This parameter can be one of the following values:
  3662. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3663. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3664. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3665. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3666. * @param PLLM This parameter can be one of the following values:
  3667. * @arg @ref LL_RCC_PLLM_DIV_1
  3668. * @arg @ref LL_RCC_PLLM_DIV_2
  3669. * @arg @ref LL_RCC_PLLM_DIV_3
  3670. * @arg @ref LL_RCC_PLLM_DIV_4
  3671. * @arg @ref LL_RCC_PLLM_DIV_5
  3672. * @arg @ref LL_RCC_PLLM_DIV_6
  3673. * @arg @ref LL_RCC_PLLM_DIV_7
  3674. * @arg @ref LL_RCC_PLLM_DIV_8
  3675. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  3676. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  3677. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  3678. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  3679. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  3680. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  3681. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  3682. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  3683. *
  3684. * (*) value not defined in all devices.
  3685. * @param PLLN Between 8 and 86 or 127 depending on devices
  3686. * @param PLLQ This parameter can be one of the following values:
  3687. * @arg @ref LL_RCC_PLLQ_DIV_2
  3688. * @arg @ref LL_RCC_PLLQ_DIV_4
  3689. * @arg @ref LL_RCC_PLLQ_DIV_6
  3690. * @arg @ref LL_RCC_PLLQ_DIV_8
  3691. * @retval None
  3692. */
  3693. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  3694. {
  3695. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  3696. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  3697. }
  3698. /**
  3699. * @brief Configure PLL clock source
  3700. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_SetMainSource
  3701. * @param PLLSource This parameter can be one of the following values:
  3702. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3703. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3704. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3705. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3706. * @retval None
  3707. */
  3708. __STATIC_INLINE void LL_RCC_PLL_SetMainSource(uint32_t PLLSource)
  3709. {
  3710. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSource);
  3711. }
  3712. /**
  3713. * @brief Get the oscillator used as PLL clock source.
  3714. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_GetMainSource
  3715. * @retval Returned value can be one of the following values:
  3716. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3717. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3718. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3719. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3720. */
  3721. __STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void)
  3722. {
  3723. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC));
  3724. }
  3725. /**
  3726. * @brief Get Main PLL multiplication factor for VCO
  3727. * @rmtoll PLLCFGR PLLN LL_RCC_PLL_GetN
  3728. * @retval Between 8 and 86 or 127 depending on devices
  3729. */
  3730. __STATIC_INLINE uint32_t LL_RCC_PLL_GetN(void)
  3731. {
  3732. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos);
  3733. }
  3734. #if defined(RCC_PLLP_SUPPORT)
  3735. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  3736. /**
  3737. * @brief Get Main PLL division factor for PLLP
  3738. * @note Used for PLLSAI3CLK (SAI1 and SAI2 clock)
  3739. * @rmtoll PLLCFGR PLLPDIV LL_RCC_PLL_GetP
  3740. * @retval Returned value can be one of the following values:
  3741. * @arg @ref LL_RCC_PLLP_DIV_2
  3742. * @arg @ref LL_RCC_PLLP_DIV_3
  3743. * @arg @ref LL_RCC_PLLP_DIV_4
  3744. * @arg @ref LL_RCC_PLLP_DIV_5
  3745. * @arg @ref LL_RCC_PLLP_DIV_6
  3746. * @arg @ref LL_RCC_PLLP_DIV_7
  3747. * @arg @ref LL_RCC_PLLP_DIV_8
  3748. * @arg @ref LL_RCC_PLLP_DIV_9
  3749. * @arg @ref LL_RCC_PLLP_DIV_10
  3750. * @arg @ref LL_RCC_PLLP_DIV_11
  3751. * @arg @ref LL_RCC_PLLP_DIV_12
  3752. * @arg @ref LL_RCC_PLLP_DIV_13
  3753. * @arg @ref LL_RCC_PLLP_DIV_14
  3754. * @arg @ref LL_RCC_PLLP_DIV_15
  3755. * @arg @ref LL_RCC_PLLP_DIV_16
  3756. * @arg @ref LL_RCC_PLLP_DIV_17
  3757. * @arg @ref LL_RCC_PLLP_DIV_18
  3758. * @arg @ref LL_RCC_PLLP_DIV_19
  3759. * @arg @ref LL_RCC_PLLP_DIV_20
  3760. * @arg @ref LL_RCC_PLLP_DIV_21
  3761. * @arg @ref LL_RCC_PLLP_DIV_22
  3762. * @arg @ref LL_RCC_PLLP_DIV_23
  3763. * @arg @ref LL_RCC_PLLP_DIV_24
  3764. * @arg @ref LL_RCC_PLLP_DIV_25
  3765. * @arg @ref LL_RCC_PLLP_DIV_26
  3766. * @arg @ref LL_RCC_PLLP_DIV_27
  3767. * @arg @ref LL_RCC_PLLP_DIV_28
  3768. * @arg @ref LL_RCC_PLLP_DIV_29
  3769. * @arg @ref LL_RCC_PLLP_DIV_30
  3770. * @arg @ref LL_RCC_PLLP_DIV_31
  3771. */
  3772. __STATIC_INLINE uint32_t LL_RCC_PLL_GetP(void)
  3773. {
  3774. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPDIV));
  3775. }
  3776. #else
  3777. /**
  3778. * @brief Get Main PLL division factor for PLLP
  3779. * @note Used for PLLSAI3CLK (SAI1 and SAI2 clock)
  3780. * @rmtoll PLLCFGR PLLP LL_RCC_PLL_GetP
  3781. * @retval Returned value can be one of the following values:
  3782. * @arg @ref LL_RCC_PLLP_DIV_7
  3783. * @arg @ref LL_RCC_PLLP_DIV_17
  3784. */
  3785. __STATIC_INLINE uint32_t LL_RCC_PLL_GetP(void)
  3786. {
  3787. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLP));
  3788. }
  3789. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  3790. #endif /* RCC_PLLP_SUPPORT */
  3791. /**
  3792. * @brief Get Main PLL division factor for PLLQ
  3793. * @note Used for PLL48M1CLK selected for USB, RNG, SDMMC (48 MHz clock)
  3794. * @rmtoll PLLCFGR PLLQ LL_RCC_PLL_GetQ
  3795. * @retval Returned value can be one of the following values:
  3796. * @arg @ref LL_RCC_PLLQ_DIV_2
  3797. * @arg @ref LL_RCC_PLLQ_DIV_4
  3798. * @arg @ref LL_RCC_PLLQ_DIV_6
  3799. * @arg @ref LL_RCC_PLLQ_DIV_8
  3800. */
  3801. __STATIC_INLINE uint32_t LL_RCC_PLL_GetQ(void)
  3802. {
  3803. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQ));
  3804. }
  3805. /**
  3806. * @brief Get Main PLL division factor for PLLR
  3807. * @note Used for PLLCLK (system clock)
  3808. * @rmtoll PLLCFGR PLLR LL_RCC_PLL_GetR
  3809. * @retval Returned value can be one of the following values:
  3810. * @arg @ref LL_RCC_PLLR_DIV_2
  3811. * @arg @ref LL_RCC_PLLR_DIV_4
  3812. * @arg @ref LL_RCC_PLLR_DIV_6
  3813. * @arg @ref LL_RCC_PLLR_DIV_8
  3814. */
  3815. __STATIC_INLINE uint32_t LL_RCC_PLL_GetR(void)
  3816. {
  3817. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLR));
  3818. }
  3819. /**
  3820. * @brief Get Division factor for the main PLL and other PLL
  3821. * @rmtoll PLLCFGR PLLM LL_RCC_PLL_GetDivider
  3822. * @retval Returned value can be one of the following values:
  3823. * @arg @ref LL_RCC_PLLM_DIV_1
  3824. * @arg @ref LL_RCC_PLLM_DIV_2
  3825. * @arg @ref LL_RCC_PLLM_DIV_3
  3826. * @arg @ref LL_RCC_PLLM_DIV_4
  3827. * @arg @ref LL_RCC_PLLM_DIV_5
  3828. * @arg @ref LL_RCC_PLLM_DIV_6
  3829. * @arg @ref LL_RCC_PLLM_DIV_7
  3830. * @arg @ref LL_RCC_PLLM_DIV_8
  3831. * @arg @ref LL_RCC_PLLM_DIV_9 (*)
  3832. * @arg @ref LL_RCC_PLLM_DIV_10 (*)
  3833. * @arg @ref LL_RCC_PLLM_DIV_11 (*)
  3834. * @arg @ref LL_RCC_PLLM_DIV_12 (*)
  3835. * @arg @ref LL_RCC_PLLM_DIV_13 (*)
  3836. * @arg @ref LL_RCC_PLLM_DIV_14 (*)
  3837. * @arg @ref LL_RCC_PLLM_DIV_15 (*)
  3838. * @arg @ref LL_RCC_PLLM_DIV_16 (*)
  3839. *
  3840. * (*) value not defined in all devices.
  3841. */
  3842. __STATIC_INLINE uint32_t LL_RCC_PLL_GetDivider(void)
  3843. {
  3844. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLM));
  3845. }
  3846. #if defined(RCC_PLLP_SUPPORT)
  3847. /**
  3848. * @brief Enable PLL output mapped on SAI domain clock
  3849. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_EnableDomain_SAI
  3850. * @retval None
  3851. */
  3852. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_SAI(void)
  3853. {
  3854. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  3855. }
  3856. /**
  3857. * @brief Disable PLL output mapped on SAI domain clock
  3858. * @note Cannot be disabled if the PLL clock is used as the system
  3859. * clock
  3860. * @note In order to save power, when the PLLCLK of the PLL is
  3861. * not used, should be 0
  3862. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_DisableDomain_SAI
  3863. * @retval None
  3864. */
  3865. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_SAI(void)
  3866. {
  3867. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  3868. }
  3869. /**
  3870. * @brief Check if PLL output mapped on SAI domain clock is enabled
  3871. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_IsEnabledDomain_SAI
  3872. * @retval State of bit (1 or 0).
  3873. */
  3874. __STATIC_INLINE uint32_t LL_RCC_PLL_IsEnabledDomain_SAI(void)
  3875. {
  3876. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN) == (RCC_PLLCFGR_PLLPEN)) ? 1UL : 0UL);
  3877. }
  3878. #endif /* RCC_PLLP_SUPPORT */
  3879. /**
  3880. * @brief Enable PLL output mapped on 48MHz domain clock
  3881. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_48M
  3882. * @retval None
  3883. */
  3884. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_48M(void)
  3885. {
  3886. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3887. }
  3888. /**
  3889. * @brief Disable PLL output mapped on 48MHz domain clock
  3890. * @note Cannot be disabled if the PLL clock is used as the system
  3891. * clock
  3892. * @note In order to save power, when the PLLCLK of the PLL is
  3893. * not used, should be 0
  3894. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_48M
  3895. * @retval None
  3896. */
  3897. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_48M(void)
  3898. {
  3899. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3900. }
  3901. /**
  3902. * @brief Check if PLL output mapped on 48MHz domain clock is enabled
  3903. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_IsEnabledDomain_48M
  3904. * @retval State of bit (1 or 0).
  3905. */
  3906. __STATIC_INLINE uint32_t LL_RCC_PLL_IsEnabledDomain_48M(void)
  3907. {
  3908. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN) == (RCC_PLLCFGR_PLLQEN)) ? 1UL : 0UL);
  3909. }
  3910. /**
  3911. * @brief Enable PLL output mapped on SYSCLK domain
  3912. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_EnableDomain_SYS
  3913. * @retval None
  3914. */
  3915. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_SYS(void)
  3916. {
  3917. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN);
  3918. }
  3919. /**
  3920. * @brief Disable PLL output mapped on SYSCLK domain
  3921. * @note Cannot be disabled if the PLL clock is used as the system
  3922. * clock
  3923. * @note In order to save power, when the PLLCLK of the PLL is
  3924. * not used, Main PLL should be 0
  3925. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_DisableDomain_SYS
  3926. * @retval None
  3927. */
  3928. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_SYS(void)
  3929. {
  3930. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN);
  3931. }
  3932. /**
  3933. * @brief Check if PLL output mapped on SYSCLK domain clock is enabled
  3934. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_IsEnabledDomain_SYS
  3935. * @retval State of bit (1 or 0).
  3936. */
  3937. __STATIC_INLINE uint32_t LL_RCC_PLL_IsEnabledDomain_SYS(void)
  3938. {
  3939. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN) == (RCC_PLLCFGR_PLLREN)) ? 1UL : 0UL);
  3940. }
  3941. /**
  3942. * @}
  3943. */
  3944. #if defined(RCC_PLLSAI1_SUPPORT)
  3945. /** @defgroup RCC_LL_EF_PLLSAI1 PLLSAI1
  3946. * @{
  3947. */
  3948. /**
  3949. * @brief Enable PLLSAI1
  3950. * @rmtoll CR PLLSAI1ON LL_RCC_PLLSAI1_Enable
  3951. * @retval None
  3952. */
  3953. __STATIC_INLINE void LL_RCC_PLLSAI1_Enable(void)
  3954. {
  3955. SET_BIT(RCC->CR, RCC_CR_PLLSAI1ON);
  3956. }
  3957. /**
  3958. * @brief Disable PLLSAI1
  3959. * @rmtoll CR PLLSAI1ON LL_RCC_PLLSAI1_Disable
  3960. * @retval None
  3961. */
  3962. __STATIC_INLINE void LL_RCC_PLLSAI1_Disable(void)
  3963. {
  3964. CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI1ON);
  3965. }
  3966. /**
  3967. * @brief Check if PLLSAI1 Ready
  3968. * @rmtoll CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady
  3969. * @retval State of bit (1 or 0).
  3970. */
  3971. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
  3972. {
  3973. return ((READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) == RCC_CR_PLLSAI1RDY) ? 1UL : 0UL);
  3974. }
  3975. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT)
  3976. /**
  3977. * @brief Configure PLLSAI1 used for 48Mhz domain clock
  3978. * @note PLL Source can be written only when PLL, PLLSAI1 and PLLSAI2 (*) are disabled.
  3979. * @note PLLSAI1M/PLLSAI1N/PLLSAI1Q can be written only when PLLSAI1 is disabled.
  3980. * @note This can be selected for USB, RNG, SDMMC
  3981. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_48M\n
  3982. * PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_ConfigDomain_48M\n
  3983. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_48M\n
  3984. * PLLSAI1CFGR PLLSAI1Q LL_RCC_PLLSAI1_ConfigDomain_48M
  3985. * @param Source This parameter can be one of the following values:
  3986. * @arg @ref LL_RCC_PLLSOURCE_NONE
  3987. * @arg @ref LL_RCC_PLLSOURCE_MSI
  3988. * @arg @ref LL_RCC_PLLSOURCE_HSI
  3989. * @arg @ref LL_RCC_PLLSOURCE_HSE
  3990. * @param PLLM This parameter can be one of the following values:
  3991. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  3992. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  3993. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  3994. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  3995. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  3996. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  3997. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  3998. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  3999. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  4000. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  4001. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  4002. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  4003. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  4004. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  4005. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  4006. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  4007. * @param PLLN Between 8 and 86 or 127 depending on devices
  4008. * @param PLLQ This parameter can be one of the following values:
  4009. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  4010. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  4011. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  4012. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  4013. * @retval None
  4014. */
  4015. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  4016. {
  4017. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source);
  4018. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1M | RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1Q,
  4019. PLLM | (PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos) | PLLQ);
  4020. }
  4021. #else
  4022. /**
  4023. * @brief Configure PLLSAI1 used for 48Mhz domain clock
  4024. * @note PLL Source and PLLM Divider can be written only when PLL,
  4025. * PLLSAI1 and PLLSAI2 (*) are disabled.
  4026. * @note PLLSAI1N/PLLSAI1Q can be written only when PLLSAI1 is disabled.
  4027. * @note This can be selected for USB, RNG, SDMMC
  4028. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_48M\n
  4029. * PLLCFGR PLLM LL_RCC_PLLSAI1_ConfigDomain_48M\n
  4030. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_48M\n
  4031. * PLLSAI1CFGR PLLSAI1Q LL_RCC_PLLSAI1_ConfigDomain_48M
  4032. * @param Source This parameter can be one of the following values:
  4033. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4034. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4035. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4036. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4037. * @param PLLM This parameter can be one of the following values:
  4038. * @arg @ref LL_RCC_PLLM_DIV_1
  4039. * @arg @ref LL_RCC_PLLM_DIV_2
  4040. * @arg @ref LL_RCC_PLLM_DIV_3
  4041. * @arg @ref LL_RCC_PLLM_DIV_4
  4042. * @arg @ref LL_RCC_PLLM_DIV_5
  4043. * @arg @ref LL_RCC_PLLM_DIV_6
  4044. * @arg @ref LL_RCC_PLLM_DIV_7
  4045. * @arg @ref LL_RCC_PLLM_DIV_8
  4046. * @param PLLN Between 8 and 86 or 127 depending on devices
  4047. * @param PLLQ This parameter can be one of the following values:
  4048. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  4049. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  4050. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  4051. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  4052. * @retval None
  4053. */
  4054. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  4055. {
  4056. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4057. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1Q, PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos | PLLQ);
  4058. }
  4059. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT */
  4060. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT) && defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT)
  4061. /**
  4062. * @brief Configure PLLSAI1 used for SAI domain clock
  4063. * @note PLL Source can be written only when PLL, PLLSAI1 and PLLSAI2 (*) are disabled.
  4064. * @note PLLSAI1M/PLLSAI1N/PLLSAI1PDIV can be written only when PLLSAI1 is disabled.
  4065. * @note This can be selected for SAI1 or SAI2
  4066. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4067. * PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4068. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4069. * PLLSAI1CFGR PLLSAI1PDIV LL_RCC_PLLSAI1_ConfigDomain_SAI
  4070. * @param Source This parameter can be one of the following values:
  4071. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4072. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4073. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4074. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4075. * @param PLLM This parameter can be one of the following values:
  4076. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  4077. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  4078. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  4079. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  4080. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  4081. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  4082. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  4083. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  4084. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  4085. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  4086. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  4087. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  4088. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  4089. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  4090. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  4091. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  4092. * @param PLLN Between 8 and 86 or 127 depending on devices
  4093. * @param PLLP This parameter can be one of the following values:
  4094. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  4095. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  4096. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  4097. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  4098. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  4099. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  4100. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  4101. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  4102. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  4103. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  4104. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  4105. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  4106. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  4107. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  4108. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  4109. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  4110. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  4111. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  4112. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  4113. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  4114. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  4115. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  4116. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  4117. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  4118. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  4119. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  4120. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  4121. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  4122. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  4123. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  4124. * @retval None
  4125. */
  4126. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  4127. {
  4128. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source);
  4129. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1M | RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1PDIV,
  4130. PLLM | (PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos) | PLLP);
  4131. }
  4132. #elif defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT)
  4133. /**
  4134. * @brief Configure PLLSAI1 used for SAI domain clock
  4135. * @note PLL Source and PLLM Divider can be written only when PLL,
  4136. * PLLSAI1 and PLLSAI2 (*) are disabled.
  4137. * @note PLLSAI1N/PLLSAI1PDIV can be written only when PLLSAI1 is disabled.
  4138. * @note This can be selected for SAI1 or SAI2 (*)
  4139. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4140. * PLLCFGR PLLM LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4141. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4142. * PLLSAI1CFGR PLLSAI1PDIV LL_RCC_PLLSAI1_ConfigDomain_SAI
  4143. * @param Source This parameter can be one of the following values:
  4144. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4145. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4146. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4147. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4148. * @param PLLM This parameter can be one of the following values:
  4149. * @arg @ref LL_RCC_PLLM_DIV_1
  4150. * @arg @ref LL_RCC_PLLM_DIV_2
  4151. * @arg @ref LL_RCC_PLLM_DIV_3
  4152. * @arg @ref LL_RCC_PLLM_DIV_4
  4153. * @arg @ref LL_RCC_PLLM_DIV_5
  4154. * @arg @ref LL_RCC_PLLM_DIV_6
  4155. * @arg @ref LL_RCC_PLLM_DIV_7
  4156. * @arg @ref LL_RCC_PLLM_DIV_8
  4157. * @param PLLN Between 8 and 86 or 127 depending on devices
  4158. * @param PLLP This parameter can be one of the following values:
  4159. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  4160. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  4161. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  4162. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  4163. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  4164. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  4165. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  4166. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  4167. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  4168. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  4169. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  4170. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  4171. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  4172. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  4173. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  4174. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  4175. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  4176. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  4177. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  4178. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  4179. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  4180. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  4181. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  4182. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  4183. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  4184. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  4185. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  4186. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  4187. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  4188. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  4189. * @retval None
  4190. */
  4191. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  4192. {
  4193. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4194. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1PDIV,
  4195. PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos | PLLP);
  4196. }
  4197. #else
  4198. /**
  4199. * @brief Configure PLLSAI1 used for SAI domain clock
  4200. * @note PLL Source and PLLM Divider can be written only when PLL,
  4201. * PLLSAI1 and PLLSAI2 (*) are disabled.
  4202. * @note PLLSAI1N/PLLSAI1P can be written only when PLLSAI1 is disabled.
  4203. * @note This can be selected for SAI1 or SAI2 (*)
  4204. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4205. * PLLCFGR PLLM LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4206. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  4207. * PLLSAI1CFGR PLLSAI1P LL_RCC_PLLSAI1_ConfigDomain_SAI
  4208. * @param Source This parameter can be one of the following values:
  4209. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4210. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4211. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4212. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4213. * @param PLLM This parameter can be one of the following values:
  4214. * @arg @ref LL_RCC_PLLM_DIV_1
  4215. * @arg @ref LL_RCC_PLLM_DIV_2
  4216. * @arg @ref LL_RCC_PLLM_DIV_3
  4217. * @arg @ref LL_RCC_PLLM_DIV_4
  4218. * @arg @ref LL_RCC_PLLM_DIV_5
  4219. * @arg @ref LL_RCC_PLLM_DIV_6
  4220. * @arg @ref LL_RCC_PLLM_DIV_7
  4221. * @arg @ref LL_RCC_PLLM_DIV_8
  4222. * @param PLLN Between 8 and 86
  4223. * @param PLLP This parameter can be one of the following values:
  4224. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  4225. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  4226. * @retval None
  4227. */
  4228. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  4229. {
  4230. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4231. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1P, PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos | PLLP);
  4232. }
  4233. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT && RCC_PLLSAI1P_DIV_2_31_SUPPORT */
  4234. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT)
  4235. /**
  4236. * @brief Configure PLLSAI1 used for ADC domain clock
  4237. * @note PLL Source can be written only when PLL, PLLSAI1 and PLLSAI2 (*) are disabled.
  4238. * @note PLLSAI1M/PLLSAI1N/PLLSAI1R can be written only when PLLSAI1 is disabled.
  4239. * @note This can be selected for ADC
  4240. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  4241. * PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  4242. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  4243. * PLLSAI1CFGR PLLSAI1R LL_RCC_PLLSAI1_ConfigDomain_ADC
  4244. * @param Source This parameter can be one of the following values:
  4245. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4246. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4247. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4248. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4249. * @param PLLM This parameter can be one of the following values:
  4250. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  4251. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  4252. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  4253. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  4254. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  4255. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  4256. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  4257. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  4258. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  4259. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  4260. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  4261. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  4262. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  4263. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  4264. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  4265. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  4266. * @param PLLN Between 8 and 86 or 127 depending on devices
  4267. * @param PLLR This parameter can be one of the following values:
  4268. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  4269. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  4270. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  4271. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  4272. * @retval None
  4273. */
  4274. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_ADC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  4275. {
  4276. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source);
  4277. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1M | RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1R,
  4278. PLLM | (PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos) | PLLR);
  4279. }
  4280. #else
  4281. /**
  4282. * @brief Configure PLLSAI1 used for ADC domain clock
  4283. * @note PLL Source and PLLM Divider can be written only when PLL,
  4284. * PLLSAI1 and PLLSAI2 (*) are disabled.
  4285. * @note PLLN/PLLR can be written only when PLLSAI1 is disabled.
  4286. * @note This can be selected for ADC
  4287. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  4288. * PLLCFGR PLLM LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  4289. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  4290. * PLLSAI1CFGR PLLSAI1R LL_RCC_PLLSAI1_ConfigDomain_ADC
  4291. * @param Source This parameter can be one of the following values:
  4292. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4293. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4294. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4295. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4296. * @param PLLM This parameter can be one of the following values:
  4297. * @arg @ref LL_RCC_PLLM_DIV_1
  4298. * @arg @ref LL_RCC_PLLM_DIV_2
  4299. * @arg @ref LL_RCC_PLLM_DIV_3
  4300. * @arg @ref LL_RCC_PLLM_DIV_4
  4301. * @arg @ref LL_RCC_PLLM_DIV_5
  4302. * @arg @ref LL_RCC_PLLM_DIV_6
  4303. * @arg @ref LL_RCC_PLLM_DIV_7
  4304. * @arg @ref LL_RCC_PLLM_DIV_8
  4305. * @param PLLN Between 8 and 86 or 127 depending on devices
  4306. * @param PLLR This parameter can be one of the following values:
  4307. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  4308. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  4309. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  4310. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  4311. * @retval None
  4312. */
  4313. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_ADC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  4314. {
  4315. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4316. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1R, PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos | PLLR);
  4317. }
  4318. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT */
  4319. /**
  4320. * @brief Get SAI1PLL multiplication factor for VCO
  4321. * @rmtoll PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_GetN
  4322. * @retval Between 8 and 86 or 127 depending on devices
  4323. */
  4324. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetN(void)
  4325. {
  4326. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N) >> RCC_PLLSAI1CFGR_PLLSAI1N_Pos);
  4327. }
  4328. #if defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT)
  4329. /**
  4330. * @brief Get SAI1PLL division factor for PLLSAI1P
  4331. * @note Used for PLLSAI1CLK (SAI1 or SAI2 (*) clock).
  4332. * @rmtoll PLLSAI1CFGR PLLSAI1PDIV LL_RCC_PLLSAI1_GetP
  4333. * @retval Returned value can be one of the following values:
  4334. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  4335. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  4336. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  4337. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  4338. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  4339. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  4340. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  4341. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  4342. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  4343. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  4344. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  4345. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  4346. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  4347. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  4348. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  4349. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  4350. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  4351. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  4352. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  4353. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  4354. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  4355. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  4356. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  4357. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  4358. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  4359. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  4360. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  4361. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  4362. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  4363. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  4364. */
  4365. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetP(void)
  4366. {
  4367. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PDIV));
  4368. }
  4369. #else
  4370. /**
  4371. * @brief Get SAI1PLL division factor for PLLSAI1P
  4372. * @note Used for PLLSAI1CLK (SAI1 or SAI2 (*) clock).
  4373. * @rmtoll PLLSAI1CFGR PLLSAI1P LL_RCC_PLLSAI1_GetP
  4374. * @retval Returned value can be one of the following values:
  4375. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  4376. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  4377. */
  4378. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetP(void)
  4379. {
  4380. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1P));
  4381. }
  4382. #endif /* RCC_PLLSAI1P_DIV_2_31_SUPPORT */
  4383. /**
  4384. * @brief Get SAI1PLL division factor for PLLSAI1Q
  4385. * @note Used PLL48M2CLK selected for USB, RNG, SDMMC (48 MHz clock)
  4386. * @rmtoll PLLSAI1CFGR PLLSAI1Q LL_RCC_PLLSAI1_GetQ
  4387. * @retval Returned value can be one of the following values:
  4388. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  4389. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  4390. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  4391. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  4392. */
  4393. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetQ(void)
  4394. {
  4395. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1Q));
  4396. }
  4397. /**
  4398. * @brief Get PLLSAI1 division factor for PLLSAIR
  4399. * @note Used for PLLADC1CLK (ADC clock)
  4400. * @rmtoll PLLSAI1CFGR PLLSAI1R LL_RCC_PLLSAI1_GetR
  4401. * @retval Returned value can be one of the following values:
  4402. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  4403. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  4404. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  4405. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  4406. */
  4407. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetR(void)
  4408. {
  4409. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1R));
  4410. }
  4411. #if defined(RCC_PLLSAI1M_DIV_1_16_SUPPORT)
  4412. /**
  4413. * @brief Get Division factor for the PLLSAI1
  4414. * @rmtoll PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_GetDivider
  4415. * @retval Returned value can be one of the following values:
  4416. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  4417. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  4418. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  4419. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  4420. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  4421. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  4422. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  4423. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  4424. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  4425. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  4426. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  4427. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  4428. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  4429. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  4430. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  4431. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  4432. */
  4433. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetDivider(void)
  4434. {
  4435. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1M));
  4436. }
  4437. #endif /* RCC_PLLSAI1M_DIV_1_16_SUPPORT */
  4438. /**
  4439. * @brief Enable PLLSAI1 output mapped on SAI domain clock
  4440. * @rmtoll PLLSAI1CFGR PLLSAI1PEN LL_RCC_PLLSAI1_EnableDomain_SAI
  4441. * @retval None
  4442. */
  4443. __STATIC_INLINE void LL_RCC_PLLSAI1_EnableDomain_SAI(void)
  4444. {
  4445. SET_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PEN);
  4446. }
  4447. /**
  4448. * @brief Disable PLLSAI1 output mapped on SAI domain clock
  4449. * @note In order to save power, when of the PLLSAI1 is
  4450. * not used, should be 0
  4451. * @rmtoll PLLSAI1CFGR PLLSAI1PEN LL_RCC_PLLSAI1_DisableDomain_SAI
  4452. * @retval None
  4453. */
  4454. __STATIC_INLINE void LL_RCC_PLLSAI1_DisableDomain_SAI(void)
  4455. {
  4456. CLEAR_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PEN);
  4457. }
  4458. /**
  4459. * @brief Check if PLLSAI1 output mapped on SAI domain clock is enabled
  4460. * @rmtoll PLLSAI1CFGR PLLSAI1PEN LL_RCC_PLLSAI1_IsEnabledDomain_SAI
  4461. * @retval State of bit (1 or 0).
  4462. */
  4463. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsEnabledDomain_SAI(void)
  4464. {
  4465. return ((READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PEN) == (RCC_PLLSAI1CFGR_PLLSAI1PEN)) ? 1UL : 0UL);
  4466. }
  4467. /**
  4468. * @brief Enable PLLSAI1 output mapped on 48MHz domain clock
  4469. * @rmtoll PLLSAI1CFGR PLLSAI1QEN LL_RCC_PLLSAI1_EnableDomain_48M
  4470. * @retval None
  4471. */
  4472. __STATIC_INLINE void LL_RCC_PLLSAI1_EnableDomain_48M(void)
  4473. {
  4474. SET_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1QEN);
  4475. }
  4476. /**
  4477. * @brief Disable PLLSAI1 output mapped on 48MHz domain clock
  4478. * @note In order to save power, when of the PLLSAI1 is
  4479. * not used, should be 0
  4480. * @rmtoll PLLSAI1CFGR PLLSAI1QEN LL_RCC_PLLSAI1_DisableDomain_48M
  4481. * @retval None
  4482. */
  4483. __STATIC_INLINE void LL_RCC_PLLSAI1_DisableDomain_48M(void)
  4484. {
  4485. CLEAR_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1QEN);
  4486. }
  4487. /**
  4488. * @brief Check if PLLSAI1 output mapped on SAI domain clock is enabled
  4489. * @rmtoll PLLSAI1CFGR PLLSAI1QEN LL_RCC_PLLSAI1_IsEnabledDomain_48M
  4490. * @retval State of bit (1 or 0).
  4491. */
  4492. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsEnabledDomain_48M(void)
  4493. {
  4494. return ((READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1QEN) == (RCC_PLLSAI1CFGR_PLLSAI1QEN)) ? 1UL : 0UL);
  4495. }
  4496. /**
  4497. * @brief Enable PLLSAI1 output mapped on ADC domain clock
  4498. * @rmtoll PLLSAI1CFGR PLLSAI1REN LL_RCC_PLLSAI1_EnableDomain_ADC
  4499. * @retval None
  4500. */
  4501. __STATIC_INLINE void LL_RCC_PLLSAI1_EnableDomain_ADC(void)
  4502. {
  4503. SET_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1REN);
  4504. }
  4505. /**
  4506. * @brief Disable PLLSAI1 output mapped on ADC domain clock
  4507. * @note In order to save power, when of the PLLSAI1 is
  4508. * not used, Main PLLSAI1 should be 0
  4509. * @rmtoll PLLSAI1CFGR PLLSAI1REN LL_RCC_PLLSAI1_DisableDomain_ADC
  4510. * @retval None
  4511. */
  4512. __STATIC_INLINE void LL_RCC_PLLSAI1_DisableDomain_ADC(void)
  4513. {
  4514. CLEAR_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1REN);
  4515. }
  4516. /**
  4517. * @brief Check if PLLSAI1 output mapped on ADC domain clock is enabled
  4518. * @rmtoll PLLSAI1CFGR PLLSAI1REN LL_RCC_PLLSAI1_IsEnabledDomain_ADC
  4519. * @retval State of bit (1 or 0).
  4520. */
  4521. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsEnabledDomain_ADC(void)
  4522. {
  4523. return ((READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1REN) == (RCC_PLLSAI1CFGR_PLLSAI1REN)) ? 1UL : 0UL);
  4524. }
  4525. /**
  4526. * @}
  4527. */
  4528. #endif /* RCC_PLLSAI1_SUPPORT */
  4529. #if defined(RCC_PLLSAI2_SUPPORT)
  4530. /** @defgroup RCC_LL_EF_PLLSAI2 PLLSAI2
  4531. * @{
  4532. */
  4533. /**
  4534. * @brief Enable PLLSAI2
  4535. * @rmtoll CR PLLSAI2ON LL_RCC_PLLSAI2_Enable
  4536. * @retval None
  4537. */
  4538. __STATIC_INLINE void LL_RCC_PLLSAI2_Enable(void)
  4539. {
  4540. SET_BIT(RCC->CR, RCC_CR_PLLSAI2ON);
  4541. }
  4542. /**
  4543. * @brief Disable PLLSAI2
  4544. * @rmtoll CR PLLSAI2ON LL_RCC_PLLSAI2_Disable
  4545. * @retval None
  4546. */
  4547. __STATIC_INLINE void LL_RCC_PLLSAI2_Disable(void)
  4548. {
  4549. CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI2ON);
  4550. }
  4551. /**
  4552. * @brief Check if PLLSAI2 Ready
  4553. * @rmtoll CR PLLSAI2RDY LL_RCC_PLLSAI2_IsReady
  4554. * @retval State of bit (1 or 0).
  4555. */
  4556. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsReady(void)
  4557. {
  4558. return ((READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) == RCC_CR_PLLSAI2RDY) ? 1UL : 0UL);
  4559. }
  4560. #if defined(RCC_PLLSAI2M_DIV_1_16_SUPPORT) && defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT)
  4561. /**
  4562. * @brief Configure PLLSAI2 used for SAI domain clock
  4563. * @note PLL Source can be written only when PLL, PLLSAI1 and PLLSAI2 (*) are disabled.
  4564. * @note PLLSAI2M/PLLSAI2N/PLLSAI2PDIV can be written only when PLLSAI2 is disabled.
  4565. * @note This can be selected for SAI1 or SAI2
  4566. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4567. * PLLSAI2CFGR PLLSAI2M LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4568. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4569. * PLLSAI2CFGR PLLSAI2PDIV LL_RCC_PLLSAI2_ConfigDomain_SAI
  4570. * @param Source This parameter can be one of the following values:
  4571. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4572. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4573. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4574. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4575. * @param PLLM This parameter can be one of the following values:
  4576. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  4577. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  4578. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  4579. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  4580. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  4581. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  4582. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  4583. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  4584. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  4585. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  4586. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  4587. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  4588. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  4589. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  4590. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  4591. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  4592. * @param PLLN Between 8 and 86 or 127 depending on devices
  4593. * @param PLLP This parameter can be one of the following values:
  4594. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  4595. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  4596. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  4597. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  4598. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  4599. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  4600. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  4601. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  4602. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  4603. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  4604. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  4605. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  4606. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  4607. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  4608. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  4609. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  4610. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  4611. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  4612. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  4613. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  4614. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  4615. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  4616. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  4617. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  4618. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  4619. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  4620. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  4621. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  4622. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  4623. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  4624. * @retval None
  4625. */
  4626. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  4627. {
  4628. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source);
  4629. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2M | RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2PDIV,
  4630. PLLM | (PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos) | PLLP);
  4631. }
  4632. #elif defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT)
  4633. /**
  4634. * @brief Configure PLLSAI2 used for SAI domain clock
  4635. * @note PLL Source and PLLM Divider can be written only when PLL,
  4636. * PLLSAI1 and PLLSAI2 are disabled.
  4637. * @note PLLSAI2N/PLLSAI2PDIV can be written only when PLLSAI2 is disabled.
  4638. * @note This can be selected for SAI1 or SAI2
  4639. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4640. * PLLCFGR PLLM LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4641. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4642. * PLLSAI2CFGR PLLSAI2PDIV LL_RCC_PLLSAI2_ConfigDomain_SAI
  4643. * @param Source This parameter can be one of the following values:
  4644. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4645. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4646. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4647. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4648. * @param PLLM This parameter can be one of the following values:
  4649. * @arg @ref LL_RCC_PLLM_DIV_1
  4650. * @arg @ref LL_RCC_PLLM_DIV_2
  4651. * @arg @ref LL_RCC_PLLM_DIV_3
  4652. * @arg @ref LL_RCC_PLLM_DIV_4
  4653. * @arg @ref LL_RCC_PLLM_DIV_5
  4654. * @arg @ref LL_RCC_PLLM_DIV_6
  4655. * @arg @ref LL_RCC_PLLM_DIV_7
  4656. * @arg @ref LL_RCC_PLLM_DIV_8
  4657. * @param PLLN Between 8 and 86 or 127 depending on devices
  4658. * @param PLLP This parameter can be one of the following values:
  4659. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  4660. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  4661. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  4662. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  4663. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  4664. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  4665. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  4666. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  4667. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  4668. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  4669. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  4670. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  4671. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  4672. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  4673. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  4674. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  4675. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  4676. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  4677. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  4678. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  4679. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  4680. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  4681. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  4682. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  4683. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  4684. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  4685. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  4686. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  4687. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  4688. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  4689. * @retval None
  4690. */
  4691. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  4692. {
  4693. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4694. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2PDIV, PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos | PLLP);
  4695. }
  4696. #else
  4697. /**
  4698. * @brief Configure PLLSAI2 used for SAI domain clock
  4699. * @note PLL Source and PLLM Divider can be written only when PLL,
  4700. * PLLSAI2 and PLLSAI2 are disabled.
  4701. * @note PLLSAI2N/PLLSAI2P can be written only when PLLSAI2 is disabled.
  4702. * @note This can be selected for SAI1 or SAI2
  4703. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4704. * PLLCFGR PLLM LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4705. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  4706. * PLLSAI2CFGR PLLSAI2P LL_RCC_PLLSAI2_ConfigDomain_SAI
  4707. * @param Source This parameter can be one of the following values:
  4708. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4709. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4710. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4711. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4712. * @param PLLM This parameter can be one of the following values:
  4713. * @arg @ref LL_RCC_PLLM_DIV_1
  4714. * @arg @ref LL_RCC_PLLM_DIV_2
  4715. * @arg @ref LL_RCC_PLLM_DIV_3
  4716. * @arg @ref LL_RCC_PLLM_DIV_4
  4717. * @arg @ref LL_RCC_PLLM_DIV_5
  4718. * @arg @ref LL_RCC_PLLM_DIV_6
  4719. * @arg @ref LL_RCC_PLLM_DIV_7
  4720. * @arg @ref LL_RCC_PLLM_DIV_8
  4721. * @param PLLN Between 8 and 86
  4722. * @param PLLP This parameter can be one of the following values:
  4723. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  4724. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  4725. * @retval None
  4726. */
  4727. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  4728. {
  4729. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4730. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2P, PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos | PLLP);
  4731. }
  4732. #endif /* RCC_PLLSAI2M_DIV_1_16_SUPPORT && RCC_PLLSAI2P_DIV_2_31_SUPPORT */
  4733. #if defined(DSI)
  4734. /**
  4735. * @brief Configure PLLSAI2 used for DSI domain clock
  4736. * @note PLL Source can be written only when PLL, PLLSAI1 and PLLSAI2 (*) are disabled.
  4737. * @note PLLSAI2M/PLLSAI2N/PLLSAI2Q can be written only when PLLSAI2 is disabled.
  4738. * @note This can be selected for DSI
  4739. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI2_ConfigDomain_DSI\n
  4740. * PLLSAI2CFGR PLLSAI2M LL_RCC_PLLSAI2_ConfigDomain_DSI\n
  4741. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_DSI\n
  4742. * PLLSAI2CFGR PLLSAI2Q LL_RCC_PLLSAI2_ConfigDomain_DSI
  4743. * @param Source This parameter can be one of the following values:
  4744. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4745. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4746. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4747. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4748. * @param PLLM This parameter can be one of the following values:
  4749. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  4750. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  4751. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  4752. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  4753. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  4754. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  4755. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  4756. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  4757. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  4758. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  4759. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  4760. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  4761. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  4762. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  4763. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  4764. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  4765. * @param PLLN Between 8 and 127
  4766. * @param PLLQ This parameter can be one of the following values:
  4767. * @arg @ref LL_RCC_PLLSAI2Q_DIV_2
  4768. * @arg @ref LL_RCC_PLLSAI2Q_DIV_4
  4769. * @arg @ref LL_RCC_PLLSAI2Q_DIV_6
  4770. * @arg @ref LL_RCC_PLLSAI2Q_DIV_8
  4771. * @retval None
  4772. */
  4773. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_DSI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  4774. {
  4775. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source);
  4776. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2M | RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2Q,
  4777. (PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos) | PLLQ | PLLM);
  4778. }
  4779. #endif /* DSI */
  4780. #if defined(LTDC)
  4781. /**
  4782. * @brief Configure PLLSAI2 used for LTDC domain clock
  4783. * @note PLL Source can be written only when PLL, PLLSAI1 and PLLSAI2 (*) are disabled.
  4784. * @note PLLSAI2M/PLLSAI2N/PLLSAI2R can be written only when PLLSAI2 is disabled.
  4785. * @note This can be selected for LTDC
  4786. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI2_ConfigDomain_LTDC\n
  4787. * PLLSAI2CFGR PLLSAI2M LL_RCC_PLLSAI2_ConfigDomain_LTDC\n
  4788. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_LTDC\n
  4789. * PLLSAI2CFGR PLLSAI2R LL_RCC_PLLSAI2_ConfigDomain_LTDC\n
  4790. * CCIPR2 PLLSAI2DIVR LL_RCC_PLLSAI2_ConfigDomain_LTDC
  4791. * @param Source This parameter can be one of the following values:
  4792. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4793. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4794. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4795. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4796. * @param PLLM This parameter can be one of the following values:
  4797. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  4798. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  4799. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  4800. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  4801. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  4802. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  4803. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  4804. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  4805. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  4806. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  4807. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  4808. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  4809. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  4810. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  4811. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  4812. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  4813. * @param PLLN Between 8 and 127
  4814. * @param PLLR This parameter can be one of the following values:
  4815. * @arg @ref LL_RCC_PLLSAI2R_DIV_2
  4816. * @arg @ref LL_RCC_PLLSAI2R_DIV_4
  4817. * @arg @ref LL_RCC_PLLSAI2R_DIV_6
  4818. * @arg @ref LL_RCC_PLLSAI2R_DIV_8
  4819. * @param PLLDIVR This parameter can be one of the following values:
  4820. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_2
  4821. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_4
  4822. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_8
  4823. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_16
  4824. * @retval None
  4825. */
  4826. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_LTDC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR, uint32_t PLLDIVR)
  4827. {
  4828. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, Source);
  4829. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2M | RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2R,
  4830. (PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos) | PLLR | PLLM);
  4831. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_PLLSAI2DIVR, PLLDIVR);
  4832. }
  4833. #else
  4834. /**
  4835. * @brief Configure PLLSAI2 used for ADC domain clock
  4836. * @note PLL Source and PLLM Divider can be written only when PLL,
  4837. * PLLSAI2 and PLLSAI2 are disabled.
  4838. * @note PLLSAI2N/PLLSAI2R can be written only when PLLSAI2 is disabled.
  4839. * @note This can be selected for ADC
  4840. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLLSAI2_ConfigDomain_ADC\n
  4841. * PLLCFGR PLLM LL_RCC_PLLSAI2_ConfigDomain_ADC\n
  4842. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_ADC\n
  4843. * PLLSAI2CFGR PLLSAI2R LL_RCC_PLLSAI2_ConfigDomain_ADC
  4844. * @param Source This parameter can be one of the following values:
  4845. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4846. * @arg @ref LL_RCC_PLLSOURCE_MSI
  4847. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4848. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4849. * @param PLLM This parameter can be one of the following values:
  4850. * @arg @ref LL_RCC_PLLM_DIV_1
  4851. * @arg @ref LL_RCC_PLLM_DIV_2
  4852. * @arg @ref LL_RCC_PLLM_DIV_3
  4853. * @arg @ref LL_RCC_PLLM_DIV_4
  4854. * @arg @ref LL_RCC_PLLM_DIV_5
  4855. * @arg @ref LL_RCC_PLLM_DIV_6
  4856. * @arg @ref LL_RCC_PLLM_DIV_7
  4857. * @arg @ref LL_RCC_PLLM_DIV_8
  4858. * @param PLLN Between 8 and 86
  4859. * @param PLLR This parameter can be one of the following values:
  4860. * @arg @ref LL_RCC_PLLSAI2R_DIV_2
  4861. * @arg @ref LL_RCC_PLLSAI2R_DIV_4
  4862. * @arg @ref LL_RCC_PLLSAI2R_DIV_6
  4863. * @arg @ref LL_RCC_PLLSAI2R_DIV_8
  4864. * @retval None
  4865. */
  4866. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_ADC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  4867. {
  4868. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM, Source | PLLM);
  4869. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2R, PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos | PLLR);
  4870. }
  4871. #endif /* LTDC */
  4872. /**
  4873. * @brief Get SAI2PLL multiplication factor for VCO
  4874. * @rmtoll PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_GetN
  4875. * @retval Between 8 and 86 or 127 depending on devices
  4876. */
  4877. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetN(void)
  4878. {
  4879. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N) >> RCC_PLLSAI2CFGR_PLLSAI2N_Pos);
  4880. }
  4881. #if defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT)
  4882. /**
  4883. * @brief Get SAI2PLL division factor for PLLSAI2P
  4884. * @note Used for PLLSAI2CLK (SAI1 or SAI2 clock).
  4885. * @rmtoll PLLSAI2CFGR PLLSAI2PDIV LL_RCC_PLLSAI2_GetP
  4886. * @retval Returned value can be one of the following values:
  4887. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  4888. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  4889. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  4890. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  4891. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  4892. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  4893. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  4894. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  4895. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  4896. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  4897. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  4898. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  4899. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  4900. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  4901. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  4902. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  4903. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  4904. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  4905. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  4906. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  4907. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  4908. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  4909. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  4910. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  4911. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  4912. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  4913. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  4914. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  4915. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  4916. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  4917. */
  4918. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetP(void)
  4919. {
  4920. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PDIV));
  4921. }
  4922. #else
  4923. /**
  4924. * @brief Get SAI2PLL division factor for PLLSAI2P
  4925. * @note Used for PLLSAI2CLK (SAI1 or SAI2 clock).
  4926. * @rmtoll PLLSAI2CFGR PLLSAI2P LL_RCC_PLLSAI2_GetP
  4927. * @retval Returned value can be one of the following values:
  4928. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  4929. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  4930. */
  4931. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetP(void)
  4932. {
  4933. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2P));
  4934. }
  4935. #endif /* RCC_PLLSAI2P_DIV_2_31_SUPPORT */
  4936. #if defined(RCC_PLLSAI2Q_DIV_SUPPORT)
  4937. /**
  4938. * @brief Get division factor for PLLSAI2Q
  4939. * @note Used for PLLDSICLK (DSI clock)
  4940. * @rmtoll PLLSAI2CFGR PLLSAI2Q LL_RCC_PLLSAI2_GetQ
  4941. * @retval Returned value can be one of the following values:
  4942. * @arg @ref LL_RCC_PLLSAI2Q_DIV_2
  4943. * @arg @ref LL_RCC_PLLSAI2Q_DIV_4
  4944. * @arg @ref LL_RCC_PLLSAI2Q_DIV_6
  4945. * @arg @ref LL_RCC_PLLSAI2Q_DIV_8
  4946. */
  4947. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetQ(void)
  4948. {
  4949. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2Q));
  4950. }
  4951. #endif /* RCC_PLLSAI2Q_DIV_SUPPORT */
  4952. /**
  4953. * @brief Get SAI2PLL division factor for PLLSAI2R
  4954. * @note Used for PLLADC2CLK (ADC clock) or PLLLCDCLK (LTDC clock) depending on devices
  4955. * @rmtoll PLLSAI2CFGR PLLSAI2R LL_RCC_PLLSAI2_GetR
  4956. * @retval Returned value can be one of the following values:
  4957. * @arg @ref LL_RCC_PLLSAI2R_DIV_2
  4958. * @arg @ref LL_RCC_PLLSAI2R_DIV_4
  4959. * @arg @ref LL_RCC_PLLSAI2R_DIV_6
  4960. * @arg @ref LL_RCC_PLLSAI2R_DIV_8
  4961. */
  4962. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetR(void)
  4963. {
  4964. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2R));
  4965. }
  4966. #if defined(RCC_PLLSAI2M_DIV_1_16_SUPPORT)
  4967. /**
  4968. * @brief Get Division factor for the PLLSAI2
  4969. * @rmtoll PLLSAI2CFGR PLLSAI2M LL_RCC_PLLSAI2_GetDivider
  4970. * @retval Returned value can be one of the following values:
  4971. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  4972. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  4973. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  4974. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  4975. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  4976. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  4977. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  4978. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  4979. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  4980. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  4981. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  4982. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  4983. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  4984. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  4985. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  4986. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  4987. */
  4988. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetDivider(void)
  4989. {
  4990. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2M));
  4991. }
  4992. #endif /* RCC_PLLSAI2M_DIV_1_16_SUPPORT */
  4993. #if defined(RCC_CCIPR2_PLLSAI2DIVR)
  4994. /**
  4995. * @brief Get PLLSAI2 division factor for PLLSAI2DIVR
  4996. * @note Used for LTDC domain clock
  4997. * @rmtoll CCIPR2 PLLSAI2DIVR LL_RCC_PLLSAI2_GetDIVR
  4998. * @retval Returned value can be one of the following values:
  4999. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_2
  5000. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_4
  5001. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_8
  5002. * @arg @ref LL_RCC_PLLSAI2DIVR_DIV_16
  5003. */
  5004. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetDIVR(void)
  5005. {
  5006. return (uint32_t)(READ_BIT(RCC->CCIPR2, RCC_CCIPR2_PLLSAI2DIVR));
  5007. }
  5008. #endif /* RCC_CCIPR2_PLLSAI2DIVR */
  5009. /**
  5010. * @brief Enable PLLSAI2 output mapped on SAI domain clock
  5011. * @rmtoll PLLSAI2CFGR PLLSAI2PEN LL_RCC_PLLSAI2_EnableDomain_SAI
  5012. * @retval None
  5013. */
  5014. __STATIC_INLINE void LL_RCC_PLLSAI2_EnableDomain_SAI(void)
  5015. {
  5016. SET_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PEN);
  5017. }
  5018. /**
  5019. * @brief Disable PLLSAI2 output mapped on SAI domain clock
  5020. * @note In order to save power, when of the PLLSAI2 is
  5021. * not used, should be 0
  5022. * @rmtoll PLLSAI2CFGR PLLSAI2PEN LL_RCC_PLLSAI2_DisableDomain_SAI
  5023. * @retval None
  5024. */
  5025. __STATIC_INLINE void LL_RCC_PLLSAI2_DisableDomain_SAI(void)
  5026. {
  5027. CLEAR_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PEN);
  5028. }
  5029. /**
  5030. * @brief Check if PLLSAI2 output mapped on SAI domain clock is enabled
  5031. * @rmtoll PLLSAI2CFGR PLLSAI2PEN LL_RCC_PLLSAI2_IsEnabledDomain_SAI
  5032. * @retval State of bit (1 or 0).
  5033. */
  5034. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsEnabledDomain_SAI(void)
  5035. {
  5036. return ((READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PEN) == (RCC_PLLSAI2CFGR_PLLSAI2PEN)) ? 1UL : 0UL);
  5037. }
  5038. #if defined(DSI)
  5039. /**
  5040. * @brief Enable PLLSAI2 output mapped on DSI domain clock
  5041. * @rmtoll PLLSAI2CFGR PLLSAI2QEN LL_RCC_PLLSAI2_EnableDomain_DSI
  5042. * @retval None
  5043. */
  5044. __STATIC_INLINE void LL_RCC_PLLSAI2_EnableDomain_DSI(void)
  5045. {
  5046. SET_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2QEN);
  5047. }
  5048. /**
  5049. * @brief Disable PLLSAI2 output mapped on DSI domain clock
  5050. * @note In order to save power, when of the PLLSAI2 is
  5051. * not used, Main PLLSAI2 should be 0
  5052. * @rmtoll PLLSAI2CFGR PLLSAI2QEN LL_RCC_PLLSAI2_DisableDomain_DSI
  5053. * @retval None
  5054. */
  5055. __STATIC_INLINE void LL_RCC_PLLSAI2_DisableDomain_DSI(void)
  5056. {
  5057. CLEAR_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2QEN);
  5058. }
  5059. /**
  5060. * @brief Check if PLLSAI2 output mapped on DSI domain clock is enabled
  5061. * @rmtoll PLLSAI2CFGR PLLSAI2QEN LL_RCC_PLLSAI2_IsEnabledDomain_DSI
  5062. * @retval State of bit (1 or 0).
  5063. */
  5064. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsEnabledDomain_DSI(void)
  5065. {
  5066. return ((READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2QEN) == (RCC_PLLSAI2CFGR_PLLSAI2QEN)) ? 1UL : 0UL);
  5067. }
  5068. #endif /* DSI */
  5069. #if defined(LTDC)
  5070. /**
  5071. * @brief Enable PLLSAI2 output mapped on LTDC domain clock
  5072. * @rmtoll PLLSAI2CFGR PLLSAI2REN LL_RCC_PLLSAI2_EnableDomain_LTDC
  5073. * @retval None
  5074. */
  5075. __STATIC_INLINE void LL_RCC_PLLSAI2_EnableDomain_LTDC(void)
  5076. {
  5077. SET_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2REN);
  5078. }
  5079. /**
  5080. * @brief Disable PLLSAI2 output mapped on LTDC domain clock
  5081. * @note In order to save power, when of the PLLSAI2 is
  5082. * not used, Main PLLSAI2 should be 0
  5083. * @rmtoll PLLSAI2CFGR PLLSAI2REN LL_RCC_PLLSAI2_DisableDomain_LTDC
  5084. * @retval None
  5085. */
  5086. __STATIC_INLINE void LL_RCC_PLLSAI2_DisableDomain_LTDC(void)
  5087. {
  5088. CLEAR_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2REN);
  5089. }
  5090. /**
  5091. * @brief Check if PLLSAI2 output mapped on LTDC domain clock is enabled
  5092. * @rmtoll PLLSAI2CFGR PLLSAI2REN LL_RCC_PLLSAI2_IsEnabledDomain_LTDC
  5093. * @retval State of bit (1 or 0).
  5094. */
  5095. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsEnabledDomain_LTDC(void)
  5096. {
  5097. return ((READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2REN) == (RCC_PLLSAI2CFGR_PLLSAI2REN)) ? 1UL : 0UL);
  5098. }
  5099. #else
  5100. /**
  5101. * @brief Enable PLLSAI2 output mapped on ADC domain clock
  5102. * @rmtoll PLLSAI2CFGR PLLSAI2REN LL_RCC_PLLSAI2_EnableDomain_ADC
  5103. * @retval None
  5104. */
  5105. __STATIC_INLINE void LL_RCC_PLLSAI2_EnableDomain_ADC(void)
  5106. {
  5107. SET_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2REN);
  5108. }
  5109. /**
  5110. * @brief Disable PLLSAI2 output mapped on ADC domain clock
  5111. * @note In order to save power, when of the PLLSAI2 is
  5112. * not used, Main PLLSAI2 should be 0
  5113. * @rmtoll PLLSAI2CFGR PLLSAI2REN LL_RCC_PLLSAI2_DisableDomain_ADC
  5114. * @retval None
  5115. */
  5116. __STATIC_INLINE void LL_RCC_PLLSAI2_DisableDomain_ADC(void)
  5117. {
  5118. CLEAR_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2REN);
  5119. }
  5120. /**
  5121. * @brief Check if PLLSAI2 output mapped on ADC domain clock is enabled
  5122. * @rmtoll PLLSAI2CFGR PLLSAI2REN LL_RCC_PLLSAI2_IsEnabledDomain_ADC
  5123. * @retval State of bit (1 or 0).
  5124. */
  5125. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsEnabledDomain_ADC(void)
  5126. {
  5127. return ((READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2REN) == (RCC_PLLSAI2CFGR_PLLSAI2REN)) ? 1UL : 0UL);
  5128. }
  5129. #endif /* LTDC */
  5130. /**
  5131. * @}
  5132. */
  5133. #endif /* RCC_PLLSAI2_SUPPORT */
  5134. #if defined(OCTOSPI1)
  5135. /** @defgroup RCC_LL_EF_OCTOSPI OCTOSPI
  5136. * @{
  5137. */
  5138. /**
  5139. * @brief Configure OCTOSPI1 DQS delay
  5140. * @rmtoll DLYCFGR OCTOSPI1_DLY LL_RCC_OCTOSPI1_DelayConfig
  5141. * @param Delay OCTOSPI1 DQS delay between 0 and 15
  5142. * @retval None
  5143. */
  5144. __STATIC_INLINE void LL_RCC_OCTOSPI1_DelayConfig(uint32_t Delay)
  5145. {
  5146. MODIFY_REG(RCC->DLYCFGR, RCC_DLYCFGR_OCTOSPI1_DLY, Delay);
  5147. }
  5148. #if defined(OCTOSPI2)
  5149. /**
  5150. * @brief Configure OCTOSPI2 DQS delay
  5151. * @rmtoll DLYCFGR OCTOSPI2_DLY LL_RCC_OCTOSPI2_DelayConfig
  5152. * @param Delay OCTOSPI2 DQS delay between 0 and 15
  5153. * @retval None
  5154. */
  5155. __STATIC_INLINE void LL_RCC_OCTOSPI2_DelayConfig(uint32_t Delay)
  5156. {
  5157. MODIFY_REG(RCC->DLYCFGR, RCC_DLYCFGR_OCTOSPI2_DLY, (Delay << RCC_DLYCFGR_OCTOSPI2_DLY_Pos));
  5158. }
  5159. #endif /* OCTOSPI2 */
  5160. /**
  5161. * @}
  5162. */
  5163. #endif /* OCTOSPI1 */
  5164. /** @defgroup RCC_LL_EF_FLAG_Management FLAG Management
  5165. * @{
  5166. */
  5167. /**
  5168. * @brief Clear LSI ready interrupt flag
  5169. * @rmtoll CICR LSIRDYC LL_RCC_ClearFlag_LSIRDY
  5170. * @retval None
  5171. */
  5172. __STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void)
  5173. {
  5174. SET_BIT(RCC->CICR, RCC_CICR_LSIRDYC);
  5175. }
  5176. /**
  5177. * @brief Clear LSE ready interrupt flag
  5178. * @rmtoll CICR LSERDYC LL_RCC_ClearFlag_LSERDY
  5179. * @retval None
  5180. */
  5181. __STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void)
  5182. {
  5183. SET_BIT(RCC->CICR, RCC_CICR_LSERDYC);
  5184. }
  5185. /**
  5186. * @brief Clear MSI ready interrupt flag
  5187. * @rmtoll CICR MSIRDYC LL_RCC_ClearFlag_MSIRDY
  5188. * @retval None
  5189. */
  5190. __STATIC_INLINE void LL_RCC_ClearFlag_MSIRDY(void)
  5191. {
  5192. SET_BIT(RCC->CICR, RCC_CICR_MSIRDYC);
  5193. }
  5194. /**
  5195. * @brief Clear HSI ready interrupt flag
  5196. * @rmtoll CICR HSIRDYC LL_RCC_ClearFlag_HSIRDY
  5197. * @retval None
  5198. */
  5199. __STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void)
  5200. {
  5201. SET_BIT(RCC->CICR, RCC_CICR_HSIRDYC);
  5202. }
  5203. /**
  5204. * @brief Clear HSE ready interrupt flag
  5205. * @rmtoll CICR HSERDYC LL_RCC_ClearFlag_HSERDY
  5206. * @retval None
  5207. */
  5208. __STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void)
  5209. {
  5210. SET_BIT(RCC->CICR, RCC_CICR_HSERDYC);
  5211. }
  5212. /**
  5213. * @brief Clear PLL ready interrupt flag
  5214. * @rmtoll CICR PLLRDYC LL_RCC_ClearFlag_PLLRDY
  5215. * @retval None
  5216. */
  5217. __STATIC_INLINE void LL_RCC_ClearFlag_PLLRDY(void)
  5218. {
  5219. SET_BIT(RCC->CICR, RCC_CICR_PLLRDYC);
  5220. }
  5221. #if defined(RCC_HSI48_SUPPORT)
  5222. /**
  5223. * @brief Clear HSI48 ready interrupt flag
  5224. * @rmtoll CICR HSI48RDYC LL_RCC_ClearFlag_HSI48RDY
  5225. * @retval None
  5226. */
  5227. __STATIC_INLINE void LL_RCC_ClearFlag_HSI48RDY(void)
  5228. {
  5229. SET_BIT(RCC->CICR, RCC_CICR_HSI48RDYC);
  5230. }
  5231. #endif /* RCC_HSI48_SUPPORT */
  5232. #if defined(RCC_PLLSAI1_SUPPORT)
  5233. /**
  5234. * @brief Clear PLLSAI1 ready interrupt flag
  5235. * @rmtoll CICR PLLSAI1RDYC LL_RCC_ClearFlag_PLLSAI1RDY
  5236. * @retval None
  5237. */
  5238. __STATIC_INLINE void LL_RCC_ClearFlag_PLLSAI1RDY(void)
  5239. {
  5240. SET_BIT(RCC->CICR, RCC_CICR_PLLSAI1RDYC);
  5241. }
  5242. #endif /* RCC_PLLSAI1_SUPPORT */
  5243. #if defined(RCC_PLLSAI2_SUPPORT)
  5244. /**
  5245. * @brief Clear PLLSAI1 ready interrupt flag
  5246. * @rmtoll CICR PLLSAI2RDYC LL_RCC_ClearFlag_PLLSAI2RDY
  5247. * @retval None
  5248. */
  5249. __STATIC_INLINE void LL_RCC_ClearFlag_PLLSAI2RDY(void)
  5250. {
  5251. SET_BIT(RCC->CICR, RCC_CICR_PLLSAI2RDYC);
  5252. }
  5253. #endif /* RCC_PLLSAI2_SUPPORT */
  5254. /**
  5255. * @brief Clear Clock security system interrupt flag
  5256. * @rmtoll CICR CSSC LL_RCC_ClearFlag_HSECSS
  5257. * @retval None
  5258. */
  5259. __STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void)
  5260. {
  5261. SET_BIT(RCC->CICR, RCC_CICR_CSSC);
  5262. }
  5263. /**
  5264. * @brief Clear LSE Clock security system interrupt flag
  5265. * @rmtoll CICR LSECSSC LL_RCC_ClearFlag_LSECSS
  5266. * @retval None
  5267. */
  5268. __STATIC_INLINE void LL_RCC_ClearFlag_LSECSS(void)
  5269. {
  5270. SET_BIT(RCC->CICR, RCC_CICR_LSECSSC);
  5271. }
  5272. /**
  5273. * @brief Check if LSI ready interrupt occurred or not
  5274. * @rmtoll CIFR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY
  5275. * @retval State of bit (1 or 0).
  5276. */
  5277. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void)
  5278. {
  5279. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSIRDYF) == RCC_CIFR_LSIRDYF) ? 1UL : 0UL);
  5280. }
  5281. /**
  5282. * @brief Check if LSE ready interrupt occurred or not
  5283. * @rmtoll CIFR LSERDYF LL_RCC_IsActiveFlag_LSERDY
  5284. * @retval State of bit (1 or 0).
  5285. */
  5286. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void)
  5287. {
  5288. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSERDYF) == RCC_CIFR_LSERDYF) ? 1UL : 0UL);
  5289. }
  5290. /**
  5291. * @brief Check if MSI ready interrupt occurred or not
  5292. * @rmtoll CIFR MSIRDYF LL_RCC_IsActiveFlag_MSIRDY
  5293. * @retval State of bit (1 or 0).
  5294. */
  5295. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_MSIRDY(void)
  5296. {
  5297. return ((READ_BIT(RCC->CIFR, RCC_CIFR_MSIRDYF) == RCC_CIFR_MSIRDYF) ? 1UL : 0UL);
  5298. }
  5299. /**
  5300. * @brief Check if HSI ready interrupt occurred or not
  5301. * @rmtoll CIFR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY
  5302. * @retval State of bit (1 or 0).
  5303. */
  5304. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void)
  5305. {
  5306. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSIRDYF) == RCC_CIFR_HSIRDYF) ? 1UL : 0UL);
  5307. }
  5308. /**
  5309. * @brief Check if HSE ready interrupt occurred or not
  5310. * @rmtoll CIFR HSERDYF LL_RCC_IsActiveFlag_HSERDY
  5311. * @retval State of bit (1 or 0).
  5312. */
  5313. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void)
  5314. {
  5315. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSERDYF) == RCC_CIFR_HSERDYF) ? 1UL : 0UL);
  5316. }
  5317. /**
  5318. * @brief Check if PLL ready interrupt occurred or not
  5319. * @rmtoll CIFR PLLRDYF LL_RCC_IsActiveFlag_PLLRDY
  5320. * @retval State of bit (1 or 0).
  5321. */
  5322. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLRDY(void)
  5323. {
  5324. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLRDYF) == RCC_CIFR_PLLRDYF) ? 1UL : 0UL);
  5325. }
  5326. #if defined(RCC_HSI48_SUPPORT)
  5327. /**
  5328. * @brief Check if HSI48 ready interrupt occurred or not
  5329. * @rmtoll CIR HSI48RDYF LL_RCC_IsActiveFlag_HSI48RDY
  5330. * @retval State of bit (1 or 0).
  5331. */
  5332. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSI48RDY(void)
  5333. {
  5334. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSI48RDYF) == RCC_CIFR_HSI48RDYF) ? 1UL : 0UL);
  5335. }
  5336. #endif /* RCC_HSI48_SUPPORT */
  5337. #if defined(RCC_PLLSAI1_SUPPORT)
  5338. /**
  5339. * @brief Check if PLLSAI1 ready interrupt occurred or not
  5340. * @rmtoll CIFR PLLSAI1RDYF LL_RCC_IsActiveFlag_PLLSAI1RDY
  5341. * @retval State of bit (1 or 0).
  5342. */
  5343. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLSAI1RDY(void)
  5344. {
  5345. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI1RDYF) == RCC_CIFR_PLLSAI1RDYF) ? 1UL : 0UL);
  5346. }
  5347. #endif /* RCC_PLLSAI1_SUPPORT */
  5348. #if defined(RCC_PLLSAI2_SUPPORT)
  5349. /**
  5350. * @brief Check if PLLSAI1 ready interrupt occurred or not
  5351. * @rmtoll CIFR PLLSAI2RDYF LL_RCC_IsActiveFlag_PLLSAI2RDY
  5352. * @retval State of bit (1 or 0).
  5353. */
  5354. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLSAI2RDY(void)
  5355. {
  5356. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI2RDYF) == RCC_CIFR_PLLSAI2RDYF) ? 1UL : 0UL);
  5357. }
  5358. #endif /* RCC_PLLSAI2_SUPPORT */
  5359. /**
  5360. * @brief Check if Clock security system interrupt occurred or not
  5361. * @rmtoll CIFR CSSF LL_RCC_IsActiveFlag_HSECSS
  5362. * @retval State of bit (1 or 0).
  5363. */
  5364. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void)
  5365. {
  5366. return ((READ_BIT(RCC->CIFR, RCC_CIFR_CSSF) == RCC_CIFR_CSSF) ? 1UL : 0UL);
  5367. }
  5368. /**
  5369. * @brief Check if LSE Clock security system interrupt occurred or not
  5370. * @rmtoll CIFR LSECSSF LL_RCC_IsActiveFlag_LSECSS
  5371. * @retval State of bit (1 or 0).
  5372. */
  5373. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSECSS(void)
  5374. {
  5375. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSECSSF) == RCC_CIFR_LSECSSF) ? 1UL : 0UL);
  5376. }
  5377. /**
  5378. * @brief Check if RCC flag FW reset is set or not.
  5379. * @rmtoll CSR FWRSTF LL_RCC_IsActiveFlag_FWRST
  5380. * @retval State of bit (1 or 0).
  5381. */
  5382. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_FWRST(void)
  5383. {
  5384. return ((READ_BIT(RCC->CSR, RCC_CSR_FWRSTF) == RCC_CSR_FWRSTF) ? 1UL : 0UL);
  5385. }
  5386. /**
  5387. * @brief Check if RCC flag Independent Watchdog reset is set or not.
  5388. * @rmtoll CSR IWDGRSTF LL_RCC_IsActiveFlag_IWDGRST
  5389. * @retval State of bit (1 or 0).
  5390. */
  5391. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDGRST(void)
  5392. {
  5393. return ((READ_BIT(RCC->CSR, RCC_CSR_IWDGRSTF) == RCC_CSR_IWDGRSTF) ? 1UL : 0UL);
  5394. }
  5395. /**
  5396. * @brief Check if RCC flag Low Power reset is set or not.
  5397. * @rmtoll CSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST
  5398. * @retval State of bit (1 or 0).
  5399. */
  5400. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void)
  5401. {
  5402. return ((READ_BIT(RCC->CSR, RCC_CSR_LPWRRSTF) == RCC_CSR_LPWRRSTF) ? 1UL : 0UL);
  5403. }
  5404. /**
  5405. * @brief Check if RCC flag is set or not.
  5406. * @rmtoll CSR OBLRSTF LL_RCC_IsActiveFlag_OBLRST
  5407. * @retval State of bit (1 or 0).
  5408. */
  5409. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_OBLRST(void)
  5410. {
  5411. return ((READ_BIT(RCC->CSR, RCC_CSR_OBLRSTF) == RCC_CSR_OBLRSTF) ? 1UL : 0UL);
  5412. }
  5413. /**
  5414. * @brief Check if RCC flag Pin reset is set or not.
  5415. * @rmtoll CSR PINRSTF LL_RCC_IsActiveFlag_PINRST
  5416. * @retval State of bit (1 or 0).
  5417. */
  5418. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void)
  5419. {
  5420. return ((READ_BIT(RCC->CSR, RCC_CSR_PINRSTF) == RCC_CSR_PINRSTF) ? 1UL : 0UL);
  5421. }
  5422. /**
  5423. * @brief Check if RCC flag Software reset is set or not.
  5424. * @rmtoll CSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST
  5425. * @retval State of bit (1 or 0).
  5426. */
  5427. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void)
  5428. {
  5429. return ((READ_BIT(RCC->CSR, RCC_CSR_SFTRSTF) == RCC_CSR_SFTRSTF) ? 1UL : 0UL);
  5430. }
  5431. /**
  5432. * @brief Check if RCC flag Window Watchdog reset is set or not.
  5433. * @rmtoll CSR WWDGRSTF LL_RCC_IsActiveFlag_WWDGRST
  5434. * @retval State of bit (1 or 0).
  5435. */
  5436. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDGRST(void)
  5437. {
  5438. return ((READ_BIT(RCC->CSR, RCC_CSR_WWDGRSTF) == RCC_CSR_WWDGRSTF) ? 1UL : 0UL);
  5439. }
  5440. /**
  5441. * @brief Check if RCC flag BOR reset is set or not.
  5442. * @rmtoll CSR BORRSTF LL_RCC_IsActiveFlag_BORRST
  5443. * @retval State of bit (1 or 0).
  5444. */
  5445. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_BORRST(void)
  5446. {
  5447. return ((READ_BIT(RCC->CSR, RCC_CSR_BORRSTF) == RCC_CSR_BORRSTF) ? 1UL : 0UL);
  5448. }
  5449. /**
  5450. * @brief Set RMVF bit to clear the reset flags.
  5451. * @rmtoll CSR RMVF LL_RCC_ClearResetFlags
  5452. * @retval None
  5453. */
  5454. __STATIC_INLINE void LL_RCC_ClearResetFlags(void)
  5455. {
  5456. SET_BIT(RCC->CSR, RCC_CSR_RMVF);
  5457. }
  5458. /**
  5459. * @}
  5460. */
  5461. /** @defgroup RCC_LL_EF_IT_Management IT Management
  5462. * @{
  5463. */
  5464. /**
  5465. * @brief Enable LSI ready interrupt
  5466. * @rmtoll CIER LSIRDYIE LL_RCC_EnableIT_LSIRDY
  5467. * @retval None
  5468. */
  5469. __STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void)
  5470. {
  5471. SET_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  5472. }
  5473. /**
  5474. * @brief Enable LSE ready interrupt
  5475. * @rmtoll CIER LSERDYIE LL_RCC_EnableIT_LSERDY
  5476. * @retval None
  5477. */
  5478. __STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void)
  5479. {
  5480. SET_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  5481. }
  5482. /**
  5483. * @brief Enable MSI ready interrupt
  5484. * @rmtoll CIER MSIRDYIE LL_RCC_EnableIT_MSIRDY
  5485. * @retval None
  5486. */
  5487. __STATIC_INLINE void LL_RCC_EnableIT_MSIRDY(void)
  5488. {
  5489. SET_BIT(RCC->CIER, RCC_CIER_MSIRDYIE);
  5490. }
  5491. /**
  5492. * @brief Enable HSI ready interrupt
  5493. * @rmtoll CIER HSIRDYIE LL_RCC_EnableIT_HSIRDY
  5494. * @retval None
  5495. */
  5496. __STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void)
  5497. {
  5498. SET_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  5499. }
  5500. /**
  5501. * @brief Enable HSE ready interrupt
  5502. * @rmtoll CIER HSERDYIE LL_RCC_EnableIT_HSERDY
  5503. * @retval None
  5504. */
  5505. __STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void)
  5506. {
  5507. SET_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  5508. }
  5509. /**
  5510. * @brief Enable PLL ready interrupt
  5511. * @rmtoll CIER PLLRDYIE LL_RCC_EnableIT_PLLRDY
  5512. * @retval None
  5513. */
  5514. __STATIC_INLINE void LL_RCC_EnableIT_PLLRDY(void)
  5515. {
  5516. SET_BIT(RCC->CIER, RCC_CIER_PLLRDYIE);
  5517. }
  5518. #if defined(RCC_HSI48_SUPPORT)
  5519. /**
  5520. * @brief Enable HSI48 ready interrupt
  5521. * @rmtoll CIER HSI48RDYIE LL_RCC_EnableIT_HSI48RDY
  5522. * @retval None
  5523. */
  5524. __STATIC_INLINE void LL_RCC_EnableIT_HSI48RDY(void)
  5525. {
  5526. SET_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  5527. }
  5528. #endif /* RCC_HSI48_SUPPORT */
  5529. #if defined(RCC_PLLSAI1_SUPPORT)
  5530. /**
  5531. * @brief Enable PLLSAI1 ready interrupt
  5532. * @rmtoll CIER PLLSAI1RDYIE LL_RCC_EnableIT_PLLSAI1RDY
  5533. * @retval None
  5534. */
  5535. __STATIC_INLINE void LL_RCC_EnableIT_PLLSAI1RDY(void)
  5536. {
  5537. SET_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE);
  5538. }
  5539. #endif /* RCC_PLLSAI1_SUPPORT */
  5540. #if defined(RCC_PLLSAI2_SUPPORT)
  5541. /**
  5542. * @brief Enable PLLSAI2 ready interrupt
  5543. * @rmtoll CIER PLLSAI2RDYIE LL_RCC_EnableIT_PLLSAI2RDY
  5544. * @retval None
  5545. */
  5546. __STATIC_INLINE void LL_RCC_EnableIT_PLLSAI2RDY(void)
  5547. {
  5548. SET_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE);
  5549. }
  5550. #endif /* RCC_PLLSAI2_SUPPORT */
  5551. /**
  5552. * @brief Enable LSE clock security system interrupt
  5553. * @rmtoll CIER LSECSSIE LL_RCC_EnableIT_LSECSS
  5554. * @retval None
  5555. */
  5556. __STATIC_INLINE void LL_RCC_EnableIT_LSECSS(void)
  5557. {
  5558. SET_BIT(RCC->CIER, RCC_CIER_LSECSSIE);
  5559. }
  5560. /**
  5561. * @brief Disable LSI ready interrupt
  5562. * @rmtoll CIER LSIRDYIE LL_RCC_DisableIT_LSIRDY
  5563. * @retval None
  5564. */
  5565. __STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void)
  5566. {
  5567. CLEAR_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  5568. }
  5569. /**
  5570. * @brief Disable LSE ready interrupt
  5571. * @rmtoll CIER LSERDYIE LL_RCC_DisableIT_LSERDY
  5572. * @retval None
  5573. */
  5574. __STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void)
  5575. {
  5576. CLEAR_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  5577. }
  5578. /**
  5579. * @brief Disable MSI ready interrupt
  5580. * @rmtoll CIER MSIRDYIE LL_RCC_DisableIT_MSIRDY
  5581. * @retval None
  5582. */
  5583. __STATIC_INLINE void LL_RCC_DisableIT_MSIRDY(void)
  5584. {
  5585. CLEAR_BIT(RCC->CIER, RCC_CIER_MSIRDYIE);
  5586. }
  5587. /**
  5588. * @brief Disable HSI ready interrupt
  5589. * @rmtoll CIER HSIRDYIE LL_RCC_DisableIT_HSIRDY
  5590. * @retval None
  5591. */
  5592. __STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void)
  5593. {
  5594. CLEAR_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  5595. }
  5596. /**
  5597. * @brief Disable HSE ready interrupt
  5598. * @rmtoll CIER HSERDYIE LL_RCC_DisableIT_HSERDY
  5599. * @retval None
  5600. */
  5601. __STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void)
  5602. {
  5603. CLEAR_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  5604. }
  5605. /**
  5606. * @brief Disable PLL ready interrupt
  5607. * @rmtoll CIER PLLRDYIE LL_RCC_DisableIT_PLLRDY
  5608. * @retval None
  5609. */
  5610. __STATIC_INLINE void LL_RCC_DisableIT_PLLRDY(void)
  5611. {
  5612. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLRDYIE);
  5613. }
  5614. #if defined(RCC_HSI48_SUPPORT)
  5615. /**
  5616. * @brief Disable HSI48 ready interrupt
  5617. * @rmtoll CIER HSI48RDYIE LL_RCC_DisableIT_HSI48RDY
  5618. * @retval None
  5619. */
  5620. __STATIC_INLINE void LL_RCC_DisableIT_HSI48RDY(void)
  5621. {
  5622. CLEAR_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  5623. }
  5624. #endif /* RCC_HSI48_SUPPORT */
  5625. #if defined(RCC_PLLSAI1_SUPPORT)
  5626. /**
  5627. * @brief Disable PLLSAI1 ready interrupt
  5628. * @rmtoll CIER PLLSAI1RDYIE LL_RCC_DisableIT_PLLSAI1RDY
  5629. * @retval None
  5630. */
  5631. __STATIC_INLINE void LL_RCC_DisableIT_PLLSAI1RDY(void)
  5632. {
  5633. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE);
  5634. }
  5635. #endif /* RCC_PLLSAI1_SUPPORT */
  5636. #if defined(RCC_PLLSAI2_SUPPORT)
  5637. /**
  5638. * @brief Disable PLLSAI2 ready interrupt
  5639. * @rmtoll CIER PLLSAI2RDYIE LL_RCC_DisableIT_PLLSAI2RDY
  5640. * @retval None
  5641. */
  5642. __STATIC_INLINE void LL_RCC_DisableIT_PLLSAI2RDY(void)
  5643. {
  5644. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE);
  5645. }
  5646. #endif /* RCC_PLLSAI2_SUPPORT */
  5647. /**
  5648. * @brief Disable LSE clock security system interrupt
  5649. * @rmtoll CIER LSECSSIE LL_RCC_DisableIT_LSECSS
  5650. * @retval None
  5651. */
  5652. __STATIC_INLINE void LL_RCC_DisableIT_LSECSS(void)
  5653. {
  5654. CLEAR_BIT(RCC->CIER, RCC_CIER_LSECSSIE);
  5655. }
  5656. /**
  5657. * @brief Checks if LSI ready interrupt source is enabled or disabled.
  5658. * @rmtoll CIER LSIRDYIE LL_RCC_IsEnabledIT_LSIRDY
  5659. * @retval State of bit (1 or 0).
  5660. */
  5661. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSIRDY(void)
  5662. {
  5663. return ((READ_BIT(RCC->CIER, RCC_CIER_LSIRDYIE) == RCC_CIER_LSIRDYIE) ? 1UL : 0UL);
  5664. }
  5665. /**
  5666. * @brief Checks if LSE ready interrupt source is enabled or disabled.
  5667. * @rmtoll CIER LSERDYIE LL_RCC_IsEnabledIT_LSERDY
  5668. * @retval State of bit (1 or 0).
  5669. */
  5670. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSERDY(void)
  5671. {
  5672. return ((READ_BIT(RCC->CIER, RCC_CIER_LSERDYIE) == RCC_CIER_LSERDYIE) ? 1UL : 0UL);
  5673. }
  5674. /**
  5675. * @brief Checks if MSI ready interrupt source is enabled or disabled.
  5676. * @rmtoll CIER MSIRDYIE LL_RCC_IsEnabledIT_MSIRDY
  5677. * @retval State of bit (1 or 0).
  5678. */
  5679. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_MSIRDY(void)
  5680. {
  5681. return ((READ_BIT(RCC->CIER, RCC_CIER_MSIRDYIE) == RCC_CIER_MSIRDYIE) ? 1UL : 0UL);
  5682. }
  5683. /**
  5684. * @brief Checks if HSI ready interrupt source is enabled or disabled.
  5685. * @rmtoll CIER HSIRDYIE LL_RCC_IsEnabledIT_HSIRDY
  5686. * @retval State of bit (1 or 0).
  5687. */
  5688. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSIRDY(void)
  5689. {
  5690. return ((READ_BIT(RCC->CIER, RCC_CIER_HSIRDYIE) == RCC_CIER_HSIRDYIE) ? 1UL : 0UL);
  5691. }
  5692. /**
  5693. * @brief Checks if HSE ready interrupt source is enabled or disabled.
  5694. * @rmtoll CIER HSERDYIE LL_RCC_IsEnabledIT_HSERDY
  5695. * @retval State of bit (1 or 0).
  5696. */
  5697. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSERDY(void)
  5698. {
  5699. return ((READ_BIT(RCC->CIER, RCC_CIER_HSERDYIE) == RCC_CIER_HSERDYIE) ? 1UL : 0UL);
  5700. }
  5701. /**
  5702. * @brief Checks if PLL ready interrupt source is enabled or disabled.
  5703. * @rmtoll CIER PLLRDYIE LL_RCC_IsEnabledIT_PLLRDY
  5704. * @retval State of bit (1 or 0).
  5705. */
  5706. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLRDY(void)
  5707. {
  5708. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLRDYIE) == RCC_CIER_PLLRDYIE) ? 1UL : 0UL);
  5709. }
  5710. #if defined(RCC_HSI48_SUPPORT)
  5711. /**
  5712. * @brief Checks if HSI48 ready interrupt source is enabled or disabled.
  5713. * @rmtoll CIER HSI48RDYIE LL_RCC_IsEnabledIT_HSI48RDY
  5714. * @retval State of bit (1 or 0).
  5715. */
  5716. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSI48RDY(void)
  5717. {
  5718. return ((READ_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE) == RCC_CIER_HSI48RDYIE) ? 1UL : 0UL);
  5719. }
  5720. #endif /* RCC_HSI48_SUPPORT */
  5721. #if defined(RCC_PLLSAI1_SUPPORT)
  5722. /**
  5723. * @brief Checks if PLLSAI1 ready interrupt source is enabled or disabled.
  5724. * @rmtoll CIER PLLSAI1RDYIE LL_RCC_IsEnabledIT_PLLSAI1RDY
  5725. * @retval State of bit (1 or 0).
  5726. */
  5727. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLSAI1RDY(void)
  5728. {
  5729. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE) == RCC_CIER_PLLSAI1RDYIE) ? 1UL : 0UL);
  5730. }
  5731. #endif /* RCC_PLLSAI1_SUPPORT */
  5732. #if defined(RCC_PLLSAI2_SUPPORT)
  5733. /**
  5734. * @brief Checks if PLLSAI2 ready interrupt source is enabled or disabled.
  5735. * @rmtoll CIER PLLSAI2RDYIE LL_RCC_IsEnabledIT_PLLSAI2RDY
  5736. * @retval State of bit (1 or 0).
  5737. */
  5738. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLSAI2RDY(void)
  5739. {
  5740. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE) == RCC_CIER_PLLSAI2RDYIE) ? 1UL : 0UL);
  5741. }
  5742. #endif /* RCC_PLLSAI2_SUPPORT */
  5743. /**
  5744. * @brief Checks if LSECSS interrupt source is enabled or disabled.
  5745. * @rmtoll CIER LSECSSIE LL_RCC_IsEnabledIT_LSECSS
  5746. * @retval State of bit (1 or 0).
  5747. */
  5748. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSECSS(void)
  5749. {
  5750. return ((READ_BIT(RCC->CIER, RCC_CIER_LSECSSIE) == RCC_CIER_LSECSSIE) ? 1UL : 0UL);
  5751. }
  5752. /**
  5753. * @}
  5754. */
  5755. #if defined(USE_FULL_LL_DRIVER)
  5756. /** @defgroup RCC_LL_EF_Init De-initialization function
  5757. * @{
  5758. */
  5759. ErrorStatus LL_RCC_DeInit(void);
  5760. /**
  5761. * @}
  5762. */
  5763. /** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions
  5764. * @{
  5765. */
  5766. void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks);
  5767. uint32_t LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource);
  5768. #if defined(UART4) || defined(UART5)
  5769. uint32_t LL_RCC_GetUARTClockFreq(uint32_t UARTxSource);
  5770. #endif /* UART4 || UART5 */
  5771. uint32_t LL_RCC_GetI2CClockFreq(uint32_t I2CxSource);
  5772. uint32_t LL_RCC_GetLPUARTClockFreq(uint32_t LPUARTxSource);
  5773. uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource);
  5774. #if defined(SAI1)
  5775. uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource);
  5776. #endif /* SAI1 */
  5777. #if defined(SDMMC1)
  5778. #if defined(RCC_CCIPR2_SDMMCSEL)
  5779. uint32_t LL_RCC_GetSDMMCKernelClockFreq(uint32_t SDMMCxSource);
  5780. #endif
  5781. uint32_t LL_RCC_GetSDMMCClockFreq(uint32_t SDMMCxSource);
  5782. #endif /* SDMMC1 */
  5783. uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource);
  5784. #if defined(USB_OTG_FS) || defined(USB)
  5785. uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource);
  5786. #endif /* USB_OTG_FS || USB */
  5787. uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource);
  5788. #if defined(SWPMI1)
  5789. uint32_t LL_RCC_GetSWPMIClockFreq(uint32_t SWPMIxSource);
  5790. #endif /* SWPMI1 */
  5791. #if defined(DFSDM1_Channel0)
  5792. uint32_t LL_RCC_GetDFSDMClockFreq(uint32_t DFSDMxSource);
  5793. #if defined(RCC_CCIPR2_DFSDM1SEL)
  5794. uint32_t LL_RCC_GetDFSDMAudioClockFreq(uint32_t DFSDMxSource);
  5795. #endif /* RCC_CCIPR2_DFSDM1SEL */
  5796. #endif /* DFSDM1_Channel0 */
  5797. #if defined(LTDC)
  5798. uint32_t LL_RCC_GetLTDCClockFreq(uint32_t LTDCxSource);
  5799. #endif /* LTDC */
  5800. #if defined(DSI)
  5801. uint32_t LL_RCC_GetDSIClockFreq(uint32_t DSIxSource);
  5802. #endif /* DSI */
  5803. #if defined(OCTOSPI1)
  5804. uint32_t LL_RCC_GetOCTOSPIClockFreq(uint32_t OCTOSPIxSource);
  5805. #endif /* OCTOSPI1 */
  5806. /**
  5807. * @}
  5808. */
  5809. #endif /* USE_FULL_LL_DRIVER */
  5810. /**
  5811. * @}
  5812. */
  5813. /**
  5814. * @}
  5815. */
  5816. #endif /* defined(RCC) */
  5817. /**
  5818. * @}
  5819. */
  5820. #ifdef __cplusplus
  5821. }
  5822. #endif
  5823. #endif /* STM32L4xx_LL_RCC_H */