stm32l4xx_ll_rcc.h 249 KB

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