stm32l4xx_hal_rcc.h 216 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_rcc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32L4xx_HAL_RCC_H
  37. #define __STM32L4xx_HAL_RCC_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32l4xx_hal_def.h"
  43. /** @addtogroup STM32L4xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup RCC
  47. * @{
  48. */
  49. /* Exported types ------------------------------------------------------------*/
  50. /** @defgroup RCC_Exported_Types RCC Exported Types
  51. * @{
  52. */
  53. /**
  54. * @brief RCC PLL configuration structure definition
  55. */
  56. typedef struct
  57. {
  58. uint32_t PLLState; /*!< The new state of the PLL.
  59. This parameter can be a value of @ref RCC_PLL_Config */
  60. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  61. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  62. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  63. This parameter must be a number between Min_Data = 1 and Max_Data = 16 on STM32L4Rx/STM32L4Sx devices.
  64. This parameter must be a number between Min_Data = 1 and Max_Data = 8 on the other devices */
  65. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  66. This parameter must be a number between Min_Data = 8 and Max_Data = 86 */
  67. uint32_t PLLP; /*!< PLLP: Division factor for SAI clock.
  68. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  69. uint32_t PLLQ; /*!< PLLQ: Division factor for SDMMC1, RNG and USB clocks.
  70. This parameter must be a value of @ref RCC_PLLQ_Clock_Divider */
  71. uint32_t PLLR; /*!< PLLR: Division for the main system clock.
  72. User have to set the PLLR parameter correctly to not exceed max frequency 80MHZ.
  73. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */
  74. }RCC_PLLInitTypeDef;
  75. /**
  76. * @brief RCC Internal/External Oscillator (HSE, HSI, MSI, LSE and LSI) configuration structure definition
  77. */
  78. typedef struct
  79. {
  80. uint32_t OscillatorType; /*!< The oscillators to be configured.
  81. This parameter can be a value of @ref RCC_Oscillator_Type */
  82. uint32_t HSEState; /*!< The new state of the HSE.
  83. This parameter can be a value of @ref RCC_HSE_Config */
  84. uint32_t LSEState; /*!< The new state of the LSE.
  85. This parameter can be a value of @ref RCC_LSE_Config */
  86. uint32_t HSIState; /*!< The new state of the HSI.
  87. This parameter can be a value of @ref RCC_HSI_Config */
  88. uint32_t HSICalibrationValue; /*!< The calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT).
  89. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F on STM32L43x/STM32L44x/STM32L47x/STM32L48x devices.
  90. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F on the other devices */
  91. uint32_t LSIState; /*!< The new state of the LSI.
  92. This parameter can be a value of @ref RCC_LSI_Config */
  93. uint32_t MSIState; /*!< The new state of the MSI.
  94. This parameter can be a value of @ref RCC_MSI_Config */
  95. uint32_t MSICalibrationValue; /*!< The calibration trimming value (default is RCC_MSICALIBRATION_DEFAULT).
  96. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
  97. uint32_t MSIClockRange; /*!< The MSI frequency range.
  98. This parameter can be a value of @ref RCC_MSI_Clock_Range */
  99. uint32_t HSI48State; /*!< The new state of the HSI48 (only applicable to STM32L43x/STM32L44x/STM32L49x/STM32L4Ax devices).
  100. This parameter can be a value of @ref RCC_HSI48_Config */
  101. RCC_PLLInitTypeDef PLL; /*!< Main PLL structure parameters */
  102. }RCC_OscInitTypeDef;
  103. /**
  104. * @brief RCC System, AHB and APB busses clock configuration structure definition
  105. */
  106. typedef struct
  107. {
  108. uint32_t ClockType; /*!< The clock to be configured.
  109. This parameter can be a value of @ref RCC_System_Clock_Type */
  110. uint32_t SYSCLKSource; /*!< The clock source used as system clock (SYSCLK).
  111. This parameter can be a value of @ref RCC_System_Clock_Source */
  112. uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
  113. This parameter can be a value of @ref RCC_AHB_Clock_Source */
  114. uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
  115. This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */
  116. uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK).
  117. This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */
  118. }RCC_ClkInitTypeDef;
  119. /**
  120. * @}
  121. */
  122. /* Exported constants --------------------------------------------------------*/
  123. /** @defgroup RCC_Exported_Constants RCC Exported Constants
  124. * @{
  125. */
  126. /** @defgroup RCC_Timeout_Value Timeout Values
  127. * @{
  128. */
  129. #define RCC_DBP_TIMEOUT_VALUE 2U /* 2 ms (minimum Tick + 1) */
  130. #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT
  131. /**
  132. * @}
  133. */
  134. /** @defgroup RCC_Oscillator_Type Oscillator Type
  135. * @{
  136. */
  137. #define RCC_OSCILLATORTYPE_NONE 0x00000000U /*!< Oscillator configuration unchanged */
  138. #define RCC_OSCILLATORTYPE_HSE 0x00000001U /*!< HSE to configure */
  139. #define RCC_OSCILLATORTYPE_HSI 0x00000002U /*!< HSI to configure */
  140. #define RCC_OSCILLATORTYPE_LSE 0x00000004U /*!< LSE to configure */
  141. #define RCC_OSCILLATORTYPE_LSI 0x00000008U /*!< LSI to configure */
  142. #define RCC_OSCILLATORTYPE_MSI 0x00000010U /*!< MSI to configure */
  143. #if defined(RCC_HSI48_SUPPORT)
  144. #define RCC_OSCILLATORTYPE_HSI48 0x00000020U /*!< HSI48 to configure */
  145. #endif /* RCC_HSI48_SUPPORT */
  146. /**
  147. * @}
  148. */
  149. /** @defgroup RCC_HSE_Config HSE Config
  150. * @{
  151. */
  152. #define RCC_HSE_OFF 0x00000000U /*!< HSE clock deactivation */
  153. #define RCC_HSE_ON RCC_CR_HSEON /*!< HSE clock activation */
  154. #define RCC_HSE_BYPASS (RCC_CR_HSEBYP | RCC_CR_HSEON) /*!< External clock source for HSE clock */
  155. /**
  156. * @}
  157. */
  158. /** @defgroup RCC_LSE_Config LSE Config
  159. * @{
  160. */
  161. #define RCC_LSE_OFF 0x00000000U /*!< LSE clock deactivation */
  162. #define RCC_LSE_ON RCC_BDCR_LSEON /*!< LSE clock activation */
  163. #define RCC_LSE_BYPASS (RCC_BDCR_LSEBYP | RCC_BDCR_LSEON) /*!< External clock source for LSE clock */
  164. /**
  165. * @}
  166. */
  167. /** @defgroup RCC_HSI_Config HSI Config
  168. * @{
  169. */
  170. #define RCC_HSI_OFF 0x00000000U /*!< HSI clock deactivation */
  171. #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */
  172. #if defined(STM32L431xx) || defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx) || \
  173. defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
  174. #define RCC_HSICALIBRATION_DEFAULT 0x10U /* Default HSI calibration trimming value */
  175. #else
  176. #define RCC_HSICALIBRATION_DEFAULT 0x40U /* Default HSI calibration trimming value */
  177. #endif /* STM32L431xx || STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx || */
  178. /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
  179. /**
  180. * @}
  181. */
  182. /** @defgroup RCC_LSI_Config LSI Config
  183. * @{
  184. */
  185. #define RCC_LSI_OFF 0x00000000U /*!< LSI clock deactivation */
  186. #define RCC_LSI_ON RCC_CSR_LSION /*!< LSI clock activation */
  187. /**
  188. * @}
  189. */
  190. /** @defgroup RCC_MSI_Config MSI Config
  191. * @{
  192. */
  193. #define RCC_MSI_OFF 0x00000000U /*!< MSI clock deactivation */
  194. #define RCC_MSI_ON RCC_CR_MSION /*!< MSI clock activation */
  195. #define RCC_MSICALIBRATION_DEFAULT 0U /*!< Default MSI calibration trimming value */
  196. /**
  197. * @}
  198. */
  199. #if defined(RCC_HSI48_SUPPORT)
  200. /** @defgroup RCC_HSI48_Config HSI48 Config
  201. * @{
  202. */
  203. #define RCC_HSI48_OFF 0x00000000U /*!< HSI48 clock deactivation */
  204. #define RCC_HSI48_ON RCC_CRRCR_HSI48ON /*!< HSI48 clock activation */
  205. /**
  206. * @}
  207. */
  208. #else
  209. /** @defgroup RCC_HSI48_Config HSI48 Config
  210. * @{
  211. */
  212. #define RCC_HSI48_OFF 0x00000000U /*!< HSI48 clock deactivation */
  213. /**
  214. * @}
  215. */
  216. #endif /* RCC_HSI48_SUPPORT */
  217. /** @defgroup RCC_PLL_Config PLL Config
  218. * @{
  219. */
  220. #define RCC_PLL_NONE 0x00000000U /*!< PLL configuration unchanged */
  221. #define RCC_PLL_OFF 0x00000001U /*!< PLL deactivation */
  222. #define RCC_PLL_ON 0x00000002U /*!< PLL activation */
  223. /**
  224. * @}
  225. */
  226. /** @defgroup RCC_PLLP_Clock_Divider PLLP Clock Divider
  227. * @{
  228. */
  229. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  230. #define RCC_PLLP_DIV2 0x00000002U /*!< PLLP division factor = 2 */
  231. #define RCC_PLLP_DIV3 0x00000003U /*!< PLLP division factor = 3 */
  232. #define RCC_PLLP_DIV4 0x00000004U /*!< PLLP division factor = 4 */
  233. #define RCC_PLLP_DIV5 0x00000005U /*!< PLLP division factor = 5 */
  234. #define RCC_PLLP_DIV6 0x00000006U /*!< PLLP division factor = 6 */
  235. #define RCC_PLLP_DIV7 0x00000007U /*!< PLLP division factor = 7 */
  236. #define RCC_PLLP_DIV8 0x00000008U /*!< PLLP division factor = 8 */
  237. #define RCC_PLLP_DIV9 0x00000009U /*!< PLLP division factor = 9 */
  238. #define RCC_PLLP_DIV10 0x0000000AU /*!< PLLP division factor = 10 */
  239. #define RCC_PLLP_DIV11 0x0000000BU /*!< PLLP division factor = 11 */
  240. #define RCC_PLLP_DIV12 0x0000000CU /*!< PLLP division factor = 12 */
  241. #define RCC_PLLP_DIV13 0x0000000DU /*!< PLLP division factor = 13 */
  242. #define RCC_PLLP_DIV14 0x0000000EU /*!< PLLP division factor = 14 */
  243. #define RCC_PLLP_DIV15 0x0000000FU /*!< PLLP division factor = 15 */
  244. #define RCC_PLLP_DIV16 0x00000010U /*!< PLLP division factor = 16 */
  245. #define RCC_PLLP_DIV17 0x00000011U /*!< PLLP division factor = 17 */
  246. #define RCC_PLLP_DIV18 0x00000012U /*!< PLLP division factor = 18 */
  247. #define RCC_PLLP_DIV19 0x00000013U /*!< PLLP division factor = 19 */
  248. #define RCC_PLLP_DIV20 0x00000014U /*!< PLLP division factor = 20 */
  249. #define RCC_PLLP_DIV21 0x00000015U /*!< PLLP division factor = 21 */
  250. #define RCC_PLLP_DIV22 0x00000016U /*!< PLLP division factor = 22 */
  251. #define RCC_PLLP_DIV23 0x00000017U /*!< PLLP division factor = 23 */
  252. #define RCC_PLLP_DIV24 0x00000018U /*!< PLLP division factor = 24 */
  253. #define RCC_PLLP_DIV25 0x00000019U /*!< PLLP division factor = 25 */
  254. #define RCC_PLLP_DIV26 0x0000001AU /*!< PLLP division factor = 26 */
  255. #define RCC_PLLP_DIV27 0x0000001BU /*!< PLLP division factor = 27 */
  256. #define RCC_PLLP_DIV28 0x0000001CU /*!< PLLP division factor = 28 */
  257. #define RCC_PLLP_DIV29 0x0000001DU /*!< PLLP division factor = 29 */
  258. #define RCC_PLLP_DIV30 0x0000001EU /*!< PLLP division factor = 30 */
  259. #define RCC_PLLP_DIV31 0x0000001FU /*!< PLLP division factor = 31 */
  260. #else
  261. #define RCC_PLLP_DIV7 0x00000007U /*!< PLLP division factor = 7 */
  262. #define RCC_PLLP_DIV17 0x00000011U /*!< PLLP division factor = 17 */
  263. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  264. /**
  265. * @}
  266. */
  267. /** @defgroup RCC_PLLQ_Clock_Divider PLLQ Clock Divider
  268. * @{
  269. */
  270. #define RCC_PLLQ_DIV2 0x00000002U /*!< PLLQ division factor = 2 */
  271. #define RCC_PLLQ_DIV4 0x00000004U /*!< PLLQ division factor = 4 */
  272. #define RCC_PLLQ_DIV6 0x00000006U /*!< PLLQ division factor = 6 */
  273. #define RCC_PLLQ_DIV8 0x00000008U /*!< PLLQ division factor = 8 */
  274. /**
  275. * @}
  276. */
  277. /** @defgroup RCC_PLLR_Clock_Divider PLLR Clock Divider
  278. * @{
  279. */
  280. #define RCC_PLLR_DIV2 0x00000002U /*!< PLLR division factor = 2 */
  281. #define RCC_PLLR_DIV4 0x00000004U /*!< PLLR division factor = 4 */
  282. #define RCC_PLLR_DIV6 0x00000006U /*!< PLLR division factor = 6 */
  283. #define RCC_PLLR_DIV8 0x00000008U /*!< PLLR division factor = 8 */
  284. /**
  285. * @}
  286. */
  287. /** @defgroup RCC_PLL_Clock_Source PLL Clock Source
  288. * @{
  289. */
  290. #define RCC_PLLSOURCE_NONE 0x00000000U /*!< No clock selected as PLL entry clock source */
  291. #define RCC_PLLSOURCE_MSI RCC_PLLCFGR_PLLSRC_MSI /*!< MSI clock selected as PLL entry clock source */
  292. #define RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI /*!< HSI clock selected as PLL entry clock source */
  293. #define RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE /*!< HSE clock selected as PLL entry clock source */
  294. /**
  295. * @}
  296. */
  297. /** @defgroup RCC_PLL_Clock_Output PLL Clock Output
  298. * @{
  299. */
  300. #if defined(RCC_PLLSAI2_SUPPORT)
  301. #define RCC_PLL_SAI3CLK RCC_PLLCFGR_PLLPEN /*!< PLLSAI3CLK selection from main PLL (for devices with PLLSAI2) */
  302. #else
  303. #define RCC_PLL_SAI2CLK RCC_PLLCFGR_PLLPEN /*!< PLLSAI2CLK selection from main PLL (for devices without PLLSAI2) */
  304. #endif /* RCC_PLLSAI2_SUPPORT */
  305. #define RCC_PLL_48M1CLK RCC_PLLCFGR_PLLQEN /*!< PLL48M1CLK selection from main PLL */
  306. #define RCC_PLL_SYSCLK RCC_PLLCFGR_PLLREN /*!< PLLCLK selection from main PLL */
  307. /**
  308. * @}
  309. */
  310. /** @defgroup RCC_PLLSAI1_Clock_Output PLLSAI1 Clock Output
  311. * @{
  312. */
  313. #define RCC_PLLSAI1_SAI1CLK RCC_PLLSAI1CFGR_PLLSAI1PEN /*!< PLLSAI1CLK selection from PLLSAI1 */
  314. #define RCC_PLLSAI1_48M2CLK RCC_PLLSAI1CFGR_PLLSAI1QEN /*!< PLL48M2CLK selection from PLLSAI1 */
  315. #define RCC_PLLSAI1_ADC1CLK RCC_PLLSAI1CFGR_PLLSAI1REN /*!< PLLADC1CLK selection from PLLSAI1 */
  316. /**
  317. * @}
  318. */
  319. #if defined(RCC_PLLSAI2_SUPPORT)
  320. /** @defgroup RCC_PLLSAI2_Clock_Output PLLSAI2 Clock Output
  321. * @{
  322. */
  323. #define RCC_PLLSAI2_SAI2CLK RCC_PLLSAI2CFGR_PLLSAI2PEN /*!< PLLSAI2CLK selection from PLLSAI2 */
  324. #if defined(RCC_PLLSAI2Q_DIV_SUPPORT)
  325. #define RCC_PLLSAI2_DSICLK RCC_PLLSAI2CFGR_PLLSAI2QEN /*!< PLLDSICLK selection from PLLSAI2 */
  326. #endif /* RCC_PLLSAI2Q_DIV_SUPPORT */
  327. #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || defined(STM32L496xx) || defined(STM32L4A6xx)
  328. #define RCC_PLLSAI2_ADC2CLK RCC_PLLSAI2CFGR_PLLSAI2REN /*!< PLLADC2CLK selection from PLLSAI2 */
  329. #else
  330. #define RCC_PLLSAI2_LTDCCLK RCC_PLLSAI2CFGR_PLLSAI2REN /*!< PLLLTDCCLK selection from PLLSAI2 */
  331. #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || STM32L496xx || STM32L4A6xx */
  332. /**
  333. * @}
  334. */
  335. #endif /* RCC_PLLSAI2_SUPPORT */
  336. /** @defgroup RCC_MSI_Clock_Range MSI Clock Range
  337. * @{
  338. */
  339. #define RCC_MSIRANGE_0 RCC_CR_MSIRANGE_0 /*!< MSI = 100 KHz */
  340. #define RCC_MSIRANGE_1 RCC_CR_MSIRANGE_1 /*!< MSI = 200 KHz */
  341. #define RCC_MSIRANGE_2 RCC_CR_MSIRANGE_2 /*!< MSI = 400 KHz */
  342. #define RCC_MSIRANGE_3 RCC_CR_MSIRANGE_3 /*!< MSI = 800 KHz */
  343. #define RCC_MSIRANGE_4 RCC_CR_MSIRANGE_4 /*!< MSI = 1 MHz */
  344. #define RCC_MSIRANGE_5 RCC_CR_MSIRANGE_5 /*!< MSI = 2 MHz */
  345. #define RCC_MSIRANGE_6 RCC_CR_MSIRANGE_6 /*!< MSI = 4 MHz */
  346. #define RCC_MSIRANGE_7 RCC_CR_MSIRANGE_7 /*!< MSI = 8 MHz */
  347. #define RCC_MSIRANGE_8 RCC_CR_MSIRANGE_8 /*!< MSI = 16 MHz */
  348. #define RCC_MSIRANGE_9 RCC_CR_MSIRANGE_9 /*!< MSI = 24 MHz */
  349. #define RCC_MSIRANGE_10 RCC_CR_MSIRANGE_10 /*!< MSI = 32 MHz */
  350. #define RCC_MSIRANGE_11 RCC_CR_MSIRANGE_11 /*!< MSI = 48 MHz */
  351. /**
  352. * @}
  353. */
  354. /** @defgroup RCC_System_Clock_Type System Clock Type
  355. * @{
  356. */
  357. #define RCC_CLOCKTYPE_SYSCLK 0x00000001U /*!< SYSCLK to configure */
  358. #define RCC_CLOCKTYPE_HCLK 0x00000002U /*!< HCLK to configure */
  359. #define RCC_CLOCKTYPE_PCLK1 0x00000004U /*!< PCLK1 to configure */
  360. #define RCC_CLOCKTYPE_PCLK2 0x00000008U /*!< PCLK2 to configure */
  361. /**
  362. * @}
  363. */
  364. /** @defgroup RCC_System_Clock_Source System Clock Source
  365. * @{
  366. */
  367. #define RCC_SYSCLKSOURCE_MSI RCC_CFGR_SW_MSI /*!< MSI selection as system clock */
  368. #define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selection as system clock */
  369. #define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selection as system clock */
  370. #define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL /*!< PLL selection as system clock */
  371. /**
  372. * @}
  373. */
  374. /** @defgroup RCC_System_Clock_Source_Status System Clock Source Status
  375. * @{
  376. */
  377. #define RCC_SYSCLKSOURCE_STATUS_MSI RCC_CFGR_SWS_MSI /*!< MSI used as system clock */
  378. #define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
  379. #define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
  380. #define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */
  381. /**
  382. * @}
  383. */
  384. /** @defgroup RCC_AHB_Clock_Source AHB Clock Source
  385. * @{
  386. */
  387. #define RCC_SYSCLK_DIV1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */
  388. #define RCC_SYSCLK_DIV2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */
  389. #define RCC_SYSCLK_DIV4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */
  390. #define RCC_SYSCLK_DIV8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */
  391. #define RCC_SYSCLK_DIV16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */
  392. #define RCC_SYSCLK_DIV64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */
  393. #define RCC_SYSCLK_DIV128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
  394. #define RCC_SYSCLK_DIV256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
  395. #define RCC_SYSCLK_DIV512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
  396. /**
  397. * @}
  398. */
  399. /** @defgroup RCC_APB1_APB2_Clock_Source APB1 APB2 Clock Source
  400. * @{
  401. */
  402. #define RCC_HCLK_DIV1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */
  403. #define RCC_HCLK_DIV2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */
  404. #define RCC_HCLK_DIV4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */
  405. #define RCC_HCLK_DIV8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */
  406. #define RCC_HCLK_DIV16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */
  407. /**
  408. * @}
  409. */
  410. /** @defgroup RCC_RTC_Clock_Source RTC Clock Source
  411. * @{
  412. */
  413. #define RCC_RTCCLKSOURCE_NONE 0x00000000U /*!< No clock used as RTC clock */
  414. #define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */
  415. #define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */
  416. #define RCC_RTCCLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 32 used as RTC clock */
  417. /**
  418. * @}
  419. */
  420. /** @defgroup RCC_MCO_Index MCO Index
  421. * @{
  422. */
  423. #define RCC_MCO1 0x00000000U
  424. #define RCC_MCO RCC_MCO1 /*!< MCO1 to be compliant with other families with 2 MCOs*/
  425. /**
  426. * @}
  427. */
  428. /** @defgroup RCC_MCO1_Clock_Source MCO1 Clock Source
  429. * @{
  430. */
  431. #define RCC_MCO1SOURCE_NOCLOCK 0x00000000U /*!< MCO1 output disabled, no clock on MCO1 */
  432. #define RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCOSEL_0 /*!< SYSCLK selection as MCO1 source */
  433. #define RCC_MCO1SOURCE_MSI RCC_CFGR_MCOSEL_1 /*!< MSI selection as MCO1 source */
  434. #define RCC_MCO1SOURCE_HSI (RCC_CFGR_MCOSEL_0| RCC_CFGR_MCOSEL_1) /*!< HSI selection as MCO1 source */
  435. #define RCC_MCO1SOURCE_HSE RCC_CFGR_MCOSEL_2 /*!< HSE selection as MCO1 source */
  436. #define RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_2) /*!< PLLCLK selection as MCO1 source */
  437. #define RCC_MCO1SOURCE_LSI (RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSI selection as MCO1 source */
  438. #define RCC_MCO1SOURCE_LSE (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSE selection as MCO1 source */
  439. #if defined(RCC_HSI48_SUPPORT)
  440. #define RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCOSEL_3 /*!< HSI48 selection as MCO1 source (STM32L43x/STM32L44x devices) */
  441. #endif /* RCC_HSI48_SUPPORT */
  442. /**
  443. * @}
  444. */
  445. /** @defgroup RCC_MCOx_Clock_Prescaler MCO1 Clock Prescaler
  446. * @{
  447. */
  448. #define RCC_MCODIV_1 RCC_CFGR_MCOPRE_DIV1 /*!< MCO not divided */
  449. #define RCC_MCODIV_2 RCC_CFGR_MCOPRE_DIV2 /*!< MCO divided by 2 */
  450. #define RCC_MCODIV_4 RCC_CFGR_MCOPRE_DIV4 /*!< MCO divided by 4 */
  451. #define RCC_MCODIV_8 RCC_CFGR_MCOPRE_DIV8 /*!< MCO divided by 8 */
  452. #define RCC_MCODIV_16 RCC_CFGR_MCOPRE_DIV16 /*!< MCO divided by 16 */
  453. /**
  454. * @}
  455. */
  456. /** @defgroup RCC_Interrupt Interrupts
  457. * @{
  458. */
  459. #define RCC_IT_LSIRDY RCC_CIFR_LSIRDYF /*!< LSI Ready Interrupt flag */
  460. #define RCC_IT_LSERDY RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
  461. #define RCC_IT_MSIRDY RCC_CIFR_MSIRDYF /*!< MSI Ready Interrupt flag */
  462. #define RCC_IT_HSIRDY RCC_CIFR_HSIRDYF /*!< HSI16 Ready Interrupt flag */
  463. #define RCC_IT_HSERDY RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
  464. #define RCC_IT_PLLRDY RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
  465. #define RCC_IT_PLLSAI1RDY RCC_CIFR_PLLSAI1RDYF /*!< PLLSAI1 Ready Interrupt flag */
  466. #if defined(RCC_PLLSAI2_SUPPORT)
  467. #define RCC_IT_PLLSAI2RDY RCC_CIFR_PLLSAI2RDYF /*!< PLLSAI2 Ready Interrupt flag */
  468. #endif /* RCC_PLLSAI2_SUPPORT */
  469. #define RCC_IT_CSS RCC_CIFR_CSSF /*!< Clock Security System Interrupt flag */
  470. #define RCC_IT_LSECSS RCC_CIFR_LSECSSF /*!< LSE Clock Security System Interrupt flag */
  471. #if defined(RCC_HSI48_SUPPORT)
  472. #define RCC_IT_HSI48RDY RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
  473. #endif /* RCC_HSI48_SUPPORT */
  474. /**
  475. * @}
  476. */
  477. /** @defgroup RCC_Flag Flags
  478. * Elements values convention: XXXYYYYYb
  479. * - YYYYY : Flag position in the register
  480. * - XXX : Register index
  481. * - 001: CR register
  482. * - 010: BDCR register
  483. * - 011: CSR register
  484. * - 100: CRRCR register
  485. * @{
  486. */
  487. /* Flags in the CR register */
  488. #define RCC_FLAG_MSIRDY ((CR_REG_INDEX << 5U) | RCC_CR_MSIRDY_Pos) /*!< MSI Ready flag */
  489. #define RCC_FLAG_HSIRDY ((CR_REG_INDEX << 5U) | RCC_CR_HSIRDY_Pos) /*!< HSI Ready flag */
  490. #define RCC_FLAG_HSERDY ((CR_REG_INDEX << 5U) | RCC_CR_HSERDY_Pos) /*!< HSE Ready flag */
  491. #define RCC_FLAG_PLLRDY ((CR_REG_INDEX << 5U) | RCC_CR_PLLRDY_Pos) /*!< PLL Ready flag */
  492. #define RCC_FLAG_PLLSAI1RDY ((CR_REG_INDEX << 5U) | RCC_CR_PLLSAI1RDY_Pos) /*!< PLLSAI1 Ready flag */
  493. #if defined(RCC_PLLSAI2_SUPPORT)
  494. #define RCC_FLAG_PLLSAI2RDY ((CR_REG_INDEX << 5U) | RCC_CR_PLLSAI2RDY_Pos) /*!< PLLSAI2 Ready flag */
  495. #endif /* RCC_PLLSAI2_SUPPORT */
  496. /* Flags in the BDCR register */
  497. #define RCC_FLAG_LSERDY ((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSERDY_Pos) /*!< LSE Ready flag */
  498. #define RCC_FLAG_LSECSSD ((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSECSSD_Pos) /*!< LSE Clock Security System Interrupt flag */
  499. /* Flags in the CSR register */
  500. #define RCC_FLAG_LSIRDY ((CSR_REG_INDEX << 5U) | RCC_CSR_LSIRDY_Pos) /*!< LSI Ready flag */
  501. #define RCC_FLAG_RMVF ((CSR_REG_INDEX << 5U) | RCC_CSR_RMVF_Pos) /*!< Remove reset flag */
  502. #define RCC_FLAG_FWRST ((CSR_REG_INDEX << 5U) | RCC_CSR_FWRSTF_Pos) /*!< Firewall reset flag */
  503. #define RCC_FLAG_OBLRST ((CSR_REG_INDEX << 5U) | RCC_CSR_OBLRSTF_Pos) /*!< Option Byte Loader reset flag */
  504. #define RCC_FLAG_PINRST ((CSR_REG_INDEX << 5U) | RCC_CSR_PINRSTF_Pos) /*!< PIN reset flag */
  505. #define RCC_FLAG_BORRST ((CSR_REG_INDEX << 5U) | RCC_CSR_BORRSTF_Pos) /*!< BOR reset flag */
  506. #define RCC_FLAG_SFTRST ((CSR_REG_INDEX << 5U) | RCC_CSR_SFTRSTF_Pos) /*!< Software Reset flag */
  507. #define RCC_FLAG_IWDGRST ((CSR_REG_INDEX << 5U) | RCC_CSR_IWDGRSTF_Pos) /*!< Independent Watchdog reset flag */
  508. #define RCC_FLAG_WWDGRST ((CSR_REG_INDEX << 5U) | RCC_CSR_WWDGRSTF_Pos) /*!< Window watchdog reset flag */
  509. #define RCC_FLAG_LPWRRST ((CSR_REG_INDEX << 5U) | RCC_CSR_LPWRRSTF_Pos) /*!< Low-Power reset flag */
  510. #if defined(RCC_HSI48_SUPPORT)
  511. /* Flags in the CRRCR register */
  512. #define RCC_FLAG_HSI48RDY ((CRRCR_REG_INDEX << 5U) | RCC_CRRCR_HSI48RDY_Pos) /*!< HSI48 Ready flag */
  513. #endif /* RCC_HSI48_SUPPORT */
  514. /**
  515. * @}
  516. */
  517. /** @defgroup RCC_LSEDrive_Config LSE Drive Config
  518. * @{
  519. */
  520. #define RCC_LSEDRIVE_LOW 0x00000000U /*!< LSE low drive capability */
  521. #define RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< LSE medium low drive capability */
  522. #define RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< LSE medium high drive capability */
  523. #define RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< LSE high drive capability */
  524. /**
  525. * @}
  526. */
  527. /** @defgroup RCC_Stop_WakeUpClock Wake-Up from STOP Clock
  528. * @{
  529. */
  530. #define RCC_STOP_WAKEUPCLOCK_MSI 0x00000000U /*!< MSI selection after wake-up from STOP */
  531. #define RCC_STOP_WAKEUPCLOCK_HSI RCC_CFGR_STOPWUCK /*!< HSI selection after wake-up from STOP */
  532. /**
  533. * @}
  534. */
  535. /**
  536. * @}
  537. */
  538. /* Exported macros -----------------------------------------------------------*/
  539. /** @defgroup RCC_Exported_Macros RCC Exported Macros
  540. * @{
  541. */
  542. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  543. * @brief Enable or disable the AHB1 peripheral clock.
  544. * @note After reset, the peripheral clock (used for registers read/write access)
  545. * is disabled and the application software has to enable this clock before
  546. * using it.
  547. * @{
  548. */
  549. #define __HAL_RCC_DMA1_CLK_ENABLE() do { \
  550. __IO uint32_t tmpreg; \
  551. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN); \
  552. /* Delay after an RCC peripheral clock enabling */ \
  553. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN); \
  554. UNUSED(tmpreg); \
  555. } while(0)
  556. #define __HAL_RCC_DMA2_CLK_ENABLE() do { \
  557. __IO uint32_t tmpreg; \
  558. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN); \
  559. /* Delay after an RCC peripheral clock enabling */ \
  560. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN); \
  561. UNUSED(tmpreg); \
  562. } while(0)
  563. #if defined(DMAMUX1)
  564. #define __HAL_RCC_DMAMUX1_CLK_ENABLE() do { \
  565. __IO uint32_t tmpreg; \
  566. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMAMUX1EN); \
  567. /* Delay after an RCC peripheral clock enabling */ \
  568. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMAMUX1EN); \
  569. UNUSED(tmpreg); \
  570. } while(0)
  571. #endif /* DMAMUX1 */
  572. #define __HAL_RCC_FLASH_CLK_ENABLE() do { \
  573. __IO uint32_t tmpreg; \
  574. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN); \
  575. /* Delay after an RCC peripheral clock enabling */ \
  576. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN); \
  577. UNUSED(tmpreg); \
  578. } while(0)
  579. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  580. __IO uint32_t tmpreg; \
  581. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN); \
  582. /* Delay after an RCC peripheral clock enabling */ \
  583. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN); \
  584. UNUSED(tmpreg); \
  585. } while(0)
  586. #define __HAL_RCC_TSC_CLK_ENABLE() do { \
  587. __IO uint32_t tmpreg; \
  588. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN); \
  589. /* Delay after an RCC peripheral clock enabling */ \
  590. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN); \
  591. UNUSED(tmpreg); \
  592. } while(0)
  593. #if defined(DMA2D)
  594. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  595. __IO uint32_t tmpreg; \
  596. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN); \
  597. /* Delay after an RCC peripheral clock enabling */ \
  598. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN); \
  599. UNUSED(tmpreg); \
  600. } while(0)
  601. #endif /* DMA2D */
  602. #if defined(GFXMMU)
  603. #define __HAL_RCC_GFXMMU_CLK_ENABLE() do { \
  604. __IO uint32_t tmpreg; \
  605. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GFXMMUEN); \
  606. /* Delay after an RCC peripheral clock enabling */ \
  607. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GFXMMUEN); \
  608. UNUSED(tmpreg); \
  609. } while(0)
  610. #endif /* GFXMMU */
  611. #define __HAL_RCC_DMA1_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN)
  612. #define __HAL_RCC_DMA2_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN)
  613. #if defined(DMAMUX1)
  614. #define __HAL_RCC_DMAMUX1_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMAMUX1EN)
  615. #endif /* DMAMUX1 */
  616. #define __HAL_RCC_FLASH_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN)
  617. #define __HAL_RCC_CRC_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN)
  618. #define __HAL_RCC_TSC_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN)
  619. #if defined(DMA2D)
  620. #define __HAL_RCC_DMA2D_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN)
  621. #endif /* DMA2D */
  622. #if defined(GFXMMU)
  623. #define __HAL_RCC_GFXMMU_CLK_DISABLE() CLEAR_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GFXMMUEN)
  624. #endif /* GFXMMU */
  625. /**
  626. * @}
  627. */
  628. /** @defgroup RCC_AHB2_Peripheral_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  629. * @brief Enable or disable the AHB2 peripheral clock.
  630. * @note After reset, the peripheral clock (used for registers read/write access)
  631. * is disabled and the application software has to enable this clock before
  632. * using it.
  633. * @{
  634. */
  635. #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
  636. __IO uint32_t tmpreg; \
  637. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN); \
  638. /* Delay after an RCC peripheral clock enabling */ \
  639. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN); \
  640. UNUSED(tmpreg); \
  641. } while(0)
  642. #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
  643. __IO uint32_t tmpreg; \
  644. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN); \
  645. /* Delay after an RCC peripheral clock enabling */ \
  646. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN); \
  647. UNUSED(tmpreg); \
  648. } while(0)
  649. #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
  650. __IO uint32_t tmpreg; \
  651. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN); \
  652. /* Delay after an RCC peripheral clock enabling */ \
  653. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN); \
  654. UNUSED(tmpreg); \
  655. } while(0)
  656. #if defined(GPIOD)
  657. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  658. __IO uint32_t tmpreg; \
  659. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN); \
  660. /* Delay after an RCC peripheral clock enabling */ \
  661. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN); \
  662. UNUSED(tmpreg); \
  663. } while(0)
  664. #endif /* GPIOD */
  665. #if defined(GPIOE)
  666. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  667. __IO uint32_t tmpreg; \
  668. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN); \
  669. /* Delay after an RCC peripheral clock enabling */ \
  670. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN); \
  671. UNUSED(tmpreg); \
  672. } while(0)
  673. #endif /* GPIOE */
  674. #if defined(GPIOF)
  675. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  676. __IO uint32_t tmpreg; \
  677. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN); \
  678. /* Delay after an RCC peripheral clock enabling */ \
  679. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN); \
  680. UNUSED(tmpreg); \
  681. } while(0)
  682. #endif /* GPIOF */
  683. #if defined(GPIOG)
  684. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  685. __IO uint32_t tmpreg; \
  686. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN); \
  687. /* Delay after an RCC peripheral clock enabling */ \
  688. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN); \
  689. UNUSED(tmpreg); \
  690. } while(0)
  691. #endif /* GPIOG */
  692. #define __HAL_RCC_GPIOH_CLK_ENABLE() do { \
  693. __IO uint32_t tmpreg; \
  694. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN); \
  695. /* Delay after an RCC peripheral clock enabling */ \
  696. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN); \
  697. UNUSED(tmpreg); \
  698. } while(0)
  699. #if defined(GPIOI)
  700. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  701. __IO uint32_t tmpreg; \
  702. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN); \
  703. /* Delay after an RCC peripheral clock enabling */ \
  704. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN); \
  705. UNUSED(tmpreg); \
  706. } while(0)
  707. #endif /* GPIOI */
  708. #if defined(USB_OTG_FS)
  709. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \
  710. __IO uint32_t tmpreg; \
  711. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN); \
  712. /* Delay after an RCC peripheral clock enabling */ \
  713. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN); \
  714. UNUSED(tmpreg); \
  715. } while(0)
  716. #endif /* USB_OTG_FS */
  717. #define __HAL_RCC_ADC_CLK_ENABLE() do { \
  718. __IO uint32_t tmpreg; \
  719. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN); \
  720. /* Delay after an RCC peripheral clock enabling */ \
  721. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN); \
  722. UNUSED(tmpreg); \
  723. } while(0)
  724. #if defined(DCMI)
  725. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  726. __IO uint32_t tmpreg; \
  727. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN); \
  728. /* Delay after an RCC peripheral clock enabling */ \
  729. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN); \
  730. UNUSED(tmpreg); \
  731. } while(0)
  732. #endif /* DCMI */
  733. #if defined(AES)
  734. #define __HAL_RCC_AES_CLK_ENABLE() do { \
  735. __IO uint32_t tmpreg; \
  736. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN); \
  737. /* Delay after an RCC peripheral clock enabling */ \
  738. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN); \
  739. UNUSED(tmpreg); \
  740. } while(0)
  741. #endif /* AES */
  742. #if defined(HASH)
  743. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  744. __IO uint32_t tmpreg; \
  745. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN); \
  746. /* Delay after an RCC peripheral clock enabling */ \
  747. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN); \
  748. UNUSED(tmpreg); \
  749. } while(0)
  750. #endif /* HASH */
  751. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  752. __IO uint32_t tmpreg; \
  753. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN); \
  754. /* Delay after an RCC peripheral clock enabling */ \
  755. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN); \
  756. UNUSED(tmpreg); \
  757. } while(0)
  758. #if defined(OCTOSPIM)
  759. #define __HAL_RCC_OSPIM_CLK_ENABLE() do { \
  760. __IO uint32_t tmpreg; \
  761. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OSPIMEN); \
  762. /* Delay after an RCC peripheral clock enabling */ \
  763. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OSPIMEN); \
  764. UNUSED(tmpreg); \
  765. } while(0)
  766. #endif /* OCTOSPIM */
  767. #if defined(SDMMC1) && defined(RCC_AHB2ENR_SDMMC1EN)
  768. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  769. __IO uint32_t tmpreg; \
  770. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_SDMMC1EN); \
  771. /* Delay after an RCC peripheral clock enabling */ \
  772. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_SDMMC1EN); \
  773. UNUSED(tmpreg); \
  774. } while(0)
  775. #endif /* SDMMC1 && RCC_AHB2ENR_SDMMC1EN */
  776. #define __HAL_RCC_GPIOA_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN)
  777. #define __HAL_RCC_GPIOB_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN)
  778. #define __HAL_RCC_GPIOC_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN)
  779. #if defined(GPIOD)
  780. #define __HAL_RCC_GPIOD_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN)
  781. #endif /* GPIOD */
  782. #if defined(GPIOE)
  783. #define __HAL_RCC_GPIOE_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN)
  784. #endif /* GPIOE */
  785. #if defined(GPIOF)
  786. #define __HAL_RCC_GPIOF_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN)
  787. #endif /* GPIOF */
  788. #if defined(GPIOG)
  789. #define __HAL_RCC_GPIOG_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN)
  790. #endif /* GPIOG */
  791. #define __HAL_RCC_GPIOH_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN)
  792. #if defined(GPIOI)
  793. #define __HAL_RCC_GPIOI_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN)
  794. #endif /* GPIOI */
  795. #if defined(USB_OTG_FS)
  796. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);
  797. #endif /* USB_OTG_FS */
  798. #define __HAL_RCC_ADC_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN)
  799. #if defined(DCMI)
  800. #define __HAL_RCC_DCMI_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN)
  801. #endif /* DCMI */
  802. #if defined(AES)
  803. #define __HAL_RCC_AES_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);
  804. #endif /* AES */
  805. #if defined(HASH)
  806. #define __HAL_RCC_HASH_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN)
  807. #endif /* HASH */
  808. #define __HAL_RCC_RNG_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN)
  809. #if defined(OCTOSPIM)
  810. #define __HAL_RCC_OSPIM_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OSPIMEN)
  811. #endif /* OCTOSPIM */
  812. #if defined(SDMMC1) && defined(RCC_AHB2ENR_SDMMC1EN)
  813. #define __HAL_RCC_SDMMC1_CLK_DISABLE() CLEAR_BIT(RCC->AHB2ENR, RCC_AHB2ENR_SDMMC1EN)
  814. #endif /* SDMMC1 && RCC_AHB2ENR_SDMMC1EN */
  815. /**
  816. * @}
  817. */
  818. /** @defgroup RCC_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  819. * @brief Enable or disable the AHB3 peripheral clock.
  820. * @note After reset, the peripheral clock (used for registers read/write access)
  821. * is disabled and the application software has to enable this clock before
  822. * using it.
  823. * @{
  824. */
  825. #if defined(FMC_BANK1)
  826. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  827. __IO uint32_t tmpreg; \
  828. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); \
  829. /* Delay after an RCC peripheral clock enabling */ \
  830. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN); \
  831. UNUSED(tmpreg); \
  832. } while(0)
  833. #endif /* FMC_BANK1 */
  834. #if defined(QUADSPI)
  835. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  836. __IO uint32_t tmpreg; \
  837. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN); \
  838. /* Delay after an RCC peripheral clock enabling */ \
  839. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN); \
  840. UNUSED(tmpreg); \
  841. } while(0)
  842. #endif /* QUADSPI */
  843. #if defined(OCTOSPI1)
  844. #define __HAL_RCC_OSPI1_CLK_ENABLE() do { \
  845. __IO uint32_t tmpreg; \
  846. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_OSPI1EN); \
  847. /* Delay after an RCC peripheral clock enabling */ \
  848. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_OSPI1EN); \
  849. UNUSED(tmpreg); \
  850. } while(0)
  851. #endif /* OCTOSPI1 */
  852. #if defined(OCTOSPI2)
  853. #define __HAL_RCC_OSPI2_CLK_ENABLE() do { \
  854. __IO uint32_t tmpreg; \
  855. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_OSPI2EN); \
  856. /* Delay after an RCC peripheral clock enabling */ \
  857. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_OSPI2EN); \
  858. UNUSED(tmpreg); \
  859. } while(0)
  860. #endif /* OCTOSPI2 */
  861. #if defined(FMC_BANK1)
  862. #define __HAL_RCC_FMC_CLK_DISABLE() CLEAR_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN)
  863. #endif /* FMC_BANK1 */
  864. #if defined(QUADSPI)
  865. #define __HAL_RCC_QSPI_CLK_DISABLE() CLEAR_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN)
  866. #endif /* QUADSPI */
  867. #if defined(OCTOSPI1)
  868. #define __HAL_RCC_OSPI1_CLK_DISABLE() CLEAR_BIT(RCC->AHB3ENR, RCC_AHB3ENR_OSPI1EN)
  869. #endif /* OCTOSPI1 */
  870. #if defined(OCTOSPI2)
  871. #define __HAL_RCC_OSPI2_CLK_DISABLE() CLEAR_BIT(RCC->AHB3ENR, RCC_AHB3ENR_OSPI2EN)
  872. #endif /* OCTOSPI2 */
  873. /**
  874. * @}
  875. */
  876. /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  877. * @brief Enable or disable the APB1 peripheral clock.
  878. * @note After reset, the peripheral clock (used for registers read/write access)
  879. * is disabled and the application software has to enable this clock before
  880. * using it.
  881. * @{
  882. */
  883. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  884. __IO uint32_t tmpreg; \
  885. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN); \
  886. /* Delay after an RCC peripheral clock enabling */ \
  887. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN); \
  888. UNUSED(tmpreg); \
  889. } while(0)
  890. #if defined(TIM3)
  891. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  892. __IO uint32_t tmpreg; \
  893. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN); \
  894. /* Delay after an RCC peripheral clock enabling */ \
  895. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN); \
  896. UNUSED(tmpreg); \
  897. } while(0)
  898. #endif /* TIM3 */
  899. #if defined(TIM4)
  900. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  901. __IO uint32_t tmpreg; \
  902. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN); \
  903. /* Delay after an RCC peripheral clock enabling */ \
  904. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN); \
  905. UNUSED(tmpreg); \
  906. } while(0)
  907. #endif /* TIM4 */
  908. #if defined(TIM5)
  909. #define __HAL_RCC_TIM5_CLK_ENABLE() do { \
  910. __IO uint32_t tmpreg; \
  911. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN); \
  912. /* Delay after an RCC peripheral clock enabling */ \
  913. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN); \
  914. UNUSED(tmpreg); \
  915. } while(0)
  916. #endif /* TIM5 */
  917. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  918. __IO uint32_t tmpreg; \
  919. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN); \
  920. /* Delay after an RCC peripheral clock enabling */ \
  921. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN); \
  922. UNUSED(tmpreg); \
  923. } while(0)
  924. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  925. __IO uint32_t tmpreg; \
  926. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN); \
  927. /* Delay after an RCC peripheral clock enabling */ \
  928. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN); \
  929. UNUSED(tmpreg); \
  930. } while(0)
  931. #if defined(LCD)
  932. #define __HAL_RCC_LCD_CLK_ENABLE() do { \
  933. __IO uint32_t tmpreg; \
  934. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN); \
  935. /* Delay after an RCC peripheral clock enabling */ \
  936. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN); \
  937. UNUSED(tmpreg); \
  938. } while(0)
  939. #endif /* LCD */
  940. #if defined(RCC_APB1ENR1_RTCAPBEN)
  941. #define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \
  942. __IO uint32_t tmpreg; \
  943. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN); \
  944. /* Delay after an RCC peripheral clock enabling */ \
  945. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN); \
  946. UNUSED(tmpreg); \
  947. } while(0)
  948. #endif /* RCC_APB1ENR1_RTCAPBEN */
  949. #define __HAL_RCC_WWDG_CLK_ENABLE() do { \
  950. __IO uint32_t tmpreg; \
  951. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN); \
  952. /* Delay after an RCC peripheral clock enabling */ \
  953. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN); \
  954. UNUSED(tmpreg); \
  955. } while(0)
  956. #if defined(SPI2)
  957. #define __HAL_RCC_SPI2_CLK_ENABLE() do { \
  958. __IO uint32_t tmpreg; \
  959. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN); \
  960. /* Delay after an RCC peripheral clock enabling */ \
  961. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN); \
  962. UNUSED(tmpreg); \
  963. } while(0)
  964. #endif /* SPI2 */
  965. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  966. __IO uint32_t tmpreg; \
  967. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN); \
  968. /* Delay after an RCC peripheral clock enabling */ \
  969. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN); \
  970. UNUSED(tmpreg); \
  971. } while(0)
  972. #define __HAL_RCC_USART2_CLK_ENABLE() do { \
  973. __IO uint32_t tmpreg; \
  974. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN); \
  975. /* Delay after an RCC peripheral clock enabling */ \
  976. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN); \
  977. UNUSED(tmpreg); \
  978. } while(0)
  979. #if defined(USART3)
  980. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  981. __IO uint32_t tmpreg; \
  982. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN); \
  983. /* Delay after an RCC peripheral clock enabling */ \
  984. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN); \
  985. UNUSED(tmpreg); \
  986. } while(0)
  987. #endif /* USART3 */
  988. #if defined(UART4)
  989. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  990. __IO uint32_t tmpreg; \
  991. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN); \
  992. /* Delay after an RCC peripheral clock enabling */ \
  993. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN); \
  994. UNUSED(tmpreg); \
  995. } while(0)
  996. #endif /* UART4 */
  997. #if defined(UART5)
  998. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  999. __IO uint32_t tmpreg; \
  1000. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN); \
  1001. /* Delay after an RCC peripheral clock enabling */ \
  1002. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN); \
  1003. UNUSED(tmpreg); \
  1004. } while(0)
  1005. #endif /* UART5 */
  1006. #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
  1007. __IO uint32_t tmpreg; \
  1008. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN); \
  1009. /* Delay after an RCC peripheral clock enabling */ \
  1010. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN); \
  1011. UNUSED(tmpreg); \
  1012. } while(0)
  1013. #if defined(I2C2)
  1014. #define __HAL_RCC_I2C2_CLK_ENABLE() do { \
  1015. __IO uint32_t tmpreg; \
  1016. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN); \
  1017. /* Delay after an RCC peripheral clock enabling */ \
  1018. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN); \
  1019. UNUSED(tmpreg); \
  1020. } while(0)
  1021. #endif /* I2C2 */
  1022. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  1023. __IO uint32_t tmpreg; \
  1024. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN); \
  1025. /* Delay after an RCC peripheral clock enabling */ \
  1026. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN); \
  1027. UNUSED(tmpreg); \
  1028. } while(0)
  1029. #if defined(I2C4)
  1030. #define __HAL_RCC_I2C4_CLK_ENABLE() do { \
  1031. __IO uint32_t tmpreg; \
  1032. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN); \
  1033. /* Delay after an RCC peripheral clock enabling */ \
  1034. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN); \
  1035. UNUSED(tmpreg); \
  1036. } while(0)
  1037. #endif /* I2C4 */
  1038. #if defined(CRS)
  1039. #define __HAL_RCC_CRS_CLK_ENABLE() do { \
  1040. __IO uint32_t tmpreg; \
  1041. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN); \
  1042. /* Delay after an RCC peripheral clock enabling */ \
  1043. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN); \
  1044. UNUSED(tmpreg); \
  1045. } while(0)
  1046. #endif /* CRS */
  1047. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  1048. __IO uint32_t tmpreg; \
  1049. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN); \
  1050. /* Delay after an RCC peripheral clock enabling */ \
  1051. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN); \
  1052. UNUSED(tmpreg); \
  1053. } while(0)
  1054. #if defined(CAN2)
  1055. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  1056. __IO uint32_t tmpreg; \
  1057. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN); \
  1058. /* Delay after an RCC peripheral clock enabling */ \
  1059. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN); \
  1060. UNUSED(tmpreg); \
  1061. } while(0)
  1062. #endif /* CAN2 */
  1063. #if defined(USB)
  1064. #define __HAL_RCC_USB_CLK_ENABLE() do { \
  1065. __IO uint32_t tmpreg; \
  1066. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN); \
  1067. /* Delay after an RCC peripheral clock enabling */ \
  1068. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN); \
  1069. UNUSED(tmpreg); \
  1070. } while(0)
  1071. #endif /* USB */
  1072. #define __HAL_RCC_PWR_CLK_ENABLE() do { \
  1073. __IO uint32_t tmpreg; \
  1074. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN); \
  1075. /* Delay after an RCC peripheral clock enabling */ \
  1076. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN); \
  1077. UNUSED(tmpreg); \
  1078. } while(0)
  1079. #define __HAL_RCC_DAC1_CLK_ENABLE() do { \
  1080. __IO uint32_t tmpreg; \
  1081. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN); \
  1082. /* Delay after an RCC peripheral clock enabling */ \
  1083. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN); \
  1084. UNUSED(tmpreg); \
  1085. } while(0)
  1086. #define __HAL_RCC_OPAMP_CLK_ENABLE() do { \
  1087. __IO uint32_t tmpreg; \
  1088. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN); \
  1089. /* Delay after an RCC peripheral clock enabling */ \
  1090. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN); \
  1091. UNUSED(tmpreg); \
  1092. } while(0)
  1093. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  1094. __IO uint32_t tmpreg; \
  1095. SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN); \
  1096. /* Delay after an RCC peripheral clock enabling */ \
  1097. tmpreg = READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN); \
  1098. UNUSED(tmpreg); \
  1099. } while(0)
  1100. #define __HAL_RCC_LPUART1_CLK_ENABLE() do { \
  1101. __IO uint32_t tmpreg; \
  1102. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN); \
  1103. /* Delay after an RCC peripheral clock enabling */ \
  1104. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN); \
  1105. UNUSED(tmpreg); \
  1106. } while(0)
  1107. #if defined(SWPMI1)
  1108. #define __HAL_RCC_SWPMI1_CLK_ENABLE() do { \
  1109. __IO uint32_t tmpreg; \
  1110. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN); \
  1111. /* Delay after an RCC peripheral clock enabling */ \
  1112. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN); \
  1113. UNUSED(tmpreg); \
  1114. } while(0)
  1115. #endif /* SWPMI1 */
  1116. #define __HAL_RCC_LPTIM2_CLK_ENABLE() do { \
  1117. __IO uint32_t tmpreg; \
  1118. SET_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN); \
  1119. /* Delay after an RCC peripheral clock enabling */ \
  1120. tmpreg = READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN); \
  1121. UNUSED(tmpreg); \
  1122. } while(0)
  1123. #define __HAL_RCC_TIM2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN)
  1124. #if defined(TIM3)
  1125. #define __HAL_RCC_TIM3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN)
  1126. #endif /* TIM3 */
  1127. #if defined(TIM4)
  1128. #define __HAL_RCC_TIM4_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN)
  1129. #endif /* TIM4 */
  1130. #if defined(TIM5)
  1131. #define __HAL_RCC_TIM5_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN)
  1132. #endif /* TIM5 */
  1133. #define __HAL_RCC_TIM6_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN)
  1134. #define __HAL_RCC_TIM7_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN)
  1135. #if defined(LCD)
  1136. #define __HAL_RCC_LCD_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN);
  1137. #endif /* LCD */
  1138. #if defined(RCC_APB1ENR1_RTCAPBEN)
  1139. #define __HAL_RCC_RTCAPB_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN);
  1140. #endif /* RCC_APB1ENR1_RTCAPBEN */
  1141. #if defined(SPI2)
  1142. #define __HAL_RCC_SPI2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN)
  1143. #endif /* SPI2 */
  1144. #define __HAL_RCC_SPI3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN)
  1145. #define __HAL_RCC_USART2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN)
  1146. #if defined(USART3)
  1147. #define __HAL_RCC_USART3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN)
  1148. #endif /* USART3 */
  1149. #if defined(UART4)
  1150. #define __HAL_RCC_UART4_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN)
  1151. #endif /* UART4 */
  1152. #if defined(UART5)
  1153. #define __HAL_RCC_UART5_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN)
  1154. #endif /* UART5 */
  1155. #define __HAL_RCC_I2C1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN)
  1156. #if defined(I2C2)
  1157. #define __HAL_RCC_I2C2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN)
  1158. #endif /* I2C2 */
  1159. #define __HAL_RCC_I2C3_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN)
  1160. #if defined(I2C4)
  1161. #define __HAL_RCC_I2C4_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN)
  1162. #endif /* I2C4 */
  1163. #if defined(CRS)
  1164. #define __HAL_RCC_CRS_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN);
  1165. #endif /* CRS */
  1166. #define __HAL_RCC_CAN1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN)
  1167. #if defined(CAN2)
  1168. #define __HAL_RCC_CAN2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN)
  1169. #endif /* CAN2 */
  1170. #if defined(USB)
  1171. #define __HAL_RCC_USB_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN);
  1172. #endif /* USB */
  1173. #define __HAL_RCC_PWR_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN)
  1174. #define __HAL_RCC_DAC1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN)
  1175. #define __HAL_RCC_OPAMP_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN)
  1176. #define __HAL_RCC_LPTIM1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN)
  1177. #define __HAL_RCC_LPUART1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN)
  1178. #if defined(SWPMI1)
  1179. #define __HAL_RCC_SWPMI1_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN)
  1180. #endif /* SWPMI1 */
  1181. #define __HAL_RCC_LPTIM2_CLK_DISABLE() CLEAR_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN)
  1182. /**
  1183. * @}
  1184. */
  1185. /** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  1186. * @brief Enable or disable the APB2 peripheral clock.
  1187. * @note After reset, the peripheral clock (used for registers read/write access)
  1188. * is disabled and the application software has to enable this clock before
  1189. * using it.
  1190. * @{
  1191. */
  1192. #define __HAL_RCC_SYSCFG_CLK_ENABLE() do { \
  1193. __IO uint32_t tmpreg; \
  1194. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN); \
  1195. /* Delay after an RCC peripheral clock enabling */ \
  1196. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN); \
  1197. UNUSED(tmpreg); \
  1198. } while(0)
  1199. #define __HAL_RCC_FIREWALL_CLK_ENABLE() do { \
  1200. __IO uint32_t tmpreg; \
  1201. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_FWEN); \
  1202. /* Delay after an RCC peripheral clock enabling */ \
  1203. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_FWEN); \
  1204. UNUSED(tmpreg); \
  1205. } while(0)
  1206. #if defined(SDMMC1) && defined(RCC_APB2ENR_SDMMC1EN)
  1207. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  1208. __IO uint32_t tmpreg; \
  1209. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN); \
  1210. /* Delay after an RCC peripheral clock enabling */ \
  1211. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN); \
  1212. UNUSED(tmpreg); \
  1213. } while(0)
  1214. #endif /* SDMMC1 && RCC_APB2ENR_SDMMC1EN */
  1215. #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
  1216. __IO uint32_t tmpreg; \
  1217. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN); \
  1218. /* Delay after an RCC peripheral clock enabling */ \
  1219. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN); \
  1220. UNUSED(tmpreg); \
  1221. } while(0)
  1222. #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
  1223. __IO uint32_t tmpreg; \
  1224. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN); \
  1225. /* Delay after an RCC peripheral clock enabling */ \
  1226. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN); \
  1227. UNUSED(tmpreg); \
  1228. } while(0)
  1229. #if defined(TIM8)
  1230. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1231. __IO uint32_t tmpreg; \
  1232. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN); \
  1233. /* Delay after an RCC peripheral clock enabling */ \
  1234. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN); \
  1235. UNUSED(tmpreg); \
  1236. } while(0)
  1237. #endif /* TIM8 */
  1238. #define __HAL_RCC_USART1_CLK_ENABLE() do { \
  1239. __IO uint32_t tmpreg; \
  1240. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN); \
  1241. /* Delay after an RCC peripheral clock enabling */ \
  1242. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN); \
  1243. UNUSED(tmpreg); \
  1244. } while(0)
  1245. #define __HAL_RCC_TIM15_CLK_ENABLE() do { \
  1246. __IO uint32_t tmpreg; \
  1247. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN); \
  1248. /* Delay after an RCC peripheral clock enabling */ \
  1249. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN); \
  1250. UNUSED(tmpreg); \
  1251. } while(0)
  1252. #define __HAL_RCC_TIM16_CLK_ENABLE() do { \
  1253. __IO uint32_t tmpreg; \
  1254. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN); \
  1255. /* Delay after an RCC peripheral clock enabling */ \
  1256. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN); \
  1257. UNUSED(tmpreg); \
  1258. } while(0)
  1259. #if defined(TIM17)
  1260. #define __HAL_RCC_TIM17_CLK_ENABLE() do { \
  1261. __IO uint32_t tmpreg; \
  1262. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN); \
  1263. /* Delay after an RCC peripheral clock enabling */ \
  1264. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN); \
  1265. UNUSED(tmpreg); \
  1266. } while(0)
  1267. #endif /* TIM17 */
  1268. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1269. __IO uint32_t tmpreg; \
  1270. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN); \
  1271. /* Delay after an RCC peripheral clock enabling */ \
  1272. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN); \
  1273. UNUSED(tmpreg); \
  1274. } while(0)
  1275. #if defined(SAI2)
  1276. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  1277. __IO uint32_t tmpreg; \
  1278. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN); \
  1279. /* Delay after an RCC peripheral clock enabling */ \
  1280. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN); \
  1281. UNUSED(tmpreg); \
  1282. } while(0)
  1283. #endif /* SAI2 */
  1284. #if defined(DFSDM1_Filter0)
  1285. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  1286. __IO uint32_t tmpreg; \
  1287. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN); \
  1288. /* Delay after an RCC peripheral clock enabling */ \
  1289. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN); \
  1290. UNUSED(tmpreg); \
  1291. } while(0)
  1292. #endif /* DFSDM1_Filter0 */
  1293. #if defined(LTDC)
  1294. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  1295. __IO uint32_t tmpreg; \
  1296. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN); \
  1297. /* Delay after an RCC peripheral clock enabling */ \
  1298. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN); \
  1299. UNUSED(tmpreg); \
  1300. } while(0)
  1301. #endif /* LTDC */
  1302. #if defined(DSI)
  1303. #define __HAL_RCC_DSI_CLK_ENABLE() do { \
  1304. __IO uint32_t tmpreg; \
  1305. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN); \
  1306. /* Delay after an RCC peripheral clock enabling */ \
  1307. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN); \
  1308. UNUSED(tmpreg); \
  1309. } while(0)
  1310. #endif /* DSI */
  1311. #define __HAL_RCC_SYSCFG_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN)
  1312. #if defined(SDMMC1) && defined(RCC_APB2ENR_SDMMC1EN)
  1313. #define __HAL_RCC_SDMMC1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN)
  1314. #endif /* SDMMC1 && RCC_APB2ENR_SDMMC1EN */
  1315. #define __HAL_RCC_TIM1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN)
  1316. #define __HAL_RCC_SPI1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN)
  1317. #if defined(TIM8)
  1318. #define __HAL_RCC_TIM8_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN)
  1319. #endif /* TIM8 */
  1320. #define __HAL_RCC_USART1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN)
  1321. #define __HAL_RCC_TIM15_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN)
  1322. #define __HAL_RCC_TIM16_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN)
  1323. #if defined(TIM17)
  1324. #define __HAL_RCC_TIM17_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN)
  1325. #endif /* TIM17 */
  1326. #define __HAL_RCC_SAI1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN)
  1327. #if defined(SAI2)
  1328. #define __HAL_RCC_SAI2_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN)
  1329. #endif /* SAI2 */
  1330. #if defined(DFSDM1_Filter0)
  1331. #define __HAL_RCC_DFSDM1_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN)
  1332. #endif /* DFSDM1_Filter0 */
  1333. #if defined(LTDC)
  1334. #define __HAL_RCC_LTDC_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN)
  1335. #endif /* LTDC */
  1336. #if defined(DSI)
  1337. #define __HAL_RCC_DSI_CLK_DISABLE() CLEAR_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN)
  1338. #endif /* DSI */
  1339. /**
  1340. * @}
  1341. */
  1342. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enabled or Disabled Status
  1343. * @brief Check whether the AHB1 peripheral clock is enabled or not.
  1344. * @note After reset, the peripheral clock (used for registers read/write access)
  1345. * is disabled and the application software has to enable this clock before
  1346. * using it.
  1347. * @{
  1348. */
  1349. #define __HAL_RCC_DMA1_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN) != RESET)
  1350. #define __HAL_RCC_DMA2_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN) != RESET)
  1351. #if defined(DMAMUX1)
  1352. #define __HAL_RCC_DMAMUX1_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMAMUX1EN) != RESET)
  1353. #endif /* DMAMUX1 */
  1354. #define __HAL_RCC_FLASH_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN) != RESET)
  1355. #define __HAL_RCC_CRC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN) != RESET)
  1356. #define __HAL_RCC_TSC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN) != RESET)
  1357. #if defined(DMA2D)
  1358. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN) != RESET)
  1359. #endif /* DMA2D */
  1360. #if defined(GFXMMU)
  1361. #define __HAL_RCC_GFXMMU_IS_CLK_ENABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GFXMMUEN) != RESET)
  1362. #endif /* GFXMMU */
  1363. #define __HAL_RCC_DMA1_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN) == RESET)
  1364. #define __HAL_RCC_DMA2_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN) == RESET)
  1365. #if defined(DMAMUX1)
  1366. #define __HAL_RCC_DMAMUX1_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMAMUX1EN) == RESET)
  1367. #endif /* DMAMUX1 */
  1368. #define __HAL_RCC_FLASH_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_FLASHEN) == RESET)
  1369. #define __HAL_RCC_CRC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN) == RESET)
  1370. #define __HAL_RCC_TSC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_TSCEN) == RESET)
  1371. #if defined(DMA2D)
  1372. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN) == RESET)
  1373. #endif /* DMA2D */
  1374. #if defined(GFXMMU)
  1375. #define __HAL_RCC_GFXMMU_IS_CLK_DISABLED() (READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GFXMMUEN) == RESET)
  1376. #endif /* GFXMMU */
  1377. /**
  1378. * @}
  1379. */
  1380. /** @defgroup RCC_AHB2_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enabled or Disabled Status
  1381. * @brief Check whether the AHB2 peripheral clock is enabled or not.
  1382. * @note After reset, the peripheral clock (used for registers read/write access)
  1383. * is disabled and the application software has to enable this clock before
  1384. * using it.
  1385. * @{
  1386. */
  1387. #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN) != RESET)
  1388. #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN) != RESET)
  1389. #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN) != RESET)
  1390. #if defined(GPIOD)
  1391. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN) != RESET)
  1392. #endif /* GPIOD */
  1393. #if defined(GPIOE)
  1394. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN) != RESET)
  1395. #endif /* GPIOE */
  1396. #if defined(GPIOF)
  1397. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN) != RESET)
  1398. #endif /* GPIOF */
  1399. #if defined(GPIOG)
  1400. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN) != RESET)
  1401. #endif /* GPIOG */
  1402. #define __HAL_RCC_GPIOH_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN) != RESET)
  1403. #if defined(GPIOI)
  1404. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN) != RESET)
  1405. #endif /* GPIOI */
  1406. #if defined(USB_OTG_FS)
  1407. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN) != RESET)
  1408. #endif /* USB_OTG_FS */
  1409. #define __HAL_RCC_ADC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN) != RESET)
  1410. #if defined(DCMI)
  1411. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN) != RESET)
  1412. #endif /* DCMI */
  1413. #if defined(AES)
  1414. #define __HAL_RCC_AES_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN) != RESET)
  1415. #endif /* AES */
  1416. #if defined(HASH)
  1417. #define __HAL_RCC_HASH_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN) != RESET)
  1418. #endif /* HASH */
  1419. #define __HAL_RCC_RNG_IS_CLK_ENABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN) != RESET)
  1420. #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOAEN) == RESET)
  1421. #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN) == RESET)
  1422. #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOCEN) == RESET)
  1423. #if defined(GPIOD)
  1424. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIODEN) == RESET)
  1425. #endif /* GPIOD */
  1426. #if defined(GPIOE)
  1427. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOEEN) == RESET)
  1428. #endif /* GPIOE */
  1429. #if defined(GPIOF)
  1430. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOFEN) == RESET)
  1431. #endif /* GPIOF */
  1432. #if defined(GPIOG)
  1433. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOGEN) == RESET)
  1434. #endif /* GPIOG */
  1435. #define __HAL_RCC_GPIOH_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOHEN) == RESET)
  1436. #if defined(GPIOI)
  1437. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOIEN) == RESET)
  1438. #endif /* GPIOI */
  1439. #if defined(USB_OTG_FS)
  1440. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN) == RESET)
  1441. #endif /* USB_OTG_FS */
  1442. #define __HAL_RCC_ADC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN) == RESET)
  1443. #if defined(DCMI)
  1444. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN) == RESET)
  1445. #endif /* DCMI */
  1446. #if defined(AES)
  1447. #define __HAL_RCC_AES_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN) == RESET)
  1448. #endif /* AES */
  1449. #if defined(HASH)
  1450. #define __HAL_RCC_HASH_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN) == RESET)
  1451. #endif /* HASH */
  1452. #define __HAL_RCC_RNG_IS_CLK_DISABLED() (READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN) == RESET)
  1453. /**
  1454. * @}
  1455. */
  1456. /** @defgroup RCC_AHB3_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enabled or Disabled Status
  1457. * @brief Check whether the AHB3 peripheral clock is enabled or not.
  1458. * @note After reset, the peripheral clock (used for registers read/write access)
  1459. * is disabled and the application software has to enable this clock before
  1460. * using it.
  1461. * @{
  1462. */
  1463. #if defined(FMC_BANK1)
  1464. #define __HAL_RCC_FMC_IS_CLK_ENABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN) != RESET)
  1465. #endif /* FMC_BANK1 */
  1466. #if defined(QUADSPI)
  1467. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN) != RESET)
  1468. #endif /* QUADSPI */
  1469. #if defined(FMC_BANK1)
  1470. #define __HAL_RCC_FMC_IS_CLK_DISABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN) == RESET)
  1471. #endif /* FMC_BANK1 */
  1472. #if defined(QUADSPI)
  1473. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN) == RESET)
  1474. #endif /* QUADSPI */
  1475. /**
  1476. * @}
  1477. */
  1478. /** @defgroup RCC_APB1_Clock_Enable_Disable_Status APB1 Peripheral Clock Enabled or Disabled Status
  1479. * @brief Check whether the APB1 peripheral clock is enabled or not.
  1480. * @note After reset, the peripheral clock (used for registers read/write access)
  1481. * is disabled and the application software has to enable this clock before
  1482. * using it.
  1483. * @{
  1484. */
  1485. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN) != RESET)
  1486. #if defined(TIM3)
  1487. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN) != RESET)
  1488. #endif /* TIM3 */
  1489. #if defined(TIM4)
  1490. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN) != RESET)
  1491. #endif /* TIM4 */
  1492. #if defined(TIM5)
  1493. #define __HAL_RCC_TIM5_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN) != RESET)
  1494. #endif /* TIM5 */
  1495. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN) != RESET)
  1496. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN) != RESET)
  1497. #if defined(LCD)
  1498. #define __HAL_RCC_LCD_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN) != RESET)
  1499. #endif /* LCD */
  1500. #if defined(RCC_APB1ENR1_RTCAPBEN)
  1501. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN) != RESET)
  1502. #endif /* RCC_APB1ENR1_RTCAPBEN */
  1503. #define __HAL_RCC_WWDG_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN) != RESET)
  1504. #if defined(SPI2)
  1505. #define __HAL_RCC_SPI2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN) != RESET)
  1506. #endif /* SPI2 */
  1507. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN) != RESET)
  1508. #define __HAL_RCC_USART2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN) != RESET)
  1509. #if defined(USART3)
  1510. #define __HAL_RCC_USART3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN) != RESET)
  1511. #endif /* USART3 */
  1512. #if defined(UART4)
  1513. #define __HAL_RCC_UART4_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN) != RESET)
  1514. #endif /* UART4 */
  1515. #if defined(UART5)
  1516. #define __HAL_RCC_UART5_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN) != RESET)
  1517. #endif /* UART5 */
  1518. #define __HAL_RCC_I2C1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN) != RESET)
  1519. #if defined(I2C2)
  1520. #define __HAL_RCC_I2C2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN) != RESET)
  1521. #endif /* I2C2 */
  1522. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN) != RESET)
  1523. #if defined(I2C4)
  1524. #define __HAL_RCC_I2C4_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN) != RESET)
  1525. #endif /* I2C4 */
  1526. #if defined(CRS)
  1527. #define __HAL_RCC_CRS_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN) != RESET)
  1528. #endif /* CRS */
  1529. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN) != RESET)
  1530. #if defined(CAN2)
  1531. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN) != RESET)
  1532. #endif /* CAN2 */
  1533. #if defined(USB)
  1534. #define __HAL_RCC_USB_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN) != RESET)
  1535. #endif /* USB */
  1536. #define __HAL_RCC_PWR_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN) != RESET)
  1537. #define __HAL_RCC_DAC1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN) != RESET)
  1538. #define __HAL_RCC_OPAMP_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN) != RESET)
  1539. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN) != RESET)
  1540. #define __HAL_RCC_LPUART1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN) != RESET)
  1541. #if defined(SWPMI1)
  1542. #define __HAL_RCC_SWPMI1_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN) != RESET)
  1543. #endif /* SWPMI1 */
  1544. #define __HAL_RCC_LPTIM2_IS_CLK_ENABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN) != RESET)
  1545. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM2EN) == RESET)
  1546. #if defined(TIM3)
  1547. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM3EN) == RESET)
  1548. #endif /* TIM3 */
  1549. #if defined(TIM4)
  1550. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM4EN) == RESET)
  1551. #endif /* TIM4 */
  1552. #if defined(TIM5)
  1553. #define __HAL_RCC_TIM5_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM5EN) == RESET)
  1554. #endif /* TIM5 */
  1555. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM6EN) == RESET)
  1556. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_TIM7EN) == RESET)
  1557. #if defined(LCD)
  1558. #define __HAL_RCC_LCD_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LCDEN) == RESET)
  1559. #endif /* LCD */
  1560. #if defined(RCC_APB1ENR1_RTCAPBEN)
  1561. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_RTCAPBEN) == RESET)
  1562. #endif /* RCC_APB1ENR1_RTCAPBEN */
  1563. #define __HAL_RCC_WWDG_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_WWDGEN) == RESET)
  1564. #if defined(SPI2)
  1565. #define __HAL_RCC_SPI2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI2EN) == RESET)
  1566. #endif /* SPI2 */
  1567. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_SPI3EN) == RESET)
  1568. #define __HAL_RCC_USART2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN) == RESET)
  1569. #if defined(USART3)
  1570. #define __HAL_RCC_USART3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART3EN) == RESET)
  1571. #endif /* USART3 */
  1572. #if defined(UART4)
  1573. #define __HAL_RCC_UART4_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART4EN) == RESET)
  1574. #endif /* UART4 */
  1575. #if defined(UART5)
  1576. #define __HAL_RCC_UART5_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_UART5EN) == RESET)
  1577. #endif /* UART5 */
  1578. #define __HAL_RCC_I2C1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C1EN) == RESET)
  1579. #if defined(I2C2)
  1580. #define __HAL_RCC_I2C2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C2EN) == RESET)
  1581. #endif /* I2C2 */
  1582. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_I2C3EN) == RESET)
  1583. #if defined(I2C4)
  1584. #define __HAL_RCC_I2C4_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_I2C4EN) == RESET)
  1585. #endif /* I2C4 */
  1586. #if defined(CRS)
  1587. #define __HAL_RCC_CRS_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CRSEN) == RESET)
  1588. #endif /* CRS */
  1589. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN1EN) == RESET)
  1590. #if defined(CAN2)
  1591. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_CAN2EN) == RESET)
  1592. #endif /* CAN2 */
  1593. #if defined(USB)
  1594. #define __HAL_RCC_USB_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN) == RESET)
  1595. #endif /* USB */
  1596. #define __HAL_RCC_PWR_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_PWREN) == RESET)
  1597. #define __HAL_RCC_DAC1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_DAC1EN) == RESET)
  1598. #define __HAL_RCC_OPAMP_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_OPAMPEN) == RESET)
  1599. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR1, RCC_APB1ENR1_LPTIM1EN) == RESET)
  1600. #define __HAL_RCC_LPUART1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPUART1EN) == RESET)
  1601. #if defined(SWPMI1)
  1602. #define __HAL_RCC_SWPMI1_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_SWPMI1EN) == RESET)
  1603. #endif /* SWPMI1 */
  1604. #define __HAL_RCC_LPTIM2_IS_CLK_DISABLED() (READ_BIT(RCC->APB1ENR2, RCC_APB1ENR2_LPTIM2EN) == RESET)
  1605. /**
  1606. * @}
  1607. */
  1608. /** @defgroup RCC_APB2_Clock_Enable_Disable_Status APB2 Peripheral Clock Enabled or Disabled Status
  1609. * @brief Check whether the APB2 peripheral clock is enabled or not.
  1610. * @note After reset, the peripheral clock (used for registers read/write access)
  1611. * is disabled and the application software has to enable this clock before
  1612. * using it.
  1613. * @{
  1614. */
  1615. #define __HAL_RCC_SYSCFG_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN) != RESET)
  1616. #define __HAL_RCC_FIREWALL_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_FWEN) != RESET)
  1617. #if defined(SDMMC1) && defined(RCC_APB2ENR_SDMMC1EN)
  1618. #define __HAL_RCC_SDMMC1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN) != RESET)
  1619. #endif /* SDMMC1 && RCC_APB2ENR_SDMMC1EN */
  1620. #define __HAL_RCC_TIM1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN) != RESET)
  1621. #define __HAL_RCC_SPI1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN) != RESET)
  1622. #if defined(TIM8)
  1623. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN) != RESET)
  1624. #endif /* TIM8 */
  1625. #define __HAL_RCC_USART1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN) != RESET)
  1626. #define __HAL_RCC_TIM15_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN) != RESET)
  1627. #define __HAL_RCC_TIM16_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN) != RESET)
  1628. #if defined(TIM17)
  1629. #define __HAL_RCC_TIM17_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN) != RESET)
  1630. #endif /* TIM17 */
  1631. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN) != RESET)
  1632. #if defined(SAI2)
  1633. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN) != RESET)
  1634. #endif /* SAI2 */
  1635. #if defined(DFSDM1_Filter0)
  1636. #define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN) != RESET)
  1637. #endif /* DFSDM1_Filter0 */
  1638. #if defined(LTDC)
  1639. #define __HAL_RCC_LTDC_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN) != RESET)
  1640. #endif /* LTDC */
  1641. #if defined(DSI)
  1642. #define __HAL_RCC_DSI_IS_CLK_ENABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN) != RESET)
  1643. #endif /* DSI */
  1644. #define __HAL_RCC_SYSCFG_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN) == RESET)
  1645. #if defined(SDMMC1) && defined(RCC_APB2ENR_SDMMC1EN)
  1646. #define __HAL_RCC_SDMMC1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN) == RESET)
  1647. #endif /* SDMMC1 && RCC_APB2ENR_SDMMC1EN */
  1648. #define __HAL_RCC_TIM1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN) == RESET)
  1649. #define __HAL_RCC_SPI1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN) == RESET)
  1650. #if defined(TIM8)
  1651. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN) == RESET)
  1652. #endif /* TIM8 */
  1653. #define __HAL_RCC_USART1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN) == RESET)
  1654. #define __HAL_RCC_TIM15_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN) == RESET)
  1655. #define __HAL_RCC_TIM16_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN) == RESET)
  1656. #if defined(TIM17)
  1657. #define __HAL_RCC_TIM17_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN) == RESET)
  1658. #endif /* TIM17 */
  1659. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN) == RESET)
  1660. #if defined(SAI2)
  1661. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN) == RESET)
  1662. #endif /* SAI2 */
  1663. #if defined(DFSDM1_Filter0)
  1664. #define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN) == RESET)
  1665. #endif /* DFSDM1_Filter0 */
  1666. #if defined(LTDC)
  1667. #define __HAL_RCC_LTDC_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN) == RESET)
  1668. #endif /* LTDC */
  1669. #if defined(DSI)
  1670. #define __HAL_RCC_DSI_IS_CLK_DISABLED() (READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN) == RESET)
  1671. #endif /* DSI */
  1672. /**
  1673. * @}
  1674. */
  1675. /** @defgroup RCC_AHB1_Force_Release_Reset AHB1 Peripheral Force Release Reset
  1676. * @brief Force or release AHB1 peripheral reset.
  1677. * @{
  1678. */
  1679. #define __HAL_RCC_AHB1_FORCE_RESET() WRITE_REG(RCC->AHB1RSTR, 0xFFFFFFFFU)
  1680. #define __HAL_RCC_DMA1_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA1RST)
  1681. #define __HAL_RCC_DMA2_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2RST)
  1682. #if defined(DMAMUX1)
  1683. #define __HAL_RCC_DMAMUX1_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMAMUX1RST)
  1684. #endif /* DMAMUX1 */
  1685. #define __HAL_RCC_FLASH_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_FLASHRST)
  1686. #define __HAL_RCC_CRC_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_CRCRST)
  1687. #define __HAL_RCC_TSC_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_TSCRST)
  1688. #if defined(DMA2D)
  1689. #define __HAL_RCC_DMA2D_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2DRST)
  1690. #endif /* DMA2D */
  1691. #if defined(GFXMMU)
  1692. #define __HAL_RCC_GFXMMU_FORCE_RESET() SET_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_GFXMMURST)
  1693. #endif /* GFXMMU */
  1694. #define __HAL_RCC_AHB1_RELEASE_RESET() WRITE_REG(RCC->AHB1RSTR, 0x00000000U)
  1695. #define __HAL_RCC_DMA1_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA1RST)
  1696. #define __HAL_RCC_DMA2_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2RST)
  1697. #if defined(DMAMUX1)
  1698. #define __HAL_RCC_DMAMUX1_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMAMUX1RST)
  1699. #endif /* DMAMUX1 */
  1700. #define __HAL_RCC_FLASH_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_FLASHRST)
  1701. #define __HAL_RCC_CRC_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_CRCRST)
  1702. #define __HAL_RCC_TSC_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_TSCRST)
  1703. #if defined(DMA2D)
  1704. #define __HAL_RCC_DMA2D_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_DMA2DRST)
  1705. #endif /* DMA2D */
  1706. #if defined(GFXMMU)
  1707. #define __HAL_RCC_GFXMMU_RELEASE_RESET() CLEAR_BIT(RCC->AHB1RSTR, RCC_AHB1RSTR_GFXMMURST)
  1708. #endif /* GFXMMU */
  1709. /**
  1710. * @}
  1711. */
  1712. /** @defgroup RCC_AHB2_Force_Release_Reset AHB2 Peripheral Force Release Reset
  1713. * @brief Force or release AHB2 peripheral reset.
  1714. * @{
  1715. */
  1716. #define __HAL_RCC_AHB2_FORCE_RESET() WRITE_REG(RCC->AHB2RSTR, 0xFFFFFFFFU)
  1717. #define __HAL_RCC_GPIOA_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOARST)
  1718. #define __HAL_RCC_GPIOB_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOBRST)
  1719. #define __HAL_RCC_GPIOC_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOCRST)
  1720. #if defined(GPIOD)
  1721. #define __HAL_RCC_GPIOD_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIODRST)
  1722. #endif /* GPIOD */
  1723. #if defined(GPIOE)
  1724. #define __HAL_RCC_GPIOE_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOERST)
  1725. #endif /* GPIOE */
  1726. #if defined(GPIOF)
  1727. #define __HAL_RCC_GPIOF_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOFRST)
  1728. #endif /* GPIOF */
  1729. #if defined(GPIOG)
  1730. #define __HAL_RCC_GPIOG_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOGRST)
  1731. #endif /* GPIOG */
  1732. #define __HAL_RCC_GPIOH_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOHRST)
  1733. #if defined(GPIOI)
  1734. #define __HAL_RCC_GPIOI_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOIRST)
  1735. #endif /* GPIOI */
  1736. #if defined(USB_OTG_FS)
  1737. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_OTGFSRST)
  1738. #endif /* USB_OTG_FS */
  1739. #define __HAL_RCC_ADC_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_ADCRST)
  1740. #if defined(DCMI)
  1741. #define __HAL_RCC_DCMI_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_DCMIRST)
  1742. #endif /* DCMI */
  1743. #if defined(AES)
  1744. #define __HAL_RCC_AES_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_AESRST)
  1745. #endif /* AES */
  1746. #if defined(HASH)
  1747. #define __HAL_RCC_HASH_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_HASHRST)
  1748. #endif /* HASH */
  1749. #define __HAL_RCC_RNG_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_RNGRST)
  1750. #if defined(OCTOSPIM)
  1751. #define __HAL_RCC_OSPIM_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_OSPIMRST)
  1752. #endif /* OCTOSPIM */
  1753. #if defined(SDMMC1) && defined(RCC_AHB2RSTR_SDMMC1RST)
  1754. #define __HAL_RCC_SDMMC1_FORCE_RESET() SET_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_SDMMC1RST)
  1755. #endif /* SDMMC1 && RCC_AHB2RSTR_SDMMC1RST */
  1756. #define __HAL_RCC_AHB2_RELEASE_RESET() WRITE_REG(RCC->AHB2RSTR, 0x00000000U)
  1757. #define __HAL_RCC_GPIOA_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOARST)
  1758. #define __HAL_RCC_GPIOB_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOBRST)
  1759. #define __HAL_RCC_GPIOC_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOCRST)
  1760. #if defined(GPIOD)
  1761. #define __HAL_RCC_GPIOD_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIODRST)
  1762. #endif /* GPIOD */
  1763. #if defined(GPIOE)
  1764. #define __HAL_RCC_GPIOE_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOERST)
  1765. #endif /* GPIOE */
  1766. #if defined(GPIOF)
  1767. #define __HAL_RCC_GPIOF_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOFRST)
  1768. #endif /* GPIOF */
  1769. #if defined(GPIOG)
  1770. #define __HAL_RCC_GPIOG_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOGRST)
  1771. #endif /* GPIOG */
  1772. #define __HAL_RCC_GPIOH_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOHRST)
  1773. #if defined(GPIOI)
  1774. #define __HAL_RCC_GPIOI_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_GPIOIRST)
  1775. #endif /* GPIOI */
  1776. #if defined(USB_OTG_FS)
  1777. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_OTGFSRST)
  1778. #endif /* USB_OTG_FS */
  1779. #define __HAL_RCC_ADC_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_ADCRST)
  1780. #if defined(DCMI)
  1781. #define __HAL_RCC_DCMI_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_DCMIRST)
  1782. #endif /* DCMI */
  1783. #if defined(AES)
  1784. #define __HAL_RCC_AES_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_AESRST)
  1785. #endif /* AES */
  1786. #if defined(HASH)
  1787. #define __HAL_RCC_HASH_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_HASHRST)
  1788. #endif /* HASH */
  1789. #define __HAL_RCC_RNG_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_RNGRST)
  1790. #if defined(OCTOSPIM)
  1791. #define __HAL_RCC_OSPIM_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_OSPIMRST)
  1792. #endif /* OCTOSPIM */
  1793. #if defined(SDMMC1) && defined(RCC_AHB2RSTR_SDMMC1RST)
  1794. #define __HAL_RCC_SDMMC1_RELEASE_RESET() CLEAR_BIT(RCC->AHB2RSTR, RCC_AHB2RSTR_SDMMC1RST)
  1795. #endif /* SDMMC1 && RCC_AHB2RSTR_SDMMC1RST */
  1796. /**
  1797. * @}
  1798. */
  1799. /** @defgroup RCC_AHB3_Force_Release_Reset AHB3 Peripheral Force Release Reset
  1800. * @brief Force or release AHB3 peripheral reset.
  1801. * @{
  1802. */
  1803. #define __HAL_RCC_AHB3_FORCE_RESET() WRITE_REG(RCC->AHB3RSTR, 0xFFFFFFFFU)
  1804. #if defined(FMC_BANK1)
  1805. #define __HAL_RCC_FMC_FORCE_RESET() SET_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_FMCRST)
  1806. #endif /* FMC_BANK1 */
  1807. #if defined(QUADSPI)
  1808. #define __HAL_RCC_QSPI_FORCE_RESET() SET_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_QSPIRST)
  1809. #endif /* QUADSPI */
  1810. #if defined(OCTOSPI1)
  1811. #define __HAL_RCC_OSPI1_FORCE_RESET() SET_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_OSPI1RST)
  1812. #endif /* OCTOSPI1 */
  1813. #if defined(OCTOSPI2)
  1814. #define __HAL_RCC_OSPI2_FORCE_RESET() SET_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_OSPI2RST)
  1815. #endif /* OCTOSPI2 */
  1816. #define __HAL_RCC_AHB3_RELEASE_RESET() WRITE_REG(RCC->AHB3RSTR, 0x00000000U)
  1817. #if defined(FMC_BANK1)
  1818. #define __HAL_RCC_FMC_RELEASE_RESET() CLEAR_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_FMCRST)
  1819. #endif /* FMC_BANK1 */
  1820. #if defined(QUADSPI)
  1821. #define __HAL_RCC_QSPI_RELEASE_RESET() CLEAR_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_QSPIRST)
  1822. #endif /* QUADSPI */
  1823. #if defined(OCTOSPI1)
  1824. #define __HAL_RCC_OSPI1_RELEASE_RESET() CLEAR_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_OSPI1RST)
  1825. #endif /* OCTOSPI1 */
  1826. #if defined(OCTOSPI2)
  1827. #define __HAL_RCC_OSPI2_RELEASE_RESET() CLEAR_BIT(RCC->AHB3RSTR, RCC_AHB3RSTR_OSPI2RST)
  1828. #endif /* OCTOSPI2 */
  1829. /**
  1830. * @}
  1831. */
  1832. /** @defgroup RCC_APB1_Force_Release_Reset APB1 Peripheral Force Release Reset
  1833. * @brief Force or release APB1 peripheral reset.
  1834. * @{
  1835. */
  1836. #define __HAL_RCC_APB1_FORCE_RESET() WRITE_REG(RCC->APB1RSTR1, 0xFFFFFFFFU)
  1837. #define __HAL_RCC_TIM2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM2RST)
  1838. #if defined(TIM3)
  1839. #define __HAL_RCC_TIM3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM3RST)
  1840. #endif /* TIM3 */
  1841. #if defined(TIM4)
  1842. #define __HAL_RCC_TIM4_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM4RST)
  1843. #endif /* TIM4 */
  1844. #if defined(TIM5)
  1845. #define __HAL_RCC_TIM5_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM5RST)
  1846. #endif /* TIM5 */
  1847. #define __HAL_RCC_TIM6_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM6RST)
  1848. #define __HAL_RCC_TIM7_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM7RST)
  1849. #if defined(LCD)
  1850. #define __HAL_RCC_LCD_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LCDRST)
  1851. #endif /* LCD */
  1852. #if defined(SPI2)
  1853. #define __HAL_RCC_SPI2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI2RST)
  1854. #endif /* SPI2 */
  1855. #define __HAL_RCC_SPI3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI3RST)
  1856. #define __HAL_RCC_USART2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART2RST)
  1857. #if defined(USART3)
  1858. #define __HAL_RCC_USART3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART3RST)
  1859. #endif /* USART3 */
  1860. #if defined(UART4)
  1861. #define __HAL_RCC_UART4_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART4RST)
  1862. #endif /* UART4 */
  1863. #if defined(UART5)
  1864. #define __HAL_RCC_UART5_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART5RST)
  1865. #endif /* UART5 */
  1866. #define __HAL_RCC_I2C1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C1RST)
  1867. #if defined(I2C2)
  1868. #define __HAL_RCC_I2C2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C2RST)
  1869. #endif /* I2C2 */
  1870. #define __HAL_RCC_I2C3_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C3RST)
  1871. #if defined(I2C4)
  1872. #define __HAL_RCC_I2C4_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_I2C4RST)
  1873. #endif /* I2C4 */
  1874. #if defined(CRS)
  1875. #define __HAL_RCC_CRS_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CRSRST)
  1876. #endif /* CRS */
  1877. #define __HAL_RCC_CAN1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN1RST)
  1878. #if defined(CAN2)
  1879. #define __HAL_RCC_CAN2_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN2RST)
  1880. #endif /* CAN2 */
  1881. #if defined(USB)
  1882. #define __HAL_RCC_USB_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USBFSRST)
  1883. #endif /* USB */
  1884. #define __HAL_RCC_PWR_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_PWRRST)
  1885. #define __HAL_RCC_DAC1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_DAC1RST)
  1886. #define __HAL_RCC_OPAMP_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_OPAMPRST)
  1887. #define __HAL_RCC_LPTIM1_FORCE_RESET() SET_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LPTIM1RST)
  1888. #define __HAL_RCC_LPUART1_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPUART1RST)
  1889. #if defined(SWPMI1)
  1890. #define __HAL_RCC_SWPMI1_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_SWPMI1RST)
  1891. #endif /* SWPMI1 */
  1892. #define __HAL_RCC_LPTIM2_FORCE_RESET() SET_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPTIM2RST)
  1893. #define __HAL_RCC_APB1_RELEASE_RESET() WRITE_REG(RCC->APB1RSTR1, 0x00000000U)
  1894. #define __HAL_RCC_TIM2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM2RST)
  1895. #if defined(TIM3)
  1896. #define __HAL_RCC_TIM3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM3RST)
  1897. #endif /* TIM3 */
  1898. #if defined(TIM4)
  1899. #define __HAL_RCC_TIM4_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM4RST)
  1900. #endif /* TIM4 */
  1901. #if defined(TIM5)
  1902. #define __HAL_RCC_TIM5_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM5RST)
  1903. #endif /* TIM5 */
  1904. #define __HAL_RCC_TIM6_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM6RST)
  1905. #define __HAL_RCC_TIM7_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_TIM7RST)
  1906. #if defined(LCD)
  1907. #define __HAL_RCC_LCD_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LCDRST)
  1908. #endif /* LCD */
  1909. #if defined(SPI2)
  1910. #define __HAL_RCC_SPI2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI2RST)
  1911. #endif /* SPI2 */
  1912. #define __HAL_RCC_SPI3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_SPI3RST)
  1913. #define __HAL_RCC_USART2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART2RST)
  1914. #if defined(USART3)
  1915. #define __HAL_RCC_USART3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USART3RST)
  1916. #endif /* USART3 */
  1917. #if defined(UART4)
  1918. #define __HAL_RCC_UART4_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART4RST)
  1919. #endif /* UART4 */
  1920. #if defined(UART5)
  1921. #define __HAL_RCC_UART5_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_UART5RST)
  1922. #endif /* UART5 */
  1923. #define __HAL_RCC_I2C1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C1RST)
  1924. #if defined(I2C2)
  1925. #define __HAL_RCC_I2C2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C2RST)
  1926. #endif /* I2C2 */
  1927. #define __HAL_RCC_I2C3_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_I2C3RST)
  1928. #if defined(I2C4)
  1929. #define __HAL_RCC_I2C4_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_I2C4RST)
  1930. #endif /* I2C4 */
  1931. #if defined(CRS)
  1932. #define __HAL_RCC_CRS_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CRSRST)
  1933. #endif /* CRS */
  1934. #define __HAL_RCC_CAN1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN1RST)
  1935. #if defined(CAN2)
  1936. #define __HAL_RCC_CAN2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_CAN2RST)
  1937. #endif /* CAN2 */
  1938. #if defined(USB)
  1939. #define __HAL_RCC_USB_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_USBFSRST)
  1940. #endif /* USB */
  1941. #define __HAL_RCC_PWR_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_PWRRST)
  1942. #define __HAL_RCC_DAC1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_DAC1RST)
  1943. #define __HAL_RCC_OPAMP_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_OPAMPRST)
  1944. #define __HAL_RCC_LPTIM1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR1, RCC_APB1RSTR1_LPTIM1RST)
  1945. #define __HAL_RCC_LPUART1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPUART1RST)
  1946. #if defined(SWPMI1)
  1947. #define __HAL_RCC_SWPMI1_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_SWPMI1RST)
  1948. #endif /* SWPMI1 */
  1949. #define __HAL_RCC_LPTIM2_RELEASE_RESET() CLEAR_BIT(RCC->APB1RSTR2, RCC_APB1RSTR2_LPTIM2RST)
  1950. /**
  1951. * @}
  1952. */
  1953. /** @defgroup RCC_APB2_Force_Release_Reset APB2 Peripheral Force Release Reset
  1954. * @brief Force or release APB2 peripheral reset.
  1955. * @{
  1956. */
  1957. #define __HAL_RCC_APB2_FORCE_RESET() WRITE_REG(RCC->APB2RSTR, 0xFFFFFFFFU)
  1958. #define __HAL_RCC_SYSCFG_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SYSCFGRST)
  1959. #if defined(SDMMC1) && defined(RCC_APB2RSTR_SDMMC1RST)
  1960. #define __HAL_RCC_SDMMC1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SDMMC1RST)
  1961. #endif /* SDMMC1 && RCC_APB2RSTR_SDMMC1RST */
  1962. #define __HAL_RCC_TIM1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM1RST)
  1963. #define __HAL_RCC_SPI1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SPI1RST)
  1964. #if defined(TIM8)
  1965. #define __HAL_RCC_TIM8_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM8RST)
  1966. #endif /* TIM8 */
  1967. #define __HAL_RCC_USART1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_USART1RST)
  1968. #define __HAL_RCC_TIM15_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM15RST)
  1969. #define __HAL_RCC_TIM16_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM16RST)
  1970. #if defined(TIM17)
  1971. #define __HAL_RCC_TIM17_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM17RST)
  1972. #endif /* TIM17 */
  1973. #define __HAL_RCC_SAI1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI1RST)
  1974. #if defined(SAI2)
  1975. #define __HAL_RCC_SAI2_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI2RST)
  1976. #endif /* SAI2 */
  1977. #if defined(DFSDM1_Filter0)
  1978. #define __HAL_RCC_DFSDM1_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_DFSDM1RST)
  1979. #endif /* DFSDM1_Filter0 */
  1980. #if defined(LTDC)
  1981. #define __HAL_RCC_LTDC_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_LTDCRST)
  1982. #endif /* LTDC */
  1983. #if defined(DSI)
  1984. #define __HAL_RCC_DSI_FORCE_RESET() SET_BIT(RCC->APB2RSTR, RCC_APB2RSTR_DSIRST)
  1985. #endif /* DSI */
  1986. #define __HAL_RCC_APB2_RELEASE_RESET() WRITE_REG(RCC->APB2RSTR, 0x00000000U)
  1987. #define __HAL_RCC_SYSCFG_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SYSCFGRST)
  1988. #if defined(SDMMC1) && defined(RCC_APB2RSTR_SDMMC1RST)
  1989. #define __HAL_RCC_SDMMC1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SDMMC1RST)
  1990. #endif /* SDMMC1 && RCC_APB2RSTR_SDMMC1RST */
  1991. #define __HAL_RCC_TIM1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM1RST)
  1992. #define __HAL_RCC_SPI1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SPI1RST)
  1993. #if defined(TIM8)
  1994. #define __HAL_RCC_TIM8_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM8RST)
  1995. #endif /* TIM8 */
  1996. #define __HAL_RCC_USART1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_USART1RST)
  1997. #define __HAL_RCC_TIM15_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM15RST)
  1998. #define __HAL_RCC_TIM16_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM16RST)
  1999. #if defined(TIM17)
  2000. #define __HAL_RCC_TIM17_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_TIM17RST)
  2001. #endif /* TIM17 */
  2002. #define __HAL_RCC_SAI1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI1RST)
  2003. #if defined(SAI2)
  2004. #define __HAL_RCC_SAI2_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_SAI2RST)
  2005. #endif /* SAI2 */
  2006. #if defined(DFSDM1_Filter0)
  2007. #define __HAL_RCC_DFSDM1_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_DFSDM1RST)
  2008. #endif /* DFSDM1_Filter0 */
  2009. #if defined(LTDC)
  2010. #define __HAL_RCC_LTDC_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_LTDCRST)
  2011. #endif /* LTDC */
  2012. #if defined(DSI)
  2013. #define __HAL_RCC_DSI_RELEASE_RESET() CLEAR_BIT(RCC->APB2RSTR, RCC_APB2RSTR_DSIRST)
  2014. #endif /* DSI */
  2015. /**
  2016. * @}
  2017. */
  2018. /** @defgroup RCC_AHB1_Clock_Sleep_Enable_Disable AHB1 Peripheral Clock Sleep Enable Disable
  2019. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  2020. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2021. * power consumption.
  2022. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2023. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2024. * @{
  2025. */
  2026. #define __HAL_RCC_DMA1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN)
  2027. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN)
  2028. #if defined(DMAMUX1)
  2029. #define __HAL_RCC_DMAMUX1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMAMUX1SMEN)
  2030. #endif /* DMAMUX1 */
  2031. #define __HAL_RCC_FLASH_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN)
  2032. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN)
  2033. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN)
  2034. #define __HAL_RCC_TSC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN)
  2035. #if defined(DMA2D)
  2036. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN)
  2037. #endif /* DMA2D */
  2038. #if defined(GFXMMU)
  2039. #define __HAL_RCC_GFXMMU_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_GFXMMUSMEN)
  2040. #endif /* GFXMMU */
  2041. #define __HAL_RCC_DMA1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN)
  2042. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN)
  2043. #if defined(DMAMUX1)
  2044. #define __HAL_RCC_DMAMUX1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMAMUX1SMEN)
  2045. #endif /* DMAMUX1 */
  2046. #define __HAL_RCC_FLASH_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN)
  2047. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN)
  2048. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN)
  2049. #define __HAL_RCC_TSC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN)
  2050. #if defined(DMA2D)
  2051. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN)
  2052. #endif /* DMA2D */
  2053. #if defined(GFXMMU)
  2054. #define __HAL_RCC_GFXMMU_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_GFXMMUSMEN)
  2055. #endif /* GFXMMU */
  2056. /**
  2057. * @}
  2058. */
  2059. /** @defgroup RCC_AHB2_Clock_Sleep_Enable_Disable AHB2 Peripheral Clock Sleep Enable Disable
  2060. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  2061. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2062. * power consumption.
  2063. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2064. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2065. * @{
  2066. */
  2067. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN)
  2068. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN)
  2069. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN)
  2070. #if defined(GPIOD)
  2071. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN)
  2072. #endif /* GPIOD */
  2073. #if defined(GPIOE)
  2074. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN)
  2075. #endif /* GPIOE */
  2076. #if defined(GPIOF)
  2077. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN)
  2078. #endif /* GPIOF */
  2079. #if defined(GPIOG)
  2080. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN)
  2081. #endif /* GPIOG */
  2082. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN)
  2083. #if defined(GPIOI)
  2084. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN)
  2085. #endif /* GPIOI */
  2086. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN)
  2087. #if defined(SRAM3)
  2088. #define __HAL_RCC_SRAM3_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM3SMEN)
  2089. #endif /* SRAM3 */
  2090. #if defined(USB_OTG_FS)
  2091. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN)
  2092. #endif /* USB_OTG_FS */
  2093. #define __HAL_RCC_ADC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN)
  2094. #if defined(DCMI)
  2095. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN)
  2096. #endif /* DCMI */
  2097. #if defined(AES)
  2098. #define __HAL_RCC_AES_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN)
  2099. #endif /* AES */
  2100. #if defined(HASH)
  2101. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN)
  2102. #endif /* HASH */
  2103. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN)
  2104. #if defined(OCTOSPIM)
  2105. #define __HAL_RCC_OSPIM_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OSPIMSMEN)
  2106. #endif /* OCTOSPIM */
  2107. #if defined(SDMMC1) && defined(RCC_AHB2SMENR_SDMMC1SMEN)
  2108. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SDMMC1SMEN)
  2109. #endif /* SDMMC1 && RCC_AHB2SMENR_SDMMC1SMEN */
  2110. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN)
  2111. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN)
  2112. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN)
  2113. #if defined(GPIOD)
  2114. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN)
  2115. #endif /* GPIOD */
  2116. #if defined(GPIOE)
  2117. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN)
  2118. #endif /* GPIOE */
  2119. #if defined(GPIOF)
  2120. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN)
  2121. #endif /* GPIOF */
  2122. #if defined(GPIOG)
  2123. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN)
  2124. #endif /* GPIOG */
  2125. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN)
  2126. #if defined(GPIOI)
  2127. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN)
  2128. #endif /* GPIOI */
  2129. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN)
  2130. #if defined(SRAM3)
  2131. #define __HAL_RCC_SRAM3_IS_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM3SMEN)
  2132. #endif /* SRAM3 */
  2133. #if defined(USB_OTG_FS)
  2134. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN)
  2135. #endif /* USB_OTG_FS */
  2136. #define __HAL_RCC_ADC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN)
  2137. #if defined(DCMI)
  2138. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN)
  2139. #endif /* DCMI */
  2140. #if defined(AES)
  2141. #define __HAL_RCC_AES_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN)
  2142. #endif /* AES */
  2143. #if defined(HASH)
  2144. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN)
  2145. #endif /* HASH */
  2146. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN)
  2147. #if defined(OCTOSPIM)
  2148. #define __HAL_RCC_OSPIM_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OSPIMSMEN)
  2149. #endif /* OCTOSPIM */
  2150. #if defined(SDMMC1) && defined(RCC_AHB2SMENR_SDMMC1SMEN)
  2151. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SDMMC1SMEN)
  2152. #endif /* SDMMC1 && RCC_AHB2SMENR_SDMMC1SMEN */
  2153. /**
  2154. * @}
  2155. */
  2156. /** @defgroup RCC_AHB3_Clock_Sleep_Enable_Disable AHB3 Peripheral Clock Sleep Enable Disable
  2157. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  2158. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2159. * power consumption.
  2160. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2161. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2162. * @{
  2163. */
  2164. #if defined(QUADSPI)
  2165. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN)
  2166. #endif /* QUADSPI */
  2167. #if defined(OCTOSPI1)
  2168. #define __HAL_RCC_OSPI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI1SMEN)
  2169. #endif /* OCTOSPI1 */
  2170. #if defined(OCTOSPI2)
  2171. #define __HAL_RCC_OSPI2_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI2SMEN)
  2172. #endif /* OCTOSPI2 */
  2173. #if defined(FMC_BANK1)
  2174. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() SET_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN)
  2175. #endif /* FMC_BANK1 */
  2176. #if defined(QUADSPI)
  2177. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN)
  2178. #endif /* QUADSPI */
  2179. #if defined(OCTOSPI1)
  2180. #define __HAL_RCC_OSPI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI1SMEN)
  2181. #endif /* OCTOSPI1 */
  2182. #if defined(OCTOSPI2)
  2183. #define __HAL_RCC_OSPI2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI2SMEN)
  2184. #endif /* OCTOSPI2 */
  2185. #if defined(FMC_BANK1)
  2186. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN)
  2187. #endif /* FMC_BANK1 */
  2188. /**
  2189. * @}
  2190. */
  2191. /** @defgroup RCC_APB1_Clock_Sleep_Enable_Disable APB1 Peripheral Clock Sleep Enable Disable
  2192. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  2193. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2194. * power consumption.
  2195. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2196. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2197. * @{
  2198. */
  2199. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN)
  2200. #if defined(TIM3)
  2201. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN)
  2202. #endif /* TIM3 */
  2203. #if defined(TIM4)
  2204. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN)
  2205. #endif /* TIM4 */
  2206. #if defined(TIM5)
  2207. #define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN)
  2208. #endif /* TIM5 */
  2209. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN)
  2210. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN)
  2211. #if defined(LCD)
  2212. #define __HAL_RCC_LCD_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN)
  2213. #endif /* LCD */
  2214. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2215. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN)
  2216. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2217. #define __HAL_RCC_WWDG_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN)
  2218. #if defined(SPI2)
  2219. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN)
  2220. #endif /* SPI2 */
  2221. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN)
  2222. #define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN)
  2223. #if defined(USART3)
  2224. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN)
  2225. #endif /* USART3 */
  2226. #if defined(UART4)
  2227. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN)
  2228. #endif /* UART4 */
  2229. #if defined(UART5)
  2230. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN)
  2231. #endif /* UART5 */
  2232. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN)
  2233. #if defined(I2C2)
  2234. #define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN)
  2235. #endif /* I2C2 */
  2236. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN)
  2237. #if defined(I2C4)
  2238. #define __HAL_RCC_I2C4_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN)
  2239. #endif /* I2C4 */
  2240. #if defined(CRS)
  2241. #define __HAL_RCC_CRS_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN)
  2242. #endif /* CRS */
  2243. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN)
  2244. #if defined(CAN2)
  2245. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN)
  2246. #endif /* CAN2 */
  2247. #if defined(USB)
  2248. #define __HAL_RCC_USB_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN)
  2249. #endif /* USB */
  2250. #define __HAL_RCC_PWR_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN)
  2251. #define __HAL_RCC_DAC1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN)
  2252. #define __HAL_RCC_OPAMP_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN)
  2253. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN)
  2254. #define __HAL_RCC_LPUART1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN)
  2255. #if defined(SWPMI1)
  2256. #define __HAL_RCC_SWPMI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN)
  2257. #endif /* SWPMI1 */
  2258. #define __HAL_RCC_LPTIM2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN)
  2259. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN)
  2260. #if defined(TIM3)
  2261. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN)
  2262. #endif /* TIM3 */
  2263. #if defined(TIM4)
  2264. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN)
  2265. #endif /* TIM4 */
  2266. #if defined(TIM5)
  2267. #define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN)
  2268. #endif /* TIM5 */
  2269. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN)
  2270. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN)
  2271. #if defined(LCD)
  2272. #define __HAL_RCC_LCD_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN)
  2273. #endif /* LCD */
  2274. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2275. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN)
  2276. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2277. #define __HAL_RCC_WWDG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN)
  2278. #if defined(SPI2)
  2279. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN)
  2280. #endif /* SPI2 */
  2281. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN)
  2282. #define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN)
  2283. #if defined(USART3)
  2284. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN)
  2285. #endif /* USART3 */
  2286. #if defined(UART4)
  2287. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN)
  2288. #endif /* UART4 */
  2289. #if defined(UART5)
  2290. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN)
  2291. #endif /* UART5 */
  2292. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN)
  2293. #if defined(I2C2)
  2294. #define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN)
  2295. #endif /* I2C2 */
  2296. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN)
  2297. #if defined(I2C4)
  2298. #define __HAL_RCC_I2C4_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN)
  2299. #endif /* I2C4 */
  2300. #if defined(CRS)
  2301. #define __HAL_RCC_CRS_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN)
  2302. #endif /* CRS */
  2303. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN)
  2304. #if defined(CAN2)
  2305. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN)
  2306. #endif /* CAN2 */
  2307. #if defined(USB)
  2308. #define __HAL_RCC_USB_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN)
  2309. #endif /* USB */
  2310. #define __HAL_RCC_PWR_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN)
  2311. #define __HAL_RCC_DAC1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN)
  2312. #define __HAL_RCC_OPAMP_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN)
  2313. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN)
  2314. #define __HAL_RCC_LPUART1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN)
  2315. #if defined(SWPMI1)
  2316. #define __HAL_RCC_SWPMI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN)
  2317. #endif /* SWPMI1 */
  2318. #define __HAL_RCC_LPTIM2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN)
  2319. /**
  2320. * @}
  2321. */
  2322. /** @defgroup RCC_APB2_Clock_Sleep_Enable_Disable APB2 Peripheral Clock Sleep Enable Disable
  2323. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  2324. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2325. * power consumption.
  2326. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2327. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2328. * @{
  2329. */
  2330. #define __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN)
  2331. #if defined(SDMMC1) && defined(RCC_APB2SMENR_SDMMC1SMEN)
  2332. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN)
  2333. #endif /* SDMMC1 && RCC_APB2SMENR_SDMMC1SMEN */
  2334. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN)
  2335. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN)
  2336. #if defined(TIM8)
  2337. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN)
  2338. #endif /* TIM8 */
  2339. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN)
  2340. #define __HAL_RCC_TIM15_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN)
  2341. #define __HAL_RCC_TIM16_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN)
  2342. #if defined(TIM17)
  2343. #define __HAL_RCC_TIM17_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN)
  2344. #endif /* TIM17 */
  2345. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN)
  2346. #if defined(SAI2)
  2347. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN)
  2348. #endif /* SAI2 */
  2349. #if defined(DFSDM1_Filter0)
  2350. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN)
  2351. #endif /* DFSDM1_Filter0 */
  2352. #if defined(LTDC)
  2353. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_LTDCSMEN)
  2354. #endif /* LTDC */
  2355. #if defined(DSI)
  2356. #define __HAL_RCC_DSI_CLK_SLEEP_ENABLE() SET_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DSISMEN)
  2357. #endif /* DSI */
  2358. #define __HAL_RCC_SYSCFG_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN)
  2359. #if defined(SDMMC1) && defined(RCC_APB2SMENR_SDMMC1SMEN)
  2360. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN)
  2361. #endif /* SDMMC1 && RCC_APB2SMENR_SDMMC1SMEN */
  2362. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN)
  2363. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN)
  2364. #if defined(TIM8)
  2365. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN)
  2366. #endif /* TIM8 */
  2367. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN)
  2368. #define __HAL_RCC_TIM15_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN)
  2369. #define __HAL_RCC_TIM16_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN)
  2370. #if defined(TIM17)
  2371. #define __HAL_RCC_TIM17_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN)
  2372. #endif /* TIM17 */
  2373. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN)
  2374. #if defined(SAI2)
  2375. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN)
  2376. #endif /* SAI2 */
  2377. #if defined(DFSDM1_Filter0)
  2378. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN)
  2379. #endif /* DFSDM1_Filter0 */
  2380. #if defined(LTDC)
  2381. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_LTDCSMEN)
  2382. #endif /* LTDC */
  2383. #if defined(DSI)
  2384. #define __HAL_RCC_DSI_CLK_SLEEP_DISABLE() CLEAR_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DSISMEN)
  2385. #endif /* DSI */
  2386. /**
  2387. * @}
  2388. */
  2389. /** @defgroup RCC_AHB1_Clock_Sleep_Enable_Disable_Status AHB1 Peripheral Clock Sleep Enabled or Disabled Status
  2390. * @brief Check whether the AHB1 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2391. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2392. * power consumption.
  2393. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2394. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2395. * @{
  2396. */
  2397. #define __HAL_RCC_DMA1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN) != RESET)
  2398. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN) != RESET)
  2399. #if defined(DMAMUX1)
  2400. #define __HAL_RCC_DMAMUX1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMAMUX1SMEN) != RESET)
  2401. #endif /* DMAMUX1 */
  2402. #define __HAL_RCC_FLASH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN) != RESET)
  2403. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN) != RESET)
  2404. #define __HAL_RCC_CRC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN) != RESET)
  2405. #define __HAL_RCC_TSC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN) != RESET)
  2406. #if defined(DMA2D)
  2407. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN) != RESET)
  2408. #endif /* DMA2D */
  2409. #if defined(GFXMMU)
  2410. #define __HAL_RCC_GFXMMU_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_GFXMMUSMEN) != RESET)
  2411. #endif /* GFXMMU */
  2412. #define __HAL_RCC_DMA1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN) == RESET)
  2413. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN) == RESET)
  2414. #if defined(DMAMUX1)
  2415. #define __HAL_RCC_DMAMUX1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMAMUX1SMEN) == RESET)
  2416. #endif /* DMAMUX1 */
  2417. #define __HAL_RCC_FLASH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_FLASHSMEN) == RESET)
  2418. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN) == RESET)
  2419. #define __HAL_RCC_CRC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN) == RESET)
  2420. #define __HAL_RCC_TSC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN) == RESET)
  2421. #if defined(DMA2D)
  2422. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2DSMEN) == RESET)
  2423. #endif /* DMA2D */
  2424. #if defined(GFXMMU)
  2425. #define __HAL_RCC_GFXMMU_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_GFXMMUSMEN) == RESET)
  2426. #endif /* GFXMMU */
  2427. /**
  2428. * @}
  2429. */
  2430. /** @defgroup RCC_AHB2_Clock_Sleep_Enable_Disable_Status AHB2 Peripheral Clock Sleep Enabled or Disabled Status
  2431. * @brief Check whether the AHB2 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2432. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2433. * power consumption.
  2434. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2435. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2436. * @{
  2437. */
  2438. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN) != RESET)
  2439. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN) != RESET)
  2440. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN) != RESET)
  2441. #if defined(GPIOD)
  2442. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN) != RESET)
  2443. #endif /* GPIOD */
  2444. #if defined(GPIOE)
  2445. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN) != RESET)
  2446. #endif /* GPIOE */
  2447. #if defined(GPIOF)
  2448. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN) != RESET)
  2449. #endif /* GPIOF */
  2450. #if defined(GPIOG)
  2451. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN) != RESET)
  2452. #endif /* GPIOG */
  2453. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN) != RESET)
  2454. #if defined(GPIOI)
  2455. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN) != RESET)
  2456. #endif /* GPIOI */
  2457. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN) != RESET)
  2458. #if defined(SRAM3)
  2459. #define __HAL_RCC_SRAM3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM3SMEN) != RESET)
  2460. #endif /* SRAM3 */
  2461. #if defined(USB_OTG_FS)
  2462. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN) != RESET)
  2463. #endif /* USB_OTG_FS */
  2464. #define __HAL_RCC_ADC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN) != RESET)
  2465. #if defined(DCMI)
  2466. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN) != RESET)
  2467. #endif /* DCMI */
  2468. #if defined(AES)
  2469. #define __HAL_RCC_AES_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN) != RESET)
  2470. #endif /* AES */
  2471. #if defined(HASH)
  2472. #define __HAL_RCC_HASH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN) != RESET)
  2473. #endif /* HASH */
  2474. #define __HAL_RCC_RNG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN) != RESET)
  2475. #if defined(OCTOSPIM)
  2476. #define __HAL_RCC_OSPIM_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OSPIMSMEN) != RESET)
  2477. #endif /* OCTOSPIM */
  2478. #if defined(SDMMC1) && defined(RCC_AHB2SMENR_SDMMC1SMEN)
  2479. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SDMMC1SMEN) != RESET)
  2480. #endif /* SDMMC1 && RCC_AHB2SMENR_SDMMC1SMEN */
  2481. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN) == RESET)
  2482. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN) == RESET)
  2483. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN) == RESET)
  2484. #if defined(GPIOD)
  2485. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN) == RESET)
  2486. #endif /* GPIOD */
  2487. #if defined(GPIOE)
  2488. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN) == RESET)
  2489. #endif /* GPIOE */
  2490. #if defined(GPIOF)
  2491. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOFSMEN) == RESET)
  2492. #endif /* GPIOF */
  2493. #if defined(GPIOG)
  2494. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOGSMEN) == RESET)
  2495. #endif /* GPIOG */
  2496. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN) == RESET)
  2497. #if defined(GPIOI)
  2498. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOISMEN) == RESET)
  2499. #endif /* GPIOI */
  2500. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM2SMEN) == RESET)
  2501. #if defined(SRAM3)
  2502. #define __HAL_RCC_SRAM3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SRAM3SMEN) == RESET)
  2503. #endif /* SRAM3 */
  2504. #if defined(USB_OTG_FS)
  2505. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OTGFSSMEN) == RESET)
  2506. #endif /* USB_OTG_FS */
  2507. #define __HAL_RCC_ADC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN) == RESET)
  2508. #if defined(DCMI)
  2509. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_DCMISMEN) == RESET)
  2510. #endif /* DCMI */
  2511. #if defined(AES)
  2512. #define __HAL_RCC_AES_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AESSMEN) == RESET)
  2513. #endif /* AES */
  2514. #if defined(HASH)
  2515. #define __HAL_RCC_HASH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_HASHSMEN) == RESET)
  2516. #endif /* HASH */
  2517. #define __HAL_RCC_RNG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_RNGSMEN) == RESET)
  2518. #if defined(OCTOSPIM)
  2519. #define __HAL_RCC_OSPIM_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_OSPIMSMEN) == RESET)
  2520. #endif /* OCTOSPIM */
  2521. #if defined(SDMMC1) && defined(RCC_AHB2SMENR_SDMMC1SMEN)
  2522. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_SDMMC1SMEN) == RESET)
  2523. #endif /* SDMMC1 && RCC_AHB2SMENR_SDMMC1SMEN */
  2524. /**
  2525. * @}
  2526. */
  2527. /** @defgroup RCC_AHB3_Clock_Sleep_Enable_Disable_Status AHB3 Peripheral Clock Sleep Enabled or Disabled Status
  2528. * @brief Check whether the AHB3 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2529. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2530. * power consumption.
  2531. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2532. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2533. * @{
  2534. */
  2535. #if defined(QUADSPI)
  2536. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN) != RESET)
  2537. #endif /* QUADSPI */
  2538. #if defined(OCTOSPI1)
  2539. #define __HAL_RCC_OSPI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI1SMEN) != RESET)
  2540. #endif /* OCTOSPI1 */
  2541. #if defined(OCTOSPI2)
  2542. #define __HAL_RCC_OSPI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI2SMEN) != RESET)
  2543. #endif /* OCTOSPI2 */
  2544. #if defined(FMC_BANK1)
  2545. #define __HAL_RCC_FMC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN) != RESET)
  2546. #endif /* FMC_BANK1 */
  2547. #if defined(QUADSPI)
  2548. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QSPISMEN) == RESET)
  2549. #endif /* QUADSPI */
  2550. #if defined(OCTOSPI1)
  2551. #define __HAL_RCC_OSPI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI1SMEN) == RESET)
  2552. #endif /* OCTOSPI1 */
  2553. #if defined(OCTOSPI2)
  2554. #define __HAL_RCC_OSPI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_OSPI2SMEN) == RESET)
  2555. #endif /* OCTOSPI2 */
  2556. #if defined(FMC_BANK1)
  2557. #define __HAL_RCC_FMC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FMCSMEN) == RESET)
  2558. #endif /* FMC_BANK1 */
  2559. /**
  2560. * @}
  2561. */
  2562. /** @defgroup RCC_APB1_Clock_Sleep_Enable_Disable_Status APB1 Peripheral Clock Sleep Enabled or Disabled Status
  2563. * @brief Check whether the APB1 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2564. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2565. * power consumption.
  2566. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2567. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2568. * @{
  2569. */
  2570. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN) != RESET)
  2571. #if defined(TIM3)
  2572. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN) != RESET)
  2573. #endif /* TIM3 */
  2574. #if defined(TIM4)
  2575. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN) != RESET)
  2576. #endif /* TIM4 */
  2577. #if defined(TIM5)
  2578. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN) != RESET)
  2579. #endif /* TIM5 */
  2580. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN) != RESET)
  2581. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN) != RESET)
  2582. #if defined(LCD)
  2583. #define __HAL_RCC_LCD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN) != RESET)
  2584. #endif /* LCD */
  2585. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2586. #define __HAL_RCC_RTCAPB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN) != RESET)
  2587. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2588. #define __HAL_RCC_WWDG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN) != RESET)
  2589. #if defined(SPI2)
  2590. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN) != RESET)
  2591. #endif /* SPI2 */
  2592. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN) != RESET)
  2593. #define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN) != RESET)
  2594. #if defined(USART3)
  2595. #define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN) != RESET)
  2596. #endif /* USART3 */
  2597. #if defined(UART4)
  2598. #define __HAL_RCC_UART4_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN) != RESET)
  2599. #endif /* UART4 */
  2600. #if defined(UART5)
  2601. #define __HAL_RCC_UART5_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN) != RESET)
  2602. #endif /* UART5 */
  2603. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN) != RESET)
  2604. #if defined(I2C2)
  2605. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN) != RESET)
  2606. #endif /* I2C2 */
  2607. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN) != RESET)
  2608. #if defined(I2C4)
  2609. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN) != RESET)
  2610. #endif /* I2C4 */
  2611. #if defined(CRS)
  2612. #define __HAL_RCC_CRS_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN) != RESET)
  2613. #endif /* CRS */
  2614. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN) != RESET)
  2615. #if defined(CAN2)
  2616. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN) != RESET)
  2617. #endif /* CAN2 */
  2618. #if defined(USB)
  2619. #define __HAL_RCC_USB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN) != RESET)
  2620. #endif /* USB */
  2621. #define __HAL_RCC_PWR_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN) != RESET)
  2622. #define __HAL_RCC_DAC1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN) != RESET)
  2623. #define __HAL_RCC_OPAMP_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN) != RESET)
  2624. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN) != RESET)
  2625. #define __HAL_RCC_LPUART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN) != RESET)
  2626. #if defined(SWPMI1)
  2627. #define __HAL_RCC_SWPMI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN) != RESET)
  2628. #endif /* SWPMI1 */
  2629. #define __HAL_RCC_LPTIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN) != RESET)
  2630. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN) == RESET)
  2631. #if defined(TIM3)
  2632. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM3SMEN) == RESET)
  2633. #endif /* TIM3 */
  2634. #if defined(TIM4)
  2635. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM4SMEN) == RESET)
  2636. #endif /* TIM4 */
  2637. #if defined(TIM5)
  2638. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM5SMEN) == RESET)
  2639. #endif /* TIM5 */
  2640. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM6SMEN) == RESET)
  2641. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM7SMEN) == RESET)
  2642. #if defined(LCD)
  2643. #define __HAL_RCC_LCD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN) == RESET)
  2644. #endif /* LCD */
  2645. #if defined(RCC_APB1SMENR1_RTCAPBSMEN)
  2646. #define __HAL_RCC_RTCAPB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN) == RESET)
  2647. #endif /* RCC_APB1SMENR1_RTCAPBSMEN */
  2648. #define __HAL_RCC_WWDG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN) == RESET)
  2649. #if defined(SPI2)
  2650. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN) == RESET)
  2651. #endif /* SPI2 */
  2652. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI3SMEN) == RESET)
  2653. #define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART2SMEN) == RESET)
  2654. #if defined(USART3)
  2655. #define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USART3SMEN) == RESET)
  2656. #endif /* USART3 */
  2657. #if defined(UART4)
  2658. #define __HAL_RCC_UART4_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART4SMEN) == RESET)
  2659. #endif /* UART4 */
  2660. #if defined(UART5)
  2661. #define __HAL_RCC_UART5_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_UART5SMEN) == RESET)
  2662. #endif /* UART5 */
  2663. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN) == RESET)
  2664. #if defined(I2C2)
  2665. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C2SMEN) == RESET)
  2666. #endif /* I2C2 */
  2667. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN) == RESET)
  2668. #if defined(I2C4)
  2669. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_I2C4SMEN) == RESET)
  2670. #endif /* I2C4 */
  2671. #if defined(CRS)
  2672. #define __HAL_RCC_CRS_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN) == RESET)
  2673. #endif /* CRS */
  2674. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN1SMEN) == RESET)
  2675. #if defined(CAN2)
  2676. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CAN2SMEN) == RESET)
  2677. #endif /* CAN2 */
  2678. #if defined(USB)
  2679. #define __HAL_RCC_USB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBFSSMEN) == RESET)
  2680. #endif /* USB */
  2681. #define __HAL_RCC_PWR_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_PWRSMEN) == RESET)
  2682. #define __HAL_RCC_DAC1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_DAC1SMEN) == RESET)
  2683. #define __HAL_RCC_OPAMP_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_OPAMPSMEN) == RESET)
  2684. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN) == RESET)
  2685. #define __HAL_RCC_LPUART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN) == RESET)
  2686. #if defined(SWPMI1)
  2687. #define __HAL_RCC_SWPMI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_SWPMI1SMEN) == RESET)
  2688. #endif /* SWPMI1 */
  2689. #define __HAL_RCC_LPTIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN) == RESET)
  2690. /**
  2691. * @}
  2692. */
  2693. /** @defgroup RCC_APB2_Clock_Sleep_Enable_Disable_Status APB2 Peripheral Clock Sleep Enabled or Disabled Status
  2694. * @brief Check whether the APB2 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2695. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2696. * power consumption.
  2697. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2698. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2699. * @{
  2700. */
  2701. #define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN) != RESET)
  2702. #if defined(SDMMC1) && defined(RCC_APB2SMENR_SDMMC1SMEN)
  2703. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN) != RESET)
  2704. #endif /* SDMMC1 && RCC_APB2SMENR_SDMMC1SMEN */
  2705. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN) != RESET)
  2706. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN) != RESET)
  2707. #if defined(TIM8)
  2708. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN) != RESET)
  2709. #endif /* TIM8 */
  2710. #define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN) != RESET)
  2711. #define __HAL_RCC_TIM15_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN) != RESET)
  2712. #define __HAL_RCC_TIM16_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN) != RESET)
  2713. #if defined(TIM17)
  2714. #define __HAL_RCC_TIM17_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN) != RESET)
  2715. #endif /* TIM17 */
  2716. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN) != RESET)
  2717. #if defined(SAI2)
  2718. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN) != RESET)
  2719. #endif /* SAI2 */
  2720. #if defined(DFSDM1_Filter0)
  2721. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN) != RESET)
  2722. #endif /* DFSDM1_Filter0 */
  2723. #if defined(LTDC)
  2724. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_LTDCSMEN) != RESET)
  2725. #endif /* LTDC */
  2726. #if defined(DSI)
  2727. #define __HAL_RCC_DSI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DSISMEN) != RESET)
  2728. #endif /* DSI */
  2729. #define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SYSCFGSMEN) == RESET)
  2730. #if defined(SDMMC1) && defined(RCC_APB2SMENR_SDMMC1SMEN)
  2731. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SDMMC1SMEN) == RESET)
  2732. #endif /* SDMMC1 && RCC_APB2SMENR_SDMMC1SMEN */
  2733. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN) == RESET)
  2734. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN) == RESET)
  2735. #if defined(TIM8)
  2736. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM8SMEN) == RESET)
  2737. #endif /* TIM8 */
  2738. #define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN) == RESET)
  2739. #define __HAL_RCC_TIM15_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM15SMEN) == RESET)
  2740. #define __HAL_RCC_TIM16_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN) == RESET)
  2741. #if defined(TIM17)
  2742. #define __HAL_RCC_TIM17_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN) == RESET)
  2743. #endif /* TIM17 */
  2744. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN) == RESET)
  2745. #if defined(SAI2)
  2746. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI2SMEN) == RESET)
  2747. #endif /* SAI2 */
  2748. #if defined(DFSDM1_Filter0)
  2749. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DFSDM1SMEN) == RESET)
  2750. #endif /* DFSDM1_Filter0 */
  2751. #if defined(LTDC)
  2752. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_LTDCSMEN) == RESET)
  2753. #endif /* LTDC */
  2754. #if defined(DSI)
  2755. #define __HAL_RCC_DSI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_DSISMEN) == RESET)
  2756. #endif /* DSI */
  2757. /**
  2758. * @}
  2759. */
  2760. /** @defgroup RCC_Backup_Domain_Reset RCC Backup Domain Reset
  2761. * @{
  2762. */
  2763. /** @brief Macros to force or release the Backup domain reset.
  2764. * @note This function resets the RTC peripheral (including the backup registers)
  2765. * and the RTC clock source selection in RCC_CSR register.
  2766. * @note The BKPSRAM is not affected by this reset.
  2767. * @retval None
  2768. */
  2769. #define __HAL_RCC_BACKUPRESET_FORCE() SET_BIT(RCC->BDCR, RCC_BDCR_BDRST)
  2770. #define __HAL_RCC_BACKUPRESET_RELEASE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST)
  2771. /**
  2772. * @}
  2773. */
  2774. /** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
  2775. * @{
  2776. */
  2777. /** @brief Macros to enable or disable the RTC clock.
  2778. * @note As the RTC is in the Backup domain and write access is denied to
  2779. * this domain after reset, you have to enable write access using
  2780. * HAL_PWR_EnableBkUpAccess() function before to configure the RTC
  2781. * (to be done once after reset).
  2782. * @note These macros must be used after the RTC clock source was selected.
  2783. * @retval None
  2784. */
  2785. #define __HAL_RCC_RTC_ENABLE() SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
  2786. #define __HAL_RCC_RTC_DISABLE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
  2787. /**
  2788. * @}
  2789. */
  2790. /** @brief Macros to enable or disable the Internal High Speed 16MHz oscillator (HSI).
  2791. * @note The HSI is stopped by hardware when entering STOP and STANDBY modes.
  2792. * It is used (enabled by hardware) as system clock source after startup
  2793. * from Reset, wakeup from STOP and STANDBY mode, or in case of failure
  2794. * of the HSE used directly or indirectly as system clock (if the Clock
  2795. * Security System CSS is enabled).
  2796. * @note HSI can not be stopped if it is used as system clock source. In this case,
  2797. * you have to select another source of the system clock then stop the HSI.
  2798. * @note After enabling the HSI, the application software should wait on HSIRDY
  2799. * flag to be set indicating that HSI clock is stable and can be used as
  2800. * system clock source.
  2801. * This parameter can be: ENABLE or DISABLE.
  2802. * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
  2803. * clock cycles.
  2804. * @retval None
  2805. */
  2806. #define __HAL_RCC_HSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSION)
  2807. #define __HAL_RCC_HSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSION)
  2808. /** @brief Macro to adjust the Internal High Speed 16MHz oscillator (HSI) calibration value.
  2809. * @note The calibration is used to compensate for the variations in voltage
  2810. * and temperature that influence the frequency of the internal HSI RC.
  2811. * @param __HSICALIBRATIONVALUE__ specifies the calibration trimming value
  2812. * (default is RCC_HSICALIBRATION_DEFAULT).
  2813. * This parameter must be a number between 0 and 0x1F (STM32L43x/STM32L44x/STM32L47x/STM32L48x) or 0x7F (for other devices).
  2814. * @retval None
  2815. */
  2816. #define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(__HSICALIBRATIONVALUE__) \
  2817. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, (__HSICALIBRATIONVALUE__) << RCC_ICSCR_HSITRIM_Pos)
  2818. /**
  2819. * @brief Macros to enable or disable the wakeup the Internal High Speed oscillator (HSI)
  2820. * in parallel to the Internal Multi Speed oscillator (MSI) used at system wakeup.
  2821. * @note The enable of this function has not effect on the HSION bit.
  2822. * This parameter can be: ENABLE or DISABLE.
  2823. * @retval None
  2824. */
  2825. #define __HAL_RCC_HSIAUTOMATIC_START_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSIASFS)
  2826. #define __HAL_RCC_HSIAUTOMATIC_START_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSIASFS)
  2827. /**
  2828. * @brief Macros to enable or disable the force of the Internal High Speed oscillator (HSI)
  2829. * in STOP mode to be quickly available as kernel clock for USARTs and I2Cs.
  2830. * @note Keeping the HSI ON in STOP mode allows to avoid slowing down the communication
  2831. * speed because of the HSI startup time.
  2832. * @note The enable of this function has not effect on the HSION bit.
  2833. * This parameter can be: ENABLE or DISABLE.
  2834. * @retval None
  2835. */
  2836. #define __HAL_RCC_HSISTOP_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSIKERON)
  2837. #define __HAL_RCC_HSISTOP_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON)
  2838. /**
  2839. * @brief Macros to enable or disable the Internal Multi Speed oscillator (MSI).
  2840. * @note The MSI is stopped by hardware when entering STOP and STANDBY modes.
  2841. * It is used (enabled by hardware) as system clock source after
  2842. * startup from Reset, wakeup from STOP and STANDBY mode, or in case
  2843. * of failure of the HSE used directly or indirectly as system clock
  2844. * (if the Clock Security System CSS is enabled).
  2845. * @note MSI can not be stopped if it is used as system clock source.
  2846. * In this case, you have to select another source of the system
  2847. * clock then stop the MSI.
  2848. * @note After enabling the MSI, the application software should wait on
  2849. * MSIRDY flag to be set indicating that MSI clock is stable and can
  2850. * be used as system clock source.
  2851. * @note When the MSI is stopped, MSIRDY flag goes low after 6 MSI oscillator
  2852. * clock cycles.
  2853. * @retval None
  2854. */
  2855. #define __HAL_RCC_MSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_MSION)
  2856. #define __HAL_RCC_MSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_MSION)
  2857. /** @brief Macro Adjusts the Internal Multi Speed oscillator (MSI) calibration value.
  2858. * @note The calibration is used to compensate for the variations in voltage
  2859. * and temperature that influence the frequency of the internal MSI RC.
  2860. * Refer to the Application Note AN3300 for more details on how to
  2861. * calibrate the MSI.
  2862. * @param __MSICALIBRATIONVALUE__ specifies the calibration trimming value
  2863. * (default is RCC_MSICALIBRATION_DEFAULT).
  2864. * This parameter must be a number between 0 and 255.
  2865. * @retval None
  2866. */
  2867. #define __HAL_RCC_MSI_CALIBRATIONVALUE_ADJUST(__MSICALIBRATIONVALUE__) \
  2868. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_MSITRIM, (__MSICALIBRATIONVALUE__) << RCC_ICSCR_MSITRIM_Pos)
  2869. /**
  2870. * @brief Macro configures the Internal Multi Speed oscillator (MSI) clock range in run mode
  2871. * @note After restart from Reset , the MSI clock is around 4 MHz.
  2872. * After stop the startup clock can be MSI (at any of its possible
  2873. * frequencies, the one that was used before entering stop mode) or HSI.
  2874. * After Standby its frequency can be selected between 4 possible values
  2875. * (1, 2, 4 or 8 MHz).
  2876. * @note MSIRANGE can be modified when MSI is OFF (MSION=0) or when MSI is ready
  2877. * (MSIRDY=1).
  2878. * @note The MSI clock range after reset can be modified on the fly.
  2879. * @param __MSIRANGEVALUE__ specifies the MSI clock range.
  2880. * This parameter must be one of the following values:
  2881. * @arg @ref RCC_MSIRANGE_0 MSI clock is around 100 KHz
  2882. * @arg @ref RCC_MSIRANGE_1 MSI clock is around 200 KHz
  2883. * @arg @ref RCC_MSIRANGE_2 MSI clock is around 400 KHz
  2884. * @arg @ref RCC_MSIRANGE_3 MSI clock is around 800 KHz
  2885. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2886. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2887. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2888. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2889. * @arg @ref RCC_MSIRANGE_8 MSI clock is around 16 MHz
  2890. * @arg @ref RCC_MSIRANGE_9 MSI clock is around 24 MHz
  2891. * @arg @ref RCC_MSIRANGE_10 MSI clock is around 32 MHz
  2892. * @arg @ref RCC_MSIRANGE_11 MSI clock is around 48 MHz
  2893. * @retval None
  2894. */
  2895. #define __HAL_RCC_MSI_RANGE_CONFIG(__MSIRANGEVALUE__) \
  2896. do { \
  2897. SET_BIT(RCC->CR, RCC_CR_MSIRGSEL); \
  2898. MODIFY_REG(RCC->CR, RCC_CR_MSIRANGE, (__MSIRANGEVALUE__)); \
  2899. } while(0)
  2900. /**
  2901. * @brief Macro configures the Internal Multi Speed oscillator (MSI) clock range after Standby mode
  2902. * After Standby its frequency can be selected between 4 possible values (1, 2, 4 or 8 MHz).
  2903. * @param __MSIRANGEVALUE__ specifies the MSI clock range.
  2904. * This parameter must be one of the following values:
  2905. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2906. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2907. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2908. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2909. * @retval None
  2910. */
  2911. #define __HAL_RCC_MSI_STANDBY_RANGE_CONFIG(__MSIRANGEVALUE__) \
  2912. MODIFY_REG(RCC->CSR, RCC_CSR_MSISRANGE, (__MSIRANGEVALUE__) << 4U)
  2913. /** @brief Macro to get the Internal Multi Speed oscillator (MSI) clock range in run mode
  2914. * @retval MSI clock range.
  2915. * This parameter must be one of the following values:
  2916. * @arg @ref RCC_MSIRANGE_0 MSI clock is around 100 KHz
  2917. * @arg @ref RCC_MSIRANGE_1 MSI clock is around 200 KHz
  2918. * @arg @ref RCC_MSIRANGE_2 MSI clock is around 400 KHz
  2919. * @arg @ref RCC_MSIRANGE_3 MSI clock is around 800 KHz
  2920. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2921. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2922. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2923. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2924. * @arg @ref RCC_MSIRANGE_8 MSI clock is around 16 MHz
  2925. * @arg @ref RCC_MSIRANGE_9 MSI clock is around 24 MHz
  2926. * @arg @ref RCC_MSIRANGE_10 MSI clock is around 32 MHz
  2927. * @arg @ref RCC_MSIRANGE_11 MSI clock is around 48 MHz
  2928. */
  2929. #define __HAL_RCC_GET_MSI_RANGE() \
  2930. ((READ_BIT(RCC->CR, RCC_CR_MSIRGSEL) != RESET) ? \
  2931. READ_BIT(RCC->CR, RCC_CR_MSIRANGE) : \
  2932. READ_BIT(RCC->CSR, RCC_CSR_MSISRANGE) >> 4U)
  2933. /** @brief Macros to enable or disable the Internal Low Speed oscillator (LSI).
  2934. * @note After enabling the LSI, the application software should wait on
  2935. * LSIRDY flag to be set indicating that LSI clock is stable and can
  2936. * be used to clock the IWDG and/or the RTC.
  2937. * @note LSI can not be disabled if the IWDG is running.
  2938. * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
  2939. * clock cycles.
  2940. * @retval None
  2941. */
  2942. #define __HAL_RCC_LSI_ENABLE() SET_BIT(RCC->CSR, RCC_CSR_LSION)
  2943. #define __HAL_RCC_LSI_DISABLE() CLEAR_BIT(RCC->CSR, RCC_CSR_LSION)
  2944. /**
  2945. * @brief Macro to configure the External High Speed oscillator (HSE).
  2946. * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not
  2947. * supported by this macro. User should request a transition to HSE Off
  2948. * first and then HSE On or HSE Bypass.
  2949. * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application
  2950. * software should wait on HSERDY flag to be set indicating that HSE clock
  2951. * is stable and can be used to clock the PLL and/or system clock.
  2952. * @note HSE state can not be changed if it is used directly or through the
  2953. * PLL as system clock. In this case, you have to select another source
  2954. * of the system clock then change the HSE state (ex. disable it).
  2955. * @note The HSE is stopped by hardware when entering STOP and STANDBY modes.
  2956. * @note This function reset the CSSON bit, so if the clock security system(CSS)
  2957. * was previously enabled you have to enable it again after calling this
  2958. * function.
  2959. * @param __STATE__ specifies the new state of the HSE.
  2960. * This parameter can be one of the following values:
  2961. * @arg @ref RCC_HSE_OFF Turn OFF the HSE oscillator, HSERDY flag goes low after
  2962. * 6 HSE oscillator clock cycles.
  2963. * @arg @ref RCC_HSE_ON Turn ON the HSE oscillator.
  2964. * @arg @ref RCC_HSE_BYPASS HSE oscillator bypassed with external clock.
  2965. * @retval None
  2966. */
  2967. #define __HAL_RCC_HSE_CONFIG(__STATE__) \
  2968. do { \
  2969. if((__STATE__) == RCC_HSE_ON) \
  2970. { \
  2971. SET_BIT(RCC->CR, RCC_CR_HSEON); \
  2972. } \
  2973. else if((__STATE__) == RCC_HSE_BYPASS) \
  2974. { \
  2975. SET_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2976. SET_BIT(RCC->CR, RCC_CR_HSEON); \
  2977. } \
  2978. else \
  2979. { \
  2980. CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
  2981. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2982. } \
  2983. } while(0)
  2984. /**
  2985. * @brief Macro to configure the External Low Speed oscillator (LSE).
  2986. * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not
  2987. * supported by this macro. User should request a transition to LSE Off
  2988. * first and then LSE On or LSE Bypass.
  2989. * @note As the LSE is in the Backup domain and write access is denied to
  2990. * this domain after reset, you have to enable write access using
  2991. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2992. * (to be done once after reset).
  2993. * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
  2994. * software should wait on LSERDY flag to be set indicating that LSE clock
  2995. * is stable and can be used to clock the RTC.
  2996. * @param __STATE__ specifies the new state of the LSE.
  2997. * This parameter can be one of the following values:
  2998. * @arg @ref RCC_LSE_OFF Turn OFF the LSE oscillator, LSERDY flag goes low after
  2999. * 6 LSE oscillator clock cycles.
  3000. * @arg @ref RCC_LSE_ON Turn ON the LSE oscillator.
  3001. * @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock.
  3002. * @retval None
  3003. */
  3004. #define __HAL_RCC_LSE_CONFIG(__STATE__) \
  3005. do { \
  3006. if((__STATE__) == RCC_LSE_ON) \
  3007. { \
  3008. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  3009. } \
  3010. else if((__STATE__) == RCC_LSE_BYPASS) \
  3011. { \
  3012. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  3013. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  3014. } \
  3015. else \
  3016. { \
  3017. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  3018. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  3019. } \
  3020. } while(0)
  3021. #if defined(RCC_HSI48_SUPPORT)
  3022. /** @brief Macros to enable or disable the Internal High Speed 48MHz oscillator (HSI48).
  3023. * @note The HSI48 is stopped by hardware when entering STOP and STANDBY modes.
  3024. * @note After enabling the HSI48, the application software should wait on HSI48RDY
  3025. * flag to be set indicating that HSI48 clock is stable.
  3026. * This parameter can be: ENABLE or DISABLE.
  3027. * @retval None
  3028. */
  3029. #define __HAL_RCC_HSI48_ENABLE() SET_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON)
  3030. #define __HAL_RCC_HSI48_DISABLE() CLEAR_BIT(RCC->CRRCR, RCC_CRRCR_HSI48ON)
  3031. #endif /* RCC_HSI48_SUPPORT */
  3032. /** @brief Macros to configure the RTC clock (RTCCLK).
  3033. * @note As the RTC clock configuration bits are in the Backup domain and write
  3034. * access is denied to this domain after reset, you have to enable write
  3035. * access using the Power Backup Access macro before to configure
  3036. * the RTC clock source (to be done once after reset).
  3037. * @note Once the RTC clock is configured it cannot be changed unless the
  3038. * Backup domain is reset using __HAL_RCC_BACKUPRESET_FORCE() macro, or by
  3039. * a Power On Reset (POR).
  3040. *
  3041. * @param __RTC_CLKSOURCE__ specifies the RTC clock source.
  3042. * This parameter can be one of the following values:
  3043. * @arg @ref RCC_RTCCLKSOURCE_NONE No clock selected as RTC clock.
  3044. * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock.
  3045. * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock.
  3046. * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32 selected
  3047. *
  3048. * @note If the LSE or LSI is used as RTC clock source, the RTC continues to
  3049. * work in STOP and STANDBY modes, and can be used as wakeup source.
  3050. * However, when the HSE clock is used as RTC clock source, the RTC
  3051. * cannot be used in STOP and STANDBY modes.
  3052. * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as
  3053. * RTC clock source).
  3054. * @retval None
  3055. */
  3056. #define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) \
  3057. MODIFY_REG( RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__))
  3058. /** @brief Macro to get the RTC clock source.
  3059. * @retval The returned value can be one of the following:
  3060. * @arg @ref RCC_RTCCLKSOURCE_NONE No clock selected as RTC clock.
  3061. * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock.
  3062. * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock.
  3063. * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32 selected
  3064. */
  3065. #define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL))
  3066. /** @brief Macros to enable or disable the main PLL.
  3067. * @note After enabling the main PLL, the application software should wait on
  3068. * PLLRDY flag to be set indicating that PLL clock is stable and can
  3069. * be used as system clock source.
  3070. * @note The main PLL can not be disabled if it is used as system clock source
  3071. * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes.
  3072. * @retval None
  3073. */
  3074. #define __HAL_RCC_PLL_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLON)
  3075. #define __HAL_RCC_PLL_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLON)
  3076. /** @brief Macro to configure the PLL clock source.
  3077. * @note This function must be used only when the main PLL is disabled.
  3078. * @param __PLLSOURCE__ specifies the PLL entry clock source.
  3079. * This parameter can be one of the following values:
  3080. * @arg @ref RCC_PLLSOURCE_NONE No clock selected as PLL clock entry
  3081. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator clock selected as PLL clock entry
  3082. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
  3083. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
  3084. * @note This clock source is common for the main PLL and audio PLL (PLLSAI1 and PLLSAI2).
  3085. * @retval None
  3086. *
  3087. */
  3088. #define __HAL_RCC_PLL_PLLSOURCE_CONFIG(__PLLSOURCE__) \
  3089. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
  3090. /** @brief Macro to configure the PLL source division factor M.
  3091. * @note This function must be used only when the main PLL is disabled.
  3092. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  3093. * This parameter must be a number between Min_Data = 1 and Max_Data = 16 on STM32L4Rx/STM32L4Sx devices.
  3094. * This parameter must be a number between Min_Data = 1 and Max_Data = 8 on other devices.
  3095. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  3096. * frequency ranges from 4 to 16 MHz. It is recommended to select a frequency
  3097. * of 16 MHz to limit PLL jitter.
  3098. * @retval None
  3099. *
  3100. */
  3101. #define __HAL_RCC_PLL_PLLM_CONFIG(__PLLM__) \
  3102. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, ((__PLLM__) - 1) << 4U)
  3103. /**
  3104. * @brief Macro to configure the main PLL clock source, multiplication and division factors.
  3105. * @note This function must be used only when the main PLL is disabled.
  3106. *
  3107. * @param __PLLSOURCE__ specifies the PLL entry clock source.
  3108. * This parameter can be one of the following values:
  3109. * @arg @ref RCC_PLLSOURCE_NONE No clock selected as PLL clock entry
  3110. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator clock selected as PLL clock entry
  3111. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
  3112. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
  3113. * @note This clock source is common for the main PLL and audio PLL (PLLSAI1 and PLLSAI2).
  3114. *
  3115. * @param __PLLM__ specifies the division factor for PLL VCO input clock.
  3116. * This parameter must be a number between Min_Data = 1 and Max_Data = 16 on STM32L4Rx/STM32L4Sx devices.
  3117. * This parameter must be a number between Min_Data = 1 and Max_Data = 8 on other devices.
  3118. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  3119. * frequency ranges from 4 to 16 MHz. It is recommended to select a frequency
  3120. * of 16 MHz to limit PLL jitter.
  3121. *
  3122. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock.
  3123. * This parameter must be a number between 8 and 86.
  3124. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  3125. * output frequency is between 64 and 344 MHz.
  3126. *
  3127. * @param __PLLP__ specifies the division factor for SAI clock.
  3128. * This parameter must be a number in the range (7 or 17) for STM32L47x/STM32L48x
  3129. * else (2 to 31).
  3130. *
  3131. * @param __PLLQ__ specifies the division factor for OTG FS, SDMMC1 and RNG clocks.
  3132. * This parameter must be in the range (2, 4, 6 or 8).
  3133. * @note If the USB OTG FS is used in your application, you have to set the
  3134. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  3135. * the SDMMC1 and RNG need a frequency lower than or equal to 48 MHz to work
  3136. * correctly.
  3137. * @param __PLLR__ specifies the division factor for the main system clock.
  3138. * @note You have to set the PLLR parameter correctly to not exceed 80MHZ.
  3139. * This parameter must be in the range (2, 4, 6 or 8).
  3140. * @retval None
  3141. */
  3142. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  3143. #define __HAL_RCC_PLL_CONFIG(__PLLSOURCE__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__ ) \
  3144. (RCC->PLLCFGR = (uint32_t)(((__PLLM__) - 1U) << 4U) | (uint32_t)((__PLLN__) << 8U) | \
  3145. (__PLLSOURCE__) | (uint32_t)((((__PLLQ__) >> 1U) - 1U) << 21U) | (uint32_t)((((__PLLR__) >> 1U) - 1U) << 25U) | \
  3146. ((uint32_t)(__PLLP__) << 27U))
  3147. #else
  3148. #define __HAL_RCC_PLL_CONFIG(__PLLSOURCE__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__ ) \
  3149. (RCC->PLLCFGR = (uint32_t)(((__PLLM__) - 1U) << 4U) | (uint32_t)((__PLLN__) << 8U) | \
  3150. (uint32_t)(((__PLLP__) >> 4U ) << 17U) | \
  3151. (__PLLSOURCE__) | (uint32_t)((((__PLLQ__) >> 1U) - 1U) << 21U) | (uint32_t)((((__PLLR__) >> 1U) - 1U) << 25U))
  3152. #endif /* RCC_PLLP_DIV_2_31_SUPPORT */
  3153. /** @brief Macro to get the oscillator used as PLL clock source.
  3154. * @retval The oscillator used as PLL clock source. The returned value can be one
  3155. * of the following:
  3156. * - RCC_PLLSOURCE_NONE: No oscillator is used as PLL clock source.
  3157. * - RCC_PLLSOURCE_MSI: MSI oscillator is used as PLL clock source.
  3158. * - RCC_PLLSOURCE_HSI: HSI oscillator is used as PLL clock source.
  3159. * - RCC_PLLSOURCE_HSE: HSE oscillator is used as PLL clock source.
  3160. */
  3161. #define __HAL_RCC_GET_PLL_OSCSOURCE() (READ_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC))
  3162. /**
  3163. * @brief Enable or disable each clock output (RCC_PLL_SYSCLK, RCC_PLL_48M1CLK, RCC_PLL_SAI3CLK)
  3164. * @note Enabling/disabling clock outputs RCC_PLL_SAI3CLK and RCC_PLL_48M1CLK can be done at anytime
  3165. * without the need to stop the PLL in order to save power. But RCC_PLL_SYSCLK cannot
  3166. * be stopped if used as System Clock.
  3167. * @param __PLLCLOCKOUT__ specifies the PLL clock to be output.
  3168. * This parameter can be one or a combination of the following values:
  3169. * @arg @ref RCC_PLL_SAI3CLK This clock is used to generate an accurate clock to achieve
  3170. * high-quality audio performance on SAI interface in case.
  3171. * @arg @ref RCC_PLL_48M1CLK This Clock is used to generate the clock for the USB OTG FS (48 MHz),
  3172. * the random analog generator (<=48 MHz) and the SDMMC1 (<= 48 MHz).
  3173. * @arg @ref RCC_PLL_SYSCLK This Clock is used to generate the high speed system clock (up to 80MHz)
  3174. * @retval None
  3175. */
  3176. #define __HAL_RCC_PLLCLKOUT_ENABLE(__PLLCLOCKOUT__) SET_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  3177. #define __HAL_RCC_PLLCLKOUT_DISABLE(__PLLCLOCKOUT__) CLEAR_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  3178. /**
  3179. * @brief Get clock output enable status (RCC_PLL_SYSCLK, RCC_PLL_48M1CLK, RCC_PLL_SAI3CLK)
  3180. * @param __PLLCLOCKOUT__ specifies the output PLL clock to be checked.
  3181. * This parameter can be one of the following values:
  3182. * @arg @ref RCC_PLL_SAI3CLK This clock is used to generate an accurate clock to achieve
  3183. * high-quality audio performance on SAI interface in case.
  3184. * @arg @ref RCC_PLL_48M1CLK This Clock is used to generate the clock for the USB OTG FS (48 MHz),
  3185. * the random analog generator (<=48 MHz) and the SDMMC1 (<= 48 MHz).
  3186. * @arg @ref RCC_PLL_SYSCLK This Clock is used to generate the high speed system clock (up to 80MHz)
  3187. * @retval SET / RESET
  3188. */
  3189. #define __HAL_RCC_GET_PLLCLKOUT_CONFIG(__PLLCLOCKOUT__) READ_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  3190. /**
  3191. * @brief Macro to configure the system clock source.
  3192. * @param __SYSCLKSOURCE__ specifies the system clock source.
  3193. * This parameter can be one of the following values:
  3194. * - RCC_SYSCLKSOURCE_MSI: MSI oscillator is used as system clock source.
  3195. * - RCC_SYSCLKSOURCE_HSI: HSI oscillator is used as system clock source.
  3196. * - RCC_SYSCLKSOURCE_HSE: HSE oscillator is used as system clock source.
  3197. * - RCC_SYSCLKSOURCE_PLLCLK: PLL output is used as system clock source.
  3198. * @retval None
  3199. */
  3200. #define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) \
  3201. MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__SYSCLKSOURCE__))
  3202. /** @brief Macro to get the clock source used as system clock.
  3203. * @retval The clock source used as system clock. The returned value can be one
  3204. * of the following:
  3205. * - RCC_SYSCLKSOURCE_STATUS_MSI: MSI used as system clock.
  3206. * - RCC_SYSCLKSOURCE_STATUS_HSI: HSI used as system clock.
  3207. * - RCC_SYSCLKSOURCE_STATUS_HSE: HSE used as system clock.
  3208. * - RCC_SYSCLKSOURCE_STATUS_PLLCLK: PLL used as system clock.
  3209. */
  3210. #define __HAL_RCC_GET_SYSCLK_SOURCE() (READ_BIT(RCC->CFGR, RCC_CFGR_SWS))
  3211. /**
  3212. * @brief Macro to configure the External Low Speed oscillator (LSE) drive capability.
  3213. * @note As the LSE is in the Backup domain and write access is denied to
  3214. * this domain after reset, you have to enable write access using
  3215. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  3216. * (to be done once after reset).
  3217. * @param __LSEDRIVE__ specifies the new state of the LSE drive capability.
  3218. * This parameter can be one of the following values:
  3219. * @arg @ref RCC_LSEDRIVE_LOW LSE oscillator low drive capability.
  3220. * @arg @ref RCC_LSEDRIVE_MEDIUMLOW LSE oscillator medium low drive capability.
  3221. * @arg @ref RCC_LSEDRIVE_MEDIUMHIGH LSE oscillator medium high drive capability.
  3222. * @arg @ref RCC_LSEDRIVE_HIGH LSE oscillator high drive capability.
  3223. * @retval None
  3224. */
  3225. #define __HAL_RCC_LSEDRIVE_CONFIG(__LSEDRIVE__) \
  3226. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, (__LSEDRIVE__))
  3227. /**
  3228. * @brief Macro to configure the wake up from stop clock.
  3229. * @param __STOPWUCLK__ specifies the clock source used after wake up from stop.
  3230. * This parameter can be one of the following values:
  3231. * @arg @ref RCC_STOP_WAKEUPCLOCK_MSI MSI selected as system clock source
  3232. * @arg @ref RCC_STOP_WAKEUPCLOCK_HSI HSI selected as system clock source
  3233. * @retval None
  3234. */
  3235. #define __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(__STOPWUCLK__) \
  3236. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPWUCK, (__STOPWUCLK__))
  3237. /** @brief Macro to configure the MCO clock.
  3238. * @param __MCOCLKSOURCE__ specifies the MCO clock source.
  3239. * This parameter can be one of the following values:
  3240. * @arg @ref RCC_MCO1SOURCE_NOCLOCK MCO output disabled
  3241. * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock selected as MCO source
  3242. * @arg @ref RCC_MCO1SOURCE_MSI MSI clock selected as MCO source
  3243. * @arg @ref RCC_MCO1SOURCE_HSI HSI clock selected as MCO source
  3244. * @arg @ref RCC_MCO1SOURCE_HSE HSE clock selected as MCO sourcee
  3245. * @arg @ref RCC_MCO1SOURCE_PLLCLK Main PLL clock selected as MCO source
  3246. * @arg @ref RCC_MCO1SOURCE_LSI LSI clock selected as MCO source
  3247. * @arg @ref RCC_MCO1SOURCE_LSE LSE clock selected as MCO source
  3248. @if STM32L443xx
  3249. * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 clock selected as MCO source for devices with HSI48
  3250. @endif
  3251. @if STM32L4A6xx
  3252. * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 clock selected as MCO source for devices with HSI48
  3253. @endif
  3254. * @param __MCODIV__ specifies the MCO clock prescaler.
  3255. * This parameter can be one of the following values:
  3256. * @arg @ref RCC_MCODIV_1 MCO clock source is divided by 1
  3257. * @arg @ref RCC_MCODIV_2 MCO clock source is divided by 2
  3258. * @arg @ref RCC_MCODIV_4 MCO clock source is divided by 4
  3259. * @arg @ref RCC_MCODIV_8 MCO clock source is divided by 8
  3260. * @arg @ref RCC_MCODIV_16 MCO clock source is divided by 16
  3261. */
  3262. #define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \
  3263. MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE), ((__MCOCLKSOURCE__) | (__MCODIV__)))
  3264. /** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management
  3265. * @brief macros to manage the specified RCC Flags and interrupts.
  3266. * @{
  3267. */
  3268. /** @brief Enable RCC interrupt(s).
  3269. * @param __INTERRUPT__ specifies the RCC interrupt source(s) to be enabled.
  3270. * This parameter can be any combination of the following values:
  3271. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3272. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3273. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt
  3274. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3275. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3276. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3277. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3278. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3279. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3280. @if STM32L443xx
  3281. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3282. @endif
  3283. @if STM32L4A6xx
  3284. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3285. @endif
  3286. * @retval None
  3287. */
  3288. #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) SET_BIT(RCC->CIER, (__INTERRUPT__))
  3289. /** @brief Disable RCC interrupt(s).
  3290. * @param __INTERRUPT__ specifies the RCC interrupt source(s) to be disabled.
  3291. * This parameter can be any combination of the following values:
  3292. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3293. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3294. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt
  3295. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3296. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3297. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3298. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3299. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3300. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3301. @if STM32L443xx
  3302. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3303. @endif
  3304. @if STM32L4A6xx
  3305. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3306. @endif
  3307. * @retval None
  3308. */
  3309. #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(RCC->CIER, (__INTERRUPT__))
  3310. /** @brief Clear the RCC's interrupt pending bits.
  3311. * @param __INTERRUPT__ specifies the interrupt pending bit to clear.
  3312. * This parameter can be any combination of the following values:
  3313. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3314. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3315. * @arg @ref RCC_IT_MSIRDY MSI ready interrupt
  3316. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3317. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3318. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3319. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3320. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3321. * @arg @ref RCC_IT_CSS HSE Clock security system interrupt
  3322. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3323. @if STM32L443xx
  3324. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3325. @endif
  3326. @if STM32L4A6xx
  3327. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3328. @endif
  3329. * @retval None
  3330. */
  3331. #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) WRITE_REG(RCC->CICR, (__INTERRUPT__))
  3332. /** @brief Check whether the RCC interrupt has occurred or not.
  3333. * @param __INTERRUPT__ specifies the RCC interrupt source to check.
  3334. * This parameter can be one of the following values:
  3335. * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
  3336. * @arg @ref RCC_IT_LSERDY LSE ready interrupt
  3337. * @arg @ref RCC_IT_MSIRDY MSI ready interrupt
  3338. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
  3339. * @arg @ref RCC_IT_HSERDY HSE ready interrupt
  3340. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt
  3341. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt
  3342. * @arg @ref RCC_IT_PLLSAI2RDY PLLSAI2 ready interrupt for devices with PLLSAI2
  3343. * @arg @ref RCC_IT_CSS HSE Clock security system interrupt
  3344. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt
  3345. @if STM32L443xx
  3346. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3347. @endif
  3348. @if STM32L4A6xx
  3349. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt for devices with HSI48
  3350. @endif
  3351. * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
  3352. */
  3353. #define __HAL_RCC_GET_IT(__INTERRUPT__) (READ_BIT(RCC->CIFR, (__INTERRUPT__)) == (__INTERRUPT__))
  3354. /** @brief Set RMVF bit to clear the reset flags.
  3355. * The reset flags are: RCC_FLAG_FWRRST, RCC_FLAG_OBLRST, RCC_FLAG_PINRST, RCC_FLAG_BORRST,
  3356. * RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST and RCC_FLAG_LPWRRST.
  3357. * @retval None
  3358. */
  3359. #define __HAL_RCC_CLEAR_RESET_FLAGS() SET_BIT(RCC->CSR, RCC_CSR_RMVF)
  3360. /** @brief Check whether the selected RCC flag is set or not.
  3361. * @param __FLAG__ specifies the flag to check.
  3362. * This parameter can be one of the following values:
  3363. * @arg @ref RCC_FLAG_MSIRDY MSI oscillator clock ready
  3364. * @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready
  3365. * @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready
  3366. * @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready
  3367. * @arg @ref RCC_FLAG_PLLSAI1RDY PLLSAI1 clock ready
  3368. * @arg @ref RCC_FLAG_PLLSAI2RDY PLLSAI2 clock ready for devices with PLLSAI2
  3369. @if STM32L443xx
  3370. * @arg @ref RCC_FLAG_HSI48RDY HSI48 clock ready for devices with HSI48
  3371. @endif
  3372. @if STM32L4A6xx
  3373. * @arg @ref RCC_FLAG_HSI48RDY HSI48 clock ready for devices with HSI48
  3374. @endif
  3375. * @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready
  3376. * @arg @ref RCC_FLAG_LSECSSD Clock security system failure on LSE oscillator detection
  3377. * @arg @ref RCC_FLAG_LSIRDY LSI oscillator clock ready
  3378. * @arg @ref RCC_FLAG_BORRST BOR reset
  3379. * @arg @ref RCC_FLAG_OBLRST OBLRST reset
  3380. * @arg @ref RCC_FLAG_PINRST Pin reset
  3381. * @arg @ref RCC_FLAG_FWRST FIREWALL reset
  3382. * @arg @ref RCC_FLAG_RMVF Remove reset Flag
  3383. * @arg @ref RCC_FLAG_SFTRST Software reset
  3384. * @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset
  3385. * @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset
  3386. * @arg @ref RCC_FLAG_LPWRRST Low Power reset
  3387. * @retval The new state of __FLAG__ (TRUE or FALSE).
  3388. */
  3389. #if defined(RCC_HSI48_SUPPORT)
  3390. #define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5U) == 1U) ? RCC->CR : \
  3391. ((((__FLAG__) >> 5U) == 4U) ? RCC->CRRCR : \
  3392. ((((__FLAG__) >> 5U) == 2U) ? RCC->BDCR : \
  3393. ((((__FLAG__) >> 5U) == 3U) ? RCC->CSR : RCC->CIFR)))) & \
  3394. (1U << ((__FLAG__) & RCC_FLAG_MASK))) != RESET) ? 1U : 0U)
  3395. #else
  3396. #define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5U) == 1U) ? RCC->CR : \
  3397. ((((__FLAG__) >> 5U) == 2U) ? RCC->BDCR : \
  3398. ((((__FLAG__) >> 5U) == 3U) ? RCC->CSR : RCC->CIFR))) & \
  3399. (1U << ((__FLAG__) & RCC_FLAG_MASK))) != RESET) ? 1U : 0U)
  3400. #endif /* RCC_HSI48_SUPPORT */
  3401. /**
  3402. * @}
  3403. */
  3404. /**
  3405. * @}
  3406. */
  3407. /* Private constants ---------------------------------------------------------*/
  3408. /** @defgroup RCC_Private_Constants RCC Private Constants
  3409. * @{
  3410. */
  3411. /* Defines used for Flags */
  3412. #define CR_REG_INDEX 1U
  3413. #define BDCR_REG_INDEX 2U
  3414. #define CSR_REG_INDEX 3U
  3415. #if defined(RCC_HSI48_SUPPORT)
  3416. #define CRRCR_REG_INDEX 4U
  3417. #endif /* RCC_HSI48_SUPPORT */
  3418. #define RCC_FLAG_MASK 0x1FU
  3419. /**
  3420. * @}
  3421. */
  3422. /* Private macros ------------------------------------------------------------*/
  3423. /** @addtogroup RCC_Private_Macros
  3424. * @{
  3425. */
  3426. #if defined(RCC_HSI48_SUPPORT)
  3427. #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
  3428. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  3429. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  3430. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI48) == RCC_OSCILLATORTYPE_HSI48) || \
  3431. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_MSI) == RCC_OSCILLATORTYPE_MSI) || \
  3432. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \
  3433. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
  3434. #else
  3435. #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
  3436. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  3437. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  3438. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_MSI) == RCC_OSCILLATORTYPE_MSI) || \
  3439. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \
  3440. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
  3441. #endif /* RCC_HSI48_SUPPORT */
  3442. #define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \
  3443. ((__HSE__) == RCC_HSE_BYPASS))
  3444. #define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
  3445. ((__LSE__) == RCC_LSE_BYPASS))
  3446. #define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
  3447. #define IS_RCC_HSI_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= (RCC_ICSCR_HSITRIM >> RCC_ICSCR_HSITRIM_Pos))
  3448. #define IS_RCC_LSI(__LSI__) (((__LSI__) == RCC_LSI_OFF) || ((__LSI__) == RCC_LSI_ON))
  3449. #define IS_RCC_MSI(__MSI__) (((__MSI__) == RCC_MSI_OFF) || ((__MSI__) == RCC_MSI_ON))
  3450. #define IS_RCC_MSICALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 255U)
  3451. #if defined(RCC_HSI48_SUPPORT)
  3452. #define IS_RCC_HSI48(__HSI48__) (((__HSI48__) == RCC_HSI48_OFF) || ((__HSI48__) == RCC_HSI48_ON))
  3453. #endif /* RCC_HSI48_SUPPORT */
  3454. #define IS_RCC_PLL(__PLL__) (((__PLL__) == RCC_PLL_NONE) ||((__PLL__) == RCC_PLL_OFF) || \
  3455. ((__PLL__) == RCC_PLL_ON))
  3456. #define IS_RCC_PLLSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLSOURCE_NONE) || \
  3457. ((__SOURCE__) == RCC_PLLSOURCE_MSI) || \
  3458. ((__SOURCE__) == RCC_PLLSOURCE_HSI) || \
  3459. ((__SOURCE__) == RCC_PLLSOURCE_HSE))
  3460. #if defined(RCC_PLLM_DIV_1_16_SUPPORT)
  3461. #define IS_RCC_PLLM_VALUE(__VALUE__) ((1U <= (__VALUE__)) && ((__VALUE__) <= 16U))
  3462. #else
  3463. #define IS_RCC_PLLM_VALUE(__VALUE__) ((1U <= (__VALUE__)) && ((__VALUE__) <= 8U))
  3464. #endif /*RCC_PLLM_DIV_1_16_SUPPORT */
  3465. #define IS_RCC_PLLN_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U))
  3466. #if defined(RCC_PLLP_DIV_2_31_SUPPORT)
  3467. #define IS_RCC_PLLP_VALUE(__VALUE__) (((__VALUE__) >= 2U) && ((__VALUE__) <= 31U))
  3468. #else
  3469. #define IS_RCC_PLLP_VALUE(__VALUE__) (((__VALUE__) == 7U) || ((__VALUE__) == 17U))
  3470. #endif /*RCC_PLLP_DIV_2_31_SUPPORT */
  3471. #define IS_RCC_PLLQ_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  3472. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  3473. #define IS_RCC_PLLR_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  3474. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  3475. #define IS_RCC_PLLSAI1CLOCKOUT_VALUE(__VALUE__) (((((__VALUE__) & RCC_PLLSAI1_SAI1CLK) == RCC_PLLSAI1_SAI1CLK) || \
  3476. (((__VALUE__) & RCC_PLLSAI1_48M2CLK) == RCC_PLLSAI1_48M2CLK) || \
  3477. (((__VALUE__) & RCC_PLLSAI1_ADC1CLK) == RCC_PLLSAI1_ADC1CLK)) && \
  3478. (((__VALUE__) & ~(RCC_PLLSAI1_SAI1CLK|RCC_PLLSAI1_48M2CLK|RCC_PLLSAI1_ADC1CLK)) == 0U))
  3479. #if defined(RCC_PLLSAI2_SUPPORT)
  3480. #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || defined(STM32L496xx) || defined(STM32L4A6xx)
  3481. #define IS_RCC_PLLSAI2CLOCKOUT_VALUE(__VALUE__) (((((__VALUE__) & RCC_PLLSAI2_SAI2CLK) == RCC_PLLSAI2_SAI2CLK) || \
  3482. (((__VALUE__) & RCC_PLLSAI2_ADC2CLK) == RCC_PLLSAI2_ADC2CLK)) && \
  3483. (((__VALUE__) & ~(RCC_PLLSAI2_SAI2CLK|RCC_PLLSAI2_ADC2CLK)) == 0U))
  3484. #elif defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
  3485. #define IS_RCC_PLLSAI2CLOCKOUT_VALUE(__VALUE__) (((((__VALUE__) & RCC_PLLSAI2_SAI2CLK) == RCC_PLLSAI2_SAI2CLK) || \
  3486. (((__VALUE__) & RCC_PLLSAI2_DSICLK) == RCC_PLLSAI2_DSICLK) || \
  3487. (((__VALUE__) & RCC_PLLSAI2_LTDCCLK) == RCC_PLLSAI2_LTDCCLK)) && \
  3488. (((__VALUE__) & ~(RCC_PLLSAI2_SAI2CLK|RCC_PLLSAI2_DSICLK|RCC_PLLSAI2_LTDCCLK)) == 0U))
  3489. #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || STM32L496xx || STM32L4A6xx */
  3490. #endif /* RCC_PLLSAI2_SUPPORT */
  3491. #define IS_RCC_MSI_CLOCK_RANGE(__RANGE__) (((__RANGE__) == RCC_MSIRANGE_0) || \
  3492. ((__RANGE__) == RCC_MSIRANGE_1) || \
  3493. ((__RANGE__) == RCC_MSIRANGE_2) || \
  3494. ((__RANGE__) == RCC_MSIRANGE_3) || \
  3495. ((__RANGE__) == RCC_MSIRANGE_4) || \
  3496. ((__RANGE__) == RCC_MSIRANGE_5) || \
  3497. ((__RANGE__) == RCC_MSIRANGE_6) || \
  3498. ((__RANGE__) == RCC_MSIRANGE_7) || \
  3499. ((__RANGE__) == RCC_MSIRANGE_8) || \
  3500. ((__RANGE__) == RCC_MSIRANGE_9) || \
  3501. ((__RANGE__) == RCC_MSIRANGE_10) || \
  3502. ((__RANGE__) == RCC_MSIRANGE_11))
  3503. #define IS_RCC_MSI_STANDBY_CLOCK_RANGE(__RANGE__) (((__RANGE__) == RCC_MSIRANGE_4) || \
  3504. ((__RANGE__) == RCC_MSIRANGE_5) || \
  3505. ((__RANGE__) == RCC_MSIRANGE_6) || \
  3506. ((__RANGE__) == RCC_MSIRANGE_7))
  3507. #define IS_RCC_CLOCKTYPE(__CLK__) ((1U <= (__CLK__)) && ((__CLK__) <= 15U))
  3508. #define IS_RCC_SYSCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_MSI) || \
  3509. ((__SOURCE__) == RCC_SYSCLKSOURCE_HSI) || \
  3510. ((__SOURCE__) == RCC_SYSCLKSOURCE_HSE) || \
  3511. ((__SOURCE__) == RCC_SYSCLKSOURCE_PLLCLK))
  3512. #define IS_RCC_HCLK(__HCLK__) (((__HCLK__) == RCC_SYSCLK_DIV1) || ((__HCLK__) == RCC_SYSCLK_DIV2) || \
  3513. ((__HCLK__) == RCC_SYSCLK_DIV4) || ((__HCLK__) == RCC_SYSCLK_DIV8) || \
  3514. ((__HCLK__) == RCC_SYSCLK_DIV16) || ((__HCLK__) == RCC_SYSCLK_DIV64) || \
  3515. ((__HCLK__) == RCC_SYSCLK_DIV128) || ((__HCLK__) == RCC_SYSCLK_DIV256) || \
  3516. ((__HCLK__) == RCC_SYSCLK_DIV512))
  3517. #define IS_RCC_PCLK(__PCLK__) (((__PCLK__) == RCC_HCLK_DIV1) || ((__PCLK__) == RCC_HCLK_DIV2) || \
  3518. ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
  3519. ((__PCLK__) == RCC_HCLK_DIV16))
  3520. #define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NONE) || \
  3521. ((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \
  3522. ((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \
  3523. ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV32))
  3524. #define IS_RCC_MCO(__MCOX__) ((__MCOX__) == RCC_MCO1)
  3525. #if defined(RCC_HSI48_SUPPORT)
  3526. #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK) || \
  3527. ((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || \
  3528. ((__SOURCE__) == RCC_MCO1SOURCE_MSI) || \
  3529. ((__SOURCE__) == RCC_MCO1SOURCE_HSI) || \
  3530. ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || \
  3531. ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || \
  3532. ((__SOURCE__) == RCC_MCO1SOURCE_LSI) || \
  3533. ((__SOURCE__) == RCC_MCO1SOURCE_LSE) || \
  3534. ((__SOURCE__) == RCC_MCO1SOURCE_HSI48))
  3535. #else
  3536. #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK) || \
  3537. ((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || \
  3538. ((__SOURCE__) == RCC_MCO1SOURCE_MSI) || \
  3539. ((__SOURCE__) == RCC_MCO1SOURCE_HSI) || \
  3540. ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || \
  3541. ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || \
  3542. ((__SOURCE__) == RCC_MCO1SOURCE_LSI) || \
  3543. ((__SOURCE__) == RCC_MCO1SOURCE_LSE))
  3544. #endif /* RCC_HSI48_SUPPORT */
  3545. #define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1) || ((__DIV__) == RCC_MCODIV_2) || \
  3546. ((__DIV__) == RCC_MCODIV_4) || ((__DIV__) == RCC_MCODIV_8) || \
  3547. ((__DIV__) == RCC_MCODIV_16))
  3548. #define IS_RCC_LSE_DRIVE(__DRIVE__) (((__DRIVE__) == RCC_LSEDRIVE_LOW) || \
  3549. ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMLOW) || \
  3550. ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMHIGH) || \
  3551. ((__DRIVE__) == RCC_LSEDRIVE_HIGH))
  3552. #define IS_RCC_STOP_WAKEUPCLOCK(__SOURCE__) (((__SOURCE__) == RCC_STOP_WAKEUPCLOCK_MSI) || \
  3553. ((__SOURCE__) == RCC_STOP_WAKEUPCLOCK_HSI))
  3554. /**
  3555. * @}
  3556. */
  3557. /* Include RCC HAL Extended module */
  3558. #include "stm32l4xx_hal_rcc_ex.h"
  3559. /* Exported functions --------------------------------------------------------*/
  3560. /** @addtogroup RCC_Exported_Functions
  3561. * @{
  3562. */
  3563. /** @addtogroup RCC_Exported_Functions_Group1
  3564. * @{
  3565. */
  3566. /* Initialization and de-initialization functions ******************************/
  3567. HAL_StatusTypeDef HAL_RCC_DeInit(void);
  3568. HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  3569. HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency);
  3570. /**
  3571. * @}
  3572. */
  3573. /** @addtogroup RCC_Exported_Functions_Group2
  3574. * @{
  3575. */
  3576. /* Peripheral Control functions ************************************************/
  3577. void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
  3578. void HAL_RCC_EnableCSS(void);
  3579. uint32_t HAL_RCC_GetSysClockFreq(void);
  3580. uint32_t HAL_RCC_GetHCLKFreq(void);
  3581. uint32_t HAL_RCC_GetPCLK1Freq(void);
  3582. uint32_t HAL_RCC_GetPCLK2Freq(void);
  3583. void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  3584. void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency);
  3585. /* CSS NMI IRQ handler */
  3586. void HAL_RCC_NMI_IRQHandler(void);
  3587. /* User Callbacks in non blocking mode (IT mode) */
  3588. void HAL_RCC_CSSCallback(void);
  3589. /**
  3590. * @}
  3591. */
  3592. /**
  3593. * @}
  3594. */
  3595. /**
  3596. * @}
  3597. */
  3598. /**
  3599. * @}
  3600. */
  3601. #ifdef __cplusplus
  3602. }
  3603. #endif
  3604. #endif /* __STM32L4xx_HAL_RCC_H */
  3605. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/