stm32g0xx_ll_rcc.h 148 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_ll_rcc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32G0xx_LL_RCC_H
  21. #define STM32G0xx_LL_RCC_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32g0xx.h"
  27. /** @addtogroup STM32G0xx_LL_Driver
  28. * @{
  29. */
  30. #if defined(RCC)
  31. /** @defgroup RCC_LL RCC
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /** @defgroup RCC_LL_Private_Variables RCC Private Variables
  37. * @{
  38. */
  39. /**
  40. * @}
  41. */
  42. /* Private constants ---------------------------------------------------------*/
  43. /* Private macros ------------------------------------------------------------*/
  44. #if defined(USE_FULL_LL_DRIVER)
  45. /** @defgroup RCC_LL_Private_Macros RCC Private Macros
  46. * @{
  47. */
  48. /**
  49. * @}
  50. */
  51. #endif /*USE_FULL_LL_DRIVER*/
  52. /* Exported types ------------------------------------------------------------*/
  53. #if defined(USE_FULL_LL_DRIVER)
  54. /** @defgroup RCC_LL_Exported_Types RCC Exported Types
  55. * @{
  56. */
  57. /** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure
  58. * @{
  59. */
  60. /**
  61. * @brief RCC Clocks Frequency Structure
  62. */
  63. typedef struct
  64. {
  65. uint32_t SYSCLK_Frequency; /*!< SYSCLK clock frequency */
  66. uint32_t HCLK_Frequency; /*!< HCLK clock frequency */
  67. uint32_t PCLK1_Frequency; /*!< PCLK1 clock frequency */
  68. } LL_RCC_ClocksTypeDef;
  69. /**
  70. * @}
  71. */
  72. /**
  73. * @}
  74. */
  75. #endif /* USE_FULL_LL_DRIVER */
  76. /* Exported constants --------------------------------------------------------*/
  77. /** @defgroup RCC_LL_Exported_Constants RCC Exported Constants
  78. * @{
  79. */
  80. /** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation
  81. * @brief Defines used to adapt values of different oscillators
  82. * @note These values could be modified in the user environment according to
  83. * HW set-up.
  84. * @{
  85. */
  86. #if !defined (HSE_VALUE)
  87. #define HSE_VALUE 8000000U /*!< Value of the HSE oscillator in Hz */
  88. #endif /* HSE_VALUE */
  89. #if !defined (HSI_VALUE)
  90. #define HSI_VALUE 16000000U /*!< Value of the HSI oscillator in Hz */
  91. #endif /* HSI_VALUE */
  92. #if !defined (LSE_VALUE)
  93. #define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */
  94. #endif /* LSE_VALUE */
  95. #if !defined (LSI_VALUE)
  96. #define LSI_VALUE 32000U /*!< Value of the LSI oscillator in Hz */
  97. #endif /* LSI_VALUE */
  98. #if !defined (EXTERNAL_CLOCK_VALUE)
  99. #define EXTERNAL_CLOCK_VALUE 48000000U /*!< Value of the I2S_CKIN external oscillator in Hz */
  100. #endif /* EXTERNAL_CLOCK_VALUE */
  101. #if defined(RCC_HSI48_SUPPORT)
  102. #if !defined (HSI48_VALUE)
  103. #define HSI48_VALUE 48000000U /*!< Value of the HSI48 oscillator in Hz */
  104. #endif /* HSI48_VALUE */
  105. #endif /* RCC_HSI48_SUPPORT */
  106. /**
  107. * @}
  108. */
  109. /** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines
  110. * @brief Flags defines which can be used with LL_RCC_WriteReg function
  111. * @{
  112. */
  113. #define LL_RCC_CICR_LSIRDYC RCC_CICR_LSIRDYC /*!< LSI Ready Interrupt Clear */
  114. #define LL_RCC_CICR_LSERDYC RCC_CICR_LSERDYC /*!< LSE Ready Interrupt Clear */
  115. #define LL_RCC_CICR_HSIRDYC RCC_CICR_HSIRDYC /*!< HSI Ready Interrupt Clear */
  116. #define LL_RCC_CICR_HSERDYC RCC_CICR_HSERDYC /*!< HSE Ready Interrupt Clear */
  117. #define LL_RCC_CICR_PLLRDYC RCC_CICR_PLLRDYC /*!< PLL Ready Interrupt Clear */
  118. #define LL_RCC_CICR_LSECSSC RCC_CICR_LSECSSC /*!< LSE Clock Security System Interrupt Clear */
  119. #define LL_RCC_CICR_CSSC RCC_CICR_CSSC /*!< Clock Security System Interrupt Clear */
  120. #if defined(RCC_HSI48_SUPPORT)
  121. #define LL_RCC_CICR_HSI48RDYC RCC_CICR_HSI48RDYC /*!< HSI48 Ready Interrupt Clear */
  122. #endif /* RCC_HSI48_SUPPORT */
  123. /**
  124. * @}
  125. */
  126. /** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines
  127. * @brief Flags defines which can be used with LL_RCC_ReadReg function
  128. * @{
  129. */
  130. #define LL_RCC_CIFR_LSIRDYF RCC_CIFR_LSIRDYF /*!< LSI Ready Interrupt flag */
  131. #define LL_RCC_CIFR_LSERDYF RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
  132. #define LL_RCC_CIFR_HSIRDYF RCC_CIFR_HSIRDYF /*!< HSI Ready Interrupt flag */
  133. #if defined(RCC_HSI48_SUPPORT)
  134. #define LL_RCC_CIFR_HSI48RDYF RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
  135. #endif /* RCC_HSI48_SUPPORT */
  136. #define LL_RCC_CIFR_HSERDYF RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
  137. #define LL_RCC_CIFR_PLLRDYF RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
  138. #define LL_RCC_CIFR_LSECSSF RCC_CIFR_LSECSSF /*!< LSE Clock Security System Interrupt flag */
  139. #define LL_RCC_CIFR_CSSF RCC_CIFR_CSSF /*!< Clock Security System Interrupt flag */
  140. #define LL_RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF /*!< Low-Power reset flag */
  141. #define LL_RCC_CSR_OBLRSTF RCC_CSR_OBLRSTF /*!< OBL reset flag */
  142. #define LL_RCC_CSR_PINRSTF RCC_CSR_PINRSTF /*!< PIN reset flag */
  143. #define LL_RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF /*!< Software Reset flag */
  144. #define LL_RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF /*!< Independent Watchdog reset flag */
  145. #define LL_RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF /*!< Window watchdog reset flag */
  146. #define LL_RCC_CSR_PWRRSTF RCC_CSR_PWRRSTF /*!< BOR or POR/PDR reset flag */
  147. /**
  148. * @}
  149. */
  150. /** @defgroup RCC_LL_EC_IT IT Defines
  151. * @brief IT defines which can be used with LL_RCC_ReadReg and LL_RCC_WriteReg functions
  152. * @{
  153. */
  154. #define LL_RCC_CIER_LSIRDYIE RCC_CIER_LSIRDYIE /*!< LSI Ready Interrupt Enable */
  155. #define LL_RCC_CIER_LSERDYIE RCC_CIER_LSERDYIE /*!< LSE Ready Interrupt Enable */
  156. #define LL_RCC_CIER_HSIRDYIE RCC_CIER_HSIRDYIE /*!< HSI Ready Interrupt Enable */
  157. #define LL_RCC_CIER_HSERDYIE RCC_CIER_HSERDYIE /*!< HSE Ready Interrupt Enable */
  158. #define LL_RCC_CIER_PLLRDYIE RCC_CIER_PLLRDYIE /*!< PLL Ready Interrupt Enable */
  159. #if defined(RCC_HSI48_SUPPORT)
  160. #define LL_RCC_CIER_HSI48RDYIE RCC_CIER_HSI48RDYIE /*!< HSI48 Ready Interrupt Enable */
  161. #endif /* RCC_HSI48_SUPPORT */
  162. /**
  163. * @}
  164. */
  165. /** @defgroup RCC_LL_EC_LSEDRIVE LSE oscillator drive capability
  166. * @{
  167. */
  168. #define LL_RCC_LSEDRIVE_LOW 0x00000000U /*!< Xtal mode lower driving capability */
  169. #define LL_RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< Xtal mode medium low driving capability */
  170. #define LL_RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< Xtal mode medium high driving capability */
  171. #define LL_RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< Xtal mode higher driving capability */
  172. /**
  173. * @}
  174. */
  175. /** @defgroup RCC_LL_EC_LSCO_CLKSOURCE LSCO Selection
  176. * @{
  177. */
  178. #define LL_RCC_LSCO_CLKSOURCE_LSI 0x00000000U /*!< LSI selection for low speed clock */
  179. #define LL_RCC_LSCO_CLKSOURCE_LSE RCC_BDCR_LSCOSEL /*!< LSE selection for low speed clock */
  180. /**
  181. * @}
  182. */
  183. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch
  184. * @{
  185. */
  186. #define LL_RCC_SYS_CLKSOURCE_HSI 0x00000000U /*!< HSI selection as system clock */
  187. #define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_0 /*!< HSE selection as system clock */
  188. #define LL_RCC_SYS_CLKSOURCE_PLL RCC_CFGR_SW_1 /*!< PLL selection as system clock */
  189. #define LL_RCC_SYS_CLKSOURCE_LSI (RCC_CFGR_SW_1 | RCC_CFGR_SW_0) /*!< LSI selection used as system clock */
  190. #define LL_RCC_SYS_CLKSOURCE_LSE RCC_CFGR_SW_2 /*!< LSE selection used as system clock */
  191. /**
  192. * @}
  193. */
  194. /** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status
  195. * @{
  196. */
  197. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSI 0x00000000U /*!< HSI used as system clock */
  198. #define LL_RCC_SYS_CLKSOURCE_STATUS_HSE RCC_CFGR_SWS_0 /*!< HSE used as system clock */
  199. #define LL_RCC_SYS_CLKSOURCE_STATUS_PLL RCC_CFGR_SWS_1 /*!< PLL used as system clock */
  200. #define LL_RCC_SYS_CLKSOURCE_STATUS_LSI (RCC_CFGR_SWS_1 | RCC_CFGR_SWS_0) /*!< LSI used as system clock */
  201. #define LL_RCC_SYS_CLKSOURCE_STATUS_LSE RCC_CFGR_SWS_2 /*!< LSE used as system clock */
  202. /**
  203. * @}
  204. */
  205. /** @defgroup RCC_LL_EC_SYSCLK_DIV AHB prescaler
  206. * @{
  207. */
  208. #define LL_RCC_SYSCLK_DIV_1 0x00000000U /*!< SYSCLK not divided */
  209. #define LL_RCC_SYSCLK_DIV_2 RCC_CFGR_HPRE_3 /*!< SYSCLK divided by 2 */
  210. #define LL_RCC_SYSCLK_DIV_4 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 4 */
  211. #define LL_RCC_SYSCLK_DIV_8 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_1) /*!< SYSCLK divided by 8 */
  212. #define LL_RCC_SYSCLK_DIV_16 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_1 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 16 */
  213. #define LL_RCC_SYSCLK_DIV_64 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2) /*!< SYSCLK divided by 64 */
  214. #define LL_RCC_SYSCLK_DIV_128 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 128 */
  215. #define LL_RCC_SYSCLK_DIV_256 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2 | RCC_CFGR_HPRE_1) /*!< SYSCLK divided by 256 */
  216. #define LL_RCC_SYSCLK_DIV_512 (RCC_CFGR_HPRE_3 | RCC_CFGR_HPRE_2 | RCC_CFGR_HPRE_1 | RCC_CFGR_HPRE_0) /*!< SYSCLK divided by 512 */
  217. /**
  218. * @}
  219. */
  220. /** @defgroup RCC_LL_EC_APB1_DIV APB low-speed prescaler (APB1)
  221. * @{
  222. */
  223. #define LL_RCC_APB1_DIV_1 0x00000000U /*!< HCLK not divided */
  224. #define LL_RCC_APB1_DIV_2 RCC_CFGR_PPRE_2 /*!< HCLK divided by 2 */
  225. #define LL_RCC_APB1_DIV_4 (RCC_CFGR_PPRE_2 | RCC_CFGR_PPRE_0) /*!< HCLK divided by 4 */
  226. #define LL_RCC_APB1_DIV_8 (RCC_CFGR_PPRE_2 | RCC_CFGR_PPRE_1) /*!< HCLK divided by 8 */
  227. #define LL_RCC_APB1_DIV_16 (RCC_CFGR_PPRE_2 | RCC_CFGR_PPRE_1 | RCC_CFGR_PPRE_0) /*!< HCLK divided by 16 */
  228. /**
  229. * @}
  230. */
  231. /** @defgroup RCC_LL_EC_HSI_DIV HSI division factor
  232. * @{
  233. */
  234. #define LL_RCC_HSI_DIV_1 0x00000000U /*!< HSI not divided */
  235. #define LL_RCC_HSI_DIV_2 RCC_CR_HSIDIV_0 /*!< HSI divided by 2 */
  236. #define LL_RCC_HSI_DIV_4 RCC_CR_HSIDIV_1 /*!< HSI divided by 4 */
  237. #define LL_RCC_HSI_DIV_8 (RCC_CR_HSIDIV_1 | RCC_CR_HSIDIV_0) /*!< HSI divided by 8 */
  238. #define LL_RCC_HSI_DIV_16 RCC_CR_HSIDIV_2 /*!< HSI divided by 16 */
  239. #define LL_RCC_HSI_DIV_32 (RCC_CR_HSIDIV_2 | RCC_CR_HSIDIV_0) /*!< HSI divided by 32 */
  240. #define LL_RCC_HSI_DIV_64 (RCC_CR_HSIDIV_2 | RCC_CR_HSIDIV_1) /*!< HSI divided by 64 */
  241. #define LL_RCC_HSI_DIV_128 RCC_CR_HSIDIV /*!< HSI divided by 128 */
  242. /**
  243. * @}
  244. */
  245. /** @defgroup RCC_LL_EC_MCO1SOURCE MCO1 SOURCE selection
  246. * @{
  247. */
  248. #define LL_RCC_MCO1SOURCE_NOCLOCK 0x00000000U /*!< MCO output disabled, no clock on MCO */
  249. #define LL_RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCOSEL_0 /*!< SYSCLK selection as MCO1 source */
  250. #if defined(RCC_HSI48_SUPPORT)
  251. #define LL_RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCOSEL_1 /*!< HSI48 selection as MCO1 source */
  252. #endif /* RCC_HSI48_SUPPORT */
  253. #define LL_RCC_MCO1SOURCE_HSI (RCC_CFGR_MCOSEL_0| RCC_CFGR_MCOSEL_1) /*!< HSI16 selection as MCO1 source */
  254. #define LL_RCC_MCO1SOURCE_HSE RCC_CFGR_MCOSEL_2 /*!< HSE selection as MCO1 source */
  255. #define LL_RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_2) /*!< Main PLL selection as MCO1 source */
  256. #define LL_RCC_MCO1SOURCE_LSI (RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSI selection as MCO1 source */
  257. #define LL_RCC_MCO1SOURCE_LSE (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSE selection as MCO1 source */
  258. #if defined(RCC_CFGR_MCOSEL_3)
  259. #define LL_RCC_MCO1SOURCE_PLLPCLK RCC_CFGR_MCOSEL_3 /*!< PLLPCLK selection as MCO1 source */
  260. #define LL_RCC_MCO1SOURCE_PLLQCLK (RCC_CFGR_MCOSEL_3|RCC_CFGR_MCOSEL_0) /*!< PLLQCLK selection as MCO1 source */
  261. #define LL_RCC_MCO1SOURCE_RTCCLK (RCC_CFGR_MCOSEL_3|RCC_CFGR_MCOSEL_1) /*!< RTCCLK selection as MCO1 source */
  262. #define LL_RCC_MCO1SOURCE_RTC_WKUP (RCC_CFGR_MCOSEL_3|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_0) /*!< RTC_Wakeup selection as MCO1 source */
  263. #endif /* RCC_CFGR_MCOSEL_3 */
  264. /**
  265. * @}
  266. */
  267. /** @defgroup RCC_LL_EC_MCO1_DIV MCO1 prescaler
  268. * @{
  269. */
  270. #define LL_RCC_MCO1_DIV_1 0x00000000U /*!< MCO1 not divided */
  271. #define LL_RCC_MCO1_DIV_2 RCC_CFGR_MCOPRE_0 /*!< MCO1 divided by 2 */
  272. #define LL_RCC_MCO1_DIV_4 RCC_CFGR_MCOPRE_1 /*!< MCO1 divided by 4 */
  273. #define LL_RCC_MCO1_DIV_8 (RCC_CFGR_MCOPRE_1 | RCC_CFGR_MCOPRE_0) /*!< MCO1 divided by 8 */
  274. #define LL_RCC_MCO1_DIV_16 RCC_CFGR_MCOPRE_2 /*!< MCO1 divided by 16 */
  275. #define LL_RCC_MCO1_DIV_32 (RCC_CFGR_MCOPRE_2 | RCC_CFGR_MCOPRE_0) /*!< MCO1 divided by 32 */
  276. #define LL_RCC_MCO1_DIV_64 (RCC_CFGR_MCOPRE_2 | RCC_CFGR_MCOPRE_1) /*!< MCO1 divided by 64 */
  277. #define LL_RCC_MCO1_DIV_128 (RCC_CFGR_MCOPRE_2 | RCC_CFGR_MCOPRE_1 | RCC_CFGR_MCOPRE_0) /*!< MCO1 divided by 128 */
  278. #if defined(RCC_CFGR_MCOPRE_3)
  279. #define LL_RCC_MCO1_DIV_256 RCC_CFGR_MCOPRE_3 /*!< MCO divided by 256 */
  280. #define LL_RCC_MCO1_DIV_512 (RCC_CFGR_MCOPRE_3 | RCC_CFGR_MCOPRE_0) /*!< MCO divided by 512 */
  281. #define LL_RCC_MCO1_DIV_1024 (RCC_CFGR_MCOPRE_3 | RCC_CFGR_MCOPRE_1) /*!< MCO divided by 1024 */
  282. #endif /* RCC_CFGR_MCOPRE_3 */
  283. /**
  284. * @}
  285. */
  286. #if defined(RCC_MCO2_SUPPORT)
  287. /** @defgroup RCC_LL_EC_MCO2SOURCE MCO2 SOURCE selection
  288. * @{
  289. */
  290. #define LL_RCC_MCO2SOURCE_NOCLOCK 0x00000000U /*!< MCO output disabled, no clock on MCO */
  291. #define LL_RCC_MCO2SOURCE_SYSCLK RCC_CFGR_MCO2SEL_0 /*!< SYSCLK selection as MCO2 source */
  292. #if defined(RCC_HSI48_SUPPORT)
  293. #define LL_RCC_MCO2SOURCE_HSI48 RCC_CFGR_MCO2SEL_1 /*!< HSI48 selection as MCO2 source */
  294. #endif /* RCC_HSI48_SUPPORT */
  295. #define LL_RCC_MCO2SOURCE_HSI (RCC_CFGR_MCO2SEL_1 | RCC_CFGR_MCO2SEL_0) /*!< HSI16 selection as MCO2 source */
  296. #define LL_RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2SEL_2 /*!< HSE selection as MCO2 source */
  297. #define LL_RCC_MCO2SOURCE_PLLCLK (RCC_CFGR_MCO2SEL_2 | RCC_CFGR_MCO2SEL_0) /*!< Main PLL "R" clock selection as MCO2 source */
  298. #define LL_RCC_MCO2SOURCE_LSI (RCC_CFGR_MCO2SEL_2 | RCC_CFGR_MCO2SEL_1) /*!< LSI selection as MCO2 source */
  299. #define LL_RCC_MCO2SOURCE_LSE (RCC_CFGR_MCO2SEL_2 | RCC_CFGR_MCO2SEL_1 | RCC_CFGR_MCO2SEL_0) /*!< LSE selection as MCO2 source */
  300. #define LL_RCC_MCO2SOURCE_PLLPCLK RCC_CFGR_MCO2SEL_3 /*!< PLL "P" clock selection as MCO2 source */
  301. #define LL_RCC_MCO2SOURCE_PLLQCLK (RCC_CFGR_MCO2SEL_3 | RCC_CFGR_MCO2SEL_0) /*!< PLL "Q" clock selection as MCO2 source */
  302. #define LL_RCC_MCO2SOURCE_RTCCLK (RCC_CFGR_MCO2SEL_3 | RCC_CFGR_MCO2SEL_1) /*!< RTC Clock selection as MCO2 source */
  303. #define LL_RCC_MCO2SOURCE_RTC_WKUP (RCC_CFGR_MCO2SEL_3 | RCC_CFGR_MCO2SEL_1 | RCC_CFGR_MCO2SEL_0) /*!< RTC Wakeup timer selection as MCO2 source */
  304. /**
  305. * @}
  306. */
  307. /** @defgroup RCC_LL_EC_MCO2_DIV MCO2 prescaler
  308. * @{
  309. */
  310. #define LL_RCC_MCO2_DIV_1 0x00000000U /*!< MCO2 not divided */
  311. #define LL_RCC_MCO2_DIV_2 RCC_CFGR_MCO2PRE_0 /*!< MCO2 divided by 2 */
  312. #define LL_RCC_MCO2_DIV_4 RCC_CFGR_MCO2PRE_1 /*!< MCO2 divided by 4 */
  313. #define LL_RCC_MCO2_DIV_8 (RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_0) /*!< MCO2 divided by 8 */
  314. #define LL_RCC_MCO2_DIV_16 RCC_CFGR_MCO2PRE_2 /*!< MCO2 divided by 16 */
  315. #define LL_RCC_MCO2_DIV_32 (RCC_CFGR_MCO2PRE_2 | RCC_CFGR_MCO2PRE_0) /*!< MCO2 divided by 32 */
  316. #define LL_RCC_MCO2_DIV_64 (RCC_CFGR_MCO2PRE_2 | RCC_CFGR_MCO2PRE_1) /*!< MCO2 divided by 64 */
  317. #define LL_RCC_MCO2_DIV_128 (RCC_CFGR_MCO2PRE_2 | RCC_CFGR_MCO2PRE_1 | RCC_CFGR_MCO2PRE_0) /*!< MCO2 divided by 128 */
  318. #define LL_RCC_MCO2_DIV_256 RCC_CFGR_MCO2PRE_3 /*!< MCO2 divided by 256 */
  319. #define LL_RCC_MCO2_DIV_512 (RCC_CFGR_MCO2PRE_3 | RCC_CFGR_MCO2PRE_0) /*!< MCO2 divided by 512 */
  320. #define LL_RCC_MCO2_DIV_1024 (RCC_CFGR_MCO2PRE_3 | RCC_CFGR_MCO2PRE_1) /*!< MCO2 divided by 1024 */
  321. /**
  322. * @}
  323. */
  324. #endif /* RCC_MCO2_SUPPORT */
  325. #if defined(USE_FULL_LL_DRIVER)
  326. /** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency
  327. * @{
  328. */
  329. #define LL_RCC_PERIPH_FREQUENCY_NO 0x00000000U /*!< No clock enabled for the peripheral */
  330. #define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFU /*!< Frequency cannot be provided as external clock */
  331. /**
  332. * @}
  333. */
  334. #endif /* USE_FULL_LL_DRIVER */
  335. /** @defgroup RCC_LL_EC_USARTx_CLKSOURCE Peripheral USART clock source selection
  336. * @{
  337. */
  338. #define LL_RCC_USART1_CLKSOURCE_PCLK1 ((RCC_CCIPR_USART1SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as USART1 clock source */
  339. #define LL_RCC_USART1_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL_0) /*!< SYSCLK clock used as USART1 clock source */
  340. #define LL_RCC_USART1_CLKSOURCE_HSI ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL_1) /*!< HSI clock used as USART1 clock source */
  341. #define LL_RCC_USART1_CLKSOURCE_LSE ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL) /*!< LSE clock used as USART1 clock source */
  342. #define LL_RCC_USART2_CLKSOURCE_PCLK1 ((RCC_CCIPR_USART2SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as USART2 clock source */
  343. #define LL_RCC_USART2_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL_0) /*!< SYSCLK clock used as USART2 clock source */
  344. #define LL_RCC_USART2_CLKSOURCE_HSI ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL_1) /*!< HSI clock used as USART2 clock source */
  345. #define LL_RCC_USART2_CLKSOURCE_LSE ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL) /*!< LSE clock used as USART2 clock source */
  346. #if defined(RCC_CCIPR_USART3SEL)
  347. #define LL_RCC_USART3_CLKSOURCE_PCLK1 ((RCC_CCIPR_USART3SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as USART3 clock source */
  348. #define LL_RCC_USART3_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL_0) /*!< SYSCLK clock used as USART3 clock source */
  349. #define LL_RCC_USART3_CLKSOURCE_HSI ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL_1) /*!< HSI clock used as USART3 clock source */
  350. #define LL_RCC_USART3_CLKSOURCE_LSE ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL) /*!< LSE clock used as USART3 clock source */
  351. #endif /* RCC_CCIPR_USART3SEL */
  352. /**
  353. * @}
  354. */
  355. #if defined(LPUART1) || defined(LPUART2)
  356. /** @defgroup RCC_LL_EC_LPUARTx_CLKSOURCE Peripheral LPUART clock source selection
  357. * @{
  358. */
  359. #if defined(LPUART2)
  360. #define LL_RCC_LPUART2_CLKSOURCE_PCLK1 ((RCC_CCIPR_LPUART2SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as LPUART2 clock source */
  361. #define LL_RCC_LPUART2_CLKSOURCE_SYSCLK ((RCC_CCIPR_LPUART2SEL << 16U) | RCC_CCIPR_LPUART2SEL_0) /*!< SYSCLK clock used as LPUART2 clock source */
  362. #define LL_RCC_LPUART2_CLKSOURCE_HSI ((RCC_CCIPR_LPUART2SEL << 16U) | RCC_CCIPR_LPUART2SEL_1) /*!< HSI clock used as LPUART2 clock source */
  363. #define LL_RCC_LPUART2_CLKSOURCE_LSE ((RCC_CCIPR_LPUART2SEL << 16U) | RCC_CCIPR_LPUART2SEL) /*!< LSE clock used as LPUART2 clock source */
  364. #endif /* LPUART2 */
  365. #define LL_RCC_LPUART1_CLKSOURCE_PCLK1 ((RCC_CCIPR_LPUART1SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as LPUART1 clock source */
  366. #define LL_RCC_LPUART1_CLKSOURCE_SYSCLK ((RCC_CCIPR_LPUART1SEL << 16U) | RCC_CCIPR_LPUART1SEL_0) /*!< SYSCLK clock used as LPUART1 clock source */
  367. #define LL_RCC_LPUART1_CLKSOURCE_HSI ((RCC_CCIPR_LPUART1SEL << 16U) | RCC_CCIPR_LPUART1SEL_1) /*!< HSI clock used as LPUART1 clock source */
  368. #define LL_RCC_LPUART1_CLKSOURCE_LSE ((RCC_CCIPR_LPUART1SEL << 16U) | RCC_CCIPR_LPUART1SEL) /*!< LSE clock used as LPUART1 clock source */
  369. /**
  370. * @}
  371. */
  372. #endif /* LPUART1 || LPUART2 */
  373. /** @defgroup RCC_LL_EC_I2Cx_CLKSOURCE Peripheral I2C clock source selection
  374. * @{
  375. */
  376. #define LL_RCC_I2C1_CLKSOURCE_PCLK1 ((RCC_CCIPR_I2C1SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as I2C1 clock source */
  377. #define LL_RCC_I2C1_CLKSOURCE_SYSCLK ((RCC_CCIPR_I2C1SEL << 16U) | RCC_CCIPR_I2C1SEL_0) /*!< SYSCLK clock used as I2C1 clock source */
  378. #define LL_RCC_I2C1_CLKSOURCE_HSI ((RCC_CCIPR_I2C1SEL << 16U) | RCC_CCIPR_I2C1SEL_1) /*!< HSI clock used as I2C1 clock source */
  379. #if defined(RCC_CCIPR_I2C2SEL)
  380. #define LL_RCC_I2C2_CLKSOURCE_PCLK1 ((RCC_CCIPR_I2C2SEL << 16U) | 0x00000000U) /*!< PCLK1 clock used as I2C2 clock source */
  381. #define LL_RCC_I2C2_CLKSOURCE_SYSCLK ((RCC_CCIPR_I2C2SEL << 16U) | RCC_CCIPR_I2C2SEL_0) /*!< SYSCLK clock used as I2C2 clock source */
  382. #define LL_RCC_I2C2_CLKSOURCE_HSI ((RCC_CCIPR_I2C2SEL << 16U) | RCC_CCIPR_I2C2SEL_1) /*!< HSI clock used as I2C2 clock source */
  383. #endif /* RCC_CCIPR_I2C2SEL */
  384. /**
  385. * @}
  386. */
  387. /** @defgroup RCC_LL_EC_I2Sx_CLKSOURCE Peripheral I2S clock source selection
  388. * @{
  389. */
  390. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  391. #define LL_RCC_I2S1_CLKSOURCE_SYSCLK ((RCC_CCIPR2_I2S1SEL << 16U) | 0x00000000U) /*!< SYSCLK clock used as I2S1 clock source */
  392. #define LL_RCC_I2S1_CLKSOURCE_PLL ((RCC_CCIPR2_I2S1SEL << 16U) | RCC_CCIPR2_I2S1SEL_0) /*!< PLL clock used as I2S1 clock source */
  393. #define LL_RCC_I2S1_CLKSOURCE_HSI ((RCC_CCIPR2_I2S1SEL << 16U) | RCC_CCIPR2_I2S1SEL_1) /*!< HSI clock used as I2S1 clock source */
  394. #define LL_RCC_I2S1_CLKSOURCE_PIN ((RCC_CCIPR2_I2S1SEL << 16U) | RCC_CCIPR2_I2S1SEL) /*!< External clock used as I2S1 clock source */
  395. #define LL_RCC_I2S2_CLKSOURCE_SYSCLK ((RCC_CCIPR2_I2S2SEL << 16U) | 0x00000000U) /*!< SYSCLK clock used as I2S2 clock source */
  396. #define LL_RCC_I2S2_CLKSOURCE_PLL ((RCC_CCIPR2_I2S2SEL << 16U) | RCC_CCIPR2_I2S2SEL_0) /*!< PLL clock used as I2S2 clock source */
  397. #define LL_RCC_I2S2_CLKSOURCE_HSI ((RCC_CCIPR2_I2S2SEL << 16U) | RCC_CCIPR2_I2S2SEL_1) /*!< HSI clock used as I2S2 clock source */
  398. #define LL_RCC_I2S2_CLKSOURCE_PIN ((RCC_CCIPR2_I2S2SEL << 16U) | RCC_CCIPR2_I2S2SEL) /*!< External clock used as I2S2 clock source */
  399. #else
  400. #define LL_RCC_I2S1_CLKSOURCE_SYSCLK 0x00000000U /*!< SYSCLK clock used as I2S1 clock source */
  401. #define LL_RCC_I2S1_CLKSOURCE_PLL RCC_CCIPR_I2S1SEL_0 /*!< PLL clock used as I2S1 clock source */
  402. #define LL_RCC_I2S1_CLKSOURCE_HSI RCC_CCIPR_I2S1SEL_1 /*!< HSI clock used as I2S1 clock source */
  403. #define LL_RCC_I2S1_CLKSOURCE_PIN RCC_CCIPR_I2S1SEL /*!< External clock used as I2S1 clock source */
  404. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  405. /**
  406. * @}
  407. */
  408. #if defined(RCC_CCIPR_TIM1SEL)
  409. /** @defgroup RCC_LL_EC_TIMx_CLKSOURCE Peripheral TIM clock source selection
  410. * @{
  411. */
  412. #define LL_RCC_TIM1_CLKSOURCE_PCLK1 (RCC_CCIPR_TIM1SEL | (0x00000000U >> 16U)) /*!< PCLK1 clock used as TIM1 clock source */
  413. #define LL_RCC_TIM1_CLKSOURCE_PLL (RCC_CCIPR_TIM1SEL | (RCC_CCIPR_TIM1SEL >> 16U)) /*!< PLL used as TIM1 clock source */
  414. /**
  415. * @}
  416. */
  417. #endif /* RCC_CCIPR_TIM1SEL */
  418. #if defined(RCC_CCIPR_TIM15SEL)
  419. /** @addtogroup RCC_LL_EC_TIMx_CLKSOURCE
  420. * @{
  421. */
  422. #define LL_RCC_TIM15_CLKSOURCE_PCLK1 (RCC_CCIPR_TIM15SEL | (0x00000000U >> 16U)) /*!< PCLK1 clock used as TIM15 clock source */
  423. #define LL_RCC_TIM15_CLKSOURCE_PLL (RCC_CCIPR_TIM15SEL | (RCC_CCIPR_TIM15SEL >> 16U)) /*!< PLL used as TIM15 clock source */
  424. /**
  425. * @}
  426. */
  427. #endif /* RCC_CCIPR_TIM15SEL */
  428. #if defined(LPTIM1) && defined(LPTIM2)
  429. /** @defgroup RCC_LL_EC_LPTIMx_CLKSOURCE Peripheral LPTIM clock source selection
  430. * @{
  431. */
  432. #define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 (RCC_CCIPR_LPTIM1SEL | (0x00000000U >> 16U)) /*!< PCLK1 selected as LPTIM1 clock */
  433. #define LL_RCC_LPTIM1_CLKSOURCE_LSI (RCC_CCIPR_LPTIM1SEL | (RCC_CCIPR_LPTIM1SEL_0 >> 16U)) /*!< LSI selected as LPTIM1 clock */
  434. #define LL_RCC_LPTIM1_CLKSOURCE_HSI (RCC_CCIPR_LPTIM1SEL | (RCC_CCIPR_LPTIM1SEL_1 >> 16U)) /*!< HSI selected as LPTIM1 clock */
  435. #define LL_RCC_LPTIM1_CLKSOURCE_LSE (RCC_CCIPR_LPTIM1SEL | (RCC_CCIPR_LPTIM1SEL >> 16U)) /*!< LSE selected as LPTIM1 clock */
  436. #define LL_RCC_LPTIM2_CLKSOURCE_PCLK1 (RCC_CCIPR_LPTIM2SEL | (0x00000000U >> 16U)) /*!< PCLK1 selected as LPTIM2 clock */
  437. #define LL_RCC_LPTIM2_CLKSOURCE_LSI (RCC_CCIPR_LPTIM2SEL | (RCC_CCIPR_LPTIM2SEL_0 >> 16U)) /*!< LSI selected as LPTIM2 clock */
  438. #define LL_RCC_LPTIM2_CLKSOURCE_HSI (RCC_CCIPR_LPTIM2SEL | (RCC_CCIPR_LPTIM2SEL_1 >> 16U)) /*!< HSI selected as LPTIM2 clock */
  439. #define LL_RCC_LPTIM2_CLKSOURCE_LSE (RCC_CCIPR_LPTIM2SEL | (RCC_CCIPR_LPTIM2SEL >> 16U)) /*!< LSE selected as LPTIM2 clock */
  440. /**
  441. * @}
  442. */
  443. #endif /* LPTIM1 && LPTIM2*/
  444. #if defined(CEC)
  445. /** @defgroup RCC_LL_EC_CEC_CLKSOURCE_HSI Peripheral CEC clock source selection
  446. * @{
  447. */
  448. #define LL_RCC_CEC_CLKSOURCE_HSI_DIV488 0x00000000U /*!< HSI oscillator clock divided by 488 used as CEC clock */
  449. #define LL_RCC_CEC_CLKSOURCE_LSE RCC_CCIPR_CECSEL /*!< LSE oscillator clock used as CEC clock */
  450. /**
  451. * @}
  452. */
  453. #endif /* CEC */
  454. #if defined(FDCAN1) || defined(FDCAN2)
  455. /** @defgroup RCC_LL_EC_FDCAN_CLKSOURCE_HSI Peripheral FDCAN clock source selection
  456. * @{
  457. */
  458. #define LL_RCC_FDCAN_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 oscillator clock used as FDCAN clock */
  459. #define LL_RCC_FDCAN_CLKSOURCE_PLL RCC_CCIPR2_FDCANSEL_0 /*!< PLL "Q" oscillator clock used as FDCAN clock */
  460. #define LL_RCC_FDCAN_CLKSOURCE_HSE RCC_CCIPR2_FDCANSEL_1 /*!< HSE oscillator clock used as FDCAN clock */
  461. /**
  462. * @}
  463. */
  464. #endif /* FDCAN1 || FDCAN2 */
  465. #if defined(RNG)
  466. /** @defgroup RCC_LL_EC_RNG_CLKSOURCE Peripheral RNG clock source selection
  467. * @{
  468. */
  469. #define LL_RCC_RNG_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RNG clock */
  470. #define LL_RCC_RNG_CLKSOURCE_HSI_DIV8 RCC_CCIPR_RNGSEL_0 /*!< HSI oscillator clock divided by 8 used as RNG clock, available on cut2.0 */
  471. #define LL_RCC_RNG_CLKSOURCE_SYSCLK RCC_CCIPR_RNGSEL_1 /*!< SYSCLK divided by 1 used as RNG clock */
  472. #define LL_RCC_RNG_CLKSOURCE_PLL RCC_CCIPR_RNGSEL /*!< PLL used as RNG clock */
  473. /**
  474. * @}
  475. */
  476. #endif /* RNG */
  477. #if defined(RNG)
  478. /** @defgroup RCC_LL_EC_RNG_CLK_DIV Peripheral RNG clock division factor
  479. * @{
  480. */
  481. #define LL_RCC_RNG_CLK_DIV1 0x00000000U /*!< RNG clock not divided */
  482. #define LL_RCC_RNG_CLK_DIV2 RCC_CCIPR_RNGDIV_0 /*!< RNG clock divided by 2 */
  483. #define LL_RCC_RNG_CLK_DIV4 RCC_CCIPR_RNGDIV_1 /*!< RNG clock divided by 4 */
  484. #define LL_RCC_RNG_CLK_DIV8 RCC_CCIPR_RNGDIV /*!< RNG clock divided by 8 */
  485. /**
  486. * @}
  487. */
  488. #endif /* RNG */
  489. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  490. /** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection
  491. * @{
  492. */
  493. #if defined(RCC_HSI48_SUPPORT)
  494. #define LL_RCC_USB_CLKSOURCE_HSI48 0x00000000U /*!< HSI48 clock used as USB clock source */
  495. #endif /* RCC_HSI48_SUPPORT */
  496. #define LL_RCC_USB_CLKSOURCE_HSE RCC_CCIPR2_USBSEL_0 /*!< PLL clock used as USB clock source */
  497. #define LL_RCC_USB_CLKSOURCE_PLL RCC_CCIPR2_USBSEL_1 /*!< PLL clock used as USB clock source */
  498. /**
  499. * @}
  500. */
  501. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  502. /** @defgroup RCC_LL_EC_ADC_CLKSOURCE Peripheral ADC clock source selection
  503. * @{
  504. */
  505. #define LL_RCC_ADC_CLKSOURCE_SYSCLK 0x00000000U /*!< SYSCLK used as ADC clock */
  506. #define LL_RCC_ADC_CLKSOURCE_PLL RCC_CCIPR_ADCSEL_0 /*!< PLL used as ADC clock */
  507. #define LL_RCC_ADC_CLKSOURCE_HSI RCC_CCIPR_ADCSEL_1 /*!< HSI used as ADC clock */
  508. /**
  509. * @}
  510. */
  511. /** @defgroup RCC_LL_EC_USARTx Peripheral USARTx get clock source
  512. * @{
  513. */
  514. #define LL_RCC_USART1_CLKSOURCE RCC_CCIPR_USART1SEL /*!< USART1 Clock source selection */
  515. #define LL_RCC_USART2_CLKSOURCE RCC_CCIPR_USART2SEL /*!< USART2 Clock source selection */
  516. #if defined(RCC_CCIPR_USART3SEL)
  517. #define LL_RCC_USART3_CLKSOURCE RCC_CCIPR_USART3SEL /*!< USART3 Clock source selection */
  518. #endif /* RCC_CCIPR_USART3SEL */
  519. /**
  520. * @}
  521. */
  522. #if defined(LPUART1)
  523. /** @defgroup RCC_LL_EC_LPUART1 Peripheral LPUART get clock source
  524. * @{
  525. */
  526. #define LL_RCC_LPUART1_CLKSOURCE RCC_CCIPR_LPUART1SEL /*!< LPUART1 Clock source selection */
  527. #if defined(LPUART2)
  528. #define LL_RCC_LPUART2_CLKSOURCE RCC_CCIPR_LPUART2SEL /*!< LPUART2 Clock source selection */
  529. #endif /* LPUART2 */
  530. /**
  531. * @}
  532. */
  533. #endif /* LPUART1 */
  534. /** @defgroup RCC_LL_EC_I2C1 Peripheral I2C get clock source
  535. * @{
  536. */
  537. #define LL_RCC_I2C1_CLKSOURCE RCC_CCIPR_I2C1SEL /*!< I2C1 Clock source selection */
  538. #if defined(RCC_CCIPR_I2C2SEL)
  539. #define LL_RCC_I2C2_CLKSOURCE RCC_CCIPR_I2C2SEL /*!< I2C2 Clock source selection */
  540. #endif /* RCC_CCIPR_I2C2SEL */
  541. /**
  542. * @}
  543. */
  544. /** @defgroup RCC_LL_EC_I2S1 Peripheral I2S get clock source
  545. * @{
  546. */
  547. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  548. #define LL_RCC_I2S1_CLKSOURCE RCC_CCIPR2_I2S1SEL /*!< I2S1 Clock source selection */
  549. #define LL_RCC_I2S2_CLKSOURCE RCC_CCIPR2_I2S2SEL /*!< I2S2 Clock source selection */
  550. #else
  551. #define LL_RCC_I2S1_CLKSOURCE RCC_CCIPR_I2S1SEL /*!< I2S1 Clock source selection */
  552. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  553. /**
  554. * @}
  555. */
  556. #if defined(RCC_CCIPR_TIM1SEL)
  557. /** @defgroup RCC_LL_EC_TIMx Peripheral TIMx get clock source
  558. * @{
  559. */
  560. #define LL_RCC_TIM1_CLKSOURCE RCC_CCIPR_TIM1SEL /*!< TIM1 Clock source selection */
  561. #if defined(RCC_CCIPR_TIM15SEL)
  562. #define LL_RCC_TIM15_CLKSOURCE RCC_CCIPR_TIM15SEL /*!< TIM15 Clock source selection */
  563. #endif /* RCC_CCIPR_TIM15SEL */
  564. /**
  565. * @}
  566. */
  567. #endif /* RCC_CCIPR_TIM1SEL */
  568. #if defined(LPTIM1) && defined(LPTIM2)
  569. /** @defgroup RCC_LL_EC_LPTIM1 Peripheral LPTIM get clock source
  570. * @{
  571. */
  572. #define LL_RCC_LPTIM1_CLKSOURCE RCC_CCIPR_LPTIM1SEL /*!< LPTIM2 Clock source selection */
  573. #define LL_RCC_LPTIM2_CLKSOURCE RCC_CCIPR_LPTIM2SEL /*!< LPTIM2 Clock source selection */
  574. /**
  575. * @}
  576. */
  577. #endif /* LPTIM1 && LPTIM2 */
  578. #if defined(CEC)
  579. /** @defgroup RCC_LL_EC_CEC Peripheral CEC get clock source
  580. * @{
  581. */
  582. #define LL_RCC_CEC_CLKSOURCE RCC_CCIPR_CECSEL /*!< CEC Clock source selection */
  583. /**
  584. * @}
  585. */
  586. #endif /* CEC */
  587. #if defined(FDCAN1) || defined(FDCAN2)
  588. /** @defgroup RCC_LL_EC_FDCAN Peripheral FDCAN get clock source
  589. * @{
  590. */
  591. #define LL_RCC_FDCAN_CLKSOURCE RCC_CCIPR2_FDCANSEL /*!< FDCAN Clock source selection */
  592. /**
  593. * @}
  594. */
  595. #endif /* FDCAN1 */
  596. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  597. /** @defgroup RCC_LL_EC_USB Peripheral USB get clock source
  598. * @{
  599. */
  600. #define LL_RCC_USB_CLKSOURCE RCC_CCIPR2_USBSEL /*!< USB Clock source selection */
  601. /**
  602. * @}
  603. */
  604. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  605. #if defined(RNG)
  606. /** @defgroup RCC_LL_EC_RNG Peripheral RNG get clock source
  607. * @{
  608. */
  609. #define LL_RCC_RNG_CLKSOURCE RCC_CCIPR_RNGSEL /*!< RNG Clock source selection */
  610. /**
  611. * @}
  612. */
  613. /** @defgroup RCC_LL_EC_RNG_DIV Peripheral RNG get clock division factor
  614. * @{
  615. */
  616. #define LL_RCC_RNG_CLKDIV RCC_CCIPR_RNGDIV /*!< RNG Clock division factor */
  617. /**
  618. * @}
  619. */
  620. #endif /* RNG */
  621. /** @defgroup RCC_LL_EC_ADC Peripheral ADC get clock source
  622. * @{
  623. */
  624. #define LL_RCC_ADC_CLKSOURCE RCC_CCIPR_ADCSEL /*!< ADC Clock source selection */
  625. /**
  626. * @}
  627. */
  628. /** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection
  629. * @{
  630. */
  631. #define LL_RCC_RTC_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RTC clock */
  632. #define LL_RCC_RTC_CLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */
  633. #define LL_RCC_RTC_CLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */
  634. #define LL_RCC_RTC_CLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 32 used as RTC clock */
  635. /**
  636. * @}
  637. */
  638. /** @defgroup RCC_LL_EC_PLLSOURCE PLL entry clock source
  639. * @{
  640. */
  641. #define LL_RCC_PLLSOURCE_NONE 0x00000000U /*!< No clock */
  642. #define LL_RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI /*!< HSI16 clock selected as PLL entry clock source */
  643. #define LL_RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE /*!< HSE clock selected as PLL entry clock source */
  644. /**
  645. * @}
  646. */
  647. /** @defgroup RCC_LL_EC_PLLM_DIV PLL division factor (PLLM)
  648. * @{
  649. */
  650. #define LL_RCC_PLLM_DIV_1 0x00000000U /*!< PLL division factor by 1 */
  651. #define LL_RCC_PLLM_DIV_2 (RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 2 */
  652. #define LL_RCC_PLLM_DIV_3 (RCC_PLLCFGR_PLLM_1) /*!< PLL division factor by 3 */
  653. #define LL_RCC_PLLM_DIV_4 ((RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0)) /*!< PLL division factor by 4 */
  654. #define LL_RCC_PLLM_DIV_5 (RCC_PLLCFGR_PLLM_2) /*!< PLL division factor by 5 */
  655. #define LL_RCC_PLLM_DIV_6 ((RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0)) /*!< PLL division factor by 6 */
  656. #define LL_RCC_PLLM_DIV_7 ((RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1)) /*!< PLL division factor by 7 */
  657. #define LL_RCC_PLLM_DIV_8 (RCC_PLLCFGR_PLLM) /*!< PLL division factor by 8 */
  658. /**
  659. * @}
  660. */
  661. /** @defgroup RCC_LL_EC_PLLR_DIV PLL division factor (PLLR)
  662. * @{
  663. */
  664. #define LL_RCC_PLLR_DIV_2 (RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 2 */
  665. #define LL_RCC_PLLR_DIV_3 (RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 3 */
  666. #define LL_RCC_PLLR_DIV_4 (RCC_PLLCFGR_PLLR_1|RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 4 */
  667. #define LL_RCC_PLLR_DIV_5 (RCC_PLLCFGR_PLLR_2) /*!< Main PLL division factor for PLLCLK (system clock) by 5 */
  668. #define LL_RCC_PLLR_DIV_6 (RCC_PLLCFGR_PLLR_2|RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 6 */
  669. #define LL_RCC_PLLR_DIV_7 (RCC_PLLCFGR_PLLR_2|RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 7 */
  670. #define LL_RCC_PLLR_DIV_8 (RCC_PLLCFGR_PLLR) /*!< Main PLL division factor for PLLCLK (system clock) by 8 */
  671. /**
  672. * @}
  673. */
  674. /** @defgroup RCC_LL_EC_PLLP_DIV PLL division factor (PLLP)
  675. * @{
  676. */
  677. #define LL_RCC_PLLP_DIV_2 (RCC_PLLCFGR_PLLP_0) /*!< Main PLL division factor for PLLP output by 2 */
  678. #define LL_RCC_PLLP_DIV_3 (RCC_PLLCFGR_PLLP_1) /*!< Main PLL division factor for PLLP output by 3 */
  679. #define LL_RCC_PLLP_DIV_4 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1) /*!< Main PLL division factor for PLLP output by 4 */
  680. #define LL_RCC_PLLP_DIV_5 (RCC_PLLCFGR_PLLP_2) /*!< Main PLL division factor for PLLP output by 5 */
  681. #define LL_RCC_PLLP_DIV_6 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_2) /*!< Main PLL division factor for PLLP output by 6 */
  682. #define LL_RCC_PLLP_DIV_7 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2) /*!< Main PLL division factor for PLLP output by 7 */
  683. #define LL_RCC_PLLP_DIV_8 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2) /*!< Main PLL division factor for PLLP output by 8 */
  684. #define LL_RCC_PLLP_DIV_9 (RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 9 */
  685. #define LL_RCC_PLLP_DIV_10 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 10 */
  686. #define LL_RCC_PLLP_DIV_11 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 11 */
  687. #define LL_RCC_PLLP_DIV_12 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 12 */
  688. #define LL_RCC_PLLP_DIV_13 (RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 13 */
  689. #define LL_RCC_PLLP_DIV_14 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 14 */
  690. #define LL_RCC_PLLP_DIV_15 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3) /*!< Main PLL division factor for PLLP output by 15 */
  691. #define LL_RCC_PLLP_DIV_16 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3)/*!< Main PLL division factor for PLLP output by 16 */
  692. #define LL_RCC_PLLP_DIV_17 (RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 17 */
  693. #define LL_RCC_PLLP_DIV_18 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 18 */
  694. #define LL_RCC_PLLP_DIV_19 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 19 */
  695. #define LL_RCC_PLLP_DIV_20 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 20 */
  696. #define LL_RCC_PLLP_DIV_21 (RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 21 */
  697. #define LL_RCC_PLLP_DIV_22 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 22 */
  698. #define LL_RCC_PLLP_DIV_23 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 23 */
  699. #define LL_RCC_PLLP_DIV_24 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_4)/*!< Main PLL division factor for PLLP output by 24 */
  700. #define LL_RCC_PLLP_DIV_25 (RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 25 */
  701. #define LL_RCC_PLLP_DIV_26 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 26 */
  702. #define LL_RCC_PLLP_DIV_27 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 27*/
  703. #define LL_RCC_PLLP_DIV_28 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4)/*!< Main PLL division factor for PLLP output by 28 */
  704. #define LL_RCC_PLLP_DIV_29 (RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4) /*!< Main PLL division factor for PLLP output by 29 */
  705. #define LL_RCC_PLLP_DIV_30 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4)/*!< Main PLL division factor for PLLP output by 30 */
  706. #define LL_RCC_PLLP_DIV_31 (RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4)/*!< Main PLL division factor for PLLP output by 31 */
  707. #define LL_RCC_PLLP_DIV_32 (RCC_PLLCFGR_PLLP_0|RCC_PLLCFGR_PLLP_1|RCC_PLLCFGR_PLLP_2|RCC_PLLCFGR_PLLP_3|RCC_PLLCFGR_PLLP_4)/*!< Main PLL division factor for PLLP output by 32 */
  708. /**
  709. * @}
  710. */
  711. #if defined(RCC_PLLQ_SUPPORT)
  712. /** @defgroup RCC_LL_EC_PLLQ_DIV PLL division factor (PLLQ)
  713. * @{
  714. */
  715. #define LL_RCC_PLLQ_DIV_2 (RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 2 */
  716. #define LL_RCC_PLLQ_DIV_3 (RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 3 */
  717. #define LL_RCC_PLLQ_DIV_4 (RCC_PLLCFGR_PLLQ_1|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 4 */
  718. #define LL_RCC_PLLQ_DIV_5 (RCC_PLLCFGR_PLLQ_2) /*!< Main PLL division factor for PLLQ output by 5 */
  719. #define LL_RCC_PLLQ_DIV_6 (RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 6 */
  720. #define LL_RCC_PLLQ_DIV_7 (RCC_PLLCFGR_PLLQ_2|RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 7 */
  721. #define LL_RCC_PLLQ_DIV_8 (RCC_PLLCFGR_PLLQ) /*!< Main PLL division factor for PLLQ output by 8 */
  722. /**
  723. * @}
  724. */
  725. #endif /* RCC_PLLQ_SUPPORT */
  726. /**
  727. * @}
  728. */
  729. /* Exported macro ------------------------------------------------------------*/
  730. /** @defgroup RCC_LL_Exported_Macros RCC Exported Macros
  731. * @{
  732. */
  733. /** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros
  734. * @{
  735. */
  736. /**
  737. * @brief Write a value in RCC register
  738. * @param __REG__ Register to be written
  739. * @param __VALUE__ Value to be written in the register
  740. * @retval None
  741. */
  742. #define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG((RCC->__REG__), (__VALUE__))
  743. /**
  744. * @brief Read a value in RCC register
  745. * @param __REG__ Register to be read
  746. * @retval Register value
  747. */
  748. #define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__)
  749. /**
  750. * @}
  751. */
  752. /** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies
  753. * @{
  754. */
  755. /**
  756. * @brief Helper macro to calculate the PLLCLK frequency on system domain
  757. * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  758. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ());
  759. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  760. * @param __PLLM__ This parameter can be one of the following values:
  761. * @arg @ref LL_RCC_PLLM_DIV_1
  762. * @arg @ref LL_RCC_PLLM_DIV_2
  763. * @arg @ref LL_RCC_PLLM_DIV_3
  764. * @arg @ref LL_RCC_PLLM_DIV_4
  765. * @arg @ref LL_RCC_PLLM_DIV_5
  766. * @arg @ref LL_RCC_PLLM_DIV_6
  767. * @arg @ref LL_RCC_PLLM_DIV_7
  768. * @arg @ref LL_RCC_PLLM_DIV_8
  769. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  770. * @param __PLLR__ This parameter can be one of the following values:
  771. * @arg @ref LL_RCC_PLLR_DIV_2
  772. * @arg @ref LL_RCC_PLLR_DIV_3
  773. * @arg @ref LL_RCC_PLLR_DIV_4
  774. * @arg @ref LL_RCC_PLLR_DIV_5
  775. * @arg @ref LL_RCC_PLLR_DIV_6
  776. * @arg @ref LL_RCC_PLLR_DIV_7
  777. * @arg @ref LL_RCC_PLLR_DIV_8
  778. * @retval PLL clock frequency (in Hz)
  779. */
  780. #define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) \
  781. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  782. (((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos) + 1U))
  783. /**
  784. * @brief Helper macro to calculate the PLLPCLK frequency used on I2S domain
  785. * @note ex: @ref __LL_RCC_CALC_PLLCLK_I2S1_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  786. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
  787. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  788. * @param __PLLM__ This parameter can be one of the following values:
  789. * @arg @ref LL_RCC_PLLM_DIV_1
  790. * @arg @ref LL_RCC_PLLM_DIV_2
  791. * @arg @ref LL_RCC_PLLM_DIV_3
  792. * @arg @ref LL_RCC_PLLM_DIV_4
  793. * @arg @ref LL_RCC_PLLM_DIV_5
  794. * @arg @ref LL_RCC_PLLM_DIV_6
  795. * @arg @ref LL_RCC_PLLM_DIV_7
  796. * @arg @ref LL_RCC_PLLM_DIV_8
  797. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  798. * @param __PLLP__ This parameter can be one of the following values:
  799. * @arg @ref LL_RCC_PLLP_DIV_2
  800. * @arg @ref LL_RCC_PLLP_DIV_3
  801. * @arg @ref LL_RCC_PLLP_DIV_4
  802. * @arg @ref LL_RCC_PLLP_DIV_5
  803. * @arg @ref LL_RCC_PLLP_DIV_6
  804. * @arg @ref LL_RCC_PLLP_DIV_7
  805. * @arg @ref LL_RCC_PLLP_DIV_8
  806. * @arg @ref LL_RCC_PLLP_DIV_9
  807. * @arg @ref LL_RCC_PLLP_DIV_10
  808. * @arg @ref LL_RCC_PLLP_DIV_11
  809. * @arg @ref LL_RCC_PLLP_DIV_12
  810. * @arg @ref LL_RCC_PLLP_DIV_13
  811. * @arg @ref LL_RCC_PLLP_DIV_14
  812. * @arg @ref LL_RCC_PLLP_DIV_15
  813. * @arg @ref LL_RCC_PLLP_DIV_16
  814. * @arg @ref LL_RCC_PLLP_DIV_17
  815. * @arg @ref LL_RCC_PLLP_DIV_18
  816. * @arg @ref LL_RCC_PLLP_DIV_19
  817. * @arg @ref LL_RCC_PLLP_DIV_20
  818. * @arg @ref LL_RCC_PLLP_DIV_21
  819. * @arg @ref LL_RCC_PLLP_DIV_22
  820. * @arg @ref LL_RCC_PLLP_DIV_23
  821. * @arg @ref LL_RCC_PLLP_DIV_24
  822. * @arg @ref LL_RCC_PLLP_DIV_25
  823. * @arg @ref LL_RCC_PLLP_DIV_26
  824. * @arg @ref LL_RCC_PLLP_DIV_27
  825. * @arg @ref LL_RCC_PLLP_DIV_28
  826. * @arg @ref LL_RCC_PLLP_DIV_29
  827. * @arg @ref LL_RCC_PLLP_DIV_30
  828. * @arg @ref LL_RCC_PLLP_DIV_31
  829. * @arg @ref LL_RCC_PLLP_DIV_32
  830. * @retval PLL clock frequency (in Hz)
  831. */
  832. #define __LL_RCC_CALC_PLLCLK_I2S1_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) \
  833. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  834. (((__PLLP__) >> RCC_PLLCFGR_PLLP_Pos) + 1U))
  835. #if defined(RCC_CCIPR2_I2S2SEL)
  836. /**
  837. * @brief Helper macro to calculate the PLLPCLK frequency used on I2S2 domain
  838. * @note ex: @ref __LL_RCC_CALC_PLLCLK_I2S2_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  839. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
  840. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  841. * @param __PLLM__ This parameter can be one of the following values:
  842. * @arg @ref LL_RCC_PLLM_DIV_1
  843. * @arg @ref LL_RCC_PLLM_DIV_2
  844. * @arg @ref LL_RCC_PLLM_DIV_3
  845. * @arg @ref LL_RCC_PLLM_DIV_4
  846. * @arg @ref LL_RCC_PLLM_DIV_5
  847. * @arg @ref LL_RCC_PLLM_DIV_6
  848. * @arg @ref LL_RCC_PLLM_DIV_7
  849. * @arg @ref LL_RCC_PLLM_DIV_8
  850. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  851. * @param __PLLP__ This parameter can be one of the following values:
  852. * @arg @ref LL_RCC_PLLP_DIV_2
  853. * @arg @ref LL_RCC_PLLP_DIV_3
  854. * @arg @ref LL_RCC_PLLP_DIV_4
  855. * @arg @ref LL_RCC_PLLP_DIV_5
  856. * @arg @ref LL_RCC_PLLP_DIV_6
  857. * @arg @ref LL_RCC_PLLP_DIV_7
  858. * @arg @ref LL_RCC_PLLP_DIV_8
  859. * @arg @ref LL_RCC_PLLP_DIV_9
  860. * @arg @ref LL_RCC_PLLP_DIV_10
  861. * @arg @ref LL_RCC_PLLP_DIV_11
  862. * @arg @ref LL_RCC_PLLP_DIV_12
  863. * @arg @ref LL_RCC_PLLP_DIV_13
  864. * @arg @ref LL_RCC_PLLP_DIV_14
  865. * @arg @ref LL_RCC_PLLP_DIV_15
  866. * @arg @ref LL_RCC_PLLP_DIV_16
  867. * @arg @ref LL_RCC_PLLP_DIV_17
  868. * @arg @ref LL_RCC_PLLP_DIV_18
  869. * @arg @ref LL_RCC_PLLP_DIV_19
  870. * @arg @ref LL_RCC_PLLP_DIV_20
  871. * @arg @ref LL_RCC_PLLP_DIV_21
  872. * @arg @ref LL_RCC_PLLP_DIV_22
  873. * @arg @ref LL_RCC_PLLP_DIV_23
  874. * @arg @ref LL_RCC_PLLP_DIV_24
  875. * @arg @ref LL_RCC_PLLP_DIV_25
  876. * @arg @ref LL_RCC_PLLP_DIV_26
  877. * @arg @ref LL_RCC_PLLP_DIV_27
  878. * @arg @ref LL_RCC_PLLP_DIV_28
  879. * @arg @ref LL_RCC_PLLP_DIV_29
  880. * @arg @ref LL_RCC_PLLP_DIV_30
  881. * @arg @ref LL_RCC_PLLP_DIV_31
  882. * @arg @ref LL_RCC_PLLP_DIV_32
  883. * @retval PLL clock frequency (in Hz)
  884. */
  885. #define __LL_RCC_CALC_PLLCLK_I2S2_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) \
  886. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  887. (((__PLLP__) >> RCC_PLLCFGR_PLLP_Pos) + 1U))
  888. #endif /* RCC_CCIPR2_I2S2SEL */
  889. /**
  890. * @brief Helper macro to calculate the PLLPCLK frequency used on ADC domain
  891. * @note ex: @ref __LL_RCC_CALC_PLLCLK_ADC_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  892. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
  893. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  894. * @param __PLLM__ This parameter can be one of the following values:
  895. * @arg @ref LL_RCC_PLLM_DIV_1
  896. * @arg @ref LL_RCC_PLLM_DIV_2
  897. * @arg @ref LL_RCC_PLLM_DIV_3
  898. * @arg @ref LL_RCC_PLLM_DIV_4
  899. * @arg @ref LL_RCC_PLLM_DIV_5
  900. * @arg @ref LL_RCC_PLLM_DIV_6
  901. * @arg @ref LL_RCC_PLLM_DIV_7
  902. * @arg @ref LL_RCC_PLLM_DIV_8
  903. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  904. * @param __PLLP__ This parameter can be one of the following values:
  905. * @arg @ref LL_RCC_PLLP_DIV_2
  906. * @arg @ref LL_RCC_PLLP_DIV_3
  907. * @arg @ref LL_RCC_PLLP_DIV_4
  908. * @arg @ref LL_RCC_PLLP_DIV_5
  909. * @arg @ref LL_RCC_PLLP_DIV_6
  910. * @arg @ref LL_RCC_PLLP_DIV_7
  911. * @arg @ref LL_RCC_PLLP_DIV_8
  912. * @arg @ref LL_RCC_PLLP_DIV_9
  913. * @arg @ref LL_RCC_PLLP_DIV_10
  914. * @arg @ref LL_RCC_PLLP_DIV_11
  915. * @arg @ref LL_RCC_PLLP_DIV_12
  916. * @arg @ref LL_RCC_PLLP_DIV_13
  917. * @arg @ref LL_RCC_PLLP_DIV_14
  918. * @arg @ref LL_RCC_PLLP_DIV_15
  919. * @arg @ref LL_RCC_PLLP_DIV_16
  920. * @arg @ref LL_RCC_PLLP_DIV_17
  921. * @arg @ref LL_RCC_PLLP_DIV_18
  922. * @arg @ref LL_RCC_PLLP_DIV_19
  923. * @arg @ref LL_RCC_PLLP_DIV_20
  924. * @arg @ref LL_RCC_PLLP_DIV_21
  925. * @arg @ref LL_RCC_PLLP_DIV_22
  926. * @arg @ref LL_RCC_PLLP_DIV_23
  927. * @arg @ref LL_RCC_PLLP_DIV_24
  928. * @arg @ref LL_RCC_PLLP_DIV_25
  929. * @arg @ref LL_RCC_PLLP_DIV_26
  930. * @arg @ref LL_RCC_PLLP_DIV_27
  931. * @arg @ref LL_RCC_PLLP_DIV_28
  932. * @arg @ref LL_RCC_PLLP_DIV_29
  933. * @arg @ref LL_RCC_PLLP_DIV_30
  934. * @arg @ref LL_RCC_PLLP_DIV_31
  935. * @arg @ref LL_RCC_PLLP_DIV_32
  936. * @retval PLL clock frequency (in Hz)
  937. */
  938. #define __LL_RCC_CALC_PLLCLK_ADC_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) \
  939. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  940. (((__PLLP__) >> RCC_PLLCFGR_PLLP_Pos) + 1U))
  941. #if defined(RNG)
  942. /**
  943. * @brief Helper macro to calculate the PLLQCLK frequency used on RNG domain
  944. * @note ex: @ref __LL_RCC_CALC_PLLCLK_RNG_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  945. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  946. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  947. * @param __PLLM__ This parameter can be one of the following values:
  948. * @arg @ref LL_RCC_PLLM_DIV_1
  949. * @arg @ref LL_RCC_PLLM_DIV_2
  950. * @arg @ref LL_RCC_PLLM_DIV_3
  951. * @arg @ref LL_RCC_PLLM_DIV_4
  952. * @arg @ref LL_RCC_PLLM_DIV_5
  953. * @arg @ref LL_RCC_PLLM_DIV_6
  954. * @arg @ref LL_RCC_PLLM_DIV_7
  955. * @arg @ref LL_RCC_PLLM_DIV_8
  956. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  957. * @param __PLLQ__ This parameter can be one of the following values:
  958. * @arg @ref LL_RCC_PLLQ_DIV_2
  959. * @arg @ref LL_RCC_PLLQ_DIV_3
  960. * @arg @ref LL_RCC_PLLQ_DIV_4
  961. * @arg @ref LL_RCC_PLLQ_DIV_5
  962. * @arg @ref LL_RCC_PLLQ_DIV_6
  963. * @arg @ref LL_RCC_PLLQ_DIV_7
  964. * @arg @ref LL_RCC_PLLQ_DIV_8
  965. * @retval PLL clock frequency (in Hz)
  966. */
  967. #define __LL_RCC_CALC_PLLCLK_RNG_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) \
  968. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  969. (((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U))
  970. #endif /* RNG */
  971. #if defined(RCC_PLLQ_SUPPORT)
  972. /**
  973. * @brief Helper macro to calculate the PLLQCLK frequency used on TIM1 domain
  974. * @note ex: @ref __LL_RCC_CALC_PLLCLK_TIM1_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  975. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  976. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  977. * @param __PLLM__ This parameter can be one of the following values:
  978. * @arg @ref LL_RCC_PLLM_DIV_1
  979. * @arg @ref LL_RCC_PLLM_DIV_2
  980. * @arg @ref LL_RCC_PLLM_DIV_3
  981. * @arg @ref LL_RCC_PLLM_DIV_4
  982. * @arg @ref LL_RCC_PLLM_DIV_5
  983. * @arg @ref LL_RCC_PLLM_DIV_6
  984. * @arg @ref LL_RCC_PLLM_DIV_7
  985. * @arg @ref LL_RCC_PLLM_DIV_8
  986. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  987. * @param __PLLQ__ This parameter can be one of the following values:
  988. * @arg @ref LL_RCC_PLLQ_DIV_2
  989. * @arg @ref LL_RCC_PLLQ_DIV_3
  990. * @arg @ref LL_RCC_PLLQ_DIV_4
  991. * @arg @ref LL_RCC_PLLQ_DIV_5
  992. * @arg @ref LL_RCC_PLLQ_DIV_6
  993. * @arg @ref LL_RCC_PLLQ_DIV_7
  994. * @arg @ref LL_RCC_PLLQ_DIV_8
  995. * @retval PLL clock frequency (in Hz)
  996. */
  997. #define __LL_RCC_CALC_PLLCLK_TIM1_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) \
  998. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  999. (((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U))
  1000. #if defined(TIM15)
  1001. /**
  1002. * @brief Helper macro to calculate the PLLQCLK frequency used on TIM15 domain
  1003. * @note ex: @ref __LL_RCC_CALC_PLLCLK_TIM15_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1004. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  1005. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  1006. * @param __PLLM__ This parameter can be one of the following values:
  1007. * @arg @ref LL_RCC_PLLM_DIV_1
  1008. * @arg @ref LL_RCC_PLLM_DIV_2
  1009. * @arg @ref LL_RCC_PLLM_DIV_3
  1010. * @arg @ref LL_RCC_PLLM_DIV_4
  1011. * @arg @ref LL_RCC_PLLM_DIV_5
  1012. * @arg @ref LL_RCC_PLLM_DIV_6
  1013. * @arg @ref LL_RCC_PLLM_DIV_7
  1014. * @arg @ref LL_RCC_PLLM_DIV_8
  1015. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  1016. * @param __PLLQ__ This parameter can be one of the following values:
  1017. * @arg @ref LL_RCC_PLLQ_DIV_2
  1018. * @arg @ref LL_RCC_PLLQ_DIV_3
  1019. * @arg @ref LL_RCC_PLLQ_DIV_4
  1020. * @arg @ref LL_RCC_PLLQ_DIV_5
  1021. * @arg @ref LL_RCC_PLLQ_DIV_6
  1022. * @arg @ref LL_RCC_PLLQ_DIV_7
  1023. * @arg @ref LL_RCC_PLLQ_DIV_8
  1024. * @retval PLL clock frequency (in Hz)
  1025. */
  1026. #define __LL_RCC_CALC_PLLCLK_TIM15_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) \
  1027. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  1028. (((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U))
  1029. #endif /* TIM15 */
  1030. #endif /* RCC_PLLQ_SUPPORT */
  1031. #if defined(FDCAN1) || defined(FDCAN2)
  1032. /**
  1033. * @brief Helper macro to calculate the PLLQCLK frequency used on FDCAN domain
  1034. * @note ex: @ref __LL_RCC_CALC_PLLCLK_FDCAN_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1035. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  1036. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  1037. * @param __PLLM__ This parameter can be one of the following values:
  1038. * @arg @ref LL_RCC_PLLM_DIV_1
  1039. * @arg @ref LL_RCC_PLLM_DIV_2
  1040. * @arg @ref LL_RCC_PLLM_DIV_3
  1041. * @arg @ref LL_RCC_PLLM_DIV_4
  1042. * @arg @ref LL_RCC_PLLM_DIV_5
  1043. * @arg @ref LL_RCC_PLLM_DIV_6
  1044. * @arg @ref LL_RCC_PLLM_DIV_7
  1045. * @arg @ref LL_RCC_PLLM_DIV_8
  1046. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  1047. * @param __PLLQ__ This parameter can be one of the following values:
  1048. * @arg @ref LL_RCC_PLLQ_DIV_2
  1049. * @arg @ref LL_RCC_PLLQ_DIV_3
  1050. * @arg @ref LL_RCC_PLLQ_DIV_4
  1051. * @arg @ref LL_RCC_PLLQ_DIV_5
  1052. * @arg @ref LL_RCC_PLLQ_DIV_6
  1053. * @arg @ref LL_RCC_PLLQ_DIV_7
  1054. * @arg @ref LL_RCC_PLLQ_DIV_8
  1055. * @retval PLL clock frequency (in Hz)
  1056. */
  1057. #define __LL_RCC_CALC_PLLCLK_FDCAN_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) \
  1058. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  1059. (((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U))
  1060. #endif /* FDCAN1 || FDCAN2 */
  1061. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  1062. /**
  1063. * @brief Helper macro to calculate the PLLQCLK frequency used on USB domain
  1064. * @note ex: @ref __LL_RCC_CALC_PLLCLK_USB_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
  1065. * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
  1066. * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
  1067. * @param __PLLM__ This parameter can be one of the following values:
  1068. * @arg @ref LL_RCC_PLLM_DIV_1
  1069. * @arg @ref LL_RCC_PLLM_DIV_2
  1070. * @arg @ref LL_RCC_PLLM_DIV_3
  1071. * @arg @ref LL_RCC_PLLM_DIV_4
  1072. * @arg @ref LL_RCC_PLLM_DIV_5
  1073. * @arg @ref LL_RCC_PLLM_DIV_6
  1074. * @arg @ref LL_RCC_PLLM_DIV_7
  1075. * @arg @ref LL_RCC_PLLM_DIV_8
  1076. * @param __PLLN__ Between Min_Data = 8 and Max_Data = 86
  1077. * @param __PLLQ__ This parameter can be one of the following values:
  1078. * @arg @ref LL_RCC_PLLQ_DIV_2
  1079. * @arg @ref LL_RCC_PLLQ_DIV_3
  1080. * @arg @ref LL_RCC_PLLQ_DIV_4
  1081. * @arg @ref LL_RCC_PLLQ_DIV_5
  1082. * @arg @ref LL_RCC_PLLQ_DIV_6
  1083. * @arg @ref LL_RCC_PLLQ_DIV_7
  1084. * @arg @ref LL_RCC_PLLQ_DIV_8
  1085. * @retval PLL clock frequency (in Hz)
  1086. */
  1087. #define __LL_RCC_CALC_PLLCLK_USB_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) \
  1088. ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
  1089. (((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U))
  1090. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  1091. /**
  1092. * @brief Helper macro to calculate the HCLK frequency
  1093. * @param __SYSCLKFREQ__ SYSCLK frequency (based on HSE/HSI/PLLCLK)
  1094. * @param __AHBPRESCALER__ This parameter can be one of the following values:
  1095. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1096. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1097. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1098. * @arg @ref LL_RCC_SYSCLK_DIV_8
  1099. * @arg @ref LL_RCC_SYSCLK_DIV_16
  1100. * @arg @ref LL_RCC_SYSCLK_DIV_64
  1101. * @arg @ref LL_RCC_SYSCLK_DIV_128
  1102. * @arg @ref LL_RCC_SYSCLK_DIV_256
  1103. * @arg @ref LL_RCC_SYSCLK_DIV_512
  1104. * @retval HCLK clock frequency (in Hz)
  1105. */
  1106. #define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__,__AHBPRESCALER__) \
  1107. ((__SYSCLKFREQ__) >> (AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos] & 0x1FU))
  1108. /**
  1109. * @brief Helper macro to calculate the PCLK1 frequency (ABP1)
  1110. * @param __HCLKFREQ__ HCLK frequency
  1111. * @param __APB1PRESCALER__ This parameter can be one of the following values:
  1112. * @arg @ref LL_RCC_APB1_DIV_1
  1113. * @arg @ref LL_RCC_APB1_DIV_2
  1114. * @arg @ref LL_RCC_APB1_DIV_4
  1115. * @arg @ref LL_RCC_APB1_DIV_8
  1116. * @arg @ref LL_RCC_APB1_DIV_16
  1117. * @retval PCLK1 clock frequency (in Hz)
  1118. */
  1119. #define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) \
  1120. ((__HCLKFREQ__) >> (APBPrescTable[(__APB1PRESCALER__) >> RCC_CFGR_PPRE_Pos] & 0x1FU))
  1121. /**
  1122. * @brief Helper macro to calculate the HSISYS frequency
  1123. * @param __HSIDIV__ This parameter can be one of the following values:
  1124. * @arg @ref LL_RCC_HSI_DIV_1
  1125. * @arg @ref LL_RCC_HSI_DIV_2
  1126. * @arg @ref LL_RCC_HSI_DIV_4
  1127. * @arg @ref LL_RCC_HSI_DIV_8
  1128. * @arg @ref LL_RCC_HSI_DIV_16
  1129. * @arg @ref LL_RCC_HSI_DIV_32
  1130. * @arg @ref LL_RCC_HSI_DIV_64
  1131. * @arg @ref LL_RCC_HSI_DIV_128
  1132. * @retval HSISYS clock frequency (in Hz)
  1133. */
  1134. #define __LL_RCC_CALC_HSI_FREQ(__HSIDIV__) (HSI_VALUE / (1U << ((__HSIDIV__)>> RCC_CR_HSIDIV_Pos)))
  1135. /**
  1136. * @}
  1137. */
  1138. /**
  1139. * @}
  1140. */
  1141. /* Exported functions --------------------------------------------------------*/
  1142. /** @defgroup RCC_LL_Exported_Functions RCC Exported Functions
  1143. * @{
  1144. */
  1145. /** @defgroup RCC_LL_EF_HSE HSE
  1146. * @{
  1147. */
  1148. /**
  1149. * @brief Enable the Clock Security System.
  1150. * @rmtoll CR CSSON LL_RCC_HSE_EnableCSS
  1151. * @retval None
  1152. */
  1153. __STATIC_INLINE void LL_RCC_HSE_EnableCSS(void)
  1154. {
  1155. SET_BIT(RCC->CR, RCC_CR_CSSON);
  1156. }
  1157. /**
  1158. * @brief Enable HSE external oscillator (HSE Bypass)
  1159. * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass
  1160. * @retval None
  1161. */
  1162. __STATIC_INLINE void LL_RCC_HSE_EnableBypass(void)
  1163. {
  1164. SET_BIT(RCC->CR, RCC_CR_HSEBYP);
  1165. }
  1166. /**
  1167. * @brief Disable HSE external oscillator (HSE Bypass)
  1168. * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass
  1169. * @retval None
  1170. */
  1171. __STATIC_INLINE void LL_RCC_HSE_DisableBypass(void)
  1172. {
  1173. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);
  1174. }
  1175. /**
  1176. * @brief Enable HSE crystal oscillator (HSE ON)
  1177. * @rmtoll CR HSEON LL_RCC_HSE_Enable
  1178. * @retval None
  1179. */
  1180. __STATIC_INLINE void LL_RCC_HSE_Enable(void)
  1181. {
  1182. SET_BIT(RCC->CR, RCC_CR_HSEON);
  1183. }
  1184. /**
  1185. * @brief Disable HSE crystal oscillator (HSE ON)
  1186. * @rmtoll CR HSEON LL_RCC_HSE_Disable
  1187. * @retval None
  1188. */
  1189. __STATIC_INLINE void LL_RCC_HSE_Disable(void)
  1190. {
  1191. CLEAR_BIT(RCC->CR, RCC_CR_HSEON);
  1192. }
  1193. /**
  1194. * @brief Check if HSE oscillator Ready
  1195. * @rmtoll CR HSERDY LL_RCC_HSE_IsReady
  1196. * @retval State of bit (1 or 0).
  1197. */
  1198. __STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void)
  1199. {
  1200. return ((READ_BIT(RCC->CR, RCC_CR_HSERDY) == (RCC_CR_HSERDY)) ? 1UL : 0UL);
  1201. }
  1202. /**
  1203. * @}
  1204. */
  1205. /** @defgroup RCC_LL_EF_HSI HSI
  1206. * @{
  1207. */
  1208. /**
  1209. * @brief Enable HSI even in stop mode
  1210. * @note HSI oscillator is forced ON even in Stop mode
  1211. * @rmtoll CR HSIKERON LL_RCC_HSI_EnableInStopMode
  1212. * @retval None
  1213. */
  1214. __STATIC_INLINE void LL_RCC_HSI_EnableInStopMode(void)
  1215. {
  1216. SET_BIT(RCC->CR, RCC_CR_HSIKERON);
  1217. }
  1218. /**
  1219. * @brief Disable HSI in stop mode
  1220. * @rmtoll CR HSIKERON LL_RCC_HSI_DisableInStopMode
  1221. * @retval None
  1222. */
  1223. __STATIC_INLINE void LL_RCC_HSI_DisableInStopMode(void)
  1224. {
  1225. CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON);
  1226. }
  1227. /**
  1228. * @brief Check if HSI in stop mode is enabled
  1229. * @rmtoll CR HSIKERON LL_RCC_HSI_IsEnabledInStopMode
  1230. * @retval State of bit (1 or 0).
  1231. */
  1232. __STATIC_INLINE uint32_t LL_RCC_HSI_IsEnabledInStopMode(void)
  1233. {
  1234. return ((READ_BIT(RCC->CR, RCC_CR_HSIKERON) == (RCC_CR_HSIKERON)) ? 1UL : 0UL);
  1235. }
  1236. /**
  1237. * @brief Enable HSI oscillator
  1238. * @rmtoll CR HSION LL_RCC_HSI_Enable
  1239. * @retval None
  1240. */
  1241. __STATIC_INLINE void LL_RCC_HSI_Enable(void)
  1242. {
  1243. SET_BIT(RCC->CR, RCC_CR_HSION);
  1244. }
  1245. /**
  1246. * @brief Disable HSI oscillator
  1247. * @rmtoll CR HSION LL_RCC_HSI_Disable
  1248. * @retval None
  1249. */
  1250. __STATIC_INLINE void LL_RCC_HSI_Disable(void)
  1251. {
  1252. CLEAR_BIT(RCC->CR, RCC_CR_HSION);
  1253. }
  1254. /**
  1255. * @brief Check if HSI clock is ready
  1256. * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady
  1257. * @retval State of bit (1 or 0).
  1258. */
  1259. __STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
  1260. {
  1261. return ((READ_BIT(RCC->CR, RCC_CR_HSIRDY) == (RCC_CR_HSIRDY)) ? 1UL : 0UL);
  1262. }
  1263. /**
  1264. * @brief Get HSI Calibration value
  1265. * @note When HSITRIM is written, HSICAL is updated with the sum of
  1266. * HSITRIM and the factory trim value
  1267. * @rmtoll ICSCR HSICAL LL_RCC_HSI_GetCalibration
  1268. * @retval Between Min_Data = 0x00 and Max_Data = 0xFF
  1269. */
  1270. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void)
  1271. {
  1272. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_HSICAL) >> RCC_ICSCR_HSICAL_Pos);
  1273. }
  1274. /**
  1275. * @brief Set HSI Calibration trimming
  1276. * @note user-programmable trimming value that is added to the HSICAL
  1277. * @note Default value is 64, which, when added to the HSICAL value,
  1278. * should trim the HSI to 16 MHz +/- 1 %
  1279. * @rmtoll ICSCR HSITRIM LL_RCC_HSI_SetCalibTrimming
  1280. * @param Value Between Min_Data = 0 and Max_Data = 127
  1281. * @retval None
  1282. */
  1283. __STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value)
  1284. {
  1285. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, Value << RCC_ICSCR_HSITRIM_Pos);
  1286. }
  1287. /**
  1288. * @brief Get HSI Calibration trimming
  1289. * @rmtoll ICSCR HSITRIM LL_RCC_HSI_GetCalibTrimming
  1290. * @retval Between Min_Data = 0 and Max_Data = 127
  1291. */
  1292. __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void)
  1293. {
  1294. return (uint32_t)(READ_BIT(RCC->ICSCR, RCC_ICSCR_HSITRIM) >> RCC_ICSCR_HSITRIM_Pos);
  1295. }
  1296. /**
  1297. * @}
  1298. */
  1299. #if defined(RCC_HSI48_SUPPORT)
  1300. /** @defgroup RCC_LL_EF_HSI48 HSI48
  1301. * @{
  1302. */
  1303. /**
  1304. * @brief Enable HSI48
  1305. * @rmtoll CR HSI48ON LL_RCC_HSI48_Enable
  1306. * @retval None
  1307. */
  1308. __STATIC_INLINE void LL_RCC_HSI48_Enable(void)
  1309. {
  1310. SET_BIT(RCC->CR, RCC_CR_HSI48ON);
  1311. }
  1312. /**
  1313. * @brief Disable HSI48
  1314. * @rmtoll CR HSI48ON LL_RCC_HSI48_Disable
  1315. * @retval None
  1316. */
  1317. __STATIC_INLINE void LL_RCC_HSI48_Disable(void)
  1318. {
  1319. CLEAR_BIT(RCC->CR, RCC_CR_HSI48ON);
  1320. }
  1321. /**
  1322. * @brief Check if HSI48 oscillator Ready
  1323. * @rmtoll CR HSI48RDY LL_RCC_HSI48_IsReady
  1324. * @retval State of bit (1 or 0).
  1325. */
  1326. __STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
  1327. {
  1328. return ((READ_BIT(RCC->CR, RCC_CR_HSI48RDY) == RCC_CR_HSI48RDY) ? 1UL : 0UL);
  1329. }
  1330. /**
  1331. * @brief Get HSI48 Calibration value
  1332. * @rmtoll CRRCR HSI48CAL LL_RCC_HSI48_GetCalibration
  1333. * @retval Between Min_Data = 0x00 and Max_Data = 0x1FF
  1334. */
  1335. __STATIC_INLINE uint32_t LL_RCC_HSI48_GetCalibration(void)
  1336. {
  1337. return (uint32_t)(READ_BIT(RCC->CRRCR, RCC_CRRCR_HSI48CAL) >> RCC_CRRCR_HSI48CAL_Pos);
  1338. }
  1339. /**
  1340. * @}
  1341. */
  1342. #endif /* RCC_HSI48_SUPPORT */
  1343. /** @defgroup RCC_LL_EF_LSE LSE
  1344. * @{
  1345. */
  1346. /**
  1347. * @brief Enable Low Speed External (LSE) crystal.
  1348. * @rmtoll BDCR LSEON LL_RCC_LSE_Enable
  1349. * @retval None
  1350. */
  1351. __STATIC_INLINE void LL_RCC_LSE_Enable(void)
  1352. {
  1353. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  1354. }
  1355. /**
  1356. * @brief Disable Low Speed External (LSE) crystal.
  1357. * @rmtoll BDCR LSEON LL_RCC_LSE_Disable
  1358. * @retval None
  1359. */
  1360. __STATIC_INLINE void LL_RCC_LSE_Disable(void)
  1361. {
  1362. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
  1363. }
  1364. /**
  1365. * @brief Enable external clock source (LSE bypass).
  1366. * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass
  1367. * @retval None
  1368. */
  1369. __STATIC_INLINE void LL_RCC_LSE_EnableBypass(void)
  1370. {
  1371. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  1372. }
  1373. /**
  1374. * @brief Disable external clock source (LSE bypass).
  1375. * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass
  1376. * @retval None
  1377. */
  1378. __STATIC_INLINE void LL_RCC_LSE_DisableBypass(void)
  1379. {
  1380. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
  1381. }
  1382. /**
  1383. * @brief Set LSE oscillator drive capability
  1384. * @note The oscillator is in Xtal mode when it is not in bypass mode.
  1385. * @rmtoll BDCR LSEDRV LL_RCC_LSE_SetDriveCapability
  1386. * @param LSEDrive This parameter can be one of the following values:
  1387. * @arg @ref LL_RCC_LSEDRIVE_LOW
  1388. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  1389. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  1390. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  1391. * @retval None
  1392. */
  1393. __STATIC_INLINE void LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive)
  1394. {
  1395. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, LSEDrive);
  1396. }
  1397. /**
  1398. * @brief Get LSE oscillator drive capability
  1399. * @rmtoll BDCR LSEDRV LL_RCC_LSE_GetDriveCapability
  1400. * @retval Returned value can be one of the following values:
  1401. * @arg @ref LL_RCC_LSEDRIVE_LOW
  1402. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
  1403. * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
  1404. * @arg @ref LL_RCC_LSEDRIVE_HIGH
  1405. */
  1406. __STATIC_INLINE uint32_t LL_RCC_LSE_GetDriveCapability(void)
  1407. {
  1408. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSEDRV));
  1409. }
  1410. /**
  1411. * @brief Enable Clock security system on LSE.
  1412. * @rmtoll BDCR LSECSSON LL_RCC_LSE_EnableCSS
  1413. * @retval None
  1414. */
  1415. __STATIC_INLINE void LL_RCC_LSE_EnableCSS(void)
  1416. {
  1417. SET_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  1418. }
  1419. /**
  1420. * @brief Disable Clock security system on LSE.
  1421. * @note Clock security system can be disabled only after a LSE
  1422. * failure detection. In that case it MUST be disabled by software.
  1423. * @rmtoll BDCR LSECSSON LL_RCC_LSE_DisableCSS
  1424. * @retval None
  1425. */
  1426. __STATIC_INLINE void LL_RCC_LSE_DisableCSS(void)
  1427. {
  1428. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSECSSON);
  1429. }
  1430. /**
  1431. * @brief Check if LSE oscillator Ready
  1432. * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady
  1433. * @retval State of bit (1 or 0).
  1434. */
  1435. __STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
  1436. {
  1437. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == (RCC_BDCR_LSERDY)) ? 1UL : 0UL);
  1438. }
  1439. /**
  1440. * @brief Check if CSS on LSE failure Detection
  1441. * @rmtoll BDCR LSECSSD LL_RCC_LSE_IsCSSDetected
  1442. * @retval State of bit (1 or 0).
  1443. */
  1444. __STATIC_INLINE uint32_t LL_RCC_LSE_IsCSSDetected(void)
  1445. {
  1446. return ((READ_BIT(RCC->BDCR, RCC_BDCR_LSECSSD) == (RCC_BDCR_LSECSSD)) ? 1UL : 0UL);
  1447. }
  1448. /**
  1449. * @}
  1450. */
  1451. /** @defgroup RCC_LL_EF_LSI LSI
  1452. * @{
  1453. */
  1454. /**
  1455. * @brief Enable LSI Oscillator
  1456. * @rmtoll CSR LSION LL_RCC_LSI_Enable
  1457. * @retval None
  1458. */
  1459. __STATIC_INLINE void LL_RCC_LSI_Enable(void)
  1460. {
  1461. SET_BIT(RCC->CSR, RCC_CSR_LSION);
  1462. }
  1463. /**
  1464. * @brief Disable LSI Oscillator
  1465. * @rmtoll CSR LSION LL_RCC_LSI_Disable
  1466. * @retval None
  1467. */
  1468. __STATIC_INLINE void LL_RCC_LSI_Disable(void)
  1469. {
  1470. CLEAR_BIT(RCC->CSR, RCC_CSR_LSION);
  1471. }
  1472. /**
  1473. * @brief Check if LSI is Ready
  1474. * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady
  1475. * @retval State of bit (1 or 0).
  1476. */
  1477. __STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void)
  1478. {
  1479. return ((READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == (RCC_CSR_LSIRDY)) ? 1UL : 0UL);
  1480. }
  1481. /**
  1482. * @}
  1483. */
  1484. /** @defgroup RCC_LL_EF_LSCO LSCO
  1485. * @{
  1486. */
  1487. /**
  1488. * @brief Enable Low speed clock
  1489. * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Enable
  1490. * @retval None
  1491. */
  1492. __STATIC_INLINE void LL_RCC_LSCO_Enable(void)
  1493. {
  1494. SET_BIT(RCC->BDCR, RCC_BDCR_LSCOEN);
  1495. }
  1496. /**
  1497. * @brief Disable Low speed clock
  1498. * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Disable
  1499. * @retval None
  1500. */
  1501. __STATIC_INLINE void LL_RCC_LSCO_Disable(void)
  1502. {
  1503. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSCOEN);
  1504. }
  1505. /**
  1506. * @brief Configure Low speed clock selection
  1507. * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_SetSource
  1508. * @param Source This parameter can be one of the following values:
  1509. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
  1510. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
  1511. * @retval None
  1512. */
  1513. __STATIC_INLINE void LL_RCC_LSCO_SetSource(uint32_t Source)
  1514. {
  1515. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSCOSEL, Source);
  1516. }
  1517. /**
  1518. * @brief Get Low speed clock selection
  1519. * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_GetSource
  1520. * @retval Returned value can be one of the following values:
  1521. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
  1522. * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
  1523. */
  1524. __STATIC_INLINE uint32_t LL_RCC_LSCO_GetSource(void)
  1525. {
  1526. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSCOSEL));
  1527. }
  1528. /**
  1529. * @}
  1530. */
  1531. /** @defgroup RCC_LL_EF_System System
  1532. * @{
  1533. */
  1534. /**
  1535. * @brief Configure the system clock source
  1536. * @rmtoll CFGR SW LL_RCC_SetSysClkSource
  1537. * @param Source This parameter can be one of the following values:
  1538. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI
  1539. * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
  1540. * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL
  1541. * @arg @ref LL_RCC_SYS_CLKSOURCE_LSI
  1542. * @arg @ref LL_RCC_SYS_CLKSOURCE_LSE
  1543. * @retval None
  1544. */
  1545. __STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source)
  1546. {
  1547. MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source);
  1548. }
  1549. /**
  1550. * @brief Get the system clock source
  1551. * @rmtoll CFGR SWS LL_RCC_GetSysClkSource
  1552. * @retval Returned value can be one of the following values:
  1553. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
  1554. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
  1555. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL
  1556. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_LSI
  1557. * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_LSE
  1558. */
  1559. __STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void)
  1560. {
  1561. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS));
  1562. }
  1563. /**
  1564. * @brief Set AHB prescaler
  1565. * @rmtoll CFGR HPRE LL_RCC_SetAHBPrescaler
  1566. * @param Prescaler This parameter can be one of the following values:
  1567. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1568. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1569. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1570. * @arg @ref LL_RCC_SYSCLK_DIV_8
  1571. * @arg @ref LL_RCC_SYSCLK_DIV_16
  1572. * @arg @ref LL_RCC_SYSCLK_DIV_64
  1573. * @arg @ref LL_RCC_SYSCLK_DIV_128
  1574. * @arg @ref LL_RCC_SYSCLK_DIV_256
  1575. * @arg @ref LL_RCC_SYSCLK_DIV_512
  1576. * @retval None
  1577. */
  1578. __STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler)
  1579. {
  1580. MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler);
  1581. }
  1582. /**
  1583. * @brief Set APB1 prescaler
  1584. * @rmtoll CFGR PPRE LL_RCC_SetAPB1Prescaler
  1585. * @param Prescaler This parameter can be one of the following values:
  1586. * @arg @ref LL_RCC_APB1_DIV_1
  1587. * @arg @ref LL_RCC_APB1_DIV_2
  1588. * @arg @ref LL_RCC_APB1_DIV_4
  1589. * @arg @ref LL_RCC_APB1_DIV_8
  1590. * @arg @ref LL_RCC_APB1_DIV_16
  1591. * @retval None
  1592. */
  1593. __STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)
  1594. {
  1595. MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE, Prescaler);
  1596. }
  1597. /**
  1598. * @brief Set HSI16 division factor
  1599. * @rmtoll CR HSIDIV LL_RCC_SetHSIDiv
  1600. * @note HSIDIV parameter is only applied to SYSCLK_Frequency when HSI is used as
  1601. * system clock source.
  1602. * @param HSIDiv This parameter can be one of the following values:
  1603. * @arg @ref LL_RCC_HSI_DIV_1
  1604. * @arg @ref LL_RCC_HSI_DIV_2
  1605. * @arg @ref LL_RCC_HSI_DIV_4
  1606. * @arg @ref LL_RCC_HSI_DIV_8
  1607. * @arg @ref LL_RCC_HSI_DIV_16
  1608. * @arg @ref LL_RCC_HSI_DIV_32
  1609. * @arg @ref LL_RCC_HSI_DIV_64
  1610. * @arg @ref LL_RCC_HSI_DIV_128
  1611. * @retval None
  1612. */
  1613. __STATIC_INLINE void LL_RCC_SetHSIDiv(uint32_t HSIDiv)
  1614. {
  1615. MODIFY_REG(RCC->CR, RCC_CR_HSIDIV, HSIDiv);
  1616. }
  1617. /**
  1618. * @brief Get AHB prescaler
  1619. * @rmtoll CFGR HPRE LL_RCC_GetAHBPrescaler
  1620. * @retval Returned value can be one of the following values:
  1621. * @arg @ref LL_RCC_SYSCLK_DIV_1
  1622. * @arg @ref LL_RCC_SYSCLK_DIV_2
  1623. * @arg @ref LL_RCC_SYSCLK_DIV_4
  1624. * @arg @ref LL_RCC_SYSCLK_DIV_8
  1625. * @arg @ref LL_RCC_SYSCLK_DIV_16
  1626. * @arg @ref LL_RCC_SYSCLK_DIV_64
  1627. * @arg @ref LL_RCC_SYSCLK_DIV_128
  1628. * @arg @ref LL_RCC_SYSCLK_DIV_256
  1629. * @arg @ref LL_RCC_SYSCLK_DIV_512
  1630. */
  1631. __STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void)
  1632. {
  1633. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE));
  1634. }
  1635. /**
  1636. * @brief Get APB1 prescaler
  1637. * @rmtoll CFGR PPRE LL_RCC_GetAPB1Prescaler
  1638. * @retval Returned value can be one of the following values:
  1639. * @arg @ref LL_RCC_APB1_DIV_1
  1640. * @arg @ref LL_RCC_APB1_DIV_2
  1641. * @arg @ref LL_RCC_APB1_DIV_4
  1642. * @arg @ref LL_RCC_APB1_DIV_8
  1643. * @arg @ref LL_RCC_APB1_DIV_16
  1644. */
  1645. __STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void)
  1646. {
  1647. return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE));
  1648. }
  1649. /**
  1650. * @brief Get HSI16 Division factor
  1651. * @rmtoll CR HSIDIV LL_RCC_GetHSIDiv
  1652. * @note HSIDIV parameter is only applied to SYSCLK_Frequency when HSI is used as
  1653. * system clock source.
  1654. * @retval Returned value can be one of the following values:
  1655. * @arg @ref LL_RCC_HSI_DIV_1
  1656. * @arg @ref LL_RCC_HSI_DIV_2
  1657. * @arg @ref LL_RCC_HSI_DIV_4
  1658. * @arg @ref LL_RCC_HSI_DIV_8
  1659. * @arg @ref LL_RCC_HSI_DIV_16
  1660. * @arg @ref LL_RCC_HSI_DIV_32
  1661. * @arg @ref LL_RCC_HSI_DIV_64
  1662. * @arg @ref LL_RCC_HSI_DIV_128
  1663. */
  1664. __STATIC_INLINE uint32_t LL_RCC_GetHSIDiv(void)
  1665. {
  1666. return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSIDIV));
  1667. }
  1668. /**
  1669. * @}
  1670. */
  1671. /** @defgroup RCC_LL_EF_MCO1 MCO1
  1672. * @{
  1673. */
  1674. /**
  1675. * @brief Configure MCOx
  1676. * @rmtoll CFGR MCOSEL LL_RCC_ConfigMCO\n
  1677. * CFGR MCOPRE LL_RCC_ConfigMCO
  1678. * @param MCOxSource This parameter can be one of the following values:
  1679. * @arg @ref LL_RCC_MCO1SOURCE_NOCLOCK
  1680. * @arg @ref LL_RCC_MCO1SOURCE_SYSCLK
  1681. * @arg @ref LL_RCC_MCO1SOURCE_HSI
  1682. * @arg @ref LL_RCC_MCO1SOURCE_HSI48 (*)
  1683. * @arg @ref LL_RCC_MCO1SOURCE_HSE
  1684. * @arg @ref LL_RCC_MCO1SOURCE_PLLCLK
  1685. * @arg @ref LL_RCC_MCO1SOURCE_LSI
  1686. * @arg @ref LL_RCC_MCO1SOURCE_LSE
  1687. * @arg @ref LL_RCC_MCO1SOURCE_PLLPCLK (*)
  1688. * @arg @ref LL_RCC_MCO1SOURCE_PLLQCLK (*)
  1689. * @arg @ref LL_RCC_MCO1SOURCE_RTCCLK (*)
  1690. * @arg @ref LL_RCC_MCO1SOURCE_RTC_WKUP (*)
  1691. *
  1692. * (*) value not defined in all devices.
  1693. * @param MCOxPrescaler This parameter can be one of the following values:
  1694. * @arg @ref LL_RCC_MCO1_DIV_1
  1695. * @arg @ref LL_RCC_MCO1_DIV_2
  1696. * @arg @ref LL_RCC_MCO1_DIV_4
  1697. * @arg @ref LL_RCC_MCO1_DIV_8
  1698. * @arg @ref LL_RCC_MCO1_DIV_32
  1699. * @arg @ref LL_RCC_MCO1_DIV_64
  1700. * @arg @ref LL_RCC_MCO1_DIV_128
  1701. * @retval None
  1702. */
  1703. __STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource, uint32_t MCOxPrescaler)
  1704. {
  1705. MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE, MCOxSource | MCOxPrescaler);
  1706. }
  1707. /**
  1708. * @}
  1709. */
  1710. #if defined(RCC_MCO2_SUPPORT)
  1711. /** @defgroup RCC_LL_EF_MCO2 MCO2
  1712. * @{
  1713. */
  1714. /**
  1715. * @brief Configure MCO2
  1716. * @rmtoll CFGR MCO2SEL LL_RCC_ConfigMCO2\n
  1717. * CFGR MCO2PRE LL_RCC_ConfigMCO2
  1718. * @note feature not available in all devices.
  1719. * @param MCOxSource This parameter can be one of the following values:
  1720. * @arg @ref LL_RCC_MCO2SOURCE_NOCLOCK
  1721. * @arg @ref LL_RCC_MCO2SOURCE_SYSCLK
  1722. * @arg @ref LL_RCC_MCO2SOURCE_HSI
  1723. * @arg @ref LL_RCC_MCO2SOURCE_HSI48
  1724. * @arg @ref LL_RCC_MCO2SOURCE_HSE
  1725. * @arg @ref LL_RCC_MCO2SOURCE_PLLCLK
  1726. * @arg @ref LL_RCC_MCO2SOURCE_LSI
  1727. * @arg @ref LL_RCC_MCO2SOURCE_LSE
  1728. * @arg @ref LL_RCC_MCO2SOURCE_PLLPCLK
  1729. * @arg @ref LL_RCC_MCO2SOURCE_PLLQCLK
  1730. * @arg @ref LL_RCC_MCO2SOURCE_RTCCLK
  1731. * @arg @ref LL_RCC_MCO2SOURCE_RTC_WKUP
  1732. *
  1733. * @param MCOxPrescaler This parameter can be one of the following values:
  1734. * @arg @ref LL_RCC_MCO2_DIV_1
  1735. * @arg @ref LL_RCC_MCO2_DIV_2
  1736. * @arg @ref LL_RCC_MCO2_DIV_4
  1737. * @arg @ref LL_RCC_MCO2_DIV_8
  1738. * @arg @ref LL_RCC_MCO2_DIV_16
  1739. * @arg @ref LL_RCC_MCO2_DIV_32
  1740. * @arg @ref LL_RCC_MCO2_DIV_64
  1741. * @arg @ref LL_RCC_MCO2_DIV_128
  1742. * @arg @ref LL_RCC_MCO2_DIV_256
  1743. * @arg @ref LL_RCC_MCO2_DIV_512
  1744. * @arg @ref LL_RCC_MCO2_DIV_1024
  1745. * @retval None
  1746. */
  1747. __STATIC_INLINE void LL_RCC_ConfigMCO2(uint32_t MCOxSource, uint32_t MCOxPrescaler)
  1748. {
  1749. MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO2SEL | RCC_CFGR_MCO2PRE, MCOxSource | MCOxPrescaler);
  1750. }
  1751. /**
  1752. * @}
  1753. */
  1754. #endif /* RCC_MCO2_SUPPORT */
  1755. /** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source
  1756. * @{
  1757. */
  1758. /**
  1759. * @brief Configure USARTx clock source
  1760. * @rmtoll CCIPR USARTxSEL LL_RCC_SetUSARTClockSource
  1761. * @param USARTxSource This parameter can be one of the following values:
  1762. * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK1
  1763. * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
  1764. * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
  1765. * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
  1766. * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
  1767. * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
  1768. * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
  1769. * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
  1770. * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1 (*)
  1771. * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK (*)
  1772. * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI (*)
  1773. * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE (*)
  1774. *
  1775. * (*) value not defined in all devices.
  1776. * @retval None
  1777. */
  1778. __STATIC_INLINE void LL_RCC_SetUSARTClockSource(uint32_t USARTxSource)
  1779. {
  1780. MODIFY_REG(RCC->CCIPR, (USARTxSource >> 16U), (USARTxSource & 0x0000FFFFU));
  1781. }
  1782. #if defined(LPUART1)
  1783. /**
  1784. * @brief Configure LPUARTx clock source
  1785. * @rmtoll CCIPR LPUART1SEL LL_RCC_SetLPUARTClockSource
  1786. * @rmtoll CCIPR LPUART2SEL LL_RCC_SetLPUARTClockSource
  1787. * @param LPUARTxSource This parameter can be one of the following values:
  1788. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
  1789. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
  1790. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  1791. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  1792. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_PCLK1 (*)
  1793. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_SYSCLK (*)
  1794. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_HSI (*)
  1795. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_LSE (*)
  1796. * (*) feature not available on all devices
  1797. * @retval None
  1798. */
  1799. __STATIC_INLINE void LL_RCC_SetLPUARTClockSource(uint32_t LPUARTxSource)
  1800. {
  1801. MODIFY_REG(RCC->CCIPR, (LPUARTxSource >> 16U), (LPUARTxSource & 0x0000FFFFU));
  1802. }
  1803. #endif /* LPUART1 */
  1804. /**
  1805. * @brief Configure I2Cx clock source
  1806. * @rmtoll CCIPR I2C1SEL LL_RCC_SetI2CClockSource
  1807. * @param I2CxSource This parameter can be one of the following values:
  1808. * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
  1809. * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
  1810. * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
  1811. * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1 (*)
  1812. * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK (*)
  1813. * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI (*)
  1814. * (*) value not defined in all devices.
  1815. * @retval None
  1816. */
  1817. __STATIC_INLINE void LL_RCC_SetI2CClockSource(uint32_t I2CxSource)
  1818. {
  1819. MODIFY_REG(RCC->CCIPR, (I2CxSource >> 16U), (I2CxSource & 0x0000FFFFU));
  1820. }
  1821. #if defined(RCC_CCIPR_TIM1SEL) || defined(RCC_CCIPR_TIM15SEL)
  1822. /**
  1823. * @brief Configure TIMx clock source
  1824. * @rmtoll CCIPR TIMxSEL LL_RCC_SetTIMClockSource
  1825. * @param TIMxSource This parameter can be one of the following values:
  1826. * @arg @ref LL_RCC_TIM1_CLKSOURCE_PLL
  1827. * @arg @ref LL_RCC_TIM1_CLKSOURCE_PCLK1
  1828. * @if defined(STM32G081xx)
  1829. * @arg @ref LL_RCC_TIM15_CLKSOURCE_PLL
  1830. * @arg @ref LL_RCC_TIM15_CLKSOURCE_PCLK1
  1831. * @endif
  1832. * @retval None
  1833. */
  1834. __STATIC_INLINE void LL_RCC_SetTIMClockSource(uint32_t TIMxSource)
  1835. {
  1836. MODIFY_REG(RCC->CCIPR, (TIMxSource & 0xFFFF0000U), (TIMxSource << 16));
  1837. }
  1838. #endif /* RCC_CCIPR_TIM1SEL && RCC_CCIPR_TIM15SEL */
  1839. #if defined(LPTIM1) && defined(LPTIM2)
  1840. /**
  1841. * @brief Configure LPTIMx clock source
  1842. * @rmtoll CCIPR LPTIMxSEL LL_RCC_SetLPTIMClockSource
  1843. * @param LPTIMxSource This parameter can be one of the following values:
  1844. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  1845. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  1846. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
  1847. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  1848. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK1
  1849. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  1850. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_HSI
  1851. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  1852. * @retval None
  1853. */
  1854. __STATIC_INLINE void LL_RCC_SetLPTIMClockSource(uint32_t LPTIMxSource)
  1855. {
  1856. MODIFY_REG(RCC->CCIPR, (LPTIMxSource & 0xFFFF0000U), (LPTIMxSource << 16U));
  1857. }
  1858. #endif /* LPTIM1 && LPTIM2 */
  1859. #if defined(CEC)
  1860. /**
  1861. * @brief Configure CEC clock source
  1862. * @rmtoll CCIPR CECSEL LL_RCC_SetCECClockSource
  1863. * @param CECxSource This parameter can be one of the following values:
  1864. * @arg @ref LL_RCC_CEC_CLKSOURCE_HSI_DIV488
  1865. * @arg @ref LL_RCC_CEC_CLKSOURCE_LSE
  1866. * @retval None
  1867. */
  1868. __STATIC_INLINE void LL_RCC_SetCECClockSource(uint32_t CECxSource)
  1869. {
  1870. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CECSEL, CECxSource);
  1871. }
  1872. #endif /* CEC */
  1873. #if defined(RCC_CCIPR_RNGDIV)
  1874. /**
  1875. * @brief Configure RNG division factor
  1876. * @rmtoll CCIPR RNGDIV LL_RCC_SetRNGClockDiv
  1877. * @param RNGxDiv This parameter can be one of the following values:
  1878. * @arg @ref LL_RCC_RNG_CLK_DIV1
  1879. * @arg @ref LL_RCC_RNG_CLK_DIV2
  1880. * @arg @ref LL_RCC_RNG_CLK_DIV4
  1881. * @arg @ref LL_RCC_RNG_CLK_DIV8
  1882. * @retval None
  1883. */
  1884. __STATIC_INLINE void LL_RCC_SetRNGClockDiv(uint32_t RNGxDiv)
  1885. {
  1886. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_RNGDIV, RNGxDiv);
  1887. }
  1888. #endif /* RNG */
  1889. #if defined (RCC_CCIPR_RNGSEL)
  1890. /**
  1891. * @brief Configure RNG clock source
  1892. * @rmtoll CCIPR RNGSEL LL_RCC_SetRNGClockSource
  1893. * @param RNGxSource This parameter can be one of the following values:
  1894. * @arg @ref LL_RCC_RNG_CLKSOURCE_NONE
  1895. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI_DIV8
  1896. * @arg @ref LL_RCC_RNG_CLKSOURCE_SYSCLK
  1897. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
  1898. * @retval None
  1899. */
  1900. __STATIC_INLINE void LL_RCC_SetRNGClockSource(uint32_t RNGxSource)
  1901. {
  1902. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_RNGSEL, RNGxSource);
  1903. }
  1904. #endif /* RNG */
  1905. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  1906. /**
  1907. * @brief Configure USB clock source
  1908. * @rmtoll CCIPR2 CK48MSEL LL_RCC_SetUSBClockSource
  1909. * @param USBxSource This parameter can be one of the following values:
  1910. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
  1911. * @arg @ref LL_RCC_USB_CLKSOURCE_HSE
  1912. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
  1913. *
  1914. * (*) value not defined in all devices.
  1915. * @retval None
  1916. */
  1917. __STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t USBxSource)
  1918. {
  1919. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_USBSEL, USBxSource);
  1920. }
  1921. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  1922. #if defined (FDCAN1) || defined (FDCAN2)
  1923. /**
  1924. * @brief Configure FDCAN clock source
  1925. * @rmtoll CCIPR2 FDCANSEL LL_RCC_SetFDCANClockSource
  1926. * @param FDCANxSource This parameter can be one of the following values:
  1927. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
  1928. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PCLK1
  1929. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL
  1930. * @retval None
  1931. */
  1932. __STATIC_INLINE void LL_RCC_SetFDCANClockSource(uint32_t FDCANxSource)
  1933. {
  1934. MODIFY_REG(RCC->CCIPR2, RCC_CCIPR2_FDCANSEL, FDCANxSource);
  1935. }
  1936. #endif /* FDCAN1 || FDCAN2 */
  1937. /**
  1938. * @brief Configure ADC clock source
  1939. * @rmtoll CCIPR ADCSEL LL_RCC_SetADCClockSource
  1940. * @param ADCxSource This parameter can be one of the following values:
  1941. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLL
  1942. * @arg @ref LL_RCC_ADC_CLKSOURCE_SYSCLK
  1943. * @arg @ref LL_RCC_ADC_CLKSOURCE_HSI
  1944. * @retval None
  1945. */
  1946. __STATIC_INLINE void LL_RCC_SetADCClockSource(uint32_t ADCxSource)
  1947. {
  1948. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_ADCSEL, ADCxSource);
  1949. }
  1950. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  1951. /**
  1952. * @brief Configure I2Sx clock source
  1953. * @rmtoll CCIPR2 I2SxSEL LL_RCC_SetI2SClockSource
  1954. * @param I2SxSource This parameter can be one of the following values:
  1955. * @arg @ref LL_RCC_I2S1_CLKSOURCE_SYSCLK
  1956. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PIN
  1957. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLL
  1958. * @arg @ref LL_RCC_I2S1_CLKSOURCE_HSI
  1959. * @arg @ref LL_RCC_I2S2_CLKSOURCE_SYSCLK
  1960. * @arg @ref LL_RCC_I2S2_CLKSOURCE_PIN
  1961. * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLL
  1962. * @arg @ref LL_RCC_I2S2_CLKSOURCE_HSI
  1963. * @retval None
  1964. */
  1965. __STATIC_INLINE void LL_RCC_SetI2SClockSource(uint32_t I2SxSource)
  1966. {
  1967. MODIFY_REG(RCC->CCIPR2, (I2SxSource >> 16U), (I2SxSource & 0x0000FFFFU));
  1968. }
  1969. #else
  1970. /**
  1971. * @brief Configure I2Sx clock source
  1972. * @rmtoll CCIPR I2S1SEL LL_RCC_SetI2SClockSource
  1973. * @param I2SxSource This parameter can be one of the following values:
  1974. * @arg @ref LL_RCC_I2S1_CLKSOURCE_SYSCLK
  1975. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PIN
  1976. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLL
  1977. * @arg @ref LL_RCC_I2S1_CLKSOURCE_HSI
  1978. * @retval None
  1979. */
  1980. __STATIC_INLINE void LL_RCC_SetI2SClockSource(uint32_t I2SxSource)
  1981. {
  1982. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2S1SEL, I2SxSource);
  1983. }
  1984. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  1985. /**
  1986. * @brief Get USARTx clock source
  1987. * @rmtoll CCIPR USARTxSEL LL_RCC_GetUSARTClockSource
  1988. * @param USARTx This parameter can be one of the following values:
  1989. * @arg @ref LL_RCC_USART1_CLKSOURCE
  1990. * @arg @ref LL_RCC_USART2_CLKSOURCE
  1991. * @arg @ref LL_RCC_USART3_CLKSOURCE (*)
  1992. * @retval Returned value can be one of the following values:
  1993. * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK1
  1994. * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
  1995. * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
  1996. * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
  1997. * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
  1998. * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
  1999. * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
  2000. * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
  2001. * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1 (*)
  2002. * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK (*)
  2003. * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI (*)
  2004. * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE (*)
  2005. * (*) feature not available on all devices
  2006. */
  2007. __STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx)
  2008. {
  2009. return (uint32_t)(READ_BIT(RCC->CCIPR, USARTx) | (USARTx << 16U));
  2010. }
  2011. #if defined (LPUART2) || defined (LPUART1)
  2012. /**
  2013. * @brief Get LPUARTx clock source
  2014. * @rmtoll CCIPR LPUART1SEL LL_RCC_GetLPUARTClockSource\n
  2015. * CCIPR LPUART2SEL LL_RCC_GetLPUARTClockSource
  2016. * @param LPUARTx This parameter can be one of the following values:
  2017. * @arg @ref LL_RCC_LPUART1_CLKSOURCE
  2018. * @arg @ref LL_RCC_LPUART2_CLKSOURCE (*)
  2019. * @retval Returned value can be one of the following values:
  2020. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
  2021. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
  2022. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
  2023. * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
  2024. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_PCLK1 (*)
  2025. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_SYSCLK (*)
  2026. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_HSI (*)
  2027. * @arg @ref LL_RCC_LPUART2_CLKSOURCE_LSE (*)
  2028. * (*) feature not available on all devices
  2029. */
  2030. __STATIC_INLINE uint32_t LL_RCC_GetLPUARTClockSource(uint32_t LPUARTx)
  2031. {
  2032. return (uint32_t)(READ_BIT(RCC->CCIPR, LPUARTx) | (LPUARTx << 16U));
  2033. }
  2034. #endif /* LPUART2 || LPUART1 */
  2035. /**
  2036. * @brief Get I2Cx clock source
  2037. * @rmtoll CCIPR I2C1SEL LL_RCC_GetI2CClockSource\n
  2038. * CCIPR I2C2SEL LL_RCC_GetI2CClockSource
  2039. * @param I2Cx This parameter can be one of the following values:
  2040. * @arg @ref LL_RCC_I2C1_CLKSOURCE
  2041. * @arg @ref LL_RCC_I2C2_CLKSOURCE
  2042. * @retval Returned value can be one of the following values:
  2043. * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
  2044. * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
  2045. * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
  2046. * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1
  2047. * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK
  2048. * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI
  2049. */
  2050. __STATIC_INLINE uint32_t LL_RCC_GetI2CClockSource(uint32_t I2Cx)
  2051. {
  2052. return (uint32_t)(READ_BIT(RCC->CCIPR, I2Cx) | (I2Cx << 16U));
  2053. }
  2054. #if defined(RCC_CCIPR_TIM1SEL) || defined(RCC_CCIPR_TIM15SEL)
  2055. /**
  2056. * @brief Get TIMx clock source
  2057. * @rmtoll CCIPR TIMxSEL LL_RCC_GetTIMClockSource
  2058. * @param TIMx This parameter can be one of the following values:
  2059. * @arg @ref LL_RCC_TIM1_CLKSOURCE
  2060. * @arg @ref LL_RCC_TIM15_CLKSOURCE
  2061. * @retval Returned value can be one of the following values:
  2062. * @arg @ref LL_RCC_TIM1_CLKSOURCE_PLL
  2063. * @arg @ref LL_RCC_TIM1_CLKSOURCE_PCLK1
  2064. * @if defined(STM32G081xx)
  2065. * @arg @ref LL_RCC_TIM15_CLKSOURCE_PLL
  2066. * @arg @ref LL_RCC_TIM15_CLKSOURCE_PCLK1
  2067. * @endif
  2068. */
  2069. __STATIC_INLINE uint32_t LL_RCC_GetTIMClockSource(uint32_t TIMx)
  2070. {
  2071. return (uint32_t)((READ_BIT(RCC->CCIPR, TIMx) >> 16U) | TIMx);
  2072. }
  2073. #endif /* RCC_CCIPR_TIM1SEL || RCC_CCIPR_TIM15SEL */
  2074. #if defined(LPTIM1) && defined(LPTIM2)
  2075. /**
  2076. * @brief Get LPTIMx clock source
  2077. * @rmtoll CCIPR LPTIM1SEL LL_RCC_GetLPTIMClockSource\n
  2078. CCIPR LPTIM2SEL LL_RCC_GetLPTIMClockSource
  2079. * @param LPTIMx This parameter can be one of the following values:
  2080. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
  2081. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE
  2082. * @retval Returned value can be one of the following values:
  2083. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
  2084. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
  2085. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
  2086. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
  2087. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_PCLK1
  2088. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSI
  2089. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_HSI
  2090. * @arg @ref LL_RCC_LPTIM2_CLKSOURCE_LSE
  2091. */
  2092. __STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx)
  2093. {
  2094. return (uint32_t)((READ_BIT(RCC->CCIPR, LPTIMx) >> 16U) | LPTIMx);
  2095. }
  2096. #endif /* LPTIM1 && LPTIM2 */
  2097. #if defined (RCC_CCIPR_CECSEL)
  2098. /**
  2099. * @brief Get CEC clock source
  2100. * @rmtoll CCIPR CECSEL LL_RCC_GetCECClockSource
  2101. * @param CECx This parameter can be one of the following values:
  2102. * @arg @ref LL_RCC_CEC_CLKSOURCE
  2103. * @retval Returned value can be one of the following values:
  2104. * @arg @ref LL_RCC_CEC_CLKSOURCE_HSI_DIV488
  2105. * @arg @ref LL_RCC_CEC_CLKSOURCE_LSE
  2106. */
  2107. __STATIC_INLINE uint32_t LL_RCC_GetCECClockSource(uint32_t CECx)
  2108. {
  2109. return (uint32_t)(READ_BIT(RCC->CCIPR, CECx));
  2110. }
  2111. #endif /* CEC */
  2112. #if defined(RCC_CCIPR2_FDCANSEL)
  2113. /**
  2114. * @brief Get FDCAN clock source
  2115. * @rmtoll CCIPR2 FDCANSEL LL_RCC_GetFDCANClockSource
  2116. * @param FDCANx This parameter can be one of the following values:
  2117. * @arg @ref LL_RCC_FDCAN_CLKSOURCE
  2118. * @retval Returned value can be one of the following values:
  2119. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PCLK1
  2120. * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
  2121. */
  2122. __STATIC_INLINE uint32_t LL_RCC_GetFDCANClockSource(uint32_t FDCANx)
  2123. {
  2124. return (uint32_t)(READ_BIT(RCC->CCIPR2, FDCANx));
  2125. }
  2126. #endif /* RCC_CCIPR2_FDCANSEL */
  2127. #if defined(RNG)
  2128. /**
  2129. * @brief Get RNGx clock source
  2130. * @rmtoll CCIPR RNGSEL LL_RCC_GetRNGClockSource
  2131. * @param RNGx This parameter can be one of the following values:
  2132. * @arg @ref LL_RCC_RNG_CLKSOURCE
  2133. * @retval Returned value can be one of the following values:
  2134. * @arg @ref LL_RCC_RNG_CLKSOURCE_NONE
  2135. * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI_DIV8
  2136. * @arg @ref LL_RCC_RNG_CLKSOURCE_SYSCLK
  2137. * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
  2138. */
  2139. __STATIC_INLINE uint32_t LL_RCC_GetRNGClockSource(uint32_t RNGx)
  2140. {
  2141. return (uint32_t)(READ_BIT(RCC->CCIPR, RNGx));
  2142. }
  2143. #endif /* RNG */
  2144. #if defined(RNG)
  2145. /**
  2146. * @brief Get RNGx clock division factor
  2147. * @rmtoll CCIPR RNGDIV LL_RCC_GetRNGClockDiv
  2148. * @retval Returned value can be one of the following values:
  2149. * @arg @ref LL_RCC_RNG_CLK_DIV1
  2150. * @arg @ref LL_RCC_RNG_CLK_DIV2
  2151. * @arg @ref LL_RCC_RNG_CLK_DIV4
  2152. * @arg @ref LL_RCC_RNG_CLK_DIV8
  2153. */
  2154. __STATIC_INLINE uint32_t LL_RCC_GetRNGClockDiv(void)
  2155. {
  2156. return (uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_RNGDIV));
  2157. }
  2158. #endif /* RNG */
  2159. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  2160. /**
  2161. * @brief Get USBx clock source
  2162. * @rmtoll CCIPR2 CK48MSEL LL_RCC_GetUSBClockSource
  2163. * @param USBx This parameter can be one of the following values:
  2164. * @arg @ref LL_RCC_USB_CLKSOURCE
  2165. * @retval Returned value can be one of the following values:
  2166. * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
  2167. * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
  2168. */
  2169. __STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx)
  2170. {
  2171. return (uint32_t)(READ_BIT(RCC->CCIPR2, USBx));
  2172. }
  2173. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  2174. /**
  2175. * @brief Get ADCx clock source
  2176. * @rmtoll CCIPR ADCSEL LL_RCC_GetADCClockSource
  2177. * @param ADCx This parameter can be one of the following values:
  2178. * @arg @ref LL_RCC_ADC_CLKSOURCE
  2179. * @retval Returned value can be one of the following values:
  2180. * @arg @ref LL_RCC_ADC_CLKSOURCE_HSI
  2181. * @arg @ref LL_RCC_ADC_CLKSOURCE_PLL
  2182. * @arg @ref LL_RCC_ADC_CLKSOURCE_SYSCLK
  2183. */
  2184. __STATIC_INLINE uint32_t LL_RCC_GetADCClockSource(uint32_t ADCx)
  2185. {
  2186. return (uint32_t)(READ_BIT(RCC->CCIPR, ADCx));
  2187. }
  2188. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  2189. /**
  2190. * @brief Get I2Sx clock source
  2191. * @rmtoll CCIPR2 I2S1SEL LL_RCC_GetI2SClockSource\n
  2192. * CCIPR2 I2S2SEL LL_RCC_GetI2SClockSource
  2193. * @param I2Sx This parameter can be one of the following values:
  2194. * @arg @ref LL_RCC_I2S1_CLKSOURCE
  2195. * @arg @ref LL_RCC_I2S2_CLKSOURCE
  2196. * @retval Returned value can be one of the following values:
  2197. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PIN
  2198. * @arg @ref LL_RCC_I2S1_CLKSOURCE_SYSCLK
  2199. * @arg @ref LL_RCC_I2S1_CLKSOURCE_HSI
  2200. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLL
  2201. * @arg @ref LL_RCC_I2S2_CLKSOURCE_PIN
  2202. * @arg @ref LL_RCC_I2S2_CLKSOURCE_SYSCLK
  2203. * @arg @ref LL_RCC_I2S2_CLKSOURCE_HSI
  2204. * @arg @ref LL_RCC_I2S2_CLKSOURCE_PLL
  2205. */
  2206. __STATIC_INLINE uint32_t LL_RCC_GetI2SClockSource(uint32_t I2Sx)
  2207. {
  2208. return (uint32_t)(READ_BIT(RCC->CCIPR2, I2Sx) | (I2Sx << 16U));
  2209. }
  2210. #else
  2211. /**
  2212. * @brief Get I2Sx clock source
  2213. * @rmtoll CCIPR I2S1SEL LL_RCC_GetI2SClockSource
  2214. * @param I2Sx This parameter can be one of the following values:
  2215. * @arg @ref LL_RCC_I2S1_CLKSOURCE
  2216. * @retval Returned value can be one of the following values:
  2217. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PIN
  2218. * @arg @ref LL_RCC_I2S1_CLKSOURCE_SYSCLK
  2219. * @arg @ref LL_RCC_I2S1_CLKSOURCE_HSI
  2220. * @arg @ref LL_RCC_I2S1_CLKSOURCE_PLL
  2221. */
  2222. __STATIC_INLINE uint32_t LL_RCC_GetI2SClockSource(uint32_t I2Sx)
  2223. {
  2224. return (uint32_t)(READ_BIT(RCC->CCIPR, I2Sx));
  2225. }
  2226. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  2227. /**
  2228. * @}
  2229. */
  2230. /** @defgroup RCC_LL_EF_RTC RTC
  2231. * @{
  2232. */
  2233. /**
  2234. * @brief Set RTC Clock Source
  2235. * @note Once the RTC clock source has been selected, it cannot be changed anymore unless
  2236. * the Backup domain is reset, or unless a failure is detected on LSE (LSECSSD is
  2237. * set). The BDRST bit can be used to reset them.
  2238. * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource
  2239. * @param Source This parameter can be one of the following values:
  2240. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  2241. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  2242. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  2243. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
  2244. * @retval None
  2245. */
  2246. __STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source)
  2247. {
  2248. MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source);
  2249. }
  2250. /**
  2251. * @brief Get RTC Clock Source
  2252. * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource
  2253. * @retval Returned value can be one of the following values:
  2254. * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
  2255. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
  2256. * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
  2257. * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
  2258. */
  2259. __STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void)
  2260. {
  2261. return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL));
  2262. }
  2263. /**
  2264. * @brief Enable RTC
  2265. * @rmtoll BDCR RTCEN LL_RCC_EnableRTC
  2266. * @retval None
  2267. */
  2268. __STATIC_INLINE void LL_RCC_EnableRTC(void)
  2269. {
  2270. SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  2271. }
  2272. /**
  2273. * @brief Disable RTC
  2274. * @rmtoll BDCR RTCEN LL_RCC_DisableRTC
  2275. * @retval None
  2276. */
  2277. __STATIC_INLINE void LL_RCC_DisableRTC(void)
  2278. {
  2279. CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
  2280. }
  2281. /**
  2282. * @brief Check if RTC has been enabled or not
  2283. * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC
  2284. * @retval State of bit (1 or 0).
  2285. */
  2286. __STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void)
  2287. {
  2288. return ((READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == (RCC_BDCR_RTCEN)) ? 1UL : 0UL);
  2289. }
  2290. /**
  2291. * @brief Force the Backup domain reset
  2292. * @rmtoll BDCR BDRST LL_RCC_ForceBackupDomainReset
  2293. * @retval None
  2294. */
  2295. __STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void)
  2296. {
  2297. SET_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  2298. }
  2299. /**
  2300. * @brief Release the Backup domain reset
  2301. * @rmtoll BDCR BDRST LL_RCC_ReleaseBackupDomainReset
  2302. * @retval None
  2303. */
  2304. __STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void)
  2305. {
  2306. CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST);
  2307. }
  2308. /**
  2309. * @}
  2310. */
  2311. /** @defgroup RCC_LL_EF_PLL PLL
  2312. * @{
  2313. */
  2314. /**
  2315. * @brief Enable PLL
  2316. * @rmtoll CR PLLON LL_RCC_PLL_Enable
  2317. * @retval None
  2318. */
  2319. __STATIC_INLINE void LL_RCC_PLL_Enable(void)
  2320. {
  2321. SET_BIT(RCC->CR, RCC_CR_PLLON);
  2322. }
  2323. /**
  2324. * @brief Disable PLL
  2325. * @note Cannot be disabled if the PLL clock is used as the system clock
  2326. * @rmtoll CR PLLON LL_RCC_PLL_Disable
  2327. * @retval None
  2328. */
  2329. __STATIC_INLINE void LL_RCC_PLL_Disable(void)
  2330. {
  2331. CLEAR_BIT(RCC->CR, RCC_CR_PLLON);
  2332. }
  2333. /**
  2334. * @brief Check if PLL Ready
  2335. * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady
  2336. * @retval State of bit (1 or 0).
  2337. */
  2338. __STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
  2339. {
  2340. return ((READ_BIT(RCC->CR, RCC_CR_PLLRDY) == (RCC_CR_PLLRDY)) ? 1UL : 0UL);
  2341. }
  2342. /**
  2343. * @brief Configure PLL used for SYSCLK Domain
  2344. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2345. * @note PLLN/PLLR can be written only when PLL is disabled
  2346. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SYS\n
  2347. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SYS\n
  2348. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SYS\n
  2349. * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SYS
  2350. * @param Source This parameter can be one of the following values:
  2351. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2352. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2353. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2354. * @param PLLM This parameter can be one of the following values:
  2355. * @arg @ref LL_RCC_PLLM_DIV_1
  2356. * @arg @ref LL_RCC_PLLM_DIV_2
  2357. * @arg @ref LL_RCC_PLLM_DIV_3
  2358. * @arg @ref LL_RCC_PLLM_DIV_4
  2359. * @arg @ref LL_RCC_PLLM_DIV_5
  2360. * @arg @ref LL_RCC_PLLM_DIV_6
  2361. * @arg @ref LL_RCC_PLLM_DIV_7
  2362. * @arg @ref LL_RCC_PLLM_DIV_8
  2363. * @param PLLN Between 8 and 86
  2364. * @param PLLR This parameter can be one of the following values:
  2365. * @arg @ref LL_RCC_PLLR_DIV_2
  2366. * @arg @ref LL_RCC_PLLR_DIV_3
  2367. * @arg @ref LL_RCC_PLLR_DIV_4
  2368. * @arg @ref LL_RCC_PLLR_DIV_5
  2369. * @arg @ref LL_RCC_PLLR_DIV_6
  2370. * @arg @ref LL_RCC_PLLR_DIV_7
  2371. * @arg @ref LL_RCC_PLLR_DIV_8
  2372. * @retval None
  2373. */
  2374. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLR)
  2375. {
  2376. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR,
  2377. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLR);
  2378. }
  2379. /**
  2380. * @brief Configure PLL used for ADC domain clock
  2381. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2382. * @note PLLN/PLLP can be written only when PLL is disabled
  2383. * @note User shall verify whether the PLL configuration is not done through
  2384. * other functions (ex: I2S1)
  2385. * @note This can be selected for ADC
  2386. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_ADC\n
  2387. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_ADC\n
  2388. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_ADC\n
  2389. * PLLCFGR PLLP LL_RCC_PLL_ConfigDomain_ADC
  2390. * @param Source This parameter can be one of the following values:
  2391. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2392. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2393. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2394. * @param PLLM This parameter can be one of the following values:
  2395. * @arg @ref LL_RCC_PLLM_DIV_1
  2396. * @arg @ref LL_RCC_PLLM_DIV_2
  2397. * @arg @ref LL_RCC_PLLM_DIV_3
  2398. * @arg @ref LL_RCC_PLLM_DIV_4
  2399. * @arg @ref LL_RCC_PLLM_DIV_5
  2400. * @arg @ref LL_RCC_PLLM_DIV_6
  2401. * @arg @ref LL_RCC_PLLM_DIV_7
  2402. * @arg @ref LL_RCC_PLLM_DIV_8
  2403. * @param PLLN Between 8 and 86
  2404. * @param PLLP This parameter can be one of the following values:
  2405. * @arg @ref LL_RCC_PLLP_DIV_2
  2406. * @arg @ref LL_RCC_PLLP_DIV_3
  2407. * @arg @ref LL_RCC_PLLP_DIV_4
  2408. * @arg @ref LL_RCC_PLLP_DIV_5
  2409. * @arg @ref LL_RCC_PLLP_DIV_6
  2410. * @arg @ref LL_RCC_PLLP_DIV_7
  2411. * @arg @ref LL_RCC_PLLP_DIV_8
  2412. * @arg @ref LL_RCC_PLLP_DIV_9
  2413. * @arg @ref LL_RCC_PLLP_DIV_10
  2414. * @arg @ref LL_RCC_PLLP_DIV_11
  2415. * @arg @ref LL_RCC_PLLP_DIV_12
  2416. * @arg @ref LL_RCC_PLLP_DIV_13
  2417. * @arg @ref LL_RCC_PLLP_DIV_14
  2418. * @arg @ref LL_RCC_PLLP_DIV_15
  2419. * @arg @ref LL_RCC_PLLP_DIV_16
  2420. * @arg @ref LL_RCC_PLLP_DIV_17
  2421. * @arg @ref LL_RCC_PLLP_DIV_18
  2422. * @arg @ref LL_RCC_PLLP_DIV_19
  2423. * @arg @ref LL_RCC_PLLP_DIV_20
  2424. * @arg @ref LL_RCC_PLLP_DIV_21
  2425. * @arg @ref LL_RCC_PLLP_DIV_22
  2426. * @arg @ref LL_RCC_PLLP_DIV_23
  2427. * @arg @ref LL_RCC_PLLP_DIV_24
  2428. * @arg @ref LL_RCC_PLLP_DIV_25
  2429. * @arg @ref LL_RCC_PLLP_DIV_26
  2430. * @arg @ref LL_RCC_PLLP_DIV_27
  2431. * @arg @ref LL_RCC_PLLP_DIV_28
  2432. * @arg @ref LL_RCC_PLLP_DIV_29
  2433. * @arg @ref LL_RCC_PLLP_DIV_30
  2434. * @arg @ref LL_RCC_PLLP_DIV_31
  2435. * @arg @ref LL_RCC_PLLP_DIV_32
  2436. * @retval None
  2437. */
  2438. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_ADC(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  2439. {
  2440. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLP,
  2441. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLP);
  2442. }
  2443. /**
  2444. * @brief Configure PLL used for I2S1 domain clock
  2445. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2446. * @note PLLN/PLLP can be written only when PLL is disabled
  2447. * @note User shall verify whether the PLL configuration is not done through
  2448. * other functions (ex: ADC)
  2449. * @note This can be selected for I2S1
  2450. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_I2S1\n
  2451. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_I2S1\n
  2452. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_I2S1\n
  2453. * PLLCFGR PLLP LL_RCC_PLL_ConfigDomain_I2S1
  2454. * @param Source This parameter can be one of the following values:
  2455. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2456. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2457. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2458. * @param PLLM This parameter can be one of the following values:
  2459. * @arg @ref LL_RCC_PLLM_DIV_1
  2460. * @arg @ref LL_RCC_PLLM_DIV_2
  2461. * @arg @ref LL_RCC_PLLM_DIV_3
  2462. * @arg @ref LL_RCC_PLLM_DIV_4
  2463. * @arg @ref LL_RCC_PLLM_DIV_5
  2464. * @arg @ref LL_RCC_PLLM_DIV_6
  2465. * @arg @ref LL_RCC_PLLM_DIV_7
  2466. * @arg @ref LL_RCC_PLLM_DIV_8
  2467. * @param PLLN Between 8 and 86
  2468. * @param PLLP This parameter can be one of the following values:
  2469. * @arg @ref LL_RCC_PLLP_DIV_2
  2470. * @arg @ref LL_RCC_PLLP_DIV_3
  2471. * @arg @ref LL_RCC_PLLP_DIV_4
  2472. * @arg @ref LL_RCC_PLLP_DIV_5
  2473. * @arg @ref LL_RCC_PLLP_DIV_6
  2474. * @arg @ref LL_RCC_PLLP_DIV_7
  2475. * @arg @ref LL_RCC_PLLP_DIV_8
  2476. * @arg @ref LL_RCC_PLLP_DIV_9
  2477. * @arg @ref LL_RCC_PLLP_DIV_10
  2478. * @arg @ref LL_RCC_PLLP_DIV_11
  2479. * @arg @ref LL_RCC_PLLP_DIV_12
  2480. * @arg @ref LL_RCC_PLLP_DIV_13
  2481. * @arg @ref LL_RCC_PLLP_DIV_14
  2482. * @arg @ref LL_RCC_PLLP_DIV_15
  2483. * @arg @ref LL_RCC_PLLP_DIV_16
  2484. * @arg @ref LL_RCC_PLLP_DIV_17
  2485. * @arg @ref LL_RCC_PLLP_DIV_18
  2486. * @arg @ref LL_RCC_PLLP_DIV_19
  2487. * @arg @ref LL_RCC_PLLP_DIV_20
  2488. * @arg @ref LL_RCC_PLLP_DIV_21
  2489. * @arg @ref LL_RCC_PLLP_DIV_22
  2490. * @arg @ref LL_RCC_PLLP_DIV_23
  2491. * @arg @ref LL_RCC_PLLP_DIV_24
  2492. * @arg @ref LL_RCC_PLLP_DIV_25
  2493. * @arg @ref LL_RCC_PLLP_DIV_26
  2494. * @arg @ref LL_RCC_PLLP_DIV_27
  2495. * @arg @ref LL_RCC_PLLP_DIV_28
  2496. * @arg @ref LL_RCC_PLLP_DIV_29
  2497. * @arg @ref LL_RCC_PLLP_DIV_30
  2498. * @arg @ref LL_RCC_PLLP_DIV_31
  2499. * @arg @ref LL_RCC_PLLP_DIV_32
  2500. * @retval None
  2501. */
  2502. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_I2S1(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  2503. {
  2504. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLP,
  2505. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLP);
  2506. }
  2507. #if defined(RCC_CCIPR2_I2S2SEL)
  2508. /**
  2509. * @brief Configure PLL used for I2S2 domain clock
  2510. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2511. * @note PLLN/PLLP can be written only when PLL is disabled
  2512. * @note User shall verify whether the PLL configuration is not done through
  2513. * other functions (ex: ADC)
  2514. * @note This can be selected for I2S2
  2515. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_I2S2\n
  2516. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_I2S2\n
  2517. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_I2S2\n
  2518. * PLLCFGR PLLP LL_RCC_PLL_ConfigDomain_I2S2
  2519. * @param Source This parameter can be one of the following values:
  2520. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2521. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2522. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2523. * @param PLLM This parameter can be one of the following values:
  2524. * @arg @ref LL_RCC_PLLM_DIV_1
  2525. * @arg @ref LL_RCC_PLLM_DIV_2
  2526. * @arg @ref LL_RCC_PLLM_DIV_3
  2527. * @arg @ref LL_RCC_PLLM_DIV_4
  2528. * @arg @ref LL_RCC_PLLM_DIV_5
  2529. * @arg @ref LL_RCC_PLLM_DIV_6
  2530. * @arg @ref LL_RCC_PLLM_DIV_7
  2531. * @arg @ref LL_RCC_PLLM_DIV_8
  2532. * @param PLLN Between 8 and 86
  2533. * @param PLLP This parameter can be one of the following values:
  2534. * @arg @ref LL_RCC_PLLP_DIV_2
  2535. * @arg @ref LL_RCC_PLLP_DIV_3
  2536. * @arg @ref LL_RCC_PLLP_DIV_4
  2537. * @arg @ref LL_RCC_PLLP_DIV_5
  2538. * @arg @ref LL_RCC_PLLP_DIV_6
  2539. * @arg @ref LL_RCC_PLLP_DIV_7
  2540. * @arg @ref LL_RCC_PLLP_DIV_8
  2541. * @arg @ref LL_RCC_PLLP_DIV_9
  2542. * @arg @ref LL_RCC_PLLP_DIV_10
  2543. * @arg @ref LL_RCC_PLLP_DIV_11
  2544. * @arg @ref LL_RCC_PLLP_DIV_12
  2545. * @arg @ref LL_RCC_PLLP_DIV_13
  2546. * @arg @ref LL_RCC_PLLP_DIV_14
  2547. * @arg @ref LL_RCC_PLLP_DIV_15
  2548. * @arg @ref LL_RCC_PLLP_DIV_16
  2549. * @arg @ref LL_RCC_PLLP_DIV_17
  2550. * @arg @ref LL_RCC_PLLP_DIV_18
  2551. * @arg @ref LL_RCC_PLLP_DIV_19
  2552. * @arg @ref LL_RCC_PLLP_DIV_20
  2553. * @arg @ref LL_RCC_PLLP_DIV_21
  2554. * @arg @ref LL_RCC_PLLP_DIV_22
  2555. * @arg @ref LL_RCC_PLLP_DIV_23
  2556. * @arg @ref LL_RCC_PLLP_DIV_24
  2557. * @arg @ref LL_RCC_PLLP_DIV_25
  2558. * @arg @ref LL_RCC_PLLP_DIV_26
  2559. * @arg @ref LL_RCC_PLLP_DIV_27
  2560. * @arg @ref LL_RCC_PLLP_DIV_28
  2561. * @arg @ref LL_RCC_PLLP_DIV_29
  2562. * @arg @ref LL_RCC_PLLP_DIV_30
  2563. * @arg @ref LL_RCC_PLLP_DIV_31
  2564. * @arg @ref LL_RCC_PLLP_DIV_32
  2565. * @retval None
  2566. */
  2567. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_I2S2(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP)
  2568. {
  2569. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLP,
  2570. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLP);
  2571. }
  2572. #endif /* RCC_CCIPR2_I2S2SEL */
  2573. #if defined(RNG)
  2574. /**
  2575. * @brief Configure PLL used for RNG domain clock
  2576. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2577. * @note PLLN/PLLQ can be written only when PLL is disabled
  2578. * @note User shall verify whether the PLL configuration is not done through
  2579. * other functions (ex: TIM1, TIM15)
  2580. * @note This can be selected for RNG
  2581. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_RNG\n
  2582. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_RNG\n
  2583. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_RNG\n
  2584. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_RNG
  2585. * @param Source This parameter can be one of the following values:
  2586. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2587. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2588. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2589. * @param PLLM This parameter can be one of the following values:
  2590. * @arg @ref LL_RCC_PLLM_DIV_1
  2591. * @arg @ref LL_RCC_PLLM_DIV_2
  2592. * @arg @ref LL_RCC_PLLM_DIV_3
  2593. * @arg @ref LL_RCC_PLLM_DIV_4
  2594. * @arg @ref LL_RCC_PLLM_DIV_5
  2595. * @arg @ref LL_RCC_PLLM_DIV_6
  2596. * @arg @ref LL_RCC_PLLM_DIV_7
  2597. * @arg @ref LL_RCC_PLLM_DIV_8
  2598. * @param PLLN Between 8 and 86
  2599. * @param PLLQ This parameter can be one of the following values:
  2600. * @arg @ref LL_RCC_PLLQ_DIV_2
  2601. * @arg @ref LL_RCC_PLLQ_DIV_3
  2602. * @arg @ref LL_RCC_PLLQ_DIV_4
  2603. * @arg @ref LL_RCC_PLLQ_DIV_5
  2604. * @arg @ref LL_RCC_PLLQ_DIV_6
  2605. * @arg @ref LL_RCC_PLLQ_DIV_7
  2606. * @arg @ref LL_RCC_PLLQ_DIV_8
  2607. * @retval None
  2608. */
  2609. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_RNG(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  2610. {
  2611. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  2612. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  2613. }
  2614. #endif /* RNG */
  2615. #if defined(FDCAN1) || defined(FDCAN2)
  2616. /**
  2617. * @brief Configure PLL used for FDCAN domain clock
  2618. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2619. * @note PLLN/PLLQ can be written only when PLL is disabled
  2620. * @note User shall verify whether the PLL configuration is not done through
  2621. * other functions (ex: TIM1, TIM15)
  2622. * @note This can be selected for FDCAN
  2623. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_FDCAN\n
  2624. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_FDCAN\n
  2625. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_FDCAN\n
  2626. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_FDCAN
  2627. * @param Source This parameter can be one of the following values:
  2628. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2629. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2630. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2631. * @param PLLM This parameter can be one of the following values:
  2632. * @arg @ref LL_RCC_PLLM_DIV_1
  2633. * @arg @ref LL_RCC_PLLM_DIV_2
  2634. * @arg @ref LL_RCC_PLLM_DIV_3
  2635. * @arg @ref LL_RCC_PLLM_DIV_4
  2636. * @arg @ref LL_RCC_PLLM_DIV_5
  2637. * @arg @ref LL_RCC_PLLM_DIV_6
  2638. * @arg @ref LL_RCC_PLLM_DIV_7
  2639. * @arg @ref LL_RCC_PLLM_DIV_8
  2640. * @param PLLN Between 8 and 86
  2641. * @param PLLQ This parameter can be one of the following values:
  2642. * @arg @ref LL_RCC_PLLQ_DIV_2
  2643. * @arg @ref LL_RCC_PLLQ_DIV_3
  2644. * @arg @ref LL_RCC_PLLQ_DIV_4
  2645. * @arg @ref LL_RCC_PLLQ_DIV_5
  2646. * @arg @ref LL_RCC_PLLQ_DIV_6
  2647. * @arg @ref LL_RCC_PLLQ_DIV_7
  2648. * @arg @ref LL_RCC_PLLQ_DIV_8
  2649. * @retval None
  2650. */
  2651. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_FDCAN(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  2652. {
  2653. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  2654. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  2655. }
  2656. #endif /* FDCAN1 || FDCAN2 */
  2657. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  2658. /**
  2659. * @brief Configure PLL used for USB domain clock
  2660. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2661. * @note PLLN/PLLQ can be written only when PLL is disabled
  2662. * @note User shall verify whether the PLL configuration is not done through
  2663. * other functions (ex: TIM1, TIM15)
  2664. * @note This can be selected for USB
  2665. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_USB\n
  2666. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_USB\n
  2667. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_USB\n
  2668. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_USB
  2669. * @param Source This parameter can be one of the following values:
  2670. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2671. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2672. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2673. * @param PLLM This parameter can be one of the following values:
  2674. * @arg @ref LL_RCC_PLLM_DIV_1
  2675. * @arg @ref LL_RCC_PLLM_DIV_2
  2676. * @arg @ref LL_RCC_PLLM_DIV_3
  2677. * @arg @ref LL_RCC_PLLM_DIV_4
  2678. * @arg @ref LL_RCC_PLLM_DIV_5
  2679. * @arg @ref LL_RCC_PLLM_DIV_6
  2680. * @arg @ref LL_RCC_PLLM_DIV_7
  2681. * @arg @ref LL_RCC_PLLM_DIV_8
  2682. * @param PLLN Between 8 and 86
  2683. * @param PLLQ This parameter can be one of the following values:
  2684. * @arg @ref LL_RCC_PLLQ_DIV_2
  2685. * @arg @ref LL_RCC_PLLQ_DIV_3
  2686. * @arg @ref LL_RCC_PLLQ_DIV_4
  2687. * @arg @ref LL_RCC_PLLQ_DIV_5
  2688. * @arg @ref LL_RCC_PLLQ_DIV_6
  2689. * @arg @ref LL_RCC_PLLQ_DIV_7
  2690. * @arg @ref LL_RCC_PLLQ_DIV_8
  2691. * @retval None
  2692. */
  2693. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_USB(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  2694. {
  2695. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  2696. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  2697. }
  2698. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  2699. #if defined(RCC_PLLQ_SUPPORT)
  2700. /**
  2701. * @brief Configure PLL used for TIM1 domain clock
  2702. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2703. * @note PLLN/PLLQ can be written only when PLL is disabled
  2704. * @note User shall verify whether the PLL configuration is not done through
  2705. * other functions (ex: RNG, TIM15)
  2706. * @note This can be selected for TIM1
  2707. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_TIM1\n
  2708. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_TIM1\n
  2709. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_TIM1\n
  2710. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_TIM1
  2711. * @param Source This parameter can be one of the following values:
  2712. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2713. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2714. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2715. * @param PLLM This parameter can be one of the following values:
  2716. * @arg @ref LL_RCC_PLLM_DIV_1
  2717. * @arg @ref LL_RCC_PLLM_DIV_2
  2718. * @arg @ref LL_RCC_PLLM_DIV_3
  2719. * @arg @ref LL_RCC_PLLM_DIV_4
  2720. * @arg @ref LL_RCC_PLLM_DIV_5
  2721. * @arg @ref LL_RCC_PLLM_DIV_6
  2722. * @arg @ref LL_RCC_PLLM_DIV_7
  2723. * @arg @ref LL_RCC_PLLM_DIV_8
  2724. * @param PLLN Between 8 and 86
  2725. * @param PLLQ This parameter can be one of the following values:
  2726. * @arg @ref LL_RCC_PLLQ_DIV_2
  2727. * @arg @ref LL_RCC_PLLQ_DIV_3
  2728. * @arg @ref LL_RCC_PLLQ_DIV_4
  2729. * @arg @ref LL_RCC_PLLQ_DIV_5
  2730. * @arg @ref LL_RCC_PLLQ_DIV_6
  2731. * @arg @ref LL_RCC_PLLQ_DIV_7
  2732. * @arg @ref LL_RCC_PLLQ_DIV_8
  2733. * @retval None
  2734. */
  2735. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_TIM1(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  2736. {
  2737. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  2738. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  2739. }
  2740. #endif /* RCC_PLLQ_SUPPORT */
  2741. #if defined(RCC_PLLQ_SUPPORT) && defined(TIM15)
  2742. /**
  2743. * @brief Configure PLL used for TIM15 domain clock
  2744. * @note PLL Source and PLLM Divider can be written only when PLL is disabled
  2745. * @note PLLN/PLLQ can be written only when PLL is disabled
  2746. * @note User shall verify whether the PLL configuration is not done through
  2747. * other functions (ex: RNG, TIM1)
  2748. * @note This can be selected for TIM15
  2749. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_TIM15\n
  2750. * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_TIM15\n
  2751. * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_TIM15\n
  2752. * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_TIM15
  2753. * @param Source This parameter can be one of the following values:
  2754. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2755. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2756. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2757. * @param PLLM This parameter can be one of the following values:
  2758. * @arg @ref LL_RCC_PLLM_DIV_1
  2759. * @arg @ref LL_RCC_PLLM_DIV_2
  2760. * @arg @ref LL_RCC_PLLM_DIV_3
  2761. * @arg @ref LL_RCC_PLLM_DIV_4
  2762. * @arg @ref LL_RCC_PLLM_DIV_5
  2763. * @arg @ref LL_RCC_PLLM_DIV_6
  2764. * @arg @ref LL_RCC_PLLM_DIV_7
  2765. * @arg @ref LL_RCC_PLLM_DIV_8
  2766. * @param PLLN Between 8 and 86
  2767. * @param PLLQ This parameter can be one of the following values:
  2768. * @arg @ref LL_RCC_PLLQ_DIV_2
  2769. * @arg @ref LL_RCC_PLLQ_DIV_3
  2770. * @arg @ref LL_RCC_PLLQ_DIV_4
  2771. * @arg @ref LL_RCC_PLLQ_DIV_5
  2772. * @arg @ref LL_RCC_PLLQ_DIV_6
  2773. * @arg @ref LL_RCC_PLLQ_DIV_7
  2774. * @arg @ref LL_RCC_PLLQ_DIV_8
  2775. * @retval None
  2776. */
  2777. __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_TIM15(uint32_t Source, uint32_t PLLM, uint32_t PLLN, uint32_t PLLQ)
  2778. {
  2779. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLQ,
  2780. Source | PLLM | (PLLN << RCC_PLLCFGR_PLLN_Pos) | PLLQ);
  2781. }
  2782. #endif /* RCC_PLLQ_SUPPORT && TIM15 */
  2783. /**
  2784. * @brief Get Main PLL multiplication factor for VCO
  2785. * @rmtoll PLLCFGR PLLN LL_RCC_PLL_GetN
  2786. * @retval Between 8 and 86
  2787. */
  2788. __STATIC_INLINE uint32_t LL_RCC_PLL_GetN(void)
  2789. {
  2790. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos);
  2791. }
  2792. /**
  2793. * @brief Get Main PLL division factor for PLLP
  2794. * @note used for PLLPCLK (ADC & I2S clock)
  2795. * @rmtoll PLLCFGR PLLP LL_RCC_PLL_GetP
  2796. * @retval Returned value can be one of the following values:
  2797. * @arg @ref LL_RCC_PLLP_DIV_2
  2798. * @arg @ref LL_RCC_PLLP_DIV_3
  2799. * @arg @ref LL_RCC_PLLP_DIV_4
  2800. * @arg @ref LL_RCC_PLLP_DIV_5
  2801. * @arg @ref LL_RCC_PLLP_DIV_6
  2802. * @arg @ref LL_RCC_PLLP_DIV_7
  2803. * @arg @ref LL_RCC_PLLP_DIV_8
  2804. * @arg @ref LL_RCC_PLLP_DIV_9
  2805. * @arg @ref LL_RCC_PLLP_DIV_10
  2806. * @arg @ref LL_RCC_PLLP_DIV_11
  2807. * @arg @ref LL_RCC_PLLP_DIV_12
  2808. * @arg @ref LL_RCC_PLLP_DIV_13
  2809. * @arg @ref LL_RCC_PLLP_DIV_14
  2810. * @arg @ref LL_RCC_PLLP_DIV_15
  2811. * @arg @ref LL_RCC_PLLP_DIV_16
  2812. * @arg @ref LL_RCC_PLLP_DIV_17
  2813. * @arg @ref LL_RCC_PLLP_DIV_18
  2814. * @arg @ref LL_RCC_PLLP_DIV_19
  2815. * @arg @ref LL_RCC_PLLP_DIV_20
  2816. * @arg @ref LL_RCC_PLLP_DIV_21
  2817. * @arg @ref LL_RCC_PLLP_DIV_22
  2818. * @arg @ref LL_RCC_PLLP_DIV_23
  2819. * @arg @ref LL_RCC_PLLP_DIV_24
  2820. * @arg @ref LL_RCC_PLLP_DIV_25
  2821. * @arg @ref LL_RCC_PLLP_DIV_26
  2822. * @arg @ref LL_RCC_PLLP_DIV_27
  2823. * @arg @ref LL_RCC_PLLP_DIV_28
  2824. * @arg @ref LL_RCC_PLLP_DIV_29
  2825. * @arg @ref LL_RCC_PLLP_DIV_30
  2826. * @arg @ref LL_RCC_PLLP_DIV_31
  2827. * @arg @ref LL_RCC_PLLP_DIV_32
  2828. */
  2829. __STATIC_INLINE uint32_t LL_RCC_PLL_GetP(void)
  2830. {
  2831. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLP));
  2832. }
  2833. #if defined(RCC_PLLQ_SUPPORT)
  2834. /**
  2835. * @brief Get Main PLL division factor for PLLQ
  2836. * @note used for PLLQCLK selected for RNG, TIM1, TIM15 clock
  2837. * @rmtoll PLLCFGR PLLQ LL_RCC_PLL_GetQ
  2838. * @retval Returned value can be one of the following values:
  2839. * @arg @ref LL_RCC_PLLQ_DIV_2
  2840. * @arg @ref LL_RCC_PLLQ_DIV_3
  2841. * @arg @ref LL_RCC_PLLQ_DIV_4
  2842. * @arg @ref LL_RCC_PLLQ_DIV_5
  2843. * @arg @ref LL_RCC_PLLQ_DIV_6
  2844. * @arg @ref LL_RCC_PLLQ_DIV_7
  2845. * @arg @ref LL_RCC_PLLQ_DIV_8
  2846. */
  2847. __STATIC_INLINE uint32_t LL_RCC_PLL_GetQ(void)
  2848. {
  2849. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQ));
  2850. }
  2851. #endif /* RCC_PLLQ_SUPPORT */
  2852. /**
  2853. * @brief Get Main PLL division factor for PLLR
  2854. * @note used for PLLCLK (system clock)
  2855. * @rmtoll PLLCFGR PLLR LL_RCC_PLL_GetR
  2856. * @retval Returned value can be one of the following values:
  2857. * @arg @ref LL_RCC_PLLR_DIV_2
  2858. * @arg @ref LL_RCC_PLLR_DIV_3
  2859. * @arg @ref LL_RCC_PLLR_DIV_4
  2860. * @arg @ref LL_RCC_PLLR_DIV_5
  2861. * @arg @ref LL_RCC_PLLR_DIV_6
  2862. * @arg @ref LL_RCC_PLLR_DIV_7
  2863. * @arg @ref LL_RCC_PLLR_DIV_8
  2864. */
  2865. __STATIC_INLINE uint32_t LL_RCC_PLL_GetR(void)
  2866. {
  2867. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLR));
  2868. }
  2869. /**
  2870. * @brief Configure PLL clock source
  2871. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_SetMainSource
  2872. * @param PLLSource This parameter can be one of the following values:
  2873. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2874. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2875. * @retval None
  2876. */
  2877. __STATIC_INLINE void LL_RCC_PLL_SetMainSource(uint32_t PLLSource)
  2878. {
  2879. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSource);
  2880. }
  2881. /**
  2882. * @brief Get the oscillator used as PLL clock source.
  2883. * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_GetMainSource
  2884. * @retval Returned value can be one of the following values:
  2885. * @arg @ref LL_RCC_PLLSOURCE_NONE
  2886. * @arg @ref LL_RCC_PLLSOURCE_HSI
  2887. * @arg @ref LL_RCC_PLLSOURCE_HSE
  2888. */
  2889. __STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void)
  2890. {
  2891. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC));
  2892. }
  2893. /**
  2894. * @brief Get Division factor for the main PLL and other PLL
  2895. * @rmtoll PLLCFGR PLLM LL_RCC_PLL_GetDivider
  2896. * @retval Returned value can be one of the following values:
  2897. * @arg @ref LL_RCC_PLLM_DIV_1
  2898. * @arg @ref LL_RCC_PLLM_DIV_2
  2899. * @arg @ref LL_RCC_PLLM_DIV_3
  2900. * @arg @ref LL_RCC_PLLM_DIV_4
  2901. * @arg @ref LL_RCC_PLLM_DIV_5
  2902. * @arg @ref LL_RCC_PLLM_DIV_6
  2903. * @arg @ref LL_RCC_PLLM_DIV_7
  2904. * @arg @ref LL_RCC_PLLM_DIV_8
  2905. */
  2906. __STATIC_INLINE uint32_t LL_RCC_PLL_GetDivider(void)
  2907. {
  2908. return (uint32_t)(READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLM));
  2909. }
  2910. /**
  2911. * @brief Enable PLL output mapped on ADC domain clock
  2912. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_EnableDomain_ADC
  2913. * @note User shall check that PLL enable is not done through
  2914. * other functions (ex: I2S1)
  2915. * @retval None
  2916. */
  2917. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_ADC(void)
  2918. {
  2919. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  2920. }
  2921. /**
  2922. * @brief Disable PLL output mapped on ADC domain clock
  2923. * @note Cannot be disabled if the PLL clock is used as the system clock
  2924. * @note User shall check that PLL is not used by any other peripheral
  2925. * (ex: I2S1)
  2926. * @note In order to save power, when the PLLCLK of the PLL is
  2927. * not used, should be 0
  2928. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_DisableDomain_ADC
  2929. * @retval None
  2930. */
  2931. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_ADC(void)
  2932. {
  2933. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  2934. }
  2935. /**
  2936. * @brief Enable PLL output mapped on I2S domain clock
  2937. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_EnableDomain_I2S1
  2938. * @note User shall check that PLL enable is not done through
  2939. * other functions (ex: ADC)
  2940. * @retval None
  2941. */
  2942. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_I2S1(void)
  2943. {
  2944. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  2945. }
  2946. #if defined(RCC_CCIPR2_I2S2SEL)
  2947. /**
  2948. * @brief Enable PLL output mapped on I2S2 domain clock
  2949. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_EnableDomain_I2S2
  2950. * @note User shall check that PLL enable is not done through
  2951. * other functions (ex: ADC)
  2952. * @retval None
  2953. */
  2954. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_I2S2(void)
  2955. {
  2956. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  2957. }
  2958. #endif /* RCC_CCIPR2_I2S2SEL */
  2959. /**
  2960. * @brief Disable PLL output mapped on I2S1 domain clock
  2961. * @note Cannot be disabled if the PLL clock is used as the system clock
  2962. * @note User shall check that PLL is not used by any other peripheral
  2963. * (ex: RNG)
  2964. * @note In order to save power, when the PLLCLK of the PLL is
  2965. * not used, should be 0
  2966. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_DisableDomain_I2S1
  2967. * @retval None
  2968. */
  2969. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_I2S1(void)
  2970. {
  2971. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  2972. }
  2973. #if defined(RCC_CCIPR2_I2S2SEL)
  2974. /**
  2975. * @brief Disable PLL output mapped on I2S2 domain clock
  2976. * @note Cannot be disabled if the PLL clock is used as the system clock
  2977. * @note User shall check that PLL is not used by any other peripheral
  2978. * (ex: RNG)
  2979. * @note In order to save power, when the PLLCLK of the PLL is
  2980. * not used, should be 0
  2981. * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_DisableDomain_I2S2
  2982. * @retval None
  2983. */
  2984. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_I2S2(void)
  2985. {
  2986. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLPEN);
  2987. }
  2988. #endif /* RCC_CCIPR2_I2S2SEL */
  2989. #if defined(RNG)
  2990. /**
  2991. * @brief Enable PLL output mapped on RNG domain clock
  2992. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_RNG
  2993. * @note User shall check that PLL enable is not done through
  2994. * other functions (ex: TIM1, TIM15)
  2995. * @retval None
  2996. */
  2997. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_RNG(void)
  2998. {
  2999. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3000. }
  3001. /**
  3002. * @brief Disable PLL output mapped on RNG domain clock
  3003. * @note Cannot be disabled if the PLL clock is used as the system clock
  3004. * @note User shall check that PLL is not used by any other peripheral
  3005. * (ex: TIM, TIM15)
  3006. * @note In order to save power, when the PLLCLK of the PLL is
  3007. * not used, should be 0
  3008. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_RNG
  3009. * @retval None
  3010. */
  3011. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_RNG(void)
  3012. {
  3013. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3014. }
  3015. #endif /* RNG */
  3016. #if defined(FDCAN1) || defined(FDCAN2)
  3017. /**
  3018. * @brief Enable PLL output mapped on FDCAN domain clock
  3019. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_FDCAN
  3020. * @note User shall check that PLL enable is not done through
  3021. * other functions (ex: TIM1, TIM15)
  3022. * @retval None
  3023. */
  3024. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_FDCAN(void)
  3025. {
  3026. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3027. }
  3028. /**
  3029. * @brief Disable PLL output mapped on FDCAN domain clock
  3030. * @note Cannot be disabled if the PLL clock is used as the system clock
  3031. * @note User shall check that PLL is not used by any other peripheral
  3032. * (ex: TIM, TIM15)
  3033. * @note In order to save power, when the PLLCLK of the PLL is
  3034. * not used, should be 0
  3035. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_FDCAN
  3036. * @retval None
  3037. */
  3038. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_FDCAN(void)
  3039. {
  3040. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3041. }
  3042. #endif /* FDCAN1 || FDCAN2 */
  3043. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  3044. /**
  3045. * @brief Enable PLL output mapped on USB domain clock
  3046. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_USB
  3047. * @note User shall check that PLL enable is not done through
  3048. * other functions (ex: TIM1, TIM15)
  3049. * @retval None
  3050. */
  3051. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_USB(void)
  3052. {
  3053. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3054. }
  3055. /**
  3056. * @brief Disable PLL output mapped on USB domain clock
  3057. * @note Cannot be disabled if the PLL clock is used as the system clock
  3058. * @note User shall check that PLL is not used by any other peripheral
  3059. * (ex: TIM, TIM15)
  3060. * @note In order to save power, when the PLLCLK of the PLL is
  3061. * not used, should be 0
  3062. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_USB
  3063. * @retval None
  3064. */
  3065. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_USB(void)
  3066. {
  3067. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3068. }
  3069. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  3070. #if defined(RCC_PLLQ_SUPPORT)
  3071. /**
  3072. * @brief Enable PLL output mapped on TIM1 domain clock
  3073. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_TIM1
  3074. * @note User shall check that PLL enable is not done through
  3075. * other functions (ex: RNG, TIM15)
  3076. * @retval None
  3077. */
  3078. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_TIM1(void)
  3079. {
  3080. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3081. }
  3082. /**
  3083. * @brief Disable PLL output mapped on TIM1 domain clock
  3084. * @note Cannot be disabled if the PLL clock is used as the system clock
  3085. * @note User shall check that PLL is not used by any other peripheral
  3086. * (ex: RNG, TIM15)
  3087. * @note In order to save power, when the PLLCLK of the PLL is
  3088. * not used, should be 0
  3089. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_TIM1
  3090. * @retval None
  3091. */
  3092. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_TIM1(void)
  3093. {
  3094. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3095. }
  3096. #endif /* RCC_PLLQ_SUPPORT */
  3097. #if defined(RCC_PLLQ_SUPPORT) && defined(TIM15)
  3098. /**
  3099. * @brief Enable PLL output mapped on TIM15 domain clock
  3100. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_TIM15
  3101. * @note User shall check that PLL enable is not done through
  3102. * other functions (ex: RNG, TIM1)
  3103. * @retval None
  3104. */
  3105. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_TIM15(void)
  3106. {
  3107. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3108. }
  3109. /**
  3110. * @brief Disable PLL output mapped on TIM15 domain clock
  3111. * @note Cannot be disabled if the PLL clock is used as the system clock
  3112. * @note User shall check that PLL is not used by any other peripheral
  3113. * (ex: RNG, TIM1)
  3114. * @note In order to save power, when the PLLCLK of the PLL is
  3115. * not used, should be 0
  3116. * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_TIM15
  3117. * @retval None
  3118. */
  3119. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_TIM15(void)
  3120. {
  3121. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
  3122. }
  3123. #endif /* RCC_PLLQ_SUPPORT && TIM15 */
  3124. /**
  3125. * @brief Enable PLL output mapped on SYSCLK domain
  3126. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_EnableDomain_SYS
  3127. * @retval None
  3128. */
  3129. __STATIC_INLINE void LL_RCC_PLL_EnableDomain_SYS(void)
  3130. {
  3131. SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN);
  3132. }
  3133. /**
  3134. * @brief Disable PLL output mapped on SYSCLK domain
  3135. * @note Cannot be disabled if the PLL clock is used as the system clock
  3136. * @note In order to save power, when the PLLCLK of the PLL is
  3137. * not used, Main PLL should be 0
  3138. * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_DisableDomain_SYS
  3139. * @retval None
  3140. */
  3141. __STATIC_INLINE void LL_RCC_PLL_DisableDomain_SYS(void)
  3142. {
  3143. CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLREN);
  3144. }
  3145. /**
  3146. * @}
  3147. */
  3148. /** @defgroup RCC_LL_EF_FLAG_Management FLAG Management
  3149. * @{
  3150. */
  3151. /**
  3152. * @brief Clear LSI ready interrupt flag
  3153. * @rmtoll CICR LSIRDYC LL_RCC_ClearFlag_LSIRDY
  3154. * @retval None
  3155. */
  3156. __STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void)
  3157. {
  3158. SET_BIT(RCC->CICR, RCC_CICR_LSIRDYC);
  3159. }
  3160. /**
  3161. * @brief Clear LSE ready interrupt flag
  3162. * @rmtoll CICR LSERDYC LL_RCC_ClearFlag_LSERDY
  3163. * @retval None
  3164. */
  3165. __STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void)
  3166. {
  3167. SET_BIT(RCC->CICR, RCC_CICR_LSERDYC);
  3168. }
  3169. /**
  3170. * @brief Clear HSI ready interrupt flag
  3171. * @rmtoll CICR HSIRDYC LL_RCC_ClearFlag_HSIRDY
  3172. * @retval None
  3173. */
  3174. __STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void)
  3175. {
  3176. SET_BIT(RCC->CICR, RCC_CICR_HSIRDYC);
  3177. }
  3178. /**
  3179. * @brief Clear HSE ready interrupt flag
  3180. * @rmtoll CICR HSERDYC LL_RCC_ClearFlag_HSERDY
  3181. * @retval None
  3182. */
  3183. __STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void)
  3184. {
  3185. SET_BIT(RCC->CICR, RCC_CICR_HSERDYC);
  3186. }
  3187. /**
  3188. * @brief Clear PLL ready interrupt flag
  3189. * @rmtoll CICR PLLRDYC LL_RCC_ClearFlag_PLLRDY
  3190. * @retval None
  3191. */
  3192. __STATIC_INLINE void LL_RCC_ClearFlag_PLLRDY(void)
  3193. {
  3194. SET_BIT(RCC->CICR, RCC_CICR_PLLRDYC);
  3195. }
  3196. #if defined(RCC_HSI48_SUPPORT)
  3197. /**
  3198. * @brief Clear HSI48 ready interrupt flag
  3199. * @rmtoll CICR HSI48RDYC LL_RCC_ClearFlag_HSI48RDY
  3200. * @retval None
  3201. */
  3202. __STATIC_INLINE void LL_RCC_ClearFlag_HSI48RDY(void)
  3203. {
  3204. SET_BIT(RCC->CICR, RCC_CICR_HSI48RDYC);
  3205. }
  3206. #endif /* RCC_HSI48_SUPPORT */
  3207. /**
  3208. * @brief Clear Clock security system interrupt flag
  3209. * @rmtoll CICR CSSC LL_RCC_ClearFlag_HSECSS
  3210. * @retval None
  3211. */
  3212. __STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void)
  3213. {
  3214. SET_BIT(RCC->CICR, RCC_CICR_CSSC);
  3215. }
  3216. /**
  3217. * @brief Clear LSE Clock security system interrupt flag
  3218. * @rmtoll CICR LSECSSC LL_RCC_ClearFlag_LSECSS
  3219. * @retval None
  3220. */
  3221. __STATIC_INLINE void LL_RCC_ClearFlag_LSECSS(void)
  3222. {
  3223. SET_BIT(RCC->CICR, RCC_CICR_LSECSSC);
  3224. }
  3225. /**
  3226. * @brief Check if LSI ready interrupt occurred or not
  3227. * @rmtoll CIFR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY
  3228. * @retval State of bit (1 or 0).
  3229. */
  3230. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void)
  3231. {
  3232. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSIRDYF) == (RCC_CIFR_LSIRDYF)) ? 1UL : 0UL);
  3233. }
  3234. /**
  3235. * @brief Check if LSE ready interrupt occurred or not
  3236. * @rmtoll CIFR LSERDYF LL_RCC_IsActiveFlag_LSERDY
  3237. * @retval State of bit (1 or 0).
  3238. */
  3239. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void)
  3240. {
  3241. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSERDYF) == (RCC_CIFR_LSERDYF)) ? 1UL : 0UL);
  3242. }
  3243. /**
  3244. * @brief Check if HSI ready interrupt occurred or not
  3245. * @rmtoll CIFR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY
  3246. * @retval State of bit (1 or 0).
  3247. */
  3248. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void)
  3249. {
  3250. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSIRDYF) == (RCC_CIFR_HSIRDYF)) ? 1UL : 0UL);
  3251. }
  3252. /**
  3253. * @brief Check if HSE ready interrupt occurred or not
  3254. * @rmtoll CIFR HSERDYF LL_RCC_IsActiveFlag_HSERDY
  3255. * @retval State of bit (1 or 0).
  3256. */
  3257. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void)
  3258. {
  3259. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSERDYF) == (RCC_CIFR_HSERDYF)) ? 1UL : 0UL);
  3260. }
  3261. /**
  3262. * @brief Check if PLL ready interrupt occurred or not
  3263. * @rmtoll CIFR PLLRDYF LL_RCC_IsActiveFlag_PLLRDY
  3264. * @retval State of bit (1 or 0).
  3265. */
  3266. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLRDY(void)
  3267. {
  3268. return ((READ_BIT(RCC->CIFR, RCC_CIFR_PLLRDYF) == (RCC_CIFR_PLLRDYF)) ? 1UL : 0UL);
  3269. }
  3270. #if defined(RCC_HSI48_SUPPORT)
  3271. /**
  3272. * @brief Check if HSI48 ready interrupt occurred or not
  3273. * @rmtoll CIR HSI48RDYF LL_RCC_IsActiveFlag_HSI48RDY
  3274. * @retval State of bit (1 or 0).
  3275. */
  3276. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSI48RDY(void)
  3277. {
  3278. return ((READ_BIT(RCC->CIFR, RCC_CIFR_HSI48RDYF) == (RCC_CIFR_HSI48RDYF)) ? 1UL : 0UL);
  3279. }
  3280. #endif /* RCC_HSI48_SUPPORT */
  3281. /**
  3282. * @brief Check if Clock security system interrupt occurred or not
  3283. * @rmtoll CIFR CSSF LL_RCC_IsActiveFlag_HSECSS
  3284. * @retval State of bit (1 or 0).
  3285. */
  3286. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void)
  3287. {
  3288. return ((READ_BIT(RCC->CIFR, RCC_CIFR_CSSF) == (RCC_CIFR_CSSF)) ? 1UL : 0UL);
  3289. }
  3290. /**
  3291. * @brief Check if LSE Clock security system interrupt occurred or not
  3292. * @rmtoll CIFR LSECSSF LL_RCC_IsActiveFlag_LSECSS
  3293. * @retval State of bit (1 or 0).
  3294. */
  3295. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSECSS(void)
  3296. {
  3297. return ((READ_BIT(RCC->CIFR, RCC_CIFR_LSECSSF) == (RCC_CIFR_LSECSSF)) ? 1UL : 0UL);
  3298. }
  3299. /**
  3300. * @brief Check if RCC flag Independent Watchdog reset is set or not.
  3301. * @rmtoll CSR IWDGRSTF LL_RCC_IsActiveFlag_IWDGRST
  3302. * @retval State of bit (1 or 0).
  3303. */
  3304. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDGRST(void)
  3305. {
  3306. return ((READ_BIT(RCC->CSR, RCC_CSR_IWDGRSTF) == (RCC_CSR_IWDGRSTF)) ? 1UL : 0UL);
  3307. }
  3308. /**
  3309. * @brief Check if RCC flag Low Power reset is set or not.
  3310. * @rmtoll CSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST
  3311. * @retval State of bit (1 or 0).
  3312. */
  3313. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void)
  3314. {
  3315. return ((READ_BIT(RCC->CSR, RCC_CSR_LPWRRSTF) == (RCC_CSR_LPWRRSTF)) ? 1UL : 0UL);
  3316. }
  3317. /**
  3318. * @brief Check if RCC flag Option byte reset is set or not.
  3319. * @rmtoll CSR OBLRSTF LL_RCC_IsActiveFlag_OBLRST
  3320. * @retval State of bit (1 or 0).
  3321. */
  3322. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_OBLRST(void)
  3323. {
  3324. return ((READ_BIT(RCC->CSR, RCC_CSR_OBLRSTF) == (RCC_CSR_OBLRSTF)) ? 1UL : 0UL);
  3325. }
  3326. /**
  3327. * @brief Check if RCC flag Pin reset is set or not.
  3328. * @rmtoll CSR PINRSTF LL_RCC_IsActiveFlag_PINRST
  3329. * @retval State of bit (1 or 0).
  3330. */
  3331. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void)
  3332. {
  3333. return ((READ_BIT(RCC->CSR, RCC_CSR_PINRSTF) == (RCC_CSR_PINRSTF)) ? 1UL : 0UL);
  3334. }
  3335. /**
  3336. * @brief Check if RCC flag Software reset is set or not.
  3337. * @rmtoll CSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST
  3338. * @retval State of bit (1 or 0).
  3339. */
  3340. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void)
  3341. {
  3342. return ((READ_BIT(RCC->CSR, RCC_CSR_SFTRSTF) == (RCC_CSR_SFTRSTF)) ? 1UL : 0UL);
  3343. }
  3344. /**
  3345. * @brief Check if RCC flag Window Watchdog reset is set or not.
  3346. * @rmtoll CSR WWDGRSTF LL_RCC_IsActiveFlag_WWDGRST
  3347. * @retval State of bit (1 or 0).
  3348. */
  3349. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDGRST(void)
  3350. {
  3351. return ((READ_BIT(RCC->CSR, RCC_CSR_WWDGRSTF) == (RCC_CSR_WWDGRSTF)) ? 1UL : 0UL);
  3352. }
  3353. /**
  3354. * @brief Check if RCC flag BOR or POR/PDR reset is set or not.
  3355. * @rmtoll CSR PWRRSTF LL_RCC_IsActiveFlag_PWRRST
  3356. * @retval State of bit (1 or 0).
  3357. */
  3358. __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PWRRST(void)
  3359. {
  3360. return ((READ_BIT(RCC->CSR, RCC_CSR_PWRRSTF) == (RCC_CSR_PWRRSTF)) ? 1UL : 0UL);
  3361. }
  3362. /**
  3363. * @brief Set RMVF bit to clear the reset flags.
  3364. * @rmtoll CSR RMVF LL_RCC_ClearResetFlags
  3365. * @retval None
  3366. */
  3367. __STATIC_INLINE void LL_RCC_ClearResetFlags(void)
  3368. {
  3369. SET_BIT(RCC->CSR, RCC_CSR_RMVF);
  3370. }
  3371. /**
  3372. * @}
  3373. */
  3374. /** @defgroup RCC_LL_EF_IT_Management IT Management
  3375. * @{
  3376. */
  3377. /**
  3378. * @brief Enable LSI ready interrupt
  3379. * @rmtoll CIER LSIRDYIE LL_RCC_EnableIT_LSIRDY
  3380. * @retval None
  3381. */
  3382. __STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void)
  3383. {
  3384. SET_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  3385. }
  3386. /**
  3387. * @brief Enable LSE ready interrupt
  3388. * @rmtoll CIER LSERDYIE LL_RCC_EnableIT_LSERDY
  3389. * @retval None
  3390. */
  3391. __STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void)
  3392. {
  3393. SET_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  3394. }
  3395. /**
  3396. * @brief Enable HSI ready interrupt
  3397. * @rmtoll CIER HSIRDYIE LL_RCC_EnableIT_HSIRDY
  3398. * @retval None
  3399. */
  3400. __STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void)
  3401. {
  3402. SET_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  3403. }
  3404. /**
  3405. * @brief Enable HSE ready interrupt
  3406. * @rmtoll CIER HSERDYIE LL_RCC_EnableIT_HSERDY
  3407. * @retval None
  3408. */
  3409. __STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void)
  3410. {
  3411. SET_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  3412. }
  3413. /**
  3414. * @brief Enable PLL ready interrupt
  3415. * @rmtoll CIER PLLRDYIE LL_RCC_EnableIT_PLLRDY
  3416. * @retval None
  3417. */
  3418. __STATIC_INLINE void LL_RCC_EnableIT_PLLRDY(void)
  3419. {
  3420. SET_BIT(RCC->CIER, RCC_CIER_PLLRDYIE);
  3421. }
  3422. #if defined(RCC_HSI48_SUPPORT)
  3423. /**
  3424. * @brief Enable HSI48 ready interrupt
  3425. * @rmtoll CIER HSI48RDYIE LL_RCC_EnableIT_HSI48RDY
  3426. * @retval None
  3427. */
  3428. __STATIC_INLINE void LL_RCC_EnableIT_HSI48RDY(void)
  3429. {
  3430. SET_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  3431. }
  3432. #endif /* RCC_HSI48_SUPPORT */
  3433. /**
  3434. * @brief Disable LSI ready interrupt
  3435. * @rmtoll CIER LSIRDYIE LL_RCC_DisableIT_LSIRDY
  3436. * @retval None
  3437. */
  3438. __STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void)
  3439. {
  3440. CLEAR_BIT(RCC->CIER, RCC_CIER_LSIRDYIE);
  3441. }
  3442. /**
  3443. * @brief Disable LSE ready interrupt
  3444. * @rmtoll CIER LSERDYIE LL_RCC_DisableIT_LSERDY
  3445. * @retval None
  3446. */
  3447. __STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void)
  3448. {
  3449. CLEAR_BIT(RCC->CIER, RCC_CIER_LSERDYIE);
  3450. }
  3451. /**
  3452. * @brief Disable HSI ready interrupt
  3453. * @rmtoll CIER HSIRDYIE LL_RCC_DisableIT_HSIRDY
  3454. * @retval None
  3455. */
  3456. __STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void)
  3457. {
  3458. CLEAR_BIT(RCC->CIER, RCC_CIER_HSIRDYIE);
  3459. }
  3460. /**
  3461. * @brief Disable HSE ready interrupt
  3462. * @rmtoll CIER HSERDYIE LL_RCC_DisableIT_HSERDY
  3463. * @retval None
  3464. */
  3465. __STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void)
  3466. {
  3467. CLEAR_BIT(RCC->CIER, RCC_CIER_HSERDYIE);
  3468. }
  3469. /**
  3470. * @brief Disable PLL ready interrupt
  3471. * @rmtoll CIER PLLRDYIE LL_RCC_DisableIT_PLLRDY
  3472. * @retval None
  3473. */
  3474. __STATIC_INLINE void LL_RCC_DisableIT_PLLRDY(void)
  3475. {
  3476. CLEAR_BIT(RCC->CIER, RCC_CIER_PLLRDYIE);
  3477. }
  3478. #if defined(RCC_HSI48_SUPPORT)
  3479. /**
  3480. * @brief Disable HSI48 ready interrupt
  3481. * @rmtoll CIER HSI48RDYIE LL_RCC_DisableIT_HSI48RDY
  3482. * @retval None
  3483. */
  3484. __STATIC_INLINE void LL_RCC_DisableIT_HSI48RDY(void)
  3485. {
  3486. CLEAR_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE);
  3487. }
  3488. #endif /* RCC_HSI48_SUPPORT */
  3489. /**
  3490. * @brief Checks if LSI ready interrupt source is enabled or disabled.
  3491. * @rmtoll CIER LSIRDYIE LL_RCC_IsEnabledIT_LSIRDY
  3492. * @retval State of bit (1 or 0).
  3493. */
  3494. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSIRDY(void)
  3495. {
  3496. return ((READ_BIT(RCC->CIER, RCC_CIER_LSIRDYIE) == (RCC_CIER_LSIRDYIE)) ? 1UL : 0UL);
  3497. }
  3498. /**
  3499. * @brief Checks if LSE ready interrupt source is enabled or disabled.
  3500. * @rmtoll CIER LSERDYIE LL_RCC_IsEnabledIT_LSERDY
  3501. * @retval State of bit (1 or 0).
  3502. */
  3503. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSERDY(void)
  3504. {
  3505. return ((READ_BIT(RCC->CIER, RCC_CIER_LSERDYIE) == (RCC_CIER_LSERDYIE)) ? 1UL : 0UL);
  3506. }
  3507. /**
  3508. * @brief Checks if HSI ready interrupt source is enabled or disabled.
  3509. * @rmtoll CIER HSIRDYIE LL_RCC_IsEnabledIT_HSIRDY
  3510. * @retval State of bit (1 or 0).
  3511. */
  3512. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSIRDY(void)
  3513. {
  3514. return ((READ_BIT(RCC->CIER, RCC_CIER_HSIRDYIE) == (RCC_CIER_HSIRDYIE)) ? 1UL : 0UL);
  3515. }
  3516. #if defined(RCC_HSI48_SUPPORT)
  3517. /**
  3518. * @brief Checks if HSI48 ready interrupt source is enabled or disabled.
  3519. * @rmtoll CIER HSI48RDYIE LL_RCC_IsEnabledIT_HSI48RDY
  3520. * @retval State of bit (1 or 0).
  3521. */
  3522. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSI48RDY(void)
  3523. {
  3524. return ((READ_BIT(RCC->CIER, RCC_CIER_HSI48RDYIE) == (RCC_CIER_HSI48RDYIE)) ? 1UL : 0UL);
  3525. }
  3526. #endif /* RCC_HSI48_SUPPORT */
  3527. /**
  3528. * @brief Checks if HSE ready interrupt source is enabled or disabled.
  3529. * @rmtoll CIER HSERDYIE LL_RCC_IsEnabledIT_HSERDY
  3530. * @retval State of bit (1 or 0).
  3531. */
  3532. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSERDY(void)
  3533. {
  3534. return ((READ_BIT(RCC->CIER, RCC_CIER_HSERDYIE) == (RCC_CIER_HSERDYIE)) ? 1UL : 0UL);
  3535. }
  3536. /**
  3537. * @brief Checks if PLL ready interrupt source is enabled or disabled.
  3538. * @rmtoll CIER PLLRDYIE LL_RCC_IsEnabledIT_PLLRDY
  3539. * @retval State of bit (1 or 0).
  3540. */
  3541. __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLRDY(void)
  3542. {
  3543. return ((READ_BIT(RCC->CIER, RCC_CIER_PLLRDYIE) == (RCC_CIER_PLLRDYIE)) ? 1UL : 0UL);
  3544. }
  3545. /**
  3546. * @}
  3547. */
  3548. #if defined(USE_FULL_LL_DRIVER)
  3549. /** @defgroup RCC_LL_EF_Init De-initialization function
  3550. * @{
  3551. */
  3552. ErrorStatus LL_RCC_DeInit(void);
  3553. /**
  3554. * @}
  3555. */
  3556. /** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions
  3557. * @{
  3558. */
  3559. void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks);
  3560. uint32_t LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource);
  3561. uint32_t LL_RCC_GetI2CClockFreq(uint32_t I2CxSource);
  3562. #if defined(LPUART1) || defined(LPUART2)
  3563. uint32_t LL_RCC_GetLPUARTClockFreq(uint32_t LPUARTxSource);
  3564. #endif /* LPUART1 */
  3565. #if defined(LPTIM1) && defined(LPTIM2)
  3566. uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource);
  3567. #endif /* LPTIM1 && LPTIM2 */
  3568. #if defined(RNG)
  3569. uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource);
  3570. #endif /* RNG */
  3571. uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource);
  3572. uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource);
  3573. #if defined(CEC)
  3574. uint32_t LL_RCC_GetCECClockFreq(uint32_t CECxSource);
  3575. #endif /* CEC */
  3576. #if defined(FDCAN1) || defined(FDCAN2)
  3577. uint32_t LL_RCC_GetFDCANClockFreq(uint32_t FDCANxSource);
  3578. #endif /* FDCAN1 */
  3579. uint32_t LL_RCC_GetTIMClockFreq(uint32_t TIMxSource);
  3580. uint32_t LL_RCC_GetRTCClockFreq(void);
  3581. #if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
  3582. uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource);
  3583. #endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
  3584. /**
  3585. * @}
  3586. */
  3587. #endif /* USE_FULL_LL_DRIVER */
  3588. /**
  3589. * @}
  3590. */
  3591. /**
  3592. * @}
  3593. */
  3594. #endif /* RCC */
  3595. /**
  3596. * @}
  3597. */
  3598. #ifdef __cplusplus
  3599. }
  3600. #endif
  3601. #endif /* STM32G0xx_LL_RCC_H */
  3602. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/