stm32l4xx_ll_rcc.h 252 KB

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