stm32l5xx_ll_rcc.h 202 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833
  1. /**
  2. ******************************************************************************
  3. * @file stm32l5xx_ll_rcc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2019 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 STM32L5xx_LL_RCC_H
  19. #define STM32L5xx_LL_RCC_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32l5xx.h"
  25. /** @addtogroup STM32L5xx_LL_Driver
  26. * @{
  27. */
  28. #if defined(RCC)
  29. /** @defgroup RCC_LL RCC
  30. * @{
  31. */
  32. /* Private types -------------------------------------------------------------*/
  33. /* Private variables ---------------------------------------------------------*/
  34. /* Private constants ---------------------------------------------------------*/
  35. /** @defgroup RCC_LL_Private_Constants RCC Private Constants
  36. * @{
  37. */
  38. /* Defines used to perform offsets*/
  39. /* Offset used to access to RCC_CCIPR1 and RCC_CCIPR2 registers */
  40. #define RCC_OFFSET_CCIPR1 0U
  41. #define RCC_OFFSET_CCIPR2 0x14U
  42. /* Defines used for security configuration extension */
  43. #define RCC_SECURE_MASK 0x1FFFU
  44. /**
  45. * @}
  46. */
  47. /* Private macros ------------------------------------------------------------*/
  48. /* Exported types ------------------------------------------------------------*/
  49. #if defined(USE_FULL_LL_DRIVER)
  50. /** @defgroup RCC_LL_Exported_Types RCC Exported Types
  51. * @{
  52. */
  53. /** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure
  54. * @{
  55. */
  56. /**
  57. * @brief RCC Clocks Frequency Structure
  58. */
  59. typedef struct
  60. {
  61. uint32_t SYSCLK_Frequency; /*!< SYSCLK clock frequency */
  62. uint32_t HCLK_Frequency; /*!< HCLK clock frequency */
  63. uint32_t PCLK1_Frequency; /*!< PCLK1 clock frequency */
  64. uint32_t PCLK2_Frequency; /*!< PCLK2 clock frequency */
  65. } LL_RCC_ClocksTypeDef;
  66. /**
  67. * @}
  68. */
  69. /**
  70. * @}
  71. */
  72. #endif /* USE_FULL_LL_DRIVER */
  73. /* Exported constants --------------------------------------------------------*/
  74. /** @defgroup RCC_LL_Exported_Constants RCC Exported Constants
  75. * @{
  76. */
  77. /** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation
  78. * @brief Defines used to adapt values of different oscillators
  79. * @note These values could be modified in the user environment according to
  80. * HW set-up.
  81. * @{
  82. */
  83. #if !defined (HSE_VALUE)
  84. #define HSE_VALUE 8000000U /*!< Value of the HSE oscillator in Hz */
  85. #endif /* HSE_VALUE */
  86. #if !defined (HSI_VALUE)
  87. #define HSI_VALUE 16000000U /*!< Value of the HSI oscillator in Hz */
  88. #endif /* HSI_VALUE */
  89. #if !defined (LSE_VALUE)
  90. #define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */
  91. #endif /* LSE_VALUE */
  92. #if !defined (LSI_VALUE)
  93. #define LSI_VALUE 32000U /*!< Value of the LSI oscillator in Hz */
  94. #endif /* LSI_VALUE */
  95. #if !defined (HSI48_VALUE)
  96. #define HSI48_VALUE 48000000U /*!< Value of the HSI48 oscillator in Hz */
  97. #endif /* HSI48_VALUE */
  98. #if !defined (EXTERNAL_SAI1_CLOCK_VALUE)
  99. #define EXTERNAL_SAI1_CLOCK_VALUE 48000U /*!< Value of the SAI1_EXTCLK external oscillator in Hz */
  100. #endif /* EXTERNAL_SAI1_CLOCK_VALUE */
  101. #if !defined (EXTERNAL_SAI2_CLOCK_VALUE)
  102. #define EXTERNAL_SAI2_CLOCK_VALUE 48000U /*!< Value of the SAI2_EXTCLK external oscillator in Hz */
  103. #endif /* EXTERNAL_SAI2_CLOCK_VALUE */
  104. /**
  105. * @}
  106. */
  107. /** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines
  108. * @brief Flags defines which can be used with LL_RCC_WriteReg function
  109. * @{
  110. */
  111. #define LL_RCC_CICR_LSIRDYC RCC_CICR_LSIRDYC /*!< LSI Ready Interrupt Clear */
  112. #define LL_RCC_CICR_LSERDYC RCC_CICR_LSERDYC /*!< LSE Ready Interrupt Clear */
  113. #define LL_RCC_CICR_MSIRDYC RCC_CICR_MSIRDYC /*!< MSI Ready Interrupt Clear */
  114. #define LL_RCC_CICR_HSIRDYC RCC_CICR_HSIRDYC /*!< HSI Ready Interrupt Clear */
  115. #define LL_RCC_CICR_HSERDYC RCC_CICR_HSERDYC /*!< HSE Ready Interrupt Clear */
  116. #define LL_RCC_CICR_PLLRDYC RCC_CICR_PLLRDYC /*!< PLL Ready Interrupt Clear */
  117. #define LL_RCC_CICR_HSI48RDYC RCC_CICR_HSI48RDYC /*!< HSI48 Ready Interrupt Clear */
  118. #define LL_RCC_CICR_PLLSAI1RDYC RCC_CICR_PLLSAI1RDYC /*!< PLLSAI1 Ready Interrupt Clear */
  119. #define LL_RCC_CICR_PLLSAI2RDYC RCC_CICR_PLLSAI2RDYC /*!< PLLSAI2 Ready Interrupt Clear */
  120. #define LL_RCC_CICR_CSSC RCC_CICR_CSSC /*!< Clock Security System Interrupt Clear */
  121. /**
  122. * @}
  123. */
  124. /** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines
  125. * @brief Flags defines which can be used with LL_RCC_ReadReg function
  126. * @{
  127. */
  128. #define LL_RCC_CIFR_LSIRDYF RCC_CIFR_LSIRDYF /*!< LSI Ready Interrupt flag */
  129. #define LL_RCC_CIFR_LSERDYF RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
  130. #define LL_RCC_CIFR_MSIRDYF RCC_CIFR_MSIRDYF /*!< MSI Ready Interrupt flag */
  131. #define LL_RCC_CIFR_HSIRDYF RCC_CIFR_HSIRDYF /*!< HSI Ready Interrupt flag */
  132. #define LL_RCC_CIFR_HSERDYF RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
  133. #define LL_RCC_CIFR_PLLRDYF RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
  134. #define LL_RCC_CIFR_HSI48RDYF RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
  135. #define LL_RCC_CIFR_PLLSAI1RDYF RCC_CIFR_PLLSAI1RDYF /*!< PLLSAI1 Ready Interrupt flag */
  136. #define LL_RCC_CIFR_PLLSAI2RDYF RCC_CIFR_PLLSAI2RDYF /*!< PLLSAI2 Ready Interrupt flag */
  137. #define LL_RCC_CIFR_CSSF RCC_CIFR_CSSF /*!< Clock Security System Interrupt flag */
  138. #define LL_RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF /*!< Low-Power reset flag */
  139. #define LL_RCC_CSR_OBLRSTF RCC_CSR_OBLRSTF /*!< OBL reset flag */
  140. #define LL_RCC_CSR_PINRSTF RCC_CSR_PINRSTF /*!< PIN reset flag */
  141. #define LL_RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF /*!< Software Reset flag */
  142. #define LL_RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF /*!< Independent Watchdog reset flag */
  143. #define LL_RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF /*!< Window watchdog reset flag */
  144. #define LL_RCC_CSR_BORRSTF RCC_CSR_BORRSTF /*!< BOR reset flag */
  145. /**
  146. * @}
  147. */
  148. /** @defgroup RCC_LL_EC_IT IT Defines
  149. * @brief IT defines which can be used with LL_RCC_ReadReg and LL_RCC_WriteReg functions
  150. * @{
  151. */
  152. #define LL_RCC_CIER_LSIRDYIE RCC_CIER_LSIRDYIE /*!< LSI Ready Interrupt Enable */
  153. #define LL_RCC_CIER_LSERDYIE RCC_CIER_LSERDYIE /*!< LSE Ready Interrupt Enable */
  154. #define LL_RCC_CIER_MSIRDYIE RCC_CIER_MSIRDYIE /*!< MSI Ready Interrupt Enable */
  155. #define LL_RCC_CIER_HSIRDYIE RCC_CIER_HSIRDYIE /*!< HSI Ready Interrupt Enable */
  156. #define LL_RCC_CIER_HSERDYIE RCC_CIER_HSERDYIE /*!< HSE Ready Interrupt Enable */
  157. #define LL_RCC_CIER_PLLRDYIE RCC_CIER_PLLRDYIE /*!< PLL Ready Interrupt Enable */
  158. #define LL_RCC_CIER_HSI48RDYIE RCC_CIER_HSI48RDYIE /*!< HSI48 Ready Interrupt Enable */
  159. #define LL_RCC_CIER_PLLSAI1RDYIE RCC_CIER_PLLSAI1RDYIE /*!< PLLSAI1 Ready Interrupt Enable */
  160. #define LL_RCC_CIER_PLLSAI2RDYIE RCC_CIER_PLLSAI2RDYIE /*!< PLLSAI2 Ready Interrupt Enable */
  161. /**
  162. * @}
  163. */
  164. /** @defgroup RCC_LL_EC_LSIPRE LSI prescaler
  165. * @{
  166. */
  167. #define LL_RCC_LSI_DIV_1 0UL /*!< LSI divided by 1 */
  168. #define LL_RCC_LSI_DIV_128 RCC_CSR_LSIPRE /*!< LSI divided by 128 */
  169. /**
  170. * @}
  171. */
  172. /** @defgroup RCC_LL_EC_LSEDRIVE LSE oscillator drive capability
  173. * @{
  174. */
  175. #define LL_RCC_LSEDRIVE_LOW 0UL /*!< Xtal mode lower driving capability */
  176. #define LL_RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< Xtal mode medium low driving capability */
  177. #define LL_RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< Xtal mode medium high driving capability */
  178. #define LL_RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< Xtal mode higher driving capability */
  179. /**
  180. * @}
  181. */
  182. /** @defgroup RCC_LL_EC_MSIRANGE MSI clock ranges
  183. * @{
  184. */
  185. #define LL_RCC_MSIRANGE_0 0UL /*!< MSI = 100 kHz */
  186. #define LL_RCC_MSIRANGE_1 RCC_CR_MSIRANGE_0 /*!< MSI = 200 kHz */
  187. #define LL_RCC_MSIRANGE_2 RCC_CR_MSIRANGE_1 /*!< MSI = 400 kHz */
  188. #define LL_RCC_MSIRANGE_3 (RCC_CR_MSIRANGE_1 | RCC_CR_MSIRANGE_0) /*!< MSI = 800 kHz */
  189. #define LL_RCC_MSIRANGE_4 RCC_CR_MSIRANGE_2 /*!< MSI = 1 MHz */
  190. #define LL_RCC_MSIRANGE_5 (RCC_CR_MSIRANGE_2 | RCC_CR_MSIRANGE_0) /*!< MSI = 2 MHz */
  191. #define LL_RCC_MSIRANGE_6 (RCC_CR_MSIRANGE_2 | RCC_CR_MSIRANGE_1) /*!< MSI = 4 MHz */
  192. #define LL_RCC_MSIRANGE_7 (RCC_CR_MSIRANGE_2 | RCC_CR_MSIRANGE_1 | RCC_CR_MSIRANGE_0) /*!< MSI = 8 MHz */
  193. #define LL_RCC_MSIRANGE_8 RCC_CR_MSIRANGE_3 /*!< MSI = 16 MHz */
  194. #define LL_RCC_MSIRANGE_9 (RCC_CR_MSIRANGE_3 | RCC_CR_MSIRANGE_0) /*!< MSI = 24 MHz */
  195. #define LL_RCC_MSIRANGE_10 (RCC_CR_MSIRANGE_3 | RCC_CR_MSIRANGE_1) /*!< MSI = 32 MHz */
  196. #define LL_RCC_MSIRANGE_11 (RCC_CR_MSIRANGE_3 | RCC_CR_MSIRANGE_1 | RCC_CR_MSIRANGE_0) /*!< MSI = 48 MHz */
  197. /**
  198. * @}
  199. */
  200. /** @defgroup RCC_LL_EC_MSISRANGE MSI range after Standby mode
  201. * @{
  202. */
  203. #define LL_RCC_MSISRANGE_4 RCC_CSR_MSISRANGE_2 /*!< MSI = 1 MHz */
  204. #define LL_RCC_MSISRANGE_5 (RCC_CSR_MSISRANGE_2 | RCC_CSR_MSISRANGE_0) /*!< MSI = 2 MHz */
  205. #define LL_RCC_MSISRANGE_6 (RCC_CSR_MSISRANGE_2 | RCC_CSR_MSISRANGE_1) /*!< MSI = 4 MHz */
  206. #define LL_RCC_MSISRANGE_7 (RCC_CSR_MSISRANGE_2 | RCC_CSR_MSISRANGE_1 | RCC_CSR_MSISRANGE_0) /*!< MSI = 8 MHz */
  207. /**
  208. * @}
  209. */
  210. /** @defgroup RCC_LL_EC_LSCO_CLKSOURCE LSCO Selection
  211. * @{
  212. */
  213. #define LL_RCC_LSCO_CLKSOURCE_LSI 0UL /*!< LSI selection for low speed clock */
  214. #define LL_RCC_LSCO_CLKSOURCE_LSE RCC_BDCR_LSCOSEL /*!< LSE selection for low speed clock */
  215. /**
  216. * @}
  217. */
  218. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch
  219. * @{
  220. */
  221. #define LL_RCC_SYS_CLKSOURCE_MSI 0UL /*!< MSI selection as system clock */
  222. #define LL_RCC_SYS_CLKSOURCE_HSI RCC_CFGR_SW_0 /*!< HSI selection as system clock */
  223. #define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_1 /*!< HSE selection as system clock */
  224. #define LL_RCC_SYS_CLKSOURCE_PLL RCC_CFGR_SW /*!< PLL selection as system clock */
  225. /**
  226. * @}
  227. */
  228. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status
  229. * @{
  230. */
  231. #define LL_RCC_SYS_CLKSOURCE_STATUS_MSI 0UL /*!< MSI used as system clock */
  232. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSI RCC_CFGR_SWS_0 /*!< HSI used as system clock */
  233. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSE RCC_CFGR_SWS_1 /*!< HSE used as system clock */
  234. #define LL_RCC_SYS_CLKSOURCE_STATUS_PLL RCC_CFGR_SWS /*!< PLL used as system clock */
  235. /**
  236. * @}
  237. */
  238. /** @defgroup RCC_LL_EC_SYSCLK_DIV AHB prescaler
  239. * @{
  240. */
  241. #define LL_RCC_SYSCLK_DIV_1 0UL /*!< SYSCLK not divided */
  242. #define LL_RCC_SYSCLK_DIV_2 RCC_CFGR_HPRE_3 /*!< SYSCLK divided by 2 */
  243. #define LL_RCC_SYSCLK_DIV_4 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 4 */
  244. #define LL_RCC_SYSCLK_DIV_8 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_1) /*!< SYSCLK divided by 8 */
  245. #define LL_RCC_SYSCLK_DIV_16 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_1 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 16 */
  246. #define LL_RCC_SYSCLK_DIV_64 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2) /*!< SYSCLK divided by 64 */
  247. #define LL_RCC_SYSCLK_DIV_128 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 128 */
  248. #define LL_RCC_SYSCLK_DIV_256 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2 | RCC_CFGR_HPRE_1) /*!< SYSCLK divided by 256 */
  249. #define LL_RCC_SYSCLK_DIV_512 RCC_CFGR_HPRE_3 /*!< SYSCLK divided by 512 */
  250. /**
  251. * @}
  252. */
  253. /** @defgroup RCC_LL_EC_APB1_DIV APB1 prescaler
  254. * @{
  255. */
  256. #define LL_RCC_APB1_DIV_1 0UL /*!< HCLK not divided */
  257. #define LL_RCC_APB1_DIV_2 RCC_CFGR_PPRE1_2 /*!< HCLK divided by 2 */
  258. #define LL_RCC_APB1_DIV_4 (RCC_CFGR_PPRE1_2 | RCC_CFGR_PPRE1_0) /*!< HCLK divided by 4 */
  259. #define LL_RCC_APB1_DIV_8 (RCC_CFGR_PPRE1_2 | RCC_CFGR_PPRE1_1) /*!< HCLK divided by 8 */
  260. #define LL_RCC_APB1_DIV_16 RCC_CFGR_PPRE1 /*!< HCLK divided by 16 */
  261. /**
  262. * @}
  263. */
  264. /** @defgroup RCC_LL_EC_APB2_DIV APB2 prescaler
  265. * @{
  266. */
  267. #define LL_RCC_APB2_DIV_1 0UL /*!< HCLK not divided */
  268. #define LL_RCC_APB2_DIV_2 RCC_CFGR_PPRE2_2 /*!< HCLK divided by 2 */
  269. #define LL_RCC_APB2_DIV_4 (RCC_CFGR_PPRE2_2 | RCC_CFGR_PPRE2_0) /*!< HCLK divided by 4 */
  270. #define LL_RCC_APB2_DIV_8 (RCC_CFGR_PPRE2_2 | RCC_CFGR_PPRE2_1) /*!< HCLK divided by 8 */
  271. #define LL_RCC_APB2_DIV_16 RCC_CFGR_PPRE2 /*!< HCLK divided by 16 */
  272. /**
  273. * @}
  274. */
  275. /** @defgroup RCC_LL_EC_STOP_WAKEUPCLOCK Wakeup from Stop and CSS backup clock selection
  276. * @{
  277. */
  278. #define LL_RCC_STOP_WAKEUPCLOCK_MSI 0UL /*!< MSI selection after wake-up from STOP */
  279. #define LL_RCC_STOP_WAKEUPCLOCK_HSI RCC_CFGR_STOPWUCK /*!< HSI selection after wake-up from STOP */
  280. /**
  281. * @}
  282. */
  283. /** @defgroup RCC_LL_EC_MCO1SOURCE MCO1 SOURCE selection
  284. * @{
  285. */
  286. #define LL_RCC_MCO1SOURCE_NOCLOCK 0UL /*!< MCO output disabled, no clock on MCO */
  287. #define LL_RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCOSEL_0 /*!< SYSCLK selection as MCO1 source */
  288. #define LL_RCC_MCO1SOURCE_MSI RCC_CFGR_MCOSEL_1 /*!< MSI selection as MCO1 source */
  289. #define LL_RCC_MCO1SOURCE_HSI (RCC_CFGR_MCOSEL_0| RCC_CFGR_MCOSEL_1) /*!< HSI16 selection as MCO1 source */
  290. #define LL_RCC_MCO1SOURCE_HSE RCC_CFGR_MCOSEL_2 /*!< HSE selection as MCO1 source */
  291. #define LL_RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_2) /*!< Main PLL selection as MCO1 source */
  292. #define LL_RCC_MCO1SOURCE_LSI (RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSI selection as MCO1 source */
  293. #define LL_RCC_MCO1SOURCE_LSE (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSE selection as MCO1 source */
  294. #define LL_RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCOSEL_3 /*!< HSI48 selection as MCO1 source */
  295. /**
  296. * @}
  297. */
  298. /** @defgroup RCC_LL_EC_MCO1_DIV MCO1 prescaler
  299. * @{
  300. */
  301. #define LL_RCC_MCO1_DIV_1 0UL /*!< MCO not divided */
  302. #define LL_RCC_MCO1_DIV_2 RCC_CFGR_MCOPRE_0 /*!< MCO divided by 2 */
  303. #define LL_RCC_MCO1_DIV_4 RCC_CFGR_MCOPRE_1 /*!< MCO divided by 4 */
  304. #define LL_RCC_MCO1_DIV_8 (RCC_CFGR_MCOPRE_1 | RCC_CFGR_MCOPRE_0) /*!< MCO divided by 8 */
  305. #define LL_RCC_MCO1_DIV_16 RCC_CFGR_MCOPRE_2 /*!< MCO divided by 16 */
  306. /**
  307. * @}
  308. */
  309. #if defined(USE_FULL_LL_DRIVER)
  310. /** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency
  311. * @{
  312. */
  313. #define LL_RCC_PERIPH_FREQUENCY_NO 0UL /*!< No clock enabled for the peripheral */
  314. #define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFUL /*!< Frequency cannot be provided as external clock */
  315. /**
  316. * @}
  317. */
  318. #endif /* USE_FULL_LL_DRIVER */
  319. /** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection
  320. * @{
  321. */
  322. #define LL_RCC_RTC_CLKSOURCE_NONE 0UL /*!< No clock used as RTC clock */
  323. #define LL_RCC_RTC_CLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */
  324. #define LL_RCC_RTC_CLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */
  325. #define LL_RCC_RTC_CLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 32 used as RTC clock */
  326. /**
  327. * @}
  328. */
  329. /** @defgroup RCC_LL_EC_USART_CLKSOURCE Peripheral USARTx clock source selection
  330. * @{
  331. */
  332. #define LL_RCC_USART1_CLKSOURCE_PCLK2 (RCC_CCIPR1_USART1SEL << 16U) /*!< PCLK2 clock used as USART1 clock source */
  333. #define LL_RCC_USART1_CLKSOURCE_SYSCLK ((RCC_CCIPR1_USART1SEL << 16U) | RCC_CCIPR1_USART1SEL_0) /*!< SYSCLK clock used as USART1 clock source */
  334. #define LL_RCC_USART1_CLKSOURCE_HSI ((RCC_CCIPR1_USART1SEL << 16U) | RCC_CCIPR1_USART1SEL_1) /*!< HSI clock used as USART1 clock source */
  335. #define LL_RCC_USART1_CLKSOURCE_LSE ((RCC_CCIPR1_USART1SEL << 16U) | RCC_CCIPR1_USART1SEL) /*!< LSE clock used as USART1 clock source */
  336. #define LL_RCC_USART2_CLKSOURCE_PCLK1 (RCC_CCIPR1_USART2SEL << 16U) /*!< PCLK1 clock used as USART2 clock source */
  337. #define LL_RCC_USART2_CLKSOURCE_SYSCLK ((RCC_CCIPR1_USART2SEL << 16U) | RCC_CCIPR1_USART2SEL_0) /*!< SYSCLK clock used as USART2 clock source */
  338. #define LL_RCC_USART2_CLKSOURCE_HSI ((RCC_CCIPR1_USART2SEL << 16U) | RCC_CCIPR1_USART2SEL_1) /*!< HSI clock used as USART2 clock source */
  339. #define LL_RCC_USART2_CLKSOURCE_LSE ((RCC_CCIPR1_USART2SEL << 16U) | RCC_CCIPR1_USART2SEL) /*!< LSE clock used as USART2 clock source */
  340. #define LL_RCC_USART3_CLKSOURCE_PCLK1 (RCC_CCIPR1_USART3SEL << 16U) /*!< PCLK1 clock used as USART3 clock source */
  341. #define LL_RCC_USART3_CLKSOURCE_SYSCLK ((RCC_CCIPR1_USART3SEL << 16U) | RCC_CCIPR1_USART3SEL_0) /*!< SYSCLK clock used as USART3 clock source */
  342. #define LL_RCC_USART3_CLKSOURCE_HSI ((RCC_CCIPR1_USART3SEL << 16U) | RCC_CCIPR1_USART3SEL_1) /*!< HSI clock used as USART3 clock source */
  343. #define LL_RCC_USART3_CLKSOURCE_LSE ((RCC_CCIPR1_USART3SEL << 16U) | RCC_CCIPR1_USART3SEL) /*!< LSE clock used as USART3 clock source */
  344. /**
  345. * @}
  346. */
  347. /** @defgroup RCC_LL_EC_UART_CLKSOURCE Peripheral UARTx clock source selection
  348. * @{
  349. */
  350. #define LL_RCC_UART4_CLKSOURCE_PCLK1 (RCC_CCIPR1_UART4SEL << 16U) /*!< PCLK1 clock used as UART4 clock source */
  351. #define LL_RCC_UART4_CLKSOURCE_SYSCLK ((RCC_CCIPR1_UART4SEL << 16U) | RCC_CCIPR1_UART4SEL_0) /*!< SYSCLK clock used as UART4 clock source */
  352. #define LL_RCC_UART4_CLKSOURCE_HSI ((RCC_CCIPR1_UART4SEL << 16U) | RCC_CCIPR1_UART4SEL_1) /*!< HSI clock used as UART4 clock source */
  353. #define LL_RCC_UART4_CLKSOURCE_LSE ((RCC_CCIPR1_UART4SEL << 16U) | RCC_CCIPR1_UART4SEL) /*!< LSE clock used as UART4 clock source */
  354. #define LL_RCC_UART5_CLKSOURCE_PCLK1 (RCC_CCIPR1_UART5SEL << 16U) /*!< PCLK1 clock used as UART5 clock source */
  355. #define LL_RCC_UART5_CLKSOURCE_SYSCLK ((RCC_CCIPR1_UART5SEL << 16U) | RCC_CCIPR1_UART5SEL_0) /*!< SYSCLK clock used as UART5 clock source */
  356. #define LL_RCC_UART5_CLKSOURCE_HSI ((RCC_CCIPR1_UART5SEL << 16U) | RCC_CCIPR1_UART5SEL_1) /*!< HSI clock used as UART5 clock source */
  357. #define LL_RCC_UART5_CLKSOURCE_LSE ((RCC_CCIPR1_UART5SEL << 16U) | RCC_CCIPR1_UART5SEL) /*!< LSE clock used as UART5 clock source */
  358. /**
  359. * @}
  360. */
  361. /** @defgroup RCC_LL_EC_LPUART_CLKSOURCE Peripheral LPUARTx clock source selection
  362. * @{
  363. */
  364. #define LL_RCC_LPUART1_CLKSOURCE_PCLK1 0UL /*!< PCLK1 clock used as LPUART1 clock source */
  365. #define LL_RCC_LPUART1_CLKSOURCE_SYSCLK RCC_CCIPR1_LPUART1SEL_0 /*!< SYSCLK clock used as LPUART1 clock source */
  366. #define LL_RCC_LPUART1_CLKSOURCE_HSI RCC_CCIPR1_LPUART1SEL_1 /*!< HSI clock used as LPUART1 clock source */
  367. #define LL_RCC_LPUART1_CLKSOURCE_LSE RCC_CCIPR1_LPUART1SEL /*!< LSE clock used as LPUART1 clock source */
  368. /**
  369. * @}
  370. */
  371. /** @defgroup RCC_LL_EC_I2C_CLKSOURCE Peripheral I2Cx clock source selection
  372. * @{
  373. */
  374. #define LL_RCC_I2C1_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C1SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C1 clock source */
  375. #define LL_RCC_I2C1_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C1SEL_Pos << 16U) | (RCC_CCIPR1_I2C1SEL_0 >> RCC_CCIPR1_I2C1SEL_Pos)) /*!< SYSCLK clock used as I2C1 clock source */
  376. #define LL_RCC_I2C1_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C1SEL_Pos << 16U) | (RCC_CCIPR1_I2C1SEL_1 >> RCC_CCIPR1_I2C1SEL_Pos)) /*!< HSI clock used as I2C1 clock source */
  377. #define LL_RCC_I2C2_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C2SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C2 clock source */
  378. #define LL_RCC_I2C2_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C2SEL_Pos << 16U) | (RCC_CCIPR1_I2C2SEL_0 >> RCC_CCIPR1_I2C2SEL_Pos)) /*!< SYSCLK clock used as I2C2 clock source */
  379. #define LL_RCC_I2C2_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C2SEL_Pos << 16U) | (RCC_CCIPR1_I2C2SEL_1 >> RCC_CCIPR1_I2C2SEL_Pos)) /*!< HSI clock used as I2C2 clock source */
  380. #define LL_RCC_I2C3_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C3SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C3 clock source */
  381. #define LL_RCC_I2C3_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C3SEL_Pos << 16U) | (RCC_CCIPR1_I2C3SEL_0 >> RCC_CCIPR1_I2C3SEL_Pos)) /*!< SYSCLK clock used as I2C3 clock source */
  382. #define LL_RCC_I2C3_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C3SEL_Pos << 16U) | (RCC_CCIPR1_I2C3SEL_1 >> RCC_CCIPR1_I2C3SEL_Pos)) /*!< HSI clock used as I2C3 clock source */
  383. #define LL_RCC_I2C4_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C4 clock source */
  384. #define LL_RCC_I2C4_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL_0 >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< SYSCLK clock used as I2C4 clock source */
  385. #define LL_RCC_I2C4_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL_1 >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< HSI clock used as I2C4 clock source */
  386. /**
  387. * @}
  388. */
  389. /** @defgroup RCC_LL_EC_LPTIM_CLKSOURCE Peripheral LPTIMx clock source selection
  390. * @{
  391. */
  392. #define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 RCC_CCIPR1_LPTIM1SEL /*!< PCLK1 clock used as LPTIM1 clock source */
  393. #define LL_RCC_LPTIM1_CLKSOURCE_LSI (RCC_CCIPR1_LPTIM1SEL | (RCC_CCIPR1_LPTIM1SEL_0 >> 16U)) /*!< LSI clock used as LPTIM1 clock source */
  394. #define LL_RCC_LPTIM1_CLKSOURCE_HSI (RCC_CCIPR1_LPTIM1SEL | (RCC_CCIPR1_LPTIM1SEL_1 >> 16U)) /*!< HSI clock used as LPTIM1 clock source */
  395. #define LL_RCC_LPTIM1_CLKSOURCE_LSE (RCC_CCIPR1_LPTIM1SEL | (RCC_CCIPR1_LPTIM1SEL >> 16U)) /*!< LSE clock used as LPTIM1 clock source */
  396. #define LL_RCC_LPTIM2_CLKSOURCE_PCLK1 RCC_CCIPR1_LPTIM2SEL /*!< PCLK1 clock used as LPTIM2 clock source */
  397. #define LL_RCC_LPTIM2_CLKSOURCE_LSI (RCC_CCIPR1_LPTIM2SEL | (RCC_CCIPR1_LPTIM2SEL_0 >> 16U)) /*!< LSI clock used as LPTIM2 clock source */
  398. #define LL_RCC_LPTIM2_CLKSOURCE_HSI (RCC_CCIPR1_LPTIM2SEL | (RCC_CCIPR1_LPTIM2SEL_1 >> 16U)) /*!< HSI clock used as LPTIM2 clock source */
  399. #define LL_RCC_LPTIM2_CLKSOURCE_LSE (RCC_CCIPR1_LPTIM2SEL | (RCC_CCIPR1_LPTIM2SEL >> 16U)) /*!< LSE clock used as LPTIM2 clock source */
  400. #define LL_RCC_LPTIM3_CLKSOURCE_PCLK1 RCC_CCIPR1_LPTIM3SEL /*!< PCLK1 clock used as LPTIM3 clock source */
  401. #define LL_RCC_LPTIM3_CLKSOURCE_LSI (RCC_CCIPR1_LPTIM3SEL | (RCC_CCIPR1_LPTIM3SEL_0 >> 16U)) /*!< LSI clock used as LPTIM3 clock source */
  402. #define LL_RCC_LPTIM3_CLKSOURCE_HSI (RCC_CCIPR1_LPTIM3SEL | (RCC_CCIPR1_LPTIM3SEL_1 >> 16U)) /*!< HSI clock used as LPTIM3 clock source */
  403. #define LL_RCC_LPTIM3_CLKSOURCE_LSE (RCC_CCIPR1_LPTIM3SEL | (RCC_CCIPR1_LPTIM3SEL >> 16U)) /*!< LSE clock used as LPTIM3 clock source */
  404. /**
  405. * @}
  406. */
  407. /** @defgroup RCC_LL_EC_FDCAN_CLKSOURCE Peripheral FDCAN kernel clock source selection
  408. * @{
  409. */
  410. #define LL_RCC_FDCAN_CLKSOURCE_HSE 0UL /*!< HSE clock used as FDCAN kernel clock source */
  411. #define LL_RCC_FDCAN_CLKSOURCE_PLL RCC_CCIPR1_FDCANSEL_0 /*!< PLL clock used as FDCAN kernel clock source */
  412. #define LL_RCC_FDCAN_CLKSOURCE_PLLSAI1 RCC_CCIPR1_FDCANSEL_1 /*!< PLLSAI1 clock used as FDCAN kernel clock source */
  413. /**
  414. * @}
  415. */
  416. /** @defgroup RCC_LL_EC_SAI_CLKSOURCE Peripheral SAIx clock source selection
  417. * @{
  418. */
  419. #define LL_RCC_SAI1_CLKSOURCE_PLL (RCC_CCIPR2_SAI1SEL << 16U) /*!< PLL clock used as SAI1 clock source */
  420. #define LL_RCC_SAI1_CLKSOURCE_PLLSAI1 ((RCC_CCIPR2_SAI1SEL << 16U) | RCC_CCIPR2_SAI1SEL_0) /*!< PLLSAI1 clock used as SAI1 clock source */
  421. #define LL_RCC_SAI1_CLKSOURCE_PLLSAI2 ((RCC_CCIPR2_SAI1SEL << 16U) | RCC_CCIPR2_SAI1SEL_1) /*!< PLLSAI2 clock used as SAI1 clock source */
  422. #define LL_RCC_SAI1_CLKSOURCE_HSI ((RCC_CCIPR2_SAI1SEL << 16U) | RCC_CCIPR2_SAI1SEL_2) /*!< HSI clock used as SAI1 clock source */
  423. #define LL_RCC_SAI1_CLKSOURCE_PIN ((RCC_CCIPR2_SAI1SEL << 16U) | (RCC_CCIPR2_SAI1SEL_1 | RCC_CCIPR2_SAI1SEL_0)) /*!< External input clock used as SAI1 clock source */
  424. #define LL_RCC_SAI2_CLKSOURCE_PLL (RCC_CCIPR2_SAI2SEL << 16U) /*!< PLL clock used as SAI2 clock source */
  425. #define LL_RCC_SAI2_CLKSOURCE_PLLSAI1 ((RCC_CCIPR2_SAI2SEL << 16U) | RCC_CCIPR2_SAI2SEL_0) /*!< PLLSAI1 clock used as SAI2 clock source */
  426. #define LL_RCC_SAI2_CLKSOURCE_PLLSAI2 ((RCC_CCIPR2_SAI2SEL << 16U) | RCC_CCIPR2_SAI2SEL_1) /*!< PLLSAI2 clock used as SAI2 clock source */
  427. #define LL_RCC_SAI2_CLKSOURCE_HSI ((RCC_CCIPR2_SAI2SEL << 16U) | RCC_CCIPR2_SAI2SEL_2) /*!< HSI clock used as SAI2 clock source */
  428. #define LL_RCC_SAI2_CLKSOURCE_PIN ((RCC_CCIPR2_SAI2SEL << 16U) | (RCC_CCIPR2_SAI2SEL_1 | RCC_CCIPR2_SAI2SEL_0)) /*!< External input clock used as SAI2 clock source */
  429. /**
  430. * @}
  431. */
  432. /** @defgroup RCC_LL_EC_SDMMC1_KERNELCLKSOURCE Peripheral SDMMC kernel clock source selection
  433. * @{
  434. */
  435. #define LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK 0UL /*!< 48MHz clock from internal multiplexor used as SDMMC1 clock source */
  436. #define LL_RCC_SDMMC1_KERNELCLKSOURCE_PLLP RCC_CCIPR2_SDMMCSEL /*!< PLLP clock (PLLSAI3CLK) used as SDMMC1 clock source */
  437. /**
  438. * @}
  439. */
  440. /** @defgroup RCC_LL_EC_SDMMC1_CLKSOURCE Peripheral SDMMC clock source selection
  441. * @{
  442. */
  443. #define LL_RCC_SDMMC1_CLKSOURCE_HSI48 0UL /*!< HSI48 clock used as SDMMC1 clock source in internal multiplexor */
  444. #define LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1 RCC_CCIPR1_CLK48MSEL_0 /*!< PLLSAI1 clock used as SDMMC1 clock source in internal multiplexor */
  445. #define LL_RCC_SDMMC1_CLKSOURCE_PLL RCC_CCIPR1_CLK48MSEL_1 /*!< PLLQ clock used as SDMMC1 clock source in internal multiplexor */
  446. #define LL_RCC_SDMMC1_CLKSOURCE_MSI RCC_CCIPR1_CLK48MSEL /*!< MSI clock used as SDMMC1 clock source in internal multiplexor */
  447. /**
  448. * @}
  449. */
  450. /** @defgroup RCC_LL_EC_RNG_CLKSOURCE Peripheral RNG clock source selection
  451. * @{
  452. */
  453. #define LL_RCC_RNG_CLKSOURCE_HSI48 0UL /*!< HSI48 clock used as RNG clock source */
  454. #define LL_RCC_RNG_CLKSOURCE_PLLSAI1 RCC_CCIPR1_CLK48MSEL_0 /*!< PLLSAI1 clock used as RNG clock source */
  455. #define LL_RCC_RNG_CLKSOURCE_PLL RCC_CCIPR1_CLK48MSEL_1 /*!< PLL clock used as RNG clock source */
  456. #define LL_RCC_RNG_CLKSOURCE_MSI RCC_CCIPR1_CLK48MSEL /*!< MSI clock used as RNG clock source */
  457. /**
  458. * @}
  459. */
  460. /** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection
  461. * @{
  462. */
  463. #define LL_RCC_USB_CLKSOURCE_HSI48 0UL /*!< HSI48 clock used as USB clock source */
  464. #define LL_RCC_USB_CLKSOURCE_PLLSAI1 RCC_CCIPR1_CLK48MSEL_0 /*!< PLLSAI1 clock used as USB clock source */
  465. #define LL_RCC_USB_CLKSOURCE_PLL RCC_CCIPR1_CLK48MSEL_1 /*!< PLL clock used as USB clock source */
  466. #define LL_RCC_USB_CLKSOURCE_MSI RCC_CCIPR1_CLK48MSEL /*!< MSI clock used as USB clock source */
  467. /**
  468. * @}
  469. */
  470. /** @defgroup RCC_LL_EC_ADC_CLKSOURCE Peripheral ADCx clock source selection
  471. * @{
  472. */
  473. #define LL_RCC_ADC_CLKSOURCE_NONE 0UL /*!< No clock used as ADC clock source */
  474. #define LL_RCC_ADC_CLKSOURCE_PLLSAI1 RCC_CCIPR1_ADCSEL_0 /*!< PLLSAI1 clock used as ADC clock source */
  475. #define LL_RCC_ADC_CLKSOURCE_SYSCLK RCC_CCIPR1_ADCSEL /*!< SYSCLK clock used as ADC clock source */
  476. /**
  477. * @}
  478. */
  479. /** @defgroup RCC_LL_EC_DFSDM_AUDIO_CLKSOURCE Peripheral DFSDMx Audio clock source selection
  480. * @{
  481. */
  482. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1 0UL /*!< SAI1 clock used as DFSDM1 Audio clock */
  483. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI RCC_CCIPR2_ADFSDMSEL_0 /*!< HSI clock used as DFSDM1 Audio clock */
  484. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI RCC_CCIPR2_ADFSDMSEL_1 /*!< MSI clock used as DFSDM1 Audio clock */
  485. /**
  486. * @}
  487. */
  488. /** @defgroup RCC_LL_EC_DFSDM1_CLKSOURCE Peripheral DFSDM1 clock source selection
  489. * @{
  490. */
  491. #define LL_RCC_DFSDM1_CLKSOURCE_PCLK2 0UL /*!< PCLK2 clock used as DFSDM1 clock source */
  492. #define LL_RCC_DFSDM1_CLKSOURCE_SYSCLK RCC_CCIPR2_DFSDMSEL /*!< SYSCLK clock used as DFSDM1 clock source */
  493. /**
  494. * @}
  495. */
  496. /** @defgroup RCC_LL_EC_OCTOSPI_CLKSOURCE Peripheral OCTOSPI kernel clock source selection
  497. * @{
  498. */
  499. #define LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK 0UL /*!< SYSCLK clock used as OctoSPI kernel clock source */
  500. #define LL_RCC_OCTOSPI_CLKSOURCE_MSI RCC_CCIPR2_OSPISEL_0 /*!< MSI clock used as OctoSPI kernel clock source */
  501. #define LL_RCC_OCTOSPI_CLKSOURCE_PLL RCC_CCIPR2_OSPISEL_1 /*!< PLL clock used as OctoSPI kernel clock source */
  502. /**
  503. * @}
  504. */
  505. /** @defgroup RCC_LL_EC_USART Peripheral USARTx get clock source
  506. * @{
  507. */
  508. #define LL_RCC_USART1_CLKSOURCE RCC_CCIPR1_USART1SEL /*!< USART1 Clock source selection */
  509. #define LL_RCC_USART2_CLKSOURCE RCC_CCIPR1_USART2SEL /*!< USART2 Clock source selection */
  510. #define LL_RCC_USART3_CLKSOURCE RCC_CCIPR1_USART3SEL /*!< USART3 Clock source selection */
  511. /**
  512. * @}
  513. */
  514. /** @defgroup RCC_LL_EC_UART Peripheral UARTx get clock source
  515. * @{
  516. */
  517. #define LL_RCC_UART4_CLKSOURCE RCC_CCIPR1_UART4SEL /*!< UART4 Clock source selection */
  518. #define LL_RCC_UART5_CLKSOURCE RCC_CCIPR1_UART5SEL /*!< UART5 Clock source selection */
  519. /**
  520. * @}
  521. */
  522. /** @defgroup RCC_LL_EC_LPUART Peripheral LPUARTx get clock source
  523. * @{
  524. */
  525. #define LL_RCC_LPUART1_CLKSOURCE RCC_CCIPR1_LPUART1SEL /*!< LPUART1 Clock source selection */
  526. /**
  527. * @}
  528. */
  529. /** @defgroup RCC_LL_EC_I2C Peripheral I2Cx get clock source
  530. * @{
  531. */
  532. #define LL_RCC_I2C1_CLKSOURCE ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C1SEL_Pos << 16U) | (RCC_CCIPR1_I2C1SEL >> RCC_CCIPR1_I2C1SEL_Pos)) /*!< I2C1 Clock source selection */
  533. #define LL_RCC_I2C2_CLKSOURCE ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C2SEL_Pos << 16U) | (RCC_CCIPR1_I2C2SEL >> RCC_CCIPR1_I2C2SEL_Pos)) /*!< I2C2 Clock source selection */
  534. #define LL_RCC_I2C3_CLKSOURCE ((RCC_OFFSET_CCIPR1 << 24U) | (RCC_CCIPR1_I2C3SEL_Pos << 16U) | (RCC_CCIPR1_I2C3SEL >> RCC_CCIPR1_I2C3SEL_Pos)) /*!< I2C3 Clock source selection */
  535. #define LL_RCC_I2C4_CLKSOURCE ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< I2C4 Clock source selection */
  536. /**
  537. * @}
  538. */
  539. /** @defgroup RCC_LL_EC_LPTIM Peripheral LPTIMx get clock source
  540. * @{
  541. */
  542. #define LL_RCC_LPTIM1_CLKSOURCE RCC_CCIPR1_LPTIM1SEL /*!< LPTIM1 Clock source selection */
  543. #define LL_RCC_LPTIM2_CLKSOURCE RCC_CCIPR1_LPTIM2SEL /*!< LPTIM2 Clock source selection */
  544. #define LL_RCC_LPTIM3_CLKSOURCE RCC_CCIPR1_LPTIM3SEL /*!< LPTIM3 Clock source selection */
  545. /**
  546. * @}
  547. */
  548. /** @defgroup RCC_LL_EC_SAI Peripheral SAIx get clock source
  549. * @{
  550. */
  551. #define LL_RCC_SAI1_CLKSOURCE RCC_CCIPR2_SAI1SEL /*!< SAI1 Clock source selection */
  552. #define LL_RCC_SAI2_CLKSOURCE RCC_CCIPR2_SAI2SEL /*!< SAI2 Clock source selection */
  553. /**
  554. * @}
  555. */
  556. /** @defgroup RCC_LL_EC_SDMMC_KERNEL Peripheral SDMMC get kernel clock source
  557. * @{
  558. */
  559. #define LL_RCC_SDMMC1_KERNELCLKSOURCE RCC_CCIPR2_SDMMCSEL /*!< SDMMC1 Kernel Clock source selection */
  560. /**
  561. * @}
  562. */
  563. /** @defgroup RCC_LL_EC_SDMMC Peripheral SDMMC get clock source
  564. * @{
  565. */
  566. #define LL_RCC_SDMMC1_CLKSOURCE RCC_CCIPR1_CLK48MSEL /*!< SDMMC1 Clock source selection */
  567. /**
  568. * @}
  569. */
  570. /** @defgroup RCC_LL_EC_RNG Peripheral RNG get clock source
  571. * @{
  572. */
  573. #define LL_RCC_RNG_CLKSOURCE RCC_CCIPR1_CLK48MSEL /*!< RNG Clock source selection */
  574. /**
  575. * @}
  576. */
  577. /** @defgroup RCC_LL_EC_USB Peripheral USB get clock source
  578. * @{
  579. */
  580. #define LL_RCC_USB_CLKSOURCE RCC_CCIPR1_CLK48MSEL /*!< USB Clock source selection */
  581. /**
  582. * @}
  583. */
  584. /** @defgroup RCC_LL_EC_ADC Peripheral ADC get clock source
  585. * @{
  586. */
  587. #define LL_RCC_ADC_CLKSOURCE RCC_CCIPR1_ADCSEL /*!< ADCs Clock source selection */
  588. /**
  589. * @}
  590. */
  591. /** @defgroup RCC_LL_EC_DFSDM_AUDIO Peripheral DFSDM1 Audio get clock source
  592. * @{
  593. */
  594. #define LL_RCC_DFSDM1_AUDIO_CLKSOURCE RCC_CCIPR2_ADFSDMSEL /* DFSDM1 Audio Clock source selection */
  595. /**
  596. * @}
  597. */
  598. /** @defgroup RCC_LL_EC_DFSDM Peripheral DFSDM1 get kernel clock source
  599. * @{
  600. */
  601. #define LL_RCC_DFSDM1_CLKSOURCE RCC_CCIPR2_DFSDMSEL /*!< DFSDM1 Clock source selection */
  602. /**
  603. * @}
  604. */
  605. /** @defgroup RCC_LL_EC_FDCAN Peripheral FDCAN get kernel clock source
  606. * @{
  607. */
  608. #define LL_RCC_FDCAN_CLKSOURCE RCC_CCIPR1_FDCANSEL /*!< FDCAN Kernel Clock source selection */
  609. /**
  610. * @}
  611. */
  612. /** @defgroup RCC_LL_EC_OCTOSPI Peripheral OCTOSPI get clock source
  613. * @{
  614. */
  615. #define LL_RCC_OCTOSPI_CLKSOURCE RCC_CCIPR2_OSPISEL /*!< OctoSPI Clock source selection */
  616. /**
  617. * @}
  618. */
  619. /** @defgroup RCC_LL_EC_PLLSOURCE PLL entry clock source
  620. * @{
  621. */
  622. #define LL_RCC_PLLSOURCE_NONE 0UL /*!< No clock selected as main PLL entry clock source */
  623. #define LL_RCC_PLLSOURCE_MSI RCC_PLLCFGR_PLLSRC_0 /*!< MSI clock selected as main PLL entry clock source */
  624. #define LL_RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_1 /*!< HSI16 clock selected as main PLL entry clock source */
  625. #define LL_RCC_PLLSOURCE_HSE (RCC_PLLCFGR_PLLSRC_1 | RCC_PLLCFGR_PLLSRC_0) /*!< HSE clock selected as main PLL entry clock source */
  626. /**
  627. * @}
  628. */
  629. /** @defgroup RCC_LL_EC_PLLM_DIV PLL division factor
  630. * @{
  631. */
  632. #define LL_RCC_PLLM_DIV_1 0UL /*!< Main PLL division factor for PLLM input by 1 */
  633. #define LL_RCC_PLLM_DIV_2 (RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 2 */
  634. #define LL_RCC_PLLM_DIV_3 (RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 3 */
  635. #define LL_RCC_PLLM_DIV_4 (RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 4 */
  636. #define LL_RCC_PLLM_DIV_5 (RCC_PLLCFGR_PLLM_2) /*!< Main PLL division factor for PLLM input by 5 */
  637. #define LL_RCC_PLLM_DIV_6 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 6 */
  638. #define LL_RCC_PLLM_DIV_7 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 7 */
  639. #define LL_RCC_PLLM_DIV_8 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 8 */
  640. #define LL_RCC_PLLM_DIV_9 (RCC_PLLCFGR_PLLM_3) /*!< Main PLL division factor for PLLM input by 9 */
  641. #define LL_RCC_PLLM_DIV_10 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 10 */
  642. #define LL_RCC_PLLM_DIV_11 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 11 */
  643. #define LL_RCC_PLLM_DIV_12 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 12 */
  644. #define LL_RCC_PLLM_DIV_13 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< Main PLL division factor for PLLM input by 13 */
  645. #define LL_RCC_PLLM_DIV_14 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 14 */
  646. #define LL_RCC_PLLM_DIV_15 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< Main PLL division factor for PLLM input by 15 */
  647. #define LL_RCC_PLLM_DIV_16 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< Main PLL division factor for PLLM input by 16 */
  648. /**
  649. * @}
  650. */
  651. /** @defgroup RCC_LL_EC_PLLR_DIV PLL division factor (PLLR)
  652. * @{
  653. */
  654. #define LL_RCC_PLLR_DIV_2 0UL /*!< Main PLL division factor for PLLCLK (system clock) by 2 */
  655. #define LL_RCC_PLLR_DIV_4 (RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 4 */
  656. #define LL_RCC_PLLR_DIV_6 (RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 6 */
  657. #define LL_RCC_PLLR_DIV_8 (RCC_PLLCFGR_PLLR) /*!< Main PLL division factor for PLLCLK (system clock) by 8 */
  658. /**
  659. * @}
  660. */
  661. /** @defgroup RCC_LL_EC_PLLP_DIV PLL division factor (PLLP)
  662. * @{
  663. */
  664. #define LL_RCC_PLLP_DIV_2 (RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 2 */
  665. #define LL_RCC_PLLP_DIV_3 (RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 3 */
  666. #define LL_RCC_PLLP_DIV_4 (RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 4 */
  667. #define LL_RCC_PLLP_DIV_5 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 5 */
  668. #define LL_RCC_PLLP_DIV_6 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 6 */
  669. #define LL_RCC_PLLP_DIV_7 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 7 */
  670. #define LL_RCC_PLLP_DIV_8 (RCC_PLLCFGR_PLLPDIV_3) /*!< Main PLL division factor for PLLP output by 8 */
  671. #define LL_RCC_PLLP_DIV_9 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 9 */
  672. #define LL_RCC_PLLP_DIV_10 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 10 */
  673. #define LL_RCC_PLLP_DIV_11 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 11 */
  674. #define LL_RCC_PLLP_DIV_12 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 12 */
  675. #define LL_RCC_PLLP_DIV_13 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 13 */
  676. #define LL_RCC_PLLP_DIV_14 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 14 */
  677. #define LL_RCC_PLLP_DIV_15 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 15 */
  678. #define LL_RCC_PLLP_DIV_16 (RCC_PLLCFGR_PLLPDIV_4) /*!< Main PLL division factor for PLLP output by 16 */
  679. #define LL_RCC_PLLP_DIV_17 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 17 */
  680. #define LL_RCC_PLLP_DIV_18 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 18 */
  681. #define LL_RCC_PLLP_DIV_19 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 19 */
  682. #define LL_RCC_PLLP_DIV_20 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 20 */
  683. #define LL_RCC_PLLP_DIV_21 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 21 */
  684. #define LL_RCC_PLLP_DIV_22 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 22 */
  685. #define LL_RCC_PLLP_DIV_23 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 23 */
  686. #define LL_RCC_PLLP_DIV_24 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3) /*!< Main PLL division factor for PLLP output by 24 */
  687. #define LL_RCC_PLLP_DIV_25 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 25 */
  688. #define LL_RCC_PLLP_DIV_26 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 26 */
  689. #define LL_RCC_PLLP_DIV_27 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 27 */
  690. #define LL_RCC_PLLP_DIV_28 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 28 */
  691. #define LL_RCC_PLLP_DIV_29 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 29 */
  692. #define LL_RCC_PLLP_DIV_30 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 30 */
  693. #define LL_RCC_PLLP_DIV_31 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 31 */
  694. /**
  695. * @}
  696. */
  697. /** @defgroup RCC_LL_EC_PLLQ_DIV PLL division factor (PLLQ)
  698. * @{
  699. */
  700. #define LL_RCC_PLLQ_DIV_2 0UL /*!< Main PLL division factor for PLLQ output by 2 */
  701. #define LL_RCC_PLLQ_DIV_4 (RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 4 */
  702. #define LL_RCC_PLLQ_DIV_6 (RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 6 */
  703. #define LL_RCC_PLLQ_DIV_8 (RCC_PLLCFGR_PLLQ) /*!< Main PLL division factor for PLLQ output by 8 */
  704. /**
  705. * @}
  706. */
  707. /** @defgroup RCC_LL_EC_PLLSAI1SOURCE PLLSAI1 entry clock source
  708. * @{
  709. */
  710. #define LL_RCC_PLLSAI1SOURCE_NONE 0UL /*!< No clock selected as PLLSAI1 entry clock source */
  711. #define LL_RCC_PLLSAI1SOURCE_MSI RCC_PLLSAI1CFGR_PLLSAI1SRC_0 /*!< MSI clock selected as PLLSAI1 entry clock source */
  712. #define LL_RCC_PLLSAI1SOURCE_HSI RCC_PLLSAI1CFGR_PLLSAI1SRC_1 /*!< HSI16 clock selected as PLLSAI1 entry clock source */
  713. #define LL_RCC_PLLSAI1SOURCE_HSE (RCC_PLLSAI1CFGR_PLLSAI1SRC_1 | RCC_PLLSAI1CFGR_PLLSAI1SRC_0) /*!< HSE clock selected as PLLSAI1 entry clock source */
  714. /**
  715. * @}
  716. */
  717. /** @defgroup RCC_LL_EC_PLLSAI1M PLLSAI1 division factor (PLLSAI1M)
  718. * @{
  719. */
  720. #define LL_RCC_PLLSAI1M_DIV_1 0UL /*!< PLLSAI1 division factor for PLLSAI1M input by 1 */
  721. #define LL_RCC_PLLSAI1M_DIV_2 (RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 2 */
  722. #define LL_RCC_PLLSAI1M_DIV_3 (RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 3 */
  723. #define LL_RCC_PLLSAI1M_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 4 */
  724. #define LL_RCC_PLLSAI1M_DIV_5 (RCC_PLLSAI1CFGR_PLLSAI1M_2) /*!< PLLSAI1 division factor for PLLSAI1M input by 5 */
  725. #define LL_RCC_PLLSAI1M_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 6 */
  726. #define LL_RCC_PLLSAI1M_DIV_7 (RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 7 */
  727. #define LL_RCC_PLLSAI1M_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 8 */
  728. #define LL_RCC_PLLSAI1M_DIV_9 (RCC_PLLSAI1CFGR_PLLSAI1M_3) /*!< PLLSAI1 division factor for PLLSAI1M input by 9 */
  729. #define LL_RCC_PLLSAI1M_DIV_10 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 10 */
  730. #define LL_RCC_PLLSAI1M_DIV_11 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 11 */
  731. #define LL_RCC_PLLSAI1M_DIV_12 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 12 */
  732. #define LL_RCC_PLLSAI1M_DIV_13 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2) /*!< PLLSAI1 division factor for PLLSAI1M input by 13 */
  733. #define LL_RCC_PLLSAI1M_DIV_14 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 14 */
  734. #define LL_RCC_PLLSAI1M_DIV_15 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1) /*!< PLLSAI1 division factor for PLLSAI1M input by 15 */
  735. #define LL_RCC_PLLSAI1M_DIV_16 (RCC_PLLSAI1CFGR_PLLSAI1M_3|RCC_PLLSAI1CFGR_PLLSAI1M_2|RCC_PLLSAI1CFGR_PLLSAI1M_1|RCC_PLLSAI1CFGR_PLLSAI1M_0) /*!< PLLSAI1 division factor for PLLSAI1M input by 16 */
  736. /**
  737. * @}
  738. */
  739. /** @defgroup RCC_LL_EC_PLLSAI1Q PLLSAI1 division factor (PLLSAI1Q)
  740. * @{
  741. */
  742. #define LL_RCC_PLLSAI1Q_DIV_2 0UL /*!< PLLSAI1 division factor for PLLSAI1Q output by 2 */
  743. #define LL_RCC_PLLSAI1Q_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1Q_0) /*!< PLLSAI1 division factor for PLLSAI1Q output by 4 */
  744. #define LL_RCC_PLLSAI1Q_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1Q_1) /*!< PLLSAI1 division factor for PLLSAI1Q output by 6 */
  745. #define LL_RCC_PLLSAI1Q_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1Q) /*!< PLLSAI1 division factor for PLLSAI1Q output by 8 */
  746. /**
  747. * @}
  748. */
  749. /** @defgroup RCC_LL_EC_PLLSAI1P PLLSAI1 division factor (PLLSAI1P)
  750. * @{
  751. */
  752. #define LL_RCC_PLLSAI1P_DIV_2 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 2 */
  753. #define LL_RCC_PLLSAI1P_DIV_3 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 3 */
  754. #define LL_RCC_PLLSAI1P_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 4 */
  755. #define LL_RCC_PLLSAI1P_DIV_5 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 5 */
  756. #define LL_RCC_PLLSAI1P_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 6 */
  757. #define LL_RCC_PLLSAI1P_DIV_7 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 7 */
  758. #define LL_RCC_PLLSAI1P_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3) /*!< PLLSAI1 division factor for PLLSAI1P output by 8 */
  759. #define LL_RCC_PLLSAI1P_DIV_9 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 9 */
  760. #define LL_RCC_PLLSAI1P_DIV_10 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 10 */
  761. #define LL_RCC_PLLSAI1P_DIV_11 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 1 */
  762. #define LL_RCC_PLLSAI1P_DIV_12 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 12 */
  763. #define LL_RCC_PLLSAI1P_DIV_13 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 13 */
  764. #define LL_RCC_PLLSAI1P_DIV_14 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 14 */
  765. #define LL_RCC_PLLSAI1P_DIV_15 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 15 */
  766. #define LL_RCC_PLLSAI1P_DIV_16 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4) /*!< PLLSAI1 division factor for PLLSAI1P output by 16 */
  767. #define LL_RCC_PLLSAI1P_DIV_17 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 17 */
  768. #define LL_RCC_PLLSAI1P_DIV_18 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 18 */
  769. #define LL_RCC_PLLSAI1P_DIV_19 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 19 */
  770. #define LL_RCC_PLLSAI1P_DIV_20 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 20 */
  771. #define LL_RCC_PLLSAI1P_DIV_21 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division fctor for PLLSAI1P output by 21 */
  772. #define LL_RCC_PLLSAI1P_DIV_22 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 22 */
  773. #define LL_RCC_PLLSAI1P_DIV_23 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 23 */
  774. #define LL_RCC_PLLSAI1P_DIV_24 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3) /*!< PLLSAI1 division factor for PLLSAI1P output by 24 */
  775. #define LL_RCC_PLLSAI1P_DIV_25 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 25 */
  776. #define LL_RCC_PLLSAI1P_DIV_26 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 26 */
  777. #define LL_RCC_PLLSAI1P_DIV_27 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 27 */
  778. #define LL_RCC_PLLSAI1P_DIV_28 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2) /*!< PLLSAI1 division factor for PLLSAI1P output by 28 */
  779. #define LL_RCC_PLLSAI1P_DIV_29 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 29 */
  780. #define LL_RCC_PLLSAI1P_DIV_30 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1) /*!< PLLSAI1 division factor for PLLSAI1P output by 30 */
  781. #define LL_RCC_PLLSAI1P_DIV_31 (RCC_PLLSAI1CFGR_PLLSAI1PDIV_4|RCC_PLLSAI1CFGR_PLLSAI1PDIV_3|RCC_PLLSAI1CFGR_PLLSAI1PDIV_2|RCC_PLLSAI1CFGR_PLLSAI1PDIV_1|RCC_PLLSAI1CFGR_PLLSAI1PDIV_0) /*!< PLLSAI1 division factor for PLLSAI1P output by 31 */
  782. /**
  783. * @}
  784. */
  785. /** @defgroup RCC_LL_EC_PLLSAI1R PLLSAI1 division factor (PLLSAI1R)
  786. * @{
  787. */
  788. #define LL_RCC_PLLSAI1R_DIV_2 0UL /*!< PLLSAI1 division factor for PLLSAI1R output by 2 */
  789. #define LL_RCC_PLLSAI1R_DIV_4 (RCC_PLLSAI1CFGR_PLLSAI1R_0) /*!< PLLSAI1 division factor for PLLSAI1R output by 4 */
  790. #define LL_RCC_PLLSAI1R_DIV_6 (RCC_PLLSAI1CFGR_PLLSAI1R_1) /*!< PLLSAI1 division factor for PLLSAI1R output by 6 */
  791. #define LL_RCC_PLLSAI1R_DIV_8 (RCC_PLLSAI1CFGR_PLLSAI1R) /*!< PLLSAI1 division factor for PLLSAI1R output by 8 */
  792. /**
  793. * @}
  794. */
  795. /** @defgroup RCC_LL_EC_PLLSAI2SOURCE PLLSAI2 entry clock source
  796. * @{
  797. */
  798. #define LL_RCC_PLLSAI2SOURCE_NONE 0UL /*!< No clock selected as PLLSAI2 entry clock source */
  799. #define LL_RCC_PLLSAI2SOURCE_MSI RCC_PLLSAI2CFGR_PLLSAI2SRC_0 /*!< MSI clock selected as PLLSAI2 entry clock source */
  800. #define LL_RCC_PLLSAI2SOURCE_HSI RCC_PLLSAI2CFGR_PLLSAI2SRC_1 /*!< HSI16 clock selected as PLLSAI2 entry clock source */
  801. #define LL_RCC_PLLSAI2SOURCE_HSE (RCC_PLLSAI2CFGR_PLLSAI2SRC_1 | RCC_PLLSAI2CFGR_PLLSAI2SRC_0) /*!< HSE clock selected as PLLSAI2 entry clock source */
  802. /**
  803. * @}
  804. */
  805. /** @defgroup RCC_LL_EC_PLLSAI2M PLLSAI2 division factor (PLLSAI2M)
  806. * @{
  807. */
  808. #define LL_RCC_PLLSAI2M_DIV_1 0UL /*!< PLLSAI2 division factor for PLLSAI2M input by 1 */
  809. #define LL_RCC_PLLSAI2M_DIV_2 (RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 2 */
  810. #define LL_RCC_PLLSAI2M_DIV_3 (RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 3 */
  811. #define LL_RCC_PLLSAI2M_DIV_4 (RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 4 */
  812. #define LL_RCC_PLLSAI2M_DIV_5 (RCC_PLLSAI2CFGR_PLLSAI2M_2) /*!< PLLSAI2 division factor for PLLSAI2M input by 5 */
  813. #define LL_RCC_PLLSAI2M_DIV_6 (RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 6 */
  814. #define LL_RCC_PLLSAI2M_DIV_7 (RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 7 */
  815. #define LL_RCC_PLLSAI2M_DIV_8 (RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 8 */
  816. #define LL_RCC_PLLSAI2M_DIV_9 (RCC_PLLSAI2CFGR_PLLSAI2M_3) /*!< PLLSAI2 division factor for PLLSAI2M input by 9 */
  817. #define LL_RCC_PLLSAI2M_DIV_10 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 10 */
  818. #define LL_RCC_PLLSAI2M_DIV_11 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 11 */
  819. #define LL_RCC_PLLSAI2M_DIV_12 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 12 */
  820. #define LL_RCC_PLLSAI2M_DIV_13 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2) /*!< PLLSAI2 division factor for PLLSAI2M input by 13 */
  821. #define LL_RCC_PLLSAI2M_DIV_14 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 14 */
  822. #define LL_RCC_PLLSAI2M_DIV_15 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1) /*!< PLLSAI2 division factor for PLLSAI2M input by 15 */
  823. #define LL_RCC_PLLSAI2M_DIV_16 (RCC_PLLSAI2CFGR_PLLSAI2M_3|RCC_PLLSAI2CFGR_PLLSAI2M_2|RCC_PLLSAI2CFGR_PLLSAI2M_1|RCC_PLLSAI2CFGR_PLLSAI2M_0) /*!< PLLSAI2 division factor for PLLSAI2M input by 16 */
  824. /**
  825. * @}
  826. */
  827. /** @defgroup RCC_LL_EC_PLLSAI2P PLLSAI2 division factor (PLLSAI2P)
  828. * @{
  829. */
  830. #define LL_RCC_PLLSAI2P_DIV_2 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 2 */
  831. #define LL_RCC_PLLSAI2P_DIV_3 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 3 */
  832. #define LL_RCC_PLLSAI2P_DIV_4 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 4 */
  833. #define LL_RCC_PLLSAI2P_DIV_5 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 5 */
  834. #define LL_RCC_PLLSAI2P_DIV_6 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 6 */
  835. #define LL_RCC_PLLSAI2P_DIV_7 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 7 */
  836. #define LL_RCC_PLLSAI2P_DIV_8 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3) /*!< PLLSAI2 division factor for PLLSAI2P output by 8 */
  837. #define LL_RCC_PLLSAI2P_DIV_9 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 9 */
  838. #define LL_RCC_PLLSAI2P_DIV_10 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 10 */
  839. #define LL_RCC_PLLSAI2P_DIV_11 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 1 */
  840. #define LL_RCC_PLLSAI2P_DIV_12 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 12 */
  841. #define LL_RCC_PLLSAI2P_DIV_13 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 13 */
  842. #define LL_RCC_PLLSAI2P_DIV_14 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 14 */
  843. #define LL_RCC_PLLSAI2P_DIV_15 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 15 */
  844. #define LL_RCC_PLLSAI2P_DIV_16 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4) /*!< PLLSAI2 division factor for PLLSAI2P output by 16 */
  845. #define LL_RCC_PLLSAI2P_DIV_17 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 17 */
  846. #define LL_RCC_PLLSAI2P_DIV_18 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 18 */
  847. #define LL_RCC_PLLSAI2P_DIV_19 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 19 */
  848. #define LL_RCC_PLLSAI2P_DIV_20 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 20 */
  849. #define LL_RCC_PLLSAI2P_DIV_21 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division fctor for PLLSAI2P output by 21 */
  850. #define LL_RCC_PLLSAI2P_DIV_22 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 22 */
  851. #define LL_RCC_PLLSAI2P_DIV_23 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 23 */
  852. #define LL_RCC_PLLSAI2P_DIV_24 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3) /*!< PLLSAI2 division factor for PLLSAI2P output by 24 */
  853. #define LL_RCC_PLLSAI2P_DIV_25 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 25 */
  854. #define LL_RCC_PLLSAI2P_DIV_26 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 26 */
  855. #define LL_RCC_PLLSAI2P_DIV_27 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 27 */
  856. #define LL_RCC_PLLSAI2P_DIV_28 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2) /*!< PLLSAI2 division factor for PLLSAI2P output by 28 */
  857. #define LL_RCC_PLLSAI2P_DIV_29 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 29 */
  858. #define LL_RCC_PLLSAI2P_DIV_30 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1) /*!< PLLSAI2 division factor for PLLSAI2P output by 30 */
  859. #define LL_RCC_PLLSAI2P_DIV_31 (RCC_PLLSAI2CFGR_PLLSAI2PDIV_4|RCC_PLLSAI2CFGR_PLLSAI2PDIV_3|RCC_PLLSAI2CFGR_PLLSAI2PDIV_2|RCC_PLLSAI2CFGR_PLLSAI2PDIV_1|RCC_PLLSAI2CFGR_PLLSAI2PDIV_0) /*!< PLLSAI2 division factor for PLLSAI2P output by 31 */
  860. /**
  861. * @}
  862. */
  863. /** @defgroup RCC_LL_EC_MSIRANGESEL MSI clock range selection
  864. * @{
  865. */
  866. #define LL_RCC_MSIRANGESEL_STANDBY 0U /*!< MSI Range is provided by MSISRANGE */
  867. #define LL_RCC_MSIRANGESEL_RUN 1U /*!< MSI Range is provided by MSIRANGE */
  868. /**
  869. * @}
  870. */
  871. /** @defgroup RCC_LL_EC_SECURE_ATTRIBUTES Secure attributes
  872. * @note Only available when system implements security (TZEN=1)
  873. * @{
  874. */
  875. #define LL_RCC_ALL_SEC RCC_SECURE_MASK /*!< Security on all RCC resources */
  876. #define LL_RCC_ALL_NSEC 0U /*!< No security on RCC resources (default) */
  877. #define LL_RCC_HSI_SEC RCC_SECCFGR_HSISEC /*!< HSI clock configuration secure-only access */
  878. #define LL_RCC_HSI_NSEC 0U /*!< HSI clock configuration secure/non-secure access */
  879. #define LL_RCC_HSE_SEC RCC_SECCFGR_HSESEC /*!< HSE clock configuration secure-only access */
  880. #define LL_RCC_HSE_NSEC 0U /*!< HSE clock configuration secure/non-secure access */
  881. #define LL_RCC_MSI_SEC RCC_SECCFGR_MSISEC /*!< MSI clock configuration secure-only access */
  882. #define LL_RCC_MSI_NSEC 0U /*!< MSI clock configuration secure/non-secure access */
  883. #define LL_RCC_LSI_SEC RCC_SECCFGR_LSISEC /*!< LSI clock configuration secure-only access */
  884. #define LL_RCC_LSI_NSEC 0U /*!< LSI clock configuration secure/non-secure access */
  885. #define LL_RCC_LSE_SEC RCC_SECCFGR_LSESEC /*!< LSE clock configuration secure-only access */
  886. #define LL_RCC_LSE_NSEC 0U /*!< LSE clock configuration secure/non-secure access */
  887. #define LL_RCC_SYSCLK_SEC RCC_SECCFGR_SYSCLKSEC /*!< SYSCLK clock; STOPWUCK and MCO output configuration secure-only access */
  888. #define LL_RCC_SYSCLK_NSEC 0U /*!< SYSCLK clock; STOPWUCK and MCO output configuration secure/non-secure access */
  889. #define LL_RCC_PRESCALERS_SEC RCC_SECCFGR_PRESCSEC /*!< AHBx/APBx prescaler configuration secure-only access */
  890. #define LL_RCC_PRESCALERS_NSEC 0U /*!< AHBx/APBx prescaler configuration secure/non-secure access */
  891. #define LL_RCC_PLL_SEC RCC_SECCFGR_PLLSEC /*!< main PLL clock configuration secure-only access */
  892. #define LL_RCC_PLL_NSEC 0U /*!< main PLL clock configuration secure/non-secure access */
  893. #define LL_RCC_PLLSAI1_SEC RCC_SECCFGR_PLLSAI1SEC /*!< PLLSAI1 clock configuration secure-only access */
  894. #define LL_RCC_PLLSAI1_NSEC 0U /*!< PLLSAI1 clock configuration secure/non-secure access */
  895. #define LL_RCC_PLLSAI2_SEC RCC_SECCFGR_PLLSAI2SEC /*!< PLLSAI2 clock configuration secure-only access */
  896. #define LL_RCC_PLLSAI2_NSEC 0U /*!< PLLSAI2 clock configuration secure/non-secure access */
  897. #define LL_RCC_CLK48M_SEC RCC_SECCFGR_CLK48MSEC /*!< 48MHz clock source selection secure-only access */
  898. #define LL_RCC_CLK48M_NSEC 0U /*!< 48MHz clock source selection secure/non-secure access */
  899. #define LL_RCC_HSI48_SEC RCC_SECCFGR_HSI48SEC /*!< HSI48 clock configuration secure-only access */
  900. #define LL_RCC_HSI48_NSEC 0U /*!< HSI48 clock configuration secure/non-secure access */
  901. #define LL_RCC_RESET_FLAGS_SEC RCC_SECCFGR_RMVFSEC /*!< Remove reset flag secure-ony access */
  902. #define LL_RCC_RESET_FLAGS_NSEC 0U /*!< Remove reset flag secure/non-secure access */
  903. /**
  904. * @}
  905. */
  906. /**
  907. * @}
  908. */
  909. /* Exported macro ------------------------------------------------------------*/
  910. /** @defgroup RCC_LL_Exported_Macros RCC Exported Macros
  911. * @{
  912. */
  913. /** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros
  914. * @{
  915. */
  916. /**
  917. * @brief Write a value in RCC register
  918. * @param __REG__ Register to be written
  919. * @param __VALUE__ Value to be written in the register
  920. * @retval None
  921. */
  922. #define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, (__VALUE__))
  923. /**
  924. * @brief Read a value in RCC register
  925. * @param __REG__ Register to be read
  926. * @retval Register value
  927. */
  928. #define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__)
  929. /**
  930. * @}
  931. */
  932. /** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies
  933. * @{
  934. */
  935. /**
  936. * @brief Helper macro to calculate the PLLCLK frequency on system domain
  937. * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  938. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ());
  939. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  940. * @param __PLLM__ This parameter can be one of the following values:
  941. * @arg @ref LL_RCC_PLLM_DIV_1
  942. * @arg @ref LL_RCC_PLLM_DIV_2
  943. * @arg @ref LL_RCC_PLLM_DIV_3
  944. * @arg @ref LL_RCC_PLLM_DIV_4
  945. * @arg @ref LL_RCC_PLLM_DIV_5
  946. * @arg @ref LL_RCC_PLLM_DIV_6
  947. * @arg @ref LL_RCC_PLLM_DIV_7
  948. * @arg @ref LL_RCC_PLLM_DIV_8
  949. * @arg @ref LL_RCC_PLLM_DIV_9
  950. * @arg @ref LL_RCC_PLLM_DIV_10
  951. * @arg @ref LL_RCC_PLLM_DIV_11
  952. * @arg @ref LL_RCC_PLLM_DIV_12
  953. * @arg @ref LL_RCC_PLLM_DIV_13
  954. * @arg @ref LL_RCC_PLLM_DIV_14
  955. * @arg @ref LL_RCC_PLLM_DIV_15
  956. * @arg @ref LL_RCC_PLLM_DIV_16
  957. * @param __PLLN__ Between 8 and 86
  958. * @param __PLLR__ This parameter can be one of the following values:
  959. * @arg @ref LL_RCC_PLLR_DIV_2
  960. * @arg @ref LL_RCC_PLLR_DIV_4
  961. * @arg @ref LL_RCC_PLLR_DIV_6
  962. * @arg @ref LL_RCC_PLLR_DIV_8
  963. * @retval PLL clock frequency (in Hz)
  964. */
  965. #define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) \
  966. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  967. ((((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos) + 1U) * 2U))
  968. /**
  969. * @brief Helper macro to calculate the PLLCLK frequency used on SAI domain
  970. * @note ex: @ref __LL_RCC_CALC_PLLCLK_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  971. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
  972. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  973. * @param __PLLM__ This parameter can be one of the following values:
  974. * @arg @ref LL_RCC_PLLM_DIV_1
  975. * @arg @ref LL_RCC_PLLM_DIV_2
  976. * @arg @ref LL_RCC_PLLM_DIV_3
  977. * @arg @ref LL_RCC_PLLM_DIV_4
  978. * @arg @ref LL_RCC_PLLM_DIV_5
  979. * @arg @ref LL_RCC_PLLM_DIV_6
  980. * @arg @ref LL_RCC_PLLM_DIV_7
  981. * @arg @ref LL_RCC_PLLM_DIV_8
  982. * @arg @ref LL_RCC_PLLM_DIV_9
  983. * @arg @ref LL_RCC_PLLM_DIV_10
  984. * @arg @ref LL_RCC_PLLM_DIV_11
  985. * @arg @ref LL_RCC_PLLM_DIV_12
  986. * @arg @ref LL_RCC_PLLM_DIV_13
  987. * @arg @ref LL_RCC_PLLM_DIV_14
  988. * @arg @ref LL_RCC_PLLM_DIV_15
  989. * @arg @ref LL_RCC_PLLM_DIV_16
  990. * @param __PLLN__ Between 8 and 86
  991. * @param __PLLP__ This parameter can be one of the following values:
  992. * @arg @ref LL_RCC_PLLP_DIV_2
  993. * @arg @ref LL_RCC_PLLP_DIV_3
  994. * @arg @ref LL_RCC_PLLP_DIV_4
  995. * @arg @ref LL_RCC_PLLP_DIV_5
  996. * @arg @ref LL_RCC_PLLP_DIV_6
  997. * @arg @ref LL_RCC_PLLP_DIV_7
  998. * @arg @ref LL_RCC_PLLP_DIV_8
  999. * @arg @ref LL_RCC_PLLP_DIV_9
  1000. * @arg @ref LL_RCC_PLLP_DIV_10
  1001. * @arg @ref LL_RCC_PLLP_DIV_11
  1002. * @arg @ref LL_RCC_PLLP_DIV_12
  1003. * @arg @ref LL_RCC_PLLP_DIV_13
  1004. * @arg @ref LL_RCC_PLLP_DIV_14
  1005. * @arg @ref LL_RCC_PLLP_DIV_15
  1006. * @arg @ref LL_RCC_PLLP_DIV_16
  1007. * @arg @ref LL_RCC_PLLP_DIV_17
  1008. * @arg @ref LL_RCC_PLLP_DIV_18
  1009. * @arg @ref LL_RCC_PLLP_DIV_19
  1010. * @arg @ref LL_RCC_PLLP_DIV_20
  1011. * @arg @ref LL_RCC_PLLP_DIV_21
  1012. * @arg @ref LL_RCC_PLLP_DIV_22
  1013. * @arg @ref LL_RCC_PLLP_DIV_23
  1014. * @arg @ref LL_RCC_PLLP_DIV_24
  1015. * @arg @ref LL_RCC_PLLP_DIV_25
  1016. * @arg @ref LL_RCC_PLLP_DIV_26
  1017. * @arg @ref LL_RCC_PLLP_DIV_27
  1018. * @arg @ref LL_RCC_PLLP_DIV_28
  1019. * @arg @ref LL_RCC_PLLP_DIV_29
  1020. * @arg @ref LL_RCC_PLLP_DIV_30
  1021. * @arg @ref LL_RCC_PLLP_DIV_31
  1022. * @retval PLL clock frequency (in Hz)
  1023. */
  1024. #define __LL_RCC_CALC_PLLCLK_SAI_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) \
  1025. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  1026. ((__PLLP__) >> RCC_PLLCFGR_PLLPDIV_Pos))
  1027. /**
  1028. * @brief Helper macro to calculate the PLLCLK frequency used on 48M domain
  1029. * @note ex: @ref __LL_RCC_CALC_PLLCLK_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1030. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  1031. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1032. * @param __PLLM__ This parameter can be one of the following values:
  1033. * @arg @ref LL_RCC_PLLM_DIV_1
  1034. * @arg @ref LL_RCC_PLLM_DIV_2
  1035. * @arg @ref LL_RCC_PLLM_DIV_3
  1036. * @arg @ref LL_RCC_PLLM_DIV_4
  1037. * @arg @ref LL_RCC_PLLM_DIV_5
  1038. * @arg @ref LL_RCC_PLLM_DIV_6
  1039. * @arg @ref LL_RCC_PLLM_DIV_7
  1040. * @arg @ref LL_RCC_PLLM_DIV_8
  1041. * @arg @ref LL_RCC_PLLM_DIV_9
  1042. * @arg @ref LL_RCC_PLLM_DIV_10
  1043. * @arg @ref LL_RCC_PLLM_DIV_11
  1044. * @arg @ref LL_RCC_PLLM_DIV_12
  1045. * @arg @ref LL_RCC_PLLM_DIV_13
  1046. * @arg @ref LL_RCC_PLLM_DIV_14
  1047. * @arg @ref LL_RCC_PLLM_DIV_15
  1048. * @arg @ref LL_RCC_PLLM_DIV_16
  1049. * @param __PLLN__ Between 8 and 86
  1050. * @param __PLLQ__ This parameter can be one of the following values:
  1051. * @arg @ref LL_RCC_PLLQ_DIV_2
  1052. * @arg @ref LL_RCC_PLLQ_DIV_4
  1053. * @arg @ref LL_RCC_PLLQ_DIV_6
  1054. * @arg @ref LL_RCC_PLLQ_DIV_8
  1055. * @retval PLL clock frequency (in Hz)
  1056. */
  1057. #define __LL_RCC_CALC_PLLCLK_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) \
  1058. ((__INPUTFREQ__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) * (__PLLN__) / \
  1059. ((((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U) << 1U))
  1060. /**
  1061. * @brief Helper macro to calculate the PLLSAI1 frequency used for SAI domain
  1062. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI1_GetDivider (),
  1063. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetP ());
  1064. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1065. * @param __PLLSAI1M__ This parameter can be one of the following values:
  1066. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  1067. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  1068. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  1069. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  1070. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  1071. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  1072. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  1073. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  1074. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  1075. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  1076. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  1077. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  1078. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  1079. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  1080. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  1081. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  1082. * @param __PLLSAI1N__ Between 8 and 86
  1083. * @param __PLLSAI1P__ This parameter can be one of the following values:
  1084. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  1085. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  1086. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  1087. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  1088. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  1089. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  1090. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  1091. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  1092. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  1093. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  1094. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  1095. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  1096. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  1097. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  1098. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  1099. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  1100. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  1101. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  1102. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  1103. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  1104. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  1105. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  1106. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  1107. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  1108. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  1109. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  1110. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  1111. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  1112. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  1113. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  1114. * @retval PLLSAI1 clock frequency (in Hz)
  1115. */
  1116. #define __LL_RCC_CALC_PLLSAI1_SAI_FREQ(__INPUTFREQ__, __PLLSAI1M__, __PLLSAI1N__, __PLLSAI1P__) \
  1117. ((__INPUTFREQ__) / ((((__PLLSAI1M__) >> RCC_PLLSAI1CFGR_PLLSAI1M_Pos) + 1U)) * (__PLLSAI1N__) / \
  1118. ((__PLLSAI1P__) >> RCC_PLLSAI1CFGR_PLLSAI1PDIV_Pos))
  1119. /**
  1120. * @brief Helper macro to calculate the PLLSAI1 frequency used on 48M domain
  1121. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI1_GetDivider (),
  1122. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetQ ());
  1123. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1124. * @param __PLLSAI1M__ This parameter can be one of the following values:
  1125. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  1126. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  1127. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  1128. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  1129. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  1130. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  1131. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  1132. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  1133. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  1134. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  1135. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  1136. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  1137. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  1138. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  1139. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  1140. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  1141. * @param __PLLSAI1N__ Between 8 and 86
  1142. * @param __PLLSAI1Q__ This parameter can be one of the following values:
  1143. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  1144. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  1145. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  1146. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  1147. * @retval PLLSAI1 clock frequency (in Hz)
  1148. */
  1149. #define __LL_RCC_CALC_PLLSAI1_48M_FREQ(__INPUTFREQ__, __PLLSAI1M__, __PLLSAI1N__, __PLLSAI1Q__) \
  1150. ((__INPUTFREQ__) / ((((__PLLSAI1M__) >> RCC_PLLSAI1CFGR_PLLSAI1M_Pos) + 1U)) * (__PLLSAI1N__) / \
  1151. ((((__PLLSAI1Q__) >> RCC_PLLSAI1CFGR_PLLSAI1Q_Pos) + 1U) << 1U))
  1152. /**
  1153. * @brief Helper macro to calculate the PLLSAI1 frequency used on ADC domain
  1154. * @note ex: @ref __LL_RCC_CALC_PLLSAI1_ADC_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI1_GetDivider (),
  1155. * @ref LL_RCC_PLLSAI1_GetN (), @ref LL_RCC_PLLSAI1_GetR ());
  1156. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1157. * @param __PLLSAI1M__ This parameter can be one of the following values:
  1158. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  1159. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  1160. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  1161. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  1162. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  1163. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  1164. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  1165. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  1166. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  1167. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  1168. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  1169. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  1170. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  1171. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  1172. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  1173. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  1174. * @param __PLLSAI1N__ Between 8 and 86
  1175. * @param __PLLSAI1R__ This parameter can be one of the following values:
  1176. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  1177. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  1178. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  1179. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  1180. * @retval PLLSAI1 clock frequency (in Hz)
  1181. */
  1182. #define __LL_RCC_CALC_PLLSAI1_ADC_FREQ(__INPUTFREQ__, __PLLSAI1M__, __PLLSAI1N__, __PLLSAI1R__) \
  1183. ((__INPUTFREQ__) / ((((__PLLSAI1M__) >> RCC_PLLSAI1CFGR_PLLSAI1M_Pos) + 1U)) * (__PLLSAI1N__) / \
  1184. ((((__PLLSAI1R__) >> RCC_PLLSAI1CFGR_PLLSAI1R_Pos) + 1U) << 1U))
  1185. /**
  1186. * @brief Helper macro to calculate the PLLSAI2 frequency used for SAI domain
  1187. * @note ex: @ref __LL_RCC_CALC_PLLSAI2_SAI_FREQ (HSE_VALUE,@ref LL_RCC_PLLSAI2_GetDivider (),
  1188. * @ref LL_RCC_PLLSAI2_GetN (), @ref LL_RCC_PLLSAI2_GetP ());
  1189. * @param __INPUTFREQ__ PLL Input frequency (based on MSI/HSE/HSI)
  1190. * @param __PLLSAI2M__ This parameter can be one of the following values:
  1191. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  1192. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  1193. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  1194. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  1195. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  1196. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  1197. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  1198. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  1199. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  1200. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  1201. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  1202. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  1203. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  1204. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  1205. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  1206. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  1207. * @param __PLLSAI2N__ Between 8 and 86
  1208. * @param __PLLSAI2P__ This parameter can be one of the following values:
  1209. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  1210. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  1211. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  1212. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  1213. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  1214. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  1215. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  1216. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  1217. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  1218. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  1219. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  1220. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  1221. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  1222. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  1223. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  1224. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  1225. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  1226. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  1227. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  1228. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  1229. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  1230. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  1231. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  1232. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  1233. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  1234. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  1235. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  1236. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  1237. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  1238. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  1239. * @retval PLLSAI2 clock frequency (in Hz)
  1240. */
  1241. #define __LL_RCC_CALC_PLLSAI2_SAI_FREQ(__INPUTFREQ__, __PLLSAI2M__, __PLLSAI2N__, __PLLSAI2P__) \
  1242. ((__INPUTFREQ__) / ((((__PLLSAI2M__) >> RCC_PLLSAI2CFGR_PLLSAI2M_Pos) + 1U)) * (__PLLSAI2N__) / \
  1243. ((__PLLSAI2P__) >> RCC_PLLSAI2CFGR_PLLSAI2PDIV_Pos))
  1244. /**
  1245. * @brief Helper macro to calculate the HCLK frequency
  1246. * @param __SYSCLKFREQ__ SYSCLK frequency (based on MSI/HSE/HSI/PLLCLK)
  1247. * @param __AHBPRESCALER__ This parameter can be one of the following values:
  1248. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1249. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1250. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1251. * @arg @ref LL_RCC_SYSCLK_DIV_8
  1252. * @arg @ref LL_RCC_SYSCLK_DIV_16
  1253. * @arg @ref LL_RCC_SYSCLK_DIV_64
  1254. * @arg @ref LL_RCC_SYSCLK_DIV_128
  1255. * @arg @ref LL_RCC_SYSCLK_DIV_256
  1256. * @arg @ref LL_RCC_SYSCLK_DIV_512
  1257. * @retval HCLK clock frequency (in Hz)
  1258. */
  1259. #define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __AHBPRESCALER__) \
  1260. ((__SYSCLKFREQ__) >> AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos])
  1261. /**
  1262. * @brief Helper macro to calculate the PCLK1 frequency (ABP1)
  1263. * @param __HCLKFREQ__ HCLK frequency
  1264. * @param __APB1PRESCALER__ This parameter can be one of the following values:
  1265. * @arg @ref LL_RCC_APB1_DIV_1
  1266. * @arg @ref LL_RCC_APB1_DIV_2
  1267. * @arg @ref LL_RCC_APB1_DIV_4
  1268. * @arg @ref LL_RCC_APB1_DIV_8
  1269. * @arg @ref LL_RCC_APB1_DIV_16
  1270. * @retval PCLK1 clock frequency (in Hz)
  1271. */
  1272. #define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB1PRESCALER__) >> RCC_CFGR_PPRE1_Pos])
  1273. /**
  1274. * @brief Helper macro to calculate the PCLK2 frequency (ABP2)
  1275. * @param __HCLKFREQ__ HCLK frequency
  1276. * @param __APB2PRESCALER__ This parameter can be one of the following values:
  1277. * @arg @ref LL_RCC_APB2_DIV_1
  1278. * @arg @ref LL_RCC_APB2_DIV_2
  1279. * @arg @ref LL_RCC_APB2_DIV_4
  1280. * @arg @ref LL_RCC_APB2_DIV_8
  1281. * @arg @ref LL_RCC_APB2_DIV_16
  1282. * @retval PCLK2 clock frequency (in Hz)
  1283. */
  1284. #define __LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB2PRESCALER__) >> RCC_CFGR_PPRE2_Pos])
  1285. /**
  1286. * @brief Helper macro to calculate the MSI frequency (in Hz)
  1287. * @note __MSISEL__ can be retrieved thanks to function LL_RCC_MSI_IsEnabledRangeSelect()
  1288. * @note if __MSISEL__ is equal to LL_RCC_MSIRANGESEL_STANDBY,
  1289. * __MSIRANGE__can be retrieved by LL_RCC_MSI_GetRangeAfterStandby()
  1290. * else by LL_RCC_MSI_GetRange()
  1291. * ex: __LL_RCC_CALC_MSI_FREQ(LL_RCC_MSI_IsEnabledRangeSelect(),
  1292. * (LL_RCC_MSI_IsEnabledRangeSelect()?
  1293. * LL_RCC_MSI_GetRange():
  1294. * LL_RCC_MSI_GetRangeAfterStandby()))
  1295. * @param __MSISEL__ This parameter can be one of the following values:
  1296. * @arg @ref LL_RCC_MSIRANGESEL_STANDBY
  1297. * @arg @ref LL_RCC_MSIRANGESEL_RUN
  1298. * @param __MSIRANGE__ This parameter can be one of the following values:
  1299. * @arg @ref LL_RCC_MSIRANGE_0
  1300. * @arg @ref LL_RCC_MSIRANGE_1
  1301. * @arg @ref LL_RCC_MSIRANGE_2
  1302. * @arg @ref LL_RCC_MSIRANGE_3
  1303. * @arg @ref LL_RCC_MSIRANGE_4
  1304. * @arg @ref LL_RCC_MSIRANGE_5
  1305. * @arg @ref LL_RCC_MSIRANGE_6
  1306. * @arg @ref LL_RCC_MSIRANGE_7
  1307. * @arg @ref LL_RCC_MSIRANGE_8
  1308. * @arg @ref LL_RCC_MSIRANGE_9
  1309. * @arg @ref LL_RCC_MSIRANGE_10
  1310. * @arg @ref LL_RCC_MSIRANGE_11
  1311. * @arg @ref LL_RCC_MSISRANGE_4
  1312. * @arg @ref LL_RCC_MSISRANGE_5
  1313. * @arg @ref LL_RCC_MSISRANGE_6
  1314. * @arg @ref LL_RCC_MSISRANGE_7
  1315. * @retval MSI clock frequency (in Hz)
  1316. */
  1317. #define __LL_RCC_CALC_MSI_FREQ(__MSISEL__, __MSIRANGE__) \
  1318. (((__MSISEL__) == LL_RCC_MSIRANGESEL_STANDBY) ? \
  1319. MSIRangeTable[((__MSIRANGE__) >> RCC_CSR_MSISRANGE_Pos) & 0x0FU] : \
  1320. MSIRangeTable[((__MSIRANGE__) >> RCC_CR_MSIRANGE_Pos) & 0x0FU])
  1321. /**
  1322. * @}
  1323. */
  1324. /**
  1325. * @}
  1326. */
  1327. /* Exported functions --------------------------------------------------------*/
  1328. /** @defgroup RCC_LL_Exported_Functions RCC Exported Functions
  1329. * @{
  1330. */
  1331. /** @defgroup RCC_LL_EF_HSE HSE
  1332. * @{
  1333. */
  1334. /**
  1335. * @brief Enable the Clock Security System.
  1336. * @rmtoll CR CSSON LL_RCC_HSE_EnableCSS
  1337. * @retval None
  1338. */
  1339. __STATIC_INLINE void LL_RCC_HSE_EnableCSS(void)
  1340. {
  1341. SET_BIT(RCC->CR, RCC_CR_CSSON);
  1342. }
  1343. /**
  1344. * @brief Enable HSE external oscillator (HSE Bypass)
  1345. * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass
  1346. * @retval None
  1347. */
  1348. __STATIC_INLINE void LL_RCC_HSE_EnableBypass(void)
  1349. {
  1350. SET_BIT(RCC->CR, RCC_CR_HSEBYP);
  1351. }
  1352. /**
  1353. * @brief Disable HSE external oscillator (HSE Bypass)
  1354. * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass
  1355. * @retval None
  1356. */
  1357. __STATIC_INLINE void LL_RCC_HSE_DisableBypass(void)
  1358. {
  1359. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);
  1360. }
  1361. /**
  1362. * @brief Enable HSE crystal oscillator (HSE ON)
  1363. * @rmtoll CR HSEON LL_RCC_HSE_Enable
  1364. * @retval None
  1365. */
  1366. __STATIC_INLINE void LL_RCC_HSE_Enable(void)
  1367. {
  1368. SET_BIT(RCC->CR, RCC_CR_HSEON);
  1369. }
  1370. /**
  1371. * @brief Disable HSE crystal oscillator (HSE ON)
  1372. * @rmtoll CR HSEON LL_RCC_HSE_Disable
  1373. * @retval None
  1374. */
  1375. __STATIC_INLINE void LL_RCC_HSE_Disable(void)
  1376. {
  1377. CLEAR_BIT(RCC->CR, RCC_CR_HSEON);
  1378. }
  1379. /**
  1380. * @brief Check if HSE oscillator Ready
  1381. * @rmtoll CR HSERDY LL_RCC_HSE_IsReady
  1382. * @retval State of bit (1 or 0).
  1383. */
  1384. __STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void)
  1385. {
  1386. return ((READ_BIT(RCC->CR, RCC_CR_HSERDY) == RCC_CR_HSERDY) ? 1UL : 0UL);
  1387. }
  1388. /**
  1389. * @}
  1390. */
  1391. /** @defgroup RCC_LL_EF_HSI HSI
  1392. * @{
  1393. */
  1394. /**
  1395. * @brief Enable HSI even in stop mode
  1396. * @note HSI oscillator is forced ON even in Stop mode
  1397. * @rmtoll CR HSIKERON LL_RCC_HSI_EnableInStopMode
  1398. * @retval None
  1399. */
  1400. __STATIC_INLINE void LL_RCC_HSI_EnableInStopMode(void)
  1401. {
  1402. SET_BIT(RCC->CR, RCC_CR_HSIKERON);
  1403. }
  1404. /**
  1405. * @brief Disable HSI in stop mode
  1406. * @rmtoll CR HSIKERON LL_RCC_HSI_DisableInStopMode
  1407. * @retval None
  1408. */
  1409. __STATIC_INLINE void LL_RCC_HSI_DisableInStopMode(void)
  1410. {
  1411. CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON);
  1412. }
  1413. /**
  1414. * @brief Check if HSI is enabled in stop mode
  1415. * @rmtoll CR HSIKERON LL_RCC_HSI_IsEnabledInStopMode
  1416. * @retval State of bit (1 or 0).
  1417. */
  1418. __STATIC_INLINE uint32_t LL_RCC_HSI_IsEnabledInStopMode(void)
  1419. {
  1420. return ((READ_BIT(RCC->CR, RCC_CR_HSIKERON) == RCC_CR_HSIKERON) ? 1UL : 0UL);
  1421. }
  1422. /**
  1423. * @brief Enable HSI oscillator
  1424. * @rmtoll CR HSION LL_RCC_HSI_Enable
  1425. * @retval None
  1426. */
  1427. __STATIC_INLINE void LL_RCC_HSI_Enable(void)
  1428. {
  1429. SET_BIT(RCC->CR, RCC_CR_HSION);
  1430. }
  1431. /**
  1432. * @brief Disable HSI oscillator
  1433. * @rmtoll CR HSION LL_RCC_HSI_Disable
  1434. * @retval None
  1435. */
  1436. __STATIC_INLINE void LL_RCC_HSI_Disable(void)
  1437. {
  1438. CLEAR_BIT(RCC->CR, RCC_CR_HSION);
  1439. }
  1440. /**
  1441. * @brief Check if HSI clock is ready
  1442. * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady
  1443. * @retval State of bit (1 or 0).
  1444. */
  1445. __STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
  1446. {
  1447. return ((READ_BIT(RCC->CR, RCC_CR_HSIRDY) == RCC_CR_HSIRDY) ? 1UL : 0UL);
  1448. }
  1449. /**
  1450. * @brief Enable HSI Automatic from stop mode
  1451. * @rmtoll CR HSIASFS LL_RCC_HSI_EnableAutoFromStop
  1452. * @retval None
  1453. */
  1454. __STATIC_INLINE void LL_RCC_HSI_EnableAutoFromStop(void)
  1455. {
  1456. SET_BIT(RCC->CR, RCC_CR_HSIASFS);
  1457. }
  1458. /**
  1459. * @brief Disable HSI Automatic from stop mode
  1460. * @rmtoll CR HSIASFS LL_RCC_HSI_DisableAutoFromStop
  1461. * @retval None
  1462. */
  1463. __STATIC_INLINE void LL_RCC_HSI_DisableAutoFromStop(void)
  1464. {
  1465. CLEAR_BIT(RCC->CR, RCC_CR_HSIASFS);
  1466. }
  1467. /**
  1468. * @brief Get HSI Calibration value
  1469. * @note When HSITRIM is written, HSICAL is updated with the sum of
  1470. * HSITRIM and the factory trim value
  1471. * @rmtoll ICSCR HSICAL LL_RCC_HSI_GetCalibration
  1472. * @retval Between Min_Data = 0 and Max_Data = 127
  1473. */
  1474. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void)
  1475. {
  1476. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_HSICAL) >> RCC_ICSCR_HSICAL_Pos);
  1477. }
  1478. /**
  1479. * @brief Set HSI Calibration trimming
  1480. * @note user-programmable trimming value that is added to the HSICAL
  1481. * @note Default value is 64, which, when added to the HSICAL value,
  1482. * should trim the HSI to 16 MHz +/- 1 %
  1483. * @rmtoll ICSCR HSITRIM LL_RCC_HSI_SetCalibTrimming
  1484. * @param Value Between Min_Data = 0 and Max_Data = 127
  1485. * @retval None
  1486. */
  1487. __STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value)
  1488. {
  1489. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, Value << RCC_ICSCR_HSITRIM_Pos);
  1490. }
  1491. /**
  1492. * @brief Get HSI Calibration trimming
  1493. * @rmtoll ICSCR HSITRIM LL_RCC_HSI_GetCalibTrimming
  1494. * @retval Between Min_Data = 0 and Max_Data = 127
  1495. */
  1496. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void)
  1497. {
  1498. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_HSITRIM) >> RCC_ICSCR_HSITRIM_Pos);
  1499. }
  1500. /**
  1501. * @}
  1502. */
  1503. /** @defgroup RCC_LL_EF_HSI48 HSI48
  1504. * @{
  1505. */
  1506. /**
  1507. * @brief Enable HSI48
  1508. * @rmtoll CRRCR HSI48ON LL_RCC_HSI48_Enable
  1509. * @retval None
  1510. */
  1511. __STATIC_INLINE void LL_RCC_HSI48_Enable(void)
  1512. {
  1513. SET_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON);
  1514. }
  1515. /**
  1516. * @brief Disable HSI48
  1517. * @rmtoll CRRCR HSI48ON LL_RCC_HSI48_Disable
  1518. * @retval None
  1519. */
  1520. __STATIC_INLINE void LL_RCC_HSI48_Disable(void)
  1521. {
  1522. CLEAR_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON);
  1523. }
  1524. /**
  1525. * @brief Check if HSI48 oscillator Ready
  1526. * @rmtoll CRRCR HSI48RDY LL_RCC_HSI48_IsReady
  1527. * @retval State of bit (1 or 0).
  1528. */
  1529. __STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
  1530. {
  1531. return ((READ_BIT(RCC->CRRCR, RCC_CRRCR_HSI48RDY) == RCC_CRRCR_HSI48RDY) ? 1UL : 0UL);
  1532. }
  1533. /**
  1534. * @brief Get HSI48 Calibration value
  1535. * @rmtoll CRRCR HSI48CAL LL_RCC_HSI48_GetCalibration
  1536. * @retval Between Min_Data = 0x00 and Max_Data = 0x1FF
  1537. */
  1538. __STATIC_INLINE uint32_t LL_RCC_HSI48_GetCalibration(void)
  1539. {
  1540. return (uint32_t)(READ_BIT(RCC->CRRCR, RCC_CRRCR_HSI48CAL) >> RCC_CRRCR_HSI48CAL_Pos);
  1541. }
  1542. /**
  1543. * @}
  1544. */
  1545. /** @defgroup RCC_LL_EF_LSE LSE
  1546. * @{
  1547. */
  1548. /**
  1549. * @brief Enable Low Speed External (LSE) crystal.
  1550. * @rmtoll BDCR LSEON LL_RCC_LSE_Enable
  1551. * @retval None
  1552. */
  1553. __STATIC_INLINE void LL_RCC_LSE_Enable(void)
  1554. {
  1555. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  1556. }
  1557. /**
  1558. * @brief Disable Low Speed External (LSE) crystal.
  1559. * @rmtoll BDCR LSEON LL_RCC_LSE_Disable
  1560. * @retval None
  1561. */
  1562. __STATIC_INLINE void LL_RCC_LSE_Disable(void)
  1563. {
  1564. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  1565. }
  1566. /**
  1567. * @brief Enable external clock source (LSE bypass).
  1568. * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass
  1569. * @retval None
  1570. */
  1571. __STATIC_INLINE void LL_RCC_LSE_EnableBypass(void)
  1572. {
  1573. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  1574. }
  1575. /**
  1576. * @brief Disable external clock source (LSE bypass).
  1577. * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass
  1578. * @retval None
  1579. */
  1580. __STATIC_INLINE void LL_RCC_LSE_DisableBypass(void)
  1581. {
  1582. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  1583. }
  1584. /**
  1585. * @brief Set LSE oscillator drive capability
  1586. * @note The oscillator is in Xtal mode when it is not in bypass mode.
  1587. * @rmtoll BDCR LSEDRV LL_RCC_LSE_SetDriveCapability
  1588. * @param LSEDrive This parameter can be one of the following values:
  1589. * @arg @ref LL_RCC_LSEDRIVE_LOW
  1590. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  1591. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  1592. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  1593. * @retval None
  1594. */
  1595. __STATIC_INLINE void LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive)
  1596. {
  1597. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, LSEDrive);
  1598. }
  1599. /**
  1600. * @brief Get LSE oscillator drive capability
  1601. * @rmtoll BDCR LSEDRV LL_RCC_LSE_GetDriveCapability
  1602. * @retval Returned value can be one of the following values:
  1603. * @arg @ref LL_RCC_LSEDRIVE_LOW
  1604. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  1605. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  1606. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  1607. */
  1608. __STATIC_INLINE uint32_t LL_RCC_LSE_GetDriveCapability(void)
  1609. {
  1610. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSEDRV));
  1611. }
  1612. /**
  1613. * @brief Enable Clock security system on LSE.
  1614. * @rmtoll BDCR LSECSSON LL_RCC_LSE_EnableCSS
  1615. * @retval None
  1616. */
  1617. __STATIC_INLINE void LL_RCC_LSE_EnableCSS(void)
  1618. {
  1619. SET_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  1620. }
  1621. /**
  1622. * @brief Disable Clock security system on LSE.
  1623. * @note Clock security system can be disabled only after a LSE
  1624. * failure detection. In that case it MUST be disabled by software.
  1625. * @rmtoll BDCR LSECSSON LL_RCC_LSE_DisableCSS
  1626. * @retval None
  1627. */
  1628. __STATIC_INLINE void LL_RCC_LSE_DisableCSS(void)
  1629. {
  1630. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  1631. }
  1632. /**
  1633. * @brief Check if LSE oscillator Ready
  1634. * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady
  1635. * @retval State of bit (1 or 0).
  1636. */
  1637. __STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
  1638. {
  1639. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == RCC_BDCR_LSERDY) ? 1UL : 0UL);
  1640. }
  1641. /**
  1642. * @brief Enable LSE oscillator propagation for system clock
  1643. * @rmtoll BDCR LSESYSEN LL_RCC_LSE_EnablePropagation
  1644. * @retval None
  1645. */
  1646. __STATIC_INLINE void LL_RCC_LSE_EnablePropagation(void)
  1647. {
  1648. SET_BIT(RCC->BDCR, RCC_BDCR_LSESYSEN);
  1649. }
  1650. /**
  1651. * @brief Disable LSE oscillator propagation for system clock
  1652. * @rmtoll BDCR LSESYSEN LL_RCC_LSE_DisablePropagation
  1653. * @retval None
  1654. */
  1655. __STATIC_INLINE void LL_RCC_LSE_DisablePropagation(void)
  1656. {
  1657. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSESYSEN);
  1658. }
  1659. /**
  1660. * @brief Check if LSE oscillator propagation for system clock Ready
  1661. * @rmtoll BDCR LSESYSRDY LL_RCC_LSE_IsPropagationReady
  1662. * @retval State of bit (1 or 0).
  1663. */
  1664. __STATIC_INLINE uint32_t LL_RCC_LSE_IsPropagationReady(void)
  1665. {
  1666. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSESYSRDY) == RCC_BDCR_LSESYSRDY) ? 1UL : 0UL);
  1667. }
  1668. /**
  1669. * @brief Check if CSS on LSE failure Detection
  1670. * @rmtoll BDCR LSECSSD LL_RCC_LSE_IsCSSDetected
  1671. * @retval State of bit (1 or 0).
  1672. */
  1673. __STATIC_INLINE uint32_t LL_RCC_LSE_IsCSSDetected(void)
  1674. {
  1675. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSECSSD) == RCC_BDCR_LSECSSD) ? 1UL : 0UL);
  1676. }
  1677. /**
  1678. * @}
  1679. */
  1680. /** @defgroup RCC_LL_EF_LSI LSI
  1681. * @{
  1682. */
  1683. /**
  1684. * @brief Enable LSI Oscillator
  1685. * @rmtoll CSR LSION LL_RCC_LSI_Enable
  1686. * @retval None
  1687. */
  1688. __STATIC_INLINE void LL_RCC_LSI_Enable(void)
  1689. {
  1690. SET_BIT(RCC->CSR, RCC_CSR_LSION);
  1691. }
  1692. /**
  1693. * @brief Disable LSI Oscillator
  1694. * @rmtoll CSR LSION LL_RCC_LSI_Disable
  1695. * @retval None
  1696. */
  1697. __STATIC_INLINE void LL_RCC_LSI_Disable(void)
  1698. {
  1699. CLEAR_BIT(RCC->CSR, RCC_CSR_LSION);
  1700. }
  1701. /**
  1702. * @brief Check if LSI is Ready
  1703. * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady
  1704. * @retval State of bit (1 or 0).
  1705. */
  1706. __STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void)
  1707. {
  1708. return ((READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == RCC_CSR_LSIRDY) ? 1UL : 0UL);
  1709. }
  1710. /**
  1711. * @brief Set LSI prescaler
  1712. * @rmtoll CSR LSIPRE LL_RCC_LSI_SetPrescaler
  1713. * @param LSIPrescaler This parameter can be one of the following values:
  1714. * @arg @ref LL_RCC_LSI_DIV_1
  1715. * @arg @ref LL_RCC_LSI_DIV_128
  1716. * @retval None
  1717. */
  1718. __STATIC_INLINE void LL_RCC_LSI_SetPrescaler(uint32_t LSIPrescaler)
  1719. {
  1720. MODIFY_REG(RCC->CSR, RCC_CSR_LSIPRE, LSIPrescaler);
  1721. }
  1722. /**
  1723. * @brief Get LSI prescaler
  1724. * @rmtoll CSR LSIPRE LL_RCC_LSI_GetPrescaler
  1725. * @retval Returned value can be one of the following values:
  1726. * @arg @ref LL_RCC_LSI_DIV_1
  1727. * @arg @ref LL_RCC_LSI_DIV_128
  1728. */
  1729. __STATIC_INLINE uint32_t LL_RCC_LSI_GetPrescaler(void)
  1730. {
  1731. return (READ_BIT(RCC->CSR, RCC_CSR_LSIPRE));
  1732. }
  1733. /**
  1734. * @}
  1735. */
  1736. /** @defgroup RCC_LL_EF_MSI MSI
  1737. * @{
  1738. */
  1739. /**
  1740. * @brief Enable MSI oscillator
  1741. * @rmtoll CR MSION LL_RCC_MSI_Enable
  1742. * @retval None
  1743. */
  1744. __STATIC_INLINE void LL_RCC_MSI_Enable(void)
  1745. {
  1746. SET_BIT(RCC->CR, RCC_CR_MSION);
  1747. }
  1748. /**
  1749. * @brief Disable MSI oscillator
  1750. * @rmtoll CR MSION LL_RCC_MSI_Disable
  1751. * @retval None
  1752. */
  1753. __STATIC_INLINE void LL_RCC_MSI_Disable(void)
  1754. {
  1755. CLEAR_BIT(RCC->CR, RCC_CR_MSION);
  1756. }
  1757. /**
  1758. * @brief Check if MSI oscillator Ready
  1759. * @rmtoll CR MSIRDY LL_RCC_MSI_IsReady
  1760. * @retval State of bit (1 or 0).
  1761. */
  1762. __STATIC_INLINE uint32_t LL_RCC_MSI_IsReady(void)
  1763. {
  1764. return ((READ_BIT(RCC->CR, RCC_CR_MSIRDY) == RCC_CR_MSIRDY) ? 1UL : 0UL);
  1765. }
  1766. /**
  1767. * @brief Enable MSI PLL-mode (Hardware auto calibration with LSE)
  1768. * @note MSIPLLEN must be enabled after LSE is enabled (LSEON enabled)
  1769. * and ready (LSERDY set by hardware)
  1770. * @note hardware protection to avoid enabling MSIPLLEN if LSE is not
  1771. * ready
  1772. * @rmtoll CR MSIPLLEN LL_RCC_MSI_EnablePLLMode
  1773. * @retval None
  1774. */
  1775. __STATIC_INLINE void LL_RCC_MSI_EnablePLLMode(void)
  1776. {
  1777. SET_BIT(RCC->CR, RCC_CR_MSIPLLEN);
  1778. }
  1779. /**
  1780. * @brief Disable MSI-PLL mode
  1781. * @note cleared by hardware when LSE is disabled (LSEON = 0) or when
  1782. * the Clock Security System on LSE detects a LSE failure
  1783. * @rmtoll CR MSIPLLEN LL_RCC_MSI_DisablePLLMode
  1784. * @retval None
  1785. */
  1786. __STATIC_INLINE void LL_RCC_MSI_DisablePLLMode(void)
  1787. {
  1788. CLEAR_BIT(RCC->CR, RCC_CR_MSIPLLEN);
  1789. }
  1790. /**
  1791. * @brief Enable MSI clock range selection with MSIRANGE register
  1792. * @note Write 0 has no effect. After a standby or a reset
  1793. * MSIRGSEL is at 0 and the MSI range value is provided by
  1794. * MSISRANGE
  1795. * @rmtoll CR MSIRGSEL LL_RCC_MSI_EnableRangeSelection
  1796. * @retval None
  1797. */
  1798. __STATIC_INLINE void LL_RCC_MSI_EnableRangeSelection(void)
  1799. {
  1800. SET_BIT(RCC->CR, RCC_CR_MSIRGSEL);
  1801. }
  1802. /**
  1803. * @brief Check if MSI clock range is selected with MSIRANGE register
  1804. * @rmtoll CR MSIRGSEL LL_RCC_MSI_IsEnabledRangeSelect
  1805. * @retval State of bit (1 or 0).
  1806. */
  1807. __STATIC_INLINE uint32_t LL_RCC_MSI_IsEnabledRangeSelect(void)
  1808. {
  1809. return ((READ_BIT(RCC->CR, RCC_CR_MSIRGSEL) == RCC_CR_MSIRGSEL) ? 1UL : 0UL);
  1810. }
  1811. /**
  1812. * @brief Configure the Internal Multi Speed oscillator (MSI) clock range in run mode.
  1813. * @rmtoll CR MSIRANGE LL_RCC_MSI_SetRange
  1814. * @param Range This parameter can be one of the following values:
  1815. * @arg @ref LL_RCC_MSIRANGE_0
  1816. * @arg @ref LL_RCC_MSIRANGE_1
  1817. * @arg @ref LL_RCC_MSIRANGE_2
  1818. * @arg @ref LL_RCC_MSIRANGE_3
  1819. * @arg @ref LL_RCC_MSIRANGE_4
  1820. * @arg @ref LL_RCC_MSIRANGE_5
  1821. * @arg @ref LL_RCC_MSIRANGE_6
  1822. * @arg @ref LL_RCC_MSIRANGE_7
  1823. * @arg @ref LL_RCC_MSIRANGE_8
  1824. * @arg @ref LL_RCC_MSIRANGE_9
  1825. * @arg @ref LL_RCC_MSIRANGE_10
  1826. * @arg @ref LL_RCC_MSIRANGE_11
  1827. * @retval None
  1828. */
  1829. __STATIC_INLINE void LL_RCC_MSI_SetRange(uint32_t Range)
  1830. {
  1831. MODIFY_REG(RCC->CR, RCC_CR_MSIRANGE, Range);
  1832. }
  1833. /**
  1834. * @brief Get the Internal Multi Speed oscillator (MSI) clock range in run mode.
  1835. * @rmtoll CR MSIRANGE LL_RCC_MSI_GetRange
  1836. * @retval Returned value can be one of the following values:
  1837. * @arg @ref LL_RCC_MSIRANGE_0
  1838. * @arg @ref LL_RCC_MSIRANGE_1
  1839. * @arg @ref LL_RCC_MSIRANGE_2
  1840. * @arg @ref LL_RCC_MSIRANGE_3
  1841. * @arg @ref LL_RCC_MSIRANGE_4
  1842. * @arg @ref LL_RCC_MSIRANGE_5
  1843. * @arg @ref LL_RCC_MSIRANGE_6
  1844. * @arg @ref LL_RCC_MSIRANGE_7
  1845. * @arg @ref LL_RCC_MSIRANGE_8
  1846. * @arg @ref LL_RCC_MSIRANGE_9
  1847. * @arg @ref LL_RCC_MSIRANGE_10
  1848. * @arg @ref LL_RCC_MSIRANGE_11
  1849. */
  1850. __STATIC_INLINE uint32_t LL_RCC_MSI_GetRange(void)
  1851. {
  1852. return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_MSIRANGE));
  1853. }
  1854. /**
  1855. * @brief Configure MSI range used after standby
  1856. * @rmtoll CSR MSISRANGE LL_RCC_MSI_SetRangeAfterStandby
  1857. * @param Range This parameter can be one of the following values:
  1858. * @arg @ref LL_RCC_MSISRANGE_4
  1859. * @arg @ref LL_RCC_MSISRANGE_5
  1860. * @arg @ref LL_RCC_MSISRANGE_6
  1861. * @arg @ref LL_RCC_MSISRANGE_7
  1862. * @retval None
  1863. */
  1864. __STATIC_INLINE void LL_RCC_MSI_SetRangeAfterStandby(uint32_t Range)
  1865. {
  1866. MODIFY_REG(RCC->CSR, RCC_CSR_MSISRANGE, Range);
  1867. }
  1868. /**
  1869. * @brief Get MSI range used after standby
  1870. * @rmtoll CSR MSISRANGE LL_RCC_MSI_GetRangeAfterStandby
  1871. * @retval Returned value can be one of the following values:
  1872. * @arg @ref LL_RCC_MSISRANGE_4
  1873. * @arg @ref LL_RCC_MSISRANGE_5
  1874. * @arg @ref LL_RCC_MSISRANGE_6
  1875. * @arg @ref LL_RCC_MSISRANGE_7
  1876. */
  1877. __STATIC_INLINE uint32_t LL_RCC_MSI_GetRangeAfterStandby(void)
  1878. {
  1879. return (uint32_t)(READ_BIT(RCC->CSR, RCC_CSR_MSISRANGE));
  1880. }
  1881. /**
  1882. * @brief Get MSI Calibration value
  1883. * @note When MSITRIM is written, MSICAL is updated with the sum of
  1884. * MSITRIM and the factory trim value
  1885. * @rmtoll ICSCR MSICAL LL_RCC_MSI_GetCalibration
  1886. * @retval Between Min_Data = 0 and Max_Data = 255
  1887. */
  1888. __STATIC_INLINE uint32_t LL_RCC_MSI_GetCalibration(void)
  1889. {
  1890. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_MSICAL) >> RCC_ICSCR_MSICAL_Pos);
  1891. }
  1892. /**
  1893. * @brief Set MSI Calibration trimming
  1894. * @note user-programmable trimming value that is added to the MSICAL
  1895. * @rmtoll ICSCR MSITRIM LL_RCC_MSI_SetCalibTrimming
  1896. * @param Value Between Min_Data = 0 and Max_Data = 255
  1897. * @retval None
  1898. */
  1899. __STATIC_INLINE void LL_RCC_MSI_SetCalibTrimming(uint32_t Value)
  1900. {
  1901. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_MSITRIM, Value << RCC_ICSCR_MSITRIM_Pos);
  1902. }
  1903. /**
  1904. * @brief Get MSI Calibration trimming
  1905. * @rmtoll ICSCR MSITRIM LL_RCC_MSI_GetCalibTrimming
  1906. * @retval Between 0 and 255
  1907. */
  1908. __STATIC_INLINE uint32_t LL_RCC_MSI_GetCalibTrimming(void)
  1909. {
  1910. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_MSITRIM) >> RCC_ICSCR_MSITRIM_Pos);
  1911. }
  1912. /**
  1913. * @}
  1914. */
  1915. /** @defgroup RCC_LL_EF_LSCO LSCO
  1916. * @{
  1917. */
  1918. /**
  1919. * @brief Enable Low speed clock
  1920. * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Enable
  1921. * @retval None
  1922. */
  1923. __STATIC_INLINE void LL_RCC_LSCO_Enable(void)
  1924. {
  1925. SET_BIT(RCC->BDCR, RCC_BDCR_LSCOEN);
  1926. }
  1927. /**
  1928. * @brief Disable Low speed clock
  1929. * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Disable
  1930. * @retval None
  1931. */
  1932. __STATIC_INLINE void LL_RCC_LSCO_Disable(void)
  1933. {
  1934. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSCOEN);
  1935. }
  1936. /**
  1937. * @brief Configure Low speed clock selection
  1938. * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_SetSource
  1939. * @param Source This parameter can be one of the following values:
  1940. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
  1941. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
  1942. * @retval None
  1943. */
  1944. __STATIC_INLINE void LL_RCC_LSCO_SetSource(uint32_t Source)
  1945. {
  1946. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSCOSEL, Source);
  1947. }
  1948. /**
  1949. * @brief Get Low speed clock selection
  1950. * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_GetSource
  1951. * @retval Returned value can be one of the following values:
  1952. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
  1953. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
  1954. */
  1955. __STATIC_INLINE uint32_t LL_RCC_LSCO_GetSource(void)
  1956. {
  1957. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSCOSEL));
  1958. }
  1959. /**
  1960. * @}
  1961. */
  1962. /** @defgroup RCC_LL_EF_System System
  1963. * @{
  1964. */
  1965. /**
  1966. * @brief Configure the system clock source
  1967. * @rmtoll CFGR SW LL_RCC_SetSysClkSource
  1968. * @param Source This parameter can be one of the following values:
  1969. * @arg @ref LL_RCC_SYS_CLKSOURCE_MSI
  1970. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI
  1971. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
  1972. * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL
  1973. * @retval None
  1974. */
  1975. __STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source)
  1976. {
  1977. MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source);
  1978. }
  1979. /**
  1980. * @brief Get the system clock source
  1981. * @rmtoll CFGR SWS LL_RCC_GetSysClkSource
  1982. * @retval Returned value can be one of the following values:
  1983. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_MSI
  1984. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
  1985. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
  1986. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL
  1987. */
  1988. __STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void)
  1989. {
  1990. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS));
  1991. }
  1992. /**
  1993. * @brief Set AHB prescaler
  1994. * @rmtoll CFGR HPRE LL_RCC_SetAHBPrescaler
  1995. * @param Prescaler This parameter can be one of the following values:
  1996. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1997. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1998. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1999. * @arg @ref LL_RCC_SYSCLK_DIV_8
  2000. * @arg @ref LL_RCC_SYSCLK_DIV_16
  2001. * @arg @ref LL_RCC_SYSCLK_DIV_64
  2002. * @arg @ref LL_RCC_SYSCLK_DIV_128
  2003. * @arg @ref LL_RCC_SYSCLK_DIV_256
  2004. * @arg @ref LL_RCC_SYSCLK_DIV_512
  2005. * @retval None
  2006. */
  2007. __STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler)
  2008. {
  2009. MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler);
  2010. }
  2011. /**
  2012. * @brief Set APB1 prescaler
  2013. * @rmtoll CFGR PPRE1 LL_RCC_SetAPB1Prescaler
  2014. * @param Prescaler This parameter can be one of the following values:
  2015. * @arg @ref LL_RCC_APB1_DIV_1
  2016. * @arg @ref LL_RCC_APB1_DIV_2
  2017. * @arg @ref LL_RCC_APB1_DIV_4
  2018. * @arg @ref LL_RCC_APB1_DIV_8
  2019. * @arg @ref LL_RCC_APB1_DIV_16
  2020. * @retval None
  2021. */
  2022. __STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)
  2023. {
  2024. MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, Prescaler);
  2025. }
  2026. /**
  2027. * @brief Set APB2 prescaler
  2028. * @rmtoll CFGR PPRE2 LL_RCC_SetAPB2Prescaler
  2029. * @param Prescaler This parameter can be one of the following values:
  2030. * @arg @ref LL_RCC_APB2_DIV_1
  2031. * @arg @ref LL_RCC_APB2_DIV_2
  2032. * @arg @ref LL_RCC_APB2_DIV_4
  2033. * @arg @ref LL_RCC_APB2_DIV_8
  2034. * @arg @ref LL_RCC_APB2_DIV_16
  2035. * @retval None
  2036. */
  2037. __STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler)
  2038. {
  2039. MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, Prescaler);
  2040. }
  2041. /**
  2042. * @brief Get AHB prescaler
  2043. * @rmtoll CFGR HPRE LL_RCC_GetAHBPrescaler
  2044. * @retval Returned value can be one of the following values:
  2045. * @arg @ref LL_RCC_SYSCLK_DIV_1
  2046. * @arg @ref LL_RCC_SYSCLK_DIV_2
  2047. * @arg @ref LL_RCC_SYSCLK_DIV_4
  2048. * @arg @ref LL_RCC_SYSCLK_DIV_8
  2049. * @arg @ref LL_RCC_SYSCLK_DIV_16
  2050. * @arg @ref LL_RCC_SYSCLK_DIV_64
  2051. * @arg @ref LL_RCC_SYSCLK_DIV_128
  2052. * @arg @ref LL_RCC_SYSCLK_DIV_256
  2053. * @arg @ref LL_RCC_SYSCLK_DIV_512
  2054. */
  2055. __STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void)
  2056. {
  2057. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE));
  2058. }
  2059. /**
  2060. * @brief Get APB1 prescaler
  2061. * @rmtoll CFGR PPRE1 LL_RCC_GetAPB1Prescaler
  2062. * @retval Returned value can be one of the following values:
  2063. * @arg @ref LL_RCC_APB1_DIV_1
  2064. * @arg @ref LL_RCC_APB1_DIV_2
  2065. * @arg @ref LL_RCC_APB1_DIV_4
  2066. * @arg @ref LL_RCC_APB1_DIV_8
  2067. * @arg @ref LL_RCC_APB1_DIV_16
  2068. */
  2069. __STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void)
  2070. {
  2071. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE1));
  2072. }
  2073. /**
  2074. * @brief Get APB2 prescaler
  2075. * @rmtoll CFGR PPRE2 LL_RCC_GetAPB2Prescaler
  2076. * @retval Returned value can be one of the following values:
  2077. * @arg @ref LL_RCC_APB2_DIV_1
  2078. * @arg @ref LL_RCC_APB2_DIV_2
  2079. * @arg @ref LL_RCC_APB2_DIV_4
  2080. * @arg @ref LL_RCC_APB2_DIV_8
  2081. * @arg @ref LL_RCC_APB2_DIV_16
  2082. */
  2083. __STATIC_INLINE uint32_t LL_RCC_GetAPB2Prescaler(void)
  2084. {
  2085. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE2));
  2086. }
  2087. /**
  2088. * @brief Set Clock After Wake-Up From Stop mode
  2089. * @rmtoll CFGR STOPWUCK LL_RCC_SetClkAfterWakeFromStop
  2090. * @param Clock This parameter can be one of the following values:
  2091. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_MSI
  2092. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_HSI
  2093. * @retval None
  2094. */
  2095. __STATIC_INLINE void LL_RCC_SetClkAfterWakeFromStop(uint32_t Clock)
  2096. {
  2097. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPWUCK, Clock);
  2098. }
  2099. /**
  2100. * @brief Get Clock After Wake-Up From Stop mode
  2101. * @rmtoll CFGR STOPWUCK LL_RCC_GetClkAfterWakeFromStop
  2102. * @retval Returned value can be one of the following values:
  2103. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_MSI
  2104. * @arg @ref LL_RCC_STOP_WAKEUPCLOCK_HSI
  2105. */
  2106. __STATIC_INLINE uint32_t LL_RCC_GetClkAfterWakeFromStop(void)
  2107. {
  2108. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_STOPWUCK));
  2109. }
  2110. /**
  2111. * @}
  2112. */
  2113. /** @defgroup RCC_LL_EF_MCO MCO
  2114. * @{
  2115. */
  2116. /**
  2117. * @brief Configure MCOx
  2118. * @rmtoll CFGR MCOSEL LL_RCC_ConfigMCO\n
  2119. * CFGR MCOPRE LL_RCC_ConfigMCO
  2120. * @param MCOxSource This parameter can be one of the following values:
  2121. * @arg @ref LL_RCC_MCO1SOURCE_NOCLOCK
  2122. * @arg @ref LL_RCC_MCO1SOURCE_SYSCLK
  2123. * @arg @ref LL_RCC_MCO1SOURCE_MSI
  2124. * @arg @ref LL_RCC_MCO1SOURCE_HSI
  2125. * @arg @ref LL_RCC_MCO1SOURCE_HSE
  2126. * @arg @ref LL_RCC_MCO1SOURCE_HSI48
  2127. * @arg @ref LL_RCC_MCO1SOURCE_PLLCLK
  2128. * @arg @ref LL_RCC_MCO1SOURCE_LSI
  2129. * @arg @ref LL_RCC_MCO1SOURCE_LSE
  2130. * @param MCOxPrescaler This parameter can be one of the following values:
  2131. * @arg @ref LL_RCC_MCO1_DIV_1
  2132. * @arg @ref LL_RCC_MCO1_DIV_2
  2133. * @arg @ref LL_RCC_MCO1_DIV_4
  2134. * @arg @ref LL_RCC_MCO1_DIV_8
  2135. * @arg @ref LL_RCC_MCO1_DIV_16
  2136. * @retval None
  2137. */
  2138. __STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource, uint32_t MCOxPrescaler)
  2139. {
  2140. MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE, MCOxSource | MCOxPrescaler);
  2141. }
  2142. /**
  2143. * @}
  2144. */
  2145. /** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source
  2146. * @{
  2147. */
  2148. /**
  2149. * @brief Configure USARTx clock source
  2150. * @rmtoll CCIPR1 USART1SEL LL_RCC_SetUSARTClockSource\n
  2151. * CCIPR1 USART2SEL LL_RCC_SetUSARTClockSource\n
  2152. * CCIPR1 USART3SEL LL_RCC_SetUSARTClockSource
  2153. * @param USARTxSource This parameter can be one of the following values:
  2154. * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK2
  2155. * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
  2156. * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
  2157. * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
  2158. * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
  2159. * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
  2160. * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
  2161. * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
  2162. * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1
  2163. * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK
  2164. * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI
  2165. * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE
  2166. * @retval None
  2167. */
  2168. __STATIC_INLINE void LL_RCC_SetUSARTClockSource(uint32_t USARTxSource)
  2169. {
  2170. MODIFY_REG(RCC->CCIPR1, (USARTxSource >> 16U), (USARTxSource & 0x0000FFFFU));
  2171. }
  2172. /**
  2173. * @brief Configure UARTx clock source
  2174. * @rmtoll CCIPR1 UART4SEL LL_RCC_SetUARTClockSource\n
  2175. * CCIPR1 UART5SEL LL_RCC_SetUARTClockSource
  2176. * @param UARTxSource This parameter can be one of the following values:
  2177. * @arg @ref LL_RCC_UART4_CLKSOURCE_PCLK1
  2178. * @arg @ref LL_RCC_UART4_CLKSOURCE_SYSCLK
  2179. * @arg @ref LL_RCC_UART4_CLKSOURCE_HSI
  2180. * @arg @ref LL_RCC_UART4_CLKSOURCE_LSE
  2181. * @arg @ref LL_RCC_UART5_CLKSOURCE_PCLK1
  2182. * @arg @ref LL_RCC_UART5_CLKSOURCE_SYSCLK
  2183. * @arg @ref LL_RCC_UART5_CLKSOURCE_HSI
  2184. * @arg @ref LL_RCC_UART5_CLKSOURCE_LSE
  2185. * @retval None
  2186. */
  2187. __STATIC_INLINE void LL_RCC_SetUARTClockSource(uint32_t UARTxSource)
  2188. {
  2189. MODIFY_REG(RCC->CCIPR1, (UARTxSource >> 16U), (UARTxSource & 0x0000FFFFU));
  2190. }
  2191. /**
  2192. * @brief Configure LPUARTx clock source
  2193. * @rmtoll CCIPR1 LPUART1SEL LL_RCC_SetLPUARTClockSource
  2194. * @param LPUARTxSource This parameter can be one of the following values:
  2195. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
  2196. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
  2197. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  2198. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  2199. * @retval None
  2200. */
  2201. __STATIC_INLINE void LL_RCC_SetLPUARTClockSource(uint32_t LPUARTxSource)
  2202. {
  2203. MODIFY_REG(RCC->CCIPR1, RCC_CCIPR1_LPUART1SEL, LPUARTxSource);
  2204. }
  2205. /**
  2206. * @brief Configure I2Cx clock source
  2207. * @rmtoll CCIPR1 I2C1SEL LL_RCC_SetI2CClockSource\n
  2208. * CCIPR1 I2C2SEL LL_RCC_SetI2CClockSource\n
  2209. * CCIPR1 I2C3SEL LL_RCC_SetI2CClockSource\n
  2210. * CCIPR2 I2C4SEL LL_RCC_SetI2CClockSource
  2211. * @param I2CxSource This parameter can be one of the following values:
  2212. * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
  2213. * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
  2214. * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
  2215. * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1
  2216. * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK
  2217. * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI
  2218. * @arg @ref LL_RCC_I2C3_CLKSOURCE_PCLK1
  2219. * @arg @ref LL_RCC_I2C3_CLKSOURCE_SYSCLK
  2220. * @arg @ref LL_RCC_I2C3_CLKSOURCE_HSI
  2221. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK1
  2222. * @arg @ref LL_RCC_I2C4_CLKSOURCE_SYSCLK
  2223. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI
  2224. * @retval None
  2225. */
  2226. __STATIC_INLINE void LL_RCC_SetI2CClockSource(uint32_t I2CxSource)
  2227. {
  2228. __IO uint32_t *reg = (__IO uint32_t *)(uint32_t)(RCC_BASE + 0x88U + (I2CxSource >> 24U));
  2229. MODIFY_REG(*reg, 3U << (((I2CxSource & 0x00FF0000U) >> 16U) & 0x1FU), ((I2CxSource & 0x000000FFU) << (((I2CxSource & 0x00FF0000U) >> 16U) & 0x1FU)));
  2230. }
  2231. /**
  2232. * @brief Configure LPTIMx clock source
  2233. * @rmtoll CCIPR1 LPTIM1SEL LL_RCC_SetLPTIMClockSource\n
  2234. * CCIPR1 LPTIM2SEL LL_RCC_SetLPTIMClockSource\n
  2235. * CCIPR1 LPTIM3SEL LL_RCC_SetLPTIMClockSource
  2236. * @param LPTIMxSource This parameter can be one of the following values:
  2237. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  2238. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  2239. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
  2240. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  2241. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK1
  2242. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  2243. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_HSI
  2244. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  2245. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_PCLK1
  2246. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_LSI
  2247. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_HSI
  2248. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_LSE
  2249. * @retval None
  2250. */
  2251. __STATIC_INLINE void LL_RCC_SetLPTIMClockSource(uint32_t LPTIMxSource)
  2252. {
  2253. MODIFY_REG(RCC->CCIPR1, (LPTIMxSource & 0xFFFF0000U), (LPTIMxSource << 16U));
  2254. }
  2255. /**
  2256. * @brief Configure FDCAN kernel clock source
  2257. * @rmtoll CCIPR1 FDCANSEL LL_RCC_SetFDCANClockSource
  2258. * @param FDCANxSource This parameter can be one of the following values:
  2259. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
  2260. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL
  2261. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLLSAI1
  2262. * @retval None
  2263. */
  2264. __STATIC_INLINE void LL_RCC_SetFDCANClockSource(uint32_t FDCANxSource)
  2265. {
  2266. MODIFY_REG(RCC->CCIPR1, RCC_CCIPR1_FDCANSEL, FDCANxSource);
  2267. }
  2268. /**
  2269. * @brief Configure SAIx clock source
  2270. * @rmtoll CCIPR2 SAI1SEL LL_RCC_SetSAIClockSource\n
  2271. * CCIPR2 SAI2SEL LL_RCC_SetSAIClockSource
  2272. * @param SAIxSource This parameter can be one of the following values:
  2273. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI1
  2274. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI2
  2275. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL
  2276. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN
  2277. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI1
  2278. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI2
  2279. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLL
  2280. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PIN
  2281. * @retval None
  2282. */
  2283. __STATIC_INLINE void LL_RCC_SetSAIClockSource(uint32_t SAIxSource)
  2284. {
  2285. MODIFY_REG(RCC->CCIPR2, (SAIxSource >> 16U), (SAIxSource & 0x0000FFFFU));
  2286. }
  2287. /**
  2288. * @brief Configure SDMMC1 kernel clock source
  2289. * @rmtoll CCIPR2 SDMMCSEL LL_RCC_SetSDMMCKernelClockSource
  2290. * @param SDMMCxSource This parameter can be one of the following values:
  2291. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK
  2292. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_PLLP
  2293. * @retval None
  2294. */
  2295. __STATIC_INLINE void LL_RCC_SetSDMMCKernelClockSource(uint32_t SDMMCxSource)
  2296. {
  2297. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_SDMMCSEL, SDMMCxSource);
  2298. }
  2299. /**
  2300. * @brief Configure SDMMC1 clock source
  2301. * @rmtoll CCIPR1 CLK48MSEL LL_RCC_SetSDMMCClockSource
  2302. * @param SDMMCxSource This parameter can be one of the following values:
  2303. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_HSI48
  2304. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1
  2305. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLL
  2306. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_MSI
  2307. * @retval None
  2308. */
  2309. __STATIC_INLINE void LL_RCC_SetSDMMCClockSource(uint32_t SDMMCxSource)
  2310. {
  2311. MODIFY_REG(RCC->CCIPR1, RCC_CCIPR1_CLK48MSEL, SDMMCxSource);
  2312. }
  2313. /**
  2314. * @brief Configure RNG clock source
  2315. * @rmtoll CCIPR1 CLK48MSEL LL_RCC_SetRNGClockSource
  2316. * @param RNGxSource This parameter can be one of the following values:
  2317. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48
  2318. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLSAI1
  2319. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
  2320. * @arg @ref LL_RCC_RNG_CLKSOURCE_MSI
  2321. * @retval None
  2322. */
  2323. __STATIC_INLINE void LL_RCC_SetRNGClockSource(uint32_t RNGxSource)
  2324. {
  2325. MODIFY_REG(RCC->CCIPR1, RCC_CCIPR1_CLK48MSEL, RNGxSource);
  2326. }
  2327. /**
  2328. * @brief Configure USB clock source
  2329. * @rmtoll CCIPR1 CLK48MSEL LL_RCC_SetUSBClockSource
  2330. * @param USBxSource This parameter can be one of the following values:
  2331. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
  2332. * @arg @ref LL_RCC_USB_CLKSOURCE_PLLSAI1
  2333. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
  2334. * @arg @ref LL_RCC_USB_CLKSOURCE_MSI
  2335. * @retval None
  2336. */
  2337. __STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t USBxSource)
  2338. {
  2339. MODIFY_REG(RCC->CCIPR1, RCC_CCIPR1_CLK48MSEL, USBxSource);
  2340. }
  2341. /**
  2342. * @brief Configure ADC clock source
  2343. * @rmtoll CCIPR1 ADCSEL LL_RCC_SetADCClockSource
  2344. * @param ADCxSource This parameter can be one of the following values:
  2345. * @arg @ref LL_RCC_ADC_CLKSOURCE_NONE
  2346. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLLSAI1
  2347. * @arg @ref LL_RCC_ADC_CLKSOURCE_SYSCLK
  2348. * @retval None
  2349. */
  2350. __STATIC_INLINE void LL_RCC_SetADCClockSource(uint32_t ADCxSource)
  2351. {
  2352. MODIFY_REG(RCC->CCIPR1, RCC_CCIPR1_ADCSEL, ADCxSource);
  2353. }
  2354. /**
  2355. * @brief Configure DFSDM Audio clock source
  2356. * @rmtoll CCIPR2 ADFSDM1SEL LL_RCC_SetDFSDMAudioClockSource
  2357. * @param Source This parameter can be one of the following values:
  2358. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1
  2359. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI
  2360. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI
  2361. * @retval None
  2362. */
  2363. __STATIC_INLINE void LL_RCC_SetDFSDMAudioClockSource(uint32_t Source)
  2364. {
  2365. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_ADFSDMSEL, Source);
  2366. }
  2367. /**
  2368. * @brief Configure DFSDM Kernel clock source
  2369. * @rmtoll CCIPR2 DFSDM1SEL LL_RCC_SetDFSDMClockSource
  2370. * @param DFSDMxSource This parameter can be one of the following values:
  2371. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  2372. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  2373. * @retval None
  2374. */
  2375. __STATIC_INLINE void LL_RCC_SetDFSDMClockSource(uint32_t DFSDMxSource)
  2376. {
  2377. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_DFSDMSEL, DFSDMxSource);
  2378. }
  2379. /**
  2380. * @brief Configure OCTOSPI kernel clock source
  2381. * @rmtoll CCIPR2 OSPISEL LL_RCC_SetOCTOSPIClockSource
  2382. * @param Source This parameter can be one of the following values:
  2383. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK
  2384. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_MSI
  2385. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_PLL
  2386. * @retval None
  2387. */
  2388. __STATIC_INLINE void LL_RCC_SetOCTOSPIClockSource(uint32_t Source)
  2389. {
  2390. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_OSPISEL, Source);
  2391. }
  2392. /**
  2393. * @brief Get USARTx clock source
  2394. * @rmtoll CCIPR1 USART1SEL LL_RCC_GetUSARTClockSource\n
  2395. * CCIPR1 USART2SEL LL_RCC_GetUSARTClockSource\n
  2396. * CCIPR1 USART3SEL LL_RCC_GetUSARTClockSource
  2397. * @param USARTx This parameter can be one of the following values:
  2398. * @arg @ref LL_RCC_USART1_CLKSOURCE
  2399. * @arg @ref LL_RCC_USART2_CLKSOURCE
  2400. * @arg @ref LL_RCC_USART3_CLKSOURCE
  2401. * @retval Returned value can be one of the following values:
  2402. * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK2
  2403. * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
  2404. * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
  2405. * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
  2406. * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
  2407. * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
  2408. * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
  2409. * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
  2410. * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1
  2411. * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK
  2412. * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI
  2413. * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE
  2414. */
  2415. __STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx)
  2416. {
  2417. return (uint32_t)(READ_BIT(RCC->CCIPR1, USARTx) | (USARTx << 16U));
  2418. }
  2419. /**
  2420. * @brief Get UARTx clock source
  2421. * @rmtoll CCIPR1 UART4SEL LL_RCC_GetUARTClockSource\n
  2422. * CCIPR1 UART5SEL LL_RCC_GetUARTClockSource
  2423. * @param UARTx This parameter can be one of the following values:
  2424. * @arg @ref LL_RCC_UART4_CLKSOURCE
  2425. * @arg @ref LL_RCC_UART5_CLKSOURCE
  2426. * @retval Returned value can be one of the following values:
  2427. * @arg @ref LL_RCC_UART4_CLKSOURCE_PCLK1
  2428. * @arg @ref LL_RCC_UART4_CLKSOURCE_SYSCLK
  2429. * @arg @ref LL_RCC_UART4_CLKSOURCE_HSI
  2430. * @arg @ref LL_RCC_UART4_CLKSOURCE_LSE
  2431. * @arg @ref LL_RCC_UART5_CLKSOURCE_PCLK1
  2432. * @arg @ref LL_RCC_UART5_CLKSOURCE_SYSCLK
  2433. * @arg @ref LL_RCC_UART5_CLKSOURCE_HSI
  2434. * @arg @ref LL_RCC_UART5_CLKSOURCE_LSE
  2435. */
  2436. __STATIC_INLINE uint32_t LL_RCC_GetUARTClockSource(uint32_t UARTx)
  2437. {
  2438. return (uint32_t)(READ_BIT(RCC->CCIPR1, UARTx) | (UARTx << 16U));
  2439. }
  2440. /**
  2441. * @brief Get LPUARTx clock source
  2442. * @rmtoll CCIPR1 LPUART1SEL LL_RCC_GetLPUARTClockSource
  2443. * @param LPUARTx This parameter can be one of the following values:
  2444. * @arg @ref LL_RCC_LPUART1_CLKSOURCE
  2445. * @retval Returned value can be one of the following values:
  2446. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
  2447. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
  2448. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  2449. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  2450. */
  2451. __STATIC_INLINE uint32_t LL_RCC_GetLPUARTClockSource(uint32_t LPUARTx)
  2452. {
  2453. return (uint32_t)(READ_BIT(RCC->CCIPR1, LPUARTx));
  2454. }
  2455. /**
  2456. * @brief Get I2Cx clock source
  2457. * @rmtoll CCIPR1 I2C1SEL LL_RCC_GetI2CClockSource\n
  2458. * CCIPR1 I2C2SEL LL_RCC_GetI2CClockSource\n
  2459. * CCIPR1 I2C3SEL LL_RCC_GetI2CClockSource\n
  2460. * CCIPR2 I2C4SEL LL_RCC_GetI2CClockSource
  2461. * @param I2Cx This parameter can be one of the following values:
  2462. * @arg @ref LL_RCC_I2C1_CLKSOURCE
  2463. * @arg @ref LL_RCC_I2C2_CLKSOURCE
  2464. * @arg @ref LL_RCC_I2C3_CLKSOURCE
  2465. * @arg @ref LL_RCC_I2C4_CLKSOURCE
  2466. * @retval Returned value can be one of the following values:
  2467. * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
  2468. * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
  2469. * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
  2470. * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1
  2471. * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK
  2472. * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI
  2473. * @arg @ref LL_RCC_I2C3_CLKSOURCE_PCLK1
  2474. * @arg @ref LL_RCC_I2C3_CLKSOURCE_SYSCLK
  2475. * @arg @ref LL_RCC_I2C3_CLKSOURCE_HSI
  2476. * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK1
  2477. * @arg @ref LL_RCC_I2C4_CLKSOURCE_SYSCLK
  2478. * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI
  2479. */
  2480. __STATIC_INLINE uint32_t LL_RCC_GetI2CClockSource(uint32_t I2Cx)
  2481. {
  2482. __IO const uint32_t *reg = (__IO uint32_t *)(uint32_t)(RCC_BASE + 0x88U + (I2Cx >> 24U));
  2483. return (uint32_t)((READ_BIT(*reg, (3UL << (((I2Cx & 0x00FF0000UL) >> 16U) & 0x1FUL))) >> (((I2Cx & 0x00FF0000UL) >> 16U) & 0x1FUL)) | (I2Cx & 0xFFFF0000UL));
  2484. }
  2485. /**
  2486. * @brief Get LPTIMx clock source
  2487. * @rmtoll CCIPR1 LPTIM1SEL LL_RCC_GetLPTIMClockSource\n
  2488. * CCIPR1 LPTIM2SEL LL_RCC_GetLPTIMClockSource\n
  2489. * CCIPR1 LPTIM3SEL LL_RCC_GetLPTIMClockSource
  2490. * @param LPTIMx This parameter can be one of the following values:
  2491. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
  2492. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE
  2493. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE
  2494. * @retval Returned value can be one of the following values:
  2495. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  2496. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  2497. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
  2498. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  2499. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK1
  2500. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  2501. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_HSI
  2502. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  2503. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_PCLK1
  2504. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_LSI
  2505. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_HSI
  2506. * @arg @ref LL_RCC_LPTIM3_CLKSOURCE_LSE
  2507. */
  2508. __STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx)
  2509. {
  2510. return (uint32_t)((READ_BIT(RCC->CCIPR1, LPTIMx) >> 16U) | LPTIMx);
  2511. }
  2512. /**
  2513. * @brief Get FDCAN kernel clock source
  2514. * @rmtoll CCIPR1 FDCANSEL LL_RCC_GetFDCANClockSource
  2515. * @param FDCANx This parameter can be one of the following values:
  2516. * @arg @ref LL_RCC_FDCAN_CLKSOURCE
  2517. * @retval Returned value can be one of the following values:
  2518. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
  2519. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL
  2520. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLLSAI1
  2521. */
  2522. __STATIC_INLINE uint32_t LL_RCC_GetFDCANClockSource(uint32_t FDCANx)
  2523. {
  2524. return (uint32_t)(READ_BIT(RCC->CCIPR1, FDCANx));
  2525. }
  2526. /**
  2527. * @brief Get SAIx clock source
  2528. * @rmtoll CCIPR2 SAI1SEL LL_RCC_GetSAIClockSource\n
  2529. * CCIPR2 SAI2SEL LL_RCC_GetSAIClockSource
  2530. * @param SAIx This parameter can be one of the following values:
  2531. * @arg @ref LL_RCC_SAI1_CLKSOURCE
  2532. * @arg @ref LL_RCC_SAI2_CLKSOURCE
  2533. * @retval Returned value can be one of the following values:
  2534. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI1
  2535. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLLSAI2
  2536. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL
  2537. * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN
  2538. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI1
  2539. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLLSAI2
  2540. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PLL
  2541. * @arg @ref LL_RCC_SAI2_CLKSOURCE_PIN
  2542. */
  2543. __STATIC_INLINE uint32_t LL_RCC_GetSAIClockSource(uint32_t SAIx)
  2544. {
  2545. return (uint32_t)(READ_BIT(RCC->CCIPR2, SAIx) | (SAIx << 16U));
  2546. }
  2547. /**
  2548. * @brief Get SDMMCx kernel clock source
  2549. * @rmtoll CCIPR2 SDMMCSEL LL_RCC_GetSDMMCKernelClockSource
  2550. * @param SDMMCx This parameter can be one of the following values:
  2551. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE
  2552. * @retval Returned value can be one of the following values:
  2553. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_48CLK
  2554. * @arg @ref LL_RCC_SDMMC1_KERNELCLKSOURCE_PLLP
  2555. */
  2556. __STATIC_INLINE uint32_t LL_RCC_GetSDMMCKernelClockSource(uint32_t SDMMCx)
  2557. {
  2558. return (uint32_t)(READ_BIT(RCC->CCIPR2, SDMMCx));
  2559. }
  2560. /**
  2561. * @brief Get SDMMCx clock source
  2562. * @rmtoll CCIPR1 CLK48MSEL LL_RCC_GetSDMMCClockSource
  2563. * @param SDMMCx This parameter can be one of the following values:
  2564. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE
  2565. * @retval Returned value can be one of the following values:
  2566. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_HSI48
  2567. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLLSAI1
  2568. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_PLL
  2569. * @arg @ref LL_RCC_SDMMC1_CLKSOURCE_MSI
  2570. */
  2571. __STATIC_INLINE uint32_t LL_RCC_GetSDMMCClockSource(uint32_t SDMMCx)
  2572. {
  2573. return (uint32_t)(READ_BIT(RCC->CCIPR1, SDMMCx));
  2574. }
  2575. /**
  2576. * @brief Get RNGx clock source
  2577. * @rmtoll CCIPR1 CLK48MSEL LL_RCC_GetRNGClockSource
  2578. * @param RNGx This parameter can be one of the following values:
  2579. * @arg @ref LL_RCC_RNG_CLKSOURCE
  2580. * @retval Returned value can be one of the following values:
  2581. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48
  2582. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLLSAI1
  2583. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
  2584. * @arg @ref LL_RCC_RNG_CLKSOURCE_MSI
  2585. */
  2586. __STATIC_INLINE uint32_t LL_RCC_GetRNGClockSource(uint32_t RNGx)
  2587. {
  2588. return (uint32_t)(READ_BIT(RCC->CCIPR1, RNGx));
  2589. }
  2590. /**
  2591. * @brief Get USBx clock source
  2592. * @rmtoll CCIPR1 CLK48MSEL LL_RCC_GetUSBClockSource
  2593. * @param USBx This parameter can be one of the following values:
  2594. * @arg @ref LL_RCC_USB_CLKSOURCE
  2595. * @retval Returned value can be one of the following values:
  2596. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
  2597. * @arg @ref LL_RCC_USB_CLKSOURCE_PLLSAI1
  2598. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
  2599. * @arg @ref LL_RCC_USB_CLKSOURCE_MSI
  2600. */
  2601. __STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx)
  2602. {
  2603. return (uint32_t)(READ_BIT(RCC->CCIPR1, USBx));
  2604. }
  2605. /**
  2606. * @brief Get ADCx clock source
  2607. * @rmtoll CCIPR1 ADCSEL LL_RCC_GetADCClockSource
  2608. * @param ADCx This parameter can be one of the following values:
  2609. * @arg @ref LL_RCC_ADC_CLKSOURCE
  2610. * @retval Returned value can be one of the following values:
  2611. * @arg @ref LL_RCC_ADC_CLKSOURCE_NONE
  2612. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLLSAI1
  2613. * @arg @ref LL_RCC_ADC_CLKSOURCE_SYSCLK
  2614. */
  2615. __STATIC_INLINE uint32_t LL_RCC_GetADCClockSource(uint32_t ADCx)
  2616. {
  2617. return (uint32_t)(READ_BIT(RCC->CCIPR1, ADCx));
  2618. }
  2619. /**
  2620. * @brief Get DFSDM Audio Clock Source
  2621. * @rmtoll CCIPR2 ADFSDM1SEL LL_RCC_GetDFSDMAudioClockSource
  2622. * @param DFSDMx This parameter can be one of the following values:
  2623. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE
  2624. * @retval Returned value can be one of the following values:
  2625. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_SAI1
  2626. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_HSI
  2627. * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE_MSI
  2628. */
  2629. __STATIC_INLINE uint32_t LL_RCC_GetDFSDMAudioClockSource(uint32_t DFSDMx)
  2630. {
  2631. return (uint32_t)(READ_BIT(RCC->CCIPR2, DFSDMx));
  2632. }
  2633. /**
  2634. * @brief Get DFSDMx Kernel clock source
  2635. * @rmtoll CCIPR2 DFSDM1SEL LL_RCC_GetDFSDMClockSource
  2636. * @param DFSDMx This parameter can be one of the following values:
  2637. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE
  2638. * @retval Returned value can be one of the following values:
  2639. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_PCLK2
  2640. * @arg @ref LL_RCC_DFSDM1_CLKSOURCE_SYSCLK
  2641. */
  2642. __STATIC_INLINE uint32_t LL_RCC_GetDFSDMClockSource(uint32_t DFSDMx)
  2643. {
  2644. return (uint32_t)(READ_BIT(RCC->CCIPR2, DFSDMx));
  2645. }
  2646. /**
  2647. * @brief Get OCTOSPI clock source
  2648. * @rmtoll CCIPR2 OSPISEL LL_RCC_GetOCTOSPIClockSource
  2649. * @param OCTOSPIx This parameter can be one of the following values:
  2650. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE
  2651. * @retval Returned value can be one of the following values:
  2652. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_SYSCLK
  2653. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_MSI
  2654. * @arg @ref LL_RCC_OCTOSPI_CLKSOURCE_PLL
  2655. */
  2656. __STATIC_INLINE uint32_t LL_RCC_GetOCTOSPIClockSource(uint32_t OCTOSPIx)
  2657. {
  2658. return (uint32_t)(READ_BIT(RCC->CCIPR2, OCTOSPIx));
  2659. }
  2660. /**
  2661. * @}
  2662. */
  2663. /** @defgroup RCC_LL_EF_RTC RTC
  2664. * @{
  2665. */
  2666. /**
  2667. * @brief Set RTC Clock Source
  2668. * @note Once the RTC clock source has been selected, it cannot be changed anymore unless
  2669. * the Backup domain is reset, or unless a failure is detected on LSE (LSECSSD is
  2670. * set). The BDRST bit can be used to reset them.
  2671. * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource
  2672. * @param Source This parameter can be one of the following values:
  2673. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  2674. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  2675. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  2676. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
  2677. * @retval None
  2678. */
  2679. __STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source)
  2680. {
  2681. MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source);
  2682. }
  2683. /**
  2684. * @brief Get RTC Clock Source
  2685. * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource
  2686. * @retval Returned value can be one of the following values:
  2687. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  2688. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  2689. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  2690. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
  2691. */
  2692. __STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void)
  2693. {
  2694. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL));
  2695. }
  2696. /**
  2697. * @brief Enable RTC
  2698. * @rmtoll BDCR RTCEN LL_RCC_EnableRTC
  2699. * @retval None
  2700. */
  2701. __STATIC_INLINE void LL_RCC_EnableRTC(void)
  2702. {
  2703. SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  2704. }
  2705. /**
  2706. * @brief Disable RTC
  2707. * @rmtoll BDCR RTCEN LL_RCC_DisableRTC
  2708. * @retval None
  2709. */
  2710. __STATIC_INLINE void LL_RCC_DisableRTC(void)
  2711. {
  2712. CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  2713. }
  2714. /**
  2715. * @brief Check if RTC has been enabled or not
  2716. * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC
  2717. * @retval State of bit (1 or 0).
  2718. */
  2719. __STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void)
  2720. {
  2721. return ((READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == RCC_BDCR_RTCEN) ? 1UL : 0UL);
  2722. }
  2723. /**
  2724. * @brief Force the Backup domain reset
  2725. * @rmtoll BDCR BDRST LL_RCC_ForceBackupDomainReset
  2726. * @retval None
  2727. */
  2728. __STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void)
  2729. {
  2730. SET_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  2731. }
  2732. /**
  2733. * @brief Release the Backup domain reset
  2734. * @rmtoll BDCR BDRST LL_RCC_ReleaseBackupDomainReset
  2735. * @retval None
  2736. */
  2737. __STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void)
  2738. {
  2739. CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  2740. }
  2741. /**
  2742. * @}
  2743. */
  2744. /** @defgroup RCC_LL_EF_PLL PLL
  2745. * @{
  2746. */
  2747. /**
  2748. * @brief Enable PLL
  2749. * @rmtoll CR PLLON LL_RCC_PLL_Enable
  2750. * @retval None
  2751. */
  2752. __STATIC_INLINE void LL_RCC_PLL_Enable(void)
  2753. {
  2754. SET_BIT(RCC->CR, RCC_CR_PLLON);
  2755. }
  2756. /**
  2757. * @brief Disable PLL
  2758. * @note Cannot be disabled if the PLL clock is used as the system clock
  2759. * @rmtoll CR PLLON LL_RCC_PLL_Disable
  2760. * @retval None
  2761. */
  2762. __STATIC_INLINE void LL_RCC_PLL_Disable(void)
  2763. {
  2764. CLEAR_BIT(RCC->CR, RCC_CR_PLLON);
  2765. }
  2766. /**
  2767. * @brief Check if PLL Ready
  2768. * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady
  2769. * @retval State of bit (1 or 0).
  2770. */
  2771. __STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
  2772. {
  2773. return ((READ_BIT(RCC->CR, RCC_CR_PLLRDY) == RCC_CR_PLLRDY) ? 1UL : 0UL);
  2774. }
  2775. /**
  2776. * @brief Configure PLL used for SYSCLK Domain
  2777. * @note PLL Source, PLLM, PLLN and PLLR can be written only when PLL is disabled.
  2778. * @note PLLN/PLLR can be written only when PLL is disabled.
  2779. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SYS\n
  2780. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SYS\n
  2781. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SYS\n
  2782. * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SYS
  2783. * @param Source This parameter can be one of the following values:
  2784. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2785. * @arg @ref LL_RCC_PLLSOURCE_MSI
  2786. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2787. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2788. * @param PLLM This parameter can be one of the following values:
  2789. * @arg @ref LL_RCC_PLLM_DIV_1
  2790. * @arg @ref LL_RCC_PLLM_DIV_2
  2791. * @arg @ref LL_RCC_PLLM_DIV_3
  2792. * @arg @ref LL_RCC_PLLM_DIV_4
  2793. * @arg @ref LL_RCC_PLLM_DIV_5
  2794. * @arg @ref LL_RCC_PLLM_DIV_6
  2795. * @arg @ref LL_RCC_PLLM_DIV_7
  2796. * @arg @ref LL_RCC_PLLM_DIV_8
  2797. * @arg @ref LL_RCC_PLLM_DIV_9
  2798. * @arg @ref LL_RCC_PLLM_DIV_10
  2799. * @arg @ref LL_RCC_PLLM_DIV_11
  2800. * @arg @ref LL_RCC_PLLM_DIV_12
  2801. * @arg @ref LL_RCC_PLLM_DIV_13
  2802. * @arg @ref LL_RCC_PLLM_DIV_14
  2803. * @arg @ref LL_RCC_PLLM_DIV_15
  2804. * @arg @ref LL_RCC_PLLM_DIV_16
  2805. * @param PLLN Between 8 and 86
  2806. * @param PLLR This parameter can be one of the following values:
  2807. * @arg @ref LL_RCC_PLLR_DIV_2
  2808. * @arg @ref LL_RCC_PLLR_DIV_4
  2809. * @arg @ref LL_RCC_PLLR_DIV_6
  2810. * @arg @ref LL_RCC_PLLR_DIV_8
  2811. * @retval None
  2812. */
  2813. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  2814. {
  2815. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR,
  2816. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLR);
  2817. }
  2818. /**
  2819. * @brief Configure PLL used for SAI domain clock
  2820. * @note PLL Source, PLLM, PLLN and PLLPDIV can be written only when PLL is disabled.
  2821. * @note This can be selected for SAI1 or SAI2
  2822. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SAI\n
  2823. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SAI\n
  2824. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SAI\n
  2825. * PLLCFGR PLLPDIV LL_RCC_PLL_ConfigDomain_SAI
  2826. * @param Source This parameter can be one of the following values:
  2827. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2828. * @arg @ref LL_RCC_PLLSOURCE_MSI
  2829. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2830. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2831. * @param PLLM This parameter can be one of the following values:
  2832. * @arg @ref LL_RCC_PLLM_DIV_1
  2833. * @arg @ref LL_RCC_PLLM_DIV_2
  2834. * @arg @ref LL_RCC_PLLM_DIV_3
  2835. * @arg @ref LL_RCC_PLLM_DIV_4
  2836. * @arg @ref LL_RCC_PLLM_DIV_5
  2837. * @arg @ref LL_RCC_PLLM_DIV_6
  2838. * @arg @ref LL_RCC_PLLM_DIV_7
  2839. * @arg @ref LL_RCC_PLLM_DIV_8
  2840. * @arg @ref LL_RCC_PLLM_DIV_9
  2841. * @arg @ref LL_RCC_PLLM_DIV_10
  2842. * @arg @ref LL_RCC_PLLM_DIV_11
  2843. * @arg @ref LL_RCC_PLLM_DIV_12
  2844. * @arg @ref LL_RCC_PLLM_DIV_13
  2845. * @arg @ref LL_RCC_PLLM_DIV_14
  2846. * @arg @ref LL_RCC_PLLM_DIV_15
  2847. * @arg @ref LL_RCC_PLLM_DIV_16
  2848. * @param PLLN Between 8 and 86
  2849. * @param PLLP This parameter can be one of the following values:
  2850. * @arg @ref LL_RCC_PLLP_DIV_2
  2851. * @arg @ref LL_RCC_PLLP_DIV_3
  2852. * @arg @ref LL_RCC_PLLP_DIV_4
  2853. * @arg @ref LL_RCC_PLLP_DIV_5
  2854. * @arg @ref LL_RCC_PLLP_DIV_6
  2855. * @arg @ref LL_RCC_PLLP_DIV_7
  2856. * @arg @ref LL_RCC_PLLP_DIV_8
  2857. * @arg @ref LL_RCC_PLLP_DIV_9
  2858. * @arg @ref LL_RCC_PLLP_DIV_10
  2859. * @arg @ref LL_RCC_PLLP_DIV_11
  2860. * @arg @ref LL_RCC_PLLP_DIV_12
  2861. * @arg @ref LL_RCC_PLLP_DIV_13
  2862. * @arg @ref LL_RCC_PLLP_DIV_14
  2863. * @arg @ref LL_RCC_PLLP_DIV_15
  2864. * @arg @ref LL_RCC_PLLP_DIV_16
  2865. * @arg @ref LL_RCC_PLLP_DIV_17
  2866. * @arg @ref LL_RCC_PLLP_DIV_18
  2867. * @arg @ref LL_RCC_PLLP_DIV_19
  2868. * @arg @ref LL_RCC_PLLP_DIV_20
  2869. * @arg @ref LL_RCC_PLLP_DIV_21
  2870. * @arg @ref LL_RCC_PLLP_DIV_22
  2871. * @arg @ref LL_RCC_PLLP_DIV_23
  2872. * @arg @ref LL_RCC_PLLP_DIV_24
  2873. * @arg @ref LL_RCC_PLLP_DIV_25
  2874. * @arg @ref LL_RCC_PLLP_DIV_26
  2875. * @arg @ref LL_RCC_PLLP_DIV_27
  2876. * @arg @ref LL_RCC_PLLP_DIV_28
  2877. * @arg @ref LL_RCC_PLLP_DIV_29
  2878. * @arg @ref LL_RCC_PLLP_DIV_30
  2879. * @arg @ref LL_RCC_PLLP_DIV_31
  2880. * @retval None
  2881. */
  2882. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  2883. {
  2884. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLPDIV,
  2885. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLP);
  2886. }
  2887. /**
  2888. * @brief Configure PLL used for 48Mhz domain clock
  2889. * @note PLL Source, PLLM, PLLN and PLLQ can be written only when PLL is disabled.
  2890. * @note This can be selected for USB, RNG, SDMMC
  2891. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_48M\n
  2892. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_48M\n
  2893. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_48M\n
  2894. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_48M
  2895. * @param Source This parameter can be one of the following values:
  2896. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2897. * @arg @ref LL_RCC_PLLSOURCE_MSI
  2898. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2899. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2900. * @param PLLM This parameter can be one of the following values:
  2901. * @arg @ref LL_RCC_PLLM_DIV_1
  2902. * @arg @ref LL_RCC_PLLM_DIV_2
  2903. * @arg @ref LL_RCC_PLLM_DIV_3
  2904. * @arg @ref LL_RCC_PLLM_DIV_4
  2905. * @arg @ref LL_RCC_PLLM_DIV_5
  2906. * @arg @ref LL_RCC_PLLM_DIV_6
  2907. * @arg @ref LL_RCC_PLLM_DIV_7
  2908. * @arg @ref LL_RCC_PLLM_DIV_8
  2909. * @arg @ref LL_RCC_PLLM_DIV_9
  2910. * @arg @ref LL_RCC_PLLM_DIV_10
  2911. * @arg @ref LL_RCC_PLLM_DIV_11
  2912. * @arg @ref LL_RCC_PLLM_DIV_12
  2913. * @arg @ref LL_RCC_PLLM_DIV_13
  2914. * @arg @ref LL_RCC_PLLM_DIV_14
  2915. * @arg @ref LL_RCC_PLLM_DIV_15
  2916. * @arg @ref LL_RCC_PLLM_DIV_16
  2917. * @param PLLN Between 8 and 86
  2918. * @param PLLQ This parameter can be one of the following values:
  2919. * @arg @ref LL_RCC_PLLQ_DIV_2
  2920. * @arg @ref LL_RCC_PLLQ_DIV_4
  2921. * @arg @ref LL_RCC_PLLQ_DIV_6
  2922. * @arg @ref LL_RCC_PLLQ_DIV_8
  2923. * @retval None
  2924. */
  2925. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  2926. {
  2927. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  2928. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  2929. }
  2930. /**
  2931. * @brief Configure PLL clock source
  2932. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_SetMainSource
  2933. * @param PLLSource This parameter can be one of the following values:
  2934. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2935. * @arg @ref LL_RCC_PLLSOURCE_MSI
  2936. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2937. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2938. * @retval None
  2939. */
  2940. __STATIC_INLINE void LL_RCC_PLL_SetMainSource(uint32_t PLLSource)
  2941. {
  2942. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSource);
  2943. }
  2944. /**
  2945. * @brief Get the oscillator used as PLL clock source.
  2946. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_GetMainSource
  2947. * @retval Returned value can be one of the following values:
  2948. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2949. * @arg @ref LL_RCC_PLLSOURCE_MSI
  2950. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2951. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2952. */
  2953. __STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void)
  2954. {
  2955. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC));
  2956. }
  2957. /**
  2958. * @brief Get Main PLL multiplication factor for VCO
  2959. * @rmtoll PLLCFGR PLLN LL_RCC_PLL_GetN
  2960. * @retval Between 8 and 86
  2961. */
  2962. __STATIC_INLINE uint32_t LL_RCC_PLL_GetN(void)
  2963. {
  2964. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos);
  2965. }
  2966. /**
  2967. * @brief Get Main PLL division factor for PLLP
  2968. * @note Used for PLLSAI3CLK (SAI1 and SAI2 clock)
  2969. * @rmtoll PLLCFGR PLLPDIV LL_RCC_PLL_GetP
  2970. * @retval Returned value can be one of the following values:
  2971. * @arg @ref LL_RCC_PLLP_DIV_2
  2972. * @arg @ref LL_RCC_PLLP_DIV_3
  2973. * @arg @ref LL_RCC_PLLP_DIV_4
  2974. * @arg @ref LL_RCC_PLLP_DIV_5
  2975. * @arg @ref LL_RCC_PLLP_DIV_6
  2976. * @arg @ref LL_RCC_PLLP_DIV_7
  2977. * @arg @ref LL_RCC_PLLP_DIV_8
  2978. * @arg @ref LL_RCC_PLLP_DIV_9
  2979. * @arg @ref LL_RCC_PLLP_DIV_10
  2980. * @arg @ref LL_RCC_PLLP_DIV_11
  2981. * @arg @ref LL_RCC_PLLP_DIV_12
  2982. * @arg @ref LL_RCC_PLLP_DIV_13
  2983. * @arg @ref LL_RCC_PLLP_DIV_14
  2984. * @arg @ref LL_RCC_PLLP_DIV_15
  2985. * @arg @ref LL_RCC_PLLP_DIV_16
  2986. * @arg @ref LL_RCC_PLLP_DIV_17
  2987. * @arg @ref LL_RCC_PLLP_DIV_18
  2988. * @arg @ref LL_RCC_PLLP_DIV_19
  2989. * @arg @ref LL_RCC_PLLP_DIV_20
  2990. * @arg @ref LL_RCC_PLLP_DIV_21
  2991. * @arg @ref LL_RCC_PLLP_DIV_22
  2992. * @arg @ref LL_RCC_PLLP_DIV_23
  2993. * @arg @ref LL_RCC_PLLP_DIV_24
  2994. * @arg @ref LL_RCC_PLLP_DIV_25
  2995. * @arg @ref LL_RCC_PLLP_DIV_26
  2996. * @arg @ref LL_RCC_PLLP_DIV_27
  2997. * @arg @ref LL_RCC_PLLP_DIV_28
  2998. * @arg @ref LL_RCC_PLLP_DIV_29
  2999. * @arg @ref LL_RCC_PLLP_DIV_30
  3000. * @arg @ref LL_RCC_PLLP_DIV_31
  3001. */
  3002. __STATIC_INLINE uint32_t LL_RCC_PLL_GetP(void)
  3003. {
  3004. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPDIV));
  3005. }
  3006. /**
  3007. * @brief Get Main PLL division factor for PLLQ
  3008. * @note Used for PLL48M1CLK selected for USB, RNG, SDMMC (48 MHz clock)
  3009. * @rmtoll PLLCFGR PLLQ LL_RCC_PLL_GetQ
  3010. * @retval Returned value can be one of the following values:
  3011. * @arg @ref LL_RCC_PLLQ_DIV_2
  3012. * @arg @ref LL_RCC_PLLQ_DIV_4
  3013. * @arg @ref LL_RCC_PLLQ_DIV_6
  3014. * @arg @ref LL_RCC_PLLQ_DIV_8
  3015. */
  3016. __STATIC_INLINE uint32_t LL_RCC_PLL_GetQ(void)
  3017. {
  3018. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQ));
  3019. }
  3020. /**
  3021. * @brief Get Main PLL division factor for PLLR
  3022. * @note Used for PLLCLK (system clock)
  3023. * @rmtoll PLLCFGR PLLR LL_RCC_PLL_GetR
  3024. * @retval Returned value can be one of the following values:
  3025. * @arg @ref LL_RCC_PLLR_DIV_2
  3026. * @arg @ref LL_RCC_PLLR_DIV_4
  3027. * @arg @ref LL_RCC_PLLR_DIV_6
  3028. * @arg @ref LL_RCC_PLLR_DIV_8
  3029. */
  3030. __STATIC_INLINE uint32_t LL_RCC_PLL_GetR(void)
  3031. {
  3032. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLR));
  3033. }
  3034. /**
  3035. * @brief Get Division factor for the main PLL and other PLL
  3036. * @rmtoll PLLCFGR PLLM LL_RCC_PLL_GetDivider
  3037. * @retval Returned value can be one of the following values:
  3038. * @arg @ref LL_RCC_PLLM_DIV_1
  3039. * @arg @ref LL_RCC_PLLM_DIV_2
  3040. * @arg @ref LL_RCC_PLLM_DIV_3
  3041. * @arg @ref LL_RCC_PLLM_DIV_4
  3042. * @arg @ref LL_RCC_PLLM_DIV_5
  3043. * @arg @ref LL_RCC_PLLM_DIV_6
  3044. * @arg @ref LL_RCC_PLLM_DIV_7
  3045. * @arg @ref LL_RCC_PLLM_DIV_8
  3046. * @arg @ref LL_RCC_PLLM_DIV_9
  3047. * @arg @ref LL_RCC_PLLM_DIV_10
  3048. * @arg @ref LL_RCC_PLLM_DIV_11
  3049. * @arg @ref LL_RCC_PLLM_DIV_12
  3050. * @arg @ref LL_RCC_PLLM_DIV_13
  3051. * @arg @ref LL_RCC_PLLM_DIV_14
  3052. * @arg @ref LL_RCC_PLLM_DIV_15
  3053. * @arg @ref LL_RCC_PLLM_DIV_16
  3054. */
  3055. __STATIC_INLINE uint32_t LL_RCC_PLL_GetDivider(void)
  3056. {
  3057. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLM));
  3058. }
  3059. /**
  3060. * @brief Enable PLL output mapped on SAI domain clock
  3061. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_EnableDomain_SAI
  3062. * @retval None
  3063. */
  3064. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_SAI(void)
  3065. {
  3066. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  3067. }
  3068. /**
  3069. * @brief Disable PLL output mapped on SAI domain clock
  3070. * @note Cannot be disabled if the PLL clock is used as the system
  3071. * clock
  3072. * @note In order to save power, when the PLLCLK of the PLL is
  3073. * not used, should be 0
  3074. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_DisableDomain_SAI
  3075. * @retval None
  3076. */
  3077. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_SAI(void)
  3078. {
  3079. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  3080. }
  3081. /**
  3082. * @brief Check if PLL output mapped on SAI domain clock is enabled
  3083. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_IsEnabledDomain_SAI
  3084. * @retval State of bit (1 or 0).
  3085. */
  3086. __STATIC_INLINE uint32_t LL_RCC_PLL_IsEnabledDomain_SAI(void)
  3087. {
  3088. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN) == (RCC_PLLCFGR_PLLPEN)) ? 1UL : 0UL);
  3089. }
  3090. /**
  3091. * @brief Enable PLL output mapped on 48MHz domain clock
  3092. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_48M
  3093. * @retval None
  3094. */
  3095. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_48M(void)
  3096. {
  3097. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3098. }
  3099. /**
  3100. * @brief Disable PLL output mapped on 48MHz domain clock
  3101. * @note Cannot be disabled if the PLL clock is used as the system
  3102. * clock
  3103. * @note In order to save power, when the PLLCLK of the PLL is
  3104. * not used, should be 0
  3105. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_48M
  3106. * @retval None
  3107. */
  3108. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_48M(void)
  3109. {
  3110. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3111. }
  3112. /**
  3113. * @brief Check if PLL output mapped on 48MHz domain clock is enabled
  3114. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_IsEnabledDomain_48M
  3115. * @retval State of bit (1 or 0).
  3116. */
  3117. __STATIC_INLINE uint32_t LL_RCC_PLL_IsEnabledDomain_48M(void)
  3118. {
  3119. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN) == (RCC_PLLCFGR_PLLQEN)) ? 1UL : 0UL);
  3120. }
  3121. /**
  3122. * @brief Enable PLL output mapped on SYSCLK domain
  3123. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_EnableDomain_SYS
  3124. * @retval None
  3125. */
  3126. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_SYS(void)
  3127. {
  3128. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN);
  3129. }
  3130. /**
  3131. * @brief Disable PLL output mapped on SYSCLK domain
  3132. * @note Cannot be disabled if the PLL clock is used as the system
  3133. * clock
  3134. * @note In order to save power, when the PLLCLK of the PLL is
  3135. * not used, Main PLL should be 0
  3136. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_DisableDomain_SYS
  3137. * @retval None
  3138. */
  3139. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_SYS(void)
  3140. {
  3141. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN);
  3142. }
  3143. /**
  3144. * @brief Check if PLL output mapped on SYSCLK domain clock is enabled
  3145. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_IsEnabledDomain_SYS
  3146. * @retval State of bit (1 or 0).
  3147. */
  3148. __STATIC_INLINE uint32_t LL_RCC_PLL_IsEnabledDomain_SYS(void)
  3149. {
  3150. return ((READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN) == (RCC_PLLCFGR_PLLREN)) ? 1UL : 0UL);
  3151. }
  3152. /**
  3153. * @}
  3154. */
  3155. /** @defgroup RCC_LL_EF_PLLSAI1 PLLSAI1
  3156. * @{
  3157. */
  3158. /**
  3159. * @brief Enable PLLSAI1
  3160. * @rmtoll CR PLLSAI1ON LL_RCC_PLLSAI1_Enable
  3161. * @retval None
  3162. */
  3163. __STATIC_INLINE void LL_RCC_PLLSAI1_Enable(void)
  3164. {
  3165. SET_BIT(RCC->CR, RCC_CR_PLLSAI1ON);
  3166. }
  3167. /**
  3168. * @brief Disable PLLSAI1
  3169. * @rmtoll CR PLLSAI1ON LL_RCC_PLLSAI1_Disable
  3170. * @retval None
  3171. */
  3172. __STATIC_INLINE void LL_RCC_PLLSAI1_Disable(void)
  3173. {
  3174. CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI1ON);
  3175. }
  3176. /**
  3177. * @brief Check if PLLSAI1 Ready
  3178. * @rmtoll CR PLLSAI1RDY LL_RCC_PLLSAI1_IsReady
  3179. * @retval State of bit (1 or 0).
  3180. */
  3181. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsReady(void)
  3182. {
  3183. return ((READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) == RCC_CR_PLLSAI1RDY) ? 1UL : 0UL);
  3184. }
  3185. /**
  3186. * @brief Configure PLLSAI1 used for 48Mhz domain clock
  3187. * @note PLLSAI1SRC/PLLSAI1M/PLLSAI1N/PLLSAI1Q can be written only when PLLSAI1 is disabled.
  3188. * @note This can be selected for USB, RNG, SDMMC
  3189. * @rmtoll PLLSAI1CFGR PLLSAI1SRC LL_RCC_PLLSAI1_ConfigDomain_48M\n
  3190. * PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_ConfigDomain_48M\n
  3191. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_48M\n
  3192. * PLLSAI1CFGR PLLSAI1Q LL_RCC_PLLSAI1_ConfigDomain_48M
  3193. * @param Source This parameter can be one of the following values:
  3194. * @arg @ref LL_RCC_PLLSAI1SOURCE_NONE
  3195. * @arg @ref LL_RCC_PLLSAI1SOURCE_MSI
  3196. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSI
  3197. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSE
  3198. * @param PLLM This parameter can be one of the following values:
  3199. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  3200. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  3201. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  3202. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  3203. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  3204. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  3205. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  3206. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  3207. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  3208. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  3209. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  3210. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  3211. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  3212. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  3213. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  3214. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  3215. * @param PLLN Between 8 and 86
  3216. * @param PLLQ This parameter can be one of the following values:
  3217. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  3218. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  3219. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  3220. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  3221. * @retval None
  3222. */
  3223. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_48M(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  3224. {
  3225. MODIFY_REG(RCC->PLLSAI1CFGR,
  3226. RCC_PLLSAI1CFGR_PLLSAI1SRC | RCC_PLLSAI1CFGR_PLLSAI1M | RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1Q,
  3227. Source | PLLM | (PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos) | PLLQ);
  3228. }
  3229. /**
  3230. * @brief Configure PLLSAI1 used for SAI domain clock
  3231. * @note PLLSAI1SRC/PLLSAI1M/PLLSAI1N/PLLSAI1PDIV can be written only when PLLSAI1 is disabled.
  3232. * @note This can be selected for SAI1 or SAI2
  3233. * @rmtoll PLLSAI1CFGR PLLSAI1SRC LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  3234. * PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  3235. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_SAI\n
  3236. * PLLSAI1CFGR PLLSAI1PDIV LL_RCC_PLLSAI1_ConfigDomain_SAI
  3237. * @param Source This parameter can be one of the following values:
  3238. * @arg @ref LL_RCC_PLLSAI1SOURCE_NONE
  3239. * @arg @ref LL_RCC_PLLSAI1SOURCE_MSI
  3240. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSI
  3241. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSE
  3242. * @param PLLM This parameter can be one of the following values:
  3243. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  3244. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  3245. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  3246. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  3247. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  3248. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  3249. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  3250. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  3251. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  3252. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  3253. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  3254. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  3255. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  3256. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  3257. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  3258. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  3259. * @param PLLN Between 8 and 86
  3260. * @param PLLP This parameter can be one of the following values:
  3261. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  3262. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  3263. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  3264. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  3265. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  3266. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  3267. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  3268. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  3269. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  3270. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  3271. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  3272. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  3273. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  3274. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  3275. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  3276. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  3277. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  3278. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  3279. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  3280. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  3281. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  3282. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  3283. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  3284. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  3285. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  3286. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  3287. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  3288. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  3289. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  3290. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  3291. * @retval None
  3292. */
  3293. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  3294. {
  3295. MODIFY_REG(RCC->PLLSAI1CFGR,
  3296. RCC_PLLSAI1CFGR_PLLSAI1SRC | RCC_PLLSAI1CFGR_PLLSAI1M | RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1PDIV,
  3297. Source | PLLM | (PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos) | PLLP);
  3298. }
  3299. /**
  3300. * @brief Configure PLLSAI1 used for ADC domain clock
  3301. * @note PLLSAI1SRC/PLLSAI1M/PLLSAI1N/PLLSAI1R can be written only when PLLSAI1 is disabled.
  3302. * @note This can be selected for ADC
  3303. * @rmtoll PLLSAI1CFGR PLLSAI1SRC LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  3304. * PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  3305. * PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_ConfigDomain_ADC\n
  3306. * PLLSAI1CFGR PLLSAI1R LL_RCC_PLLSAI1_ConfigDomain_ADC
  3307. * @param Source This parameter can be one of the following values:
  3308. * @arg @ref LL_RCC_PLLSAI1SOURCE_NONE
  3309. * @arg @ref LL_RCC_PLLSAI1SOURCE_MSI
  3310. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSI
  3311. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSE
  3312. * @param PLLM This parameter can be one of the following values:
  3313. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  3314. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  3315. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  3316. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  3317. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  3318. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  3319. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  3320. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  3321. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  3322. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  3323. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  3324. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  3325. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  3326. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  3327. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  3328. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  3329. * @param PLLN Between 8 and 86
  3330. * @param PLLR This parameter can be one of the following values:
  3331. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  3332. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  3333. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  3334. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  3335. * @retval None
  3336. */
  3337. __STATIC_INLINE void LL_RCC_PLLSAI1_ConfigDomain_ADC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  3338. {
  3339. MODIFY_REG(RCC->PLLSAI1CFGR,
  3340. RCC_PLLSAI1CFGR_PLLSAI1SRC | RCC_PLLSAI1CFGR_PLLSAI1M | RCC_PLLSAI1CFGR_PLLSAI1N | RCC_PLLSAI1CFGR_PLLSAI1R,
  3341. Source | PLLM | (PLLN << RCC_PLLSAI1CFGR_PLLSAI1N_Pos) | PLLR);
  3342. }
  3343. /**
  3344. * @brief Configure PLLSAI1 clock source
  3345. * @rmtoll PLLSAI1CFGR PLLSAI1SRC LL_RCC_PLLSAI1_SetSource
  3346. * @param PLLSource This parameter can be one of the following values:
  3347. * @arg @ref LL_RCC_PLLSAI1SOURCE_NONE
  3348. * @arg @ref LL_RCC_PLLSAI1SOURCE_MSI
  3349. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSI
  3350. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSE
  3351. * @retval None
  3352. */
  3353. __STATIC_INLINE void LL_RCC_PLLSAI1_SetSource(uint32_t PLLSource)
  3354. {
  3355. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1SRC, PLLSource);
  3356. }
  3357. /**
  3358. * @brief Get the oscillator used as PLLSAI1 clock source.
  3359. * @rmtoll PLLSAI1CFGR PLLSAI1SRC LL_RCC_PLLSAI1_GetSource
  3360. * @retval Returned value can be one of the following values:
  3361. * @arg @ref LL_RCC_PLLSAI1SOURCE_NONE
  3362. * @arg @ref LL_RCC_PLLSAI1SOURCE_MSI
  3363. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSI
  3364. * @arg @ref LL_RCC_PLLSAI1SOURCE_HSE
  3365. */
  3366. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetSource(void)
  3367. {
  3368. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1SRC));
  3369. }
  3370. /**
  3371. * @brief Get SAI1PLL multiplication factor for VCO
  3372. * @rmtoll PLLSAI1CFGR PLLSAI1N LL_RCC_PLLSAI1_GetN
  3373. * @retval Between 8 and 86
  3374. */
  3375. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetN(void)
  3376. {
  3377. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N) >> RCC_PLLSAI1CFGR_PLLSAI1N_Pos);
  3378. }
  3379. /**
  3380. * @brief Get SAI1PLL division factor for PLLSAI1P
  3381. * @note Used for PLLSAI1CLK (SAI1 or SAI2 clock).
  3382. * @rmtoll PLLSAI1CFGR PLLSAI1PDIV LL_RCC_PLLSAI1_GetP
  3383. * @retval Returned value can be one of the following values:
  3384. * @arg @ref LL_RCC_PLLSAI1P_DIV_2
  3385. * @arg @ref LL_RCC_PLLSAI1P_DIV_3
  3386. * @arg @ref LL_RCC_PLLSAI1P_DIV_4
  3387. * @arg @ref LL_RCC_PLLSAI1P_DIV_5
  3388. * @arg @ref LL_RCC_PLLSAI1P_DIV_6
  3389. * @arg @ref LL_RCC_PLLSAI1P_DIV_7
  3390. * @arg @ref LL_RCC_PLLSAI1P_DIV_8
  3391. * @arg @ref LL_RCC_PLLSAI1P_DIV_9
  3392. * @arg @ref LL_RCC_PLLSAI1P_DIV_10
  3393. * @arg @ref LL_RCC_PLLSAI1P_DIV_11
  3394. * @arg @ref LL_RCC_PLLSAI1P_DIV_12
  3395. * @arg @ref LL_RCC_PLLSAI1P_DIV_13
  3396. * @arg @ref LL_RCC_PLLSAI1P_DIV_14
  3397. * @arg @ref LL_RCC_PLLSAI1P_DIV_15
  3398. * @arg @ref LL_RCC_PLLSAI1P_DIV_16
  3399. * @arg @ref LL_RCC_PLLSAI1P_DIV_17
  3400. * @arg @ref LL_RCC_PLLSAI1P_DIV_18
  3401. * @arg @ref LL_RCC_PLLSAI1P_DIV_19
  3402. * @arg @ref LL_RCC_PLLSAI1P_DIV_20
  3403. * @arg @ref LL_RCC_PLLSAI1P_DIV_21
  3404. * @arg @ref LL_RCC_PLLSAI1P_DIV_22
  3405. * @arg @ref LL_RCC_PLLSAI1P_DIV_23
  3406. * @arg @ref LL_RCC_PLLSAI1P_DIV_24
  3407. * @arg @ref LL_RCC_PLLSAI1P_DIV_25
  3408. * @arg @ref LL_RCC_PLLSAI1P_DIV_26
  3409. * @arg @ref LL_RCC_PLLSAI1P_DIV_27
  3410. * @arg @ref LL_RCC_PLLSAI1P_DIV_28
  3411. * @arg @ref LL_RCC_PLLSAI1P_DIV_29
  3412. * @arg @ref LL_RCC_PLLSAI1P_DIV_30
  3413. * @arg @ref LL_RCC_PLLSAI1P_DIV_31
  3414. */
  3415. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetP(void)
  3416. {
  3417. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PDIV));
  3418. }
  3419. /**
  3420. * @brief Get SAI1PLL division factor for PLLSAI1Q
  3421. * @note Used PLL48M2CLK selected for USB, RNG, SDMMC (48 MHz clock)
  3422. * @rmtoll PLLSAI1CFGR PLLSAI1Q LL_RCC_PLLSAI1_GetQ
  3423. * @retval Returned value can be one of the following values:
  3424. * @arg @ref LL_RCC_PLLSAI1Q_DIV_2
  3425. * @arg @ref LL_RCC_PLLSAI1Q_DIV_4
  3426. * @arg @ref LL_RCC_PLLSAI1Q_DIV_6
  3427. * @arg @ref LL_RCC_PLLSAI1Q_DIV_8
  3428. */
  3429. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetQ(void)
  3430. {
  3431. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1Q));
  3432. }
  3433. /**
  3434. * @brief Get PLLSAI1 division factor for PLLSAIR
  3435. * @note Used for PLLADC1CLK (ADC clock)
  3436. * @rmtoll PLLSAI1CFGR PLLSAI1R LL_RCC_PLLSAI1_GetR
  3437. * @retval Returned value can be one of the following values:
  3438. * @arg @ref LL_RCC_PLLSAI1R_DIV_2
  3439. * @arg @ref LL_RCC_PLLSAI1R_DIV_4
  3440. * @arg @ref LL_RCC_PLLSAI1R_DIV_6
  3441. * @arg @ref LL_RCC_PLLSAI1R_DIV_8
  3442. */
  3443. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetR(void)
  3444. {
  3445. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1R));
  3446. }
  3447. /**
  3448. * @brief Get Division factor for the PLLSAI1
  3449. * @rmtoll PLLSAI1CFGR PLLSAI1M LL_RCC_PLLSAI1_GetDivider
  3450. * @retval Returned value can be one of the following values:
  3451. * @arg @ref LL_RCC_PLLSAI1M_DIV_1
  3452. * @arg @ref LL_RCC_PLLSAI1M_DIV_2
  3453. * @arg @ref LL_RCC_PLLSAI1M_DIV_3
  3454. * @arg @ref LL_RCC_PLLSAI1M_DIV_4
  3455. * @arg @ref LL_RCC_PLLSAI1M_DIV_5
  3456. * @arg @ref LL_RCC_PLLSAI1M_DIV_6
  3457. * @arg @ref LL_RCC_PLLSAI1M_DIV_7
  3458. * @arg @ref LL_RCC_PLLSAI1M_DIV_8
  3459. * @arg @ref LL_RCC_PLLSAI1M_DIV_9
  3460. * @arg @ref LL_RCC_PLLSAI1M_DIV_10
  3461. * @arg @ref LL_RCC_PLLSAI1M_DIV_11
  3462. * @arg @ref LL_RCC_PLLSAI1M_DIV_12
  3463. * @arg @ref LL_RCC_PLLSAI1M_DIV_13
  3464. * @arg @ref LL_RCC_PLLSAI1M_DIV_14
  3465. * @arg @ref LL_RCC_PLLSAI1M_DIV_15
  3466. * @arg @ref LL_RCC_PLLSAI1M_DIV_16
  3467. */
  3468. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_GetDivider(void)
  3469. {
  3470. return (uint32_t)(READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1M));
  3471. }
  3472. /**
  3473. * @brief Enable PLLSAI1 output mapped on SAI domain clock
  3474. * @rmtoll PLLSAI1CFGR PLLSAI1PEN LL_RCC_PLLSAI1_EnableDomain_SAI
  3475. * @retval None
  3476. */
  3477. __STATIC_INLINE void LL_RCC_PLLSAI1_EnableDomain_SAI(void)
  3478. {
  3479. SET_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PEN);
  3480. }
  3481. /**
  3482. * @brief Disable PLLSAI1 output mapped on SAI domain clock
  3483. * @note In order to save power, when of the PLLSAI1 is
  3484. * not used, should be 0
  3485. * @rmtoll PLLSAI1CFGR PLLSAI1PEN LL_RCC_PLLSAI1_DisableDomain_SAI
  3486. * @retval None
  3487. */
  3488. __STATIC_INLINE void LL_RCC_PLLSAI1_DisableDomain_SAI(void)
  3489. {
  3490. CLEAR_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PEN);
  3491. }
  3492. /**
  3493. * @brief Check if PLLSAI1 output mapped on SAI domain clock is enabled
  3494. * @rmtoll PLLSAI1CFGR PLLSAI1PEN LL_RCC_PLLSAI1_IsEnabledDomain_SAI
  3495. * @retval State of bit (1 or 0).
  3496. */
  3497. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsEnabledDomain_SAI(void)
  3498. {
  3499. return ((READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PEN) == (RCC_PLLSAI1CFGR_PLLSAI1PEN)) ? 1UL : 0UL);
  3500. }
  3501. /**
  3502. * @brief Enable PLLSAI1 output mapped on 48MHz domain clock
  3503. * @rmtoll PLLSAI1CFGR PLLSAI1QEN LL_RCC_PLLSAI1_EnableDomain_48M
  3504. * @retval None
  3505. */
  3506. __STATIC_INLINE void LL_RCC_PLLSAI1_EnableDomain_48M(void)
  3507. {
  3508. SET_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1QEN);
  3509. }
  3510. /**
  3511. * @brief Disable PLLSAI1 output mapped on 48MHz domain clock
  3512. * @note In order to save power, when of the PLLSAI1 is
  3513. * not used, should be 0
  3514. * @rmtoll PLLSAI1CFGR PLLSAI1QEN LL_RCC_PLLSAI1_DisableDomain_48M
  3515. * @retval None
  3516. */
  3517. __STATIC_INLINE void LL_RCC_PLLSAI1_DisableDomain_48M(void)
  3518. {
  3519. CLEAR_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1QEN);
  3520. }
  3521. /**
  3522. * @brief Check if PLLSAI1 output mapped on 48MHz domain clock is enabled
  3523. * @rmtoll PLLSAI1CFGR PLLSAI1QEN LL_RCC_PLLSAI1_IsEnabledDomain_48M
  3524. * @retval State of bit (1 or 0).
  3525. */
  3526. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsEnabledDomain_48M(void)
  3527. {
  3528. return ((READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1QEN) == (RCC_PLLSAI1CFGR_PLLSAI1QEN)) ? 1UL : 0UL);
  3529. }
  3530. /**
  3531. * @brief Enable PLLSAI1 output mapped on ADC domain clock
  3532. * @rmtoll PLLSAI1CFGR PLLSAI1REN LL_RCC_PLLSAI1_EnableDomain_ADC
  3533. * @retval None
  3534. */
  3535. __STATIC_INLINE void LL_RCC_PLLSAI1_EnableDomain_ADC(void)
  3536. {
  3537. SET_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1REN);
  3538. }
  3539. /**
  3540. * @brief Disable PLLSAI1 output mapped on ADC domain clock
  3541. * @note In order to save power, when of the PLLSAI1 is
  3542. * not used, Main PLLSAI1 should be 0
  3543. * @rmtoll PLLSAI1CFGR PLLSAI1REN LL_RCC_PLLSAI1_DisableDomain_ADC
  3544. * @retval None
  3545. */
  3546. __STATIC_INLINE void LL_RCC_PLLSAI1_DisableDomain_ADC(void)
  3547. {
  3548. CLEAR_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1REN);
  3549. }
  3550. /**
  3551. * @brief Check if PLLSAI1 output mapped on ADC domain clock is enabled
  3552. * @rmtoll PLLSAI1CFGR PLLSAI1REN LL_RCC_PLLSAI1_IsEnabledDomain_ADC
  3553. * @retval State of bit (1 or 0).
  3554. */
  3555. __STATIC_INLINE uint32_t LL_RCC_PLLSAI1_IsEnabledDomain_ADC(void)
  3556. {
  3557. return ((READ_BIT(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1REN) == (RCC_PLLSAI1CFGR_PLLSAI1REN)) ? 1UL : 0UL);
  3558. }
  3559. /**
  3560. * @}
  3561. */
  3562. /** @defgroup RCC_LL_EF_PLLSAI2 PLLSAI2
  3563. * @{
  3564. */
  3565. /**
  3566. * @brief Enable PLLSAI2
  3567. * @rmtoll CR PLLSAI2ON LL_RCC_PLLSAI2_Enable
  3568. * @retval None
  3569. */
  3570. __STATIC_INLINE void LL_RCC_PLLSAI2_Enable(void)
  3571. {
  3572. SET_BIT(RCC->CR, RCC_CR_PLLSAI2ON);
  3573. }
  3574. /**
  3575. * @brief Disable PLLSAI2
  3576. * @rmtoll CR PLLSAI2ON LL_RCC_PLLSAI2_Disable
  3577. * @retval None
  3578. */
  3579. __STATIC_INLINE void LL_RCC_PLLSAI2_Disable(void)
  3580. {
  3581. CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI2ON);
  3582. }
  3583. /**
  3584. * @brief Check if PLLSAI2 Ready
  3585. * @rmtoll CR PLLSAI2RDY LL_RCC_PLLSAI2_IsReady
  3586. * @retval State of bit (1 or 0).
  3587. */
  3588. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsReady(void)
  3589. {
  3590. return ((READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) == RCC_CR_PLLSAI2RDY) ? 1UL : 0UL);
  3591. }
  3592. /**
  3593. * @brief Configure PLLSAI2 used for SAI domain clock
  3594. * @note PLLSAI2SRC/PLLSAI2M/PLLSAI2N/PLLSAI2PDIV can be written only when PLLSAI2 is disabled.
  3595. * @note This can be selected for SAI1 or SAI2
  3596. * @rmtoll PLLSAI2CFGR PLLSAI2SRC LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  3597. * PLLSAI2CFGR PLLSAI2M LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  3598. * PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_ConfigDomain_SAI\n
  3599. * PLLSAI2CFGR PLLSAI2PDIV LL_RCC_PLLSAI2_ConfigDomain_SAI
  3600. * @param Source This parameter can be one of the following values:
  3601. * @arg @ref LL_RCC_PLLSAI2SOURCE_NONE
  3602. * @arg @ref LL_RCC_PLLSAI2SOURCE_MSI
  3603. * @arg @ref LL_RCC_PLLSAI2SOURCE_HSI
  3604. * @arg @ref LL_RCC_PLLSAI2SOURCE_HSE
  3605. * @param PLLM This parameter can be one of the following values:
  3606. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  3607. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  3608. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  3609. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  3610. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  3611. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  3612. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  3613. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  3614. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  3615. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  3616. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  3617. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  3618. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  3619. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  3620. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  3621. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  3622. * @param PLLN Between 8 and 86
  3623. * @param PLLP This parameter can be one of the following values:
  3624. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  3625. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  3626. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  3627. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  3628. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  3629. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  3630. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  3631. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  3632. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  3633. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  3634. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  3635. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  3636. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  3637. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  3638. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  3639. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  3640. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  3641. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  3642. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  3643. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  3644. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  3645. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  3646. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  3647. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  3648. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  3649. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  3650. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  3651. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  3652. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  3653. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  3654. * @retval None
  3655. */
  3656. __STATIC_INLINE void LL_RCC_PLLSAI2_ConfigDomain_SAI(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  3657. {
  3658. MODIFY_REG(RCC->PLLSAI2CFGR,
  3659. RCC_PLLSAI2CFGR_PLLSAI2SRC | RCC_PLLSAI2CFGR_PLLSAI2M | RCC_PLLSAI2CFGR_PLLSAI2N | RCC_PLLSAI2CFGR_PLLSAI2PDIV,
  3660. Source | PLLM | (PLLN << RCC_PLLSAI2CFGR_PLLSAI2N_Pos) | PLLP);
  3661. }
  3662. /**
  3663. * @brief Configure PLLSAI2 clock source
  3664. * @rmtoll PLLSAI2CFGR PLLSAI2SRC LL_RCC_PLLSAI2_SetSource
  3665. * @param PLLSource This parameter can be one of the following values:
  3666. * @arg @ref LL_RCC_PLLSAI2SOURCE_NONE
  3667. * @arg @ref LL_RCC_PLLSAI2SOURCE_MSI
  3668. * @arg @ref LL_RCC_PLLSAI2SOURCE_HSI
  3669. * @arg @ref LL_RCC_PLLSAI2SOURCE_HSE
  3670. * @retval None
  3671. */
  3672. __STATIC_INLINE void LL_RCC_PLLSAI2_SetSource(uint32_t PLLSource)
  3673. {
  3674. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2SRC, PLLSource);
  3675. }
  3676. /**
  3677. * @brief Get the oscillator used as PLLSAI2 clock source.
  3678. * @rmtoll PLLSAI2CFGR PLLSAI2SRC LL_RCC_PLLSAI2_GetSource
  3679. * @retval Returned value can be one of the following values:
  3680. * @arg @ref LL_RCC_PLLSAI2SOURCE_NONE
  3681. * @arg @ref LL_RCC_PLLSAI2SOURCE_MSI
  3682. * @arg @ref LL_RCC_PLLSAI2SOURCE_HSI
  3683. * @arg @ref LL_RCC_PLLSAI2SOURCE_HSE
  3684. */
  3685. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetSource(void)
  3686. {
  3687. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2SRC));
  3688. }
  3689. /**
  3690. * @brief Get SAI2PLL multiplication factor for VCO
  3691. * @rmtoll PLLSAI2CFGR PLLSAI2N LL_RCC_PLLSAI2_GetN
  3692. * @retval Between 8 and 86
  3693. */
  3694. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetN(void)
  3695. {
  3696. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N) >> RCC_PLLSAI2CFGR_PLLSAI2N_Pos);
  3697. }
  3698. /**
  3699. * @brief Get SAI2PLL division factor for PLLSAI2P
  3700. * @note Used for PLLSAI2CLK (SAI1 or SAI2 clock).
  3701. * @rmtoll PLLSAI2CFGR PLLSAI2PDIV LL_RCC_PLLSAI2_GetP
  3702. * @retval Returned value can be one of the following values:
  3703. * @arg @ref LL_RCC_PLLSAI2P_DIV_2
  3704. * @arg @ref LL_RCC_PLLSAI2P_DIV_3
  3705. * @arg @ref LL_RCC_PLLSAI2P_DIV_4
  3706. * @arg @ref LL_RCC_PLLSAI2P_DIV_5
  3707. * @arg @ref LL_RCC_PLLSAI2P_DIV_6
  3708. * @arg @ref LL_RCC_PLLSAI2P_DIV_7
  3709. * @arg @ref LL_RCC_PLLSAI2P_DIV_8
  3710. * @arg @ref LL_RCC_PLLSAI2P_DIV_9
  3711. * @arg @ref LL_RCC_PLLSAI2P_DIV_10
  3712. * @arg @ref LL_RCC_PLLSAI2P_DIV_11
  3713. * @arg @ref LL_RCC_PLLSAI2P_DIV_12
  3714. * @arg @ref LL_RCC_PLLSAI2P_DIV_13
  3715. * @arg @ref LL_RCC_PLLSAI2P_DIV_14
  3716. * @arg @ref LL_RCC_PLLSAI2P_DIV_15
  3717. * @arg @ref LL_RCC_PLLSAI2P_DIV_16
  3718. * @arg @ref LL_RCC_PLLSAI2P_DIV_17
  3719. * @arg @ref LL_RCC_PLLSAI2P_DIV_18
  3720. * @arg @ref LL_RCC_PLLSAI2P_DIV_19
  3721. * @arg @ref LL_RCC_PLLSAI2P_DIV_20
  3722. * @arg @ref LL_RCC_PLLSAI2P_DIV_21
  3723. * @arg @ref LL_RCC_PLLSAI2P_DIV_22
  3724. * @arg @ref LL_RCC_PLLSAI2P_DIV_23
  3725. * @arg @ref LL_RCC_PLLSAI2P_DIV_24
  3726. * @arg @ref LL_RCC_PLLSAI2P_DIV_25
  3727. * @arg @ref LL_RCC_PLLSAI2P_DIV_26
  3728. * @arg @ref LL_RCC_PLLSAI2P_DIV_27
  3729. * @arg @ref LL_RCC_PLLSAI2P_DIV_28
  3730. * @arg @ref LL_RCC_PLLSAI2P_DIV_29
  3731. * @arg @ref LL_RCC_PLLSAI2P_DIV_30
  3732. * @arg @ref LL_RCC_PLLSAI2P_DIV_31
  3733. */
  3734. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetP(void)
  3735. {
  3736. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PDIV));
  3737. }
  3738. /**
  3739. * @brief Get Division factor for the PLLSAI2
  3740. * @rmtoll PLLSAI2CFGR PLLSAI2M LL_RCC_PLLSAI2_GetDivider
  3741. * @retval Returned value can be one of the following values:
  3742. * @arg @ref LL_RCC_PLLSAI2M_DIV_1
  3743. * @arg @ref LL_RCC_PLLSAI2M_DIV_2
  3744. * @arg @ref LL_RCC_PLLSAI2M_DIV_3
  3745. * @arg @ref LL_RCC_PLLSAI2M_DIV_4
  3746. * @arg @ref LL_RCC_PLLSAI2M_DIV_5
  3747. * @arg @ref LL_RCC_PLLSAI2M_DIV_6
  3748. * @arg @ref LL_RCC_PLLSAI2M_DIV_7
  3749. * @arg @ref LL_RCC_PLLSAI2M_DIV_8
  3750. * @arg @ref LL_RCC_PLLSAI2M_DIV_9
  3751. * @arg @ref LL_RCC_PLLSAI2M_DIV_10
  3752. * @arg @ref LL_RCC_PLLSAI2M_DIV_11
  3753. * @arg @ref LL_RCC_PLLSAI2M_DIV_12
  3754. * @arg @ref LL_RCC_PLLSAI2M_DIV_13
  3755. * @arg @ref LL_RCC_PLLSAI2M_DIV_14
  3756. * @arg @ref LL_RCC_PLLSAI2M_DIV_15
  3757. * @arg @ref LL_RCC_PLLSAI2M_DIV_16
  3758. */
  3759. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_GetDivider(void)
  3760. {
  3761. return (uint32_t)(READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2M));
  3762. }
  3763. /**
  3764. * @brief Enable PLLSAI2 output mapped on SAI domain clock
  3765. * @rmtoll PLLSAI2CFGR PLLSAI2PEN LL_RCC_PLLSAI2_EnableDomain_SAI
  3766. * @retval None
  3767. */
  3768. __STATIC_INLINE void LL_RCC_PLLSAI2_EnableDomain_SAI(void)
  3769. {
  3770. SET_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PEN);
  3771. }
  3772. /**
  3773. * @brief Disable PLLSAI2 output mapped on SAI domain clock
  3774. * @note In order to save power, when of the PLLSAI2 is
  3775. * not used, should be 0
  3776. * @rmtoll PLLSAI2CFGR PLLSAI2PEN LL_RCC_PLLSAI2_DisableDomain_SAI
  3777. * @retval None
  3778. */
  3779. __STATIC_INLINE void LL_RCC_PLLSAI2_DisableDomain_SAI(void)
  3780. {
  3781. CLEAR_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PEN);
  3782. }
  3783. /**
  3784. * @brief Check if PLLSAI2 output mapped on SAI domain clock is enabled
  3785. * @rmtoll PLLSAI2CFGR PLLSAI2PEN LL_RCC_PLLSAI2_IsEnabledDomain_SAI
  3786. * @retval State of bit (1 or 0).
  3787. */
  3788. __STATIC_INLINE uint32_t LL_RCC_PLLSAI2_IsEnabledDomain_SAI(void)
  3789. {
  3790. return ((READ_BIT(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2PEN) == (RCC_PLLSAI2CFGR_PLLSAI2PEN)) ? 1UL : 0UL);
  3791. }
  3792. /**
  3793. * @}
  3794. */
  3795. /** @defgroup RCC_LL_EF_PRIV Privileged mode
  3796. * @{
  3797. */
  3798. /**
  3799. * @brief Enable Privileged mode
  3800. * @rmtoll CR PRIV LL_RCC_EnablePrivilege
  3801. * @retval None
  3802. */
  3803. __STATIC_INLINE void LL_RCC_EnablePrivilege(void)
  3804. {
  3805. SET_BIT(RCC->CR, RCC_CR_PRIV);
  3806. }
  3807. /**
  3808. * @brief Disable Privileged mode
  3809. * @rmtoll CR PRIV LL_RCC_DisablePrivilege
  3810. * @retval None
  3811. */
  3812. __STATIC_INLINE void LL_RCC_DisablePrivilege(void)
  3813. {
  3814. CLEAR_BIT(RCC->CR, RCC_CR_PRIV);
  3815. }
  3816. /**
  3817. * @brief Check if Privileged mode has been enabled or not
  3818. * @rmtoll CR PRIV LL_RCC_IsEnabledPrivilege
  3819. * @retval State of bit (1 or 0).
  3820. */
  3821. __STATIC_INLINE uint32_t LL_RCC_IsEnabledPrivilege(void)
  3822. {
  3823. return ((READ_BIT(RCC->CR, RCC_CR_PRIV) == RCC_CR_PRIV) ? 1UL : 0UL);
  3824. }
  3825. /**
  3826. * @}
  3827. */
  3828. /** @defgroup RCC_LL_EF_FLAG_Management FLAG Management
  3829. * @{
  3830. */
  3831. /**
  3832. * @brief Clear LSI ready interrupt flag
  3833. * @rmtoll CICR LSIRDYC LL_RCC_ClearFlag_LSIRDY
  3834. * @retval None
  3835. */
  3836. __STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void)
  3837. {
  3838. SET_BIT(RCC->CICR, RCC_CICR_LSIRDYC);
  3839. }
  3840. /**
  3841. * @brief Clear LSE ready interrupt flag
  3842. * @rmtoll CICR LSERDYC LL_RCC_ClearFlag_LSERDY
  3843. * @retval None
  3844. */
  3845. __STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void)
  3846. {
  3847. SET_BIT(RCC->CICR, RCC_CICR_LSERDYC);
  3848. }
  3849. /**
  3850. * @brief Clear MSI ready interrupt flag
  3851. * @rmtoll CICR MSIRDYC LL_RCC_ClearFlag_MSIRDY
  3852. * @retval None
  3853. */
  3854. __STATIC_INLINE void LL_RCC_ClearFlag_MSIRDY(void)
  3855. {
  3856. SET_BIT(RCC->CICR, RCC_CICR_MSIRDYC);
  3857. }
  3858. /**
  3859. * @brief Clear HSI ready interrupt flag
  3860. * @rmtoll CICR HSIRDYC LL_RCC_ClearFlag_HSIRDY
  3861. * @retval None
  3862. */
  3863. __STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void)
  3864. {
  3865. SET_BIT(RCC->CICR, RCC_CICR_HSIRDYC);
  3866. }
  3867. /**
  3868. * @brief Clear HSE ready interrupt flag
  3869. * @rmtoll CICR HSERDYC LL_RCC_ClearFlag_HSERDY
  3870. * @retval None
  3871. */
  3872. __STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void)
  3873. {
  3874. SET_BIT(RCC->CICR, RCC_CICR_HSERDYC);
  3875. }
  3876. /**
  3877. * @brief Clear PLL ready interrupt flag
  3878. * @rmtoll CICR PLLRDYC LL_RCC_ClearFlag_PLLRDY
  3879. * @retval None
  3880. */
  3881. __STATIC_INLINE void LL_RCC_ClearFlag_PLLRDY(void)
  3882. {
  3883. SET_BIT(RCC->CICR, RCC_CICR_PLLRDYC);
  3884. }
  3885. /**
  3886. * @brief Clear HSI48 ready interrupt flag
  3887. * @rmtoll CICR HSI48RDYC LL_RCC_ClearFlag_HSI48RDY
  3888. * @retval None
  3889. */
  3890. __STATIC_INLINE void LL_RCC_ClearFlag_HSI48RDY(void)
  3891. {
  3892. SET_BIT(RCC->CICR, RCC_CICR_HSI48RDYC);
  3893. }
  3894. /**
  3895. * @brief Clear PLLSAI1 ready interrupt flag
  3896. * @rmtoll CICR PLLSAI1RDYC LL_RCC_ClearFlag_PLLSAI1RDY
  3897. * @retval None
  3898. */
  3899. __STATIC_INLINE void LL_RCC_ClearFlag_PLLSAI1RDY(void)
  3900. {
  3901. SET_BIT(RCC->CICR, RCC_CICR_PLLSAI1RDYC);
  3902. }
  3903. /**
  3904. * @brief Clear PLLSAI1 ready interrupt flag
  3905. * @rmtoll CICR PLLSAI2RDYC LL_RCC_ClearFlag_PLLSAI2RDY
  3906. * @retval None
  3907. */
  3908. __STATIC_INLINE void LL_RCC_ClearFlag_PLLSAI2RDY(void)
  3909. {
  3910. SET_BIT(RCC->CICR, RCC_CICR_PLLSAI2RDYC);
  3911. }
  3912. /**
  3913. * @brief Clear Clock security system interrupt flag
  3914. * @rmtoll CICR CSSC LL_RCC_ClearFlag_HSECSS
  3915. * @retval None
  3916. */
  3917. __STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void)
  3918. {
  3919. SET_BIT(RCC->CICR, RCC_CICR_CSSC);
  3920. }
  3921. /**
  3922. * @brief Check if LSI ready interrupt occurred or not
  3923. * @rmtoll CIFR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY
  3924. * @retval State of bit (1 or 0).
  3925. */
  3926. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void)
  3927. {
  3928. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSIRDYF) == RCC_CIFR_LSIRDYF) ? 1UL : 0UL);
  3929. }
  3930. /**
  3931. * @brief Check if LSE ready interrupt occurred or not
  3932. * @rmtoll CIFR LSERDYF LL_RCC_IsActiveFlag_LSERDY
  3933. * @retval State of bit (1 or 0).
  3934. */
  3935. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void)
  3936. {
  3937. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSERDYF) == RCC_CIFR_LSERDYF) ? 1UL : 0UL);
  3938. }
  3939. /**
  3940. * @brief Check if MSI ready interrupt occurred or not
  3941. * @rmtoll CIFR MSIRDYF LL_RCC_IsActiveFlag_MSIRDY
  3942. * @retval State of bit (1 or 0).
  3943. */
  3944. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_MSIRDY(void)
  3945. {
  3946. return ((READ_BIT(RCC->CIFR, RCC_CIFR_MSIRDYF) == RCC_CIFR_MSIRDYF) ? 1UL : 0UL);
  3947. }
  3948. /**
  3949. * @brief Check if HSI ready interrupt occurred or not
  3950. * @rmtoll CIFR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY
  3951. * @retval State of bit (1 or 0).
  3952. */
  3953. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void)
  3954. {
  3955. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSIRDYF) == RCC_CIFR_HSIRDYF) ? 1UL : 0UL);
  3956. }
  3957. /**
  3958. * @brief Check if HSE ready interrupt occurred or not
  3959. * @rmtoll CIFR HSERDYF LL_RCC_IsActiveFlag_HSERDY
  3960. * @retval State of bit (1 or 0).
  3961. */
  3962. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void)
  3963. {
  3964. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSERDYF) == RCC_CIFR_HSERDYF) ? 1UL : 0UL);
  3965. }
  3966. /**
  3967. * @brief Check if PLL ready interrupt occurred or not
  3968. * @rmtoll CIFR PLLRDYF LL_RCC_IsActiveFlag_PLLRDY
  3969. * @retval State of bit (1 or 0).
  3970. */
  3971. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLRDY(void)
  3972. {
  3973. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLRDYF) == RCC_CIFR_PLLRDYF) ? 1UL : 0UL);
  3974. }
  3975. /**
  3976. * @brief Check if HSI48 ready interrupt occurred or not
  3977. * @rmtoll CIFR HSI48RDYF LL_RCC_IsActiveFlag_HSI48RDY
  3978. * @retval State of bit (1 or 0).
  3979. */
  3980. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSI48RDY(void)
  3981. {
  3982. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSI48RDYF) == RCC_CIFR_HSI48RDYF) ? 1UL : 0UL);
  3983. }
  3984. /**
  3985. * @brief Check if PLLSAI1 ready interrupt occurred or not
  3986. * @rmtoll CIFR PLLSAI1RDYF LL_RCC_IsActiveFlag_PLLSAI1RDY
  3987. * @retval State of bit (1 or 0).
  3988. */
  3989. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLSAI1RDY(void)
  3990. {
  3991. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI1RDYF) == RCC_CIFR_PLLSAI1RDYF) ? 1UL : 0UL);
  3992. }
  3993. /**
  3994. * @brief Check if PLLSAI1 ready interrupt occurred or not
  3995. * @rmtoll CIFR PLLSAI2RDYF LL_RCC_IsActiveFlag_PLLSAI2RDY
  3996. * @retval State of bit (1 or 0).
  3997. */
  3998. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLSAI2RDY(void)
  3999. {
  4000. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI2RDYF) == RCC_CIFR_PLLSAI2RDYF) ? 1UL : 0UL);
  4001. }
  4002. /**
  4003. * @brief Check if Clock security system interrupt occurred or not
  4004. * @rmtoll CIFR CSSF LL_RCC_IsActiveFlag_HSECSS
  4005. * @retval State of bit (1 or 0).
  4006. */
  4007. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void)
  4008. {
  4009. return ((READ_BIT(RCC->CIFR, RCC_CIFR_CSSF) == RCC_CIFR_CSSF) ? 1UL : 0UL);
  4010. }
  4011. /**
  4012. * @brief Check if RCC flag Independent Watchdog reset is set or not.
  4013. * @rmtoll CSR IWDGRSTF LL_RCC_IsActiveFlag_IWDGRST
  4014. * @retval State of bit (1 or 0).
  4015. */
  4016. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDGRST(void)
  4017. {
  4018. return ((READ_BIT(RCC->CSR, RCC_CSR_IWDGRSTF) == RCC_CSR_IWDGRSTF) ? 1UL : 0UL);
  4019. }
  4020. /**
  4021. * @brief Check if RCC flag Low Power reset is set or not.
  4022. * @rmtoll CSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST
  4023. * @retval State of bit (1 or 0).
  4024. */
  4025. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void)
  4026. {
  4027. return ((READ_BIT(RCC->CSR, RCC_CSR_LPWRRSTF) == RCC_CSR_LPWRRSTF) ? 1UL : 0UL);
  4028. }
  4029. /**
  4030. * @brief Check if RCC flag is set or not.
  4031. * @rmtoll CSR OBLRSTF LL_RCC_IsActiveFlag_OBLRST
  4032. * @retval State of bit (1 or 0).
  4033. */
  4034. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_OBLRST(void)
  4035. {
  4036. return ((READ_BIT(RCC->CSR, RCC_CSR_OBLRSTF) == RCC_CSR_OBLRSTF) ? 1UL : 0UL);
  4037. }
  4038. /**
  4039. * @brief Check if RCC flag Pin reset is set or not.
  4040. * @rmtoll CSR PINRSTF LL_RCC_IsActiveFlag_PINRST
  4041. * @retval State of bit (1 or 0).
  4042. */
  4043. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void)
  4044. {
  4045. return ((READ_BIT(RCC->CSR, RCC_CSR_PINRSTF) == RCC_CSR_PINRSTF) ? 1UL : 0UL);
  4046. }
  4047. /**
  4048. * @brief Check if RCC flag Software reset is set or not.
  4049. * @rmtoll CSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST
  4050. * @retval State of bit (1 or 0).
  4051. */
  4052. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void)
  4053. {
  4054. return ((READ_BIT(RCC->CSR, RCC_CSR_SFTRSTF) == RCC_CSR_SFTRSTF) ? 1UL : 0UL);
  4055. }
  4056. /**
  4057. * @brief Check if RCC flag Window Watchdog reset is set or not.
  4058. * @rmtoll CSR WWDGRSTF LL_RCC_IsActiveFlag_WWDGRST
  4059. * @retval State of bit (1 or 0).
  4060. */
  4061. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDGRST(void)
  4062. {
  4063. return ((READ_BIT(RCC->CSR, RCC_CSR_WWDGRSTF) == RCC_CSR_WWDGRSTF) ? 1UL : 0UL);
  4064. }
  4065. /**
  4066. * @brief Check if RCC flag BOR reset is set or not.
  4067. * @rmtoll CSR BORRSTF LL_RCC_IsActiveFlag_BORRST
  4068. * @retval State of bit (1 or 0).
  4069. */
  4070. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_BORRST(void)
  4071. {
  4072. return ((READ_BIT(RCC->CSR, RCC_CSR_BORRSTF) == RCC_CSR_BORRSTF) ? 1UL : 0UL);
  4073. }
  4074. /**
  4075. * @brief Set RMVF bit to clear the reset flags.
  4076. * @rmtoll CSR RMVF LL_RCC_ClearResetFlags
  4077. * @retval None
  4078. */
  4079. __STATIC_INLINE void LL_RCC_ClearResetFlags(void)
  4080. {
  4081. SET_BIT(RCC->CSR, RCC_CSR_RMVF);
  4082. }
  4083. /**
  4084. * @}
  4085. */
  4086. /** @defgroup RCC_LL_EF_IT_Management IT Management
  4087. * @{
  4088. */
  4089. /**
  4090. * @brief Enable LSI ready interrupt
  4091. * @rmtoll CIER LSIRDYIE LL_RCC_EnableIT_LSIRDY
  4092. * @retval None
  4093. */
  4094. __STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void)
  4095. {
  4096. SET_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  4097. }
  4098. /**
  4099. * @brief Enable LSE ready interrupt
  4100. * @rmtoll CIER LSERDYIE LL_RCC_EnableIT_LSERDY
  4101. * @retval None
  4102. */
  4103. __STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void)
  4104. {
  4105. SET_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  4106. }
  4107. /**
  4108. * @brief Enable MSI ready interrupt
  4109. * @rmtoll CIER MSIRDYIE LL_RCC_EnableIT_MSIRDY
  4110. * @retval None
  4111. */
  4112. __STATIC_INLINE void LL_RCC_EnableIT_MSIRDY(void)
  4113. {
  4114. SET_BIT(RCC->CIER, RCC_CIER_MSIRDYIE);
  4115. }
  4116. /**
  4117. * @brief Enable HSI ready interrupt
  4118. * @rmtoll CIER HSIRDYIE LL_RCC_EnableIT_HSIRDY
  4119. * @retval None
  4120. */
  4121. __STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void)
  4122. {
  4123. SET_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  4124. }
  4125. /**
  4126. * @brief Enable HSE ready interrupt
  4127. * @rmtoll CIER HSERDYIE LL_RCC_EnableIT_HSERDY
  4128. * @retval None
  4129. */
  4130. __STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void)
  4131. {
  4132. SET_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  4133. }
  4134. /**
  4135. * @brief Enable PLL ready interrupt
  4136. * @rmtoll CIER PLLRDYIE LL_RCC_EnableIT_PLLRDY
  4137. * @retval None
  4138. */
  4139. __STATIC_INLINE void LL_RCC_EnableIT_PLLRDY(void)
  4140. {
  4141. SET_BIT(RCC->CIER, RCC_CIER_PLLRDYIE);
  4142. }
  4143. /**
  4144. * @brief Enable HSI48 ready interrupt
  4145. * @rmtoll CIER HSI48RDYIE LL_RCC_EnableIT_HSI48RDY
  4146. * @retval None
  4147. */
  4148. __STATIC_INLINE void LL_RCC_EnableIT_HSI48RDY(void)
  4149. {
  4150. SET_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  4151. }
  4152. /**
  4153. * @brief Enable PLLSAI1 ready interrupt
  4154. * @rmtoll CIER PLLSAI1RDYIE LL_RCC_EnableIT_PLLSAI1RDY
  4155. * @retval None
  4156. */
  4157. __STATIC_INLINE void LL_RCC_EnableIT_PLLSAI1RDY(void)
  4158. {
  4159. SET_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE);
  4160. }
  4161. /**
  4162. * @brief Enable PLLSAI2 ready interrupt
  4163. * @rmtoll CIER PLLSAI2RDYIE LL_RCC_EnableIT_PLLSAI2RDY
  4164. * @retval None
  4165. */
  4166. __STATIC_INLINE void LL_RCC_EnableIT_PLLSAI2RDY(void)
  4167. {
  4168. SET_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE);
  4169. }
  4170. /**
  4171. * @brief Disable LSI ready interrupt
  4172. * @rmtoll CIER LSIRDYIE LL_RCC_DisableIT_LSIRDY
  4173. * @retval None
  4174. */
  4175. __STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void)
  4176. {
  4177. CLEAR_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  4178. }
  4179. /**
  4180. * @brief Disable LSE ready interrupt
  4181. * @rmtoll CIER LSERDYIE LL_RCC_DisableIT_LSERDY
  4182. * @retval None
  4183. */
  4184. __STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void)
  4185. {
  4186. CLEAR_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  4187. }
  4188. /**
  4189. * @brief Disable MSI ready interrupt
  4190. * @rmtoll CIER MSIRDYIE LL_RCC_DisableIT_MSIRDY
  4191. * @retval None
  4192. */
  4193. __STATIC_INLINE void LL_RCC_DisableIT_MSIRDY(void)
  4194. {
  4195. CLEAR_BIT(RCC->CIER, RCC_CIER_MSIRDYIE);
  4196. }
  4197. /**
  4198. * @brief Disable HSI ready interrupt
  4199. * @rmtoll CIER HSIRDYIE LL_RCC_DisableIT_HSIRDY
  4200. * @retval None
  4201. */
  4202. __STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void)
  4203. {
  4204. CLEAR_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  4205. }
  4206. /**
  4207. * @brief Disable HSE ready interrupt
  4208. * @rmtoll CIER HSERDYIE LL_RCC_DisableIT_HSERDY
  4209. * @retval None
  4210. */
  4211. __STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void)
  4212. {
  4213. CLEAR_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  4214. }
  4215. /**
  4216. * @brief Disable PLL ready interrupt
  4217. * @rmtoll CIER PLLRDYIE LL_RCC_DisableIT_PLLRDY
  4218. * @retval None
  4219. */
  4220. __STATIC_INLINE void LL_RCC_DisableIT_PLLRDY(void)
  4221. {
  4222. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLRDYIE);
  4223. }
  4224. /**
  4225. * @brief Disable HSI48 ready interrupt
  4226. * @rmtoll CIER HSI48RDYIE LL_RCC_DisableIT_HSI48RDY
  4227. * @retval None
  4228. */
  4229. __STATIC_INLINE void LL_RCC_DisableIT_HSI48RDY(void)
  4230. {
  4231. CLEAR_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  4232. }
  4233. /**
  4234. * @brief Disable PLLSAI1 ready interrupt
  4235. * @rmtoll CIER PLLSAI1RDYIE LL_RCC_DisableIT_PLLSAI1RDY
  4236. * @retval None
  4237. */
  4238. __STATIC_INLINE void LL_RCC_DisableIT_PLLSAI1RDY(void)
  4239. {
  4240. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE);
  4241. }
  4242. /**
  4243. * @brief Disable PLLSAI2 ready interrupt
  4244. * @rmtoll CIER PLLSAI2RDYIE LL_RCC_DisableIT_PLLSAI2RDY
  4245. * @retval None
  4246. */
  4247. __STATIC_INLINE void LL_RCC_DisableIT_PLLSAI2RDY(void)
  4248. {
  4249. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE);
  4250. }
  4251. /**
  4252. * @brief Checks if LSI ready interrupt source is enabled or disabled.
  4253. * @rmtoll CIER LSIRDYIE LL_RCC_IsEnabledIT_LSIRDY
  4254. * @retval State of bit (1 or 0).
  4255. */
  4256. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSIRDY(void)
  4257. {
  4258. return ((READ_BIT(RCC->CIER, RCC_CIER_LSIRDYIE) == RCC_CIER_LSIRDYIE) ? 1UL : 0UL);
  4259. }
  4260. /**
  4261. * @brief Checks if LSE ready interrupt source is enabled or disabled.
  4262. * @rmtoll CIER LSERDYIE LL_RCC_IsEnabledIT_LSERDY
  4263. * @retval State of bit (1 or 0).
  4264. */
  4265. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSERDY(void)
  4266. {
  4267. return ((READ_BIT(RCC->CIER, RCC_CIER_LSERDYIE) == RCC_CIER_LSERDYIE) ? 1UL : 0UL);
  4268. }
  4269. /**
  4270. * @brief Checks if MSI ready interrupt source is enabled or disabled.
  4271. * @rmtoll CIER MSIRDYIE LL_RCC_IsEnabledIT_MSIRDY
  4272. * @retval State of bit (1 or 0).
  4273. */
  4274. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_MSIRDY(void)
  4275. {
  4276. return ((READ_BIT(RCC->CIER, RCC_CIER_MSIRDYIE) == RCC_CIER_MSIRDYIE) ? 1UL : 0UL);
  4277. }
  4278. /**
  4279. * @brief Checks if HSI ready interrupt source is enabled or disabled.
  4280. * @rmtoll CIER HSIRDYIE LL_RCC_IsEnabledIT_HSIRDY
  4281. * @retval State of bit (1 or 0).
  4282. */
  4283. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSIRDY(void)
  4284. {
  4285. return ((READ_BIT(RCC->CIER, RCC_CIER_HSIRDYIE) == RCC_CIER_HSIRDYIE) ? 1UL : 0UL);
  4286. }
  4287. /**
  4288. * @brief Checks if HSE ready interrupt source is enabled or disabled.
  4289. * @rmtoll CIER HSERDYIE LL_RCC_IsEnabledIT_HSERDY
  4290. * @retval State of bit (1 or 0).
  4291. */
  4292. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSERDY(void)
  4293. {
  4294. return ((READ_BIT(RCC->CIER, RCC_CIER_HSERDYIE) == RCC_CIER_HSERDYIE) ? 1UL : 0UL);
  4295. }
  4296. /**
  4297. * @brief Checks if PLL ready interrupt source is enabled or disabled.
  4298. * @rmtoll CIER PLLRDYIE LL_RCC_IsEnabledIT_PLLRDY
  4299. * @retval State of bit (1 or 0).
  4300. */
  4301. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLRDY(void)
  4302. {
  4303. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLRDYIE) == RCC_CIER_PLLRDYIE) ? 1UL : 0UL);
  4304. }
  4305. /**
  4306. * @brief Checks if HSI48 ready interrupt source is enabled or disabled.
  4307. * @rmtoll CIER HSI48RDYIE LL_RCC_IsEnabledIT_HSI48RDY
  4308. * @retval State of bit (1 or 0).
  4309. */
  4310. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSI48RDY(void)
  4311. {
  4312. return ((READ_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE) == RCC_CIER_HSI48RDYIE) ? 1UL : 0UL);
  4313. }
  4314. /**
  4315. * @brief Checks if PLLSAI1 ready interrupt source is enabled or disabled.
  4316. * @rmtoll CIER PLLSAI1RDYIE LL_RCC_IsEnabledIT_PLLSAI1RDY
  4317. * @retval State of bit (1 or 0).
  4318. */
  4319. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLSAI1RDY(void)
  4320. {
  4321. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE) == RCC_CIER_PLLSAI1RDYIE) ? 1UL : 0UL);
  4322. }
  4323. /**
  4324. * @brief Checks if PLLSAI2 ready interrupt source is enabled or disabled.
  4325. * @rmtoll CIER PLLSAI2RDYIE LL_RCC_IsEnabledIT_PLLSAI2RDY
  4326. * @retval State of bit (1 or 0).
  4327. */
  4328. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLSAI2RDY(void)
  4329. {
  4330. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE) == RCC_CIER_PLLSAI2RDYIE) ? 1UL : 0UL);
  4331. }
  4332. /**
  4333. * @}
  4334. */
  4335. /** @defgroup RCC_LL_EF_Secure_Management Secure Management
  4336. * @{
  4337. */
  4338. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  4339. /**
  4340. * @brief Configure Secure mode
  4341. * @note Only available from secure state when system implements security (TZEN=1)
  4342. * @rmtoll SECCFGR HSISEC LL_RCC_ConfigSecure\n
  4343. * SECCFGR HSESEC LL_RCC_ConfigSecure\n
  4344. * SECCFGR MSISEC LL_RCC_ConfigSecure\n
  4345. * SECCFGR LSISEC LL_RCC_ConfigSecure\n
  4346. * SECCFGR LSESEC LL_RCC_ConfigSecure\n
  4347. * SECCFGR SYSCLKSEC LL_RCC_ConfigSecure\n
  4348. * SECCFGR PRESCSEC LL_RCC_ConfigSecure\n
  4349. * SECCFGR PLLSEC LL_RCC_ConfigSecure\n
  4350. * SECCFGR PLLSAI1SEC LL_RCC_ConfigSecure\n
  4351. * SECCFGR PLLSAI2SEC LL_RCC_ConfigSecure\n
  4352. * SECCFGR CLK48MSEC LL_RCC_ConfigSecure\n
  4353. * SECCFGR HSI48SEC LL_RCC_ConfigSecure\n
  4354. * SECCFGR RMVFSEC LL_RCC_ConfigSecure
  4355. * @param Configuration This parameter shall be the full combination
  4356. * of the following values:
  4357. * @arg @ref LL_RCC_HSI_SEC or LL_RCC_HSI_NSEC
  4358. * @arg @ref LL_RCC_HSE_SEC or LL_RCC_HSE_NSEC
  4359. * @arg @ref LL_RCC_MSI_SEC or LL_RCC_MSI_NSEC
  4360. * @arg @ref LL_RCC_LSI_SEC or LL_RCC_LSI_NSEC
  4361. * @arg @ref LL_RCC_LSE_SEC or LL_RCC_LSE_NSEC
  4362. * @arg @ref LL_RCC_SYSCLK_SEC or LL_RCC_SYSCLK_NSEC
  4363. * @arg @ref LL_RCC_PRESCALERS_SEC or LL_RCC_PRESCALERS_NSEC
  4364. * @arg @ref LL_RCC_PLL_SEC or LL_RCC_PLL_NSEC
  4365. * @arg @ref LL_RCC_PLLSAI1_SEC or LL_RCC_PLLSAI1_NSEC
  4366. * @arg @ref LL_RCC_PLLSAI2_SEC or LL_RCC_PLLSAI2_NSEC
  4367. * @arg @ref LL_RCC_CLK48M_SEC or LL_RCC_CLK48M_NSEC
  4368. * @arg @ref LL_RCC_HSI48_SEC or LL_RCC_HSI48_NSEC
  4369. * @arg @ref LL_RCC_RESET_FLAGS_SEC or LL_RCC_RESET_FLAGS_NSEC
  4370. * @retval None
  4371. */
  4372. __STATIC_INLINE void LL_RCC_ConfigSecure(uint32_t Configuration)
  4373. {
  4374. WRITE_REG(RCC->SECCFGR, Configuration);
  4375. }
  4376. #endif /* __ARM_FEATURE_CMSE && (__ARM_FEATURE_CMSE == 3U) */
  4377. /**
  4378. * @brief Get Secure mode configuration
  4379. * @note Only available when system implements security (TZEN=1)
  4380. * @rmtoll SECSR HSISECF LL_RCC_GetConfigSecure\n
  4381. * SECSR HSESECF LL_RCC_GetConfigSecure\n
  4382. * SECSR MSISECF LL_RCC_GetConfigSecure\n
  4383. * SECSR LSISECF LL_RCC_GetConfigSecure\n
  4384. * SECSR LSESECF LL_RCC_GetConfigSecure\n
  4385. * SECSR SYSCLKSECF LL_RCC_GetConfigSecure\n
  4386. * SECSR PRESCSECF LL_RCC_GetConfigSecure\n
  4387. * SECSR PLLSECF LL_RCC_GetConfigSecure\n
  4388. * SECSR PLLSAI1SECF LL_RCC_GetConfigSecure\n
  4389. * SECSR PLLSAI2SECF LL_RCC_GetConfigSecure\n
  4390. * SECSR CLK48MSECF LL_RCC_GetConfigSecure\n
  4391. * SECSR HSI48SECF LL_RCC_GetConfigSecure\n
  4392. * SECSR RMVFSECF LL_RCC_GetConfigSecure
  4393. * @retval Returned value is the combination of the following values:
  4394. * @arg @ref LL_RCC_HSI_SEC or LL_RCC_HSI_NSEC
  4395. * @arg @ref LL_RCC_HSE_SEC or LL_RCC_HSE_NSEC
  4396. * @arg @ref LL_RCC_MSI_SEC or LL_RCC_MSI_NSEC
  4397. * @arg @ref LL_RCC_LSI_SEC or LL_RCC_LSI_NSEC
  4398. * @arg @ref LL_RCC_LSE_SEC or LL_RCC_LSE_NSEC
  4399. * @arg @ref LL_RCC_SYSCLK_SEC or LL_RCC_SYSCLK_NSEC
  4400. * @arg @ref LL_RCC_PRESCALERS_SEC or LL_RCC_PRESCALERS_NSEC
  4401. * @arg @ref LL_RCC_PLL_SEC or LL_RCC_PLL_NSEC
  4402. * @arg @ref LL_RCC_PLLSAI1_SEC or LL_RCC_PLLSAI1_NSEC
  4403. * @arg @ref LL_RCC_PLLSAI2_SEC or LL_RCC_PLLSAI2_NSEC
  4404. * @arg @ref LL_RCC_CLK48M_SEC or LL_RCC_CLK48M_NSEC
  4405. * @arg @ref LL_RCC_HSI48_SEC or LL_RCC_HSI48_NSEC
  4406. * @arg @ref LL_RCC_RESET_FLAGS_SEC or LL_RCC_RESET_FLAGS_NSEC
  4407. */
  4408. __STATIC_INLINE uint32_t LL_RCC_GetConfigSecure(void)
  4409. {
  4410. return (uint32_t)(READ_BIT(RCC->SECSR, RCC_SECURE_MASK));
  4411. }
  4412. /**
  4413. * @}
  4414. */
  4415. #if defined(USE_FULL_LL_DRIVER)
  4416. /** @defgroup RCC_LL_EF_Init De-initialization function
  4417. * @{
  4418. */
  4419. ErrorStatus LL_RCC_DeInit(void);
  4420. /**
  4421. * @}
  4422. */
  4423. /** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions
  4424. * @{
  4425. */
  4426. void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks);
  4427. uint32_t LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource);
  4428. uint32_t LL_RCC_GetUARTClockFreq(uint32_t UARTxSource);
  4429. uint32_t LL_RCC_GetI2CClockFreq(uint32_t I2CxSource);
  4430. uint32_t LL_RCC_GetLPUARTClockFreq(uint32_t LPUARTxSource);
  4431. uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource);
  4432. uint32_t LL_RCC_GetFDCANClockFreq(uint32_t FDCANxSource);
  4433. uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource);
  4434. uint32_t LL_RCC_GetSDMMCKernelClockFreq(uint32_t SDMMCxSource);
  4435. uint32_t LL_RCC_GetSDMMCClockFreq(uint32_t SDMMCxSource);
  4436. uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource);
  4437. uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource);
  4438. uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource);
  4439. uint32_t LL_RCC_GetDFSDMClockFreq(uint32_t DFSDMxSource);
  4440. uint32_t LL_RCC_GetDFSDMAudioClockFreq(uint32_t DFSDMxSource);
  4441. uint32_t LL_RCC_GetOCTOSPIClockFreq(uint32_t OCTOSPIxSource);
  4442. /**
  4443. * @}
  4444. */
  4445. #endif /* USE_FULL_LL_DRIVER */
  4446. /**
  4447. * @}
  4448. */
  4449. /**
  4450. * @}
  4451. */
  4452. #endif /* defined(RCC) */
  4453. /**
  4454. * @}
  4455. */
  4456. #ifdef __cplusplus
  4457. }
  4458. #endif
  4459. #endif /* STM32L5xx_LL_RCC_H */