stm32h7xx_ll_rcc.h 241 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404
  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_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 STM32H7xx_LL_RCC_H
  19. #define STM32H7xx_LL_RCC_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32h7xx.h"
  25. #include <math.h>
  26. /** @addtogroup STM32H7xx_LL_Driver
  27. * @{
  28. */
  29. #if defined(RCC)
  30. /** @defgroup RCC_LL RCC
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /** @defgroup RCC_LL_Private_Variables RCC Private Variables
  36. * @{
  37. */
  38. extern const uint8_t LL_RCC_PrescTable[16];
  39. /**
  40. * @}
  41. */
  42. /* Private constants ---------------------------------------------------------*/
  43. /* Private macros ------------------------------------------------------------*/
  44. /** @defgroup RCC_LL_Private_Macros RCC Private Macros
  45. * @{
  46. */
  47. #if !defined(UNUSED)
  48. #define UNUSED(x) ((void)(x))
  49. #endif
  50. /* 32 24 16 8 0
  51. --------------------------------------------------------
  52. | Mask | ClkSource | Bit | Register |
  53. | | Config | Position | Offset |
  54. --------------------------------------------------------*/
  55. #if defined(RCC_VER_2_0)
  56. /* Clock source register offset Vs CDCCIPR register */
  57. #define CDCCIP 0x0UL
  58. #define CDCCIP1 0x4UL
  59. #define CDCCIP2 0x8UL
  60. #define SRDCCIP 0xCUL
  61. #else
  62. /* Clock source register offset Vs D1CCIPR register */
  63. #define D1CCIP 0x0UL
  64. #define D2CCIP1 0x4UL
  65. #define D2CCIP2 0x8UL
  66. #define D3CCIP 0xCUL
  67. #endif /* RCC_VER_2_0 */
  68. #define LL_RCC_REG_SHIFT 0U
  69. #define LL_RCC_POS_SHIFT 8U
  70. #define LL_RCC_CONFIG_SHIFT 16U
  71. #define LL_RCC_MASK_SHIFT 24U
  72. #define LL_CLKSOURCE_SHIFT(__CLKSOURCE__) (((__CLKSOURCE__) >> LL_RCC_POS_SHIFT ) & 0x1FUL)
  73. #define LL_CLKSOURCE_MASK(__CLKSOURCE__) ((((__CLKSOURCE__) >> LL_RCC_MASK_SHIFT ) & 0xFFUL) << LL_CLKSOURCE_SHIFT(__CLKSOURCE__))
  74. #define LL_CLKSOURCE_CONFIG(__CLKSOURCE__) ((((__CLKSOURCE__) >> LL_RCC_CONFIG_SHIFT) & 0xFFUL) << LL_CLKSOURCE_SHIFT(__CLKSOURCE__))
  75. #define LL_CLKSOURCE_REG(__CLKSOURCE__) (((__CLKSOURCE__) >> LL_RCC_REG_SHIFT ) & 0xFFUL)
  76. #define LL_CLKSOURCE(__REG__, __MSK__, __POS__, __CLK__) ((uint32_t)((((__MSK__) >> (__POS__)) << LL_RCC_MASK_SHIFT) | \
  77. (( __POS__ ) << LL_RCC_POS_SHIFT) | \
  78. (( __REG__ ) << LL_RCC_REG_SHIFT) | \
  79. (((__CLK__) >> (__POS__)) << LL_RCC_CONFIG_SHIFT)))
  80. /**
  81. * @}
  82. */
  83. /* Exported types ------------------------------------------------------------*/
  84. #if defined(USE_FULL_LL_DRIVER)
  85. /** @defgroup RCC_LL_Exported_Types RCC Exported Types
  86. * @{
  87. */
  88. /** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure
  89. * @{
  90. */
  91. /**
  92. * @brief RCC Clocks Frequency Structure
  93. */
  94. typedef struct
  95. {
  96. uint32_t SYSCLK_Frequency;
  97. uint32_t CPUCLK_Frequency;
  98. uint32_t HCLK_Frequency;
  99. uint32_t PCLK1_Frequency;
  100. uint32_t PCLK2_Frequency;
  101. uint32_t PCLK3_Frequency;
  102. uint32_t PCLK4_Frequency;
  103. } LL_RCC_ClocksTypeDef;
  104. /**
  105. * @}
  106. */
  107. /**
  108. * @brief PLL Clocks Frequency Structure
  109. */
  110. typedef struct
  111. {
  112. uint32_t PLL_P_Frequency;
  113. uint32_t PLL_Q_Frequency;
  114. uint32_t PLL_R_Frequency;
  115. } LL_PLL_ClocksTypeDef;
  116. /**
  117. * @}
  118. */
  119. #endif /* USE_FULL_LL_DRIVER */
  120. /* Exported constants --------------------------------------------------------*/
  121. /** @defgroup RCC_LL_Exported_Constants RCC Exported Constants
  122. * @{
  123. */
  124. /** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation
  125. * @brief Defines used to adapt values of different oscillators
  126. * @note These values could be modified in the user environment according to
  127. * HW set-up.
  128. * @{
  129. */
  130. #if !defined (HSE_VALUE)
  131. #if defined(RCC_VER_X) || defined(RCC_VER_3_0)
  132. #define HSE_VALUE 25000000U /*!< Value of the HSE oscillator in Hz */
  133. #else
  134. #define HSE_VALUE 24000000U /*!< Value of the HSE oscillator in Hz */
  135. #endif /* RCC_VER_X || RCC_VER_3_0 */
  136. #endif /* HSE_VALUE */
  137. #if !defined (HSI_VALUE)
  138. #define HSI_VALUE 64000000U /*!< Value of the HSI oscillator in Hz */
  139. #endif /* HSI_VALUE */
  140. #if !defined (CSI_VALUE)
  141. #define CSI_VALUE 4000000U /*!< Value of the CSI oscillator in Hz */
  142. #endif /* CSI_VALUE */
  143. #if !defined (LSE_VALUE)
  144. #define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */
  145. #endif /* LSE_VALUE */
  146. #if !defined (LSI_VALUE)
  147. #define LSI_VALUE 32000U /*!< Value of the LSI oscillator in Hz */
  148. #endif /* LSI_VALUE */
  149. #if !defined (EXTERNAL_CLOCK_VALUE)
  150. #define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the I2S_CKIN external oscillator in Hz */
  151. #endif /* EXTERNAL_CLOCK_VALUE */
  152. #if !defined (HSI48_VALUE)
  153. #define HSI48_VALUE 48000000U /*!< Value of the HSI48 oscillator in Hz */
  154. #endif /* HSI48_VALUE */
  155. /**
  156. * @}
  157. */
  158. /** @defgroup RCC_LL_EC_HSIDIV HSI oscillator divider
  159. * @{
  160. */
  161. #define LL_RCC_HSI_DIV1 RCC_CR_HSIDIV_1
  162. #define LL_RCC_HSI_DIV2 RCC_CR_HSIDIV_2
  163. #define LL_RCC_HSI_DIV4 RCC_CR_HSIDIV_4
  164. #define LL_RCC_HSI_DIV8 RCC_CR_HSIDIV_8
  165. /**
  166. * @}
  167. */
  168. /** @defgroup RCC_LL_EC_LSEDRIVE LSE oscillator drive capability
  169. * @{
  170. */
  171. #define LL_RCC_LSEDRIVE_LOW (uint32_t)(0x00000000U)
  172. #define LL_RCC_LSEDRIVE_MEDIUMLOW (uint32_t)(RCC_BDCR_LSEDRV_0)
  173. #define LL_RCC_LSEDRIVE_MEDIUMHIGH (uint32_t)(RCC_BDCR_LSEDRV_1)
  174. #define LL_RCC_LSEDRIVE_HIGH (uint32_t)(RCC_BDCR_LSEDRV)
  175. /**
  176. * @}
  177. */
  178. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch
  179. * @{
  180. */
  181. #define LL_RCC_SYS_CLKSOURCE_HSI RCC_CFGR_SW_HSI
  182. #define LL_RCC_SYS_CLKSOURCE_CSI RCC_CFGR_SW_CSI
  183. #define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_HSE
  184. #define LL_RCC_SYS_CLKSOURCE_PLL1 RCC_CFGR_SW_PLL1
  185. /**
  186. * @}
  187. */
  188. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status
  189. * @{
  190. */
  191. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
  192. #define LL_RCC_SYS_CLKSOURCE_STATUS_CSI RCC_CFGR_SWS_CSI /*!< CSI used as system clock */
  193. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
  194. #define LL_RCC_SYS_CLKSOURCE_STATUS_PLL1 RCC_CFGR_SWS_PLL1 /*!< PLL1 used as system clock */
  195. /**
  196. * @}
  197. */
  198. /** @defgroup RCC_LL_EC_SYSWAKEUP_CLKSOURCE System wakeup clock source
  199. * @{
  200. */
  201. #define LL_RCC_SYSWAKEUP_CLKSOURCE_HSI (uint32_t)(0x00000000U)
  202. #define LL_RCC_SYSWAKEUP_CLKSOURCE_CSI (uint32_t)(RCC_CFGR_STOPWUCK)
  203. /**
  204. * @}
  205. */
  206. /** @defgroup RCC_LL_EC_KERWAKEUP_CLKSOURCE Kernel wakeup clock source
  207. * @{
  208. */
  209. #define LL_RCC_KERWAKEUP_CLKSOURCE_HSI (uint32_t)(0x00000000U)
  210. #define LL_RCC_KERWAKEUP_CLKSOURCE_CSI (uint32_t)(RCC_CFGR_STOPKERWUCK)
  211. /**
  212. * @}
  213. */
  214. /** @defgroup RCC_LL_EC_SYSCLK_DIV System prescaler
  215. * @{
  216. */
  217. #if defined(RCC_D1CFGR_D1CPRE_DIV1)
  218. #define LL_RCC_SYSCLK_DIV_1 RCC_D1CFGR_D1CPRE_DIV1
  219. #define LL_RCC_SYSCLK_DIV_2 RCC_D1CFGR_D1CPRE_DIV2
  220. #define LL_RCC_SYSCLK_DIV_4 RCC_D1CFGR_D1CPRE_DIV4
  221. #define LL_RCC_SYSCLK_DIV_8 RCC_D1CFGR_D1CPRE_DIV8
  222. #define LL_RCC_SYSCLK_DIV_16 RCC_D1CFGR_D1CPRE_DIV16
  223. #define LL_RCC_SYSCLK_DIV_64 RCC_D1CFGR_D1CPRE_DIV64
  224. #define LL_RCC_SYSCLK_DIV_128 RCC_D1CFGR_D1CPRE_DIV128
  225. #define LL_RCC_SYSCLK_DIV_256 RCC_D1CFGR_D1CPRE_DIV256
  226. #define LL_RCC_SYSCLK_DIV_512 RCC_D1CFGR_D1CPRE_DIV512
  227. #else
  228. #define LL_RCC_SYSCLK_DIV_1 RCC_CDCFGR1_CDCPRE_DIV1
  229. #define LL_RCC_SYSCLK_DIV_2 RCC_CDCFGR1_CDCPRE_DIV2
  230. #define LL_RCC_SYSCLK_DIV_4 RCC_CDCFGR1_CDCPRE_DIV4
  231. #define LL_RCC_SYSCLK_DIV_8 RCC_CDCFGR1_CDCPRE_DIV8
  232. #define LL_RCC_SYSCLK_DIV_16 RCC_CDCFGR1_CDCPRE_DIV16
  233. #define LL_RCC_SYSCLK_DIV_64 RCC_CDCFGR1_CDCPRE_DIV64
  234. #define LL_RCC_SYSCLK_DIV_128 RCC_CDCFGR1_CDCPRE_DIV128
  235. #define LL_RCC_SYSCLK_DIV_256 RCC_CDCFGR1_CDCPRE_DIV256
  236. #define LL_RCC_SYSCLK_DIV_512 RCC_CDCFGR1_CDCPRE_DIV512
  237. #endif /* RCC_D1CFGR_D1CPRE_DIV1 */
  238. /**
  239. * @}
  240. */
  241. /** @defgroup RCC_LL_EC_AHB_DIV AHB prescaler
  242. * @{
  243. */
  244. #if defined(RCC_D1CFGR_HPRE_DIV1)
  245. #define LL_RCC_AHB_DIV_1 RCC_D1CFGR_HPRE_DIV1
  246. #define LL_RCC_AHB_DIV_2 RCC_D1CFGR_HPRE_DIV2
  247. #define LL_RCC_AHB_DIV_4 RCC_D1CFGR_HPRE_DIV4
  248. #define LL_RCC_AHB_DIV_8 RCC_D1CFGR_HPRE_DIV8
  249. #define LL_RCC_AHB_DIV_16 RCC_D1CFGR_HPRE_DIV16
  250. #define LL_RCC_AHB_DIV_64 RCC_D1CFGR_HPRE_DIV64
  251. #define LL_RCC_AHB_DIV_128 RCC_D1CFGR_HPRE_DIV128
  252. #define LL_RCC_AHB_DIV_256 RCC_D1CFGR_HPRE_DIV256
  253. #define LL_RCC_AHB_DIV_512 RCC_D1CFGR_HPRE_DIV512
  254. #else
  255. #define LL_RCC_AHB_DIV_1 RCC_CDCFGR1_HPRE_DIV1
  256. #define LL_RCC_AHB_DIV_2 RCC_CDCFGR1_HPRE_DIV2
  257. #define LL_RCC_AHB_DIV_4 RCC_CDCFGR1_HPRE_DIV4
  258. #define LL_RCC_AHB_DIV_8 RCC_CDCFGR1_HPRE_DIV8
  259. #define LL_RCC_AHB_DIV_16 RCC_CDCFGR1_HPRE_DIV16
  260. #define LL_RCC_AHB_DIV_64 RCC_CDCFGR1_HPRE_DIV64
  261. #define LL_RCC_AHB_DIV_128 RCC_CDCFGR1_HPRE_DIV128
  262. #define LL_RCC_AHB_DIV_256 RCC_CDCFGR1_HPRE_DIV256
  263. #define LL_RCC_AHB_DIV_512 RCC_CDCFGR1_HPRE_DIV512
  264. #endif /* RCC_D1CFGR_HPRE_DIV1 */
  265. /**
  266. * @}
  267. */
  268. /** @defgroup RCC_LL_EC_APB1_DIV APB low-speed prescaler (APB1)
  269. * @{
  270. */
  271. #if defined(RCC_D2CFGR_D2PPRE1_DIV1)
  272. #define LL_RCC_APB1_DIV_1 RCC_D2CFGR_D2PPRE1_DIV1
  273. #define LL_RCC_APB1_DIV_2 RCC_D2CFGR_D2PPRE1_DIV2
  274. #define LL_RCC_APB1_DIV_4 RCC_D2CFGR_D2PPRE1_DIV4
  275. #define LL_RCC_APB1_DIV_8 RCC_D2CFGR_D2PPRE1_DIV8
  276. #define LL_RCC_APB1_DIV_16 RCC_D2CFGR_D2PPRE1_DIV16
  277. #else
  278. #define LL_RCC_APB1_DIV_1 RCC_CDCFGR2_CDPPRE1_DIV1
  279. #define LL_RCC_APB1_DIV_2 RCC_CDCFGR2_CDPPRE1_DIV2
  280. #define LL_RCC_APB1_DIV_4 RCC_CDCFGR2_CDPPRE1_DIV4
  281. #define LL_RCC_APB1_DIV_8 RCC_CDCFGR2_CDPPRE1_DIV8
  282. #define LL_RCC_APB1_DIV_16 RCC_CDCFGR2_CDPPRE1_DIV16
  283. #endif /* RCC_D2CFGR_D2PPRE1_DIV1 */
  284. /**
  285. * @}
  286. */
  287. /** @defgroup RCC_LL_EC_APB2_DIV APB low-speed prescaler (APB2)
  288. * @{
  289. */
  290. #if defined(RCC_D2CFGR_D2PPRE2_DIV1)
  291. #define LL_RCC_APB2_DIV_1 RCC_D2CFGR_D2PPRE2_DIV1
  292. #define LL_RCC_APB2_DIV_2 RCC_D2CFGR_D2PPRE2_DIV2
  293. #define LL_RCC_APB2_DIV_4 RCC_D2CFGR_D2PPRE2_DIV4
  294. #define LL_RCC_APB2_DIV_8 RCC_D2CFGR_D2PPRE2_DIV8
  295. #define LL_RCC_APB2_DIV_16 RCC_D2CFGR_D2PPRE2_DIV16
  296. #else
  297. #define LL_RCC_APB2_DIV_1 RCC_CDCFGR2_CDPPRE2_DIV1
  298. #define LL_RCC_APB2_DIV_2 RCC_CDCFGR2_CDPPRE2_DIV2
  299. #define LL_RCC_APB2_DIV_4 RCC_CDCFGR2_CDPPRE2_DIV4
  300. #define LL_RCC_APB2_DIV_8 RCC_CDCFGR2_CDPPRE2_DIV8
  301. #define LL_RCC_APB2_DIV_16 RCC_CDCFGR2_CDPPRE2_DIV16
  302. #endif /* RCC_D2CFGR_D2PPRE2_DIV1 */
  303. /**
  304. * @}
  305. */
  306. /** @defgroup RCC_LL_EC_APB3_DIV APB low-speed prescaler (APB3)
  307. * @{
  308. */
  309. #if defined(RCC_D1CFGR_D1PPRE_DIV1)
  310. #define LL_RCC_APB3_DIV_1 RCC_D1CFGR_D1PPRE_DIV1
  311. #define LL_RCC_APB3_DIV_2 RCC_D1CFGR_D1PPRE_DIV2
  312. #define LL_RCC_APB3_DIV_4 RCC_D1CFGR_D1PPRE_DIV4
  313. #define LL_RCC_APB3_DIV_8 RCC_D1CFGR_D1PPRE_DIV8
  314. #define LL_RCC_APB3_DIV_16 RCC_D1CFGR_D1PPRE_DIV16
  315. #else
  316. #define LL_RCC_APB3_DIV_1 RCC_CDCFGR1_CDPPRE_DIV1
  317. #define LL_RCC_APB3_DIV_2 RCC_CDCFGR1_CDPPRE_DIV2
  318. #define LL_RCC_APB3_DIV_4 RCC_CDCFGR1_CDPPRE_DIV4
  319. #define LL_RCC_APB3_DIV_8 RCC_CDCFGR1_CDPPRE_DIV8
  320. #define LL_RCC_APB3_DIV_16 RCC_CDCFGR1_CDPPRE_DIV16
  321. #endif /* RCC_D1CFGR_D1PPRE_DIV1 */
  322. /**
  323. * @}
  324. */
  325. /** @defgroup RCC_LL_EC_APB4_DIV APB low-speed prescaler (APB4)
  326. * @{
  327. */
  328. #if defined(RCC_D3CFGR_D3PPRE_DIV1)
  329. #define LL_RCC_APB4_DIV_1 RCC_D3CFGR_D3PPRE_DIV1
  330. #define LL_RCC_APB4_DIV_2 RCC_D3CFGR_D3PPRE_DIV2
  331. #define LL_RCC_APB4_DIV_4 RCC_D3CFGR_D3PPRE_DIV4
  332. #define LL_RCC_APB4_DIV_8 RCC_D3CFGR_D3PPRE_DIV8
  333. #define LL_RCC_APB4_DIV_16 RCC_D3CFGR_D3PPRE_DIV16
  334. #else
  335. #define LL_RCC_APB4_DIV_1 RCC_SRDCFGR_SRDPPRE_DIV1
  336. #define LL_RCC_APB4_DIV_2 RCC_SRDCFGR_SRDPPRE_DIV2
  337. #define LL_RCC_APB4_DIV_4 RCC_SRDCFGR_SRDPPRE_DIV4
  338. #define LL_RCC_APB4_DIV_8 RCC_SRDCFGR_SRDPPRE_DIV8
  339. #define LL_RCC_APB4_DIV_16 RCC_SRDCFGR_SRDPPRE_DIV16
  340. #endif /* RCC_D3CFGR_D3PPRE_DIV1 */
  341. /**
  342. * @}
  343. */
  344. /** @defgroup RCC_LL_EC_MCOxSOURCE MCO source selection
  345. * @{
  346. */
  347. #define LL_RCC_MCO1SOURCE_HSI (uint32_t)((RCC_CFGR_MCO1>>16U) | 0x00000000U)
  348. #define LL_RCC_MCO1SOURCE_LSE (uint32_t)((RCC_CFGR_MCO1>>16U) | RCC_CFGR_MCO1_0)
  349. #define LL_RCC_MCO1SOURCE_HSE (uint32_t)((RCC_CFGR_MCO1>>16U) | RCC_CFGR_MCO1_1)
  350. #define LL_RCC_MCO1SOURCE_PLL1QCLK (uint32_t)((RCC_CFGR_MCO1>>16U) | RCC_CFGR_MCO1_1|RCC_CFGR_MCO1_0)
  351. #define LL_RCC_MCO1SOURCE_HSI48 (uint32_t)((RCC_CFGR_MCO1>>16U) | RCC_CFGR_MCO1_2)
  352. #define LL_RCC_MCO2SOURCE_SYSCLK (uint32_t)((RCC_CFGR_MCO2>>16U) | 0x00000000U)
  353. #define LL_RCC_MCO2SOURCE_PLL2PCLK (uint32_t)((RCC_CFGR_MCO2>>16U) | RCC_CFGR_MCO2_0)
  354. #define LL_RCC_MCO2SOURCE_HSE (uint32_t)((RCC_CFGR_MCO2>>16U) | RCC_CFGR_MCO2_1)
  355. #define LL_RCC_MCO2SOURCE_PLL1PCLK (uint32_t)((RCC_CFGR_MCO2>>16U) | RCC_CFGR_MCO2_1|RCC_CFGR_MCO2_0)
  356. #define LL_RCC_MCO2SOURCE_CSI (uint32_t)((RCC_CFGR_MCO2>>16U) | RCC_CFGR_MCO2_2)
  357. #define LL_RCC_MCO2SOURCE_LSI (uint32_t)((RCC_CFGR_MCO2>>16U) | RCC_CFGR_MCO2_2|RCC_CFGR_MCO2_0)
  358. /**
  359. * @}
  360. */
  361. /** @defgroup RCC_LL_EC_MCOx_DIV MCO prescaler
  362. * @{
  363. */
  364. #define LL_RCC_MCO1_DIV_1 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0)
  365. #define LL_RCC_MCO1_DIV_2 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_1)
  366. #define LL_RCC_MCO1_DIV_3 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_1)
  367. #define LL_RCC_MCO1_DIV_4 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_2)
  368. #define LL_RCC_MCO1_DIV_5 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_2)
  369. #define LL_RCC_MCO1_DIV_6 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2)
  370. #define LL_RCC_MCO1_DIV_7 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2)
  371. #define LL_RCC_MCO1_DIV_8 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_3)
  372. #define LL_RCC_MCO1_DIV_9 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_3)
  373. #define LL_RCC_MCO1_DIV_10 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_3)
  374. #define LL_RCC_MCO1_DIV_11 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_3)
  375. #define LL_RCC_MCO1_DIV_12 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_2 | RCC_CFGR_MCO1PRE_3)
  376. #define LL_RCC_MCO1_DIV_13 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_2 | RCC_CFGR_MCO1PRE_3)
  377. #define LL_RCC_MCO1_DIV_14 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2 | RCC_CFGR_MCO1PRE_3)
  378. #define LL_RCC_MCO1_DIV_15 (uint32_t)((RCC_CFGR_MCO1PRE>>16U) | RCC_CFGR_MCO1PRE)
  379. #define LL_RCC_MCO2_DIV_1 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0)
  380. #define LL_RCC_MCO2_DIV_2 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_1)
  381. #define LL_RCC_MCO2_DIV_3 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0 | RCC_CFGR_MCO2PRE_1)
  382. #define LL_RCC_MCO2_DIV_4 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_2)
  383. #define LL_RCC_MCO2_DIV_5 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0 | RCC_CFGR_MCO2PRE_2)
  384. #define LL_RCC_MCO2_DIV_6 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_2)
  385. #define LL_RCC_MCO2_DIV_7 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0 | RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_2)
  386. #define LL_RCC_MCO2_DIV_8 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_3)
  387. #define LL_RCC_MCO2_DIV_9 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0 | RCC_CFGR_MCO2PRE_3)
  388. #define LL_RCC_MCO2_DIV_10 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_3)
  389. #define LL_RCC_MCO2_DIV_11 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0 | RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_3)
  390. #define LL_RCC_MCO2_DIV_12 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_2 | RCC_CFGR_MCO2PRE_3)
  391. #define LL_RCC_MCO2_DIV_13 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_0 | RCC_CFGR_MCO2PRE_2 | RCC_CFGR_MCO2PRE_3)
  392. #define LL_RCC_MCO2_DIV_14 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_2 | RCC_CFGR_MCO2PRE_3)
  393. #define LL_RCC_MCO2_DIV_15 (uint32_t)((RCC_CFGR_MCO2PRE>>16U) | RCC_CFGR_MCO2PRE)
  394. /**
  395. * @}
  396. */
  397. /** @defgroup RCC_LL_EC_RTC_HSEDIV HSE prescaler for RTC clock
  398. * @{
  399. */
  400. #define LL_RCC_RTC_NOCLOCK (uint32_t)(0x00000000U)
  401. #define LL_RCC_RTC_HSE_DIV_2 (uint32_t)(RCC_CFGR_RTCPRE_1)
  402. #define LL_RCC_RTC_HSE_DIV_3 (uint32_t)(RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  403. #define LL_RCC_RTC_HSE_DIV_4 (uint32_t)(RCC_CFGR_RTCPRE_2)
  404. #define LL_RCC_RTC_HSE_DIV_5 (uint32_t)(RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  405. #define LL_RCC_RTC_HSE_DIV_6 (uint32_t)(RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  406. #define LL_RCC_RTC_HSE_DIV_7 (uint32_t)(RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  407. #define LL_RCC_RTC_HSE_DIV_8 (uint32_t)(RCC_CFGR_RTCPRE_3)
  408. #define LL_RCC_RTC_HSE_DIV_9 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_0)
  409. #define LL_RCC_RTC_HSE_DIV_10 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1)
  410. #define LL_RCC_RTC_HSE_DIV_11 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  411. #define LL_RCC_RTC_HSE_DIV_12 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2)
  412. #define LL_RCC_RTC_HSE_DIV_13 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  413. #define LL_RCC_RTC_HSE_DIV_14 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  414. #define LL_RCC_RTC_HSE_DIV_15 (uint32_t)(RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  415. #define LL_RCC_RTC_HSE_DIV_16 (uint32_t)(RCC_CFGR_RTCPRE_4)
  416. #define LL_RCC_RTC_HSE_DIV_17 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_0)
  417. #define LL_RCC_RTC_HSE_DIV_18 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_1)
  418. #define LL_RCC_RTC_HSE_DIV_19 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  419. #define LL_RCC_RTC_HSE_DIV_20 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2)
  420. #define LL_RCC_RTC_HSE_DIV_21 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  421. #define LL_RCC_RTC_HSE_DIV_22 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  422. #define LL_RCC_RTC_HSE_DIV_23 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  423. #define LL_RCC_RTC_HSE_DIV_24 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3)
  424. #define LL_RCC_RTC_HSE_DIV_25 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_0)
  425. #define LL_RCC_RTC_HSE_DIV_26 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1)
  426. #define LL_RCC_RTC_HSE_DIV_27 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  427. #define LL_RCC_RTC_HSE_DIV_28 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2)
  428. #define LL_RCC_RTC_HSE_DIV_29 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  429. #define LL_RCC_RTC_HSE_DIV_30 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  430. #define LL_RCC_RTC_HSE_DIV_31 (uint32_t)(RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  431. #define LL_RCC_RTC_HSE_DIV_32 (uint32_t)(RCC_CFGR_RTCPRE_5)
  432. #define LL_RCC_RTC_HSE_DIV_33 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_0)
  433. #define LL_RCC_RTC_HSE_DIV_34 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_1)
  434. #define LL_RCC_RTC_HSE_DIV_35 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  435. #define LL_RCC_RTC_HSE_DIV_36 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_2)
  436. #define LL_RCC_RTC_HSE_DIV_37 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  437. #define LL_RCC_RTC_HSE_DIV_38 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  438. #define LL_RCC_RTC_HSE_DIV_39 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  439. #define LL_RCC_RTC_HSE_DIV_40 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3)
  440. #define LL_RCC_RTC_HSE_DIV_41 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_0)
  441. #define LL_RCC_RTC_HSE_DIV_42 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1)
  442. #define LL_RCC_RTC_HSE_DIV_43 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  443. #define LL_RCC_RTC_HSE_DIV_44 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2)
  444. #define LL_RCC_RTC_HSE_DIV_45 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  445. #define LL_RCC_RTC_HSE_DIV_46 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  446. #define LL_RCC_RTC_HSE_DIV_47 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  447. #define LL_RCC_RTC_HSE_DIV_48 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4)
  448. #define LL_RCC_RTC_HSE_DIV_49 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_0)
  449. #define LL_RCC_RTC_HSE_DIV_50 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_1)
  450. #define LL_RCC_RTC_HSE_DIV_51 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  451. #define LL_RCC_RTC_HSE_DIV_52 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2)
  452. #define LL_RCC_RTC_HSE_DIV_53 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  453. #define LL_RCC_RTC_HSE_DIV_54 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  454. #define LL_RCC_RTC_HSE_DIV_55 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  455. #define LL_RCC_RTC_HSE_DIV_56 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3)
  456. #define LL_RCC_RTC_HSE_DIV_57 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_0)
  457. #define LL_RCC_RTC_HSE_DIV_58 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1)
  458. #define LL_RCC_RTC_HSE_DIV_59 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  459. #define LL_RCC_RTC_HSE_DIV_60 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2)
  460. #define LL_RCC_RTC_HSE_DIV_61 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_0)
  461. #define LL_RCC_RTC_HSE_DIV_62 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1)
  462. #define LL_RCC_RTC_HSE_DIV_63 (uint32_t)(RCC_CFGR_RTCPRE_5|RCC_CFGR_RTCPRE_4|RCC_CFGR_RTCPRE_3|RCC_CFGR_RTCPRE_2|RCC_CFGR_RTCPRE_1|RCC_CFGR_RTCPRE_0)
  463. /**
  464. * @}
  465. */
  466. /** @defgroup RCC_LL_EC_USARTx_CLKSOURCE Peripheral USART clock source selection
  467. * @{
  468. */
  469. #if defined(RCC_D2CCIP2R_USART16SEL)
  470. #define LL_RCC_USART16_CLKSOURCE_PCLK2 LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, 0x00000000U)
  471. #define LL_RCC_USART16_CLKSOURCE_PLL2Q LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, RCC_D2CCIP2R_USART16SEL_0)
  472. #define LL_RCC_USART16_CLKSOURCE_PLL3Q LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, RCC_D2CCIP2R_USART16SEL_1)
  473. #define LL_RCC_USART16_CLKSOURCE_HSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, RCC_D2CCIP2R_USART16SEL_0 | RCC_D2CCIP2R_USART16SEL_1)
  474. #define LL_RCC_USART16_CLKSOURCE_CSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, RCC_D2CCIP2R_USART16SEL_2)
  475. #define LL_RCC_USART16_CLKSOURCE_LSE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, RCC_D2CCIP2R_USART16SEL_0 | RCC_D2CCIP2R_USART16SEL_2)
  476. /* Aliases */
  477. #define LL_RCC_USART16910_CLKSOURCE_PCLK2 LL_RCC_USART16_CLKSOURCE_PCLK2
  478. #define LL_RCC_USART16910_CLKSOURCE_PLL2Q LL_RCC_USART16_CLKSOURCE_PLL2Q
  479. #define LL_RCC_USART16910_CLKSOURCE_PLL3Q LL_RCC_USART16_CLKSOURCE_PLL3Q
  480. #define LL_RCC_USART16910_CLKSOURCE_HSI LL_RCC_USART16_CLKSOURCE_HSI
  481. #define LL_RCC_USART16910_CLKSOURCE_CSI LL_RCC_USART16_CLKSOURCE_CSI
  482. #define LL_RCC_USART16910_CLKSOURCE_LSE LL_RCC_USART16_CLKSOURCE_LSE
  483. #elif defined(RCC_D2CCIP2R_USART16910SEL)
  484. #define LL_RCC_USART16910_CLKSOURCE_PCLK2 LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, 0x00000000U)
  485. #define LL_RCC_USART16910_CLKSOURCE_PLL2Q LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, RCC_D2CCIP2R_USART16910SEL_0)
  486. #define LL_RCC_USART16910_CLKSOURCE_PLL3Q LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, RCC_D2CCIP2R_USART16910SEL_1)
  487. #define LL_RCC_USART16910_CLKSOURCE_HSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, RCC_D2CCIP2R_USART16910SEL_0 | RCC_D2CCIP2R_USART16910SEL_1)
  488. #define LL_RCC_USART16910_CLKSOURCE_CSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, RCC_D2CCIP2R_USART16910SEL_2)
  489. #define LL_RCC_USART16910_CLKSOURCE_LSE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, RCC_D2CCIP2R_USART16910SEL_0 | RCC_D2CCIP2R_USART16910SEL_2)
  490. /* Aliases */
  491. #define LL_RCC_USART16_CLKSOURCE_PCLK2 LL_RCC_USART16910_CLKSOURCE_PCLK2
  492. #define LL_RCC_USART16_CLKSOURCE_PLL2Q LL_RCC_USART16910_CLKSOURCE_PLL2Q
  493. #define LL_RCC_USART16_CLKSOURCE_PLL3Q LL_RCC_USART16910_CLKSOURCE_PLL3Q
  494. #define LL_RCC_USART16_CLKSOURCE_HSI LL_RCC_USART16910_CLKSOURCE_HSI
  495. #define LL_RCC_USART16_CLKSOURCE_CSI LL_RCC_USART16910_CLKSOURCE_CSI
  496. #define LL_RCC_USART16_CLKSOURCE_LSE LL_RCC_USART16910_CLKSOURCE_LSE
  497. #else
  498. #define LL_RCC_USART16910_CLKSOURCE_PCLK2 LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, 0x00000000U)
  499. #define LL_RCC_USART16910_CLKSOURCE_PLL2Q LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, RCC_CDCCIP2R_USART16910SEL_0)
  500. #define LL_RCC_USART16910_CLKSOURCE_PLL3Q LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, RCC_CDCCIP2R_USART16910SEL_1)
  501. #define LL_RCC_USART16910_CLKSOURCE_HSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, RCC_CDCCIP2R_USART16910SEL_0 | RCC_CDCCIP2R_USART16910SEL_1)
  502. #define LL_RCC_USART16910_CLKSOURCE_CSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, RCC_CDCCIP2R_USART16910SEL_2)
  503. #define LL_RCC_USART16910_CLKSOURCE_LSE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, RCC_CDCCIP2R_USART16910SEL_0 | RCC_CDCCIP2R_USART16910SEL_2)
  504. /* Aliases */
  505. #define LL_RCC_USART16_CLKSOURCE_PCLK2 LL_RCC_USART16910_CLKSOURCE_PCLK2
  506. #define LL_RCC_USART16_CLKSOURCE_PLL2Q LL_RCC_USART16910_CLKSOURCE_PLL2Q
  507. #define LL_RCC_USART16_CLKSOURCE_PLL3Q LL_RCC_USART16910_CLKSOURCE_PLL3Q
  508. #define LL_RCC_USART16_CLKSOURCE_HSI LL_RCC_USART16910_CLKSOURCE_HSI
  509. #define LL_RCC_USART16_CLKSOURCE_CSI LL_RCC_USART16910_CLKSOURCE_CSI
  510. #define LL_RCC_USART16_CLKSOURCE_LSE LL_RCC_USART16910_CLKSOURCE_LSE
  511. #endif /* RCC_D2CCIP2R_USART16SEL */
  512. #if defined(RCC_D2CCIP2R_USART28SEL)
  513. #define LL_RCC_USART234578_CLKSOURCE_PCLK1 LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, 0x00000000U)
  514. #define LL_RCC_USART234578_CLKSOURCE_PLL2Q LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, RCC_D2CCIP2R_USART28SEL_0)
  515. #define LL_RCC_USART234578_CLKSOURCE_PLL3Q LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, RCC_D2CCIP2R_USART28SEL_1)
  516. #define LL_RCC_USART234578_CLKSOURCE_HSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, RCC_D2CCIP2R_USART28SEL_0 | RCC_D2CCIP2R_USART28SEL_1)
  517. #define LL_RCC_USART234578_CLKSOURCE_CSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, RCC_D2CCIP2R_USART28SEL_2)
  518. #define LL_RCC_USART234578_CLKSOURCE_LSE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, RCC_D2CCIP2R_USART28SEL_0 | RCC_D2CCIP2R_USART28SEL_2)
  519. #else
  520. #define LL_RCC_USART234578_CLKSOURCE_PCLK1 LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, 0x00000000U)
  521. #define LL_RCC_USART234578_CLKSOURCE_PLL2Q LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, RCC_CDCCIP2R_USART234578SEL_0)
  522. #define LL_RCC_USART234578_CLKSOURCE_PLL3Q LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, RCC_CDCCIP2R_USART234578SEL_1)
  523. #define LL_RCC_USART234578_CLKSOURCE_HSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, RCC_CDCCIP2R_USART234578SEL_0 | RCC_CDCCIP2R_USART234578SEL_1)
  524. #define LL_RCC_USART234578_CLKSOURCE_CSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, RCC_CDCCIP2R_USART234578SEL_2)
  525. #define LL_RCC_USART234578_CLKSOURCE_LSE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, RCC_CDCCIP2R_USART234578SEL_0 | RCC_CDCCIP2R_USART234578SEL_2)
  526. #endif /* RCC_D2CCIP2R_USART28SEL */
  527. /**
  528. * @}
  529. */
  530. /** @defgroup RCC_LL_EC_LPUARTx_CLKSOURCE Peripheral LPUART clock source selection
  531. * @{
  532. */
  533. #if defined(RCC_D3CCIPR_LPUART1SEL)
  534. #define LL_RCC_LPUART1_CLKSOURCE_PCLK4 (0x00000000U)
  535. #define LL_RCC_LPUART1_CLKSOURCE_PLL2Q (RCC_D3CCIPR_LPUART1SEL_0)
  536. #define LL_RCC_LPUART1_CLKSOURCE_PLL3Q (RCC_D3CCIPR_LPUART1SEL_1)
  537. #define LL_RCC_LPUART1_CLKSOURCE_HSI (RCC_D3CCIPR_LPUART1SEL_0 | RCC_D3CCIPR_LPUART1SEL_1)
  538. #define LL_RCC_LPUART1_CLKSOURCE_CSI (RCC_D3CCIPR_LPUART1SEL_2)
  539. #define LL_RCC_LPUART1_CLKSOURCE_LSE (RCC_D3CCIPR_LPUART1SEL_0 | RCC_D3CCIPR_LPUART1SEL_2)
  540. #else
  541. #define LL_RCC_LPUART1_CLKSOURCE_PCLK4 (0x00000000U)
  542. #define LL_RCC_LPUART1_CLKSOURCE_PLL2Q (RCC_SRDCCIPR_LPUART1SEL_0)
  543. #define LL_RCC_LPUART1_CLKSOURCE_PLL3Q (RCC_SRDCCIPR_LPUART1SEL_1)
  544. #define LL_RCC_LPUART1_CLKSOURCE_HSI (RCC_SRDCCIPR_LPUART1SEL_0 | RCC_SRDCCIPR_LPUART1SEL_1)
  545. #define LL_RCC_LPUART1_CLKSOURCE_CSI (RCC_SRDCCIPR_LPUART1SEL_2)
  546. #define LL_RCC_LPUART1_CLKSOURCE_LSE (RCC_SRDCCIPR_LPUART1SEL_0 | RCC_SRDCCIPR_LPUART1SEL_2)
  547. #endif /* RCC_D3CCIPR_LPUART1SEL */
  548. /**
  549. * @}
  550. */
  551. /** @defgroup RCC_LL_EC_I2Cx_CLKSOURCE Peripheral I2C clock source selection
  552. * @{
  553. */
  554. #if defined (RCC_D2CCIP2R_I2C123SEL)
  555. #define LL_RCC_I2C123_CLKSOURCE_PCLK1 LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C123SEL, RCC_D2CCIP2R_I2C123SEL_Pos, 0x00000000U)
  556. #define LL_RCC_I2C123_CLKSOURCE_PLL3R LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C123SEL, RCC_D2CCIP2R_I2C123SEL_Pos, RCC_D2CCIP2R_I2C123SEL_0)
  557. #define LL_RCC_I2C123_CLKSOURCE_HSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C123SEL, RCC_D2CCIP2R_I2C123SEL_Pos, RCC_D2CCIP2R_I2C123SEL_1)
  558. #define LL_RCC_I2C123_CLKSOURCE_CSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C123SEL, RCC_D2CCIP2R_I2C123SEL_Pos, RCC_D2CCIP2R_I2C123SEL_0 | RCC_D2CCIP2R_I2C123SEL_1)
  559. /* Aliases */
  560. #define LL_RCC_I2C1235_CLKSOURCE_PCLK1 LL_RCC_I2C123_CLKSOURCE_PCLK1
  561. #define LL_RCC_I2C1235_CLKSOURCE_PLL3R LL_RCC_I2C123_CLKSOURCE_PLL3R
  562. #define LL_RCC_I2C1235_CLKSOURCE_HSI LL_RCC_I2C123_CLKSOURCE_HSI
  563. #define LL_RCC_I2C1235_CLKSOURCE_CSI LL_RCC_I2C123_CLKSOURCE_CSI
  564. #elif defined (RCC_D2CCIP2R_I2C1235SEL)
  565. #define LL_RCC_I2C1235_CLKSOURCE_PCLK1 LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C1235SEL, RCC_D2CCIP2R_I2C1235SEL_Pos, 0x00000000U)
  566. #define LL_RCC_I2C1235_CLKSOURCE_PLL3R LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C1235SEL, RCC_D2CCIP2R_I2C1235SEL_Pos, RCC_D2CCIP2R_I2C1235SEL_0)
  567. #define LL_RCC_I2C1235_CLKSOURCE_HSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C1235SEL, RCC_D2CCIP2R_I2C1235SEL_Pos, RCC_D2CCIP2R_I2C1235SEL_1)
  568. #define LL_RCC_I2C1235_CLKSOURCE_CSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C1235SEL, RCC_D2CCIP2R_I2C1235SEL_Pos, RCC_D2CCIP2R_I2C1235SEL_0 | RCC_D2CCIP2R_I2C1235SEL_1)
  569. /* Aliases */
  570. #define LL_RCC_I2C123_CLKSOURCE_PCLK1 LL_RCC_I2C1235_CLKSOURCE_PCLK1
  571. #define LL_RCC_I2C123_CLKSOURCE_PLL3R LL_RCC_I2C1235_CLKSOURCE_PLL3R
  572. #define LL_RCC_I2C123_CLKSOURCE_HSI LL_RCC_I2C1235_CLKSOURCE_HSI
  573. #define LL_RCC_I2C123_CLKSOURCE_CSI LL_RCC_I2C1235_CLKSOURCE_CSI
  574. #else
  575. #define LL_RCC_I2C123_CLKSOURCE_PCLK1 LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_I2C123SEL, RCC_CDCCIP2R_I2C123SEL_Pos, 0x00000000U)
  576. #define LL_RCC_I2C123_CLKSOURCE_PLL3R LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_I2C123SEL, RCC_CDCCIP2R_I2C123SEL_Pos, RCC_CDCCIP2R_I2C123SEL_0)
  577. #define LL_RCC_I2C123_CLKSOURCE_HSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_I2C123SEL, RCC_CDCCIP2R_I2C123SEL_Pos, RCC_CDCCIP2R_I2C123SEL_1)
  578. #define LL_RCC_I2C123_CLKSOURCE_CSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_I2C123SEL, RCC_CDCCIP2R_I2C123SEL_Pos, RCC_CDCCIP2R_I2C123SEL_0 | RCC_CDCCIP2R_I2C123SEL_1)
  579. #endif /* RCC_D2CCIP2R_I2C123SEL */
  580. #if defined (RCC_D3CCIPR_I2C4SEL)
  581. #define LL_RCC_I2C4_CLKSOURCE_PCLK4 LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_I2C4SEL, RCC_D3CCIPR_I2C4SEL_Pos, 0x00000000U)
  582. #define LL_RCC_I2C4_CLKSOURCE_PLL3R LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_I2C4SEL, RCC_D3CCIPR_I2C4SEL_Pos, RCC_D3CCIPR_I2C4SEL_0)
  583. #define LL_RCC_I2C4_CLKSOURCE_HSI LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_I2C4SEL, RCC_D3CCIPR_I2C4SEL_Pos, RCC_D3CCIPR_I2C4SEL_1)
  584. #define LL_RCC_I2C4_CLKSOURCE_CSI LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_I2C4SEL, RCC_D3CCIPR_I2C4SEL_Pos, RCC_D3CCIPR_I2C4SEL_0 | RCC_D3CCIPR_I2C4SEL_1)
  585. #else
  586. #define LL_RCC_I2C4_CLKSOURCE_PCLK4 LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_I2C4SEL, RCC_SRDCCIPR_I2C4SEL_Pos, 0x00000000U)
  587. #define LL_RCC_I2C4_CLKSOURCE_PLL3R LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_I2C4SEL, RCC_SRDCCIPR_I2C4SEL_Pos, RCC_SRDCCIPR_I2C4SEL_0)
  588. #define LL_RCC_I2C4_CLKSOURCE_HSI LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_I2C4SEL, RCC_SRDCCIPR_I2C4SEL_Pos, RCC_SRDCCIPR_I2C4SEL_1)
  589. #define LL_RCC_I2C4_CLKSOURCE_CSI LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_I2C4SEL, RCC_SRDCCIPR_I2C4SEL_Pos, RCC_SRDCCIPR_I2C4SEL_0 | RCC_SRDCCIPR_I2C4SEL_1)
  590. #endif /* RCC_D3CCIPR_I2C4SEL */
  591. /**
  592. * @}
  593. */
  594. /** @defgroup RCC_LL_EC_LPTIMx_CLKSOURCE Peripheral LPTIM clock source selection
  595. * @{
  596. */
  597. #if defined(RCC_D2CCIP2R_LPTIM1SEL)
  598. #define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, 0x00000000U)
  599. #define LL_RCC_LPTIM1_CLKSOURCE_PLL2P LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, RCC_D2CCIP2R_LPTIM1SEL_0)
  600. #define LL_RCC_LPTIM1_CLKSOURCE_PLL3R LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, RCC_D2CCIP2R_LPTIM1SEL_1)
  601. #define LL_RCC_LPTIM1_CLKSOURCE_LSE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, RCC_D2CCIP2R_LPTIM1SEL_0 | RCC_D2CCIP2R_LPTIM1SEL_1)
  602. #define LL_RCC_LPTIM1_CLKSOURCE_LSI LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, RCC_D2CCIP2R_LPTIM1SEL_2)
  603. #define LL_RCC_LPTIM1_CLKSOURCE_CLKP LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, RCC_D2CCIP2R_LPTIM1SEL_0 | RCC_D2CCIP2R_LPTIM1SEL_2)
  604. #else
  605. #define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, 0x00000000U)
  606. #define LL_RCC_LPTIM1_CLKSOURCE_PLL2P LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, RCC_CDCCIP2R_LPTIM1SEL_0)
  607. #define LL_RCC_LPTIM1_CLKSOURCE_PLL3R LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, RCC_CDCCIP2R_LPTIM1SEL_1)
  608. #define LL_RCC_LPTIM1_CLKSOURCE_LSE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, RCC_CDCCIP2R_LPTIM1SEL_0 | RCC_CDCCIP2R_LPTIM1SEL_1)
  609. #define LL_RCC_LPTIM1_CLKSOURCE_LSI LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, RCC_CDCCIP2R_LPTIM1SEL_2)
  610. #define LL_RCC_LPTIM1_CLKSOURCE_CLKP LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, RCC_CDCCIP2R_LPTIM1SEL_0 | RCC_CDCCIP2R_LPTIM1SEL_2)
  611. #endif /* RCC_D2CCIP2R_LPTIM1SEL */
  612. #if defined(RCC_D3CCIPR_LPTIM2SEL)
  613. #define LL_RCC_LPTIM2_CLKSOURCE_PCLK4 LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, 0x00000000U)
  614. #define LL_RCC_LPTIM2_CLKSOURCE_PLL2P LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, RCC_D3CCIPR_LPTIM2SEL_0)
  615. #define LL_RCC_LPTIM2_CLKSOURCE_PLL3R LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, RCC_D3CCIPR_LPTIM2SEL_1)
  616. #define LL_RCC_LPTIM2_CLKSOURCE_LSE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, RCC_D3CCIPR_LPTIM2SEL_0 | RCC_D3CCIPR_LPTIM2SEL_1)
  617. #define LL_RCC_LPTIM2_CLKSOURCE_LSI LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, RCC_D3CCIPR_LPTIM2SEL_2)
  618. #define LL_RCC_LPTIM2_CLKSOURCE_CLKP LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, RCC_D3CCIPR_LPTIM2SEL_0 | RCC_D3CCIPR_LPTIM2SEL_2)
  619. #else
  620. #define LL_RCC_LPTIM2_CLKSOURCE_PCLK4 LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, 0x00000000U)
  621. #define LL_RCC_LPTIM2_CLKSOURCE_PLL2P LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, RCC_SRDCCIPR_LPTIM2SEL_0)
  622. #define LL_RCC_LPTIM2_CLKSOURCE_PLL3R LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, RCC_SRDCCIPR_LPTIM2SEL_1)
  623. #define LL_RCC_LPTIM2_CLKSOURCE_LSE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, RCC_SRDCCIPR_LPTIM2SEL_0 | RCC_SRDCCIPR_LPTIM2SEL_1)
  624. #define LL_RCC_LPTIM2_CLKSOURCE_LSI LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, RCC_SRDCCIPR_LPTIM2SEL_2)
  625. #define LL_RCC_LPTIM2_CLKSOURCE_CLKP LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, RCC_SRDCCIPR_LPTIM2SEL_0 | RCC_SRDCCIPR_LPTIM2SEL_2)
  626. #endif /* RCC_D3CCIPR_LPTIM2SEL */
  627. #if defined(RCC_D3CCIPR_LPTIM345SEL)
  628. #define LL_RCC_LPTIM345_CLKSOURCE_PCLK4 LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, 0x00000000U)
  629. #define LL_RCC_LPTIM345_CLKSOURCE_PLL2P LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, RCC_D3CCIPR_LPTIM345SEL_0)
  630. #define LL_RCC_LPTIM345_CLKSOURCE_PLL3R LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, RCC_D3CCIPR_LPTIM345SEL_1)
  631. #define LL_RCC_LPTIM345_CLKSOURCE_LSE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, RCC_D3CCIPR_LPTIM345SEL_0 | RCC_D3CCIPR_LPTIM345SEL_1)
  632. #define LL_RCC_LPTIM345_CLKSOURCE_LSI LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, RCC_D3CCIPR_LPTIM345SEL_2)
  633. #define LL_RCC_LPTIM345_CLKSOURCE_CLKP LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, RCC_D3CCIPR_LPTIM345SEL_0 | RCC_D3CCIPR_LPTIM345SEL_2)
  634. #else
  635. #define LL_RCC_LPTIM345_CLKSOURCE_PCLK4 LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, 0x00000000U)
  636. #define LL_RCC_LPTIM345_CLKSOURCE_PLL2P LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, RCC_SRDCCIPR_LPTIM3SEL_0)
  637. #define LL_RCC_LPTIM345_CLKSOURCE_PLL3R LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, RCC_SRDCCIPR_LPTIM3SEL_1)
  638. #define LL_RCC_LPTIM345_CLKSOURCE_LSE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, RCC_SRDCCIPR_LPTIM3SEL_0 | RCC_SRDCCIPR_LPTIM3SEL_1)
  639. #define LL_RCC_LPTIM345_CLKSOURCE_LSI LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, RCC_SRDCCIPR_LPTIM3SEL_2)
  640. #define LL_RCC_LPTIM345_CLKSOURCE_CLKP LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, RCC_SRDCCIPR_LPTIM3SEL_0 | RCC_SRDCCIPR_LPTIM3SEL_2)
  641. /* aliases*/
  642. #define LL_RCC_LPTIM3_CLKSOURCE_PCLK4 LL_RCC_LPTIM345_CLKSOURCE_PCLK4
  643. #define LL_RCC_LPTIM3_CLKSOURCE_PLL2P LL_RCC_LPTIM345_CLKSOURCE_PLL2P
  644. #define LL_RCC_LPTIM3_CLKSOURCE_PLL3R LL_RCC_LPTIM345_CLKSOURCE_PLL3R
  645. #define LL_RCC_LPTIM3_CLKSOURCE_LSE LL_RCC_LPTIM345_CLKSOURCE_LSE
  646. #define LL_RCC_LPTIM3_CLKSOURCE_LSI LL_RCC_LPTIM345_CLKSOURCE_LSI
  647. #define LL_RCC_LPTIM3_CLKSOURCE_CLKP LL_RCC_LPTIM345_CLKSOURCE_CLKP
  648. #endif /* RCC_D3CCIPR_LPTIM345SEL */
  649. /**
  650. * @}
  651. */
  652. /** @defgroup RCC_LL_EC_SAIx_CLKSOURCE Peripheral SAI clock source selection
  653. * @{
  654. */
  655. #if defined(RCC_D2CCIP1R_SAI1SEL)
  656. #define LL_RCC_SAI1_CLKSOURCE_PLL1Q LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI1SEL, RCC_D2CCIP1R_SAI1SEL_Pos, 0x00000000U)
  657. #define LL_RCC_SAI1_CLKSOURCE_PLL2P LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI1SEL, RCC_D2CCIP1R_SAI1SEL_Pos, RCC_D2CCIP1R_SAI1SEL_0)
  658. #define LL_RCC_SAI1_CLKSOURCE_PLL3P LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI1SEL, RCC_D2CCIP1R_SAI1SEL_Pos, RCC_D2CCIP1R_SAI1SEL_1)
  659. #define LL_RCC_SAI1_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI1SEL, RCC_D2CCIP1R_SAI1SEL_Pos, RCC_D2CCIP1R_SAI1SEL_0 | RCC_D2CCIP1R_SAI1SEL_1)
  660. #define LL_RCC_SAI1_CLKSOURCE_CLKP LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI1SEL, RCC_D2CCIP1R_SAI1SEL_Pos, RCC_D2CCIP1R_SAI1SEL_2)
  661. #else
  662. #define LL_RCC_SAI1_CLKSOURCE_PLL1Q LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI1SEL, RCC_CDCCIP1R_SAI1SEL_Pos, 0x00000000U)
  663. #define LL_RCC_SAI1_CLKSOURCE_PLL2P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI1SEL, RCC_CDCCIP1R_SAI1SEL_Pos, RCC_CDCCIP1R_SAI1SEL_0)
  664. #define LL_RCC_SAI1_CLKSOURCE_PLL3P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI1SEL, RCC_CDCCIP1R_SAI1SEL_Pos, RCC_CDCCIP1R_SAI1SEL_1)
  665. #define LL_RCC_SAI1_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI1SEL, RCC_CDCCIP1R_SAI1SEL_Pos, RCC_CDCCIP1R_SAI1SEL_0 | RCC_CDCCIP1R_SAI1SEL_1)
  666. #define LL_RCC_SAI1_CLKSOURCE_CLKP LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI1SEL, RCC_CDCCIP1R_SAI1SEL_Pos, RCC_CDCCIP1R_SAI1SEL_2)
  667. #endif
  668. #if defined(SAI3)
  669. #define LL_RCC_SAI23_CLKSOURCE_PLL1Q LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI23SEL, RCC_D2CCIP1R_SAI23SEL_Pos, 0x00000000U)
  670. #define LL_RCC_SAI23_CLKSOURCE_PLL2P LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI23SEL, RCC_D2CCIP1R_SAI23SEL_Pos, RCC_D2CCIP1R_SAI23SEL_0)
  671. #define LL_RCC_SAI23_CLKSOURCE_PLL3P LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI23SEL, RCC_D2CCIP1R_SAI23SEL_Pos, RCC_D2CCIP1R_SAI23SEL_1)
  672. #define LL_RCC_SAI23_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI23SEL, RCC_D2CCIP1R_SAI23SEL_Pos, RCC_D2CCIP1R_SAI23SEL_0 | RCC_D2CCIP1R_SAI23SEL_1)
  673. #define LL_RCC_SAI23_CLKSOURCE_CLKP LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI23SEL, RCC_D2CCIP1R_SAI23SEL_Pos, RCC_D2CCIP1R_SAI23SEL_2)
  674. #endif /* SAI3 */
  675. #if defined(RCC_CDCCIP1R_SAI2ASEL)
  676. #define LL_RCC_SAI2A_CLKSOURCE_PLL1Q LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, 0x00000000U)
  677. #define LL_RCC_SAI2A_CLKSOURCE_PLL2P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, RCC_CDCCIP1R_SAI2ASEL_0)
  678. #define LL_RCC_SAI2A_CLKSOURCE_PLL3P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, RCC_CDCCIP1R_SAI2ASEL_1)
  679. #define LL_RCC_SAI2A_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, RCC_CDCCIP1R_SAI2ASEL_0 | RCC_CDCCIP1R_SAI2ASEL_1)
  680. #define LL_RCC_SAI2A_CLKSOURCE_CLKP LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, RCC_CDCCIP1R_SAI2ASEL_2)
  681. #define LL_RCC_SAI2A_CLKSOURCE_SPDIF LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, RCC_CDCCIP1R_SAI2ASEL_0 | RCC_CDCCIP1R_SAI2ASEL_2)
  682. #endif /* RCC_CDCCIP1R_SAI2ASEL */
  683. #if defined(RCC_CDCCIP1R_SAI2BSEL)
  684. #define LL_RCC_SAI2B_CLKSOURCE_PLL1Q LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, 0x00000000U)
  685. #define LL_RCC_SAI2B_CLKSOURCE_PLL2P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, RCC_CDCCIP1R_SAI2BSEL_0)
  686. #define LL_RCC_SAI2B_CLKSOURCE_PLL3P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, RCC_CDCCIP1R_SAI2BSEL_1)
  687. #define LL_RCC_SAI2B_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, RCC_CDCCIP1R_SAI2BSEL_0 | RCC_CDCCIP1R_SAI2BSEL_1)
  688. #define LL_RCC_SAI2B_CLKSOURCE_CLKP LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, RCC_CDCCIP1R_SAI2BSEL_2)
  689. #define LL_RCC_SAI2B_CLKSOURCE_SPDIF LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, RCC_CDCCIP1R_SAI2BSEL_0 | RCC_CDCCIP1R_SAI2BSEL_2)
  690. #endif /* RCC_CDCCIP1R_SAI2BSEL */
  691. #if defined(SAI4_Block_A)
  692. #define LL_RCC_SAI4A_CLKSOURCE_PLL1Q LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, 0x00000000U)
  693. #define LL_RCC_SAI4A_CLKSOURCE_PLL2P LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, RCC_D3CCIPR_SAI4ASEL_0)
  694. #define LL_RCC_SAI4A_CLKSOURCE_PLL3P LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, RCC_D3CCIPR_SAI4ASEL_1)
  695. #define LL_RCC_SAI4A_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, RCC_D3CCIPR_SAI4ASEL_0 | RCC_D3CCIPR_SAI4ASEL_1)
  696. #define LL_RCC_SAI4A_CLKSOURCE_CLKP LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, RCC_D3CCIPR_SAI4ASEL_2)
  697. #if defined(RCC_VER_3_0)
  698. #define LL_RCC_SAI4A_CLKSOURCE_SPDIF LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, RCC_D3CCIPR_SAI4ASEL_2 | RCC_D3CCIPR_SAI4ASEL_0)
  699. #endif /* RCC_VER_3_0 */
  700. #endif /* SAI4_Block_A */
  701. #if defined(SAI4_Block_B)
  702. #define LL_RCC_SAI4B_CLKSOURCE_PLL1Q LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, 0x00000000U)
  703. #define LL_RCC_SAI4B_CLKSOURCE_PLL2P LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, RCC_D3CCIPR_SAI4BSEL_0)
  704. #define LL_RCC_SAI4B_CLKSOURCE_PLL3P LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, RCC_D3CCIPR_SAI4BSEL_1)
  705. #define LL_RCC_SAI4B_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, RCC_D3CCIPR_SAI4BSEL_0 | RCC_D3CCIPR_SAI4BSEL_1)
  706. #define LL_RCC_SAI4B_CLKSOURCE_CLKP LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, RCC_D3CCIPR_SAI4BSEL_2)
  707. #if defined(RCC_VER_3_0)
  708. #define LL_RCC_SAI4B_CLKSOURCE_SPDIF LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, RCC_D3CCIPR_SAI4BSEL_2 | RCC_D3CCIPR_SAI4BSEL_0)
  709. #endif /* RCC_VER_3_0 */
  710. #endif /* SAI4_Block_B */
  711. /**
  712. * @}
  713. */
  714. /** @defgroup RCC_LL_EC_SDMMC_CLKSOURCE Peripheral SDMMC clock source selection
  715. * @{
  716. */
  717. #if defined(RCC_D1CCIPR_SDMMCSEL)
  718. #define LL_RCC_SDMMC_CLKSOURCE_PLL1Q (0x00000000U)
  719. #define LL_RCC_SDMMC_CLKSOURCE_PLL2R (RCC_D1CCIPR_SDMMCSEL)
  720. #else
  721. #define LL_RCC_SDMMC_CLKSOURCE_PLL1Q (0x00000000U)
  722. #define LL_RCC_SDMMC_CLKSOURCE_PLL2R (RCC_CDCCIPR_SDMMCSEL)
  723. #endif /* RCC_D1CCIPR_SDMMCSEL */
  724. /**
  725. * @}
  726. */
  727. /** @defgroup RCC_LL_EC_RNG_CLKSOURCE Peripheral RNG clock source selection
  728. * @{
  729. */
  730. #if defined(RCC_D2CCIP2R_RNGSEL)
  731. #define LL_RCC_RNG_CLKSOURCE_HSI48 (0x00000000U)
  732. #define LL_RCC_RNG_CLKSOURCE_PLL1Q (RCC_D2CCIP2R_RNGSEL_0)
  733. #define LL_RCC_RNG_CLKSOURCE_LSE (RCC_D2CCIP2R_RNGSEL_1)
  734. #define LL_RCC_RNG_CLKSOURCE_LSI (RCC_D2CCIP2R_RNGSEL_1 | RCC_D2CCIP2R_RNGSEL_0)
  735. #else
  736. #define LL_RCC_RNG_CLKSOURCE_HSI48 (0x00000000U)
  737. #define LL_RCC_RNG_CLKSOURCE_PLL1Q (RCC_CDCCIP2R_RNGSEL_0)
  738. #define LL_RCC_RNG_CLKSOURCE_LSE (RCC_CDCCIP2R_RNGSEL_1)
  739. #define LL_RCC_RNG_CLKSOURCE_LSI (RCC_CDCCIP2R_RNGSEL_1 | RCC_CDCCIP2R_RNGSEL_0)
  740. #endif /* RCC_D2CCIP2R_RNGSEL */
  741. /**
  742. * @}
  743. */
  744. /** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection
  745. * @{
  746. */
  747. #if defined(RCC_D2CCIP2R_USBSEL)
  748. #define LL_RCC_USB_CLKSOURCE_DISABLE (0x00000000U)
  749. #define LL_RCC_USB_CLKSOURCE_PLL1Q (RCC_D2CCIP2R_USBSEL_0)
  750. #define LL_RCC_USB_CLKSOURCE_PLL3Q (RCC_D2CCIP2R_USBSEL_1)
  751. #define LL_RCC_USB_CLKSOURCE_HSI48 (RCC_D2CCIP2R_USBSEL_1 | RCC_D2CCIP2R_USBSEL_0)
  752. #else
  753. #define LL_RCC_USB_CLKSOURCE_DISABLE (0x00000000U)
  754. #define LL_RCC_USB_CLKSOURCE_PLL1Q (RCC_CDCCIP2R_USBSEL_0)
  755. #define LL_RCC_USB_CLKSOURCE_PLL3Q (RCC_CDCCIP2R_USBSEL_1)
  756. #define LL_RCC_USB_CLKSOURCE_HSI48 (RCC_CDCCIP2R_USBSEL_1 | RCC_CDCCIP2R_USBSEL_0)
  757. #endif /* RCC_D2CCIP2R_USBSEL */
  758. /**
  759. * @}
  760. */
  761. /** @defgroup RCC_LL_EC_CEC_CLKSOURCE Peripheral CEC clock source selection
  762. * @{
  763. */
  764. #if defined(RCC_D2CCIP2R_CECSEL)
  765. #define LL_RCC_CEC_CLKSOURCE_LSE (0x00000000U)
  766. #define LL_RCC_CEC_CLKSOURCE_LSI (RCC_D2CCIP2R_CECSEL_0)
  767. #define LL_RCC_CEC_CLKSOURCE_CSI_DIV122 (RCC_D2CCIP2R_CECSEL_1)
  768. #else
  769. #define LL_RCC_CEC_CLKSOURCE_LSE (0x00000000U)
  770. #define LL_RCC_CEC_CLKSOURCE_LSI (RCC_CDCCIP2R_CECSEL_0)
  771. #define LL_RCC_CEC_CLKSOURCE_CSI_DIV122 (RCC_CDCCIP2R_CECSEL_1)
  772. #endif
  773. /**
  774. * @}
  775. */
  776. #if defined(DSI)
  777. /** @defgroup RCC_LL_EC_DSI_CLKSOURCE Peripheral DSI clock source selection
  778. * @{
  779. */
  780. #define LL_RCC_DSI_CLKSOURCE_PHY (0x00000000U)
  781. #define LL_RCC_DSI_CLKSOURCE_PLL2Q (RCC_D1CCIPR_DSISEL)
  782. /**
  783. * @}
  784. */
  785. #endif /* DSI */
  786. /** @defgroup RCC_LL_EC_DFSDM_CLKSOURCE Peripheral DFSDM clock source selection
  787. * @{
  788. */
  789. #if defined(RCC_D2CCIP1R_DFSDM1SEL)
  790. #define LL_RCC_DFSDM1_CLKSOURCE_PCLK2 (0x00000000U)
  791. #define LL_RCC_DFSDM1_CLKSOURCE_SYSCLK (RCC_D2CCIP1R_DFSDM1SEL)
  792. #else
  793. #define LL_RCC_DFSDM1_CLKSOURCE_PCLK2 (0x00000000U)
  794. #define LL_RCC_DFSDM1_CLKSOURCE_SYSCLK (RCC_CDCCIP1R_DFSDM1SEL)
  795. #endif /* RCC_D2CCIP1R_DFSDM1SEL */
  796. /**
  797. * @}
  798. */
  799. #if defined(DFSDM2_BASE)
  800. /** @defgroup RCC_LL_EC_DFSDM2_CLKSOURCE Peripheral DFSDM2 clock source selection
  801. * @{
  802. */
  803. #define LL_RCC_DFSDM2_CLKSOURCE_PCLK4 (0x00000000U)
  804. #define LL_RCC_DFSDM2_CLKSOURCE_SYSCLK (RCC_SRDCCIPR_DFSDM2SEL)
  805. /**
  806. * @}
  807. */
  808. #endif /* DFSDM2_BASE */
  809. /** @defgroup RCC_LL_EC_FMC_CLKSOURCE Peripheral FMC clock source selection
  810. * @{
  811. */
  812. #if defined(RCC_D1CCIPR_FMCSEL)
  813. #define LL_RCC_FMC_CLKSOURCE_HCLK (0x00000000U)
  814. #define LL_RCC_FMC_CLKSOURCE_PLL1Q (RCC_D1CCIPR_FMCSEL_0)
  815. #define LL_RCC_FMC_CLKSOURCE_PLL2R (RCC_D1CCIPR_FMCSEL_1)
  816. #define LL_RCC_FMC_CLKSOURCE_CLKP (RCC_D1CCIPR_FMCSEL_0 | RCC_D1CCIPR_FMCSEL_1)
  817. #else
  818. #define LL_RCC_FMC_CLKSOURCE_HCLK (0x00000000U)
  819. #define LL_RCC_FMC_CLKSOURCE_PLL1Q (RCC_CDCCIPR_FMCSEL_0)
  820. #define LL_RCC_FMC_CLKSOURCE_PLL2R (RCC_CDCCIPR_FMCSEL_1)
  821. #define LL_RCC_FMC_CLKSOURCE_CLKP (RCC_CDCCIPR_FMCSEL_0 | RCC_CDCCIPR_FMCSEL_1)
  822. #endif /* RCC_D1CCIPR_FMCSEL */
  823. /**
  824. * @}
  825. */
  826. #if defined(QUADSPI)
  827. /** @defgroup RCC_LL_EC_QSPI_CLKSOURCE Peripheral QSPI clock source selection
  828. * @{
  829. */
  830. #define LL_RCC_QSPI_CLKSOURCE_HCLK (0x00000000U)
  831. #define LL_RCC_QSPI_CLKSOURCE_PLL1Q (RCC_D1CCIPR_QSPISEL_0)
  832. #define LL_RCC_QSPI_CLKSOURCE_PLL2R (RCC_D1CCIPR_QSPISEL_1)
  833. #define LL_RCC_QSPI_CLKSOURCE_CLKP (RCC_D1CCIPR_QSPISEL_0 | RCC_D1CCIPR_QSPISEL_1)
  834. /**
  835. * @}
  836. */
  837. #endif /* QUADSPI */
  838. #if defined(OCTOSPI1) || defined(OCTOSPI2)
  839. /** @defgroup RCC_LL_EC_OSPI_CLKSOURCE Peripheral OSPI clock source selection
  840. * @{
  841. */
  842. #if defined(RCC_D1CCIPR_OCTOSPISEL)
  843. #define LL_RCC_OSPI_CLKSOURCE_HCLK (0x00000000U)
  844. #define LL_RCC_OSPI_CLKSOURCE_PLL1Q (RCC_D1CCIPR_OCTOSPISEL_0)
  845. #define LL_RCC_OSPI_CLKSOURCE_PLL2R (RCC_D1CCIPR_OCTOSPISEL_1)
  846. #define LL_RCC_OSPI_CLKSOURCE_CLKP (RCC_D1CCIPR_OCTOSPISEL_0 | RCC_D1CCIPR_OCTOSPISEL_1)
  847. #else
  848. #define LL_RCC_OSPI_CLKSOURCE_HCLK (0x00000000U)
  849. #define LL_RCC_OSPI_CLKSOURCE_PLL1Q (RCC_CDCCIPR_OCTOSPISEL_0)
  850. #define LL_RCC_OSPI_CLKSOURCE_PLL2R (RCC_CDCCIPR_OCTOSPISEL_1)
  851. #define LL_RCC_OSPI_CLKSOURCE_CLKP (RCC_CDCCIPR_OCTOSPISEL_0 | RCC_CDCCIPR_OCTOSPISEL_1)
  852. #endif /* RCC_D1CCIPR_OCTOSPISEL */
  853. /**
  854. * @}
  855. */
  856. #endif /* defined(OCTOSPI1) || defined(OCTOSPI2) */
  857. /** @defgroup RCC_LL_EC_CLKP_CLKSOURCE Peripheral CLKP clock source selection
  858. * @{
  859. */
  860. #if defined(RCC_D1CCIPR_CKPERSEL)
  861. #define LL_RCC_CLKP_CLKSOURCE_HSI (0x00000000U)
  862. #define LL_RCC_CLKP_CLKSOURCE_CSI (RCC_D1CCIPR_CKPERSEL_0)
  863. #define LL_RCC_CLKP_CLKSOURCE_HSE (RCC_D1CCIPR_CKPERSEL_1)
  864. #else
  865. #define LL_RCC_CLKP_CLKSOURCE_HSI (0x00000000U)
  866. #define LL_RCC_CLKP_CLKSOURCE_CSI (RCC_CDCCIPR_CKPERSEL_0)
  867. #define LL_RCC_CLKP_CLKSOURCE_HSE (RCC_CDCCIPR_CKPERSEL_1)
  868. #endif /* RCC_D1CCIPR_CKPERSEL */
  869. /**
  870. * @}
  871. */
  872. /** @defgroup RCC_LL_EC_SPIx_CLKSOURCE Peripheral SPI clock source selection
  873. * @{
  874. */
  875. #if defined(RCC_D2CCIP1R_SPI123SEL)
  876. #define LL_RCC_SPI123_CLKSOURCE_PLL1Q LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI123SEL, RCC_D2CCIP1R_SPI123SEL_Pos, 0x00000000U)
  877. #define LL_RCC_SPI123_CLKSOURCE_PLL2P LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI123SEL, RCC_D2CCIP1R_SPI123SEL_Pos, RCC_D2CCIP1R_SPI123SEL_0)
  878. #define LL_RCC_SPI123_CLKSOURCE_PLL3P LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI123SEL, RCC_D2CCIP1R_SPI123SEL_Pos, RCC_D2CCIP1R_SPI123SEL_1)
  879. #define LL_RCC_SPI123_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI123SEL, RCC_D2CCIP1R_SPI123SEL_Pos, RCC_D2CCIP1R_SPI123SEL_0 | RCC_D2CCIP1R_SPI123SEL_1)
  880. #define LL_RCC_SPI123_CLKSOURCE_CLKP LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI123SEL, RCC_D2CCIP1R_SPI123SEL_Pos, RCC_D2CCIP1R_SPI123SEL_2)
  881. #else
  882. #define LL_RCC_SPI123_CLKSOURCE_PLL1Q LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI123SEL, RCC_CDCCIP1R_SPI123SEL_Pos, 0x00000000U)
  883. #define LL_RCC_SPI123_CLKSOURCE_PLL2P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI123SEL, RCC_CDCCIP1R_SPI123SEL_Pos, RCC_CDCCIP1R_SPI123SEL_0)
  884. #define LL_RCC_SPI123_CLKSOURCE_PLL3P LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI123SEL, RCC_CDCCIP1R_SPI123SEL_Pos, RCC_CDCCIP1R_SPI123SEL_1)
  885. #define LL_RCC_SPI123_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI123SEL, RCC_CDCCIP1R_SPI123SEL_Pos, RCC_CDCCIP1R_SPI123SEL_0 | RCC_CDCCIP1R_SPI123SEL_1)
  886. #define LL_RCC_SPI123_CLKSOURCE_CLKP LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI123SEL, RCC_CDCCIP1R_SPI123SEL_Pos, RCC_CDCCIP1R_SPI123SEL_2)
  887. #endif /* RCC_D2CCIP1R_SPI123SEL */
  888. #if defined(RCC_D2CCIP1R_SPI45SEL)
  889. #define LL_RCC_SPI45_CLKSOURCE_PCLK2 LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, 0x00000000U)
  890. #define LL_RCC_SPI45_CLKSOURCE_PLL2Q LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, RCC_D2CCIP1R_SPI45SEL_0)
  891. #define LL_RCC_SPI45_CLKSOURCE_PLL3Q LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, RCC_D2CCIP1R_SPI45SEL_1)
  892. #define LL_RCC_SPI45_CLKSOURCE_HSI LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, RCC_D2CCIP1R_SPI45SEL_0 | RCC_D2CCIP1R_SPI45SEL_1)
  893. #define LL_RCC_SPI45_CLKSOURCE_CSI LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, RCC_D2CCIP1R_SPI45SEL_2)
  894. #define LL_RCC_SPI45_CLKSOURCE_HSE LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, RCC_D2CCIP1R_SPI45SEL_0 | RCC_D2CCIP1R_SPI45SEL_2)
  895. #else
  896. #define LL_RCC_SPI45_CLKSOURCE_PCLK2 LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, 0x00000000U)
  897. #define LL_RCC_SPI45_CLKSOURCE_PLL2Q LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, RCC_CDCCIP1R_SPI45SEL_0)
  898. #define LL_RCC_SPI45_CLKSOURCE_PLL3Q LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, RCC_CDCCIP1R_SPI45SEL_1)
  899. #define LL_RCC_SPI45_CLKSOURCE_HSI LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, RCC_CDCCIP1R_SPI45SEL_0 | RCC_CDCCIP1R_SPI45SEL_1)
  900. #define LL_RCC_SPI45_CLKSOURCE_CSI LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, RCC_CDCCIP1R_SPI45SEL_2)
  901. #define LL_RCC_SPI45_CLKSOURCE_HSE LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, RCC_CDCCIP1R_SPI45SEL_0 | RCC_CDCCIP1R_SPI45SEL_2)
  902. #endif /* (RCC_D2CCIP1R_SPI45SEL */
  903. #if defined(RCC_D3CCIPR_SPI6SEL)
  904. #define LL_RCC_SPI6_CLKSOURCE_PCLK4 LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, 0x00000000U)
  905. #define LL_RCC_SPI6_CLKSOURCE_PLL2Q LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, RCC_D3CCIPR_SPI6SEL_0)
  906. #define LL_RCC_SPI6_CLKSOURCE_PLL3Q LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, RCC_D3CCIPR_SPI6SEL_1)
  907. #define LL_RCC_SPI6_CLKSOURCE_HSI LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, RCC_D3CCIPR_SPI6SEL_0 | RCC_D3CCIPR_SPI6SEL_1)
  908. #define LL_RCC_SPI6_CLKSOURCE_CSI LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, RCC_D3CCIPR_SPI6SEL_2)
  909. #define LL_RCC_SPI6_CLKSOURCE_HSE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, RCC_D3CCIPR_SPI6SEL_0 | RCC_D3CCIPR_SPI6SEL_2)
  910. #else
  911. #define LL_RCC_SPI6_CLKSOURCE_PCLK4 LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, 0x00000000U)
  912. #define LL_RCC_SPI6_CLKSOURCE_PLL2Q LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, RCC_SRDCCIPR_SPI6SEL_0)
  913. #define LL_RCC_SPI6_CLKSOURCE_PLL3Q LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, RCC_SRDCCIPR_SPI6SEL_1)
  914. #define LL_RCC_SPI6_CLKSOURCE_HSI LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, RCC_SRDCCIPR_SPI6SEL_0 | RCC_SRDCCIPR_SPI6SEL_1)
  915. #define LL_RCC_SPI6_CLKSOURCE_CSI LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, RCC_SRDCCIPR_SPI6SEL_2)
  916. #define LL_RCC_SPI6_CLKSOURCE_HSE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, RCC_SRDCCIPR_SPI6SEL_0 | RCC_SRDCCIPR_SPI6SEL_2)
  917. #define LL_RCC_SPI6_CLKSOURCE_I2S_CKIN LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, RCC_SRDCCIPR_SPI6SEL_1 | RCC_SRDCCIPR_SPI6SEL_2)
  918. #endif /* RCC_D3CCIPR_SPI6SEL */
  919. /**
  920. * @}
  921. */
  922. /** @defgroup RCC_LL_EC_SPDIF_CLKSOURCE Peripheral SPDIF clock source selection
  923. * @{
  924. */
  925. #if defined(RCC_D2CCIP1R_SPDIFSEL)
  926. #define LL_RCC_SPDIF_CLKSOURCE_PLL1Q (0x00000000U)
  927. #define LL_RCC_SPDIF_CLKSOURCE_PLL2R (RCC_D2CCIP1R_SPDIFSEL_0)
  928. #define LL_RCC_SPDIF_CLKSOURCE_PLL3R (RCC_D2CCIP1R_SPDIFSEL_1)
  929. #define LL_RCC_SPDIF_CLKSOURCE_HSI (RCC_D2CCIP1R_SPDIFSEL_0 | RCC_D2CCIP1R_SPDIFSEL_1)
  930. #else
  931. #define LL_RCC_SPDIF_CLKSOURCE_PLL1Q (0x00000000U)
  932. #define LL_RCC_SPDIF_CLKSOURCE_PLL2R (RCC_CDCCIP1R_SPDIFSEL_0)
  933. #define LL_RCC_SPDIF_CLKSOURCE_PLL3R (RCC_CDCCIP1R_SPDIFSEL_1)
  934. #define LL_RCC_SPDIF_CLKSOURCE_HSI (RCC_CDCCIP1R_SPDIFSEL_0 | RCC_CDCCIP1R_SPDIFSEL_1)
  935. #endif /* RCC_D2CCIP1R_SPDIFSEL */
  936. /**
  937. * @}
  938. */
  939. #if defined(FDCAN1) || defined(FDCAN2)
  940. /** @defgroup RCC_LL_EC_FDCAN_CLKSOURCE Peripheral FDCAN clock source selection
  941. * @{
  942. */
  943. #if defined(RCC_D2CCIP1R_FDCANSEL)
  944. #define LL_RCC_FDCAN_CLKSOURCE_HSE (0x00000000U)
  945. #define LL_RCC_FDCAN_CLKSOURCE_PLL1Q (RCC_D2CCIP1R_FDCANSEL_0)
  946. #define LL_RCC_FDCAN_CLKSOURCE_PLL2Q (RCC_D2CCIP1R_FDCANSEL_1)
  947. #else
  948. #define LL_RCC_FDCAN_CLKSOURCE_HSE (0x00000000U)
  949. #define LL_RCC_FDCAN_CLKSOURCE_PLL1Q (RCC_CDCCIP1R_FDCANSEL_0)
  950. #define LL_RCC_FDCAN_CLKSOURCE_PLL2Q (RCC_CDCCIP1R_FDCANSEL_1)
  951. #endif /* RCC_D2CCIP1R_FDCANSEL */
  952. /**
  953. * @}
  954. */
  955. #endif /*FDCAN1 || FDCAN2*/
  956. /** @defgroup RCC_LL_EC_SWP_CLKSOURCE Peripheral SWP clock source selection
  957. * @{
  958. */
  959. #if defined(RCC_D2CCIP1R_SWPSEL)
  960. #define LL_RCC_SWP_CLKSOURCE_PCLK1 (0x00000000U)
  961. #define LL_RCC_SWP_CLKSOURCE_HSI (RCC_D2CCIP1R_SWPSEL)
  962. #else
  963. #define LL_RCC_SWP_CLKSOURCE_PCLK1 (0x00000000U)
  964. #define LL_RCC_SWP_CLKSOURCE_HSI (RCC_CDCCIP1R_SWPSEL)
  965. #endif /* RCC_D2CCIP1R_SWPSEL */
  966. /**
  967. * @}
  968. */
  969. /** @defgroup RCC_LL_EC_ADC_CLKSOURCE Peripheral ADC clock source selection
  970. * @{
  971. */
  972. #if defined(RCC_D3CCIPR_ADCSEL)
  973. #define LL_RCC_ADC_CLKSOURCE_PLL2P (0x00000000U)
  974. #define LL_RCC_ADC_CLKSOURCE_PLL3R (RCC_D3CCIPR_ADCSEL_0)
  975. #define LL_RCC_ADC_CLKSOURCE_CLKP (RCC_D3CCIPR_ADCSEL_1)
  976. #else
  977. #define LL_RCC_ADC_CLKSOURCE_PLL2P (0x00000000U)
  978. #define LL_RCC_ADC_CLKSOURCE_PLL3R (RCC_SRDCCIPR_ADCSEL_0)
  979. #define LL_RCC_ADC_CLKSOURCE_CLKP (RCC_SRDCCIPR_ADCSEL_1)
  980. #endif /* RCC_D3CCIPR_ADCSEL */
  981. /**
  982. * @}
  983. */
  984. /** @defgroup RCC_LL_EC_USARTx Peripheral USART get clock source
  985. * @{
  986. */
  987. #if defined (RCC_D2CCIP2R_USART16SEL)
  988. #define LL_RCC_USART16_CLKSOURCE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16SEL, RCC_D2CCIP2R_USART16SEL_Pos, 0x00000000U)
  989. #elif defined (RCC_D2CCIP2R_USART16910SEL)
  990. #define LL_RCC_USART16_CLKSOURCE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART16910SEL, RCC_D2CCIP2R_USART16910SEL_Pos, 0x00000000U)
  991. /* alias*/
  992. #define LL_RCC_USART16910_CLKSOURCE LL_RCC_USART16_CLKSOURCE
  993. #else
  994. #define LL_RCC_USART16_CLKSOURCE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART16910SEL, RCC_CDCCIP2R_USART16910SEL_Pos, 0x00000000U)
  995. /* alias*/
  996. #define LL_RCC_USART16910_CLKSOURCE LL_RCC_USART16_CLKSOURCE
  997. #endif /* RCC_D2CCIP2R_USART16SEL */
  998. #if defined (RCC_D2CCIP2R_USART28SEL)
  999. #define LL_RCC_USART234578_CLKSOURCE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_USART28SEL, RCC_D2CCIP2R_USART28SEL_Pos, 0x00000000U)
  1000. #else
  1001. #define LL_RCC_USART234578_CLKSOURCE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_USART234578SEL, RCC_CDCCIP2R_USART234578SEL_Pos, 0x00000000U)
  1002. #endif /* RCC_D2CCIP2R_USART28SEL */
  1003. /**
  1004. * @}
  1005. */
  1006. /** @defgroup RCC_LL_EC_LPUARTx Peripheral LPUART get clock source
  1007. * @{
  1008. */
  1009. #if defined(RCC_D3CCIPR_LPUART1SEL)
  1010. #define LL_RCC_LPUART1_CLKSOURCE RCC_D3CCIPR_LPUART1SEL
  1011. #else
  1012. #define LL_RCC_LPUART1_CLKSOURCE RCC_SRDCCIPR_LPUART1SEL
  1013. #endif /* RCC_D3CCIPR_LPUART1SEL */
  1014. /**
  1015. * @}
  1016. */
  1017. /** @defgroup RCC_LL_EC_I2Cx Peripheral I2C get clock source
  1018. * @{
  1019. */
  1020. #if defined(RCC_D2CCIP2R_I2C123SEL)
  1021. #define LL_RCC_I2C123_CLKSOURCE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C123SEL, RCC_D2CCIP2R_I2C123SEL_Pos, 0x00000000U)
  1022. /* alias */
  1023. #define LL_RCC_I2C1235_CLKSOURCE LL_RCC_I2C123_CLKSOURCE
  1024. #elif defined(RCC_D2CCIP2R_I2C1235SEL)
  1025. #define LL_RCC_I2C1235_CLKSOURCE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_I2C1235SEL, RCC_D2CCIP2R_I2C1235SEL_Pos, 0x00000000U)
  1026. /* alias */
  1027. #define LL_RCC_I2C123_CLKSOURCE LL_RCC_I2C1235_CLKSOURCE
  1028. #else
  1029. #define LL_RCC_I2C123_CLKSOURCE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_I2C123SEL, RCC_CDCCIP2R_I2C123SEL_Pos, 0x00000000U)
  1030. /* alias */
  1031. #define LL_RCC_I2C1235_CLKSOURCE LL_RCC_I2C123_CLKSOURCE
  1032. #endif /* RCC_D2CCIP2R_I2C123SEL */
  1033. #if defined(RCC_D3CCIPR_I2C4SEL)
  1034. #define LL_RCC_I2C4_CLKSOURCE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_I2C4SEL, RCC_D3CCIPR_I2C4SEL_Pos, 0x00000000U)
  1035. #else
  1036. #define LL_RCC_I2C4_CLKSOURCE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_I2C4SEL, RCC_SRDCCIPR_I2C4SEL_Pos, 0x00000000U)
  1037. #endif /* RCC_D3CCIPR_I2C4SEL */
  1038. /**
  1039. * @}
  1040. */
  1041. /** @defgroup RCC_LL_EC_LPTIMx Peripheral LPTIM get clock source
  1042. * @{
  1043. */
  1044. #if defined(RCC_D2CCIP2R_LPTIM1SEL)
  1045. #define LL_RCC_LPTIM1_CLKSOURCE LL_CLKSOURCE(D2CCIP2, RCC_D2CCIP2R_LPTIM1SEL, RCC_D2CCIP2R_LPTIM1SEL_Pos, 0x00000000U)
  1046. #else
  1047. #define LL_RCC_LPTIM1_CLKSOURCE LL_CLKSOURCE(CDCCIP2, RCC_CDCCIP2R_LPTIM1SEL, RCC_CDCCIP2R_LPTIM1SEL_Pos, 0x00000000U)
  1048. #endif /* RCC_D2CCIP2R_LPTIM1SEL) */
  1049. #if defined(RCC_D3CCIPR_LPTIM2SEL)
  1050. #define LL_RCC_LPTIM2_CLKSOURCE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM2SEL, RCC_D3CCIPR_LPTIM2SEL_Pos, 0x00000000U)
  1051. #else
  1052. #define LL_RCC_LPTIM2_CLKSOURCE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM2SEL, RCC_SRDCCIPR_LPTIM2SEL_Pos, 0x00000000U)
  1053. #endif /* RCC_D3CCIPR_LPTIM2SEL */
  1054. #if defined(RCC_D3CCIPR_LPTIM345SEL)
  1055. #define LL_RCC_LPTIM345_CLKSOURCE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_LPTIM345SEL, RCC_D3CCIPR_LPTIM345SEL_Pos, 0x00000000U)
  1056. #else
  1057. #define LL_RCC_LPTIM345_CLKSOURCE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_LPTIM3SEL, RCC_SRDCCIPR_LPTIM3SEL_Pos, 0x00000000U)
  1058. #define LL_RCC_LPTIM3_CLKSOURCE LL_RCC_LPTIM345_CLKSOURCE /* alias */
  1059. #endif /* RCC_D3CCIPR_LPTIM345SEL */
  1060. /**
  1061. * @}
  1062. */
  1063. /** @defgroup RCC_LL_EC_SAIx Peripheral SAI get clock source
  1064. * @{
  1065. */
  1066. #if defined(RCC_D2CCIP1R_SAI1SEL)
  1067. #define LL_RCC_SAI1_CLKSOURCE LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI1SEL, RCC_D2CCIP1R_SAI1SEL_Pos, 0x00000000U)
  1068. #else
  1069. #define LL_RCC_SAI1_CLKSOURCE LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI1SEL, RCC_CDCCIP1R_SAI1SEL_Pos, 0x00000000U)
  1070. #endif /* RCC_D2CCIP1R_SAI1SEL */
  1071. #if defined(RCC_D2CCIP1R_SAI23SEL)
  1072. #define LL_RCC_SAI23_CLKSOURCE LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SAI23SEL, RCC_D2CCIP1R_SAI23SEL_Pos, 0x00000000U)
  1073. #endif /* RCC_D2CCIP1R_SAI23SEL */
  1074. #if defined(RCC_CDCCIP1R_SAI2ASEL)
  1075. #define LL_RCC_SAI2A_CLKSOURCE LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2ASEL, RCC_CDCCIP1R_SAI2ASEL_Pos, 0x00000000U)
  1076. #endif /* RCC_CDCCIP1R_SAI2ASEL */
  1077. #if defined(RCC_CDCCIP1R_SAI2BSEL)
  1078. #define LL_RCC_SAI2B_CLKSOURCE LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SAI2BSEL, RCC_CDCCIP1R_SAI2BSEL_Pos, 0x00000000U)
  1079. #endif /* RCC_CDCCIP1R_SAI2BSEL */
  1080. #if defined(RCC_D3CCIPR_SAI4ASEL)
  1081. #define LL_RCC_SAI4A_CLKSOURCE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4ASEL, RCC_D3CCIPR_SAI4ASEL_Pos, 0x00000000U)
  1082. #endif /* RCC_D3CCIPR_SAI4ASEL */
  1083. #if defined(RCC_D3CCIPR_SAI4BSEL)
  1084. #define LL_RCC_SAI4B_CLKSOURCE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SAI4BSEL, RCC_D3CCIPR_SAI4BSEL_Pos, 0x00000000U)
  1085. #endif /* RCC_D3CCIPR_SAI4BSEL */
  1086. /**
  1087. * @}
  1088. */
  1089. /** @defgroup RCC_LL_EC_SDMMC Peripheral SDMMC get clock source
  1090. * @{
  1091. */
  1092. #if defined(RCC_D1CCIPR_SDMMCSEL)
  1093. #define LL_RCC_SDMMC_CLKSOURCE RCC_D1CCIPR_SDMMCSEL
  1094. #else
  1095. #define LL_RCC_SDMMC_CLKSOURCE RCC_CDCCIPR_SDMMCSEL
  1096. #endif /* RCC_D1CCIPR_SDMMCSEL */
  1097. /**
  1098. * @}
  1099. */
  1100. /** @defgroup RCC_LL_EC_RNG Peripheral RNG get clock source
  1101. * @{
  1102. */
  1103. #if (RCC_D2CCIP2R_RNGSEL)
  1104. #define LL_RCC_RNG_CLKSOURCE RCC_D2CCIP2R_RNGSEL
  1105. #else
  1106. #define LL_RCC_RNG_CLKSOURCE RCC_CDCCIP2R_RNGSEL
  1107. #endif /* RCC_D2CCIP2R_RNGSEL */
  1108. /**
  1109. * @}
  1110. */
  1111. /** @defgroup RCC_LL_EC_USB Peripheral USB get clock source
  1112. * @{
  1113. */
  1114. #if (RCC_D2CCIP2R_USBSEL)
  1115. #define LL_RCC_USB_CLKSOURCE RCC_D2CCIP2R_USBSEL
  1116. #else
  1117. #define LL_RCC_USB_CLKSOURCE RCC_CDCCIP2R_USBSEL
  1118. #endif /* RCC_D2CCIP2R_USBSEL */
  1119. /**
  1120. * @}
  1121. */
  1122. /** @defgroup RCC_LL_EC_CEC Peripheral CEC get clock source
  1123. * @{
  1124. */
  1125. #if (RCC_D2CCIP2R_CECSEL)
  1126. #define LL_RCC_CEC_CLKSOURCE RCC_D2CCIP2R_CECSEL
  1127. #else
  1128. #define LL_RCC_CEC_CLKSOURCE RCC_CDCCIP2R_CECSEL
  1129. #endif /* RCC_D2CCIP2R_CECSEL */
  1130. /**
  1131. * @}
  1132. */
  1133. #if defined(DSI)
  1134. /** @defgroup RCC_LL_EC_DSI Peripheral DSI get clock source
  1135. * @{
  1136. */
  1137. #define LL_RCC_DSI_CLKSOURCE RCC_D1CCIPR_DSISEL
  1138. /**
  1139. * @}
  1140. */
  1141. #endif /* DSI */
  1142. /** @defgroup RCC_LL_EC_DFSDM Peripheral DFSDM get clock source
  1143. * @{
  1144. */
  1145. #if defined(RCC_D2CCIP1R_DFSDM1SEL)
  1146. #define LL_RCC_DFSDM1_CLKSOURCE RCC_D2CCIP1R_DFSDM1SEL
  1147. #else
  1148. #define LL_RCC_DFSDM1_CLKSOURCE RCC_CDCCIP1R_DFSDM1SEL
  1149. #endif /* RCC_D2CCIP1R_DFSDM1SEL */
  1150. /**
  1151. * @}
  1152. */
  1153. #if defined(DFSDM2_BASE)
  1154. /** @defgroup RCC_LL_EC_DFSDM2 Peripheral DFSDM2 get clock source
  1155. * @{
  1156. */
  1157. #define LL_RCC_DFSDM2_CLKSOURCE RCC_SRDCCIPR_DFSDM2SEL
  1158. /**
  1159. * @}
  1160. */
  1161. #endif /* DFSDM2_BASE */
  1162. /** @defgroup RCC_LL_EC_FMC Peripheral FMC get clock source
  1163. * @{
  1164. */
  1165. #if defined(RCC_D1CCIPR_FMCSEL)
  1166. #define LL_RCC_FMC_CLKSOURCE RCC_D1CCIPR_FMCSEL
  1167. #else
  1168. #define LL_RCC_FMC_CLKSOURCE RCC_CDCCIPR_FMCSEL
  1169. #endif
  1170. /**
  1171. * @}
  1172. */
  1173. #if defined(QUADSPI)
  1174. /** @defgroup RCC_LL_EC_QSPI Peripheral QSPI get clock source
  1175. * @{
  1176. */
  1177. #define LL_RCC_QSPI_CLKSOURCE RCC_D1CCIPR_QSPISEL
  1178. /**
  1179. * @}
  1180. */
  1181. #endif /* QUADSPI */
  1182. #if defined(OCTOSPI1) || defined(OCTOSPI2)
  1183. /** @defgroup RCC_LL_EC_OSPI Peripheral OSPI get clock source
  1184. * @{
  1185. */
  1186. #if defined(RCC_CDCCIPR_OCTOSPISEL)
  1187. #define LL_RCC_OSPI_CLKSOURCE RCC_CDCCIPR_OCTOSPISEL
  1188. #else
  1189. #define LL_RCC_OSPI_CLKSOURCE RCC_D1CCIPR_OCTOSPISEL
  1190. #endif /* RCC_CDCCIPR_OCTOSPISEL */
  1191. /**
  1192. * @}
  1193. */
  1194. #endif /* OCTOSPI1 || OCTOSPI2 */
  1195. /** @defgroup RCC_LL_EC_CLKP Peripheral CLKP get clock source
  1196. * @{
  1197. */
  1198. #if defined(RCC_D1CCIPR_CKPERSEL)
  1199. #define LL_RCC_CLKP_CLKSOURCE RCC_D1CCIPR_CKPERSEL
  1200. #else
  1201. #define LL_RCC_CLKP_CLKSOURCE RCC_CDCCIPR_CKPERSEL
  1202. #endif /* RCC_D1CCIPR_CKPERSEL */
  1203. /**
  1204. * @}
  1205. */
  1206. /** @defgroup RCC_LL_EC_SPIx Peripheral SPI get clock source
  1207. * @{
  1208. */
  1209. #if defined(RCC_D2CCIP1R_SPI123SEL)
  1210. #define LL_RCC_SPI123_CLKSOURCE LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI123SEL, RCC_D2CCIP1R_SPI123SEL_Pos, 0x00000000U)
  1211. #else
  1212. #define LL_RCC_SPI123_CLKSOURCE LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI123SEL, RCC_CDCCIP1R_SPI123SEL_Pos, 0x00000000U)
  1213. #endif /* RCC_D2CCIP1R_SPI123SEL */
  1214. #if defined(RCC_D2CCIP1R_SPI45SEL)
  1215. #define LL_RCC_SPI45_CLKSOURCE LL_CLKSOURCE(D2CCIP1, RCC_D2CCIP1R_SPI45SEL, RCC_D2CCIP1R_SPI45SEL_Pos, 0x00000000U)
  1216. #else
  1217. #define LL_RCC_SPI45_CLKSOURCE LL_CLKSOURCE(CDCCIP1, RCC_CDCCIP1R_SPI45SEL, RCC_CDCCIP1R_SPI45SEL_Pos, 0x00000000U)
  1218. #endif /* RCC_D2CCIP1R_SPI45SEL */
  1219. #if defined(RCC_D3CCIPR_SPI6SEL)
  1220. #define LL_RCC_SPI6_CLKSOURCE LL_CLKSOURCE(D3CCIP, RCC_D3CCIPR_SPI6SEL, RCC_D3CCIPR_SPI6SEL_Pos, 0x00000000U)
  1221. #else
  1222. #define LL_RCC_SPI6_CLKSOURCE LL_CLKSOURCE(SRDCCIP, RCC_SRDCCIPR_SPI6SEL, RCC_SRDCCIPR_SPI6SEL_Pos, 0x00000000U)
  1223. #endif /* RCC_D3CCIPR_SPI6SEL */
  1224. /**
  1225. * @}
  1226. */
  1227. /** @defgroup RCC_LL_EC_SPDIF Peripheral SPDIF get clock source
  1228. * @{
  1229. */
  1230. #if defined(RCC_D2CCIP1R_SPDIFSEL)
  1231. #define LL_RCC_SPDIF_CLKSOURCE RCC_D2CCIP1R_SPDIFSEL
  1232. #else
  1233. #define LL_RCC_SPDIF_CLKSOURCE RCC_CDCCIP1R_SPDIFSEL
  1234. #endif /* RCC_D2CCIP1R_SPDIFSEL */
  1235. /**
  1236. * @}
  1237. */
  1238. #if defined(FDCAN1) || defined(FDCAN2)
  1239. /** @defgroup RCC_LL_EC_FDCAN Peripheral FDCAN get clock source
  1240. * @{
  1241. */
  1242. #if defined(RCC_D2CCIP1R_FDCANSEL)
  1243. #define LL_RCC_FDCAN_CLKSOURCE RCC_D2CCIP1R_FDCANSEL
  1244. #else
  1245. #define LL_RCC_FDCAN_CLKSOURCE RCC_CDCCIP1R_FDCANSEL
  1246. #endif
  1247. /**
  1248. * @}
  1249. */
  1250. #endif /*FDCAN1 || FDCAN2*/
  1251. /** @defgroup RCC_LL_EC_SWP Peripheral SWP get clock source
  1252. * @{
  1253. */
  1254. #if defined(RCC_D2CCIP1R_SWPSEL)
  1255. #define LL_RCC_SWP_CLKSOURCE RCC_D2CCIP1R_SWPSEL
  1256. #else
  1257. #define LL_RCC_SWP_CLKSOURCE RCC_CDCCIP1R_SWPSEL
  1258. #endif /* RCC_D2CCIP1R_SWPSEL */
  1259. /**
  1260. * @}
  1261. */
  1262. /** @defgroup RCC_LL_EC_ADC Peripheral ADC get clock source
  1263. * @{
  1264. */
  1265. #if defined(RCC_D3CCIPR_ADCSEL)
  1266. #define LL_RCC_ADC_CLKSOURCE RCC_D3CCIPR_ADCSEL
  1267. #else
  1268. #define LL_RCC_ADC_CLKSOURCE RCC_SRDCCIPR_ADCSEL
  1269. #endif /* RCC_D3CCIPR_ADCSEL */
  1270. /**
  1271. * @}
  1272. */
  1273. /** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection
  1274. * @{
  1275. */
  1276. #define LL_RCC_RTC_CLKSOURCE_NONE (uint32_t)(0x00000000U)
  1277. #define LL_RCC_RTC_CLKSOURCE_LSE (uint32_t)(RCC_BDCR_RTCSEL_0)
  1278. #define LL_RCC_RTC_CLKSOURCE_LSI (uint32_t)(RCC_BDCR_RTCSEL_1)
  1279. #define LL_RCC_RTC_CLKSOURCE_HSE (uint32_t)(RCC_BDCR_RTCSEL_0 | RCC_BDCR_RTCSEL_1)
  1280. /**
  1281. * @}
  1282. */
  1283. /** @defgroup RCC_LL_EC_TIM_CLKPRESCALER Timers clocks prescalers selection
  1284. * @{
  1285. */
  1286. #define LL_RCC_TIM_PRESCALER_TWICE (uint32_t)(0x00000000U)
  1287. #define LL_RCC_TIM_PRESCALER_FOUR_TIMES (uint32_t)(RCC_CFGR_TIMPRE)
  1288. /**
  1289. * @}
  1290. */
  1291. #if defined(HRTIM1)
  1292. /** @defgroup RCC_LL_EC_HRTIM_CLKSOURCE High Resolution Timers clock selection
  1293. * @{
  1294. */
  1295. #define LL_RCC_HRTIM_CLKSOURCE_TIM (uint32_t)(0x00000000U) /* HRTIM Clock source is same as other timers */
  1296. #define LL_RCC_HRTIM_CLKSOURCE_CPU (uint32_t)(RCC_CFGR_HRTIMSEL) /* HRTIM Clock source is the CPU clock */
  1297. /**
  1298. * @}
  1299. */
  1300. #endif /* HRTIM1 */
  1301. /** @defgroup RCC_LL_EC_PLLSOURCE All PLLs entry clock source
  1302. * @{
  1303. */
  1304. #define LL_RCC_PLLSOURCE_HSI RCC_PLLCKSELR_PLLSRC_HSI
  1305. #define LL_RCC_PLLSOURCE_CSI RCC_PLLCKSELR_PLLSRC_CSI
  1306. #define LL_RCC_PLLSOURCE_HSE RCC_PLLCKSELR_PLLSRC_HSE
  1307. #define LL_RCC_PLLSOURCE_NONE RCC_PLLCKSELR_PLLSRC_NONE
  1308. /**
  1309. * @}
  1310. */
  1311. /** @defgroup RCC_LL_EC_PLLINPUTRANGE All PLLs input range
  1312. * @{
  1313. */
  1314. #define LL_RCC_PLLINPUTRANGE_1_2 (uint32_t)(0x00000000U)
  1315. #define LL_RCC_PLLINPUTRANGE_2_4 (uint32_t)(0x00000001)
  1316. #define LL_RCC_PLLINPUTRANGE_4_8 (uint32_t)(0x00000002)
  1317. #define LL_RCC_PLLINPUTRANGE_8_16 (uint32_t)(0x00000003)
  1318. /**
  1319. * @}
  1320. */
  1321. /** @defgroup RCC_LL_EC_PLLVCORANGE All PLLs VCO range
  1322. * @{
  1323. */
  1324. #define LL_RCC_PLLVCORANGE_WIDE (uint32_t)(0x00000000U) /* VCO output range: 192 to 836 MHz OR 128 to 544 MHz (*) */
  1325. #define LL_RCC_PLLVCORANGE_MEDIUM (uint32_t)(0x00000001) /* VCO output range: 150 to 420 MHz */
  1326. /**
  1327. * (*) : For stm32h7a3xx and stm32h7b3xx family lines.
  1328. * @}
  1329. */
  1330. /**
  1331. * @}
  1332. */
  1333. /* Exported macro ------------------------------------------------------------*/
  1334. /** @defgroup RCC_LL_Exported_Macros RCC Exported Macros
  1335. * @{
  1336. */
  1337. /** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros
  1338. * @{
  1339. */
  1340. /**
  1341. * @brief Write a value in RCC register
  1342. * @param __REG__ Register to be written
  1343. * @param __VALUE__ Value to be written in the register
  1344. * @retval None
  1345. */
  1346. #define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, (__VALUE__))
  1347. /**
  1348. * @brief Read a value in RCC register
  1349. * @param __REG__ Register to be read
  1350. * @retval Register value
  1351. */
  1352. #define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__)
  1353. /**
  1354. * @}
  1355. */
  1356. /** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies
  1357. * @{
  1358. */
  1359. /**
  1360. * @brief Helper macro to calculate the SYSCLK frequency
  1361. * @param __SYSINPUTCLKFREQ__ Frequency of the input of sys_ck (based on HSE/CSI/HSI/PLL1P)
  1362. * @param __SYSPRESCALER__ This parameter can be one of the following values:
  1363. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1364. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1365. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1366. * @arg @ref LL_RCC_SYSCLK_DIV_8
  1367. * @arg @ref LL_RCC_SYSCLK_DIV_16
  1368. * @arg @ref LL_RCC_SYSCLK_DIV_64
  1369. * @arg @ref LL_RCC_SYSCLK_DIV_128
  1370. * @arg @ref LL_RCC_SYSCLK_DIV_256
  1371. * @arg @ref LL_RCC_SYSCLK_DIV_512
  1372. * @retval SYSCLK clock frequency (in Hz)
  1373. */
  1374. #if defined(RCC_D1CFGR_D1CPRE)
  1375. #define LL_RCC_CALC_SYSCLK_FREQ(__SYSINPUTCLKFREQ__, __SYSPRESCALER__) ((__SYSINPUTCLKFREQ__) >> ((LL_RCC_PrescTable[((__SYSPRESCALER__) & RCC_D1CFGR_D1CPRE) >> RCC_D1CFGR_D1CPRE_Pos]) & 0x1FU))
  1376. #else
  1377. #define LL_RCC_CALC_SYSCLK_FREQ(__SYSINPUTCLKFREQ__, __SYSPRESCALER__) ((__SYSINPUTCLKFREQ__) >> ((LL_RCC_PrescTable[((__SYSPRESCALER__) & RCC_CDCFGR1_CDCPRE) >> RCC_CDCFGR1_CDCPRE_Pos]) & 0x1FU))
  1378. #endif /* RCC_D1CFGR_D1CPRE */
  1379. /**
  1380. * @brief Helper macro to calculate the HCLK frequency
  1381. * @param __SYSCLKFREQ__ SYSCLK frequency.
  1382. * @param __HPRESCALER__ This parameter can be one of the following values:
  1383. * @arg @ref LL_RCC_AHB_DIV_1
  1384. * @arg @ref LL_RCC_AHB_DIV_2
  1385. * @arg @ref LL_RCC_AHB_DIV_4
  1386. * @arg @ref LL_RCC_AHB_DIV_8
  1387. * @arg @ref LL_RCC_AHB_DIV_16
  1388. * @arg @ref LL_RCC_AHB_DIV_64
  1389. * @arg @ref LL_RCC_AHB_DIV_128
  1390. * @arg @ref LL_RCC_AHB_DIV_256
  1391. * @arg @ref LL_RCC_AHB_DIV_512
  1392. * @retval HCLK clock frequency (in Hz)
  1393. */
  1394. #if defined(RCC_D1CFGR_HPRE)
  1395. #define LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __HPRESCALER__) ((__SYSCLKFREQ__) >> ((LL_RCC_PrescTable[((__HPRESCALER__) & RCC_D1CFGR_HPRE) >> RCC_D1CFGR_HPRE_Pos]) & 0x1FU))
  1396. #else
  1397. #define LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __HPRESCALER__) ((__SYSCLKFREQ__) >> ((LL_RCC_PrescTable[((__HPRESCALER__) & RCC_CDCFGR1_HPRE) >> RCC_CDCFGR1_HPRE_Pos]) & 0x1FU))
  1398. #endif /* RCC_D1CFGR_HPRE */
  1399. /**
  1400. * @brief Helper macro to calculate the PCLK1 frequency (ABP1)
  1401. * @param __HCLKFREQ__ HCLK frequency
  1402. * @param __APB1PRESCALER__ This parameter can be one of the following values:
  1403. * @arg @ref LL_RCC_APB1_DIV_1
  1404. * @arg @ref LL_RCC_APB1_DIV_2
  1405. * @arg @ref LL_RCC_APB1_DIV_4
  1406. * @arg @ref LL_RCC_APB1_DIV_8
  1407. * @arg @ref LL_RCC_APB1_DIV_16
  1408. * @retval PCLK1 clock frequency (in Hz)
  1409. */
  1410. #if defined(RCC_D2CFGR_D2PPRE1)
  1411. #define LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB1PRESCALER__) & RCC_D2CFGR_D2PPRE1) >> RCC_D2CFGR_D2PPRE1_Pos]) & 0x1FU))
  1412. #else
  1413. #define LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB1PRESCALER__) & RCC_CDCFGR2_CDPPRE1) >> RCC_CDCFGR2_CDPPRE1_Pos]) & 0x1FU))
  1414. #endif /* RCC_D2CFGR_D2PPRE1 */
  1415. /**
  1416. * @brief Helper macro to calculate the PCLK2 frequency (ABP2)
  1417. * @param __HCLKFREQ__ HCLK frequency
  1418. * @param __APB2PRESCALER__ This parameter can be one of the following values:
  1419. * @arg @ref LL_RCC_APB2_DIV_1
  1420. * @arg @ref LL_RCC_APB2_DIV_2
  1421. * @arg @ref LL_RCC_APB2_DIV_4
  1422. * @arg @ref LL_RCC_APB2_DIV_8
  1423. * @arg @ref LL_RCC_APB2_DIV_16
  1424. * @retval PCLK2 clock frequency (in Hz)
  1425. */
  1426. #if defined(RCC_D2CFGR_D2PPRE2)
  1427. #define LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB2PRESCALER__) & RCC_D2CFGR_D2PPRE2) >> RCC_D2CFGR_D2PPRE2_Pos]) & 0x1FU))
  1428. #else
  1429. #define LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB2PRESCALER__) & RCC_CDCFGR2_CDPPRE2) >> RCC_CDCFGR2_CDPPRE2_Pos]) & 0x1FU))
  1430. #endif /* RCC_D2CFGR_D2PPRE2 */
  1431. /**
  1432. * @brief Helper macro to calculate the PCLK3 frequency (APB3)
  1433. * @param __HCLKFREQ__ HCLK frequency
  1434. * @param __APB3PRESCALER__ This parameter can be one of the following values:
  1435. * @arg @ref LL_RCC_APB3_DIV_1
  1436. * @arg @ref LL_RCC_APB3_DIV_2
  1437. * @arg @ref LL_RCC_APB3_DIV_4
  1438. * @arg @ref LL_RCC_APB3_DIV_8
  1439. * @arg @ref LL_RCC_APB3_DIV_16
  1440. * @retval PCLK1 clock frequency (in Hz)
  1441. */
  1442. #if defined(RCC_D1CFGR_D1PPRE)
  1443. #define LL_RCC_CALC_PCLK3_FREQ(__HCLKFREQ__, __APB3PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB3PRESCALER__) & RCC_D1CFGR_D1PPRE) >> RCC_D1CFGR_D1PPRE_Pos]) & 0x1FU))
  1444. #else
  1445. #define LL_RCC_CALC_PCLK3_FREQ(__HCLKFREQ__, __APB3PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB3PRESCALER__) & RCC_CDCFGR1_CDPPRE) >> RCC_CDCFGR1_CDPPRE_Pos]) & 0x1FU))
  1446. #endif /* RCC_D1CFGR_D1PPRE */
  1447. /**
  1448. * @brief Helper macro to calculate the PCLK4 frequency (ABP4)
  1449. * @param __HCLKFREQ__ HCLK frequency
  1450. * @param __APB4PRESCALER__ This parameter can be one of the following values:
  1451. * @arg @ref LL_RCC_APB4_DIV_1
  1452. * @arg @ref LL_RCC_APB4_DIV_2
  1453. * @arg @ref LL_RCC_APB4_DIV_4
  1454. * @arg @ref LL_RCC_APB4_DIV_8
  1455. * @arg @ref LL_RCC_APB4_DIV_16
  1456. * @retval PCLK1 clock frequency (in Hz)
  1457. */
  1458. #if defined(RCC_D3CFGR_D3PPRE)
  1459. #define LL_RCC_CALC_PCLK4_FREQ(__HCLKFREQ__, __APB4PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB4PRESCALER__) & RCC_D3CFGR_D3PPRE) >> RCC_D3CFGR_D3PPRE_Pos]) & 0x1FU))
  1460. #else
  1461. #define LL_RCC_CALC_PCLK4_FREQ(__HCLKFREQ__, __APB4PRESCALER__) ((__HCLKFREQ__) >> ((LL_RCC_PrescTable[((__APB4PRESCALER__) & RCC_SRDCFGR_SRDPPRE) >> RCC_SRDCFGR_SRDPPRE_Pos]) & 0x1FU))
  1462. #endif /* RCC_D3CFGR_D3PPRE */
  1463. /**
  1464. * @}
  1465. */
  1466. #if defined(USE_FULL_LL_DRIVER)
  1467. /** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency
  1468. * @{
  1469. */
  1470. #define LL_RCC_PERIPH_FREQUENCY_NO 0x00000000U /*!< No clock enabled for the peripheral */
  1471. #define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFU /*!< Frequency cannot be provided as external clock */
  1472. /**
  1473. * @}
  1474. */
  1475. #endif /* USE_FULL_LL_DRIVER */
  1476. /**
  1477. * @}
  1478. */
  1479. /* Exported functions --------------------------------------------------------*/
  1480. /** @defgroup RCC_LL_Exported_Functions RCC Exported Functions
  1481. * @{
  1482. */
  1483. /** @defgroup RCC_LL_EF_HSE HSE
  1484. * @{
  1485. */
  1486. /**
  1487. * @brief Enable the Clock Security System.
  1488. * @note Once HSE Clock Security System is enabled it cannot be changed anymore unless
  1489. * a reset occurs or system enter in standby mode.
  1490. * @rmtoll CR CSSHSEON LL_RCC_HSE_EnableCSS
  1491. * @retval None
  1492. */
  1493. __STATIC_INLINE void LL_RCC_HSE_EnableCSS(void)
  1494. {
  1495. SET_BIT(RCC->CR, RCC_CR_CSSHSEON);
  1496. }
  1497. /**
  1498. * @brief Enable HSE external oscillator (HSE Bypass)
  1499. * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass
  1500. * @retval None
  1501. */
  1502. __STATIC_INLINE void LL_RCC_HSE_EnableBypass(void)
  1503. {
  1504. SET_BIT(RCC->CR, RCC_CR_HSEBYP);
  1505. }
  1506. /**
  1507. * @brief Disable HSE external oscillator (HSE Bypass)
  1508. * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass
  1509. * @retval None
  1510. */
  1511. __STATIC_INLINE void LL_RCC_HSE_DisableBypass(void)
  1512. {
  1513. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);
  1514. }
  1515. #if defined(RCC_CR_HSEEXT)
  1516. /**
  1517. * @brief Select the Analog HSE external clock type in Bypass mode
  1518. * @rmtoll CR HSEEXT LL_RCC_HSE_SelectAnalogClock
  1519. * @retval None
  1520. */
  1521. __STATIC_INLINE void LL_RCC_HSE_SelectAnalogClock(void)
  1522. {
  1523. CLEAR_BIT(RCC->CR, RCC_CR_HSEEXT);
  1524. }
  1525. /**
  1526. * @brief Select the Digital HSE external clock type in Bypass mode
  1527. * @rmtoll CR HSEEXT LL_RCC_HSE_SelectDigitalClock
  1528. * @retval None
  1529. */
  1530. __STATIC_INLINE void LL_RCC_HSE_SelectDigitalClock(void)
  1531. {
  1532. SET_BIT(RCC->CR, RCC_CR_HSEEXT);
  1533. }
  1534. #endif /* RCC_CR_HSEEXT */
  1535. /**
  1536. * @brief Enable HSE crystal oscillator (HSE ON)
  1537. * @rmtoll CR HSEON LL_RCC_HSE_Enable
  1538. * @retval None
  1539. */
  1540. __STATIC_INLINE void LL_RCC_HSE_Enable(void)
  1541. {
  1542. SET_BIT(RCC->CR, RCC_CR_HSEON);
  1543. }
  1544. /**
  1545. * @brief Disable HSE crystal oscillator (HSE ON)
  1546. * @rmtoll CR HSEON LL_RCC_HSE_Disable
  1547. * @retval None
  1548. */
  1549. __STATIC_INLINE void LL_RCC_HSE_Disable(void)
  1550. {
  1551. CLEAR_BIT(RCC->CR, RCC_CR_HSEON);
  1552. }
  1553. /**
  1554. * @brief Check if HSE oscillator Ready
  1555. * @rmtoll CR HSERDY LL_RCC_HSE_IsReady
  1556. * @retval State of bit (1 or 0).
  1557. */
  1558. __STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void)
  1559. {
  1560. return ((READ_BIT(RCC->CR, RCC_CR_HSERDY) == (RCC_CR_HSERDY)) ? 1UL : 0UL);
  1561. }
  1562. /**
  1563. * @}
  1564. */
  1565. /** @defgroup RCC_LL_EF_HSI HSI
  1566. * @{
  1567. */
  1568. /**
  1569. * @brief Enable HSI oscillator
  1570. * @rmtoll CR HSION LL_RCC_HSI_Enable
  1571. * @retval None
  1572. */
  1573. __STATIC_INLINE void LL_RCC_HSI_Enable(void)
  1574. {
  1575. SET_BIT(RCC->CR, RCC_CR_HSION);
  1576. }
  1577. /**
  1578. * @brief Disable HSI oscillator
  1579. * @rmtoll CR HSION LL_RCC_HSI_Disable
  1580. * @retval None
  1581. */
  1582. __STATIC_INLINE void LL_RCC_HSI_Disable(void)
  1583. {
  1584. CLEAR_BIT(RCC->CR, RCC_CR_HSION);
  1585. }
  1586. /**
  1587. * @brief Check if HSI clock is ready
  1588. * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady
  1589. * @retval State of bit (1 or 0).
  1590. */
  1591. __STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
  1592. {
  1593. return ((READ_BIT(RCC->CR, RCC_CR_HSIRDY) == (RCC_CR_HSIRDY)) ? 1UL : 0UL);
  1594. }
  1595. /**
  1596. * @brief Check if HSI new divider applied and ready
  1597. * @rmtoll CR HSIDIVF LL_RCC_HSI_IsDividerReady
  1598. * @retval State of bit (1 or 0).
  1599. */
  1600. __STATIC_INLINE uint32_t LL_RCC_HSI_IsDividerReady(void)
  1601. {
  1602. return ((READ_BIT(RCC->CR, RCC_CR_HSIDIVF) == (RCC_CR_HSIDIVF)) ? 1UL : 0UL);
  1603. }
  1604. /**
  1605. * @brief Set HSI divider
  1606. * @rmtoll CR HSIDIV LL_RCC_HSI_SetDivider
  1607. * @param Divider This parameter can be one of the following values:
  1608. * @arg @ref LL_RCC_HSI_DIV1
  1609. * @arg @ref LL_RCC_HSI_DIV2
  1610. * @arg @ref LL_RCC_HSI_DIV4
  1611. * @arg @ref LL_RCC_HSI_DIV8
  1612. * @retval None.
  1613. */
  1614. __STATIC_INLINE void LL_RCC_HSI_SetDivider(uint32_t Divider)
  1615. {
  1616. MODIFY_REG(RCC->CR, RCC_CR_HSIDIV, Divider);
  1617. }
  1618. /**
  1619. * @brief Get HSI divider
  1620. * @rmtoll CR HSIDIV LL_RCC_HSI_GetDivider
  1621. * @retval can be one of the following values:
  1622. * @arg @ref LL_RCC_HSI_DIV1
  1623. * @arg @ref LL_RCC_HSI_DIV2
  1624. * @arg @ref LL_RCC_HSI_DIV4
  1625. * @arg @ref LL_RCC_HSI_DIV8
  1626. */
  1627. __STATIC_INLINE uint32_t LL_RCC_HSI_GetDivider(void)
  1628. {
  1629. return (READ_BIT(RCC->CR, RCC_CR_HSIDIV));
  1630. }
  1631. /**
  1632. * @brief Enable HSI oscillator in Stop mode
  1633. * @rmtoll CR HSIKERON LL_RCC_HSI_EnableStopMode
  1634. * @retval None
  1635. */
  1636. __STATIC_INLINE void LL_RCC_HSI_EnableStopMode(void)
  1637. {
  1638. SET_BIT(RCC->CR, RCC_CR_HSIKERON);
  1639. }
  1640. /**
  1641. * @brief Disable HSI oscillator in Stop mode
  1642. * @rmtoll CR HSION LL_RCC_HSI_DisableStopMode
  1643. * @retval None
  1644. */
  1645. __STATIC_INLINE void LL_RCC_HSI_DisableStopMode(void)
  1646. {
  1647. CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON);
  1648. }
  1649. /**
  1650. * @brief Get HSI Calibration value
  1651. * @note When HSITRIM is written, HSICAL is updated with the sum of
  1652. * HSITRIM and the factory trim value
  1653. * @rmtoll HSICFGR HSICAL LL_RCC_HSI_GetCalibration
  1654. * @retval A value between 0 and 4095 (0xFFF)
  1655. */
  1656. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void)
  1657. {
  1658. return (uint32_t)(READ_BIT(RCC->HSICFGR, RCC_HSICFGR_HSICAL) >> RCC_HSICFGR_HSICAL_Pos);
  1659. }
  1660. /**
  1661. * @brief Set HSI Calibration trimming
  1662. * @note user-programmable trimming value that is added to the HSICAL
  1663. * @note Default value is 64 (32 for Cut1.x), which, when added to the HSICAL value,
  1664. * should trim the HSI to 64 MHz +/- 1 %
  1665. * @rmtoll HSICFGR HSITRIM LL_RCC_HSI_SetCalibTrimming
  1666. * @param Value can be a value between 0 and 127 (63 for Cut1.x)
  1667. * @retval None
  1668. */
  1669. __STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value)
  1670. {
  1671. #if defined(RCC_VER_X)
  1672. if ((DBGMCU->IDCODE & 0xF0000000U) == 0x10000000U)
  1673. {
  1674. /* STM32H7 Rev.Y */
  1675. MODIFY_REG(RCC->HSICFGR, 0x3F000U, Value << 12U);
  1676. }
  1677. else
  1678. {
  1679. /* STM32H7 Rev.V */
  1680. MODIFY_REG(RCC->HSICFGR, RCC_HSICFGR_HSITRIM, Value << RCC_HSICFGR_HSITRIM_Pos);
  1681. }
  1682. #else
  1683. MODIFY_REG(RCC->HSICFGR, RCC_HSICFGR_HSITRIM, Value << RCC_HSICFGR_HSITRIM_Pos);
  1684. #endif /* RCC_VER_X */
  1685. }
  1686. /**
  1687. * @brief Get HSI Calibration trimming
  1688. * @rmtoll HSICFGR HSITRIM LL_RCC_HSI_GetCalibTrimming
  1689. * @retval A value between 0 and 127 (63 for Cut1.x)
  1690. */
  1691. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void)
  1692. {
  1693. #if defined(RCC_VER_X)
  1694. if ((DBGMCU->IDCODE & 0xF0000000U) == 0x10000000U)
  1695. {
  1696. /* STM32H7 Rev.Y */
  1697. return (uint32_t)(READ_BIT(RCC->HSICFGR, 0x3F000U) >> 12U);
  1698. }
  1699. else
  1700. {
  1701. /* STM32H7 Rev.V */
  1702. return (uint32_t)(READ_BIT(RCC->HSICFGR, RCC_HSICFGR_HSITRIM) >> RCC_HSICFGR_HSITRIM_Pos);
  1703. }
  1704. #else
  1705. return (uint32_t)(READ_BIT(RCC->HSICFGR, RCC_HSICFGR_HSITRIM) >> RCC_HSICFGR_HSITRIM_Pos);
  1706. #endif /* RCC_VER_X */
  1707. }
  1708. /**
  1709. * @}
  1710. */
  1711. /** @defgroup RCC_LL_EF_CSI CSI
  1712. * @{
  1713. */
  1714. /**
  1715. * @brief Enable CSI oscillator
  1716. * @rmtoll CR CSION LL_RCC_CSI_Enable
  1717. * @retval None
  1718. */
  1719. __STATIC_INLINE void LL_RCC_CSI_Enable(void)
  1720. {
  1721. SET_BIT(RCC->CR, RCC_CR_CSION);
  1722. }
  1723. /**
  1724. * @brief Disable CSI oscillator
  1725. * @rmtoll CR CSION LL_RCC_CSI_Disable
  1726. * @retval None
  1727. */
  1728. __STATIC_INLINE void LL_RCC_CSI_Disable(void)
  1729. {
  1730. CLEAR_BIT(RCC->CR, RCC_CR_CSION);
  1731. }
  1732. /**
  1733. * @brief Check if CSI clock is ready
  1734. * @rmtoll CR CSIRDY LL_RCC_CSI_IsReady
  1735. * @retval State of bit (1 or 0).
  1736. */
  1737. __STATIC_INLINE uint32_t LL_RCC_CSI_IsReady(void)
  1738. {
  1739. return ((READ_BIT(RCC->CR, RCC_CR_CSIRDY) == (RCC_CR_CSIRDY)) ? 1UL : 0UL);
  1740. }
  1741. /**
  1742. * @brief Enable CSI oscillator in Stop mode
  1743. * @rmtoll CR CSIKERON LL_RCC_CSI_EnableStopMode
  1744. * @retval None
  1745. */
  1746. __STATIC_INLINE void LL_RCC_CSI_EnableStopMode(void)
  1747. {
  1748. SET_BIT(RCC->CR, RCC_CR_CSIKERON);
  1749. }
  1750. /**
  1751. * @brief Disable CSI oscillator in Stop mode
  1752. * @rmtoll CR CSIKERON LL_RCC_CSI_DisableStopMode
  1753. * @retval None
  1754. */
  1755. __STATIC_INLINE void LL_RCC_CSI_DisableStopMode(void)
  1756. {
  1757. CLEAR_BIT(RCC->CR, RCC_CR_CSIKERON);
  1758. }
  1759. /**
  1760. * @brief Get CSI Calibration value
  1761. * @note When CSITRIM is written, CSICAL is updated with the sum of
  1762. * CSITRIM and the factory trim value
  1763. * @rmtoll CSICFGR CSICAL LL_RCC_CSI_GetCalibration
  1764. * @retval A value between 0 and 255 (0xFF)
  1765. */
  1766. __STATIC_INLINE uint32_t LL_RCC_CSI_GetCalibration(void)
  1767. {
  1768. #if defined(RCC_VER_X)
  1769. if ((DBGMCU->IDCODE & 0xF0000000U) == 0x10000000U)
  1770. {
  1771. /* STM32H7 Rev.Y */
  1772. return (uint32_t)(READ_BIT(RCC->HSICFGR, 0x3FC0000U) >> 18U);
  1773. }
  1774. else
  1775. {
  1776. /* STM32H7 Rev.V */
  1777. return (uint32_t)(READ_BIT(RCC->CSICFGR, RCC_CSICFGR_CSICAL) >> RCC_CSICFGR_CSICAL_Pos);
  1778. }
  1779. #else
  1780. return (uint32_t)(READ_BIT(RCC->CSICFGR, RCC_CSICFGR_CSICAL) >> RCC_CSICFGR_CSICAL_Pos);
  1781. #endif /* RCC_VER_X */
  1782. }
  1783. /**
  1784. * @brief Set CSI Calibration trimming
  1785. * @note user-programmable trimming value that is added to the CSICAL
  1786. * @note Default value is 16, which, when added to the CSICAL value,
  1787. * should trim the CSI to 4 MHz +/- 1 %
  1788. * @rmtoll CSICFGR CSITRIM LL_RCC_CSI_SetCalibTrimming
  1789. * @param Value can be a value between 0 and 31
  1790. * @retval None
  1791. */
  1792. __STATIC_INLINE void LL_RCC_CSI_SetCalibTrimming(uint32_t Value)
  1793. {
  1794. #if defined(RCC_VER_X)
  1795. if ((DBGMCU->IDCODE & 0xF0000000U) == 0x10000000U)
  1796. {
  1797. /* STM32H7 Rev.Y */
  1798. MODIFY_REG(RCC->HSICFGR, 0x7C000000U, Value << 26U);
  1799. }
  1800. else
  1801. {
  1802. /* STM32H7 Rev.V */
  1803. MODIFY_REG(RCC->CSICFGR, RCC_CSICFGR_CSITRIM, Value << RCC_CSICFGR_CSITRIM_Pos);
  1804. }
  1805. #else
  1806. MODIFY_REG(RCC->CSICFGR, RCC_CSICFGR_CSITRIM, Value << RCC_CSICFGR_CSITRIM_Pos);
  1807. #endif /* RCC_VER_X */
  1808. }
  1809. /**
  1810. * @brief Get CSI Calibration trimming
  1811. * @rmtoll CSICFGR CSITRIM LL_RCC_CSI_GetCalibTrimming
  1812. * @retval A value between 0 and 31
  1813. */
  1814. __STATIC_INLINE uint32_t LL_RCC_CSI_GetCalibTrimming(void)
  1815. {
  1816. #if defined(RCC_VER_X)
  1817. if ((DBGMCU->IDCODE & 0xF0000000U) == 0x10000000U)
  1818. {
  1819. /* STM32H7 Rev.Y */
  1820. return (uint32_t)(READ_BIT(RCC->HSICFGR, 0x7C000000U) >> 26U);
  1821. }
  1822. else
  1823. {
  1824. /* STM32H7 Rev.V */
  1825. return (uint32_t)(READ_BIT(RCC->CSICFGR, RCC_CSICFGR_CSITRIM) >> RCC_CSICFGR_CSITRIM_Pos);
  1826. }
  1827. #else
  1828. return (uint32_t)(READ_BIT(RCC->CSICFGR, RCC_CSICFGR_CSITRIM) >> RCC_CSICFGR_CSITRIM_Pos);
  1829. #endif /* RCC_VER_X */
  1830. }
  1831. /**
  1832. * @}
  1833. */
  1834. /** @defgroup RCC_LL_EF_HSI48 HSI48
  1835. * @{
  1836. */
  1837. /**
  1838. * @brief Enable HSI48 oscillator
  1839. * @rmtoll CR HSI48ON LL_RCC_HSI48_Enable
  1840. * @retval None
  1841. */
  1842. __STATIC_INLINE void LL_RCC_HSI48_Enable(void)
  1843. {
  1844. SET_BIT(RCC->CR, RCC_CR_HSI48ON);
  1845. }
  1846. /**
  1847. * @brief Disable HSI48 oscillator
  1848. * @rmtoll CR HSI48ON LL_RCC_HSI48_Disable
  1849. * @retval None
  1850. */
  1851. __STATIC_INLINE void LL_RCC_HSI48_Disable(void)
  1852. {
  1853. CLEAR_BIT(RCC->CR, RCC_CR_HSI48ON);
  1854. }
  1855. /**
  1856. * @brief Check if HSI48 clock is ready
  1857. * @rmtoll CR HSI48RDY LL_RCC_HSI48_IsReady
  1858. * @retval State of bit (1 or 0).
  1859. */
  1860. __STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
  1861. {
  1862. return ((READ_BIT(RCC->CR, RCC_CR_HSI48RDY) == (RCC_CR_HSI48RDY)) ? 1UL : 0UL);
  1863. }
  1864. /**
  1865. * @brief Get HSI48 Calibration value
  1866. * @note When HSI48TRIM is written, HSI48CAL is updated with the sum of
  1867. * HSI48TRIM and the factory trim value
  1868. * @rmtoll CRRCR HSI48CAL LL_RCC_HSI48_GetCalibration
  1869. * @retval A value between 0 and 1023 (0x3FF)
  1870. */
  1871. __STATIC_INLINE uint32_t LL_RCC_HSI48_GetCalibration(void)
  1872. {
  1873. return (uint32_t)(READ_BIT(RCC->CRRCR, RCC_CRRCR_HSI48CAL) >> RCC_CRRCR_HSI48CAL_Pos);
  1874. }
  1875. /**
  1876. * @}
  1877. */
  1878. #if defined(RCC_CR_D1CKRDY)
  1879. /** @defgroup RCC_LL_EF_D1CLK D1CKREADY
  1880. * @{
  1881. */
  1882. /**
  1883. * @brief Check if D1 clock is ready
  1884. * @rmtoll CR D1CKRDY LL_RCC_D1CK_IsReady
  1885. * @retval State of bit (1 or 0).
  1886. */
  1887. __STATIC_INLINE uint32_t LL_RCC_D1CK_IsReady(void)
  1888. {
  1889. return ((READ_BIT(RCC->CR, RCC_CR_D1CKRDY) == (RCC_CR_D1CKRDY)) ? 1UL : 0UL);
  1890. }
  1891. /**
  1892. * @}
  1893. */
  1894. #else
  1895. /** @defgroup RCC_LL_EF_CPUCLK CPUCKREADY
  1896. * @{
  1897. */
  1898. /**
  1899. * @brief Check if CPU clock is ready
  1900. * @rmtoll CR CPUCKRDY LL_RCC_CPUCK_IsReady
  1901. * @retval State of bit (1 or 0).
  1902. */
  1903. __STATIC_INLINE uint32_t LL_RCC_CPUCK_IsReady(void)
  1904. {
  1905. return ((READ_BIT(RCC->CR, RCC_CR_CPUCKRDY) == (RCC_CR_CPUCKRDY)) ? 1UL : 0UL);
  1906. }
  1907. /* alias */
  1908. #define LL_RCC_D1CK_IsReady LL_RCC_CPUCK_IsReady
  1909. /**
  1910. * @}
  1911. */
  1912. #endif /* RCC_CR_D1CKRDY */
  1913. #if defined(RCC_CR_D2CKRDY)
  1914. /** @defgroup RCC_LL_EF_D2CLK D2CKREADY
  1915. * @{
  1916. */
  1917. /**
  1918. * @brief Check if D2 clock is ready
  1919. * @rmtoll CR D2CKRDY LL_RCC_D2CK_IsReady
  1920. * @retval State of bit (1 or 0).
  1921. */
  1922. __STATIC_INLINE uint32_t LL_RCC_D2CK_IsReady(void)
  1923. {
  1924. return ((READ_BIT(RCC->CR, RCC_CR_D2CKRDY) == (RCC_CR_D2CKRDY)) ? 1UL : 0UL);
  1925. }
  1926. /**
  1927. * @}
  1928. */
  1929. #else
  1930. /** @defgroup RCC_LL_EF_CDCLK CDCKREADY
  1931. * @{
  1932. */
  1933. /**
  1934. * @brief Check if CD clock is ready
  1935. * @rmtoll CR CDCKRDY LL_RCC_CDCK_IsReady
  1936. * @retval State of bit (1 or 0).
  1937. */
  1938. __STATIC_INLINE uint32_t LL_RCC_CDCK_IsReady(void)
  1939. {
  1940. return ((READ_BIT(RCC->CR, RCC_CR_CDCKRDY) == (RCC_CR_CDCKRDY)) ? 1UL : 0UL);
  1941. }
  1942. #define LL_RCC_D2CK_IsReady LL_RCC_CDCK_IsReady
  1943. /**
  1944. * @}
  1945. */
  1946. #endif /* RCC_CR_D2CKRDY */
  1947. /** @defgroup RCC_LL_EF_SYSTEM_WIDE_RESET RESET
  1948. * @{
  1949. */
  1950. #if defined(RCC_GCR_WW1RSC)
  1951. /**
  1952. * @brief Enable system wide reset for Window Watch Dog 1
  1953. * @rmtoll GCR WW1RSC LL_RCC_WWDG1_EnableSystemReset
  1954. * @retval None.
  1955. */
  1956. __STATIC_INLINE void LL_RCC_WWDG1_EnableSystemReset(void)
  1957. {
  1958. SET_BIT(RCC->GCR, RCC_GCR_WW1RSC);
  1959. }
  1960. /**
  1961. * @brief Check if Window Watch Dog 1 reset is system wide
  1962. * @rmtoll GCR WW1RSC LL_RCC_WWDG1_IsSystemReset
  1963. * @retval State of bit (1 or 0).
  1964. */
  1965. __STATIC_INLINE uint32_t LL_RCC_WWDG1_IsSystemReset(void)
  1966. {
  1967. return ((READ_BIT(RCC->GCR, RCC_GCR_WW1RSC) == RCC_GCR_WW1RSC) ? 1UL : 0UL);
  1968. }
  1969. #endif /* RCC_GCR_WW1RSC */
  1970. #if defined(DUAL_CORE)
  1971. /**
  1972. * @brief Enable system wide reset for Window Watch Dog 2
  1973. * @rmtoll GCR WW1RSC LL_RCC_WWDG2_EnableSystemReset
  1974. * @retval None.
  1975. */
  1976. __STATIC_INLINE void LL_RCC_WWDG2_EnableSystemReset(void)
  1977. {
  1978. SET_BIT(RCC->GCR, RCC_GCR_WW2RSC);
  1979. }
  1980. /**
  1981. * @brief Check if Window Watch Dog 2 reset is system wide
  1982. * @rmtoll GCR WW2RSC LL_RCC_WWDG2_IsSystemReset
  1983. * @retval State of bit (1 or 0).
  1984. */
  1985. __STATIC_INLINE uint32_t LL_RCC_WWDG2_IsSystemReset(void)
  1986. {
  1987. return ((READ_BIT(RCC->GCR, RCC_GCR_WW2RSC) == RCC_GCR_WW2RSC) ? 1UL : 0UL);
  1988. }
  1989. #endif /*DUAL_CORE*/
  1990. /**
  1991. * @}
  1992. */
  1993. #if defined(DUAL_CORE)
  1994. /** @defgroup RCC_LL_EF_BOOT_CPU CPU
  1995. * @{
  1996. */
  1997. /**
  1998. * @brief Force CM4 boot (if hold by option byte BCM4 = 0)
  1999. * @rmtoll GCR BOOT_C2 LL_RCC_ForceCM4Boot
  2000. * @retval None.
  2001. */
  2002. __STATIC_INLINE void LL_RCC_ForceCM4Boot(void)
  2003. {
  2004. SET_BIT(RCC->GCR, RCC_GCR_BOOT_C2);
  2005. }
  2006. /**
  2007. * @brief Check if CM4 boot is forced
  2008. * @rmtoll GCR BOOT_C2 LL_RCC_IsCM4BootForced
  2009. * @retval State of bit (1 or 0).
  2010. */
  2011. __STATIC_INLINE uint32_t LL_RCC_IsCM4BootForced(void)
  2012. {
  2013. return ((READ_BIT(RCC->GCR, RCC_GCR_BOOT_C2) == RCC_GCR_BOOT_C2) ? 1UL : 0UL);
  2014. }
  2015. /**
  2016. * @brief Force CM7 boot (if hold by option byte BCM7 = 0)
  2017. * @rmtoll GCR BOOT_C1 LL_RCC_ForceCM7Boot
  2018. * @retval None.
  2019. */
  2020. __STATIC_INLINE void LL_RCC_ForceCM7Boot(void)
  2021. {
  2022. SET_BIT(RCC->GCR, RCC_GCR_BOOT_C1);
  2023. }
  2024. /**
  2025. * @brief Check if CM7 boot is forced
  2026. * @rmtoll GCR BOOT_C1 LL_RCC_IsCM7BootForced
  2027. * @retval State of bit (1 or 0).
  2028. */
  2029. __STATIC_INLINE uint32_t LL_RCC_IsCM7BootForced(void)
  2030. {
  2031. return ((READ_BIT(RCC->GCR, RCC_GCR_BOOT_C1) == RCC_GCR_BOOT_C1) ? 1UL : 0UL);
  2032. }
  2033. /**
  2034. * @}
  2035. */
  2036. #endif /*DUAL_CORE*/
  2037. /** @defgroup RCC_LL_EF_LSE LSE
  2038. * @{
  2039. */
  2040. /**
  2041. * @brief Enable the Clock Security System on LSE.
  2042. * @note Once LSE Clock Security System is enabled it cannot be changed anymore unless
  2043. * a clock failure is detected.
  2044. * @rmtoll BDCR LSECSSON LL_RCC_LSE_EnableCSS
  2045. * @retval None
  2046. */
  2047. __STATIC_INLINE void LL_RCC_LSE_EnableCSS(void)
  2048. {
  2049. SET_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  2050. }
  2051. /**
  2052. * @brief Check if LSE failure is detected by Clock Security System
  2053. * @rmtoll BDCR LSECSSD LL_RCC_LSE_IsFailureDetected
  2054. * @retval State of bit (1 or 0).
  2055. */
  2056. __STATIC_INLINE uint32_t LL_RCC_LSE_IsFailureDetected(void)
  2057. {
  2058. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSECSSD) == (RCC_BDCR_LSECSSD)) ? 1UL : 0UL);
  2059. }
  2060. /**
  2061. * @brief Enable Low Speed External (LSE) crystal.
  2062. * @rmtoll BDCR LSEON LL_RCC_LSE_Enable
  2063. * @retval None
  2064. */
  2065. __STATIC_INLINE void LL_RCC_LSE_Enable(void)
  2066. {
  2067. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  2068. }
  2069. /**
  2070. * @brief Disable Low Speed External (LSE) crystal.
  2071. * @rmtoll BDCR LSEON LL_RCC_LSE_Disable
  2072. * @retval None
  2073. */
  2074. __STATIC_INLINE void LL_RCC_LSE_Disable(void)
  2075. {
  2076. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  2077. }
  2078. /**
  2079. * @brief Enable external clock source (LSE bypass).
  2080. * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass
  2081. * @retval None
  2082. */
  2083. __STATIC_INLINE void LL_RCC_LSE_EnableBypass(void)
  2084. {
  2085. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  2086. }
  2087. /**
  2088. * @brief Disable external clock source (LSE bypass).
  2089. * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass
  2090. * @retval None
  2091. */
  2092. __STATIC_INLINE void LL_RCC_LSE_DisableBypass(void)
  2093. {
  2094. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  2095. }
  2096. #if defined(RCC_BDCR_LSEEXT)
  2097. /**
  2098. * @brief Enable Low-speed external DIGITAL clock type in Bypass mode (not to be used if RTC is active).
  2099. * @note The external clock must be enabled with the LSEON bit, to be used by the device.
  2100. * The LSEEXT bit can be written only if the LSE oscillator is disabled.
  2101. * @rmtoll BDCR LSEEXT LL_RCC_LSE_SelectDigitalClock
  2102. * @retval None
  2103. */
  2104. __STATIC_INLINE void LL_RCC_LSE_SelectDigitalClock(void)
  2105. {
  2106. SET_BIT(RCC->BDCR, RCC_BDCR_LSEEXT);
  2107. }
  2108. /**
  2109. * @brief Enable Low-speed external ANALOG clock type in Bypass mode (default after Backup domain reset).
  2110. * @note The external clock must be enabled with the LSEON bit, to be used by the device.
  2111. * The LSEEXT bit can be written only if the LSE oscillator is disabled.
  2112. * @rmtoll BDCR LSEEXT LL_RCC_LSE_SelectAnalogClock
  2113. * @retval None
  2114. */
  2115. __STATIC_INLINE void LL_RCC_LSE_SelectAnalogClock(void)
  2116. {
  2117. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEEXT);
  2118. }
  2119. #endif /* RCC_BDCR_LSEEXT */
  2120. /**
  2121. * @brief Set LSE oscillator drive capability
  2122. * @note The oscillator is in Xtal mode when it is not in bypass mode.
  2123. * @rmtoll BDCR LSEDRV LL_RCC_LSE_SetDriveCapability
  2124. * @param LSEDrive This parameter can be one of the following values:
  2125. * @arg @ref LL_RCC_LSEDRIVE_LOW
  2126. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  2127. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  2128. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  2129. * @retval None
  2130. */
  2131. __STATIC_INLINE void LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive)
  2132. {
  2133. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, LSEDrive);
  2134. }
  2135. /**
  2136. * @brief Get LSE oscillator drive capability
  2137. * @rmtoll BDCR LSEDRV LL_RCC_LSE_GetDriveCapability
  2138. * @retval Returned value can be one of the following values:
  2139. * @arg @ref LL_RCC_LSEDRIVE_LOW
  2140. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  2141. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  2142. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  2143. */
  2144. __STATIC_INLINE uint32_t LL_RCC_LSE_GetDriveCapability(void)
  2145. {
  2146. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSEDRV));
  2147. }
  2148. /**
  2149. * @brief Check if LSE oscillator Ready
  2150. * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady
  2151. * @retval State of bit (1 or 0).
  2152. */
  2153. __STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
  2154. {
  2155. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == (RCC_BDCR_LSERDY)) ? 1UL : 0UL);
  2156. }
  2157. /**
  2158. * @}
  2159. */
  2160. /** @defgroup RCC_LL_EF_LSI LSI
  2161. * @{
  2162. */
  2163. /**
  2164. * @brief Enable LSI Oscillator
  2165. * @rmtoll CSR LSION LL_RCC_LSI_Enable
  2166. * @retval None
  2167. */
  2168. __STATIC_INLINE void LL_RCC_LSI_Enable(void)
  2169. {
  2170. SET_BIT(RCC->CSR, RCC_CSR_LSION);
  2171. }
  2172. /**
  2173. * @brief Disable LSI Oscillator
  2174. * @rmtoll CSR LSION LL_RCC_LSI_Disable
  2175. * @retval None
  2176. */
  2177. __STATIC_INLINE void LL_RCC_LSI_Disable(void)
  2178. {
  2179. CLEAR_BIT(RCC->CSR, RCC_CSR_LSION);
  2180. }
  2181. /**
  2182. * @brief Check if LSI is Ready
  2183. * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady
  2184. * @retval State of bit (1 or 0).
  2185. */
  2186. __STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void)
  2187. {
  2188. return ((READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == (RCC_CSR_LSIRDY)) ? 1UL : 0UL);
  2189. }
  2190. /**
  2191. * @}
  2192. */
  2193. /** @defgroup RCC_LL_EF_System System
  2194. * @{
  2195. */
  2196. /**
  2197. * @brief Configure the system clock source
  2198. * @rmtoll CFGR SW LL_RCC_SetSysClkSource
  2199. * @param Source This parameter can be one of the following values:
  2200. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI
  2201. * @arg @ref LL_RCC_SYS_CLKSOURCE_CSI
  2202. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
  2203. * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL1
  2204. * @retval None
  2205. */
  2206. __STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source)
  2207. {
  2208. MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source);
  2209. }
  2210. /**
  2211. * @brief Get the system clock source
  2212. * @rmtoll CFGR SWS LL_RCC_GetSysClkSource
  2213. * @retval Returned value can be one of the following values:
  2214. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
  2215. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_CSI
  2216. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
  2217. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL1
  2218. */
  2219. __STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void)
  2220. {
  2221. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS));
  2222. }
  2223. /**
  2224. * @brief Configure the system wakeup clock source
  2225. * @rmtoll CFGR STOPWUCK LL_RCC_SetSysWakeUpClkSource
  2226. * @param Source This parameter can be one of the following values:
  2227. * @arg @ref LL_RCC_SYSWAKEUP_CLKSOURCE_HSI
  2228. * @arg @ref LL_RCC_SYSWAKEUP_CLKSOURCE_CSI
  2229. * @retval None
  2230. */
  2231. __STATIC_INLINE void LL_RCC_SetSysWakeUpClkSource(uint32_t Source)
  2232. {
  2233. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPWUCK, Source);
  2234. }
  2235. /**
  2236. * @brief Get the system wakeup clock source
  2237. * @rmtoll CFGR STOPWUCK LL_RCC_GetSysWakeUpClkSource
  2238. * @retval Returned value can be one of the following values:
  2239. * @arg @ref LL_RCC_SYSWAKEUP_CLKSOURCE_HSI
  2240. * @arg @ref LL_RCC_SYSWAKEUP_CLKSOURCE_CSI
  2241. */
  2242. __STATIC_INLINE uint32_t LL_RCC_GetSysWakeUpClkSource(void)
  2243. {
  2244. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_STOPWUCK));
  2245. }
  2246. /**
  2247. * @brief Configure the kernel wakeup clock source
  2248. * @rmtoll CFGR STOPKERWUCK LL_RCC_SetKerWakeUpClkSource
  2249. * @param Source This parameter can be one of the following values:
  2250. * @arg @ref LL_RCC_KERWAKEUP_CLKSOURCE_HSI
  2251. * @arg @ref LL_RCC_KERWAKEUP_CLKSOURCE_CSI
  2252. * @retval None
  2253. */
  2254. __STATIC_INLINE void LL_RCC_SetKerWakeUpClkSource(uint32_t Source)
  2255. {
  2256. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPKERWUCK, Source);
  2257. }
  2258. /**
  2259. * @brief Get the kernel wakeup clock source
  2260. * @rmtoll CFGR STOPKERWUCK LL_RCC_GetKerWakeUpClkSource
  2261. * @retval Returned value can be one of the following values:
  2262. * @arg @ref LL_RCC_KERWAKEUP_CLKSOURCE_HSI
  2263. * @arg @ref LL_RCC_KERWAKEUP_CLKSOURCE_CSI
  2264. */
  2265. __STATIC_INLINE uint32_t LL_RCC_GetKerWakeUpClkSource(void)
  2266. {
  2267. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_STOPKERWUCK));
  2268. }
  2269. /**
  2270. * @brief Set System prescaler
  2271. * @rmtoll D1CFGR/CDCFGR1 D1CPRE/CDCPRE LL_RCC_SetSysPrescaler
  2272. * @param Prescaler This parameter can be one of the following values:
  2273. * @arg @ref LL_RCC_SYSCLK_DIV_1
  2274. * @arg @ref LL_RCC_SYSCLK_DIV_2
  2275. * @arg @ref LL_RCC_SYSCLK_DIV_4
  2276. * @arg @ref LL_RCC_SYSCLK_DIV_8
  2277. * @arg @ref LL_RCC_SYSCLK_DIV_16
  2278. * @arg @ref LL_RCC_SYSCLK_DIV_64
  2279. * @arg @ref LL_RCC_SYSCLK_DIV_128
  2280. * @arg @ref LL_RCC_SYSCLK_DIV_256
  2281. * @arg @ref LL_RCC_SYSCLK_DIV_512
  2282. * @retval None
  2283. */
  2284. __STATIC_INLINE void LL_RCC_SetSysPrescaler(uint32_t Prescaler)
  2285. {
  2286. #if defined(RCC_D1CFGR_D1CPRE)
  2287. MODIFY_REG(RCC->D1CFGR, RCC_D1CFGR_D1CPRE, Prescaler);
  2288. #else
  2289. MODIFY_REG(RCC->CDCFGR1, RCC_CDCFGR1_CDCPRE, Prescaler);
  2290. #endif /* RCC_D1CFGR_D1CPRE */
  2291. }
  2292. /**
  2293. * @brief Set AHB prescaler
  2294. * @rmtoll D1CFGR/CDCFGR1 HPRE LL_RCC_SetAHBPrescaler
  2295. * @param Prescaler This parameter can be one of the following values:
  2296. * @arg @ref LL_RCC_AHB_DIV_1
  2297. * @arg @ref LL_RCC_AHB_DIV_2
  2298. * @arg @ref LL_RCC_AHB_DIV_4
  2299. * @arg @ref LL_RCC_AHB_DIV_8
  2300. * @arg @ref LL_RCC_AHB_DIV_16
  2301. * @arg @ref LL_RCC_AHB_DIV_64
  2302. * @arg @ref LL_RCC_AHB_DIV_128
  2303. * @arg @ref LL_RCC_AHB_DIV_256
  2304. * @arg @ref LL_RCC_AHB_DIV_512
  2305. * @retval None
  2306. */
  2307. __STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler)
  2308. {
  2309. #if defined(RCC_D1CFGR_HPRE)
  2310. MODIFY_REG(RCC->D1CFGR, RCC_D1CFGR_HPRE, Prescaler);
  2311. #else
  2312. MODIFY_REG(RCC->CDCFGR1, RCC_CDCFGR1_HPRE, Prescaler);
  2313. #endif /* RCC_D1CFGR_HPRE */
  2314. }
  2315. /**
  2316. * @brief Set APB1 prescaler
  2317. * @rmtoll D2CFGR/CDCFGR2 D2PPRE1/CDPPRE1 LL_RCC_SetAPB1Prescaler
  2318. * @param Prescaler This parameter can be one of the following values:
  2319. * @arg @ref LL_RCC_APB1_DIV_1
  2320. * @arg @ref LL_RCC_APB1_DIV_2
  2321. * @arg @ref LL_RCC_APB1_DIV_4
  2322. * @arg @ref LL_RCC_APB1_DIV_8
  2323. * @arg @ref LL_RCC_APB1_DIV_16
  2324. * @retval None
  2325. */
  2326. __STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)
  2327. {
  2328. #if defined(RCC_D2CFGR_D2PPRE1)
  2329. MODIFY_REG(RCC->D2CFGR, RCC_D2CFGR_D2PPRE1, Prescaler);
  2330. #else
  2331. MODIFY_REG(RCC->CDCFGR2, RCC_CDCFGR2_CDPPRE1, Prescaler);
  2332. #endif /* RCC_D2CFGR_D2PPRE1 */
  2333. }
  2334. /**
  2335. * @brief Set APB2 prescaler
  2336. * @rmtoll D2CFGR/CDCFGR2 D2PPRE2/CDPPRE2 LL_RCC_SetAPB2Prescaler
  2337. * @param Prescaler This parameter can be one of the following values:
  2338. * @arg @ref LL_RCC_APB2_DIV_1
  2339. * @arg @ref LL_RCC_APB2_DIV_2
  2340. * @arg @ref LL_RCC_APB2_DIV_4
  2341. * @arg @ref LL_RCC_APB2_DIV_8
  2342. * @arg @ref LL_RCC_APB2_DIV_16
  2343. * @retval None
  2344. */
  2345. __STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler)
  2346. {
  2347. #if defined(RCC_D2CFGR_D2PPRE2)
  2348. MODIFY_REG(RCC->D2CFGR, RCC_D2CFGR_D2PPRE2, Prescaler);
  2349. #else
  2350. MODIFY_REG(RCC->CDCFGR2, RCC_CDCFGR2_CDPPRE2, Prescaler);
  2351. #endif /* RCC_D2CFGR_D2PPRE2 */
  2352. }
  2353. /**
  2354. * @brief Set APB3 prescaler
  2355. * @rmtoll D1CFGR/CDCFGR1 D1PPRE/CDPPRE LL_RCC_SetAPB3Prescaler
  2356. * @param Prescaler This parameter can be one of the following values:
  2357. * @arg @ref LL_RCC_APB3_DIV_1
  2358. * @arg @ref LL_RCC_APB3_DIV_2
  2359. * @arg @ref LL_RCC_APB3_DIV_4
  2360. * @arg @ref LL_RCC_APB3_DIV_8
  2361. * @arg @ref LL_RCC_APB3_DIV_16
  2362. * @retval None
  2363. */
  2364. __STATIC_INLINE void LL_RCC_SetAPB3Prescaler(uint32_t Prescaler)
  2365. {
  2366. #if defined(RCC_D1CFGR_D1PPRE)
  2367. MODIFY_REG(RCC->D1CFGR, RCC_D1CFGR_D1PPRE, Prescaler);
  2368. #else
  2369. MODIFY_REG(RCC->CDCFGR1, RCC_CDCFGR1_CDPPRE, Prescaler);
  2370. #endif /* RCC_D1CFGR_D1PPRE */
  2371. }
  2372. /**
  2373. * @brief Set APB4 prescaler
  2374. * @rmtoll D3CFGR/SRDCFGR D3PPRE/SRDPPRE LL_RCC_SetAPB4Prescaler
  2375. * @param Prescaler This parameter can be one of the following values:
  2376. * @arg @ref LL_RCC_APB4_DIV_1
  2377. * @arg @ref LL_RCC_APB4_DIV_2
  2378. * @arg @ref LL_RCC_APB4_DIV_4
  2379. * @arg @ref LL_RCC_APB4_DIV_8
  2380. * @arg @ref LL_RCC_APB4_DIV_16
  2381. * @retval None
  2382. */
  2383. __STATIC_INLINE void LL_RCC_SetAPB4Prescaler(uint32_t Prescaler)
  2384. {
  2385. #if defined(RCC_D3CFGR_D3PPRE)
  2386. MODIFY_REG(RCC->D3CFGR, RCC_D3CFGR_D3PPRE, Prescaler);
  2387. #else
  2388. MODIFY_REG(RCC->SRDCFGR, RCC_SRDCFGR_SRDPPRE, Prescaler);
  2389. #endif /* RCC_D3CFGR_D3PPRE */
  2390. }
  2391. /**
  2392. * @brief Get System prescaler
  2393. * @rmtoll D1CFGR/CDCFGR1 D1CPRE/CDCPRE LL_RCC_GetSysPrescaler
  2394. * @retval Returned value can be one of the following values:
  2395. * @arg @ref LL_RCC_SYSCLK_DIV_1
  2396. * @arg @ref LL_RCC_SYSCLK_DIV_2
  2397. * @arg @ref LL_RCC_SYSCLK_DIV_4
  2398. * @arg @ref LL_RCC_SYSCLK_DIV_8
  2399. * @arg @ref LL_RCC_SYSCLK_DIV_16
  2400. * @arg @ref LL_RCC_SYSCLK_DIV_64
  2401. * @arg @ref LL_RCC_SYSCLK_DIV_128
  2402. * @arg @ref LL_RCC_SYSCLK_DIV_256
  2403. * @arg @ref LL_RCC_SYSCLK_DIV_512
  2404. */
  2405. __STATIC_INLINE uint32_t LL_RCC_GetSysPrescaler(void)
  2406. {
  2407. #if defined(RCC_D1CFGR_D1CPRE)
  2408. return (uint32_t)(READ_BIT(RCC->D1CFGR, RCC_D1CFGR_D1CPRE));
  2409. #else
  2410. return (uint32_t)(READ_BIT(RCC->CDCFGR1, RCC_CDCFGR1_CDCPRE));
  2411. #endif /* RCC_D1CFGR_D1CPRE */
  2412. }
  2413. /**
  2414. * @brief Get AHB prescaler
  2415. * @rmtoll D1CFGR/ CDCFGR1 HPRE LL_RCC_GetAHBPrescaler
  2416. * @retval Returned value can be one of the following values:
  2417. * @arg @ref LL_RCC_AHB_DIV_1
  2418. * @arg @ref LL_RCC_AHB_DIV_2
  2419. * @arg @ref LL_RCC_AHB_DIV_4
  2420. * @arg @ref LL_RCC_AHB_DIV_8
  2421. * @arg @ref LL_RCC_AHB_DIV_16
  2422. * @arg @ref LL_RCC_AHB_DIV_64
  2423. * @arg @ref LL_RCC_AHB_DIV_128
  2424. * @arg @ref LL_RCC_AHB_DIV_256
  2425. * @arg @ref LL_RCC_AHB_DIV_512
  2426. */
  2427. __STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void)
  2428. {
  2429. #if defined(RCC_D1CFGR_HPRE)
  2430. return (uint32_t)(READ_BIT(RCC->D1CFGR, RCC_D1CFGR_HPRE));
  2431. #else
  2432. return (uint32_t)(READ_BIT(RCC->CDCFGR1, RCC_CDCFGR1_HPRE));
  2433. #endif /* RCC_D1CFGR_HPRE */
  2434. }
  2435. /**
  2436. * @brief Get APB1 prescaler
  2437. * @rmtoll D2CFGR/CDCFGR2 D2PPRE1/CDPPRE1 LL_RCC_GetAPB1Prescaler
  2438. * @retval Returned value can be one of the following values:
  2439. * @arg @ref LL_RCC_APB1_DIV_1
  2440. * @arg @ref LL_RCC_APB1_DIV_2
  2441. * @arg @ref LL_RCC_APB1_DIV_4
  2442. * @arg @ref LL_RCC_APB1_DIV_8
  2443. * @arg @ref LL_RCC_APB1_DIV_16
  2444. */
  2445. __STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void)
  2446. {
  2447. #if defined(RCC_D2CFGR_D2PPRE1)
  2448. return (uint32_t)(READ_BIT(RCC->D2CFGR, RCC_D2CFGR_D2PPRE1));
  2449. #else
  2450. return (uint32_t)(READ_BIT(RCC->CDCFGR2, RCC_CDCFGR2_CDPPRE1));
  2451. #endif /* RCC_D2CFGR_D2PPRE1 */
  2452. }
  2453. /**
  2454. * @brief Get APB2 prescaler
  2455. * @rmtoll D2CFGR/CDCFGR2 D2PPRE2/CDPPRE2 LL_RCC_GetAPB2Prescaler
  2456. * @retval Returned value can be one of the following values:
  2457. * @arg @ref LL_RCC_APB2_DIV_1
  2458. * @arg @ref LL_RCC_APB2_DIV_2
  2459. * @arg @ref LL_RCC_APB2_DIV_4
  2460. * @arg @ref LL_RCC_APB2_DIV_8
  2461. * @arg @ref LL_RCC_APB2_DIV_16
  2462. */
  2463. __STATIC_INLINE uint32_t LL_RCC_GetAPB2Prescaler(void)
  2464. {
  2465. #if defined(RCC_D2CFGR_D2PPRE2)
  2466. return (uint32_t)(READ_BIT(RCC->D2CFGR, RCC_D2CFGR_D2PPRE2));
  2467. #else
  2468. return (uint32_t)(READ_BIT(RCC->CDCFGR2, RCC_CDCFGR2_CDPPRE2));
  2469. #endif /* RCC_D2CFGR_D2PPRE2 */
  2470. }
  2471. /**
  2472. * @brief Get APB3 prescaler
  2473. * @rmtoll D1CFGR/CDCFGR1 D1PPRE/CDPPRE LL_RCC_GetAPB3Prescaler
  2474. * @retval Returned value can be one of the following values:
  2475. * @arg @ref LL_RCC_APB3_DIV_1
  2476. * @arg @ref LL_RCC_APB3_DIV_2
  2477. * @arg @ref LL_RCC_APB3_DIV_4
  2478. * @arg @ref LL_RCC_APB3_DIV_8
  2479. * @arg @ref LL_RCC_APB3_DIV_16
  2480. */
  2481. __STATIC_INLINE uint32_t LL_RCC_GetAPB3Prescaler(void)
  2482. {
  2483. #if defined(RCC_D1CFGR_D1PPRE)
  2484. return (uint32_t)(READ_BIT(RCC->D1CFGR, RCC_D1CFGR_D1PPRE));
  2485. #else
  2486. return (uint32_t)(READ_BIT(RCC->CDCFGR1, RCC_CDCFGR1_CDPPRE));
  2487. #endif /* RCC_D1CFGR_D1PPRE */
  2488. }
  2489. /**
  2490. * @brief Get APB4 prescaler
  2491. * @rmtoll D3CFGR/SRDCFGR D3PPRE/SRDPPRE LL_RCC_GetAPB4Prescaler
  2492. * @retval Returned value can be one of the following values:
  2493. * @arg @ref LL_RCC_APB4_DIV_1
  2494. * @arg @ref LL_RCC_APB4_DIV_2
  2495. * @arg @ref LL_RCC_APB4_DIV_4
  2496. * @arg @ref LL_RCC_APB4_DIV_8
  2497. * @arg @ref LL_RCC_APB4_DIV_16
  2498. */
  2499. __STATIC_INLINE uint32_t LL_RCC_GetAPB4Prescaler(void)
  2500. {
  2501. #if defined(RCC_D3CFGR_D3PPRE)
  2502. return (uint32_t)(READ_BIT(RCC->D3CFGR, RCC_D3CFGR_D3PPRE));
  2503. #else
  2504. return (uint32_t)(READ_BIT(RCC->SRDCFGR, RCC_SRDCFGR_SRDPPRE));
  2505. #endif /* RCC_D3CFGR_D3PPRE */
  2506. }
  2507. /**
  2508. * @}
  2509. */
  2510. /** @defgroup RCC_LL_EF_MCO MCO
  2511. * @{
  2512. */
  2513. /**
  2514. * @brief Configure MCOx
  2515. * @rmtoll CFGR MCO1 LL_RCC_ConfigMCO\n
  2516. * CFGR MCO1PRE LL_RCC_ConfigMCO\n
  2517. * CFGR MCO2 LL_RCC_ConfigMCO\n
  2518. * CFGR MCO2PRE LL_RCC_ConfigMCO
  2519. * @param MCOxSource This parameter can be one of the following values:
  2520. * @arg @ref LL_RCC_MCO1SOURCE_HSI
  2521. * @arg @ref LL_RCC_MCO1SOURCE_LSE
  2522. * @arg @ref LL_RCC_MCO1SOURCE_HSE
  2523. * @arg @ref LL_RCC_MCO1SOURCE_PLL1QCLK
  2524. * @arg @ref LL_RCC_MCO1SOURCE_HSI48
  2525. * @arg @ref LL_RCC_MCO2SOURCE_SYSCLK
  2526. * @arg @ref LL_RCC_MCO2SOURCE_PLL2PCLK
  2527. * @arg @ref LL_RCC_MCO2SOURCE_HSE
  2528. * @arg @ref LL_RCC_MCO2SOURCE_PLL1PCLK
  2529. * @arg @ref LL_RCC_MCO2SOURCE_CSI
  2530. * @arg @ref LL_RCC_MCO2SOURCE_LSI
  2531. * @param MCOxPrescaler This parameter can be one of the following values:
  2532. * @arg @ref LL_RCC_MCO1_DIV_1
  2533. * @arg @ref LL_RCC_MCO1_DIV_2
  2534. * @arg @ref LL_RCC_MCO1_DIV_3
  2535. * @arg @ref LL_RCC_MCO1_DIV_4
  2536. * @arg @ref LL_RCC_MCO1_DIV_5
  2537. * @arg @ref LL_RCC_MCO1_DIV_6
  2538. * @arg @ref LL_RCC_MCO1_DIV_7
  2539. * @arg @ref LL_RCC_MCO1_DIV_8
  2540. * @arg @ref LL_RCC_MCO1_DIV_9
  2541. * @arg @ref LL_RCC_MCO1_DIV_10
  2542. * @arg @ref LL_RCC_MCO1_DIV_11
  2543. * @arg @ref LL_RCC_MCO1_DIV_12
  2544. * @arg @ref LL_RCC_MCO1_DIV_13
  2545. * @arg @ref LL_RCC_MCO1_DIV_14
  2546. * @arg @ref LL_RCC_MCO1_DIV_15
  2547. * @arg @ref LL_RCC_MCO2_DIV_1
  2548. * @arg @ref LL_RCC_MCO2_DIV_2
  2549. * @arg @ref LL_RCC_MCO2_DIV_3
  2550. * @arg @ref LL_RCC_MCO2_DIV_4
  2551. * @arg @ref LL_RCC_MCO2_DIV_5
  2552. * @arg @ref LL_RCC_MCO2_DIV_6
  2553. * @arg @ref LL_RCC_MCO2_DIV_7
  2554. * @arg @ref LL_RCC_MCO2_DIV_8
  2555. * @arg @ref LL_RCC_MCO2_DIV_9
  2556. * @arg @ref LL_RCC_MCO2_DIV_10
  2557. * @arg @ref LL_RCC_MCO2_DIV_11
  2558. * @arg @ref LL_RCC_MCO2_DIV_12
  2559. * @arg @ref LL_RCC_MCO2_DIV_13
  2560. * @arg @ref LL_RCC_MCO2_DIV_14
  2561. * @arg @ref LL_RCC_MCO2_DIV_15
  2562. * @retval None
  2563. */
  2564. __STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource, uint32_t MCOxPrescaler)
  2565. {
  2566. MODIFY_REG(RCC->CFGR, (MCOxSource << 16U) | (MCOxPrescaler << 16U), (MCOxSource & 0xFFFF0000U) | (MCOxPrescaler & 0xFFFF0000U));
  2567. }
  2568. /**
  2569. * @}
  2570. */
  2571. /** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source
  2572. * @{
  2573. */
  2574. /**
  2575. * @brief Configure periph clock source
  2576. * @rmtoll D2CCIP1R/CDCCIP1R * LL_RCC_SetClockSource\n
  2577. * D2CCIP2R/CDCCIP2R * LL_RCC_SetClockSource\n
  2578. * D3CCIPR/SRDCCIPR * LL_RCC_SetClockSource
  2579. * @param ClkSource This parameter can be one of the following values:
  2580. * @arg @ref LL_RCC_USART16_CLKSOURCE_PCLK2
  2581. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL2Q
  2582. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL3Q
  2583. * @arg @ref LL_RCC_USART16_CLKSOURCE_HSI
  2584. * @arg @ref LL_RCC_USART16_CLKSOURCE_CSI
  2585. * @arg @ref LL_RCC_USART16_CLKSOURCE_LSE
  2586. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PCLK1
  2587. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL2Q
  2588. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL3Q
  2589. * @arg @ref LL_RCC_USART234578_CLKSOURCE_HSI
  2590. * @arg @ref LL_RCC_USART234578_CLKSOURCE_CSI
  2591. * @arg @ref LL_RCC_USART234578_CLKSOURCE_LSE
  2592. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PCLK1
  2593. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PLL3R
  2594. * @arg @ref LL_RCC_I2C123_CLKSOURCE_HSI
  2595. * @arg @ref LL_RCC_I2C123_CLKSOURCE_CSI
  2596. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK4
  2597. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PLL3R
  2598. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI
  2599. * @arg @ref LL_RCC_I2C4_CLKSOURCE_CSI
  2600. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  2601. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL2P
  2602. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL3R
  2603. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  2604. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  2605. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_CLKP
  2606. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK4
  2607. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL2P
  2608. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL3R
  2609. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  2610. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  2611. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_CLKP
  2612. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PCLK4
  2613. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL2P
  2614. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL3R
  2615. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSE
  2616. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSI
  2617. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_CLKP
  2618. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL1Q
  2619. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL2P
  2620. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL3P
  2621. * @arg @ref LL_RCC_SAI1_CLKSOURCE_I2S_CKIN
  2622. * @arg @ref LL_RCC_SAI1_CLKSOURCE_CLKP
  2623. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL1Q (*)
  2624. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL2P (*)
  2625. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL3P (*)
  2626. * @arg @ref LL_RCC_SAI23_CLKSOURCE_I2S_CKIN (*)
  2627. * @arg @ref LL_RCC_SAI23_CLKSOURCE_CLKP (*)
  2628. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL1Q (*)
  2629. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL2P (*)
  2630. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL3P (*)
  2631. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_I2S_CKIN (*)
  2632. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_SPDIF (*)
  2633. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL1Q (*)
  2634. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL2P (*)
  2635. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL3P (*)
  2636. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_I2S_CKIN (*)
  2637. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_CLKP (*)
  2638. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_SPDIF (*)
  2639. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL1Q (*)
  2640. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL2P (*)
  2641. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL3P (*)
  2642. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_I2S_CKIN (*)
  2643. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_CLKP (*)
  2644. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_SPDIF (*)
  2645. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL1Q (*)
  2646. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL2P (*)
  2647. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL3P (*)
  2648. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_I2S_CKIN (*)
  2649. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_CLKP (*)
  2650. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_SPDIF (*)
  2651. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL1Q
  2652. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL2P
  2653. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL3P
  2654. * @arg @ref LL_RCC_SPI123_CLKSOURCE_I2S_CKIN
  2655. * @arg @ref LL_RCC_SPI123_CLKSOURCE_CLKP
  2656. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PCLK2
  2657. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL2Q
  2658. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL3Q
  2659. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSI
  2660. * @arg @ref LL_RCC_SPI45_CLKSOURCE_CSI
  2661. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSE
  2662. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PCLK4
  2663. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL2Q
  2664. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL3Q
  2665. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSI
  2666. * @arg @ref LL_RCC_SPI6_CLKSOURCE_CSI
  2667. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSE
  2668. * @arg @ref LL_RCC_SPI6_CLKSOURCE_I2S_CKIN (*)
  2669. *
  2670. * (*) value not defined in all devices.
  2671. * @retval None
  2672. */
  2673. __STATIC_INLINE void LL_RCC_SetClockSource(uint32_t ClkSource)
  2674. {
  2675. #if defined(RCC_D1CCIPR_FMCSEL)
  2676. uint32_t *pReg = (uint32_t *)((uint32_t)&RCC->D1CCIPR + LL_CLKSOURCE_REG(ClkSource));
  2677. #else
  2678. uint32_t *pReg = (uint32_t *)((uint32_t)&RCC->CDCCIPR + LL_CLKSOURCE_REG(ClkSource));
  2679. #endif /* */
  2680. MODIFY_REG(*pReg, LL_CLKSOURCE_MASK(ClkSource), LL_CLKSOURCE_CONFIG(ClkSource));
  2681. }
  2682. /**
  2683. * @brief Configure USARTx clock source
  2684. * @rmtoll D2CCIP2R / D2CCIP2R USART16SEL LL_RCC_SetUSARTClockSource\n
  2685. * D2CCIP2R / D2CCIP2R USART28SEL LL_RCC_SetUSARTClockSource
  2686. * @param ClkSource This parameter can be one of the following values:
  2687. * @arg @ref LL_RCC_USART16_CLKSOURCE_PCLK2
  2688. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL2Q
  2689. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL3Q
  2690. * @arg @ref LL_RCC_USART16_CLKSOURCE_HSI
  2691. * @arg @ref LL_RCC_USART16_CLKSOURCE_CSI
  2692. * @arg @ref LL_RCC_USART16_CLKSOURCE_LSE
  2693. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PCLK1
  2694. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL2Q
  2695. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL3Q
  2696. * @arg @ref LL_RCC_USART234578_CLKSOURCE_HSI
  2697. * @arg @ref LL_RCC_USART234578_CLKSOURCE_CSI
  2698. * @arg @ref LL_RCC_USART234578_CLKSOURCE_LSE
  2699. * @retval None
  2700. */
  2701. __STATIC_INLINE void LL_RCC_SetUSARTClockSource(uint32_t ClkSource)
  2702. {
  2703. LL_RCC_SetClockSource(ClkSource);
  2704. }
  2705. /**
  2706. * @brief Configure LPUARTx clock source
  2707. * @rmtoll D3CCIPR / SRDCCIPR LPUART1SEL LL_RCC_SetLPUARTClockSource
  2708. * @param ClkSource This parameter can be one of the following values:
  2709. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK4
  2710. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PLL2Q
  2711. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PLL3Q
  2712. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  2713. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_CSI
  2714. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  2715. * @retval None
  2716. */
  2717. __STATIC_INLINE void LL_RCC_SetLPUARTClockSource(uint32_t ClkSource)
  2718. {
  2719. #if defined(RCC_D3CCIPR_LPUART1SEL)
  2720. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPUART1SEL, ClkSource);
  2721. #else
  2722. MODIFY_REG(RCC->SRDCCIPR, RCC_SRDCCIPR_LPUART1SEL, ClkSource);
  2723. #endif /* RCC_D3CCIPR_LPUART1SEL */
  2724. }
  2725. /**
  2726. * @brief Configure I2Cx clock source
  2727. * @rmtoll D2CCIP2R / CDCCIP2R I2C123SEL LL_RCC_SetI2CClockSource\n
  2728. * D3CCIPR / SRDCCIPR I2C4SEL LL_RCC_SetI2CClockSource
  2729. * @param ClkSource This parameter can be one of the following values:
  2730. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PCLK1
  2731. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PLL3R
  2732. * @arg @ref LL_RCC_I2C123_CLKSOURCE_HSI
  2733. * @arg @ref LL_RCC_I2C123_CLKSOURCE_CSI
  2734. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK4
  2735. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PLL3R
  2736. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI
  2737. * @arg @ref LL_RCC_I2C4_CLKSOURCE_CSI
  2738. * @retval None
  2739. */
  2740. __STATIC_INLINE void LL_RCC_SetI2CClockSource(uint32_t ClkSource)
  2741. {
  2742. LL_RCC_SetClockSource(ClkSource);
  2743. }
  2744. /**
  2745. * @brief Configure LPTIMx clock source
  2746. * @rmtoll D2CCIP2R / CDCCIP2R LPTIM1SEL LL_RCC_SetLPTIMClockSource
  2747. * D3CCIPR / SRDCCIPR LPTIM2SEL LL_RCC_SetLPTIMClockSource\n
  2748. * D3CCIPR / SRDCCIPR LPTIM345SEL LL_RCC_SetLPTIMClockSource
  2749. * @param ClkSource This parameter can be one of the following values:
  2750. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  2751. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL2P
  2752. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL3R
  2753. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  2754. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  2755. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_CLKP
  2756. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK4
  2757. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL2P
  2758. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL3R
  2759. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  2760. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  2761. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_CLKP
  2762. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PCLK4
  2763. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL2P
  2764. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL3R
  2765. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSE
  2766. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSI
  2767. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_CLKP
  2768. * @retval None
  2769. */
  2770. __STATIC_INLINE void LL_RCC_SetLPTIMClockSource(uint32_t ClkSource)
  2771. {
  2772. LL_RCC_SetClockSource(ClkSource);
  2773. }
  2774. /**
  2775. * @brief Configure SAIx clock source
  2776. * @rmtoll D2CCIP1R / CDCCIP1R SAI1SEL LL_RCC_SetSAIClockSource\n
  2777. * D2CCIP1R / CDCCIP1R SAI23SEL LL_RCC_SetSAIClockSource
  2778. * D3CCIPR / SRDCCIPR SAI4ASEL LL_RCC_SetSAI4xClockSource\n
  2779. * D3CCIPR / SRDCCIPR SAI4BSEL LL_RCC_SetSAI4xClockSource
  2780. * @param ClkSource This parameter can be one of the following values:
  2781. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL1Q
  2782. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL2P
  2783. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL3P
  2784. * @arg @ref LL_RCC_SAI1_CLKSOURCE_I2S_CKIN
  2785. * @arg @ref LL_RCC_SAI1_CLKSOURCE_CLKP
  2786. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL1Q (*)
  2787. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL2P (*)
  2788. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL3P (*)
  2789. * @arg @ref LL_RCC_SAI23_CLKSOURCE_I2S_CKIN (*)
  2790. * @arg @ref LL_RCC_SAI23_CLKSOURCE_CLKP (*)
  2791. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL1Q (*)
  2792. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL2P (*)
  2793. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL3P (*)
  2794. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_I2S_CKIN (*)
  2795. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_SPDIF (*)
  2796. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL1Q (*)
  2797. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL2P (*)
  2798. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL3P (*)
  2799. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_I2S_CKIN (*)
  2800. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_CLKP (*)
  2801. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_SPDIF (*)
  2802. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL1Q (*)
  2803. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL2P (*)
  2804. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL3P (*)
  2805. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_I2S_CKIN (*)
  2806. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_CLKP (*)
  2807. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_SPDIF (*)
  2808. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL1Q (*)
  2809. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL2P (*)
  2810. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL3P (*)
  2811. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_I2S_CKIN (*)
  2812. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_CLKP (*)
  2813. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_SPDIF (*)
  2814. *
  2815. * (*) value not defined in all devices.
  2816. * @retval None
  2817. */
  2818. __STATIC_INLINE void LL_RCC_SetSAIClockSource(uint32_t ClkSource)
  2819. {
  2820. LL_RCC_SetClockSource(ClkSource);
  2821. }
  2822. /**
  2823. * @brief Configure SDMMCx clock source
  2824. * @rmtoll D1CCIPR / CDCCIPR SDMMCSEL LL_RCC_SetSDMMCClockSource
  2825. * @param ClkSource This parameter can be one of the following values:
  2826. * @arg @ref LL_RCC_SDMMC_CLKSOURCE_PLL1Q
  2827. * @arg @ref LL_RCC_SDMMC_CLKSOURCE_PLL2R
  2828. * @retval None
  2829. */
  2830. __STATIC_INLINE void LL_RCC_SetSDMMCClockSource(uint32_t ClkSource)
  2831. {
  2832. #if defined(RCC_D1CCIPR_SDMMCSEL)
  2833. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_SDMMCSEL, ClkSource);
  2834. #else
  2835. MODIFY_REG(RCC->CDCCIPR, RCC_CDCCIPR_SDMMCSEL, ClkSource);
  2836. #endif /* RCC_D1CCIPR_SDMMCSEL */
  2837. }
  2838. /**
  2839. * @brief Configure RNGx clock source
  2840. * @rmtoll D2CCIP2R / CDCCIP2R RNGSEL LL_RCC_SetRNGClockSource
  2841. * @param ClkSource This parameter can be one of the following values:
  2842. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48
  2843. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL1Q
  2844. * @arg @ref LL_RCC_RNG_CLKSOURCE_LSE
  2845. * @arg @ref LL_RCC_RNG_CLKSOURCE_LSI
  2846. * @retval None
  2847. */
  2848. __STATIC_INLINE void LL_RCC_SetRNGClockSource(uint32_t ClkSource)
  2849. {
  2850. #if defined(RCC_D2CCIP2R_RNGSEL)
  2851. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_RNGSEL, ClkSource);
  2852. #else
  2853. MODIFY_REG(RCC->CDCCIP2R, RCC_CDCCIP2R_RNGSEL, ClkSource);
  2854. #endif /* RCC_D2CCIP2R_RNGSEL */
  2855. }
  2856. /**
  2857. * @brief Configure USBx clock source
  2858. * @rmtoll D2CCIP2R / CDCCIP2R USBSEL LL_RCC_SetUSBClockSource
  2859. * @param ClkSource This parameter can be one of the following values:
  2860. * @arg @ref LL_RCC_USB_CLKSOURCE_DISABLE
  2861. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL1Q
  2862. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL3Q
  2863. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
  2864. * @retval None
  2865. */
  2866. __STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t ClkSource)
  2867. {
  2868. #if defined(RCC_D2CCIP2R_USBSEL)
  2869. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USBSEL, ClkSource);
  2870. #else
  2871. MODIFY_REG(RCC->CDCCIP2R, RCC_CDCCIP2R_USBSEL, ClkSource);
  2872. #endif /* RCC_D2CCIP2R_USBSEL */
  2873. }
  2874. /**
  2875. * @brief Configure CECx clock source
  2876. * @rmtoll D2CCIP2R / CDCCIP2R CECSEL LL_RCC_SetCECClockSource
  2877. * @param ClkSource This parameter can be one of the following values:
  2878. * @arg @ref LL_RCC_CEC_CLKSOURCE_LSE
  2879. * @arg @ref LL_RCC_CEC_CLKSOURCE_LSI
  2880. * @arg @ref LL_RCC_CEC_CLKSOURCE_CSI_DIV122
  2881. * @retval None
  2882. */
  2883. __STATIC_INLINE void LL_RCC_SetCECClockSource(uint32_t ClkSource)
  2884. {
  2885. #if defined(RCC_D2CCIP2R_CECSEL)
  2886. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_CECSEL, ClkSource);
  2887. #else
  2888. MODIFY_REG(RCC->CDCCIP2R, RCC_CDCCIP2R_CECSEL, ClkSource);
  2889. #endif /* RCC_D2CCIP2R_CECSEL */
  2890. }
  2891. #if defined(DSI)
  2892. /**
  2893. * @brief Configure DSIx clock source
  2894. * @rmtoll D1CCIPR DSISEL LL_RCC_SetDSIClockSource
  2895. * @param ClkSource This parameter can be one of the following values:
  2896. * @arg @ref LL_RCC_DSI_CLKSOURCE_PHY
  2897. * @arg @ref LL_RCC_DSI_CLKSOURCE_PLL2Q
  2898. * @retval None
  2899. */
  2900. __STATIC_INLINE void LL_RCC_SetDSIClockSource(uint32_t ClkSource)
  2901. {
  2902. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_DSISEL, ClkSource);
  2903. }
  2904. #endif /* DSI */
  2905. /**
  2906. * @brief Configure DFSDMx Kernel clock source
  2907. * @rmtoll D2CCIP1R / CDCCIP1R DFSDM1SEL LL_RCC_SetDFSDMClockSource
  2908. * @param ClkSource This parameter can be one of the following values:
  2909. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  2910. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  2911. * @retval None
  2912. */
  2913. __STATIC_INLINE void LL_RCC_SetDFSDMClockSource(uint32_t ClkSource)
  2914. {
  2915. #if defined(RCC_D2CCIP1R_DFSDM1SEL)
  2916. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_DFSDM1SEL, ClkSource);
  2917. #else
  2918. MODIFY_REG(RCC->CDCCIP1R, RCC_CDCCIP1R_DFSDM1SEL, ClkSource);
  2919. #endif /* RCC_D2CCIP1R_DFSDM1SEL */
  2920. }
  2921. #if defined(DFSDM2_BASE)
  2922. /**
  2923. * @brief Configure DFSDMx Kernel clock source
  2924. * @rmtoll SRDCCIPR DFSDM2SEL LL_RCC_SetDFSDM2ClockSource
  2925. * @param ClkSource This parameter can be one of the following values:
  2926. * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_PCLK4
  2927. * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_SYSCLK
  2928. * @retval None
  2929. */
  2930. __STATIC_INLINE void LL_RCC_SetDFSDM2ClockSource(uint32_t ClkSource)
  2931. {
  2932. MODIFY_REG(RCC->SRDCCIPR, RCC_SRDCCIPR_DFSDM2SEL, ClkSource);
  2933. }
  2934. #endif /* DFSDM2_BASE */
  2935. /**
  2936. * @brief Configure FMCx Kernel clock source
  2937. * @rmtoll D1CCIPR / CDCCIPR FMCSEL LL_RCC_SetFMCClockSource
  2938. * @param ClkSource This parameter can be one of the following values:
  2939. * @arg @ref LL_RCC_FMC_CLKSOURCE_HCLK
  2940. * @arg @ref LL_RCC_FMC_CLKSOURCE_PLL1Q
  2941. * @arg @ref LL_RCC_FMC_CLKSOURCE_PLL2R
  2942. * @arg @ref LL_RCC_FMC_CLKSOURCE_CLKP
  2943. * @retval None
  2944. */
  2945. __STATIC_INLINE void LL_RCC_SetFMCClockSource(uint32_t ClkSource)
  2946. {
  2947. #if defined(RCC_D1CCIPR_FMCSEL)
  2948. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_FMCSEL, ClkSource);
  2949. #else
  2950. MODIFY_REG(RCC->CDCCIPR, RCC_CDCCIPR_FMCSEL, ClkSource);
  2951. #endif /* RCC_D1CCIPR_FMCSEL */
  2952. }
  2953. #if defined(QUADSPI)
  2954. /**
  2955. * @brief Configure QSPIx Kernel clock source
  2956. * @rmtoll D1CCIPR QSPISEL LL_RCC_SetQSPIClockSource
  2957. * @param ClkSource This parameter can be one of the following values:
  2958. * @arg @ref LL_RCC_QSPI_CLKSOURCE_HCLK
  2959. * @arg @ref LL_RCC_QSPI_CLKSOURCE_PLL1Q
  2960. * @arg @ref LL_RCC_QSPI_CLKSOURCE_PLL2R
  2961. * @arg @ref LL_RCC_QSPI_CLKSOURCE_CLKP
  2962. * @retval None
  2963. */
  2964. __STATIC_INLINE void LL_RCC_SetQSPIClockSource(uint32_t ClkSource)
  2965. {
  2966. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_QSPISEL, ClkSource);
  2967. }
  2968. #endif /* QUADSPI */
  2969. #if defined(OCTOSPI1) || defined(OCTOSPI2)
  2970. /**
  2971. * @brief Configure OSPIx Kernel clock source
  2972. * @rmtoll D1CCIPR OPISEL LL_RCC_SetOSPIClockSource
  2973. * @param ClkSource This parameter can be one of the following values:
  2974. * @arg @ref LL_RCC_OSPI_CLKSOURCE_HCLK
  2975. * @arg @ref LL_RCC_OSPI_CLKSOURCE_PLL1Q
  2976. * @arg @ref LL_RCC_OSPI_CLKSOURCE_PLL2R
  2977. * @arg @ref LL_RCC_OSPI_CLKSOURCE_CLKP
  2978. * @retval None
  2979. */
  2980. __STATIC_INLINE void LL_RCC_SetOSPIClockSource(uint32_t ClkSource)
  2981. {
  2982. #if defined(RCC_D1CCIPR_OCTOSPISEL)
  2983. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_OCTOSPISEL, ClkSource);
  2984. #else
  2985. MODIFY_REG(RCC->CDCCIPR, RCC_CDCCIPR_OCTOSPISEL, ClkSource);
  2986. #endif /* RCC_D1CCIPR_OCTOSPISEL */
  2987. }
  2988. #endif /* OCTOSPI1 || OCTOSPI2 */
  2989. /**
  2990. * @brief Configure CLKP Kernel clock source
  2991. * @rmtoll D1CCIPR / CDCCIPR CKPERSEL LL_RCC_SetCLKPClockSource
  2992. * @param ClkSource This parameter can be one of the following values:
  2993. * @arg @ref LL_RCC_CLKP_CLKSOURCE_HSI
  2994. * @arg @ref LL_RCC_CLKP_CLKSOURCE_CSI
  2995. * @arg @ref LL_RCC_CLKP_CLKSOURCE_HSE
  2996. * @retval None
  2997. */
  2998. __STATIC_INLINE void LL_RCC_SetCLKPClockSource(uint32_t ClkSource)
  2999. {
  3000. #if defined(RCC_D1CCIPR_CKPERSEL)
  3001. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_CKPERSEL, ClkSource);
  3002. #else
  3003. MODIFY_REG(RCC->CDCCIPR, RCC_CDCCIPR_CKPERSEL, ClkSource);
  3004. #endif /* RCC_D1CCIPR_CKPERSEL */
  3005. }
  3006. /**
  3007. * @brief Configure SPIx Kernel clock source
  3008. * @rmtoll D2CCIP1R / CDCCIP1R SPI123SEL LL_RCC_SetSPIClockSource\n
  3009. * D2CCIP1R / CDCCIP1R SPI45SEL LL_RCC_SetSPIClockSource\n
  3010. * D3CCIPR / SRDCCIPR SPI6SEL LL_RCC_SetSPIClockSource
  3011. * @param ClkSource This parameter can be one of the following values:
  3012. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL1Q
  3013. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL2P
  3014. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL3P
  3015. * @arg @ref LL_RCC_SPI123_CLKSOURCE_I2S_CKIN
  3016. * @arg @ref LL_RCC_SPI123_CLKSOURCE_CLKP
  3017. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PCLK2
  3018. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL2Q
  3019. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL3Q
  3020. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSI
  3021. * @arg @ref LL_RCC_SPI45_CLKSOURCE_CSI
  3022. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSE
  3023. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PCLK4
  3024. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL2Q
  3025. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL3Q
  3026. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSI
  3027. * @arg @ref LL_RCC_SPI6_CLKSOURCE_CSI
  3028. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSE
  3029. * @arg @ref LL_RCC_SPI6_CLKSOURCE_I2S_CKIN (*)
  3030. *
  3031. * (*) value not defined in all devices.
  3032. * @retval None
  3033. */
  3034. __STATIC_INLINE void LL_RCC_SetSPIClockSource(uint32_t ClkSource)
  3035. {
  3036. LL_RCC_SetClockSource(ClkSource);
  3037. }
  3038. /**
  3039. * @brief Configure SPDIFx Kernel clock source
  3040. * @rmtoll D2CCIP1R / CDCCIP1R SPDIFSEL LL_RCC_SetSPDIFClockSource
  3041. * @param ClkSource This parameter can be one of the following values:
  3042. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_PLL1Q
  3043. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_PLL2R
  3044. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_PLL3R
  3045. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_HSI
  3046. * @retval None
  3047. */
  3048. __STATIC_INLINE void LL_RCC_SetSPDIFClockSource(uint32_t ClkSource)
  3049. {
  3050. #if defined(RCC_D2CCIP1R_SPDIFSEL)
  3051. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPDIFSEL, ClkSource);
  3052. #else
  3053. MODIFY_REG(RCC->CDCCIP1R, RCC_CDCCIP1R_SPDIFSEL, ClkSource);
  3054. #endif /* RCC_D2CCIP1R_SPDIFSEL */
  3055. }
  3056. /**
  3057. * @brief Configure FDCANx Kernel clock source
  3058. * @rmtoll D2CCIP1R / CDCCIP1R FDCANSEL LL_RCC_SetFDCANClockSource
  3059. * @param ClkSource This parameter can be one of the following values:
  3060. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
  3061. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL1Q
  3062. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL2Q
  3063. * @retval None
  3064. */
  3065. __STATIC_INLINE void LL_RCC_SetFDCANClockSource(uint32_t ClkSource)
  3066. {
  3067. #if defined(RCC_D2CCIP1R_FDCANSEL)
  3068. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_FDCANSEL, ClkSource);
  3069. #else
  3070. MODIFY_REG(RCC->CDCCIP1R, RCC_CDCCIP1R_FDCANSEL, ClkSource);
  3071. #endif /* RCC_D2CCIP1R_FDCANSEL */
  3072. }
  3073. /**
  3074. * @brief Configure SWPx Kernel clock source
  3075. * @rmtoll D2CCIP1R / CDCCIP1R SWPSEL LL_RCC_SetSWPClockSource
  3076. * @param ClkSource This parameter can be one of the following values:
  3077. * @arg @ref LL_RCC_SWP_CLKSOURCE_PCLK1
  3078. * @arg @ref LL_RCC_SWP_CLKSOURCE_HSI
  3079. * @retval None
  3080. */
  3081. __STATIC_INLINE void LL_RCC_SetSWPClockSource(uint32_t ClkSource)
  3082. {
  3083. #if defined(RCC_D2CCIP1R_SWPSEL)
  3084. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SWPSEL, ClkSource);
  3085. #else
  3086. MODIFY_REG(RCC->CDCCIP1R, RCC_CDCCIP1R_SWPSEL, ClkSource);
  3087. #endif /* RCC_D2CCIP1R_SWPSEL */
  3088. }
  3089. /**
  3090. * @brief Configure ADCx Kernel clock source
  3091. * @rmtoll D3CCIPR / SRDCCIPR ADCSEL LL_RCC_SetADCClockSource
  3092. * @param ClkSource This parameter can be one of the following values:
  3093. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLL2P
  3094. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLL3R
  3095. * @arg @ref LL_RCC_ADC_CLKSOURCE_CLKP
  3096. * @retval None
  3097. */
  3098. __STATIC_INLINE void LL_RCC_SetADCClockSource(uint32_t ClkSource)
  3099. {
  3100. #if defined(RCC_D3CCIPR_ADCSEL)
  3101. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_ADCSEL, ClkSource);
  3102. #else
  3103. MODIFY_REG(RCC->SRDCCIPR, RCC_SRDCCIPR_ADCSEL, ClkSource);
  3104. #endif /* RCC_D3CCIPR_ADCSEL */
  3105. }
  3106. /**
  3107. * @brief Get periph clock source
  3108. * @rmtoll D1CCIPR / CDCCIPR * LL_RCC_GetClockSource\n
  3109. * D2CCIP1R / CDCCIP1R * LL_RCC_GetClockSource\n
  3110. * D2CCIP2R / CDCCIP2R * LL_RCC_GetClockSource\n
  3111. * D3CCIPR / SRDCCIPR * LL_RCC_GetClockSource
  3112. * @param Periph This parameter can be one of the following values:
  3113. * @arg @ref LL_RCC_USART16_CLKSOURCE
  3114. * @arg @ref LL_RCC_USART234578_CLKSOURCE
  3115. * @arg @ref LL_RCC_I2C123_CLKSOURCE
  3116. * @arg @ref LL_RCC_I2C4_CLKSOURCE
  3117. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
  3118. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE
  3119. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE
  3120. * @arg @ref LL_RCC_SAI1_CLKSOURCE
  3121. * @arg @ref LL_RCC_SAI23_CLKSOURCE
  3122. * @arg @ref LL_RCC_SAI4A_CLKSOURCE (*)
  3123. * @arg @ref LL_RCC_SAI4B_CLKSOURCE (*)
  3124. * @arg @ref LL_RCC_SAI2A_CLKSOURCE (*)
  3125. * @arg @ref LL_RCC_SAI2B_CLKSOURCE (*)
  3126. * @arg @ref LL_RCC_SPI123_CLKSOURCE (*)
  3127. * @arg @ref LL_RCC_SPI45_CLKSOURCE (*)
  3128. * @arg @ref LL_RCC_SPI6_CLKSOURCE (*)
  3129. * @retval Returned value can be one of the following values:
  3130. * @arg @ref LL_RCC_USART16_CLKSOURCE_PCLK2
  3131. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL2Q
  3132. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL3Q
  3133. * @arg @ref LL_RCC_USART16_CLKSOURCE_HSI
  3134. * @arg @ref LL_RCC_USART16_CLKSOURCE_CSI
  3135. * @arg @ref LL_RCC_USART16_CLKSOURCE_LSE
  3136. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PCLK1
  3137. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL2Q
  3138. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL3Q
  3139. * @arg @ref LL_RCC_USART234578_CLKSOURCE_HSI
  3140. * @arg @ref LL_RCC_USART234578_CLKSOURCE_CSI
  3141. * @arg @ref LL_RCC_USART234578_CLKSOURCE_LSE
  3142. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PCLK1
  3143. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PLL3R
  3144. * @arg @ref LL_RCC_I2C123_CLKSOURCE_HSI
  3145. * @arg @ref LL_RCC_I2C123_CLKSOURCE_CSI
  3146. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK4
  3147. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PLL3R
  3148. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI
  3149. * @arg @ref LL_RCC_I2C4_CLKSOURCE_CSI
  3150. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  3151. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL2P
  3152. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL3R
  3153. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  3154. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  3155. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_CLKP
  3156. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK4
  3157. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL2P
  3158. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL3R
  3159. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  3160. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  3161. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_CLKP
  3162. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PCLK4
  3163. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL2P
  3164. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL3R
  3165. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSE
  3166. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSI
  3167. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_CLKP
  3168. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL1Q
  3169. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL2P
  3170. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL3P
  3171. * @arg @ref LL_RCC_SAI1_CLKSOURCE_I2S_CKIN
  3172. * @arg @ref LL_RCC_SAI1_CLKSOURCE_CLKP
  3173. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL1Q (*)
  3174. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL2P (*)
  3175. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL3P (*)
  3176. * @arg @ref LL_RCC_SAI23_CLKSOURCE_I2S_CKIN (*)
  3177. * @arg @ref LL_RCC_SAI23_CLKSOURCE_CLKP (*)
  3178. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL1Q (*)
  3179. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL2P (*)
  3180. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL3P (*)
  3181. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_I2S_CKIN (*)
  3182. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_CLKP (*)
  3183. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL1Q (*)
  3184. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL2P (*)
  3185. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL3P (*)
  3186. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_I2S_CKIN (*)
  3187. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_CLKP (*)
  3188. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL1Q (*)
  3189. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL2P (*)
  3190. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL3P (*)
  3191. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_I2S_CKIN (*)
  3192. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_CLKP (*)
  3193. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_SPDIF (*)
  3194. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL1Q (*)
  3195. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL2P (*)
  3196. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL3P (*)
  3197. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_I2S_CKIN (*)
  3198. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_CLKP (*)
  3199. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_SPDIF (*)
  3200. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL1Q
  3201. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL2P
  3202. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL3P
  3203. * @arg @ref LL_RCC_SPI123_CLKSOURCE_I2S_CKIN
  3204. * @arg @ref LL_RCC_SPI123_CLKSOURCE_CLKP
  3205. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PCLK2
  3206. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL2Q
  3207. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL3Q
  3208. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSI
  3209. * @arg @ref LL_RCC_SPI45_CLKSOURCE_CSI
  3210. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSE
  3211. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PCLK4
  3212. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL2Q
  3213. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL3Q
  3214. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSI
  3215. * @arg @ref LL_RCC_SPI6_CLKSOURCE_CSI
  3216. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSE
  3217. * @arg @ref LL_RCC_SPI6_CLKSOURCE_I2S_CKIN (*)
  3218. *
  3219. * (*) value not defined in all devices.
  3220. * @retval None
  3221. */
  3222. __STATIC_INLINE uint32_t LL_RCC_GetClockSource(uint32_t Periph)
  3223. {
  3224. #if defined(RCC_D1CCIPR_FMCSEL)
  3225. const uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&RCC->D1CCIPR) + LL_CLKSOURCE_REG(Periph)));
  3226. #else
  3227. const uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&RCC->CDCCIPR) + LL_CLKSOURCE_REG(Periph)));
  3228. #endif /* RCC_D1CCIPR_FMCSEL */
  3229. return (uint32_t)(Periph | (((READ_BIT(*pReg, LL_CLKSOURCE_MASK(Periph))) >> LL_CLKSOURCE_SHIFT(Periph)) << LL_RCC_CONFIG_SHIFT));
  3230. }
  3231. /**
  3232. * @brief Get USARTx clock source
  3233. * @rmtoll D2CCIP2R / CDCCIP2R USART16SEL LL_RCC_GetUSARTClockSource\n
  3234. * D2CCIP2R / CDCCIP2R USART28SEL LL_RCC_GetUSARTClockSource
  3235. * @param Periph This parameter can be one of the following values:
  3236. * @arg @ref LL_RCC_USART16_CLKSOURCE
  3237. * @arg @ref LL_RCC_USART234578_CLKSOURCE
  3238. * @retval Returned value can be one of the following values:
  3239. * @arg @ref LL_RCC_USART16_CLKSOURCE_PCLK2
  3240. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL2Q
  3241. * @arg @ref LL_RCC_USART16_CLKSOURCE_PLL3Q
  3242. * @arg @ref LL_RCC_USART16_CLKSOURCE_HSI
  3243. * @arg @ref LL_RCC_USART16_CLKSOURCE_CSI
  3244. * @arg @ref LL_RCC_USART16_CLKSOURCE_LSE
  3245. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PCLK1
  3246. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL2Q
  3247. * @arg @ref LL_RCC_USART234578_CLKSOURCE_PLL3Q
  3248. * @arg @ref LL_RCC_USART234578_CLKSOURCE_HSI
  3249. * @arg @ref LL_RCC_USART234578_CLKSOURCE_CSI
  3250. * @arg @ref LL_RCC_USART234578_CLKSOURCE_LSE
  3251. */
  3252. __STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t Periph)
  3253. {
  3254. return LL_RCC_GetClockSource(Periph);
  3255. }
  3256. /**
  3257. * @brief Get LPUART clock source
  3258. * @rmtoll D3CCIPR / SRDCCIPR LPUART1SEL LL_RCC_GetLPUARTClockSource
  3259. * @param Periph This parameter can be one of the following values:
  3260. * @arg @ref LL_RCC_LPUART1_CLKSOURCE
  3261. * @retval Returned value can be one of the following values:
  3262. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK4
  3263. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PLL2Q
  3264. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PLL3Q
  3265. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  3266. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_CSI
  3267. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  3268. */
  3269. __STATIC_INLINE uint32_t LL_RCC_GetLPUARTClockSource(uint32_t Periph)
  3270. {
  3271. UNUSED(Periph);
  3272. #if defined(RCC_D3CCIPR_LPUART1SEL)
  3273. return (uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPUART1SEL));
  3274. #else
  3275. return (uint32_t)(READ_BIT(RCC->SRDCCIPR, RCC_SRDCCIPR_LPUART1SEL));
  3276. #endif /* RCC_D3CCIPR_LPUART1SEL */
  3277. }
  3278. /**
  3279. * @brief Get I2Cx clock source
  3280. * @rmtoll D2CCIP2R / CDCCIP2R I2C123SEL LL_RCC_GetI2CClockSource\n
  3281. * D3CCIPR / SRDCCIPR I2C4SEL LL_RCC_GetI2CClockSource
  3282. * @param Periph This parameter can be one of the following values:
  3283. * @arg @ref LL_RCC_I2C123_CLKSOURCE
  3284. * @arg @ref LL_RCC_I2C4_CLKSOURCE
  3285. * @retval Returned value can be one of the following values:
  3286. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PCLK1
  3287. * @arg @ref LL_RCC_I2C123_CLKSOURCE_PLL3R
  3288. * @arg @ref LL_RCC_I2C123_CLKSOURCE_HSI
  3289. * @arg @ref LL_RCC_I2C123_CLKSOURCE_CSI
  3290. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK4
  3291. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PLL3R
  3292. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI
  3293. * @arg @ref LL_RCC_I2C4_CLKSOURCE_CSI
  3294. */
  3295. __STATIC_INLINE uint32_t LL_RCC_GetI2CClockSource(uint32_t Periph)
  3296. {
  3297. return LL_RCC_GetClockSource(Periph);
  3298. }
  3299. /**
  3300. * @brief Get LPTIM clock source
  3301. * @rmtoll D2CCIP2R / CDCCIP2R LPTIM1SEL LL_RCC_GetLPTIMClockSource\n
  3302. * D3CCIPR / SRDCCIPR LPTIM2SEL LL_RCC_GetLPTIMClockSource\n
  3303. * D3CCIPR / SRDCCIPR LPTIM345SEL LL_RCC_GetLPTIMClockSource
  3304. * @param Periph This parameter can be one of the following values:
  3305. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
  3306. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE
  3307. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE
  3308. * @retval Returned value can be one of the following values:
  3309. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  3310. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL2P
  3311. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PLL3R
  3312. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  3313. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  3314. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_CLKP
  3315. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK4
  3316. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL2P
  3317. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PLL3R
  3318. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  3319. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  3320. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_CLKP
  3321. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PCLK4
  3322. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL2P
  3323. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_PLL3R
  3324. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSE
  3325. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_LSI
  3326. * @arg @ref LL_RCC_LPTIM345_CLKSOURCE_CLKP
  3327. * @retval None
  3328. */
  3329. __STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t Periph)
  3330. {
  3331. return LL_RCC_GetClockSource(Periph);
  3332. }
  3333. /**
  3334. * @brief Get SAIx clock source
  3335. * @rmtoll D2CCIP1R / CDCCIP1R SAI1SEL LL_RCC_GetSAIClockSource\n
  3336. * D2CCIP1R / CDCCIP1R SAI23SEL LL_RCC_GetSAIClockSource
  3337. * D3CCIPR / SRDCCIPR SAI4ASEL LL_RCC_GetSAIClockSource\n
  3338. * D3CCIPR / SRDCCIPR SAI4BSEL LL_RCC_GetSAIClockSource
  3339. * @param Periph This parameter can be one of the following values:
  3340. * @arg @ref LL_RCC_SAI1_CLKSOURCE (*)
  3341. * @arg @ref LL_RCC_SAI2A_CLKSOURCE (*)
  3342. * @arg @ref LL_RCC_SAI2B_CLKSOURCE (*)
  3343. * @arg @ref LL_RCC_SAI23_CLKSOURCE (*)
  3344. * @arg @ref LL_RCC_SAI4A_CLKSOURCE (*)
  3345. * @arg @ref LL_RCC_SAI4B_CLKSOURCE (*)
  3346. * @retval Returned value can be one of the following values:
  3347. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL1Q
  3348. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL2P
  3349. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL3P
  3350. * @arg @ref LL_RCC_SAI1_CLKSOURCE_I2S_CKIN
  3351. * @arg @ref LL_RCC_SAI1_CLKSOURCE_CLKP
  3352. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL1Q (*)
  3353. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL2P (*)
  3354. * @arg @ref LL_RCC_SAI23_CLKSOURCE_PLL3P (*)
  3355. * @arg @ref LL_RCC_SAI23_CLKSOURCE_I2S_CKIN (*)
  3356. * @arg @ref LL_RCC_SAI23_CLKSOURCE_CLKP (*)
  3357. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL1Q (*)
  3358. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL2P (*)
  3359. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_PLL3P (*)
  3360. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_I2S_CKIN (*)
  3361. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_CLKP (*)
  3362. * @arg @ref LL_RCC_SAI2A_CLKSOURCE_SPDIF (*)
  3363. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL1Q (*)
  3364. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL2P (*)
  3365. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_PLL3P (*)
  3366. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_I2S_CKIN (*)
  3367. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_CLKP (*)
  3368. * @arg @ref LL_RCC_SAI2B_CLKSOURCE_SPDIF (*)
  3369. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL1Q (*)
  3370. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL2P (*)
  3371. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_PLL3P (*)
  3372. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_I2S_CKIN (*)
  3373. * @arg @ref LL_RCC_SAI4A_CLKSOURCE_CLKP (*)
  3374. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL1Q (*)
  3375. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL2P (*)
  3376. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_PLL3P (*)
  3377. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_I2S_CKIN (*)
  3378. * @arg @ref LL_RCC_SAI4B_CLKSOURCE_CLKP (*)
  3379. *
  3380. * (*) value not defined in all devices.
  3381. */
  3382. __STATIC_INLINE uint32_t LL_RCC_GetSAIClockSource(uint32_t Periph)
  3383. {
  3384. return LL_RCC_GetClockSource(Periph);
  3385. }
  3386. /**
  3387. * @brief Get SDMMC clock source
  3388. * @rmtoll D1CCIPR / CDCCIPR SDMMCSEL LL_RCC_GetSDMMCClockSource
  3389. * @param Periph This parameter can be one of the following values:
  3390. * @arg @ref LL_RCC_SDMMC_CLKSOURCE
  3391. * @retval Returned value can be one of the following values:
  3392. * @arg @ref LL_RCC_SDMMC_CLKSOURCE_PLL1Q
  3393. * @arg @ref LL_RCC_SDMMC_CLKSOURCE_PLL2R
  3394. */
  3395. __STATIC_INLINE uint32_t LL_RCC_GetSDMMCClockSource(uint32_t Periph)
  3396. {
  3397. UNUSED(Periph);
  3398. #if defined(RCC_D1CCIPR_SDMMCSEL)
  3399. return (uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_SDMMCSEL));
  3400. #else
  3401. return (uint32_t)(READ_BIT(RCC->CDCCIPR, RCC_CDCCIPR_SDMMCSEL));
  3402. #endif /* RCC_D1CCIPR_SDMMCSEL */
  3403. }
  3404. /**
  3405. * @brief Get RNG clock source
  3406. * @rmtoll D2CCIP2R RNGSEL LL_RCC_GetRNGClockSource
  3407. * @param Periph This parameter can be one of the following values:
  3408. * @arg @ref LL_RCC_RNG_CLKSOURCE
  3409. * @retval Returned value can be one of the following values:
  3410. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48
  3411. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL1Q
  3412. * @arg @ref LL_RCC_RNG_CLKSOURCE_LSE
  3413. * @arg @ref LL_RCC_RNG_CLKSOURCE_LSI
  3414. */
  3415. __STATIC_INLINE uint32_t LL_RCC_GetRNGClockSource(uint32_t Periph)
  3416. {
  3417. UNUSED(Periph);
  3418. #if defined(RCC_D2CCIP2R_RNGSEL)
  3419. return (uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_RNGSEL));
  3420. #else
  3421. return (uint32_t)(READ_BIT(RCC->CDCCIP2R, RCC_CDCCIP2R_RNGSEL));
  3422. #endif /* RCC_D2CCIP2R_RNGSEL */
  3423. }
  3424. /**
  3425. * @brief Get USB clock source
  3426. * @rmtoll D2CCIP2R / CDCCIP2R USBSEL LL_RCC_GetUSBClockSource
  3427. * @param Periph This parameter can be one of the following values:
  3428. * @arg @ref LL_RCC_USB_CLKSOURCE
  3429. * @retval Returned value can be one of the following values:
  3430. * @arg @ref LL_RCC_USB_CLKSOURCE_DISABLE
  3431. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL1Q
  3432. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL3Q
  3433. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
  3434. */
  3435. __STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t Periph)
  3436. {
  3437. UNUSED(Periph);
  3438. #if defined(RCC_D2CCIP2R_USBSEL)
  3439. return (uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USBSEL));
  3440. #else
  3441. return (uint32_t)(READ_BIT(RCC->CDCCIP2R, RCC_CDCCIP2R_USBSEL));
  3442. #endif /* RCC_D2CCIP2R_USBSEL */
  3443. }
  3444. /**
  3445. * @brief Get CEC clock source
  3446. * @rmtoll D2CCIP2R / CDCCIP2R CECSEL LL_RCC_GetCECClockSource
  3447. * @param Periph This parameter can be one of the following values:
  3448. * @arg @ref LL_RCC_CEC_CLKSOURCE
  3449. * @retval Returned value can be one of the following values:
  3450. * @arg @ref LL_RCC_CEC_CLKSOURCE_LSE
  3451. * @arg @ref LL_RCC_CEC_CLKSOURCE_LSI
  3452. * @arg @ref LL_RCC_CEC_CLKSOURCE_CSI_DIV122
  3453. */
  3454. __STATIC_INLINE uint32_t LL_RCC_GetCECClockSource(uint32_t Periph)
  3455. {
  3456. UNUSED(Periph);
  3457. #if defined(RCC_D2CCIP2R_CECSEL)
  3458. return (uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_CECSEL));
  3459. #else
  3460. return (uint32_t)(READ_BIT(RCC->CDCCIP2R, RCC_CDCCIP2R_CECSEL));
  3461. #endif /* RCC_D2CCIP2R_CECSEL */
  3462. }
  3463. #if defined(DSI)
  3464. /**
  3465. * @brief Get DSI clock source
  3466. * @rmtoll D1CCIPR DSISEL LL_RCC_GetDSIClockSource
  3467. * @param Periph This parameter can be one of the following values:
  3468. * @arg @ref LL_RCC_DSI_CLKSOURCE
  3469. * @retval Returned value can be one of the following values:
  3470. * @arg @ref LL_RCC_DSI_CLKSOURCE_PHY
  3471. * @arg @ref LL_RCC_DSI_CLKSOURCE_PLL2Q
  3472. */
  3473. __STATIC_INLINE uint32_t LL_RCC_GetDSIClockSource(uint32_t Periph)
  3474. {
  3475. UNUSED(Periph);
  3476. return (uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_DSISEL));
  3477. }
  3478. #endif /* DSI */
  3479. /**
  3480. * @brief Get DFSDM Kernel clock source
  3481. * @rmtoll D2CCIP1R / CDCCIP1R DFSDM1SEL LL_RCC_GetDFSDMClockSource
  3482. * @param Periph This parameter can be one of the following values:
  3483. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE
  3484. * @retval Returned value can be one of the following values:
  3485. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  3486. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  3487. */
  3488. __STATIC_INLINE uint32_t LL_RCC_GetDFSDMClockSource(uint32_t Periph)
  3489. {
  3490. UNUSED(Periph);
  3491. #if defined(RCC_D2CCIP1R_DFSDM1SEL)
  3492. return (uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_DFSDM1SEL));
  3493. #else
  3494. return (uint32_t)(READ_BIT(RCC->CDCCIP1R, RCC_CDCCIP1R_DFSDM1SEL));
  3495. #endif /* RCC_D2CCIP1R_DFSDM1SEL */
  3496. }
  3497. #if defined(DFSDM2_BASE)
  3498. /**
  3499. * @brief Get DFSDM2 Kernel clock source
  3500. * @rmtoll SRDCCIPR DFSDM2SEL LL_RCC_GetDFSDM2ClockSource
  3501. * @param Periph This parameter can be one of the following values:
  3502. * @arg @ref LL_RCC_DFSDM2_CLKSOURCE
  3503. * @retval Returned value can be one of the following values:
  3504. * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_PCLK4
  3505. * @arg @ref LL_RCC_DFSDM2_CLKSOURCE_SYSCLK
  3506. */
  3507. __STATIC_INLINE uint32_t LL_RCC_GetDFSDM2ClockSource(uint32_t Periph)
  3508. {
  3509. UNUSED(Periph);
  3510. return (uint32_t)(READ_BIT(RCC->SRDCCIPR, RCC_SRDCCIPR_DFSDM2SEL));
  3511. }
  3512. #endif /* DFSDM2_BASE */
  3513. /**
  3514. * @brief Get FMC Kernel clock source
  3515. * @rmtoll D1CCIPR / D1CCIPR FMCSEL LL_RCC_GetFMCClockSource
  3516. * @param Periph This parameter can be one of the following values:
  3517. * @arg @ref LL_RCC_FMC_CLKSOURCE
  3518. * @retval Returned value can be one of the following values:
  3519. * @arg @ref LL_RCC_FMC_CLKSOURCE_HCLK
  3520. * @arg @ref LL_RCC_FMC_CLKSOURCE_PLL1Q
  3521. * @arg @ref LL_RCC_FMC_CLKSOURCE_PLL2R
  3522. * @arg @ref LL_RCC_FMC_CLKSOURCE_CLKP
  3523. */
  3524. __STATIC_INLINE uint32_t LL_RCC_GetFMCClockSource(uint32_t Periph)
  3525. {
  3526. UNUSED(Periph);
  3527. #if defined(RCC_D1CCIPR_FMCSEL)
  3528. return (uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_FMCSEL));
  3529. #else
  3530. return (uint32_t)(READ_BIT(RCC->CDCCIPR, RCC_CDCCIPR_FMCSEL));
  3531. #endif /* RCC_D1CCIPR_FMCSEL */
  3532. }
  3533. #if defined(QUADSPI)
  3534. /**
  3535. * @brief Get QSPI Kernel clock source
  3536. * @rmtoll D1CCIPR / CDCCIPR QSPISEL LL_RCC_GetQSPIClockSource
  3537. * @param Periph This parameter can be one of the following values:
  3538. * @arg @ref LL_RCC_QSPI_CLKSOURCE
  3539. * @retval Returned value can be one of the following values:
  3540. * @arg @ref LL_RCC_QSPI_CLKSOURCE_HCLK
  3541. * @arg @ref LL_RCC_QSPI_CLKSOURCE_PLL1Q
  3542. * @arg @ref LL_RCC_QSPI_CLKSOURCE_PLL2R
  3543. * @arg @ref LL_RCC_QSPI_CLKSOURCE_CLKP
  3544. */
  3545. __STATIC_INLINE uint32_t LL_RCC_GetQSPIClockSource(uint32_t Periph)
  3546. {
  3547. UNUSED(Periph);
  3548. return (uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_QSPISEL));
  3549. }
  3550. #endif /* QUADSPI */
  3551. #if defined(OCTOSPI1) || defined(OCTOSPI2)
  3552. /**
  3553. * @brief Get OSPI Kernel clock source
  3554. * @rmtoll CDCCIPR OSPISEL LL_RCC_GetOSPIClockSource
  3555. * @param Periph This parameter can be one of the following values:
  3556. * @arg @ref LL_RCC_OSPI_CLKSOURCE
  3557. * @retval Returned value can be one of the following values:
  3558. * @arg @ref LL_RCC_OSPI_CLKSOURCE_HCLK
  3559. * @arg @ref LL_RCC_OSPI_CLKSOURCE_PLL1Q
  3560. * @arg @ref LL_RCC_OSPI_CLKSOURCE_PLL2R
  3561. * @arg @ref LL_RCC_OSPI_CLKSOURCE_CLKP
  3562. */
  3563. __STATIC_INLINE uint32_t LL_RCC_GetOSPIClockSource(uint32_t Periph)
  3564. {
  3565. UNUSED(Periph);
  3566. #if defined(RCC_D1CCIPR_OCTOSPISEL)
  3567. return (uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_OCTOSPISEL));
  3568. #else
  3569. return (uint32_t)(READ_BIT(RCC->CDCCIPR, RCC_CDCCIPR_OCTOSPISEL));
  3570. #endif /* RCC_D1CCIPR_OCTOSPISEL */
  3571. }
  3572. #endif /* defined(OCTOSPI1) || defined(OCTOSPI2) */
  3573. /**
  3574. * @brief Get CLKP Kernel clock source
  3575. * @rmtoll D1CCIPR / CDCCIPR CKPERSEL LL_RCC_GetCLKPClockSource
  3576. * @param Periph This parameter can be one of the following values:
  3577. * @arg @ref LL_RCC_CLKP_CLKSOURCE
  3578. * @retval Returned value can be one of the following values:
  3579. * @arg @ref LL_RCC_CLKP_CLKSOURCE_HSI
  3580. * @arg @ref LL_RCC_CLKP_CLKSOURCE_CSI
  3581. * @arg @ref LL_RCC_CLKP_CLKSOURCE_HSE
  3582. */
  3583. __STATIC_INLINE uint32_t LL_RCC_GetCLKPClockSource(uint32_t Periph)
  3584. {
  3585. UNUSED(Periph);
  3586. #if defined(RCC_D1CCIPR_CKPERSEL)
  3587. return (uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_CKPERSEL));
  3588. #else
  3589. return (uint32_t)(READ_BIT(RCC->CDCCIPR, RCC_CDCCIPR_CKPERSEL));
  3590. #endif /* RCC_D1CCIPR_CKPERSEL */
  3591. }
  3592. /**
  3593. * @brief Get SPIx Kernel clock source
  3594. * @rmtoll D2CCIP1R / CDCCIP1R SPI123SEL LL_RCC_GetSPIClockSource\n
  3595. * D2CCIP1R / CDCCIP1R SPI45SEL LL_RCC_GetSPIClockSource\n
  3596. * D3CCIPR / SRDCCIPR SPI6SEL LL_RCC_GetSPIClockSource
  3597. * @param Periph This parameter can be one of the following values:
  3598. * @arg @ref LL_RCC_SPI123_CLKSOURCE
  3599. * @arg @ref LL_RCC_SPI45_CLKSOURCE
  3600. * @arg @ref LL_RCC_SPI6_CLKSOURCE
  3601. * @retval Returned value can be one of the following values:
  3602. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL1Q
  3603. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL2P
  3604. * @arg @ref LL_RCC_SPI123_CLKSOURCE_PLL3P
  3605. * @arg @ref LL_RCC_SPI123_CLKSOURCE_I2S_CKIN
  3606. * @arg @ref LL_RCC_SPI123_CLKSOURCE_CLKP
  3607. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PCLK2
  3608. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL2Q
  3609. * @arg @ref LL_RCC_SPI45_CLKSOURCE_PLL3Q
  3610. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSI
  3611. * @arg @ref LL_RCC_SPI45_CLKSOURCE_CSI
  3612. * @arg @ref LL_RCC_SPI45_CLKSOURCE_HSE
  3613. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PCLK4
  3614. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL2Q
  3615. * @arg @ref LL_RCC_SPI6_CLKSOURCE_PLL3Q
  3616. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSI
  3617. * @arg @ref LL_RCC_SPI6_CLKSOURCE_CSI
  3618. * @arg @ref LL_RCC_SPI6_CLKSOURCE_HSE
  3619. * @arg @ref LL_RCC_SPI6_CLKSOURCE_I2S_CKIN (*)
  3620. *
  3621. * (*) value not defined in all stm32h7xx lines.
  3622. */
  3623. __STATIC_INLINE uint32_t LL_RCC_GetSPIClockSource(uint32_t Periph)
  3624. {
  3625. return LL_RCC_GetClockSource(Periph);
  3626. }
  3627. /**
  3628. * @brief Get SPDIF Kernel clock source
  3629. * @rmtoll D2CCIP1R / CDCCIP1R SPDIFSEL LL_RCC_GetSPDIFClockSource
  3630. * @param Periph This parameter can be one of the following values:
  3631. * @arg @ref LL_RCC_SPDIF_CLKSOURCE
  3632. * @retval Returned value can be one of the following values:
  3633. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_PLL1Q
  3634. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_PLL2R
  3635. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_PLL3R
  3636. * @arg @ref LL_RCC_SPDIF_CLKSOURCE_HSI
  3637. */
  3638. __STATIC_INLINE uint32_t LL_RCC_GetSPDIFClockSource(uint32_t Periph)
  3639. {
  3640. UNUSED(Periph);
  3641. #if defined(RCC_D2CCIP1R_SPDIFSEL)
  3642. return (uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPDIFSEL));
  3643. #else
  3644. return (uint32_t)(READ_BIT(RCC->CDCCIP1R, RCC_CDCCIP1R_SPDIFSEL));
  3645. #endif /* RCC_D2CCIP1R_SPDIFSEL */
  3646. }
  3647. /**
  3648. * @brief Get FDCAN Kernel clock source
  3649. * @rmtoll D2CCIP1R / CDCCIP1R FDCANSEL LL_RCC_GetFDCANClockSource
  3650. * @param Periph This parameter can be one of the following values:
  3651. * @arg @ref LL_RCC_FDCAN_CLKSOURCE
  3652. * @retval Returned value can be one of the following values:
  3653. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
  3654. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL1Q
  3655. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL2Q
  3656. */
  3657. __STATIC_INLINE uint32_t LL_RCC_GetFDCANClockSource(uint32_t Periph)
  3658. {
  3659. UNUSED(Periph);
  3660. #if defined(RCC_D2CCIP1R_FDCANSEL)
  3661. return (uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_FDCANSEL));
  3662. #else
  3663. return (uint32_t)(READ_BIT(RCC->CDCCIP1R, RCC_CDCCIP1R_FDCANSEL));
  3664. #endif /* RCC_D2CCIP1R_FDCANSEL */
  3665. }
  3666. /**
  3667. * @brief Get SWP Kernel clock source
  3668. * @rmtoll D2CCIP1R / CDCCIP1R SWPSEL LL_RCC_GetSWPClockSource
  3669. * @param Periph This parameter can be one of the following values:
  3670. * @arg @ref LL_RCC_SWP_CLKSOURCE
  3671. * @retval Returned value can be one of the following values:
  3672. * @arg @ref LL_RCC_SWP_CLKSOURCE_PCLK1
  3673. * @arg @ref LL_RCC_SWP_CLKSOURCE_HSI
  3674. */
  3675. __STATIC_INLINE uint32_t LL_RCC_GetSWPClockSource(uint32_t Periph)
  3676. {
  3677. UNUSED(Periph);
  3678. #if defined(RCC_D2CCIP1R_SWPSEL)
  3679. return (uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SWPSEL));
  3680. #else
  3681. return (uint32_t)(READ_BIT(RCC->CDCCIP1R, RCC_CDCCIP1R_SWPSEL));
  3682. #endif /* RCC_D2CCIP1R_SWPSEL */
  3683. }
  3684. /**
  3685. * @brief Get ADC Kernel clock source
  3686. * @rmtoll D3CCIPR / SRDCCIPR ADCSEL LL_RCC_GetADCClockSource
  3687. * @param Periph This parameter can be one of the following values:
  3688. * @arg @ref LL_RCC_ADC_CLKSOURCE
  3689. * @retval Returned value can be one of the following values:
  3690. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLL2P
  3691. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLL3R
  3692. * @arg @ref LL_RCC_ADC_CLKSOURCE_CLKP
  3693. */
  3694. __STATIC_INLINE uint32_t LL_RCC_GetADCClockSource(uint32_t Periph)
  3695. {
  3696. UNUSED(Periph);
  3697. #if defined (RCC_D3CCIPR_ADCSEL)
  3698. return (uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_ADCSEL));
  3699. #else
  3700. return (uint32_t)(READ_BIT(RCC->SRDCCIPR, RCC_SRDCCIPR_ADCSEL));
  3701. #endif /* RCC_D3CCIPR_ADCSEL */
  3702. }
  3703. /**
  3704. * @}
  3705. */
  3706. /** @defgroup RCC_LL_EF_RTC RTC
  3707. * @{
  3708. */
  3709. /**
  3710. * @brief Set RTC Clock Source
  3711. * @note Once the RTC clock source has been selected, it cannot be changed anymore unless
  3712. * the Backup domain is reset, or unless a failure is detected on LSE (LSECSSD is
  3713. * set). The BDRST bit can be used to reset them.
  3714. * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource
  3715. * @param Source This parameter can be one of the following values:
  3716. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  3717. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  3718. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  3719. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE
  3720. * @retval None
  3721. */
  3722. __STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source)
  3723. {
  3724. MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source);
  3725. }
  3726. /**
  3727. * @brief Get RTC Clock Source
  3728. * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource
  3729. * @retval Returned value can be one of the following values:
  3730. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  3731. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  3732. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  3733. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE
  3734. */
  3735. __STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void)
  3736. {
  3737. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL));
  3738. }
  3739. /**
  3740. * @brief Enable RTC
  3741. * @rmtoll BDCR RTCEN LL_RCC_EnableRTC
  3742. * @retval None
  3743. */
  3744. __STATIC_INLINE void LL_RCC_EnableRTC(void)
  3745. {
  3746. SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  3747. }
  3748. /**
  3749. * @brief Disable RTC
  3750. * @rmtoll BDCR RTCEN LL_RCC_DisableRTC
  3751. * @retval None
  3752. */
  3753. __STATIC_INLINE void LL_RCC_DisableRTC(void)
  3754. {
  3755. CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  3756. }
  3757. /**
  3758. * @brief Check if RTC has been enabled or not
  3759. * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC
  3760. * @retval State of bit (1 or 0).
  3761. */
  3762. __STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void)
  3763. {
  3764. return ((READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == (RCC_BDCR_RTCEN)) ? 1UL : 0UL);
  3765. }
  3766. /**
  3767. * @brief Force the Backup domain reset
  3768. * @rmtoll BDCR BDRST / VSWRST LL_RCC_ForceBackupDomainReset
  3769. * @retval None
  3770. */
  3771. __STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void)
  3772. {
  3773. SET_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  3774. }
  3775. /**
  3776. * @brief Release the Backup domain reset
  3777. * @rmtoll BDCR BDRST / VSWRST LL_RCC_ReleaseBackupDomainReset
  3778. * @retval None
  3779. */
  3780. __STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void)
  3781. {
  3782. #if defined(RCC_BDCR_BDRST)
  3783. CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  3784. #else
  3785. CLEAR_BIT(RCC->BDCR, RCC_BDCR_VSWRST);
  3786. #endif /* RCC_BDCR_BDRST */
  3787. }
  3788. /**
  3789. * @brief Set HSE Prescalers for RTC Clock
  3790. * @rmtoll CFGR RTCPRE LL_RCC_SetRTC_HSEPrescaler
  3791. * @param Prescaler This parameter can be one of the following values:
  3792. * @arg @ref LL_RCC_RTC_NOCLOCK
  3793. * @arg @ref LL_RCC_RTC_HSE_DIV_2
  3794. * @arg @ref LL_RCC_RTC_HSE_DIV_3
  3795. * @arg @ref LL_RCC_RTC_HSE_DIV_4
  3796. * @arg @ref LL_RCC_RTC_HSE_DIV_5
  3797. * @arg @ref LL_RCC_RTC_HSE_DIV_6
  3798. * @arg @ref LL_RCC_RTC_HSE_DIV_7
  3799. * @arg @ref LL_RCC_RTC_HSE_DIV_8
  3800. * @arg @ref LL_RCC_RTC_HSE_DIV_9
  3801. * @arg @ref LL_RCC_RTC_HSE_DIV_10
  3802. * @arg @ref LL_RCC_RTC_HSE_DIV_11
  3803. * @arg @ref LL_RCC_RTC_HSE_DIV_12
  3804. * @arg @ref LL_RCC_RTC_HSE_DIV_13
  3805. * @arg @ref LL_RCC_RTC_HSE_DIV_14
  3806. * @arg @ref LL_RCC_RTC_HSE_DIV_15
  3807. * @arg @ref LL_RCC_RTC_HSE_DIV_16
  3808. * @arg @ref LL_RCC_RTC_HSE_DIV_17
  3809. * @arg @ref LL_RCC_RTC_HSE_DIV_18
  3810. * @arg @ref LL_RCC_RTC_HSE_DIV_19
  3811. * @arg @ref LL_RCC_RTC_HSE_DIV_20
  3812. * @arg @ref LL_RCC_RTC_HSE_DIV_21
  3813. * @arg @ref LL_RCC_RTC_HSE_DIV_22
  3814. * @arg @ref LL_RCC_RTC_HSE_DIV_23
  3815. * @arg @ref LL_RCC_RTC_HSE_DIV_24
  3816. * @arg @ref LL_RCC_RTC_HSE_DIV_25
  3817. * @arg @ref LL_RCC_RTC_HSE_DIV_26
  3818. * @arg @ref LL_RCC_RTC_HSE_DIV_27
  3819. * @arg @ref LL_RCC_RTC_HSE_DIV_28
  3820. * @arg @ref LL_RCC_RTC_HSE_DIV_29
  3821. * @arg @ref LL_RCC_RTC_HSE_DIV_30
  3822. * @arg @ref LL_RCC_RTC_HSE_DIV_31
  3823. * @arg @ref LL_RCC_RTC_HSE_DIV_32
  3824. * @arg @ref LL_RCC_RTC_HSE_DIV_33
  3825. * @arg @ref LL_RCC_RTC_HSE_DIV_34
  3826. * @arg @ref LL_RCC_RTC_HSE_DIV_35
  3827. * @arg @ref LL_RCC_RTC_HSE_DIV_36
  3828. * @arg @ref LL_RCC_RTC_HSE_DIV_37
  3829. * @arg @ref LL_RCC_RTC_HSE_DIV_38
  3830. * @arg @ref LL_RCC_RTC_HSE_DIV_39
  3831. * @arg @ref LL_RCC_RTC_HSE_DIV_40
  3832. * @arg @ref LL_RCC_RTC_HSE_DIV_41
  3833. * @arg @ref LL_RCC_RTC_HSE_DIV_42
  3834. * @arg @ref LL_RCC_RTC_HSE_DIV_43
  3835. * @arg @ref LL_RCC_RTC_HSE_DIV_44
  3836. * @arg @ref LL_RCC_RTC_HSE_DIV_45
  3837. * @arg @ref LL_RCC_RTC_HSE_DIV_46
  3838. * @arg @ref LL_RCC_RTC_HSE_DIV_47
  3839. * @arg @ref LL_RCC_RTC_HSE_DIV_48
  3840. * @arg @ref LL_RCC_RTC_HSE_DIV_49
  3841. * @arg @ref LL_RCC_RTC_HSE_DIV_50
  3842. * @arg @ref LL_RCC_RTC_HSE_DIV_51
  3843. * @arg @ref LL_RCC_RTC_HSE_DIV_52
  3844. * @arg @ref LL_RCC_RTC_HSE_DIV_53
  3845. * @arg @ref LL_RCC_RTC_HSE_DIV_54
  3846. * @arg @ref LL_RCC_RTC_HSE_DIV_55
  3847. * @arg @ref LL_RCC_RTC_HSE_DIV_56
  3848. * @arg @ref LL_RCC_RTC_HSE_DIV_57
  3849. * @arg @ref LL_RCC_RTC_HSE_DIV_58
  3850. * @arg @ref LL_RCC_RTC_HSE_DIV_59
  3851. * @arg @ref LL_RCC_RTC_HSE_DIV_60
  3852. * @arg @ref LL_RCC_RTC_HSE_DIV_61
  3853. * @arg @ref LL_RCC_RTC_HSE_DIV_62
  3854. * @arg @ref LL_RCC_RTC_HSE_DIV_63
  3855. * @retval None
  3856. */
  3857. __STATIC_INLINE void LL_RCC_SetRTC_HSEPrescaler(uint32_t Prescaler)
  3858. {
  3859. MODIFY_REG(RCC->CFGR, RCC_CFGR_RTCPRE, Prescaler);
  3860. }
  3861. /**
  3862. * @brief Get HSE Prescalers for RTC Clock
  3863. * @rmtoll CFGR RTCPRE LL_RCC_GetRTC_HSEPrescaler
  3864. * @retval Returned value can be one of the following values:
  3865. * @arg @ref LL_RCC_RTC_NOCLOCK
  3866. * @arg @ref LL_RCC_RTC_HSE_DIV_2
  3867. * @arg @ref LL_RCC_RTC_HSE_DIV_3
  3868. * @arg @ref LL_RCC_RTC_HSE_DIV_4
  3869. * @arg @ref LL_RCC_RTC_HSE_DIV_5
  3870. * @arg @ref LL_RCC_RTC_HSE_DIV_6
  3871. * @arg @ref LL_RCC_RTC_HSE_DIV_7
  3872. * @arg @ref LL_RCC_RTC_HSE_DIV_8
  3873. * @arg @ref LL_RCC_RTC_HSE_DIV_9
  3874. * @arg @ref LL_RCC_RTC_HSE_DIV_10
  3875. * @arg @ref LL_RCC_RTC_HSE_DIV_11
  3876. * @arg @ref LL_RCC_RTC_HSE_DIV_12
  3877. * @arg @ref LL_RCC_RTC_HSE_DIV_13
  3878. * @arg @ref LL_RCC_RTC_HSE_DIV_14
  3879. * @arg @ref LL_RCC_RTC_HSE_DIV_15
  3880. * @arg @ref LL_RCC_RTC_HSE_DIV_16
  3881. * @arg @ref LL_RCC_RTC_HSE_DIV_17
  3882. * @arg @ref LL_RCC_RTC_HSE_DIV_18
  3883. * @arg @ref LL_RCC_RTC_HSE_DIV_19
  3884. * @arg @ref LL_RCC_RTC_HSE_DIV_20
  3885. * @arg @ref LL_RCC_RTC_HSE_DIV_21
  3886. * @arg @ref LL_RCC_RTC_HSE_DIV_22
  3887. * @arg @ref LL_RCC_RTC_HSE_DIV_23
  3888. * @arg @ref LL_RCC_RTC_HSE_DIV_24
  3889. * @arg @ref LL_RCC_RTC_HSE_DIV_25
  3890. * @arg @ref LL_RCC_RTC_HSE_DIV_26
  3891. * @arg @ref LL_RCC_RTC_HSE_DIV_27
  3892. * @arg @ref LL_RCC_RTC_HSE_DIV_28
  3893. * @arg @ref LL_RCC_RTC_HSE_DIV_29
  3894. * @arg @ref LL_RCC_RTC_HSE_DIV_30
  3895. * @arg @ref LL_RCC_RTC_HSE_DIV_31
  3896. * @arg @ref LL_RCC_RTC_HSE_DIV_32
  3897. * @arg @ref LL_RCC_RTC_HSE_DIV_33
  3898. * @arg @ref LL_RCC_RTC_HSE_DIV_34
  3899. * @arg @ref LL_RCC_RTC_HSE_DIV_35
  3900. * @arg @ref LL_RCC_RTC_HSE_DIV_36
  3901. * @arg @ref LL_RCC_RTC_HSE_DIV_37
  3902. * @arg @ref LL_RCC_RTC_HSE_DIV_38
  3903. * @arg @ref LL_RCC_RTC_HSE_DIV_39
  3904. * @arg @ref LL_RCC_RTC_HSE_DIV_40
  3905. * @arg @ref LL_RCC_RTC_HSE_DIV_41
  3906. * @arg @ref LL_RCC_RTC_HSE_DIV_42
  3907. * @arg @ref LL_RCC_RTC_HSE_DIV_43
  3908. * @arg @ref LL_RCC_RTC_HSE_DIV_44
  3909. * @arg @ref LL_RCC_RTC_HSE_DIV_45
  3910. * @arg @ref LL_RCC_RTC_HSE_DIV_46
  3911. * @arg @ref LL_RCC_RTC_HSE_DIV_47
  3912. * @arg @ref LL_RCC_RTC_HSE_DIV_48
  3913. * @arg @ref LL_RCC_RTC_HSE_DIV_49
  3914. * @arg @ref LL_RCC_RTC_HSE_DIV_50
  3915. * @arg @ref LL_RCC_RTC_HSE_DIV_51
  3916. * @arg @ref LL_RCC_RTC_HSE_DIV_52
  3917. * @arg @ref LL_RCC_RTC_HSE_DIV_53
  3918. * @arg @ref LL_RCC_RTC_HSE_DIV_54
  3919. * @arg @ref LL_RCC_RTC_HSE_DIV_55
  3920. * @arg @ref LL_RCC_RTC_HSE_DIV_56
  3921. * @arg @ref LL_RCC_RTC_HSE_DIV_57
  3922. * @arg @ref LL_RCC_RTC_HSE_DIV_58
  3923. * @arg @ref LL_RCC_RTC_HSE_DIV_59
  3924. * @arg @ref LL_RCC_RTC_HSE_DIV_60
  3925. * @arg @ref LL_RCC_RTC_HSE_DIV_61
  3926. * @arg @ref LL_RCC_RTC_HSE_DIV_62
  3927. * @arg @ref LL_RCC_RTC_HSE_DIV_63
  3928. */
  3929. __STATIC_INLINE uint32_t LL_RCC_GetRTC_HSEPrescaler(void)
  3930. {
  3931. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_RTCPRE));
  3932. }
  3933. /**
  3934. * @}
  3935. */
  3936. /** @defgroup RCC_LL_EF_TIM_CLOCK_PRESCALER TIM
  3937. * @{
  3938. */
  3939. /**
  3940. * @brief Set Timers Clock Prescalers
  3941. * @rmtoll CFGR TIMPRE LL_RCC_SetTIMPrescaler
  3942. * @param Prescaler This parameter can be one of the following values:
  3943. * @arg @ref LL_RCC_TIM_PRESCALER_TWICE
  3944. * @arg @ref LL_RCC_TIM_PRESCALER_FOUR_TIMES
  3945. * @retval None
  3946. */
  3947. __STATIC_INLINE void LL_RCC_SetTIMPrescaler(uint32_t Prescaler)
  3948. {
  3949. MODIFY_REG(RCC->CFGR, RCC_CFGR_TIMPRE, Prescaler);
  3950. }
  3951. /**
  3952. * @brief Get Timers Clock Prescalers
  3953. * @rmtoll CFGR TIMPRE LL_RCC_GetTIMPrescaler
  3954. * @retval Returned value can be one of the following values:
  3955. * @arg @ref LL_RCC_TIM_PRESCALER_TWICE
  3956. * @arg @ref LL_RCC_TIM_PRESCALER_FOUR_TIMES
  3957. */
  3958. __STATIC_INLINE uint32_t LL_RCC_GetTIMPrescaler(void)
  3959. {
  3960. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_TIMPRE));
  3961. }
  3962. /**
  3963. * @}
  3964. */
  3965. #if defined(HRTIM1)
  3966. /** @defgroup RCC_LL_EF_HRTIM_SET_CLOCK_SOURCE HRTIM
  3967. * @{
  3968. */
  3969. /**
  3970. * @brief Set High Resolution Timers Clock Source
  3971. * @rmtoll CFGR HRTIMSEL LL_RCC_SetHRTIMClockSource
  3972. * @param Prescaler This parameter can be one of the following values:
  3973. * @arg @ref LL_RCC_HRTIM_CLKSOURCE_TIM
  3974. * @arg @ref LL_RCC_HRTIM_CLKSOURCE_CPU
  3975. * @retval None
  3976. */
  3977. __STATIC_INLINE void LL_RCC_SetHRTIMClockSource(uint32_t Prescaler)
  3978. {
  3979. MODIFY_REG(RCC->CFGR, RCC_CFGR_HRTIMSEL, Prescaler);
  3980. }
  3981. #endif /* HRTIM1 */
  3982. #if defined(HRTIM1)
  3983. /**
  3984. * @brief Get High Resolution Timers Clock Source
  3985. * @rmtoll CFGR HRTIMSEL LL_RCC_GetHRTIMClockSource
  3986. * @retval Returned value can be one of the following values:
  3987. * @arg @ref LL_RCC_HRTIM_CLKSOURCE_TIM
  3988. * @arg @ref LL_RCC_HRTIM_CLKSOURCE_CPU
  3989. */
  3990. __STATIC_INLINE uint32_t LL_RCC_GetHRTIMClockSource(void)
  3991. {
  3992. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HRTIMSEL));
  3993. }
  3994. /**
  3995. * @}
  3996. */
  3997. #endif /* HRTIM1 */
  3998. /** @defgroup RCC_LL_EF_PLL PLL
  3999. * @{
  4000. */
  4001. /**
  4002. * @brief Set the oscillator used as PLL clock source.
  4003. * @note PLLSRC can be written only when All PLLs are disabled.
  4004. * @rmtoll PLLCKSELR PLLSRC LL_RCC_PLL_SetSource
  4005. * @param PLLSource parameter can be one of the following values:
  4006. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4007. * @arg @ref LL_RCC_PLLSOURCE_CSI
  4008. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4009. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4010. * @retval None
  4011. */
  4012. __STATIC_INLINE void LL_RCC_PLL_SetSource(uint32_t PLLSource)
  4013. {
  4014. MODIFY_REG(RCC->PLLCKSELR, RCC_PLLCKSELR_PLLSRC, PLLSource);
  4015. }
  4016. /**
  4017. * @brief Get the oscillator used as PLL clock source.
  4018. * @rmtoll PLLCKSELR PLLSRC LL_RCC_PLL_GetSource
  4019. * @retval Returned value can be one of the following values:
  4020. * @arg @ref LL_RCC_PLLSOURCE_HSI
  4021. * @arg @ref LL_RCC_PLLSOURCE_CSI
  4022. * @arg @ref LL_RCC_PLLSOURCE_HSE
  4023. * @arg @ref LL_RCC_PLLSOURCE_NONE
  4024. */
  4025. __STATIC_INLINE uint32_t LL_RCC_PLL_GetSource(void)
  4026. {
  4027. return (uint32_t)(READ_BIT(RCC->PLLCKSELR, RCC_PLLCKSELR_PLLSRC));
  4028. }
  4029. /**
  4030. * @brief Enable PLL1
  4031. * @rmtoll CR PLL1ON LL_RCC_PLL1_Enable
  4032. * @retval None
  4033. */
  4034. __STATIC_INLINE void LL_RCC_PLL1_Enable(void)
  4035. {
  4036. SET_BIT(RCC->CR, RCC_CR_PLL1ON);
  4037. }
  4038. /**
  4039. * @brief Disable PLL1
  4040. * @note Cannot be disabled if the PLL1 clock is used as the system clock
  4041. * @rmtoll CR PLL1ON LL_RCC_PLL1_Disable
  4042. * @retval None
  4043. */
  4044. __STATIC_INLINE void LL_RCC_PLL1_Disable(void)
  4045. {
  4046. CLEAR_BIT(RCC->CR, RCC_CR_PLL1ON);
  4047. }
  4048. /**
  4049. * @brief Check if PLL1 Ready
  4050. * @rmtoll CR PLL1RDY LL_RCC_PLL1_IsReady
  4051. * @retval State of bit (1 or 0).
  4052. */
  4053. __STATIC_INLINE uint32_t LL_RCC_PLL1_IsReady(void)
  4054. {
  4055. return ((READ_BIT(RCC->CR, RCC_CR_PLL1RDY) == (RCC_CR_PLL1RDY)) ? 1UL : 0UL);
  4056. }
  4057. /**
  4058. * @brief Enable PLL1P
  4059. * @note This API shall be called only when PLL1 is disabled.
  4060. * @rmtoll PLLCFGR DIVP1EN LL_RCC_PLL1P_Enable
  4061. * @retval None
  4062. */
  4063. __STATIC_INLINE void LL_RCC_PLL1P_Enable(void)
  4064. {
  4065. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP1EN);
  4066. }
  4067. /**
  4068. * @brief Enable PLL1Q
  4069. * @note This API shall be called only when PLL1 is disabled.
  4070. * @rmtoll PLLCFGR DIVQ1EN LL_RCC_PLL1Q_Enable
  4071. * @retval None
  4072. */
  4073. __STATIC_INLINE void LL_RCC_PLL1Q_Enable(void)
  4074. {
  4075. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ1EN);
  4076. }
  4077. /**
  4078. * @brief Enable PLL1R
  4079. * @note This API shall be called only when PLL1 is disabled.
  4080. * @rmtoll PLLCFGR DIVR1EN LL_RCC_PLL1R_Enable
  4081. * @retval None
  4082. */
  4083. __STATIC_INLINE void LL_RCC_PLL1R_Enable(void)
  4084. {
  4085. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR1EN);
  4086. }
  4087. /**
  4088. * @brief Enable PLL1 FRACN
  4089. * @rmtoll PLLCFGR PLL1FRACEN LL_RCC_PLL1FRACN_Enable
  4090. * @retval None
  4091. */
  4092. __STATIC_INLINE void LL_RCC_PLL1FRACN_Enable(void)
  4093. {
  4094. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL1FRACEN);
  4095. }
  4096. /**
  4097. * @brief Check if PLL1 P is enabled
  4098. * @rmtoll PLLCFGR DIVP1EN LL_RCC_PLL1P_IsEnabled
  4099. * @retval State of bit (1 or 0).
  4100. */
  4101. __STATIC_INLINE uint32_t LL_RCC_PLL1P_IsEnabled(void)
  4102. {
  4103. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP1EN) == RCC_PLLCFGR_DIVP1EN) ? 1UL : 0UL);
  4104. }
  4105. /**
  4106. * @brief Check if PLL1 Q is enabled
  4107. * @rmtoll PLLCFGR DIVQ1EN LL_RCC_PLL1Q_IsEnabled
  4108. * @retval State of bit (1 or 0).
  4109. */
  4110. __STATIC_INLINE uint32_t LL_RCC_PLL1Q_IsEnabled(void)
  4111. {
  4112. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ1EN) == RCC_PLLCFGR_DIVQ1EN) ? 1UL : 0UL);
  4113. }
  4114. /**
  4115. * @brief Check if PLL1 R is enabled
  4116. * @rmtoll PLLCFGR DIVR1EN LL_RCC_PLL1R_IsEnabled
  4117. * @retval State of bit (1 or 0).
  4118. */
  4119. __STATIC_INLINE uint32_t LL_RCC_PLL1R_IsEnabled(void)
  4120. {
  4121. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR1EN) == RCC_PLLCFGR_DIVR1EN) ? 1UL : 0UL);
  4122. }
  4123. /**
  4124. * @brief Check if PLL1 FRACN is enabled
  4125. * @rmtoll PLLCFGR PLL1FRACEN LL_RCC_PLL1FRACN_IsEnabled
  4126. * @retval State of bit (1 or 0).
  4127. */
  4128. __STATIC_INLINE uint32_t LL_RCC_PLL1FRACN_IsEnabled(void)
  4129. {
  4130. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL1FRACEN) == RCC_PLLCFGR_PLL1FRACEN) ? 1UL : 0UL);
  4131. }
  4132. /**
  4133. * @brief Disable PLL1P
  4134. * @note This API shall be called only when PLL1 is disabled.
  4135. * @rmtoll PLLCFGR DIVP1EN LL_RCC_PLL1P_Disable
  4136. * @retval None
  4137. */
  4138. __STATIC_INLINE void LL_RCC_PLL1P_Disable(void)
  4139. {
  4140. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP1EN);
  4141. }
  4142. /**
  4143. * @brief Disable PLL1Q
  4144. * @note This API shall be called only when PLL1 is disabled.
  4145. * @rmtoll PLLCFGR DIVQ1EN LL_RCC_PLL1Q_Disable
  4146. * @retval None
  4147. */
  4148. __STATIC_INLINE void LL_RCC_PLL1Q_Disable(void)
  4149. {
  4150. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ1EN);
  4151. }
  4152. /**
  4153. * @brief Disable PLL1R
  4154. * @note This API shall be called only when PLL1 is disabled.
  4155. * @rmtoll PLLCFGR DIVR1EN LL_RCC_PLL1R_Disable
  4156. * @retval None
  4157. */
  4158. __STATIC_INLINE void LL_RCC_PLL1R_Disable(void)
  4159. {
  4160. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR1EN);
  4161. }
  4162. /**
  4163. * @brief Disable PLL1 FRACN
  4164. * @rmtoll PLLCFGR PLL1FRACEN LL_RCC_PLL1FRACN_Enable
  4165. * @retval None
  4166. */
  4167. __STATIC_INLINE void LL_RCC_PLL1FRACN_Disable(void)
  4168. {
  4169. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL1FRACEN);
  4170. }
  4171. /**
  4172. * @brief Set PLL1 VCO OutputRange
  4173. * @note This API shall be called only when PLL1 is disabled.
  4174. * @rmtoll PLLCFGR PLL1VCOSEL LL_RCC_PLL1_SetVCOOuputRange
  4175. * @param VCORange This parameter can be one of the following values:
  4176. * @arg @ref LL_RCC_PLLVCORANGE_WIDE
  4177. * @arg @ref LL_RCC_PLLVCORANGE_MEDIUM
  4178. * @retval None
  4179. */
  4180. __STATIC_INLINE void LL_RCC_PLL1_SetVCOOutputRange(uint32_t VCORange)
  4181. {
  4182. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL1VCOSEL, VCORange << RCC_PLLCFGR_PLL1VCOSEL_Pos);
  4183. }
  4184. /**
  4185. * @brief Set PLL1 VCO Input Range
  4186. * @note This API shall be called only when PLL1 is disabled.
  4187. * @rmtoll PLLCFGR PLL1RGE LL_RCC_PLL1_SetVCOInputRange
  4188. * @param InputRange This parameter can be one of the following values:
  4189. * @arg @ref LL_RCC_PLLINPUTRANGE_1_2
  4190. * @arg @ref LL_RCC_PLLINPUTRANGE_2_4
  4191. * @arg @ref LL_RCC_PLLINPUTRANGE_4_8
  4192. * @arg @ref LL_RCC_PLLINPUTRANGE_8_16
  4193. * @retval None
  4194. */
  4195. __STATIC_INLINE void LL_RCC_PLL1_SetVCOInputRange(uint32_t InputRange)
  4196. {
  4197. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL1RGE, InputRange << RCC_PLLCFGR_PLL1RGE_Pos);
  4198. }
  4199. /**
  4200. * @brief Get PLL1 N Coefficient
  4201. * @rmtoll PLL1DIVR N1 LL_RCC_PLL1_GetN
  4202. * @retval A value between 4 and 512
  4203. */
  4204. __STATIC_INLINE uint32_t LL_RCC_PLL1_GetN(void)
  4205. {
  4206. return (uint32_t)((READ_BIT(RCC->PLL1DIVR, RCC_PLL1DIVR_N1) >> RCC_PLL1DIVR_N1_Pos) + 1UL);
  4207. }
  4208. /**
  4209. * @brief Get PLL1 M Coefficient
  4210. * @rmtoll PLLCKSELR DIVM1 LL_RCC_PLL1_GetM
  4211. * @retval A value between 0 and 63
  4212. */
  4213. __STATIC_INLINE uint32_t LL_RCC_PLL1_GetM(void)
  4214. {
  4215. return (uint32_t)(READ_BIT(RCC->PLLCKSELR, RCC_PLLCKSELR_DIVM1) >> RCC_PLLCKSELR_DIVM1_Pos);
  4216. }
  4217. /**
  4218. * @brief Get PLL1 P Coefficient
  4219. * @rmtoll PLL1DIVR P1 LL_RCC_PLL1_GetP
  4220. * @retval A value between 2 and 128
  4221. */
  4222. __STATIC_INLINE uint32_t LL_RCC_PLL1_GetP(void)
  4223. {
  4224. return (uint32_t)((READ_BIT(RCC->PLL1DIVR, RCC_PLL1DIVR_P1) >> RCC_PLL1DIVR_P1_Pos) + 1UL);
  4225. }
  4226. /**
  4227. * @brief Get PLL1 Q Coefficient
  4228. * @rmtoll PLL1DIVR Q1 LL_RCC_PLL1_GetQ
  4229. * @retval A value between 1 and 128
  4230. */
  4231. __STATIC_INLINE uint32_t LL_RCC_PLL1_GetQ(void)
  4232. {
  4233. return (uint32_t)((READ_BIT(RCC->PLL1DIVR, RCC_PLL1DIVR_Q1) >> RCC_PLL1DIVR_Q1_Pos) + 1UL);
  4234. }
  4235. /**
  4236. * @brief Get PLL1 R Coefficient
  4237. * @rmtoll PLL1DIVR R1 LL_RCC_PLL1_GetR
  4238. * @retval A value between 1 and 128
  4239. */
  4240. __STATIC_INLINE uint32_t LL_RCC_PLL1_GetR(void)
  4241. {
  4242. return (uint32_t)((READ_BIT(RCC->PLL1DIVR, RCC_PLL1DIVR_R1) >> RCC_PLL1DIVR_R1_Pos) + 1UL);
  4243. }
  4244. /**
  4245. * @brief Get PLL1 FRACN Coefficient
  4246. * @rmtoll PLL1FRACR FRACN1 LL_RCC_PLL1_GetFRACN
  4247. * @retval A value between 0 and 8191 (0x1FFF)
  4248. */
  4249. __STATIC_INLINE uint32_t LL_RCC_PLL1_GetFRACN(void)
  4250. {
  4251. return (uint32_t)(READ_BIT(RCC->PLL1FRACR, RCC_PLL1FRACR_FRACN1) >> RCC_PLL1FRACR_FRACN1_Pos);
  4252. }
  4253. /**
  4254. * @brief Set PLL1 N Coefficient
  4255. * @note This API shall be called only when PLL1 is disabled.
  4256. * @rmtoll PLL1DIVR N1 LL_RCC_PLL1_SetN
  4257. * @param N parameter can be a value between 4 and 512
  4258. */
  4259. __STATIC_INLINE void LL_RCC_PLL1_SetN(uint32_t N)
  4260. {
  4261. MODIFY_REG(RCC->PLL1DIVR, RCC_PLL1DIVR_N1, (N - 1UL) << RCC_PLL1DIVR_N1_Pos);
  4262. }
  4263. /**
  4264. * @brief Set PLL1 M Coefficient
  4265. * @note This API shall be called only when PLL1 is disabled.
  4266. * @rmtoll PLLCKSELR DIVM1 LL_RCC_PLL1_SetM
  4267. * @param M parameter can be a value between 0 and 63
  4268. */
  4269. __STATIC_INLINE void LL_RCC_PLL1_SetM(uint32_t M)
  4270. {
  4271. MODIFY_REG(RCC->PLLCKSELR, RCC_PLLCKSELR_DIVM1, M << RCC_PLLCKSELR_DIVM1_Pos);
  4272. }
  4273. /**
  4274. * @brief Set PLL1 P Coefficient
  4275. * @note This API shall be called only when PLL1 is disabled.
  4276. * @rmtoll PLL1DIVR P1 LL_RCC_PLL1_SetP
  4277. * @param P parameter can be a value between 2 (or 1*) and 128 (ODD division factor not supported)
  4278. *
  4279. * (*) : For stm32h72xxx and stm32h73xxx family lines.
  4280. */
  4281. __STATIC_INLINE void LL_RCC_PLL1_SetP(uint32_t P)
  4282. {
  4283. MODIFY_REG(RCC->PLL1DIVR, RCC_PLL1DIVR_P1, (P - 1UL) << RCC_PLL1DIVR_P1_Pos);
  4284. }
  4285. /**
  4286. * @brief Set PLL1 Q Coefficient
  4287. * @note This API shall be called only when PLL1 is disabled.
  4288. * @rmtoll PLL1DIVR Q1 LL_RCC_PLL1_SetQ
  4289. * @param Q parameter can be a value between 1 and 128
  4290. */
  4291. __STATIC_INLINE void LL_RCC_PLL1_SetQ(uint32_t Q)
  4292. {
  4293. MODIFY_REG(RCC->PLL1DIVR, RCC_PLL1DIVR_Q1, (Q - 1UL) << RCC_PLL1DIVR_Q1_Pos);
  4294. }
  4295. /**
  4296. * @brief Set PLL1 R Coefficient
  4297. * @note This API shall be called only when PLL1 is disabled.
  4298. * @rmtoll PLL1DIVR R1 LL_RCC_PLL1_SetR
  4299. * @param R parameter can be a value between 1 and 128
  4300. */
  4301. __STATIC_INLINE void LL_RCC_PLL1_SetR(uint32_t R)
  4302. {
  4303. MODIFY_REG(RCC->PLL1DIVR, RCC_PLL1DIVR_R1, (R - 1UL) << RCC_PLL1DIVR_R1_Pos);
  4304. }
  4305. /**
  4306. * @brief Set PLL1 FRACN Coefficient
  4307. * @rmtoll PLL1FRACR FRACN1 LL_RCC_PLL1_SetFRACN
  4308. * @param FRACN parameter can be a value between 0 and 8191 (0x1FFF)
  4309. */
  4310. __STATIC_INLINE void LL_RCC_PLL1_SetFRACN(uint32_t FRACN)
  4311. {
  4312. MODIFY_REG(RCC->PLL1FRACR, RCC_PLL1FRACR_FRACN1, FRACN << RCC_PLL1FRACR_FRACN1_Pos);
  4313. }
  4314. /**
  4315. * @brief Enable PLL2
  4316. * @rmtoll CR PLL2ON LL_RCC_PLL2_Enable
  4317. * @retval None
  4318. */
  4319. __STATIC_INLINE void LL_RCC_PLL2_Enable(void)
  4320. {
  4321. SET_BIT(RCC->CR, RCC_CR_PLL2ON);
  4322. }
  4323. /**
  4324. * @brief Disable PLL2
  4325. * @note Cannot be disabled if the PLL2 clock is used as the system clock
  4326. * @rmtoll CR PLL2ON LL_RCC_PLL2_Disable
  4327. * @retval None
  4328. */
  4329. __STATIC_INLINE void LL_RCC_PLL2_Disable(void)
  4330. {
  4331. CLEAR_BIT(RCC->CR, RCC_CR_PLL2ON);
  4332. }
  4333. /**
  4334. * @brief Check if PLL2 Ready
  4335. * @rmtoll CR PLL2RDY LL_RCC_PLL2_IsReady
  4336. * @retval State of bit (1 or 0).
  4337. */
  4338. __STATIC_INLINE uint32_t LL_RCC_PLL2_IsReady(void)
  4339. {
  4340. return ((READ_BIT(RCC->CR, RCC_CR_PLL2RDY) == (RCC_CR_PLL2RDY)) ? 1UL : 0UL);
  4341. }
  4342. /**
  4343. * @brief Enable PLL2P
  4344. * @note This API shall be called only when PLL2 is disabled.
  4345. * @rmtoll PLLCFGR DIVP2EN LL_RCC_PLL2P_Enable
  4346. * @retval None
  4347. */
  4348. __STATIC_INLINE void LL_RCC_PLL2P_Enable(void)
  4349. {
  4350. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP2EN);
  4351. }
  4352. /**
  4353. * @brief Enable PLL2Q
  4354. * @note This API shall be called only when PLL2 is disabled.
  4355. * @rmtoll PLLCFGR DIVQ2EN LL_RCC_PLL2Q_Enable
  4356. * @retval None
  4357. */
  4358. __STATIC_INLINE void LL_RCC_PLL2Q_Enable(void)
  4359. {
  4360. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ2EN);
  4361. }
  4362. /**
  4363. * @brief Enable PLL2R
  4364. * @note This API shall be called only when PLL2 is disabled.
  4365. * @rmtoll PLLCFGR DIVR2EN LL_RCC_PLL2R_Enable
  4366. * @retval None
  4367. */
  4368. __STATIC_INLINE void LL_RCC_PLL2R_Enable(void)
  4369. {
  4370. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR2EN);
  4371. }
  4372. /**
  4373. * @brief Enable PLL2 FRACN
  4374. * @rmtoll PLLCFGR PLL2FRACEN LL_RCC_PLL2FRACN_Enable
  4375. * @retval None
  4376. */
  4377. __STATIC_INLINE void LL_RCC_PLL2FRACN_Enable(void)
  4378. {
  4379. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL2FRACEN);
  4380. }
  4381. /**
  4382. * @brief Check if PLL2 P is enabled
  4383. * @rmtoll PLLCFGR DIVP2EN LL_RCC_PLL2P_IsEnabled
  4384. * @retval State of bit (1 or 0).
  4385. */
  4386. __STATIC_INLINE uint32_t LL_RCC_PLL2P_IsEnabled(void)
  4387. {
  4388. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP2EN) == RCC_PLLCFGR_DIVP2EN) ? 1UL : 0UL);
  4389. }
  4390. /**
  4391. * @brief Check if PLL2 Q is enabled
  4392. * @rmtoll PLLCFGR DIVQ2EN LL_RCC_PLL2Q_IsEnabled
  4393. * @retval State of bit (1 or 0).
  4394. */
  4395. __STATIC_INLINE uint32_t LL_RCC_PLL2Q_IsEnabled(void)
  4396. {
  4397. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ2EN) == RCC_PLLCFGR_DIVQ2EN) ? 1UL : 0UL);
  4398. }
  4399. /**
  4400. * @brief Check if PLL2 R is enabled
  4401. * @rmtoll PLLCFGR DIVR2EN LL_RCC_PLL2R_IsEnabled
  4402. * @retval State of bit (1 or 0).
  4403. */
  4404. __STATIC_INLINE uint32_t LL_RCC_PLL2R_IsEnabled(void)
  4405. {
  4406. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR2EN) == RCC_PLLCFGR_DIVR2EN) ? 1UL : 0UL);
  4407. }
  4408. /**
  4409. * @brief Check if PLL2 FRACN is enabled
  4410. * @rmtoll PLLCFGR PLL2FRACEN LL_RCC_PLL2FRACN_IsEnabled
  4411. * @retval State of bit (1 or 0).
  4412. */
  4413. __STATIC_INLINE uint32_t LL_RCC_PLL2FRACN_IsEnabled(void)
  4414. {
  4415. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL2FRACEN) == RCC_PLLCFGR_PLL2FRACEN) ? 1UL : 0UL);
  4416. }
  4417. /**
  4418. * @brief Disable PLL2P
  4419. * @note This API shall be called only when PLL2 is disabled.
  4420. * @rmtoll PLLCFGR DIVP2EN LL_RCC_PLL2P_Disable
  4421. * @retval None
  4422. */
  4423. __STATIC_INLINE void LL_RCC_PLL2P_Disable(void)
  4424. {
  4425. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP2EN);
  4426. }
  4427. /**
  4428. * @brief Disable PLL2Q
  4429. * @note This API shall be called only when PLL2 is disabled.
  4430. * @rmtoll PLLCFGR DIVQ2EN LL_RCC_PLL2Q_Disable
  4431. * @retval None
  4432. */
  4433. __STATIC_INLINE void LL_RCC_PLL2Q_Disable(void)
  4434. {
  4435. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ2EN);
  4436. }
  4437. /**
  4438. * @brief Disable PLL2R
  4439. * @note This API shall be called only when PLL2 is disabled.
  4440. * @rmtoll PLLCFGR DIVR2EN LL_RCC_PLL2R_Disable
  4441. * @retval None
  4442. */
  4443. __STATIC_INLINE void LL_RCC_PLL2R_Disable(void)
  4444. {
  4445. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR2EN);
  4446. }
  4447. /**
  4448. * @brief Disable PLL2 FRACN
  4449. * @rmtoll PLLCFGR PLL2FRACEN LL_RCC_PLL2FRACN_Enable
  4450. * @retval None
  4451. */
  4452. __STATIC_INLINE void LL_RCC_PLL2FRACN_Disable(void)
  4453. {
  4454. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL2FRACEN);
  4455. }
  4456. /**
  4457. * @brief Set PLL2 VCO OutputRange
  4458. * @note This API shall be called only when PLL2 is disabled.
  4459. * @rmtoll PLLCFGR PLL2VCOSEL LL_RCC_PLL2_SetVCOOuputRange
  4460. * @param VCORange This parameter can be one of the following values:
  4461. * @arg @ref LL_RCC_PLLVCORANGE_WIDE
  4462. * @arg @ref LL_RCC_PLLVCORANGE_MEDIUM
  4463. * @retval None
  4464. */
  4465. __STATIC_INLINE void LL_RCC_PLL2_SetVCOOutputRange(uint32_t VCORange)
  4466. {
  4467. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL2VCOSEL, VCORange << RCC_PLLCFGR_PLL2VCOSEL_Pos);
  4468. }
  4469. /**
  4470. * @brief Set PLL2 VCO Input Range
  4471. * @note This API shall be called only when PLL2 is disabled.
  4472. * @rmtoll PLLCFGR PLL2RGE LL_RCC_PLL2_SetVCOInputRange
  4473. * @param InputRange This parameter can be one of the following values:
  4474. * @arg @ref LL_RCC_PLLINPUTRANGE_1_2
  4475. * @arg @ref LL_RCC_PLLINPUTRANGE_2_4
  4476. * @arg @ref LL_RCC_PLLINPUTRANGE_4_8
  4477. * @arg @ref LL_RCC_PLLINPUTRANGE_8_16
  4478. * @retval None
  4479. */
  4480. __STATIC_INLINE void LL_RCC_PLL2_SetVCOInputRange(uint32_t InputRange)
  4481. {
  4482. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL2RGE, InputRange << RCC_PLLCFGR_PLL2RGE_Pos);
  4483. }
  4484. /**
  4485. * @brief Get PLL2 N Coefficient
  4486. * @rmtoll PLL2DIVR N2 LL_RCC_PLL2_GetN
  4487. * @retval A value between 4 and 512
  4488. */
  4489. __STATIC_INLINE uint32_t LL_RCC_PLL2_GetN(void)
  4490. {
  4491. return (uint32_t)((READ_BIT(RCC->PLL2DIVR, RCC_PLL2DIVR_N2) >> RCC_PLL2DIVR_N2_Pos) + 1UL);
  4492. }
  4493. /**
  4494. * @brief Get PLL2 M Coefficient
  4495. * @rmtoll PLLCKSELR DIVM2 LL_RCC_PLL2_GetM
  4496. * @retval A value between 0 and 63
  4497. */
  4498. __STATIC_INLINE uint32_t LL_RCC_PLL2_GetM(void)
  4499. {
  4500. return (uint32_t)(READ_BIT(RCC->PLLCKSELR, RCC_PLLCKSELR_DIVM2) >> RCC_PLLCKSELR_DIVM2_Pos);
  4501. }
  4502. /**
  4503. * @brief Get PLL2 P Coefficient
  4504. * @rmtoll PLL2DIVR P2 LL_RCC_PLL2_GetP
  4505. * @retval A value between 1 and 128
  4506. */
  4507. __STATIC_INLINE uint32_t LL_RCC_PLL2_GetP(void)
  4508. {
  4509. return (uint32_t)((READ_BIT(RCC->PLL2DIVR, RCC_PLL2DIVR_P2) >> RCC_PLL2DIVR_P2_Pos) + 1UL);
  4510. }
  4511. /**
  4512. * @brief Get PLL2 Q Coefficient
  4513. * @rmtoll PLL2DIVR Q2 LL_RCC_PLL2_GetQ
  4514. * @retval A value between 1 and 128
  4515. */
  4516. __STATIC_INLINE uint32_t LL_RCC_PLL2_GetQ(void)
  4517. {
  4518. return (uint32_t)((READ_BIT(RCC->PLL2DIVR, RCC_PLL2DIVR_Q2) >> RCC_PLL2DIVR_Q2_Pos) + 1UL);
  4519. }
  4520. /**
  4521. * @brief Get PLL2 R Coefficient
  4522. * @rmtoll PLL2DIVR R2 LL_RCC_PLL2_GetR
  4523. * @retval A value between 1 and 128
  4524. */
  4525. __STATIC_INLINE uint32_t LL_RCC_PLL2_GetR(void)
  4526. {
  4527. return (uint32_t)((READ_BIT(RCC->PLL2DIVR, RCC_PLL2DIVR_R2) >> RCC_PLL2DIVR_R2_Pos) + 1UL);
  4528. }
  4529. /**
  4530. * @brief Get PLL2 FRACN Coefficient
  4531. * @rmtoll PLL2FRACR FRACN2 LL_RCC_PLL2_GetFRACN
  4532. * @retval A value between 0 and 8191 (0x1FFF)
  4533. */
  4534. __STATIC_INLINE uint32_t LL_RCC_PLL2_GetFRACN(void)
  4535. {
  4536. return (uint32_t)(READ_BIT(RCC->PLL2FRACR, RCC_PLL2FRACR_FRACN2) >> RCC_PLL2FRACR_FRACN2_Pos);
  4537. }
  4538. /**
  4539. * @brief Set PLL2 N Coefficient
  4540. * @note This API shall be called only when PLL2 is disabled.
  4541. * @rmtoll PLL2DIVR N2 LL_RCC_PLL2_SetN
  4542. * @param N parameter can be a value between 4 and 512
  4543. */
  4544. __STATIC_INLINE void LL_RCC_PLL2_SetN(uint32_t N)
  4545. {
  4546. MODIFY_REG(RCC->PLL2DIVR, RCC_PLL2DIVR_N2, (N - 1UL) << RCC_PLL2DIVR_N2_Pos);
  4547. }
  4548. /**
  4549. * @brief Set PLL2 M Coefficient
  4550. * @note This API shall be called only when PLL2 is disabled.
  4551. * @rmtoll PLLCKSELR DIVM2 LL_RCC_PLL2_SetM
  4552. * @param M parameter can be a value between 0 and 63
  4553. */
  4554. __STATIC_INLINE void LL_RCC_PLL2_SetM(uint32_t M)
  4555. {
  4556. MODIFY_REG(RCC->PLLCKSELR, RCC_PLLCKSELR_DIVM2, M << RCC_PLLCKSELR_DIVM2_Pos);
  4557. }
  4558. /**
  4559. * @brief Set PLL2 P Coefficient
  4560. * @note This API shall be called only when PLL2 is disabled.
  4561. * @rmtoll PLL2DIVR P2 LL_RCC_PLL2_SetP
  4562. * @param P parameter can be a value between 1 and 128
  4563. */
  4564. __STATIC_INLINE void LL_RCC_PLL2_SetP(uint32_t P)
  4565. {
  4566. MODIFY_REG(RCC->PLL2DIVR, RCC_PLL2DIVR_P2, (P - 1UL) << RCC_PLL2DIVR_P2_Pos);
  4567. }
  4568. /**
  4569. * @brief Set PLL2 Q Coefficient
  4570. * @note This API shall be called only when PLL2 is disabled.
  4571. * @rmtoll PLL2DIVR Q2 LL_RCC_PLL2_SetQ
  4572. * @param Q parameter can be a value between 1 and 128
  4573. */
  4574. __STATIC_INLINE void LL_RCC_PLL2_SetQ(uint32_t Q)
  4575. {
  4576. MODIFY_REG(RCC->PLL2DIVR, RCC_PLL2DIVR_Q2, (Q - 1UL) << RCC_PLL2DIVR_Q2_Pos);
  4577. }
  4578. /**
  4579. * @brief Set PLL2 R Coefficient
  4580. * @note This API shall be called only when PLL2 is disabled.
  4581. * @rmtoll PLL2DIVR R2 LL_RCC_PLL2_SetR
  4582. * @param R parameter can be a value between 1 and 128
  4583. */
  4584. __STATIC_INLINE void LL_RCC_PLL2_SetR(uint32_t R)
  4585. {
  4586. MODIFY_REG(RCC->PLL2DIVR, RCC_PLL2DIVR_R2, (R - 1UL) << RCC_PLL2DIVR_R2_Pos);
  4587. }
  4588. /**
  4589. * @brief Set PLL2 FRACN Coefficient
  4590. * @rmtoll PLL2FRACR FRACN2 LL_RCC_PLL2_SetFRACN
  4591. * @param FRACN parameter can be a value between 0 and 8191 (0x1FFF)
  4592. */
  4593. __STATIC_INLINE void LL_RCC_PLL2_SetFRACN(uint32_t FRACN)
  4594. {
  4595. MODIFY_REG(RCC->PLL2FRACR, RCC_PLL2FRACR_FRACN2, FRACN << RCC_PLL2FRACR_FRACN2_Pos);
  4596. }
  4597. /**
  4598. * @brief Enable PLL3
  4599. * @rmtoll CR PLL3ON LL_RCC_PLL3_Enable
  4600. * @retval None
  4601. */
  4602. __STATIC_INLINE void LL_RCC_PLL3_Enable(void)
  4603. {
  4604. SET_BIT(RCC->CR, RCC_CR_PLL3ON);
  4605. }
  4606. /**
  4607. * @brief Disable PLL3
  4608. * @note Cannot be disabled if the PLL3 clock is used as the system clock
  4609. * @rmtoll CR PLL3ON LL_RCC_PLL3_Disable
  4610. * @retval None
  4611. */
  4612. __STATIC_INLINE void LL_RCC_PLL3_Disable(void)
  4613. {
  4614. CLEAR_BIT(RCC->CR, RCC_CR_PLL3ON);
  4615. }
  4616. /**
  4617. * @brief Check if PLL3 Ready
  4618. * @rmtoll CR PLL3RDY LL_RCC_PLL3_IsReady
  4619. * @retval State of bit (1 or 0).
  4620. */
  4621. __STATIC_INLINE uint32_t LL_RCC_PLL3_IsReady(void)
  4622. {
  4623. return ((READ_BIT(RCC->CR, RCC_CR_PLL3RDY) == (RCC_CR_PLL3RDY)) ? 1UL : 0UL);
  4624. }
  4625. /**
  4626. * @brief Enable PLL3P
  4627. * @note This API shall be called only when PLL3 is disabled.
  4628. * @rmtoll PLLCFGR DIVP3EN LL_RCC_PLL3P_Enable
  4629. * @retval None
  4630. */
  4631. __STATIC_INLINE void LL_RCC_PLL3P_Enable(void)
  4632. {
  4633. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP3EN);
  4634. }
  4635. /**
  4636. * @brief Enable PLL3Q
  4637. * @note This API shall be called only when PLL3 is disabled.
  4638. * @rmtoll PLLCFGR DIVQ3EN LL_RCC_PLL3Q_Enable
  4639. * @retval None
  4640. */
  4641. __STATIC_INLINE void LL_RCC_PLL3Q_Enable(void)
  4642. {
  4643. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ3EN);
  4644. }
  4645. /**
  4646. * @brief Enable PLL3R
  4647. * @note This API shall be called only when PLL3 is disabled.
  4648. * @rmtoll PLLCFGR DIVR3EN LL_RCC_PLL3R_Enable
  4649. * @retval None
  4650. */
  4651. __STATIC_INLINE void LL_RCC_PLL3R_Enable(void)
  4652. {
  4653. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR3EN);
  4654. }
  4655. /**
  4656. * @brief Enable PLL3 FRACN
  4657. * @rmtoll PLLCFGR PLL3FRACEN LL_RCC_PLL3FRACN_Enable
  4658. * @retval None
  4659. */
  4660. __STATIC_INLINE void LL_RCC_PLL3FRACN_Enable(void)
  4661. {
  4662. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL3FRACEN);
  4663. }
  4664. /**
  4665. * @brief Check if PLL3 P is enabled
  4666. * @rmtoll PLLCFGR DIVP3EN LL_RCC_PLL3P_IsEnabled
  4667. * @retval State of bit (1 or 0).
  4668. */
  4669. __STATIC_INLINE uint32_t LL_RCC_PLL3P_IsEnabled(void)
  4670. {
  4671. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP3EN) == RCC_PLLCFGR_DIVP3EN) ? 1UL : 0UL);
  4672. }
  4673. /**
  4674. * @brief Check if PLL3 Q is enabled
  4675. * @rmtoll PLLCFGR DIVQ3EN LL_RCC_PLL3Q_IsEnabled
  4676. * @retval State of bit (1 or 0).
  4677. */
  4678. __STATIC_INLINE uint32_t LL_RCC_PLL3Q_IsEnabled(void)
  4679. {
  4680. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ3EN) == RCC_PLLCFGR_DIVQ3EN) ? 1UL : 0UL);
  4681. }
  4682. /**
  4683. * @brief Check if PLL3 R is enabled
  4684. * @rmtoll PLLCFGR DIVR3EN LL_RCC_PLL3R_IsEnabled
  4685. * @retval State of bit (1 or 0).
  4686. */
  4687. __STATIC_INLINE uint32_t LL_RCC_PLL3R_IsEnabled(void)
  4688. {
  4689. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR3EN) == RCC_PLLCFGR_DIVR3EN) ? 1UL : 0UL);
  4690. }
  4691. /**
  4692. * @brief Check if PLL3 FRACN is enabled
  4693. * @rmtoll PLLCFGR PLL3FRACEN LL_RCC_PLL3FRACN_IsEnabled
  4694. * @retval State of bit (1 or 0).
  4695. */
  4696. __STATIC_INLINE uint32_t LL_RCC_PLL3FRACN_IsEnabled(void)
  4697. {
  4698. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL3FRACEN) == RCC_PLLCFGR_PLL3FRACEN) ? 1UL : 0UL);
  4699. }
  4700. /**
  4701. * @brief Disable PLL3P
  4702. * @note This API shall be called only when PLL3 is disabled.
  4703. * @rmtoll PLLCFGR DIVP2EN LL_RCC_PLL3P_Disable
  4704. * @retval None
  4705. */
  4706. __STATIC_INLINE void LL_RCC_PLL3P_Disable(void)
  4707. {
  4708. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVP3EN);
  4709. }
  4710. /**
  4711. * @brief Disable PLL3Q
  4712. * @note This API shall be called only when PLL3 is disabled.
  4713. * @rmtoll PLLCFGR DIVQ3EN LL_RCC_PLL3Q_Disable
  4714. * @retval None
  4715. */
  4716. __STATIC_INLINE void LL_RCC_PLL3Q_Disable(void)
  4717. {
  4718. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVQ3EN);
  4719. }
  4720. /**
  4721. * @brief Disable PLL3R
  4722. * @note This API shall be called only when PLL3 is disabled.
  4723. * @rmtoll PLLCFGR DIVR3EN LL_RCC_PLL3R_Disable
  4724. * @retval None
  4725. */
  4726. __STATIC_INLINE void LL_RCC_PLL3R_Disable(void)
  4727. {
  4728. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_DIVR3EN);
  4729. }
  4730. /**
  4731. * @brief Disable PLL3 FRACN
  4732. * @rmtoll PLLCFGR PLL3FRACEN LL_RCC_PLL3FRACN_Enable
  4733. * @retval None
  4734. */
  4735. __STATIC_INLINE void LL_RCC_PLL3FRACN_Disable(void)
  4736. {
  4737. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL3FRACEN);
  4738. }
  4739. /**
  4740. * @brief Set PLL3 VCO OutputRange
  4741. * @note This API shall be called only when PLL3 is disabled.
  4742. * @rmtoll PLLCFGR PLL3VCOSEL LL_RCC_PLL3_SetVCOOuputRange
  4743. * @param VCORange This parameter can be one of the following values:
  4744. * @arg @ref LL_RCC_PLLVCORANGE_WIDE
  4745. * @arg @ref LL_RCC_PLLVCORANGE_MEDIUM
  4746. * @retval None
  4747. */
  4748. __STATIC_INLINE void LL_RCC_PLL3_SetVCOOutputRange(uint32_t VCORange)
  4749. {
  4750. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL3VCOSEL, VCORange << RCC_PLLCFGR_PLL3VCOSEL_Pos);
  4751. }
  4752. /**
  4753. * @brief Set PLL3 VCO Input Range
  4754. * @note This API shall be called only when PLL3 is disabled.
  4755. * @rmtoll PLLCFGR PLL3RGE LL_RCC_PLL3_SetVCOInputRange
  4756. * @param InputRange This parameter can be one of the following values:
  4757. * @arg @ref LL_RCC_PLLINPUTRANGE_1_2
  4758. * @arg @ref LL_RCC_PLLINPUTRANGE_2_4
  4759. * @arg @ref LL_RCC_PLLINPUTRANGE_4_8
  4760. * @arg @ref LL_RCC_PLLINPUTRANGE_8_16
  4761. * @retval None
  4762. */
  4763. __STATIC_INLINE void LL_RCC_PLL3_SetVCOInputRange(uint32_t InputRange)
  4764. {
  4765. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL3RGE, InputRange << RCC_PLLCFGR_PLL3RGE_Pos);
  4766. }
  4767. /**
  4768. * @brief Get PLL3 N Coefficient
  4769. * @rmtoll PLL3DIVR N3 LL_RCC_PLL3_GetN
  4770. * @retval A value between 4 and 512
  4771. */
  4772. __STATIC_INLINE uint32_t LL_RCC_PLL3_GetN(void)
  4773. {
  4774. return (uint32_t)((READ_BIT(RCC->PLL3DIVR, RCC_PLL3DIVR_N3) >> RCC_PLL3DIVR_N3_Pos) + 1UL);
  4775. }
  4776. /**
  4777. * @brief Get PLL3 M Coefficient
  4778. * @rmtoll PLLCKSELR DIVM3 LL_RCC_PLL3_GetM
  4779. * @retval A value between 0 and 63
  4780. */
  4781. __STATIC_INLINE uint32_t LL_RCC_PLL3_GetM(void)
  4782. {
  4783. return (uint32_t)(READ_BIT(RCC->PLLCKSELR, RCC_PLLCKSELR_DIVM3) >> RCC_PLLCKSELR_DIVM3_Pos);
  4784. }
  4785. /**
  4786. * @brief Get PLL3 P Coefficient
  4787. * @rmtoll PLL3DIVR P3 LL_RCC_PLL3_GetP
  4788. * @retval A value between 1 and 128
  4789. */
  4790. __STATIC_INLINE uint32_t LL_RCC_PLL3_GetP(void)
  4791. {
  4792. return (uint32_t)((READ_BIT(RCC->PLL3DIVR, RCC_PLL3DIVR_P3) >> RCC_PLL3DIVR_P3_Pos) + 1UL);
  4793. }
  4794. /**
  4795. * @brief Get PLL3 Q Coefficient
  4796. * @rmtoll PLL3DIVR Q3 LL_RCC_PLL3_GetQ
  4797. * @retval A value between 1 and 128
  4798. */
  4799. __STATIC_INLINE uint32_t LL_RCC_PLL3_GetQ(void)
  4800. {
  4801. return (uint32_t)((READ_BIT(RCC->PLL3DIVR, RCC_PLL3DIVR_Q3) >> RCC_PLL3DIVR_Q3_Pos) + 1UL);
  4802. }
  4803. /**
  4804. * @brief Get PLL3 R Coefficient
  4805. * @rmtoll PLL3DIVR R3 LL_RCC_PLL3_GetR
  4806. * @retval A value between 1 and 128
  4807. */
  4808. __STATIC_INLINE uint32_t LL_RCC_PLL3_GetR(void)
  4809. {
  4810. return (uint32_t)((READ_BIT(RCC->PLL3DIVR, RCC_PLL3DIVR_R3) >> RCC_PLL3DIVR_R3_Pos) + 1UL);
  4811. }
  4812. /**
  4813. * @brief Get PLL3 FRACN Coefficient
  4814. * @rmtoll PLL3FRACR FRACN3 LL_RCC_PLL3_GetFRACN
  4815. * @retval A value between 0 and 8191 (0x1FFF)
  4816. */
  4817. __STATIC_INLINE uint32_t LL_RCC_PLL3_GetFRACN(void)
  4818. {
  4819. return (uint32_t)(READ_BIT(RCC->PLL3FRACR, RCC_PLL3FRACR_FRACN3) >> RCC_PLL3FRACR_FRACN3_Pos);
  4820. }
  4821. /**
  4822. * @brief Set PLL3 N Coefficient
  4823. * @note This API shall be called only when PLL3 is disabled.
  4824. * @rmtoll PLL3DIVR N3 LL_RCC_PLL3_SetN
  4825. * @param N parameter can be a value between 4 and 512
  4826. */
  4827. __STATIC_INLINE void LL_RCC_PLL3_SetN(uint32_t N)
  4828. {
  4829. MODIFY_REG(RCC->PLL3DIVR, RCC_PLL3DIVR_N3, (N - 1UL) << RCC_PLL3DIVR_N3_Pos);
  4830. }
  4831. /**
  4832. * @brief Set PLL3 M Coefficient
  4833. * @note This API shall be called only when PLL3 is disabled.
  4834. * @rmtoll PLLCKSELR DIVM3 LL_RCC_PLL3_SetM
  4835. * @param M parameter can be a value between 0 and 63
  4836. */
  4837. __STATIC_INLINE void LL_RCC_PLL3_SetM(uint32_t M)
  4838. {
  4839. MODIFY_REG(RCC->PLLCKSELR, RCC_PLLCKSELR_DIVM3, M << RCC_PLLCKSELR_DIVM3_Pos);
  4840. }
  4841. /**
  4842. * @brief Set PLL3 P Coefficient
  4843. * @note This API shall be called only when PLL3 is disabled.
  4844. * @rmtoll PLL3DIVR P3 LL_RCC_PLL3_SetP
  4845. * @param P parameter can be a value between 1 and 128
  4846. */
  4847. __STATIC_INLINE void LL_RCC_PLL3_SetP(uint32_t P)
  4848. {
  4849. MODIFY_REG(RCC->PLL3DIVR, RCC_PLL3DIVR_P3, (P - 1UL) << RCC_PLL3DIVR_P3_Pos);
  4850. }
  4851. /**
  4852. * @brief Set PLL3 Q Coefficient
  4853. * @note This API shall be called only when PLL3 is disabled.
  4854. * @rmtoll PLL3DIVR Q3 LL_RCC_PLL3_SetQ
  4855. * @param Q parameter can be a value between 1 and 128
  4856. */
  4857. __STATIC_INLINE void LL_RCC_PLL3_SetQ(uint32_t Q)
  4858. {
  4859. MODIFY_REG(RCC->PLL3DIVR, RCC_PLL3DIVR_Q3, (Q - 1UL) << RCC_PLL3DIVR_Q3_Pos);
  4860. }
  4861. /**
  4862. * @brief Set PLL3 R Coefficient
  4863. * @note This API shall be called only when PLL3 is disabled.
  4864. * @rmtoll PLL3DIVR R3 LL_RCC_PLL3_SetR
  4865. * @param R parameter can be a value between 1 and 128
  4866. */
  4867. __STATIC_INLINE void LL_RCC_PLL3_SetR(uint32_t R)
  4868. {
  4869. MODIFY_REG(RCC->PLL3DIVR, RCC_PLL3DIVR_R3, (R - 1UL) << RCC_PLL3DIVR_R3_Pos);
  4870. }
  4871. /**
  4872. * @brief Set PLL3 FRACN Coefficient
  4873. * @rmtoll PLL3FRACR FRACN3 LL_RCC_PLL3_SetFRACN
  4874. * @param FRACN parameter can be a value between 0 and 8191 (0x1FFF)
  4875. */
  4876. __STATIC_INLINE void LL_RCC_PLL3_SetFRACN(uint32_t FRACN)
  4877. {
  4878. MODIFY_REG(RCC->PLL3FRACR, RCC_PLL3FRACR_FRACN3, FRACN << RCC_PLL3FRACR_FRACN3_Pos);
  4879. }
  4880. /**
  4881. * @}
  4882. */
  4883. /** @defgroup RCC_LL_EF_FLAG_Management FLAG Management
  4884. * @{
  4885. */
  4886. /**
  4887. * @brief Clear LSI ready interrupt flag
  4888. * @rmtoll CICR LSIRDYC LL_RCC_ClearFlag_LSIRDY
  4889. * @retval None
  4890. */
  4891. __STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void)
  4892. {
  4893. SET_BIT(RCC->CICR, RCC_CICR_LSIRDYC);
  4894. }
  4895. /**
  4896. * @brief Clear LSE ready interrupt flag
  4897. * @rmtoll CICR LSERDYC LL_RCC_ClearFlag_LSERDY
  4898. * @retval None
  4899. */
  4900. __STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void)
  4901. {
  4902. SET_BIT(RCC->CICR, RCC_CICR_LSERDYC);
  4903. }
  4904. /**
  4905. * @brief Clear HSI ready interrupt flag
  4906. * @rmtoll CICR HSIRDYC LL_RCC_ClearFlag_HSIRDY
  4907. * @retval None
  4908. */
  4909. __STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void)
  4910. {
  4911. SET_BIT(RCC->CICR, RCC_CICR_HSIRDYC);
  4912. }
  4913. /**
  4914. * @brief Clear HSE ready interrupt flag
  4915. * @rmtoll CICR HSERDYC LL_RCC_ClearFlag_HSERDY
  4916. * @retval None
  4917. */
  4918. __STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void)
  4919. {
  4920. SET_BIT(RCC->CICR, RCC_CICR_HSERDYC);
  4921. }
  4922. /**
  4923. * @brief Clear CSI ready interrupt flag
  4924. * @rmtoll CICR CSIRDYC LL_RCC_ClearFlag_CSIRDY
  4925. * @retval None
  4926. */
  4927. __STATIC_INLINE void LL_RCC_ClearFlag_CSIRDY(void)
  4928. {
  4929. SET_BIT(RCC->CICR, RCC_CICR_CSIRDYC);
  4930. }
  4931. /**
  4932. * @brief Clear HSI48 ready interrupt flag
  4933. * @rmtoll CICR HSI48RDYC LL_RCC_ClearFlag_HSI48RDY
  4934. * @retval None
  4935. */
  4936. __STATIC_INLINE void LL_RCC_ClearFlag_HSI48RDY(void)
  4937. {
  4938. SET_BIT(RCC->CICR, RCC_CICR_HSI48RDYC);
  4939. }
  4940. /**
  4941. * @brief Clear PLL1 ready interrupt flag
  4942. * @rmtoll CICR PLL1RDYC LL_RCC_ClearFlag_PLL1RDY
  4943. * @retval None
  4944. */
  4945. __STATIC_INLINE void LL_RCC_ClearFlag_PLL1RDY(void)
  4946. {
  4947. SET_BIT(RCC->CICR, RCC_CICR_PLLRDYC);
  4948. }
  4949. /**
  4950. * @brief Clear PLL2 ready interrupt flag
  4951. * @rmtoll CICR PLL2RDYC LL_RCC_ClearFlag_PLL2RDY
  4952. * @retval None
  4953. */
  4954. __STATIC_INLINE void LL_RCC_ClearFlag_PLL2RDY(void)
  4955. {
  4956. SET_BIT(RCC->CICR, RCC_CICR_PLL2RDYC);
  4957. }
  4958. /**
  4959. * @brief Clear PLL3 ready interrupt flag
  4960. * @rmtoll CICR PLL3RDYC LL_RCC_ClearFlag_PLL3RDY
  4961. * @retval None
  4962. */
  4963. __STATIC_INLINE void LL_RCC_ClearFlag_PLL3RDY(void)
  4964. {
  4965. SET_BIT(RCC->CICR, RCC_CICR_PLL3RDYC);
  4966. }
  4967. /**
  4968. * @brief Clear LSE Clock security system interrupt flag
  4969. * @rmtoll CICR LSECSSC LL_RCC_ClearFlag_LSECSS
  4970. * @retval None
  4971. */
  4972. __STATIC_INLINE void LL_RCC_ClearFlag_LSECSS(void)
  4973. {
  4974. SET_BIT(RCC->CICR, RCC_CICR_LSECSSC);
  4975. }
  4976. /**
  4977. * @brief Clear HSE Clock security system interrupt flag
  4978. * @rmtoll CICR HSECSSC LL_RCC_ClearFlag_HSECSS
  4979. * @retval None
  4980. */
  4981. __STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void)
  4982. {
  4983. SET_BIT(RCC->CICR, RCC_CICR_HSECSSC);
  4984. }
  4985. /**
  4986. * @brief Check if LSI ready interrupt occurred or not
  4987. * @rmtoll CIFR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY
  4988. * @retval State of bit (1 or 0).
  4989. */
  4990. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void)
  4991. {
  4992. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSIRDYF) == (RCC_CIFR_LSIRDYF)) ? 1UL : 0UL);
  4993. }
  4994. /**
  4995. * @brief Check if LSE ready interrupt occurred or not
  4996. * @rmtoll CIFR LSERDYF LL_RCC_IsActiveFlag_LSERDY
  4997. * @retval State of bit (1 or 0).
  4998. */
  4999. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void)
  5000. {
  5001. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSERDYF) == (RCC_CIFR_LSERDYF)) ? 1UL : 0UL);
  5002. }
  5003. /**
  5004. * @brief Check if HSI ready interrupt occurred or not
  5005. * @rmtoll CIFR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY
  5006. * @retval State of bit (1 or 0).
  5007. */
  5008. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void)
  5009. {
  5010. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSIRDYF) == (RCC_CIFR_HSIRDYF)) ? 1UL : 0UL);
  5011. }
  5012. /**
  5013. * @brief Check if HSE ready interrupt occurred or not
  5014. * @rmtoll CIFR HSERDYF LL_RCC_IsActiveFlag_HSERDY
  5015. * @retval State of bit (1 or 0).
  5016. */
  5017. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void)
  5018. {
  5019. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSERDYF) == (RCC_CIFR_HSERDYF)) ? 1UL : 0UL);
  5020. }
  5021. /**
  5022. * @brief Check if CSI ready interrupt occurred or not
  5023. * @rmtoll CIFR CSIRDYF LL_RCC_IsActiveFlag_CSIRDY
  5024. * @retval State of bit (1 or 0).
  5025. */
  5026. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_CSIRDY(void)
  5027. {
  5028. return ((READ_BIT(RCC->CIFR, RCC_CIFR_CSIRDYF) == (RCC_CIFR_CSIRDYF)) ? 1UL : 0UL);
  5029. }
  5030. /**
  5031. * @brief Check if HSI48 ready interrupt occurred or not
  5032. * @rmtoll CIFR HSI48RDYF LL_RCC_IsActiveFlag_HSI48RDY
  5033. * @retval State of bit (1 or 0).
  5034. */
  5035. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSI48RDY(void)
  5036. {
  5037. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSI48RDYF) == (RCC_CIFR_HSI48RDYF)) ? 1UL : 0UL);
  5038. }
  5039. /**
  5040. * @brief Check if PLL1 ready interrupt occurred or not
  5041. * @rmtoll CIFR PLLRDYF LL_RCC_IsActiveFlag_PLL1RDY
  5042. * @retval State of bit (1 or 0).
  5043. */
  5044. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLL1RDY(void)
  5045. {
  5046. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLRDYF) == (RCC_CIFR_PLLRDYF)) ? 1UL : 0UL);
  5047. }
  5048. /**
  5049. * @brief Check if PLL2 ready interrupt occurred or not
  5050. * @rmtoll CIFR PLL2RDYF LL_RCC_IsActiveFlag_PLL2RDY
  5051. * @retval State of bit (1 or 0).
  5052. */
  5053. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLL2RDY(void)
  5054. {
  5055. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLL2RDYF) == (RCC_CIFR_PLL2RDYF)) ? 1UL : 0UL);
  5056. }
  5057. /**
  5058. * @brief Check if PLL3 ready interrupt occurred or not
  5059. * @rmtoll CIFR PLL3RDYF LL_RCC_IsActiveFlag_PLL3RDY
  5060. * @retval State of bit (1 or 0).
  5061. */
  5062. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLL3RDY(void)
  5063. {
  5064. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLL3RDYF) == (RCC_CIFR_PLL3RDYF)) ? 1UL : 0UL);
  5065. }
  5066. /**
  5067. * @brief Check if LSE Clock security system interrupt occurred or not
  5068. * @rmtoll CIFR LSECSSF LL_RCC_IsActiveFlag_LSECSS
  5069. * @retval State of bit (1 or 0).
  5070. */
  5071. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSECSS(void)
  5072. {
  5073. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSECSSF) == (RCC_CIFR_LSECSSF)) ? 1UL : 0UL);
  5074. }
  5075. /**
  5076. * @brief Check if HSE Clock security system interrupt occurred or not
  5077. * @rmtoll CIFR HSECSSF LL_RCC_IsActiveFlag_HSECSS
  5078. * @retval State of bit (1 or 0).
  5079. */
  5080. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void)
  5081. {
  5082. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSECSSF) == (RCC_CIFR_HSECSSF)) ? 1UL : 0UL);
  5083. }
  5084. /**
  5085. * @brief Check if RCC flag Low Power D1 reset is set or not.
  5086. * @rmtoll RSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST (*)\n
  5087. * RSR LPWR1RSTF LL_RCC_IsActiveFlag_LPWRRST (**)
  5088. *
  5089. * (*) Only available for single core devices
  5090. * (**) Only available for Dual core devices
  5091. * @retval State of bit (1 or 0).
  5092. */
  5093. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void)
  5094. {
  5095. #if defined(DUAL_CORE)
  5096. return ((READ_BIT(RCC->RSR, RCC_RSR_LPWR1RSTF) == (RCC_RSR_LPWR1RSTF)) ? 1UL : 0UL);
  5097. #else
  5098. return ((READ_BIT(RCC->RSR, RCC_RSR_LPWRRSTF) == (RCC_RSR_LPWRRSTF)) ? 1UL : 0UL);
  5099. #endif /*DUAL_CORE*/
  5100. }
  5101. #if defined(DUAL_CORE)
  5102. /**
  5103. * @brief Check if RCC flag Low Power D2 reset is set or not.
  5104. * @rmtoll RSR LPWR2RSTF LL_RCC_IsActiveFlag_LPWR2RST
  5105. * @retval State of bit (1 or 0).
  5106. */
  5107. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWR2RST(void)
  5108. {
  5109. return ((READ_BIT(RCC->RSR, RCC_RSR_LPWR2RSTF) == (RCC_RSR_LPWR2RSTF)) ? 1UL : 0UL);
  5110. }
  5111. #endif /*DUAL_CORE*/
  5112. /**
  5113. * @brief Check if RCC flag Window Watchdog 1 reset is set or not.
  5114. * @rmtoll RSR WWDG1RSTF LL_RCC_IsActiveFlag_WWDG1RST
  5115. * @retval State of bit (1 or 0).
  5116. */
  5117. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDG1RST(void)
  5118. {
  5119. return ((READ_BIT(RCC->RSR, RCC_RSR_WWDG1RSTF) == (RCC_RSR_WWDG1RSTF)) ? 1UL : 0UL);
  5120. }
  5121. #if defined(DUAL_CORE)
  5122. /**
  5123. * @brief Check if RCC flag Window Watchdog 2 reset is set or not.
  5124. * @rmtoll RSR WWDG2RSTF LL_RCC_IsActiveFlag_WWDG2RST
  5125. * @retval State of bit (1 or 0).
  5126. */
  5127. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDG2RST(void)
  5128. {
  5129. return ((READ_BIT(RCC->RSR, RCC_RSR_WWDG2RSTF) == (RCC_RSR_WWDG2RSTF)) ? 1UL : 0UL);
  5130. }
  5131. #endif /*DUAL_CORE*/
  5132. /**
  5133. * @brief Check if RCC flag Independent Watchdog 1 reset is set or not.
  5134. * @rmtoll RSR IWDG1RSTF LL_RCC_IsActiveFlag_IWDG1RST
  5135. * @retval State of bit (1 or 0).
  5136. */
  5137. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDG1RST(void)
  5138. {
  5139. return ((READ_BIT(RCC->RSR, RCC_RSR_IWDG1RSTF) == (RCC_RSR_IWDG1RSTF)) ? 1UL : 0UL);
  5140. }
  5141. #if defined(DUAL_CORE)
  5142. /**
  5143. * @brief Check if RCC flag Independent Watchdog 2 reset is set or not.
  5144. * @rmtoll RSR IWDG2RSTF LL_RCC_IsActiveFlag_IWDG2RST
  5145. * @retval State of bit (1 or 0).
  5146. */
  5147. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDG2RST(void)
  5148. {
  5149. return ((READ_BIT(RCC->RSR, RCC_RSR_IWDG2RSTF) == (RCC_RSR_IWDG2RSTF)) ? 1UL : 0UL);
  5150. }
  5151. #endif /*DUAL_CORE*/
  5152. /**
  5153. * @brief Check if RCC flag Software reset is set or not.
  5154. * @rmtoll RSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST (*)\n
  5155. * RSR SFT1RSTF LL_RCC_IsActiveFlag_SFTRST (**)
  5156. *
  5157. * (*) Only available for single core devices
  5158. * (**) Only available for Dual core devices
  5159. * @retval State of bit (1 or 0).
  5160. */
  5161. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void)
  5162. {
  5163. #if defined(DUAL_CORE)
  5164. return ((READ_BIT(RCC->RSR, RCC_RSR_SFT1RSTF) == (RCC_RSR_SFT1RSTF)) ? 1UL : 0UL);
  5165. #else
  5166. return ((READ_BIT(RCC->RSR, RCC_RSR_SFTRSTF) == (RCC_RSR_SFTRSTF)) ? 1UL : 0UL);
  5167. #endif /*DUAL_CORE*/
  5168. }
  5169. #if defined(DUAL_CORE)
  5170. /**
  5171. * @brief Check if RCC flag Software reset is set or not.
  5172. * @rmtoll RSR SFT2RSTF LL_RCC_IsActiveFlag_SFT2RST
  5173. * @retval State of bit (1 or 0).
  5174. */
  5175. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFT2RST(void)
  5176. {
  5177. return ((READ_BIT(RCC->RSR, RCC_RSR_SFT2RSTF) == (RCC_RSR_SFT2RSTF)) ? 1UL : 0UL);
  5178. }
  5179. #endif /*DUAL_CORE*/
  5180. /**
  5181. * @brief Check if RCC flag POR/PDR reset is set or not.
  5182. * @rmtoll RSR PORRSTF LL_RCC_IsActiveFlag_PORRST
  5183. * @retval State of bit (1 or 0).
  5184. */
  5185. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PORRST(void)
  5186. {
  5187. return ((READ_BIT(RCC->RSR, RCC_RSR_PORRSTF) == (RCC_RSR_PORRSTF)) ? 1UL : 0UL);
  5188. }
  5189. /**
  5190. * @brief Check if RCC flag Pin reset is set or not.
  5191. * @rmtoll RSR PINRSTF LL_RCC_IsActiveFlag_PINRST
  5192. * @retval State of bit (1 or 0).
  5193. */
  5194. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void)
  5195. {
  5196. return ((READ_BIT(RCC->RSR, RCC_RSR_PINRSTF) == (RCC_RSR_PINRSTF)) ? 1UL : 0UL);
  5197. }
  5198. /**
  5199. * @brief Check if RCC flag BOR reset is set or not.
  5200. * @rmtoll RSR BORRSTF LL_RCC_IsActiveFlag_BORRST
  5201. * @retval State of bit (1 or 0).
  5202. */
  5203. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_BORRST(void)
  5204. {
  5205. return ((READ_BIT(RCC->RSR, RCC_RSR_BORRSTF) == (RCC_RSR_BORRSTF)) ? 1UL : 0UL);
  5206. }
  5207. #if defined(RCC_RSR_D1RSTF)
  5208. /**
  5209. * @brief Check if RCC flag D1 reset is set or not.
  5210. * @rmtoll RSR D1RSTF LL_RCC_IsActiveFlag_D1RST
  5211. * @retval State of bit (1 or 0).
  5212. */
  5213. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_D1RST(void)
  5214. {
  5215. return ((READ_BIT(RCC->RSR, RCC_RSR_D1RSTF) == (RCC_RSR_D1RSTF)) ? 1UL : 0UL);
  5216. }
  5217. #endif /* RCC_RSR_D1RSTF */
  5218. #if defined(RCC_RSR_CDRSTF)
  5219. /**
  5220. * @brief Check if RCC flag CD reset is set or not.
  5221. * @rmtoll RSR CDRSTF LL_RCC_IsActiveFlag_CDRST
  5222. * @retval State of bit (1 or 0).
  5223. */
  5224. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_CDRST(void)
  5225. {
  5226. return ((READ_BIT(RCC->RSR, RCC_RSR_CDRSTF) == (RCC_RSR_CDRSTF)) ? 1UL : 0UL);
  5227. }
  5228. #endif /* RCC_RSR_CDRSTF */
  5229. #if defined(RCC_RSR_D2RSTF)
  5230. /**
  5231. * @brief Check if RCC flag D2 reset is set or not.
  5232. * @rmtoll RSR D2RSTF LL_RCC_IsActiveFlag_D2RST
  5233. * @retval State of bit (1 or 0).
  5234. */
  5235. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_D2RST(void)
  5236. {
  5237. return ((READ_BIT(RCC->RSR, RCC_RSR_D2RSTF) == (RCC_RSR_D2RSTF)) ? 1UL : 0UL);
  5238. }
  5239. #endif /* RCC_RSR_D2RSTF */
  5240. #if defined(RCC_RSR_C1RSTF) || defined(RCC_RSR_CPURSTF)
  5241. /**
  5242. * @brief Check if RCC flag CPU reset is set or not.
  5243. * @rmtoll RSR CPURSTF LL_RCC_IsActiveFlag_CPURST (*)\n
  5244. * RSR C1RSTF LL_RCC_IsActiveFlag_CPURST (**)
  5245. *
  5246. * (*) Only available for single core devices
  5247. * (**) Only available for Dual core devices
  5248. * @retval State of bit (1 or 0).
  5249. */
  5250. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_CPURST(void)
  5251. {
  5252. #if defined(DUAL_CORE)
  5253. return ((READ_BIT(RCC->RSR, RCC_RSR_C1RSTF) == (RCC_RSR_C1RSTF)) ? 1UL : 0UL);
  5254. #else
  5255. return ((READ_BIT(RCC->RSR, RCC_RSR_CPURSTF) == (RCC_RSR_CPURSTF)) ? 1UL : 0UL);
  5256. #endif/*DUAL_CORE*/
  5257. }
  5258. #endif /* defined(RCC_RSR_C1RSTF) || defined(RCC_RSR_CPURSTF) */
  5259. #if defined(DUAL_CORE)
  5260. /**
  5261. * @brief Check if RCC flag CPU2 reset is set or not.
  5262. * @rmtoll RSR C2RSTF LL_RCC_IsActiveFlag_CPU2RST
  5263. * @retval State of bit (1 or 0).
  5264. */
  5265. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_CPU2RST(void)
  5266. {
  5267. return ((READ_BIT(RCC->RSR, RCC_RSR_C2RSTF) == (RCC_RSR_C2RSTF)) ? 1UL : 0UL);
  5268. }
  5269. #endif /*DUAL_CORE*/
  5270. /**
  5271. * @brief Set RMVF bit to clear all reset flags.
  5272. * @rmtoll RSR RMVF LL_RCC_ClearResetFlags
  5273. * @retval None
  5274. */
  5275. __STATIC_INLINE void LL_RCC_ClearResetFlags(void)
  5276. {
  5277. SET_BIT(RCC->RSR, RCC_RSR_RMVF);
  5278. }
  5279. #if defined(DUAL_CORE)
  5280. /**
  5281. * @brief Check if RCC_C1 flag Low Power D1 reset is set or not.
  5282. * @rmtoll RSR LPWR1RSTF LL_C1_RCC_IsActiveFlag_LPWRRST
  5283. * @retval State of bit (1 or 0).
  5284. */
  5285. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_LPWRRST(void)
  5286. {
  5287. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_LPWR1RSTF) == (RCC_RSR_LPWR1RSTF)) ? 1UL : 0UL);
  5288. }
  5289. /**
  5290. * @brief Check if RCC_C1 flag Low Power D2 reset is set or not.
  5291. * @rmtoll RSR LPWR2RSTF LL_C1_RCC_IsActiveFlag_LPWR2RST
  5292. * @retval State of bit (1 or 0).
  5293. */
  5294. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_LPWR2RST(void)
  5295. {
  5296. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_LPWR2RSTF) == (RCC_RSR_LPWR2RSTF)) ? 1UL : 0UL);
  5297. }
  5298. /**
  5299. * @brief Check if RCC_C1 flag Window Watchdog 1 reset is set or not.
  5300. * @rmtoll RSR WWDG1RSTF LL_C1_RCC_IsActiveFlag_WWDG1RST
  5301. * @retval State of bit (1 or 0).
  5302. */
  5303. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_WWDG1RST(void)
  5304. {
  5305. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_WWDG1RSTF) == (RCC_RSR_WWDG1RSTF)) ? 1UL : 0UL);
  5306. }
  5307. /**
  5308. * @brief Check if RCC_C1 flag Window Watchdog 2 reset is set or not.
  5309. * @rmtoll RSR WWDG2RSTF LL_C1_RCC_IsActiveFlag_WWDG2RST
  5310. * @retval State of bit (1 or 0).
  5311. */
  5312. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_WWDG2RST(void)
  5313. {
  5314. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_WWDG2RSTF) == (RCC_RSR_WWDG2RSTF)) ? 1UL : 0UL);
  5315. }
  5316. /**
  5317. * @brief Check if RCC_C1 flag Independent Watchdog 1 reset is set or not.
  5318. * @rmtoll RSR IWDG1RSTF LL_C1_RCC_IsActiveFlag_IWDG1RST
  5319. * @retval State of bit (1 or 0).
  5320. */
  5321. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_IWDG1RST(void)
  5322. {
  5323. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_IWDG1RSTF) == (RCC_RSR_IWDG1RSTF)) ? 1UL : 0UL);
  5324. }
  5325. /**
  5326. * @brief Check if RCC_C1 flag Independent Watchdog 2 reset is set or not.
  5327. * @rmtoll RSR IWDG2RSTF LL_C1_RCC_IsActiveFlag_IWDG2RST
  5328. * @retval State of bit (1 or 0).
  5329. */
  5330. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_IWDG2RST(void)
  5331. {
  5332. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_IWDG2RSTF) == (RCC_RSR_IWDG2RSTF)) ? 1UL : 0UL);
  5333. }
  5334. /**
  5335. * @brief Check if RCC_C1 flag Software reset is set or not.
  5336. * @rmtoll RSR SFT1RSTF LL_C1_RCC_IsActiveFlag_SFTRST
  5337. * @retval State of bit (1 or 0).
  5338. */
  5339. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_SFTRST(void)
  5340. {
  5341. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_SFT1RSTF) == (RCC_RSR_SFT1RSTF)) ? 1UL : 0UL);
  5342. }
  5343. /**
  5344. * @brief Check if RCC_C1 flag Software reset is set or not.
  5345. * @rmtoll RSR SFT2RSTF LL_C1_RCC_IsActiveFlag_SFT2RST
  5346. * @retval State of bit (1 or 0).
  5347. */
  5348. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_SFT2RST(void)
  5349. {
  5350. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_SFT2RSTF) == (RCC_RSR_SFT2RSTF)) ? 1UL : 0UL);
  5351. }
  5352. /**
  5353. * @brief Check if RCC_C1 flag POR/PDR reset is set or not.
  5354. * @rmtoll RSR PORRSTF LL_C1_RCC_IsActiveFlag_PORRST
  5355. * @retval State of bit (1 or 0).
  5356. */
  5357. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_PORRST(void)
  5358. {
  5359. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_PORRSTF) == (RCC_RSR_PORRSTF)) ? 1UL : 0UL);
  5360. }
  5361. /**
  5362. * @brief Check if RCC_C1 flag Pin reset is set or not.
  5363. * @rmtoll RSR PINRSTF LL_C1_RCC_IsActiveFlag_PINRST
  5364. * @retval State of bit (1 or 0).
  5365. */
  5366. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_PINRST(void)
  5367. {
  5368. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_PINRSTF) == (RCC_RSR_PINRSTF)) ? 1UL : 0UL);
  5369. }
  5370. /**
  5371. * @brief Check if RCC_C1 flag BOR reset is set or not.
  5372. * @rmtoll RSR BORRSTF LL_C1_RCC_IsActiveFlag_BORRST
  5373. * @retval State of bit (1 or 0).
  5374. */
  5375. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_BORRST(void)
  5376. {
  5377. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_BORRSTF) == (RCC_RSR_BORRSTF)) ? 1UL : 0UL);
  5378. }
  5379. /**
  5380. * @brief Check if RCC_C1 flag D1 reset is set or not.
  5381. * @rmtoll RSR D1RSTF LL_C1_RCC_IsActiveFlag_D1RST
  5382. * @retval State of bit (1 or 0).
  5383. */
  5384. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_D1RST(void)
  5385. {
  5386. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_D1RSTF) == (RCC_RSR_D1RSTF)) ? 1UL : 0UL);
  5387. }
  5388. /**
  5389. * @brief Check if RCC_C1 flag D2 reset is set or not.
  5390. * @rmtoll RSR D2RSTF LL_C1_RCC_IsActiveFlag_D2RST
  5391. * @retval State of bit (1 or 0).
  5392. */
  5393. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_D2RST(void)
  5394. {
  5395. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_D2RSTF) == (RCC_RSR_D2RSTF)) ? 1UL : 0UL);
  5396. }
  5397. /**
  5398. * @brief Check if RCC_C1 flag CPU reset is set or not.
  5399. * @rmtoll RSR C1RSTF LL_C1_RCC_IsActiveFlag_CPURST
  5400. * @retval State of bit (1 or 0).
  5401. */
  5402. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_CPURST(void)
  5403. {
  5404. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_C1RSTF) == (RCC_RSR_C1RSTF)) ? 1UL : 0UL);
  5405. }
  5406. /**
  5407. * @brief Check if RCC_C1 flag CPU2 reset is set or not.
  5408. * @rmtoll RSR C2RSTF LL_C1_RCC_IsActiveFlag_CPU2RST
  5409. * @retval State of bit (1 or 0).
  5410. */
  5411. __STATIC_INLINE uint32_t LL_C1_RCC_IsActiveFlag_CPU2RST(void)
  5412. {
  5413. return ((READ_BIT(RCC_C1->RSR, RCC_RSR_C2RSTF) == (RCC_RSR_C2RSTF)) ? 1UL : 0UL);
  5414. }
  5415. /**
  5416. * @brief Set RMVF bit to clear the reset flags.
  5417. * @rmtoll RSR RMVF LL_C1_RCC_ClearResetFlags
  5418. * @retval None
  5419. */
  5420. __STATIC_INLINE void LL_C1_RCC_ClearResetFlags(void)
  5421. {
  5422. SET_BIT(RCC_C1->RSR, RCC_RSR_RMVF);
  5423. }
  5424. /**
  5425. * @brief Check if RCC_C2 flag Low Power D1 reset is set or not.
  5426. * @rmtoll RSR LPWR1RSTF LL_C2_RCC_IsActiveFlag_LPWRRST
  5427. * @retval State of bit (1 or 0).
  5428. */
  5429. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_LPWRRST(void)
  5430. {
  5431. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_LPWR1RSTF) == (RCC_RSR_LPWR1RSTF)) ? 1UL : 0UL);
  5432. }
  5433. /**
  5434. * @brief Check if RCC_C2 flag Low Power D2 reset is set or not.
  5435. * @rmtoll RSR LPWR2RSTF LL_C2_RCC_IsActiveFlag_LPWR2RST
  5436. * @retval State of bit (1 or 0).
  5437. */
  5438. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_LPWR2RST(void)
  5439. {
  5440. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_LPWR2RSTF) == (RCC_RSR_LPWR2RSTF)) ? 1UL : 0UL);
  5441. }
  5442. /**
  5443. * @brief Check if RCC_C2 flag Window Watchdog 1 reset is set or not.
  5444. * @rmtoll RSR WWDG1RSTF LL_C2_RCC_IsActiveFlag_WWDG1RST
  5445. * @retval State of bit (1 or 0).
  5446. */
  5447. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_WWDG1RST(void)
  5448. {
  5449. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_WWDG1RSTF) == (RCC_RSR_WWDG1RSTF)) ? 1UL : 0UL);
  5450. }
  5451. /**
  5452. * @brief Check if RCC_C2 flag Window Watchdog 2 reset is set or not.
  5453. * @rmtoll RSR WWDG2RSTF LL_C2_RCC_IsActiveFlag_WWDG2RST
  5454. * @retval State of bit (1 or 0).
  5455. */
  5456. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_WWDG2RST(void)
  5457. {
  5458. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_WWDG2RSTF) == (RCC_RSR_WWDG2RSTF)) ? 1UL : 0UL);
  5459. }
  5460. /**
  5461. * @brief Check if RCC_C2 flag Independent Watchdog 1 reset is set or not.
  5462. * @rmtoll RSR IWDG1RSTF LL_C2_RCC_IsActiveFlag_IWDG1RST
  5463. * @retval State of bit (1 or 0).
  5464. */
  5465. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_IWDG1RST(void)
  5466. {
  5467. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_IWDG1RSTF) == (RCC_RSR_IWDG1RSTF)) ? 1UL : 0UL);
  5468. }
  5469. /**
  5470. * @brief Check if RCC_C2 flag Independent Watchdog 2 reset is set or not.
  5471. * @rmtoll RSR IWDG2RSTF LL_C2_RCC_IsActiveFlag_IWDG2RST
  5472. * @retval State of bit (1 or 0).
  5473. */
  5474. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_IWDG2RST(void)
  5475. {
  5476. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_IWDG2RSTF) == (RCC_RSR_IWDG2RSTF)) ? 1UL : 0UL);
  5477. }
  5478. /**
  5479. * @brief Check if RCC_C2 flag Software reset is set or not.
  5480. * @rmtoll RSR SFT1RSTF LL_C2_RCC_IsActiveFlag_SFTRST
  5481. * @retval State of bit (1 or 0).
  5482. */
  5483. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_SFTRST(void)
  5484. {
  5485. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_SFT1RSTF) == (RCC_RSR_SFT1RSTF)) ? 1UL : 0UL);
  5486. }
  5487. /**
  5488. * @brief Check if RCC_C2 flag Software reset is set or not.
  5489. * @rmtoll RSR SFT2RSTF LL_C2_RCC_IsActiveFlag_SFT2RST
  5490. * @retval State of bit (1 or 0).
  5491. */
  5492. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_SFT2RST(void)
  5493. {
  5494. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_SFT2RSTF) == (RCC_RSR_SFT2RSTF)) ? 1UL : 0UL);
  5495. }
  5496. /**
  5497. * @brief Check if RCC_C2 flag POR/PDR reset is set or not.
  5498. * @rmtoll RSR PORRSTF LL_C2_RCC_IsActiveFlag_PORRST
  5499. * @retval State of bit (1 or 0).
  5500. */
  5501. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_PORRST(void)
  5502. {
  5503. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_PORRSTF) == (RCC_RSR_PORRSTF)) ? 1UL : 0UL);
  5504. }
  5505. /**
  5506. * @brief Check if RCC_C2 flag Pin reset is set or not.
  5507. * @rmtoll RSR PINRSTF LL_C2_RCC_IsActiveFlag_PINRST
  5508. * @retval State of bit (1 or 0).
  5509. */
  5510. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_PINRST(void)
  5511. {
  5512. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_PINRSTF) == (RCC_RSR_PINRSTF)) ? 1UL : 0UL);
  5513. }
  5514. /**
  5515. * @brief Check if RCC_C2 flag BOR reset is set or not.
  5516. * @rmtoll RSR BORRSTF LL_C2_RCC_IsActiveFlag_BORRST
  5517. * @retval State of bit (1 or 0).
  5518. */
  5519. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_BORRST(void)
  5520. {
  5521. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_BORRSTF) == (RCC_RSR_BORRSTF)) ? 1UL : 0UL);
  5522. }
  5523. /**
  5524. * @brief Check if RCC_C2 flag D1 reset is set or not.
  5525. * @rmtoll RSR D1RSTF LL_C2_RCC_IsActiveFlag_D1RST
  5526. * @retval State of bit (1 or 0).
  5527. */
  5528. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_D1RST(void)
  5529. {
  5530. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_D1RSTF) == (RCC_RSR_D1RSTF)) ? 1UL : 0UL);
  5531. }
  5532. /**
  5533. * @brief Check if RCC_C2 flag D2 reset is set or not.
  5534. * @rmtoll RSR D2RSTF LL_C2_RCC_IsActiveFlag_D2RST
  5535. * @retval State of bit (1 or 0).
  5536. */
  5537. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_D2RST(void)
  5538. {
  5539. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_D2RSTF) == (RCC_RSR_D2RSTF)) ? 1UL : 0UL);
  5540. }
  5541. /**
  5542. * @brief Check if RCC_C2 flag CPU reset is set or not.
  5543. * @rmtoll RSR C1RSTF LL_C2_RCC_IsActiveFlag_CPURST
  5544. * @retval State of bit (1 or 0).
  5545. */
  5546. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_CPURST(void)
  5547. {
  5548. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_C1RSTF) == (RCC_RSR_C1RSTF)) ? 1UL : 0UL);
  5549. }
  5550. /**
  5551. * @brief Check if RCC_C2 flag CPU2 reset is set or not.
  5552. * @rmtoll RSR C2RSTF LL_C2_RCC_IsActiveFlag_CPU2RST
  5553. * @retval State of bit (1 or 0).
  5554. */
  5555. __STATIC_INLINE uint32_t LL_C2_RCC_IsActiveFlag_CPU2RST(void)
  5556. {
  5557. return ((READ_BIT(RCC_C2->RSR, RCC_RSR_C2RSTF) == (RCC_RSR_C2RSTF)) ? 1UL : 0UL);
  5558. }
  5559. /**
  5560. * @brief Set RMVF bit to clear the reset flags.
  5561. * @rmtoll RSR RMVF LL_C2_RCC_ClearResetFlags
  5562. * @retval None
  5563. */
  5564. __STATIC_INLINE void LL_C2_RCC_ClearResetFlags(void)
  5565. {
  5566. SET_BIT(RCC_C2->RSR, RCC_RSR_RMVF);
  5567. }
  5568. #endif /*DUAL_CORE*/
  5569. /**
  5570. * @}
  5571. */
  5572. /** @defgroup RCC_LL_EF_IT_Management IT Management
  5573. * @{
  5574. */
  5575. /**
  5576. * @brief Enable LSI ready interrupt
  5577. * @rmtoll CIER LSIRDYIE LL_RCC_EnableIT_LSIRDY
  5578. * @retval None
  5579. */
  5580. __STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void)
  5581. {
  5582. SET_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  5583. }
  5584. /**
  5585. * @brief Enable LSE ready interrupt
  5586. * @rmtoll CIER LSERDYIE LL_RCC_EnableIT_LSERDY
  5587. * @retval None
  5588. */
  5589. __STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void)
  5590. {
  5591. SET_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  5592. }
  5593. /**
  5594. * @brief Enable HSI ready interrupt
  5595. * @rmtoll CIER HSIRDYIE LL_RCC_EnableIT_HSIRDY
  5596. * @retval None
  5597. */
  5598. __STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void)
  5599. {
  5600. SET_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  5601. }
  5602. /**
  5603. * @brief Enable HSE ready interrupt
  5604. * @rmtoll CIER HSERDYIE LL_RCC_EnableIT_HSERDY
  5605. * @retval None
  5606. */
  5607. __STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void)
  5608. {
  5609. SET_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  5610. }
  5611. /**
  5612. * @brief Enable CSI ready interrupt
  5613. * @rmtoll CIER CSIRDYIE LL_RCC_EnableIT_CSIRDY
  5614. * @retval None
  5615. */
  5616. __STATIC_INLINE void LL_RCC_EnableIT_CSIRDY(void)
  5617. {
  5618. SET_BIT(RCC->CIER, RCC_CIER_CSIRDYIE);
  5619. }
  5620. /**
  5621. * @brief Enable HSI48 ready interrupt
  5622. * @rmtoll CIER HSI48RDYIE LL_RCC_EnableIT_HSI48RDY
  5623. * @retval None
  5624. */
  5625. __STATIC_INLINE void LL_RCC_EnableIT_HSI48RDY(void)
  5626. {
  5627. SET_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  5628. }
  5629. /**
  5630. * @brief Enable PLL1 ready interrupt
  5631. * @rmtoll CIER PLL1RDYIE LL_RCC_EnableIT_PLL1RDY
  5632. * @retval None
  5633. */
  5634. __STATIC_INLINE void LL_RCC_EnableIT_PLL1RDY(void)
  5635. {
  5636. SET_BIT(RCC->CIER, RCC_CIER_PLL1RDYIE);
  5637. }
  5638. /**
  5639. * @brief Enable PLL2 ready interrupt
  5640. * @rmtoll CIER PLL2RDYIE LL_RCC_EnableIT_PLL2RDY
  5641. * @retval None
  5642. */
  5643. __STATIC_INLINE void LL_RCC_EnableIT_PLL2RDY(void)
  5644. {
  5645. SET_BIT(RCC->CIER, RCC_CIER_PLL2RDYIE);
  5646. }
  5647. /**
  5648. * @brief Enable PLL3 ready interrupt
  5649. * @rmtoll CIER PLL3RDYIE LL_RCC_EnableIT_PLL3RDY
  5650. * @retval None
  5651. */
  5652. __STATIC_INLINE void LL_RCC_EnableIT_PLL3RDY(void)
  5653. {
  5654. SET_BIT(RCC->CIER, RCC_CIER_PLL3RDYIE);
  5655. }
  5656. /**
  5657. * @brief Enable LSECSS interrupt
  5658. * @rmtoll CIER LSECSSIE LL_RCC_EnableIT_LSECSS
  5659. * @retval None
  5660. */
  5661. __STATIC_INLINE void LL_RCC_EnableIT_LSECSS(void)
  5662. {
  5663. SET_BIT(RCC->CIER, RCC_CIER_LSECSSIE);
  5664. }
  5665. /**
  5666. * @brief Disable LSI ready interrupt
  5667. * @rmtoll CIER LSIRDYIE LL_RCC_DisableIT_LSIRDY
  5668. * @retval None
  5669. */
  5670. __STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void)
  5671. {
  5672. CLEAR_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  5673. }
  5674. /**
  5675. * @brief Disable LSE ready interrupt
  5676. * @rmtoll CIER LSERDYIE LL_RCC_DisableIT_LSERDY
  5677. * @retval None
  5678. */
  5679. __STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void)
  5680. {
  5681. CLEAR_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  5682. }
  5683. /**
  5684. * @brief Disable HSI ready interrupt
  5685. * @rmtoll CIER HSIRDYIE LL_RCC_DisableIT_HSIRDY
  5686. * @retval None
  5687. */
  5688. __STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void)
  5689. {
  5690. CLEAR_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  5691. }
  5692. /**
  5693. * @brief Disable HSE ready interrupt
  5694. * @rmtoll CIER HSERDYIE LL_RCC_DisableIT_HSERDY
  5695. * @retval None
  5696. */
  5697. __STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void)
  5698. {
  5699. CLEAR_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  5700. }
  5701. /**
  5702. * @brief Disable CSI ready interrupt
  5703. * @rmtoll CIER CSIRDYIE LL_RCC_DisableIT_CSIRDY
  5704. * @retval None
  5705. */
  5706. __STATIC_INLINE void LL_RCC_DisableIT_CSIRDY(void)
  5707. {
  5708. CLEAR_BIT(RCC->CIER, RCC_CIER_CSIRDYIE);
  5709. }
  5710. /**
  5711. * @brief Disable HSI48 ready interrupt
  5712. * @rmtoll CIER HSI48RDYIE LL_RCC_DisableIT_HSI48RDY
  5713. * @retval None
  5714. */
  5715. __STATIC_INLINE void LL_RCC_DisableIT_HSI48RDY(void)
  5716. {
  5717. CLEAR_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  5718. }
  5719. /**
  5720. * @brief Disable PLL1 ready interrupt
  5721. * @rmtoll CIER PLL1RDYIE LL_RCC_DisableIT_PLL1RDY
  5722. * @retval None
  5723. */
  5724. __STATIC_INLINE void LL_RCC_DisableIT_PLL1RDY(void)
  5725. {
  5726. CLEAR_BIT(RCC->CIER, RCC_CIER_PLL1RDYIE);
  5727. }
  5728. /**
  5729. * @brief Disable PLL2 ready interrupt
  5730. * @rmtoll CIER PLL2RDYIE LL_RCC_DisableIT_PLL2RDY
  5731. * @retval None
  5732. */
  5733. __STATIC_INLINE void LL_RCC_DisableIT_PLL2RDY(void)
  5734. {
  5735. CLEAR_BIT(RCC->CIER, RCC_CIER_PLL2RDYIE);
  5736. }
  5737. /**
  5738. * @brief Disable PLL3 ready interrupt
  5739. * @rmtoll CIER PLL3RDYIE LL_RCC_DisableIT_PLL3RDY
  5740. * @retval None
  5741. */
  5742. __STATIC_INLINE void LL_RCC_DisableIT_PLL3RDY(void)
  5743. {
  5744. CLEAR_BIT(RCC->CIER, RCC_CIER_PLL3RDYIE);
  5745. }
  5746. /**
  5747. * @brief Disable LSECSS interrupt
  5748. * @rmtoll CIER LSECSSIE LL_RCC_DisableIT_LSECSS
  5749. * @retval None
  5750. */
  5751. __STATIC_INLINE void LL_RCC_DisableIT_LSECSS(void)
  5752. {
  5753. CLEAR_BIT(RCC->CIER, RCC_CIER_LSECSSIE);
  5754. }
  5755. /**
  5756. * @brief Checks if LSI ready interrupt source is enabled or disabled.
  5757. * @rmtoll CIER LSIRDYIE LL_RCC_IsEnableIT_LSIRDY
  5758. * @retval State of bit (1 or 0).
  5759. */
  5760. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_LSIRDY(void)
  5761. {
  5762. return ((READ_BIT(RCC->CIER, RCC_CIER_LSIRDYIE) == RCC_CIER_LSIRDYIE) ? 1UL : 0UL);
  5763. }
  5764. /**
  5765. * @brief Checks if LSE ready interrupt source is enabled or disabled.
  5766. * @rmtoll CIER LSERDYIE LL_RCC_IsEnableIT_LSERDY
  5767. * @retval State of bit (1 or 0).
  5768. */
  5769. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_LSERDY(void)
  5770. {
  5771. return ((READ_BIT(RCC->CIER, RCC_CIER_LSERDYIE) == RCC_CIER_LSERDYIE) ? 1UL : 0UL);
  5772. }
  5773. /**
  5774. * @brief Checks if HSI ready interrupt source is enabled or disabled.
  5775. * @rmtoll CIER HSIRDYIE LL_RCC_IsEnableIT_HSIRDY
  5776. * @retval State of bit (1 or 0).
  5777. */
  5778. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_HSIRDY(void)
  5779. {
  5780. return ((READ_BIT(RCC->CIER, RCC_CIER_HSIRDYIE) == RCC_CIER_HSIRDYIE) ? 1UL : 0UL);
  5781. }
  5782. /**
  5783. * @brief Checks if HSE ready interrupt source is enabled or disabled.
  5784. * @rmtoll CIER HSERDYIE LL_RCC_IsEnableIT_HSERDY
  5785. * @retval State of bit (1 or 0).
  5786. */
  5787. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_HSERDY(void)
  5788. {
  5789. return ((READ_BIT(RCC->CIER, RCC_CIER_HSERDYIE) == RCC_CIER_HSERDYIE) ? 1UL : 0UL);
  5790. }
  5791. /**
  5792. * @brief Checks if CSI ready interrupt source is enabled or disabled.
  5793. * @rmtoll CIER CSIRDYIE LL_RCC_IsEnableIT_CSIRDY
  5794. * @retval State of bit (1 or 0).
  5795. */
  5796. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_CSIRDY(void)
  5797. {
  5798. return ((READ_BIT(RCC->CIER, RCC_CIER_CSIRDYIE) == RCC_CIER_CSIRDYIE) ? 1UL : 0UL);
  5799. }
  5800. /**
  5801. * @brief Checks if HSI48 ready interrupt source is enabled or disabled.
  5802. * @rmtoll CIER HSI48RDYIE LL_RCC_IsEnableIT_HSI48RDY
  5803. * @retval State of bit (1 or 0).
  5804. */
  5805. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_HSI48RDY(void)
  5806. {
  5807. return ((READ_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE) == RCC_CIER_HSI48RDYIE) ? 1UL : 0UL);
  5808. }
  5809. /**
  5810. * @brief Checks if PLL1 ready interrupt source is enabled or disabled.
  5811. * @rmtoll CIER PLL1RDYIE LL_RCC_IsEnableIT_PLL1RDY
  5812. * @retval State of bit (1 or 0).
  5813. */
  5814. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_PLL1RDY(void)
  5815. {
  5816. return ((READ_BIT(RCC->CIER, RCC_CIER_PLL1RDYIE) == RCC_CIER_PLL1RDYIE) ? 1UL : 0UL);
  5817. }
  5818. /**
  5819. * @brief Checks if PLL2 ready interrupt source is enabled or disabled.
  5820. * @rmtoll CIER PLL2RDYIE LL_RCC_IsEnableIT_PLL2RDY
  5821. * @retval State of bit (1 or 0).
  5822. */
  5823. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_PLL2RDY(void)
  5824. {
  5825. return ((READ_BIT(RCC->CIER, RCC_CIER_PLL2RDYIE) == RCC_CIER_PLL2RDYIE) ? 1UL : 0UL);
  5826. }
  5827. /**
  5828. * @brief Checks if PLL3 ready interrupt source is enabled or disabled.
  5829. * @rmtoll CIER PLL3RDYIE LL_RCC_IsEnableIT_PLL3RDY
  5830. * @retval State of bit (1 or 0).
  5831. */
  5832. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_PLL3RDY(void)
  5833. {
  5834. return ((READ_BIT(RCC->CIER, RCC_CIER_PLL3RDYIE) == RCC_CIER_PLL3RDYIE) ? 1UL : 0UL);
  5835. }
  5836. /**
  5837. * @brief Checks if LSECSS interrupt source is enabled or disabled.
  5838. * @rmtoll CIER LSECSSIE LL_RCC_IsEnableIT_LSECSS
  5839. * @retval State of bit (1 or 0).
  5840. */
  5841. __STATIC_INLINE uint32_t LL_RCC_IsEnableIT_LSECSS(void)
  5842. {
  5843. return ((READ_BIT(RCC->CIER, RCC_CIER_LSECSSIE) == RCC_CIER_LSECSSIE) ? 1UL : 0UL);
  5844. }
  5845. /**
  5846. * @}
  5847. */
  5848. #if defined(USE_FULL_LL_DRIVER)
  5849. /** @defgroup RCC_LL_EF_Init De-initialization function
  5850. * @{
  5851. */
  5852. void LL_RCC_DeInit(void);
  5853. /**
  5854. * @}
  5855. */
  5856. /** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions
  5857. * @{
  5858. */
  5859. uint32_t LL_RCC_CalcPLLClockFreq(uint32_t PLLInputFreq, uint32_t M, uint32_t N, uint32_t FRACN, uint32_t PQR);
  5860. void LL_RCC_GetPLL1ClockFreq(LL_PLL_ClocksTypeDef *PLL_Clocks);
  5861. void LL_RCC_GetPLL2ClockFreq(LL_PLL_ClocksTypeDef *PLL_Clocks);
  5862. void LL_RCC_GetPLL3ClockFreq(LL_PLL_ClocksTypeDef *PLL_Clocks);
  5863. void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks);
  5864. uint32_t LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource);
  5865. uint32_t LL_RCC_GetLPUARTClockFreq(uint32_t LPUARTxSource);
  5866. uint32_t LL_RCC_GetI2CClockFreq(uint32_t I2CxSource);
  5867. uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource);
  5868. uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource);
  5869. uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource);
  5870. uint32_t LL_RCC_GetSDMMCClockFreq(uint32_t SDMMCxSource);
  5871. uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource);
  5872. uint32_t LL_RCC_GetCECClockFreq(uint32_t CECxSource);
  5873. uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource);
  5874. uint32_t LL_RCC_GetDFSDMClockFreq(uint32_t DFSDMxSource);
  5875. #if defined(DFSDM2_BASE)
  5876. uint32_t LL_RCC_GetDFSDM2ClockFreq(uint32_t DFSDMxSource);
  5877. #endif /* DFSDM2_BASE */
  5878. #if defined(DSI)
  5879. uint32_t LL_RCC_GetDSIClockFreq(uint32_t DSIxSource);
  5880. #endif /* DSI */
  5881. uint32_t LL_RCC_GetSPDIFClockFreq(uint32_t SPDIFxSource);
  5882. uint32_t LL_RCC_GetSPIClockFreq(uint32_t SPIxSource);
  5883. uint32_t LL_RCC_GetSWPClockFreq(uint32_t SWPxSource);
  5884. uint32_t LL_RCC_GetFDCANClockFreq(uint32_t FDCANxSource);
  5885. uint32_t LL_RCC_GetFMCClockFreq(uint32_t FMCxSource);
  5886. #if defined(QUADSPI)
  5887. uint32_t LL_RCC_GetQSPIClockFreq(uint32_t QSPIxSource);
  5888. #endif /* QUADSPI */
  5889. #if defined(OCTOSPI1) || defined(OCTOSPI2)
  5890. uint32_t LL_RCC_GetOSPIClockFreq(uint32_t OSPIxSource);
  5891. #endif /* defined(OCTOSPI1) || defined(OCTOSPI2) */
  5892. uint32_t LL_RCC_GetCLKPClockFreq(uint32_t CLKPxSource);
  5893. /**
  5894. * @}
  5895. */
  5896. #endif /* USE_FULL_LL_DRIVER */
  5897. /**
  5898. * @}
  5899. */
  5900. /**
  5901. * @}
  5902. */
  5903. #endif /* defined(RCC) */
  5904. /**
  5905. * @}
  5906. */
  5907. #ifdef __cplusplus
  5908. }
  5909. #endif
  5910. #endif /* STM32H7xx_LL_RCC_H */