stm32f4xx_hal_rcc_ex.h 431 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_rcc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC HAL Extension 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 __STM32F4xx_HAL_RCC_EX_H
  37. #define __STM32F4xx_HAL_RCC_EX_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f4xx.h"
  43. #include "stm32f4xx_hal_def.h"
  44. /** @addtogroup STM32F4xx_HAL_Driver
  45. * @{
  46. */
  47. /** @addtogroup RCCEx
  48. * @{
  49. */
  50. /* Exported types ------------------------------------------------------------*/
  51. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  52. * @{
  53. */
  54. /**
  55. * @brief RCC PLL configuration structure definition
  56. */
  57. typedef struct
  58. {
  59. uint32_t PLLState; /*!< The new state of the PLL.
  60. This parameter can be a value of @ref RCC_PLL_Config */
  61. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  62. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  63. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  64. This parameter must be a number between Min_Data = 0 and Max_Data = 63 */
  65. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  66. This parameter must be a number between Min_Data = 50 and Max_Data = 432
  67. except for STM32F411xE devices where the Min_Data = 192 */
  68. uint32_t PLLP; /*!< PLLP: Division factor for main system clock (SYSCLK).
  69. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  70. uint32_t PLLQ; /*!< PLLQ: Division factor for OTG FS, SDIO and RNG clocks.
  71. This parameter must be a number between Min_Data = 2 and Max_Data = 15 */
  72. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  73. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  74. defined(STM32F413xx) || defined(STM32F423xx)
  75. uint32_t PLLR; /*!< PLLR: PLL division factor for I2S, SAI, SYSTEM, SPDIFRX clocks.
  76. This parameter is only available in STM32F410xx/STM32F446xx/STM32F469xx/STM32F479xx
  77. and STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F413xx/STM32F423xx devices.
  78. This parameter must be a number between Min_Data = 2 and Max_Data = 7 */
  79. #endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  80. }RCC_PLLInitTypeDef;
  81. #if defined(STM32F446xx)
  82. /**
  83. * @brief PLLI2S Clock structure definition
  84. */
  85. typedef struct
  86. {
  87. uint32_t PLLI2SM; /*!< Specifies division factor for PLL VCO input clock.
  88. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  89. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  90. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  91. uint32_t PLLI2SP; /*!< Specifies division factor for SPDIFRX Clock.
  92. This parameter must be a value of @ref RCCEx_PLLI2SP_Clock_Divider */
  93. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI clock.
  94. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  95. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  96. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  97. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  98. This parameter will be used only when PLLI2S is selected as Clock Source I2S */
  99. }RCC_PLLI2SInitTypeDef;
  100. /**
  101. * @brief PLLSAI Clock structure definition
  102. */
  103. typedef struct
  104. {
  105. uint32_t PLLSAIM; /*!< Spcifies division factor for PLL VCO input clock.
  106. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  107. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  108. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  109. uint32_t PLLSAIP; /*!< Specifies division factor for OTG FS, SDIO and RNG clocks.
  110. This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider */
  111. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI clock.
  112. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  113. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  114. }RCC_PLLSAIInitTypeDef;
  115. /**
  116. * @brief RCC extended clocks structure definition
  117. */
  118. typedef struct
  119. {
  120. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  121. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  122. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  123. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  124. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  125. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  126. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  127. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  128. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  129. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  130. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  131. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  132. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 Clock Source Selection.
  133. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  134. uint32_t Sai2ClockSelection; /*!< Specifies SAI2 Clock Source Selection.
  135. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */
  136. uint32_t I2sApb1ClockSelection; /*!< Specifies I2S APB1 Clock Source Selection.
  137. This parameter can be a value of @ref RCCEx_I2SAPB1_Clock_Source */
  138. uint32_t I2sApb2ClockSelection; /*!< Specifies I2S APB2 Clock Source Selection.
  139. This parameter can be a value of @ref RCCEx_I2SAPB2_Clock_Source */
  140. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection.
  141. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  142. uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection.
  143. This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */
  144. uint32_t CecClockSelection; /*!< Specifies CEC Clock Source Selection.
  145. This parameter can be a value of @ref RCCEx_CEC_Clock_Source */
  146. uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection.
  147. This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */
  148. uint32_t SpdifClockSelection; /*!< Specifies SPDIFRX Clock Source Selection.
  149. This parameter can be a value of @ref RCCEx_SPDIFRX_Clock_Source */
  150. uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks.
  151. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  152. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  153. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  154. }RCC_PeriphCLKInitTypeDef;
  155. #endif /* STM32F446xx */
  156. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  157. /**
  158. * @brief RCC extended clocks structure definition
  159. */
  160. typedef struct
  161. {
  162. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  163. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  164. uint32_t I2SClockSelection; /*!< Specifies RTC Clock Source Selection.
  165. This parameter can be a value of @ref RCCEx_I2S_APB_Clock_Source */
  166. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection.
  167. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  168. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 Clock Source Selection.
  169. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  170. uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection.
  171. This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */
  172. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  173. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  174. }RCC_PeriphCLKInitTypeDef;
  175. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  176. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  177. /**
  178. * @brief PLLI2S Clock structure definition
  179. */
  180. typedef struct
  181. {
  182. uint32_t PLLI2SM; /*!< Specifies division factor for PLL VCO input clock.
  183. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  184. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  185. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  186. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI clock.
  187. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  188. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  189. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  190. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  191. This parameter will be used only when PLLI2S is selected as Clock Source I2S */
  192. }RCC_PLLI2SInitTypeDef;
  193. /**
  194. * @brief RCC extended clocks structure definition
  195. */
  196. typedef struct
  197. {
  198. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  199. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  200. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  201. This parameter will be used only when PLLI2S is selected as Clock Source I2S */
  202. #if defined(STM32F413xx) || defined(STM32F423xx)
  203. uint32_t PLLDivR; /*!< Specifies the PLL division factor for SAI1 clock.
  204. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  205. This parameter will be used only when PLL is selected as Clock Source SAI */
  206. uint32_t PLLI2SDivR; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  207. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  208. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  209. #endif /* STM32F413xx || STM32F423xx */
  210. uint32_t I2sApb1ClockSelection; /*!< Specifies I2S APB1 Clock Source Selection.
  211. This parameter can be a value of @ref RCCEx_I2SAPB1_Clock_Source */
  212. uint32_t I2sApb2ClockSelection; /*!< Specifies I2S APB2 Clock Source Selection.
  213. This parameter can be a value of @ref RCCEx_I2SAPB2_Clock_Source */
  214. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Source Selection.
  215. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  216. uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection.
  217. This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */
  218. uint32_t Fmpi2c1ClockSelection; /*!< Specifies FMPI2C1 Clock Source Selection.
  219. This parameter can be a value of @ref RCCEx_FMPI2C1_Clock_Source */
  220. uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks.
  221. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  222. uint32_t Dfsdm1ClockSelection; /*!< Specifies DFSDM1 Clock Selection.
  223. This parameter can be a value of @ref RCCEx_DFSDM1_Kernel_Clock_Source */
  224. uint32_t Dfsdm1AudioClockSelection;/*!< Specifies DFSDM1 Audio Clock Selection.
  225. This parameter can be a value of @ref RCCEx_DFSDM1_Audio_Clock_Source */
  226. #if defined(STM32F413xx) || defined(STM32F423xx)
  227. uint32_t Dfsdm2ClockSelection; /*!< Specifies DFSDM2 Clock Selection.
  228. This parameter can be a value of @ref RCCEx_DFSDM2_Kernel_Clock_Source */
  229. uint32_t Dfsdm2AudioClockSelection;/*!< Specifies DFSDM2 Audio Clock Selection.
  230. This parameter can be a value of @ref RCCEx_DFSDM2_Audio_Clock_Source */
  231. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 Clock Source Selection.
  232. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  233. uint32_t SaiAClockSelection; /*!< Specifies SAI1_A Clock Prescalers Selection
  234. This parameter can be a value of @ref RCCEx_SAI1_BlockA_Clock_Source */
  235. uint32_t SaiBClockSelection; /*!< Specifies SAI1_B Clock Prescalers Selection
  236. This parameter can be a value of @ref RCCEx_SAI1_BlockB_Clock_Source */
  237. #endif /* STM32F413xx || STM32F423xx */
  238. uint32_t PLLI2SSelection; /*!< Specifies PLL I2S Clock Source Selection.
  239. This parameter can be a value of @ref RCCEx_PLL_I2S_Clock_Source */
  240. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  241. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  242. }RCC_PeriphCLKInitTypeDef;
  243. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  244. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  245. /**
  246. * @brief PLLI2S Clock structure definition
  247. */
  248. typedef struct
  249. {
  250. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  251. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  252. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  253. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  254. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  255. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  256. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI1 clock.
  257. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  258. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  259. }RCC_PLLI2SInitTypeDef;
  260. /**
  261. * @brief PLLSAI Clock structure definition
  262. */
  263. typedef struct
  264. {
  265. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  266. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  267. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  268. #if defined(STM32F469xx) || defined(STM32F479xx)
  269. uint32_t PLLSAIP; /*!< Specifies division factor for OTG FS and SDIO clocks.
  270. This parameter is only available in STM32F469xx/STM32F479xx devices.
  271. This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider */
  272. #endif /* STM32F469xx || STM32F479xx */
  273. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI1 clock.
  274. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  275. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  276. uint32_t PLLSAIR; /*!< specifies the division factor for LTDC clock
  277. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  278. This parameter will be used only when PLLSAI is selected as Clock Source LTDC */
  279. }RCC_PLLSAIInitTypeDef;
  280. /**
  281. * @brief RCC extended clocks structure definition
  282. */
  283. typedef struct
  284. {
  285. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  286. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  287. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  288. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  289. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  290. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  291. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  292. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  293. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  294. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  295. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  296. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  297. uint32_t PLLSAIDivR; /*!< Specifies the PLLSAI division factor for LTDC clock.
  298. This parameter must be one value of @ref RCCEx_PLLSAI_DIVR */
  299. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection.
  300. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  301. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection.
  302. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  303. #if defined(STM32F469xx) || defined(STM32F479xx)
  304. uint32_t Clk48ClockSelection; /*!< Specifies CLK48 Clock Selection this clock used OTG FS, SDIO and RNG clocks.
  305. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  306. uint32_t SdioClockSelection; /*!< Specifies SDIO Clock Source Selection.
  307. This parameter can be a value of @ref RCCEx_SDIO_Clock_Source */
  308. #endif /* STM32F469xx || STM32F479xx */
  309. }RCC_PeriphCLKInitTypeDef;
  310. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  311. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
  312. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  313. /**
  314. * @brief PLLI2S Clock structure definition
  315. */
  316. typedef struct
  317. {
  318. #if defined(STM32F411xE)
  319. uint32_t PLLI2SM; /*!< PLLM: Division factor for PLLI2S VCO input clock.
  320. This parameter must be a number between Min_Data = 2 and Max_Data = 62 */
  321. #endif /* STM32F411xE */
  322. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  323. This parameter must be a number between Min_Data = 50 and Max_Data = 432
  324. Except for STM32F411xE devices where the Min_Data = 192.
  325. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  326. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  327. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  328. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  329. }RCC_PLLI2SInitTypeDef;
  330. /**
  331. * @brief RCC extended clocks structure definition
  332. */
  333. typedef struct
  334. {
  335. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  336. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  337. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  338. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  339. uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection.
  340. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  341. #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  342. uint8_t TIMPresSelection; /*!< Specifies TIM Clock Source Selection.
  343. This parameter can be a value of @ref RCCEx_TIM_PRescaler_Selection */
  344. #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
  345. }RCC_PeriphCLKInitTypeDef;
  346. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
  347. /**
  348. * @}
  349. */
  350. /* Exported constants --------------------------------------------------------*/
  351. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  352. * @{
  353. */
  354. /** @defgroup RCCEx_Periph_Clock_Selection RCC Periph Clock Selection
  355. * @{
  356. */
  357. /* Peripheral Clock source for STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx */
  358. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  359. defined(STM32F413xx) || defined(STM32F423xx)
  360. #define RCC_PERIPHCLK_I2S_APB1 0x00000001U
  361. #define RCC_PERIPHCLK_I2S_APB2 0x00000002U
  362. #define RCC_PERIPHCLK_TIM 0x00000004U
  363. #define RCC_PERIPHCLK_RTC 0x00000008U
  364. #define RCC_PERIPHCLK_FMPI2C1 0x00000010U
  365. #define RCC_PERIPHCLK_CLK48 0x00000020U
  366. #define RCC_PERIPHCLK_SDIO 0x00000040U
  367. #define RCC_PERIPHCLK_PLLI2S 0x00000080U
  368. #define RCC_PERIPHCLK_DFSDM1 0x00000100U
  369. #define RCC_PERIPHCLK_DFSDM1_AUDIO 0x00000200U
  370. #endif /* STM32F412Zx || STM32F412Vx) || STM32F412Rx || STM32F412Cx */
  371. #if defined(STM32F413xx) || defined(STM32F423xx)
  372. #define RCC_PERIPHCLK_DFSDM2 0x00000400U
  373. #define RCC_PERIPHCLK_DFSDM2_AUDIO 0x00000800U
  374. #define RCC_PERIPHCLK_LPTIM1 0x00001000U
  375. #define RCC_PERIPHCLK_SAIA 0x00002000U
  376. #define RCC_PERIPHCLK_SAIB 0x00004000U
  377. #endif /* STM32F413xx || STM32F423xx */
  378. /*----------------------------------------------------------------------------*/
  379. /*------------------- Peripheral Clock source for STM32F410xx ----------------*/
  380. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  381. #define RCC_PERIPHCLK_I2S 0x00000001U
  382. #define RCC_PERIPHCLK_TIM 0x00000002U
  383. #define RCC_PERIPHCLK_RTC 0x00000004U
  384. #define RCC_PERIPHCLK_FMPI2C1 0x00000008U
  385. #define RCC_PERIPHCLK_LPTIM1 0x00000010U
  386. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  387. /*----------------------------------------------------------------------------*/
  388. /*------------------- Peripheral Clock source for STM32F446xx ----------------*/
  389. #if defined(STM32F446xx)
  390. #define RCC_PERIPHCLK_I2S_APB1 0x00000001U
  391. #define RCC_PERIPHCLK_I2S_APB2 0x00000002U
  392. #define RCC_PERIPHCLK_SAI1 0x00000004U
  393. #define RCC_PERIPHCLK_SAI2 0x00000008U
  394. #define RCC_PERIPHCLK_TIM 0x00000010U
  395. #define RCC_PERIPHCLK_RTC 0x00000020U
  396. #define RCC_PERIPHCLK_CEC 0x00000040U
  397. #define RCC_PERIPHCLK_FMPI2C1 0x00000080U
  398. #define RCC_PERIPHCLK_CLK48 0x00000100U
  399. #define RCC_PERIPHCLK_SDIO 0x00000200U
  400. #define RCC_PERIPHCLK_SPDIFRX 0x00000400U
  401. #define RCC_PERIPHCLK_PLLI2S 0x00000800U
  402. #endif /* STM32F446xx */
  403. /*-----------------------------------------------------------------------------*/
  404. /*----------- Peripheral Clock source for STM32F469xx/STM32F479xx -------------*/
  405. #if defined(STM32F469xx) || defined(STM32F479xx)
  406. #define RCC_PERIPHCLK_I2S 0x00000001U
  407. #define RCC_PERIPHCLK_SAI_PLLI2S 0x00000002U
  408. #define RCC_PERIPHCLK_SAI_PLLSAI 0x00000004U
  409. #define RCC_PERIPHCLK_LTDC 0x00000008U
  410. #define RCC_PERIPHCLK_TIM 0x00000010U
  411. #define RCC_PERIPHCLK_RTC 0x00000020U
  412. #define RCC_PERIPHCLK_PLLI2S 0x00000040U
  413. #define RCC_PERIPHCLK_CLK48 0x00000080U
  414. #define RCC_PERIPHCLK_SDIO 0x00000100U
  415. #endif /* STM32F469xx || STM32F479xx */
  416. /*----------------------------------------------------------------------------*/
  417. /*-------- Peripheral Clock source for STM32F42xxx/STM32F43xxx ---------------*/
  418. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
  419. #define RCC_PERIPHCLK_I2S 0x00000001U
  420. #define RCC_PERIPHCLK_SAI_PLLI2S 0x00000002U
  421. #define RCC_PERIPHCLK_SAI_PLLSAI 0x00000004U
  422. #define RCC_PERIPHCLK_LTDC 0x00000008U
  423. #define RCC_PERIPHCLK_TIM 0x00000010U
  424. #define RCC_PERIPHCLK_RTC 0x00000020U
  425. #define RCC_PERIPHCLK_PLLI2S 0x00000040U
  426. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
  427. /*----------------------------------------------------------------------------*/
  428. /*-------- Peripheral Clock source for STM32F40xxx/STM32F41xxx ---------------*/
  429. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) ||\
  430. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  431. #define RCC_PERIPHCLK_I2S 0x00000001U
  432. #define RCC_PERIPHCLK_RTC 0x00000002U
  433. #define RCC_PERIPHCLK_PLLI2S 0x00000004U
  434. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
  435. #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  436. #define RCC_PERIPHCLK_TIM 0x00000008U
  437. #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
  438. /*----------------------------------------------------------------------------*/
  439. /**
  440. * @}
  441. */
  442. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  443. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  444. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \
  445. defined(STM32F479xx)
  446. /** @defgroup RCCEx_I2S_Clock_Source I2S Clock Source
  447. * @{
  448. */
  449. #define RCC_I2SCLKSOURCE_PLLI2S 0x00000000U
  450. #define RCC_I2SCLKSOURCE_EXT 0x00000001U
  451. /**
  452. * @}
  453. */
  454. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  455. STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */
  456. /** @defgroup RCCEx_PLLSAI_DIVR RCC PLLSAI DIVR
  457. * @{
  458. */
  459. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
  460. defined(STM32F469xx) || defined(STM32F479xx)
  461. #define RCC_PLLSAIDIVR_2 0x00000000U
  462. #define RCC_PLLSAIDIVR_4 0x00010000U
  463. #define RCC_PLLSAIDIVR_8 0x00020000U
  464. #define RCC_PLLSAIDIVR_16 0x00030000U
  465. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  466. /**
  467. * @}
  468. */
  469. /** @defgroup RCCEx_PLLI2SP_Clock_Divider RCC PLLI2SP Clock Divider
  470. * @{
  471. */
  472. #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  473. defined(STM32F412Rx) || defined(STM32F412Cx)
  474. #define RCC_PLLI2SP_DIV2 0x00000002U
  475. #define RCC_PLLI2SP_DIV4 0x00000004U
  476. #define RCC_PLLI2SP_DIV6 0x00000006U
  477. #define RCC_PLLI2SP_DIV8 0x00000008U
  478. #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  479. /**
  480. * @}
  481. */
  482. /** @defgroup RCCEx_PLLSAIP_Clock_Divider RCC PLLSAIP Clock Divider
  483. * @{
  484. */
  485. #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  486. #define RCC_PLLSAIP_DIV2 0x00000002U
  487. #define RCC_PLLSAIP_DIV4 0x00000004U
  488. #define RCC_PLLSAIP_DIV6 0x00000006U
  489. #define RCC_PLLSAIP_DIV8 0x00000008U
  490. #endif /* STM32F446xx || STM32F469xx || STM32F479xx */
  491. /**
  492. * @}
  493. */
  494. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  495. /** @defgroup RCCEx_SAI_BlockA_Clock_Source RCC SAI BlockA Clock Source
  496. * @{
  497. */
  498. #define RCC_SAIACLKSOURCE_PLLSAI 0x00000000U
  499. #define RCC_SAIACLKSOURCE_PLLI2S 0x00100000U
  500. #define RCC_SAIACLKSOURCE_EXT 0x00200000U
  501. /**
  502. * @}
  503. */
  504. /** @defgroup RCCEx_SAI_BlockB_Clock_Source RCC SAI BlockB Clock Source
  505. * @{
  506. */
  507. #define RCC_SAIBCLKSOURCE_PLLSAI 0x00000000U
  508. #define RCC_SAIBCLKSOURCE_PLLI2S 0x00400000U
  509. #define RCC_SAIBCLKSOURCE_EXT 0x00800000U
  510. /**
  511. * @}
  512. */
  513. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  514. #if defined(STM32F469xx) || defined(STM32F479xx)
  515. /** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source
  516. * @{
  517. */
  518. #define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U
  519. #define RCC_CLK48CLKSOURCE_PLLSAIP ((uint32_t)RCC_DCKCFGR_CK48MSEL)
  520. /**
  521. * @}
  522. */
  523. /** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source
  524. * @{
  525. */
  526. #define RCC_SDIOCLKSOURCE_CLK48 0x00000000U
  527. #define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_SDIOSEL)
  528. /**
  529. * @}
  530. */
  531. /** @defgroup RCCEx_DSI_Clock_Source RCC DSI Clock Source
  532. * @{
  533. */
  534. #define RCC_DSICLKSOURCE_DSIPHY 0x00000000U
  535. #define RCC_DSICLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_DSISEL)
  536. /**
  537. * @}
  538. */
  539. #endif /* STM32F469xx || STM32F479xx */
  540. #if defined(STM32F446xx)
  541. /** @defgroup RCCEx_SAI1_Clock_Source RCC SAI1 Clock Source
  542. * @{
  543. */
  544. #define RCC_SAI1CLKSOURCE_PLLSAI 0x00000000U
  545. #define RCC_SAI1CLKSOURCE_PLLI2S ((uint32_t)RCC_DCKCFGR_SAI1SRC_0)
  546. #define RCC_SAI1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1SRC_1)
  547. #define RCC_SAI1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1SRC)
  548. /**
  549. * @}
  550. */
  551. /** @defgroup RCCEx_SAI2_Clock_Source RCC SAI2 Clock Source
  552. * @{
  553. */
  554. #define RCC_SAI2CLKSOURCE_PLLSAI 0x00000000U
  555. #define RCC_SAI2CLKSOURCE_PLLI2S ((uint32_t)RCC_DCKCFGR_SAI2SRC_0)
  556. #define RCC_SAI2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI2SRC_1)
  557. #define RCC_SAI2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI2SRC)
  558. /**
  559. * @}
  560. */
  561. /** @defgroup RCCEx_I2SAPB1_Clock_Source RCC I2S APB1 Clock Source
  562. * @{
  563. */
  564. #define RCC_I2SAPB1CLKSOURCE_PLLI2S 0x00000000U
  565. #define RCC_I2SAPB1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S1SRC_0)
  566. #define RCC_I2SAPB1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S1SRC_1)
  567. #define RCC_I2SAPB1CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S1SRC)
  568. /**
  569. * @}
  570. */
  571. /** @defgroup RCCEx_I2SAPB2_Clock_Source RCC I2S APB2 Clock Source
  572. * @{
  573. */
  574. #define RCC_I2SAPB2CLKSOURCE_PLLI2S 0x00000000U
  575. #define RCC_I2SAPB2CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S2SRC_0)
  576. #define RCC_I2SAPB2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S2SRC_1)
  577. #define RCC_I2SAPB2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S2SRC)
  578. /**
  579. * @}
  580. */
  581. /** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source
  582. * @{
  583. */
  584. #define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U
  585. #define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0)
  586. #define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1)
  587. /**
  588. * @}
  589. */
  590. /** @defgroup RCCEx_CEC_Clock_Source RCC CEC Clock Source
  591. * @{
  592. */
  593. #define RCC_CECCLKSOURCE_HSI 0x00000000U
  594. #define RCC_CECCLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_CECSEL)
  595. /**
  596. * @}
  597. */
  598. /** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source
  599. * @{
  600. */
  601. #define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U
  602. #define RCC_CLK48CLKSOURCE_PLLSAIP ((uint32_t)RCC_DCKCFGR2_CK48MSEL)
  603. /**
  604. * @}
  605. */
  606. /** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source
  607. * @{
  608. */
  609. #define RCC_SDIOCLKSOURCE_CLK48 0x00000000U
  610. #define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_SDIOSEL)
  611. /**
  612. * @}
  613. */
  614. /** @defgroup RCCEx_SPDIFRX_Clock_Source RCC SPDIFRX Clock Source
  615. * @{
  616. */
  617. #define RCC_SPDIFRXCLKSOURCE_PLLR 0x00000000U
  618. #define RCC_SPDIFRXCLKSOURCE_PLLI2SP ((uint32_t)RCC_DCKCFGR2_SPDIFRXSEL)
  619. /**
  620. * @}
  621. */
  622. #endif /* STM32F446xx */
  623. #if defined(STM32F413xx) || defined(STM32F423xx)
  624. /** @defgroup RCCEx_SAI1_BlockA_Clock_Source RCC SAI BlockA Clock Source
  625. * @{
  626. */
  627. #define RCC_SAIACLKSOURCE_PLLI2SR 0x00000000U
  628. #define RCC_SAIACLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1ASRC_0)
  629. #define RCC_SAIACLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1ASRC_1)
  630. #define RCC_SAIACLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI1ASRC_0 | RCC_DCKCFGR_SAI1ASRC_1)
  631. /**
  632. * @}
  633. */
  634. /** @defgroup RCCEx_SAI1_BlockB_Clock_Source RCC SAI BlockB Clock Source
  635. * @{
  636. */
  637. #define RCC_SAIBCLKSOURCE_PLLI2SR 0x00000000U
  638. #define RCC_SAIBCLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_SAI1BSRC_0)
  639. #define RCC_SAIBCLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_SAI1BSRC_1)
  640. #define RCC_SAIBCLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_SAI1BSRC_0 | RCC_DCKCFGR_SAI1BSRC_1)
  641. /**
  642. * @}
  643. */
  644. /** @defgroup RCCEx_LPTIM1_Clock_Source RCC LPTIM1 Clock Source
  645. * @{
  646. */
  647. #define RCC_LPTIM1CLKSOURCE_PCLK1 0x00000000U
  648. #define RCC_LPTIM1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0)
  649. #define RCC_LPTIM1CLKSOURCE_LSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_1)
  650. #define RCC_LPTIM1CLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0 | RCC_DCKCFGR2_LPTIM1SEL_1)
  651. /**
  652. * @}
  653. */
  654. /** @defgroup RCCEx_DFSDM2_Audio_Clock_Source RCC DFSDM2 Audio Clock Source
  655. * @{
  656. */
  657. #define RCC_DFSDM2AUDIOCLKSOURCE_I2S1 0x00000000U
  658. #define RCC_DFSDM2AUDIOCLKSOURCE_I2S2 ((uint32_t)RCC_DCKCFGR_CKDFSDM2ASEL)
  659. /**
  660. * @}
  661. */
  662. /** @defgroup RCCEx_DFSDM2_Kernel_Clock_Source RCC DFSDM2 Kernel Clock Source
  663. * @{
  664. */
  665. #define RCC_DFSDM2CLKSOURCE_PCLK2 0x00000000U
  666. #define RCC_DFSDM2CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_CKDFSDM1SEL)
  667. /**
  668. * @}
  669. */
  670. #endif /* STM32F413xx || STM32F423xx */
  671. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  672. /** @defgroup RCCEx_PLL_I2S_Clock_Source PLL I2S Clock Source
  673. * @{
  674. */
  675. #define RCC_PLLI2SCLKSOURCE_PLLSRC 0x00000000U
  676. #define RCC_PLLI2SCLKSOURCE_EXT ((uint32_t)RCC_PLLI2SCFGR_PLLI2SSRC)
  677. /**
  678. * @}
  679. */
  680. /** @defgroup RCCEx_DFSDM1_Audio_Clock_Source RCC DFSDM1 Audio Clock Source
  681. * @{
  682. */
  683. #define RCC_DFSDM1AUDIOCLKSOURCE_I2S1 0x00000000U
  684. #define RCC_DFSDM1AUDIOCLKSOURCE_I2S2 ((uint32_t)RCC_DCKCFGR_CKDFSDM1ASEL)
  685. /**
  686. * @}
  687. */
  688. /** @defgroup RCCEx_DFSDM1_Kernel_Clock_Source RCC DFSDM1 Kernel Clock Source
  689. * @{
  690. */
  691. #define RCC_DFSDM1CLKSOURCE_PCLK2 0x00000000U
  692. #define RCC_DFSDM1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR_CKDFSDM1SEL)
  693. /**
  694. * @}
  695. */
  696. /** @defgroup RCCEx_I2SAPB1_Clock_Source RCC I2S APB1 Clock Source
  697. * @{
  698. */
  699. #define RCC_I2SAPB1CLKSOURCE_PLLI2S 0x00000000U
  700. #define RCC_I2SAPB1CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S1SRC_0)
  701. #define RCC_I2SAPB1CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S1SRC_1)
  702. #define RCC_I2SAPB1CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S1SRC)
  703. /**
  704. * @}
  705. */
  706. /** @defgroup RCCEx_I2SAPB2_Clock_Source RCC I2S APB2 Clock Source
  707. * @{
  708. */
  709. #define RCC_I2SAPB2CLKSOURCE_PLLI2S 0x00000000U
  710. #define RCC_I2SAPB2CLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2S2SRC_0)
  711. #define RCC_I2SAPB2CLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_I2S2SRC_1)
  712. #define RCC_I2SAPB2CLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2S2SRC)
  713. /**
  714. * @}
  715. */
  716. /** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source
  717. * @{
  718. */
  719. #define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U
  720. #define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0)
  721. #define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1)
  722. /**
  723. * @}
  724. */
  725. /** @defgroup RCCEx_CLK48_Clock_Source RCC CLK48 Clock Source
  726. * @{
  727. */
  728. #define RCC_CLK48CLKSOURCE_PLLQ 0x00000000U
  729. #define RCC_CLK48CLKSOURCE_PLLI2SQ ((uint32_t)RCC_DCKCFGR2_CK48MSEL)
  730. /**
  731. * @}
  732. */
  733. /** @defgroup RCCEx_SDIO_Clock_Source RCC SDIO Clock Source
  734. * @{
  735. */
  736. #define RCC_SDIOCLKSOURCE_CLK48 0x00000000U
  737. #define RCC_SDIOCLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_SDIOSEL)
  738. /**
  739. * @}
  740. */
  741. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  742. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  743. /** @defgroup RCCEx_I2S_APB_Clock_Source RCC I2S APB Clock Source
  744. * @{
  745. */
  746. #define RCC_I2SAPBCLKSOURCE_PLLR 0x00000000U
  747. #define RCC_I2SAPBCLKSOURCE_EXT ((uint32_t)RCC_DCKCFGR_I2SSRC_0)
  748. #define RCC_I2SAPBCLKSOURCE_PLLSRC ((uint32_t)RCC_DCKCFGR_I2SSRC_1)
  749. /**
  750. * @}
  751. */
  752. /** @defgroup RCCEx_FMPI2C1_Clock_Source RCC FMPI2C1 Clock Source
  753. * @{
  754. */
  755. #define RCC_FMPI2C1CLKSOURCE_PCLK1 0x00000000U
  756. #define RCC_FMPI2C1CLKSOURCE_SYSCLK ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_0)
  757. #define RCC_FMPI2C1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_FMPI2C1SEL_1)
  758. /**
  759. * @}
  760. */
  761. /** @defgroup RCCEx_LPTIM1_Clock_Source RCC LPTIM1 Clock Source
  762. * @{
  763. */
  764. #define RCC_LPTIM1CLKSOURCE_PCLK1 0x00000000U
  765. #define RCC_LPTIM1CLKSOURCE_HSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0)
  766. #define RCC_LPTIM1CLKSOURCE_LSI ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_1)
  767. #define RCC_LPTIM1CLKSOURCE_LSE ((uint32_t)RCC_DCKCFGR2_LPTIM1SEL_0 | RCC_DCKCFGR2_LPTIM1SEL_1)
  768. /**
  769. * @}
  770. */
  771. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  772. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  773. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
  774. defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  775. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
  776. defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  777. /** @defgroup RCCEx_TIM_PRescaler_Selection RCC TIM PRescaler Selection
  778. * @{
  779. */
  780. #define RCC_TIMPRES_DESACTIVATED ((uint8_t)0x00)
  781. #define RCC_TIMPRES_ACTIVATED ((uint8_t)0x01)
  782. /**
  783. * @}
  784. */
  785. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
  786. STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
  787. STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  788. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\
  789. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
  790. defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
  791. defined(STM32F423xx)
  792. /** @defgroup RCCEx_LSE_Dual_Mode_Selection RCC LSE Dual Mode Selection
  793. * @{
  794. */
  795. #define RCC_LSE_LOWPOWER_MODE ((uint8_t)0x00)
  796. #define RCC_LSE_HIGHDRIVE_MODE ((uint8_t)0x01)
  797. /**
  798. * @}
  799. */
  800. #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||\
  801. STM32F412Rx || STM32F412Cx */
  802. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  803. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  804. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  805. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  806. defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  807. /** @defgroup RCC_MCO2_Clock_Source MCO2 Clock Source
  808. * @{
  809. */
  810. #define RCC_MCO2SOURCE_SYSCLK 0x00000000U
  811. #define RCC_MCO2SOURCE_PLLI2SCLK RCC_CFGR_MCO2_0
  812. #define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1
  813. #define RCC_MCO2SOURCE_PLLCLK RCC_CFGR_MCO2
  814. /**
  815. * @}
  816. */
  817. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  818. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  819. STM32F412Rx || STM32F413xx | STM32F423xx */
  820. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  821. /** @defgroup RCC_MCO2_Clock_Source MCO2 Clock Source
  822. * @{
  823. */
  824. #define RCC_MCO2SOURCE_SYSCLK 0x00000000U
  825. #define RCC_MCO2SOURCE_I2SCLK RCC_CFGR_MCO2_0
  826. #define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1
  827. #define RCC_MCO2SOURCE_PLLCLK RCC_CFGR_MCO2
  828. /**
  829. * @}
  830. */
  831. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  832. /**
  833. * @}
  834. */
  835. /* Exported macro ------------------------------------------------------------*/
  836. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  837. * @{
  838. */
  839. /*------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx --------*/
  840. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  841. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  842. * @brief Enables or disables the AHB1 peripheral clock.
  843. * @note After reset, the peripheral clock (used for registers read/write access)
  844. * is disabled and the application software has to enable this clock before
  845. * using it.
  846. * @{
  847. */
  848. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  849. __IO uint32_t tmpreg = 0x00U; \
  850. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  851. /* Delay after an RCC peripheral clock enabling */ \
  852. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  853. UNUSED(tmpreg); \
  854. } while(0U)
  855. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  856. __IO uint32_t tmpreg = 0x00U; \
  857. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  858. /* Delay after an RCC peripheral clock enabling */ \
  859. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  860. UNUSED(tmpreg); \
  861. } while(0U)
  862. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  863. __IO uint32_t tmpreg = 0x00U; \
  864. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  865. /* Delay after an RCC peripheral clock enabling */ \
  866. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  867. UNUSED(tmpreg); \
  868. } while(0U)
  869. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  870. __IO uint32_t tmpreg = 0x00U; \
  871. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  872. /* Delay after an RCC peripheral clock enabling */ \
  873. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  874. UNUSED(tmpreg); \
  875. } while(0U)
  876. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  877. __IO uint32_t tmpreg = 0x00U; \
  878. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  879. /* Delay after an RCC peripheral clock enabling */ \
  880. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  881. UNUSED(tmpreg); \
  882. } while(0U)
  883. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  884. __IO uint32_t tmpreg = 0x00U; \
  885. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  886. /* Delay after an RCC peripheral clock enabling */ \
  887. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  888. UNUSED(tmpreg); \
  889. } while(0U)
  890. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  891. __IO uint32_t tmpreg = 0x00U; \
  892. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  893. /* Delay after an RCC peripheral clock enabling */ \
  894. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  895. UNUSED(tmpreg); \
  896. } while(0U)
  897. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  898. __IO uint32_t tmpreg = 0x00U; \
  899. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  900. /* Delay after an RCC peripheral clock enabling */ \
  901. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  902. UNUSED(tmpreg); \
  903. } while(0U)
  904. #define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \
  905. __IO uint32_t tmpreg = 0x00U; \
  906. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  907. /* Delay after an RCC peripheral clock enabling */ \
  908. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  909. UNUSED(tmpreg); \
  910. } while(0U)
  911. #define __HAL_RCC_GPIOK_CLK_ENABLE() do { \
  912. __IO uint32_t tmpreg = 0x00U; \
  913. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  914. /* Delay after an RCC peripheral clock enabling */ \
  915. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  916. UNUSED(tmpreg); \
  917. } while(0U)
  918. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  919. __IO uint32_t tmpreg = 0x00U; \
  920. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  921. /* Delay after an RCC peripheral clock enabling */ \
  922. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  923. UNUSED(tmpreg); \
  924. } while(0U)
  925. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  926. __IO uint32_t tmpreg = 0x00U; \
  927. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  928. /* Delay after an RCC peripheral clock enabling */ \
  929. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  930. UNUSED(tmpreg); \
  931. } while(0U)
  932. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  933. __IO uint32_t tmpreg = 0x00U; \
  934. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  935. /* Delay after an RCC peripheral clock enabling */ \
  936. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  937. UNUSED(tmpreg); \
  938. } while(0U)
  939. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  940. __IO uint32_t tmpreg = 0x00U; \
  941. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  942. /* Delay after an RCC peripheral clock enabling */ \
  943. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  944. UNUSED(tmpreg); \
  945. } while(0U)
  946. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  947. __IO uint32_t tmpreg = 0x00U; \
  948. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  949. /* Delay after an RCC peripheral clock enabling */ \
  950. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  951. UNUSED(tmpreg); \
  952. } while(0U)
  953. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  954. __IO uint32_t tmpreg = 0x00U; \
  955. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  956. /* Delay after an RCC peripheral clock enabling */ \
  957. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  958. UNUSED(tmpreg); \
  959. } while(0U)
  960. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  961. __IO uint32_t tmpreg = 0x00U; \
  962. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  963. /* Delay after an RCC peripheral clock enabling */ \
  964. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  965. UNUSED(tmpreg); \
  966. } while(0U)
  967. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  968. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  969. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  970. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  971. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  972. #define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOJEN))
  973. #define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOKEN))
  974. #define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2DEN))
  975. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  976. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  977. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  978. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  979. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  980. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  981. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  982. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  983. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  984. /**
  985. * @brief Enable ETHERNET clock.
  986. */
  987. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  988. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  989. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  990. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  991. } while(0U)
  992. /**
  993. * @brief Disable ETHERNET clock.
  994. */
  995. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  996. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  997. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  998. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  999. } while(0U)
  1000. /**
  1001. * @}
  1002. */
  1003. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  1004. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  1005. * @note After reset, the peripheral clock (used for registers read/write access)
  1006. * is disabled and the application software has to enable this clock before
  1007. * using it.
  1008. * @{
  1009. */
  1010. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1011. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1012. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1013. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1014. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1015. #define __HAL_RCC_GPIOJ_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) != RESET)
  1016. #define __HAL_RCC_GPIOK_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) != RESET)
  1017. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) != RESET)
  1018. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1019. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  1020. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  1021. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  1022. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1023. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1024. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1025. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  1026. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  1027. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  1028. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  1029. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  1030. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1031. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1032. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1033. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1034. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1035. #define __HAL_RCC_GPIOJ_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) == RESET)
  1036. #define __HAL_RCC_GPIOK_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) == RESET)
  1037. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) == RESET)
  1038. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  1039. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  1040. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  1041. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  1042. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1043. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  1044. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1045. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  1046. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  1047. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  1048. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  1049. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  1050. /**
  1051. * @}
  1052. */
  1053. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  1054. * @brief Enable or disable the AHB2 peripheral clock.
  1055. * @note After reset, the peripheral clock (used for registers read/write access)
  1056. * is disabled and the application software has to enable this clock before
  1057. * using it.
  1058. * @{
  1059. */
  1060. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  1061. __IO uint32_t tmpreg = 0x00U; \
  1062. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  1063. /* Delay after an RCC peripheral clock enabling */ \
  1064. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  1065. UNUSED(tmpreg); \
  1066. } while(0U)
  1067. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  1068. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1069. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  1070. __IO uint32_t tmpreg = 0x00U; \
  1071. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  1072. /* Delay after an RCC peripheral clock enabling */ \
  1073. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  1074. UNUSED(tmpreg); \
  1075. } while(0U)
  1076. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  1077. __IO uint32_t tmpreg = 0x00U; \
  1078. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  1079. /* Delay after an RCC peripheral clock enabling */ \
  1080. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  1081. UNUSED(tmpreg); \
  1082. } while(0U)
  1083. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  1084. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  1085. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1086. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  1087. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  1088. }while(0U)
  1089. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  1090. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  1091. __IO uint32_t tmpreg = 0x00U; \
  1092. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  1093. /* Delay after an RCC peripheral clock enabling */ \
  1094. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  1095. UNUSED(tmpreg); \
  1096. } while(0U)
  1097. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  1098. /**
  1099. * @}
  1100. */
  1101. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  1102. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  1103. * @note After reset, the peripheral clock (used for registers read/write access)
  1104. * is disabled and the application software has to enable this clock before
  1105. * using it.
  1106. * @{
  1107. */
  1108. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  1109. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  1110. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1111. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  1112. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  1113. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  1114. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  1115. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1116. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  1117. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  1118. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  1119. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  1120. /**
  1121. * @}
  1122. */
  1123. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  1124. * @brief Enables or disables the AHB3 peripheral clock.
  1125. * @note After reset, the peripheral clock (used for registers read/write access)
  1126. * is disabled and the application software has to enable this clock before
  1127. * using it.
  1128. * @{
  1129. */
  1130. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  1131. __IO uint32_t tmpreg = 0x00U; \
  1132. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  1133. /* Delay after an RCC peripheral clock enabling */ \
  1134. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  1135. UNUSED(tmpreg); \
  1136. } while(0U)
  1137. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  1138. #if defined(STM32F469xx) || defined(STM32F479xx)
  1139. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  1140. __IO uint32_t tmpreg = 0x00U; \
  1141. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  1142. /* Delay after an RCC peripheral clock enabling */ \
  1143. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  1144. UNUSED(tmpreg); \
  1145. } while(0U)
  1146. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  1147. #endif /* STM32F469xx || STM32F479xx */
  1148. /**
  1149. * @}
  1150. */
  1151. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  1152. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  1153. * @note After reset, the peripheral clock (used for registers read/write access)
  1154. * is disabled and the application software has to enable this clock before
  1155. * using it.
  1156. * @{
  1157. */
  1158. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  1159. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  1160. #if defined(STM32F469xx) || defined(STM32F479xx)
  1161. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  1162. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  1163. #endif /* STM32F469xx || STM32F479xx */
  1164. /**
  1165. * @}
  1166. */
  1167. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  1168. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  1169. * @note After reset, the peripheral clock (used for registers read/write access)
  1170. * is disabled and the application software has to enable this clock before
  1171. * using it.
  1172. * @{
  1173. */
  1174. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  1175. __IO uint32_t tmpreg = 0x00U; \
  1176. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  1177. /* Delay after an RCC peripheral clock enabling */ \
  1178. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  1179. UNUSED(tmpreg); \
  1180. } while(0U)
  1181. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  1182. __IO uint32_t tmpreg = 0x00U; \
  1183. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  1184. /* Delay after an RCC peripheral clock enabling */ \
  1185. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  1186. UNUSED(tmpreg); \
  1187. } while(0U)
  1188. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  1189. __IO uint32_t tmpreg = 0x00U; \
  1190. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  1191. /* Delay after an RCC peripheral clock enabling */ \
  1192. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  1193. UNUSED(tmpreg); \
  1194. } while(0U)
  1195. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  1196. __IO uint32_t tmpreg = 0x00U; \
  1197. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  1198. /* Delay after an RCC peripheral clock enabling */ \
  1199. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  1200. UNUSED(tmpreg); \
  1201. } while(0U)
  1202. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  1203. __IO uint32_t tmpreg = 0x00U; \
  1204. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1205. /* Delay after an RCC peripheral clock enabling */ \
  1206. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1207. UNUSED(tmpreg); \
  1208. } while(0U)
  1209. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  1210. __IO uint32_t tmpreg = 0x00U; \
  1211. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1212. /* Delay after an RCC peripheral clock enabling */ \
  1213. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  1214. UNUSED(tmpreg); \
  1215. } while(0U)
  1216. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  1217. __IO uint32_t tmpreg = 0x00U; \
  1218. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  1219. /* Delay after an RCC peripheral clock enabling */ \
  1220. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  1221. UNUSED(tmpreg); \
  1222. } while(0U)
  1223. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  1224. __IO uint32_t tmpreg = 0x00U; \
  1225. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  1226. /* Delay after an RCC peripheral clock enabling */ \
  1227. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  1228. UNUSED(tmpreg); \
  1229. } while(0U)
  1230. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  1231. __IO uint32_t tmpreg = 0x00U; \
  1232. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  1233. /* Delay after an RCC peripheral clock enabling */ \
  1234. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  1235. UNUSED(tmpreg); \
  1236. } while(0U)
  1237. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  1238. __IO uint32_t tmpreg = 0x00U; \
  1239. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  1240. /* Delay after an RCC peripheral clock enabling */ \
  1241. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  1242. UNUSED(tmpreg); \
  1243. } while(0U)
  1244. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  1245. __IO uint32_t tmpreg = 0x00U; \
  1246. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  1247. /* Delay after an RCC peripheral clock enabling */ \
  1248. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  1249. UNUSED(tmpreg); \
  1250. } while(0U)
  1251. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  1252. __IO uint32_t tmpreg = 0x00U; \
  1253. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  1254. /* Delay after an RCC peripheral clock enabling */ \
  1255. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  1256. UNUSED(tmpreg); \
  1257. } while(0U)
  1258. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  1259. __IO uint32_t tmpreg = 0x00U; \
  1260. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  1261. /* Delay after an RCC peripheral clock enabling */ \
  1262. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  1263. UNUSED(tmpreg); \
  1264. } while(0U)
  1265. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  1266. __IO uint32_t tmpreg = 0x00U; \
  1267. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  1268. /* Delay after an RCC peripheral clock enabling */ \
  1269. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  1270. UNUSED(tmpreg); \
  1271. } while(0U)
  1272. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  1273. __IO uint32_t tmpreg = 0x00U; \
  1274. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  1275. /* Delay after an RCC peripheral clock enabling */ \
  1276. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  1277. UNUSED(tmpreg); \
  1278. } while(0U)
  1279. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  1280. __IO uint32_t tmpreg = 0x00U; \
  1281. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  1282. /* Delay after an RCC peripheral clock enabling */ \
  1283. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  1284. UNUSED(tmpreg); \
  1285. } while(0U)
  1286. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  1287. __IO uint32_t tmpreg = 0x00U; \
  1288. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  1289. /* Delay after an RCC peripheral clock enabling */ \
  1290. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  1291. UNUSED(tmpreg); \
  1292. } while(0U)
  1293. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  1294. __IO uint32_t tmpreg = 0x00U; \
  1295. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  1296. /* Delay after an RCC peripheral clock enabling */ \
  1297. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  1298. UNUSED(tmpreg); \
  1299. } while(0U)
  1300. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  1301. __IO uint32_t tmpreg = 0x00U; \
  1302. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  1303. /* Delay after an RCC peripheral clock enabling */ \
  1304. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  1305. UNUSED(tmpreg); \
  1306. } while(0U)
  1307. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  1308. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  1309. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  1310. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  1311. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  1312. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  1313. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  1314. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  1315. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  1316. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  1317. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  1318. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  1319. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  1320. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  1321. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  1322. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  1323. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  1324. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  1325. /**
  1326. * @}
  1327. */
  1328. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  1329. * @brief Get the enable or disable status of the APB1 peripheral clock.
  1330. * @note After reset, the peripheral clock (used for registers read/write access)
  1331. * is disabled and the application software has to enable this clock before
  1332. * using it.
  1333. * @{
  1334. */
  1335. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  1336. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  1337. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  1338. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  1339. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  1340. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  1341. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  1342. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  1343. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  1344. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  1345. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  1346. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  1347. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  1348. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  1349. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  1350. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  1351. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  1352. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  1353. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  1354. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  1355. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  1356. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  1357. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  1358. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  1359. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  1360. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  1361. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  1362. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  1363. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  1364. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  1365. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  1366. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  1367. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  1368. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  1369. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  1370. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  1371. /**
  1372. * @}
  1373. */
  1374. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  1375. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  1376. * @note After reset, the peripheral clock (used for registers read/write access)
  1377. * is disabled and the application software has to enable this clock before
  1378. * using it.
  1379. * @{
  1380. */
  1381. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1382. __IO uint32_t tmpreg = 0x00U; \
  1383. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1384. /* Delay after an RCC peripheral clock enabling */ \
  1385. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1386. UNUSED(tmpreg); \
  1387. } while(0U)
  1388. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  1389. __IO uint32_t tmpreg = 0x00U; \
  1390. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1391. /* Delay after an RCC peripheral clock enabling */ \
  1392. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1393. UNUSED(tmpreg); \
  1394. } while(0U)
  1395. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  1396. __IO uint32_t tmpreg = 0x00U; \
  1397. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1398. /* Delay after an RCC peripheral clock enabling */ \
  1399. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1400. UNUSED(tmpreg); \
  1401. } while(0U)
  1402. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  1403. __IO uint32_t tmpreg = 0x00U; \
  1404. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1405. /* Delay after an RCC peripheral clock enabling */ \
  1406. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1407. UNUSED(tmpreg); \
  1408. } while(0U)
  1409. #define __HAL_RCC_SPI6_CLK_ENABLE() do { \
  1410. __IO uint32_t tmpreg = 0x00U; \
  1411. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1412. /* Delay after an RCC peripheral clock enabling */ \
  1413. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1414. UNUSED(tmpreg); \
  1415. } while(0U)
  1416. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1417. __IO uint32_t tmpreg = 0x00U; \
  1418. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1419. /* Delay after an RCC peripheral clock enabling */ \
  1420. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1421. UNUSED(tmpreg); \
  1422. } while(0U)
  1423. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  1424. __IO uint32_t tmpreg = 0x00U; \
  1425. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  1426. /* Delay after an RCC peripheral clock enabling */ \
  1427. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  1428. UNUSED(tmpreg); \
  1429. } while(0U)
  1430. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  1431. __IO uint32_t tmpreg = 0x00U; \
  1432. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1433. /* Delay after an RCC peripheral clock enabling */ \
  1434. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1435. UNUSED(tmpreg); \
  1436. } while(0U)
  1437. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  1438. __IO uint32_t tmpreg = 0x00U; \
  1439. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1440. /* Delay after an RCC peripheral clock enabling */ \
  1441. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1442. UNUSED(tmpreg); \
  1443. } while(0U)
  1444. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  1445. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  1446. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  1447. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  1448. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  1449. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  1450. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  1451. #define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI6EN))
  1452. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  1453. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1454. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  1455. __IO uint32_t tmpreg = 0x00U; \
  1456. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1457. /* Delay after an RCC peripheral clock enabling */ \
  1458. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1459. UNUSED(tmpreg); \
  1460. } while(0U)
  1461. #define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_LTDCEN))
  1462. #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  1463. #if defined(STM32F469xx) || defined(STM32F479xx)
  1464. #define __HAL_RCC_DSI_CLK_ENABLE() do { \
  1465. __IO uint32_t tmpreg = 0x00U; \
  1466. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1467. /* Delay after an RCC peripheral clock enabling */ \
  1468. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1469. UNUSED(tmpreg); \
  1470. } while(0U)
  1471. #define __HAL_RCC_DSI_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DSIEN))
  1472. #endif /* STM32F469xx || STM32F479xx */
  1473. /**
  1474. * @}
  1475. */
  1476. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  1477. * @brief Get the enable or disable status of the APB2 peripheral clock.
  1478. * @note After reset, the peripheral clock (used for registers read/write access)
  1479. * is disabled and the application software has to enable this clock before
  1480. * using it.
  1481. * @{
  1482. */
  1483. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  1484. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  1485. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  1486. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  1487. #define __HAL_RCC_SPI6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) != RESET)
  1488. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  1489. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  1490. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  1491. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN))!= RESET)
  1492. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  1493. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  1494. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN))== RESET)
  1495. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  1496. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  1497. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  1498. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  1499. #define __HAL_RCC_SPI6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) == RESET)
  1500. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  1501. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1502. #define __HAL_RCC_LTDC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) != RESET)
  1503. #define __HAL_RCC_LTDC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) == RESET)
  1504. #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  1505. #if defined(STM32F469xx) || defined(STM32F479xx)
  1506. #define __HAL_RCC_DSI_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) != RESET)
  1507. #define __HAL_RCC_DSI_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) == RESET)
  1508. #endif /* STM32F469xx || STM32F479xx */
  1509. /**
  1510. * @}
  1511. */
  1512. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  1513. * @brief Force or release AHB1 peripheral reset.
  1514. * @{
  1515. */
  1516. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  1517. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  1518. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  1519. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  1520. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  1521. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  1522. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  1523. #define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOJRST))
  1524. #define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOKRST))
  1525. #define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2DRST))
  1526. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  1527. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  1528. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  1529. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  1530. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  1531. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  1532. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  1533. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  1534. #define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOJRST))
  1535. #define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOKRST))
  1536. #define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2DRST))
  1537. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  1538. /**
  1539. * @}
  1540. */
  1541. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  1542. * @brief Force or release AHB2 peripheral reset.
  1543. * @{
  1544. */
  1545. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  1546. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  1547. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  1548. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  1549. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  1550. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  1551. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  1552. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  1553. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1554. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  1555. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  1556. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  1557. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  1558. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1559. /**
  1560. * @}
  1561. */
  1562. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  1563. * @brief Force or release AHB3 peripheral reset.
  1564. * @{
  1565. */
  1566. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  1567. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  1568. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  1569. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  1570. #if defined(STM32F469xx) || defined(STM32F479xx)
  1571. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  1572. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  1573. #endif /* STM32F469xx || STM32F479xx */
  1574. /**
  1575. * @}
  1576. */
  1577. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  1578. * @brief Force or release APB1 peripheral reset.
  1579. * @{
  1580. */
  1581. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  1582. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  1583. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  1584. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  1585. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  1586. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  1587. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  1588. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  1589. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  1590. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  1591. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  1592. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  1593. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  1594. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  1595. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  1596. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  1597. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  1598. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  1599. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  1600. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  1601. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  1602. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  1603. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  1604. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  1605. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  1606. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  1607. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  1608. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  1609. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  1610. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  1611. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  1612. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  1613. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  1614. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  1615. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  1616. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  1617. /**
  1618. * @}
  1619. */
  1620. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  1621. * @brief Force or release APB2 peripheral reset.
  1622. * @{
  1623. */
  1624. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  1625. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  1626. #define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI6RST))
  1627. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  1628. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  1629. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  1630. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  1631. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  1632. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  1633. #define __HAL_RCC_TIM10_RELEASE_RESET()(RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  1634. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  1635. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  1636. #define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI6RST))
  1637. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  1638. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1639. #define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_LTDCRST))
  1640. #define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_LTDCRST))
  1641. #endif /* STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
  1642. #if defined(STM32F469xx) || defined(STM32F479xx)
  1643. #define __HAL_RCC_DSI_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DSIRST))
  1644. #define __HAL_RCC_DSI_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DSIRST))
  1645. #endif /* STM32F469xx || STM32F479xx */
  1646. /**
  1647. * @}
  1648. */
  1649. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  1650. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1651. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1652. * power consumption.
  1653. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1654. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1655. * @{
  1656. */
  1657. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  1658. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  1659. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  1660. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  1661. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  1662. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  1663. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  1664. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  1665. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  1666. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  1667. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  1668. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  1669. #define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOJLPEN))
  1670. #define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOKLPEN))
  1671. #define __HAL_RCC_SRAM3_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM3LPEN))
  1672. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2DLPEN))
  1673. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  1674. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  1675. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  1676. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  1677. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  1678. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  1679. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  1680. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  1681. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  1682. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  1683. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  1684. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  1685. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  1686. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  1687. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  1688. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  1689. #define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOJLPEN))
  1690. #define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOKLPEN))
  1691. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2DLPEN))
  1692. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  1693. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  1694. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  1695. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  1696. /**
  1697. * @}
  1698. */
  1699. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  1700. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1701. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1702. * power consumption.
  1703. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  1704. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1705. * @{
  1706. */
  1707. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  1708. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  1709. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  1710. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  1711. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  1712. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  1713. #if defined(STM32F437xx)|| defined(STM32F439xx) || defined(STM32F479xx)
  1714. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  1715. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  1716. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  1717. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  1718. #endif /* STM32F437xx || STM32F439xx || STM32F479xx */
  1719. /**
  1720. * @}
  1721. */
  1722. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  1723. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1724. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1725. * power consumption.
  1726. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1727. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1728. * @{
  1729. */
  1730. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  1731. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  1732. #if defined(STM32F469xx) || defined(STM32F479xx)
  1733. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  1734. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  1735. #endif /* STM32F469xx || STM32F479xx */
  1736. /**
  1737. * @}
  1738. */
  1739. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  1740. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1741. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1742. * power consumption.
  1743. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1744. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1745. * @{
  1746. */
  1747. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  1748. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  1749. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  1750. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  1751. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  1752. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  1753. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  1754. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  1755. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  1756. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  1757. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  1758. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  1759. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  1760. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  1761. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  1762. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  1763. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  1764. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  1765. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  1766. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  1767. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  1768. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  1769. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  1770. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  1771. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  1772. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  1773. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  1774. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  1775. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  1776. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  1777. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  1778. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  1779. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  1780. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  1781. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  1782. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  1783. /**
  1784. * @}
  1785. */
  1786. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  1787. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1788. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1789. * power consumption.
  1790. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1791. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1792. * @{
  1793. */
  1794. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  1795. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  1796. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  1797. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  1798. #define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI6LPEN))
  1799. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  1800. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  1801. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  1802. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  1803. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  1804. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  1805. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  1806. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  1807. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  1808. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  1809. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  1810. #define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI6LPEN))
  1811. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  1812. #if defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  1813. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_LTDCLPEN))
  1814. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_LTDCLPEN))
  1815. #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  1816. #if defined(STM32F469xx) || defined(STM32F479xx)
  1817. #define __HAL_RCC_DSI_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DSILPEN))
  1818. #define __HAL_RCC_DSI_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DSILPEN))
  1819. #endif /* STM32F469xx || STM32F479xx */
  1820. /**
  1821. * @}
  1822. */
  1823. #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
  1824. /*----------------------------------------------------------------------------*/
  1825. /*----------------------------------- STM32F40xxx/STM32F41xxx-----------------*/
  1826. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
  1827. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  1828. * @brief Enables or disables the AHB1 peripheral clock.
  1829. * @note After reset, the peripheral clock (used for registers read/write access)
  1830. * is disabled and the application software has to enable this clock before
  1831. * using it.
  1832. * @{
  1833. */
  1834. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  1835. __IO uint32_t tmpreg = 0x00U; \
  1836. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  1837. /* Delay after an RCC peripheral clock enabling */ \
  1838. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  1839. UNUSED(tmpreg); \
  1840. } while(0U)
  1841. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  1842. __IO uint32_t tmpreg = 0x00U; \
  1843. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  1844. /* Delay after an RCC peripheral clock enabling */ \
  1845. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  1846. UNUSED(tmpreg); \
  1847. } while(0U)
  1848. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  1849. __IO uint32_t tmpreg = 0x00U; \
  1850. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  1851. /* Delay after an RCC peripheral clock enabling */ \
  1852. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  1853. UNUSED(tmpreg); \
  1854. } while(0U)
  1855. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  1856. __IO uint32_t tmpreg = 0x00U; \
  1857. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  1858. /* Delay after an RCC peripheral clock enabling */ \
  1859. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  1860. UNUSED(tmpreg); \
  1861. } while(0U)
  1862. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  1863. __IO uint32_t tmpreg = 0x00U; \
  1864. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  1865. /* Delay after an RCC peripheral clock enabling */ \
  1866. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  1867. UNUSED(tmpreg); \
  1868. } while(0U)
  1869. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  1870. __IO uint32_t tmpreg = 0x00U; \
  1871. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  1872. /* Delay after an RCC peripheral clock enabling */ \
  1873. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  1874. UNUSED(tmpreg); \
  1875. } while(0U)
  1876. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  1877. __IO uint32_t tmpreg = 0x00U; \
  1878. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  1879. /* Delay after an RCC peripheral clock enabling */ \
  1880. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  1881. UNUSED(tmpreg); \
  1882. } while(0U)
  1883. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  1884. __IO uint32_t tmpreg = 0x00U; \
  1885. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  1886. /* Delay after an RCC peripheral clock enabling */ \
  1887. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  1888. UNUSED(tmpreg); \
  1889. } while(0U)
  1890. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  1891. __IO uint32_t tmpreg = 0x00U; \
  1892. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  1893. /* Delay after an RCC peripheral clock enabling */ \
  1894. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  1895. UNUSED(tmpreg); \
  1896. } while(0U)
  1897. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  1898. __IO uint32_t tmpreg = 0x00U; \
  1899. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  1900. /* Delay after an RCC peripheral clock enabling */ \
  1901. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  1902. UNUSED(tmpreg); \
  1903. } while(0U)
  1904. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  1905. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  1906. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  1907. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  1908. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  1909. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  1910. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  1911. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  1912. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  1913. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  1914. #if defined(STM32F407xx)|| defined(STM32F417xx)
  1915. /**
  1916. * @brief Enable ETHERNET clock.
  1917. */
  1918. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  1919. __IO uint32_t tmpreg = 0x00U; \
  1920. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  1921. /* Delay after an RCC peripheral clock enabling */ \
  1922. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  1923. UNUSED(tmpreg); \
  1924. } while(0U)
  1925. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  1926. __IO uint32_t tmpreg = 0x00U; \
  1927. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  1928. /* Delay after an RCC peripheral clock enabling */ \
  1929. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  1930. UNUSED(tmpreg); \
  1931. } while(0U)
  1932. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  1933. __IO uint32_t tmpreg = 0x00U; \
  1934. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  1935. /* Delay after an RCC peripheral clock enabling */ \
  1936. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  1937. UNUSED(tmpreg); \
  1938. } while(0U)
  1939. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  1940. __IO uint32_t tmpreg = 0x00U; \
  1941. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  1942. /* Delay after an RCC peripheral clock enabling */ \
  1943. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  1944. UNUSED(tmpreg); \
  1945. } while(0U)
  1946. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  1947. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  1948. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  1949. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  1950. } while(0U)
  1951. /**
  1952. * @brief Disable ETHERNET clock.
  1953. */
  1954. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  1955. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  1956. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  1957. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  1958. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  1959. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  1960. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  1961. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  1962. } while(0U)
  1963. #endif /* STM32F407xx || STM32F417xx */
  1964. /**
  1965. * @}
  1966. */
  1967. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  1968. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  1969. * @note After reset, the peripheral clock (used for registers read/write access)
  1970. * is disabled and the application software has to enable this clock before
  1971. * using it.
  1972. * @{
  1973. */
  1974. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1975. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  1976. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  1977. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1978. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1979. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1980. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1981. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1982. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1983. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1984. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1985. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1986. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1987. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1988. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1989. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1990. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN))== RESET)
  1991. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1992. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  1993. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  1994. #if defined(STM32F407xx)|| defined(STM32F417xx)
  1995. /**
  1996. * @brief Enable ETHERNET clock.
  1997. */
  1998. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1999. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  2000. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  2001. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  2002. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  2003. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  2004. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  2005. /**
  2006. * @brief Disable ETHERNET clock.
  2007. */
  2008. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  2009. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  2010. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  2011. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  2012. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  2013. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  2014. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  2015. #endif /* STM32F407xx || STM32F417xx */
  2016. /**
  2017. * @}
  2018. */
  2019. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  2020. * @brief Enable or disable the AHB2 peripheral clock.
  2021. * @note After reset, the peripheral clock (used for registers read/write access)
  2022. * is disabled and the application software has to enable this clock before
  2023. * using it.
  2024. * @{
  2025. */
  2026. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  2027. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  2028. }while(0U)
  2029. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  2030. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  2031. __IO uint32_t tmpreg = 0x00U; \
  2032. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  2033. /* Delay after an RCC peripheral clock enabling */ \
  2034. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  2035. UNUSED(tmpreg); \
  2036. } while(0U)
  2037. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  2038. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2039. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  2040. __IO uint32_t tmpreg = 0x00U; \
  2041. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  2042. /* Delay after an RCC peripheral clock enabling */ \
  2043. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  2044. UNUSED(tmpreg); \
  2045. } while(0U)
  2046. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  2047. #endif /* STM32F407xx || STM32F417xx */
  2048. #if defined(STM32F415xx) || defined(STM32F417xx)
  2049. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  2050. __IO uint32_t tmpreg = 0x00U; \
  2051. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  2052. /* Delay after an RCC peripheral clock enabling */ \
  2053. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  2054. UNUSED(tmpreg); \
  2055. } while(0U)
  2056. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  2057. __IO uint32_t tmpreg = 0x00U; \
  2058. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  2059. /* Delay after an RCC peripheral clock enabling */ \
  2060. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  2061. UNUSED(tmpreg); \
  2062. } while(0U)
  2063. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  2064. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  2065. #endif /* STM32F415xx || STM32F417xx */
  2066. /**
  2067. * @}
  2068. */
  2069. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  2070. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  2071. * @note After reset, the peripheral clock (used for registers read/write access)
  2072. * is disabled and the application software has to enable this clock before
  2073. * using it.
  2074. * @{
  2075. */
  2076. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  2077. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  2078. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  2079. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  2080. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2081. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  2082. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  2083. #endif /* STM32F407xx || STM32F417xx */
  2084. #if defined(STM32F415xx) || defined(STM32F417xx)
  2085. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  2086. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  2087. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  2088. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  2089. #endif /* STM32F415xx || STM32F417xx */
  2090. /**
  2091. * @}
  2092. */
  2093. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  2094. * @brief Enables or disables the AHB3 peripheral clock.
  2095. * @note After reset, the peripheral clock (used for registers read/write access)
  2096. * is disabled and the application software has to enable this clock before
  2097. * using it.
  2098. * @{
  2099. */
  2100. #define __HAL_RCC_FSMC_CLK_ENABLE() do { \
  2101. __IO uint32_t tmpreg = 0x00U; \
  2102. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  2103. /* Delay after an RCC peripheral clock enabling */ \
  2104. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  2105. UNUSED(tmpreg); \
  2106. } while(0U)
  2107. #define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FSMCEN))
  2108. /**
  2109. * @}
  2110. */
  2111. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  2112. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  2113. * @note After reset, the peripheral clock (used for registers read/write access)
  2114. * is disabled and the application software has to enable this clock before
  2115. * using it.
  2116. * @{
  2117. */
  2118. #define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) != RESET)
  2119. #define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) == RESET)
  2120. /**
  2121. * @}
  2122. */
  2123. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  2124. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  2125. * @note After reset, the peripheral clock (used for registers read/write access)
  2126. * is disabled and the application software has to enable this clock before
  2127. * using it.
  2128. * @{
  2129. */
  2130. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  2131. __IO uint32_t tmpreg = 0x00U; \
  2132. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  2133. /* Delay after an RCC peripheral clock enabling */ \
  2134. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  2135. UNUSED(tmpreg); \
  2136. } while(0U)
  2137. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  2138. __IO uint32_t tmpreg = 0x00U; \
  2139. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  2140. /* Delay after an RCC peripheral clock enabling */ \
  2141. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  2142. UNUSED(tmpreg); \
  2143. } while(0U)
  2144. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  2145. __IO uint32_t tmpreg = 0x00U; \
  2146. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  2147. /* Delay after an RCC peripheral clock enabling */ \
  2148. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  2149. UNUSED(tmpreg); \
  2150. } while(0U)
  2151. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  2152. __IO uint32_t tmpreg = 0x00U; \
  2153. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  2154. /* Delay after an RCC peripheral clock enabling */ \
  2155. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  2156. UNUSED(tmpreg); \
  2157. } while(0U)
  2158. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  2159. __IO uint32_t tmpreg = 0x00U; \
  2160. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  2161. /* Delay after an RCC peripheral clock enabling */ \
  2162. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  2163. UNUSED(tmpreg); \
  2164. } while(0U)
  2165. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  2166. __IO uint32_t tmpreg = 0x00U; \
  2167. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  2168. /* Delay after an RCC peripheral clock enabling */ \
  2169. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  2170. UNUSED(tmpreg); \
  2171. } while(0U)
  2172. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  2173. __IO uint32_t tmpreg = 0x00U; \
  2174. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  2175. /* Delay after an RCC peripheral clock enabling */ \
  2176. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  2177. UNUSED(tmpreg); \
  2178. } while(0U)
  2179. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  2180. __IO uint32_t tmpreg = 0x00U; \
  2181. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  2182. /* Delay after an RCC peripheral clock enabling */ \
  2183. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  2184. UNUSED(tmpreg); \
  2185. } while(0U)
  2186. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  2187. __IO uint32_t tmpreg = 0x00U; \
  2188. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  2189. /* Delay after an RCC peripheral clock enabling */ \
  2190. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  2191. UNUSED(tmpreg); \
  2192. } while(0U)
  2193. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  2194. __IO uint32_t tmpreg = 0x00U; \
  2195. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  2196. /* Delay after an RCC peripheral clock enabling */ \
  2197. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  2198. UNUSED(tmpreg); \
  2199. } while(0U)
  2200. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  2201. __IO uint32_t tmpreg = 0x00U; \
  2202. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  2203. /* Delay after an RCC peripheral clock enabling */ \
  2204. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  2205. UNUSED(tmpreg); \
  2206. } while(0U)
  2207. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  2208. __IO uint32_t tmpreg = 0x00U; \
  2209. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2210. /* Delay after an RCC peripheral clock enabling */ \
  2211. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2212. UNUSED(tmpreg); \
  2213. } while(0U)
  2214. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  2215. __IO uint32_t tmpreg = 0x00U; \
  2216. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2217. /* Delay after an RCC peripheral clock enabling */ \
  2218. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2219. UNUSED(tmpreg); \
  2220. } while(0U)
  2221. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  2222. __IO uint32_t tmpreg = 0x00U; \
  2223. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2224. /* Delay after an RCC peripheral clock enabling */ \
  2225. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2226. UNUSED(tmpreg); \
  2227. } while(0U)
  2228. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  2229. __IO uint32_t tmpreg = 0x00U; \
  2230. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2231. /* Delay after an RCC peripheral clock enabling */ \
  2232. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2233. UNUSED(tmpreg); \
  2234. } while(0U)
  2235. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  2236. __IO uint32_t tmpreg = 0x00U; \
  2237. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2238. /* Delay after an RCC peripheral clock enabling */ \
  2239. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2240. UNUSED(tmpreg); \
  2241. } while(0U)
  2242. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  2243. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  2244. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  2245. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  2246. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  2247. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  2248. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  2249. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  2250. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  2251. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  2252. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  2253. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  2254. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  2255. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  2256. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  2257. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  2258. /**
  2259. * @}
  2260. */
  2261. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  2262. * @brief Get the enable or disable status of the APB1 peripheral clock.
  2263. * @note After reset, the peripheral clock (used for registers read/write access)
  2264. * is disabled and the application software has to enable this clock before
  2265. * using it.
  2266. * @{
  2267. */
  2268. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  2269. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  2270. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  2271. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  2272. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  2273. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  2274. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  2275. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  2276. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  2277. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  2278. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  2279. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  2280. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  2281. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  2282. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  2283. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  2284. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  2285. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  2286. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  2287. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  2288. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  2289. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  2290. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  2291. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  2292. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  2293. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  2294. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  2295. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  2296. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  2297. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  2298. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  2299. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  2300. /**
  2301. * @}
  2302. */
  2303. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  2304. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  2305. * @note After reset, the peripheral clock (used for registers read/write access)
  2306. * is disabled and the application software has to enable this clock before
  2307. * using it.
  2308. * @{
  2309. */
  2310. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  2311. __IO uint32_t tmpreg = 0x00U; \
  2312. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  2313. /* Delay after an RCC peripheral clock enabling */ \
  2314. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  2315. UNUSED(tmpreg); \
  2316. } while(0U)
  2317. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  2318. __IO uint32_t tmpreg = 0x00U; \
  2319. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  2320. /* Delay after an RCC peripheral clock enabling */ \
  2321. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  2322. UNUSED(tmpreg); \
  2323. } while(0U)
  2324. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  2325. __IO uint32_t tmpreg = 0x00U; \
  2326. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  2327. /* Delay after an RCC peripheral clock enabling */ \
  2328. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  2329. UNUSED(tmpreg); \
  2330. } while(0U)
  2331. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  2332. __IO uint32_t tmpreg = 0x00U; \
  2333. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2334. /* Delay after an RCC peripheral clock enabling */ \
  2335. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2336. UNUSED(tmpreg); \
  2337. } while(0U)
  2338. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  2339. __IO uint32_t tmpreg = 0x00U; \
  2340. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2341. /* Delay after an RCC peripheral clock enabling */ \
  2342. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2343. UNUSED(tmpreg); \
  2344. } while(0U)
  2345. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  2346. __IO uint32_t tmpreg = 0x00U; \
  2347. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2348. /* Delay after an RCC peripheral clock enabling */ \
  2349. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2350. UNUSED(tmpreg); \
  2351. } while(0U)
  2352. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  2353. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  2354. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  2355. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  2356. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  2357. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  2358. /**
  2359. * @}
  2360. */
  2361. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  2362. * @brief Get the enable or disable status of the APB2 peripheral clock.
  2363. * @note After reset, the peripheral clock (used for registers read/write access)
  2364. * is disabled and the application software has to enable this clock before
  2365. * using it.
  2366. * @{
  2367. */
  2368. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  2369. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  2370. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  2371. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  2372. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  2373. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  2374. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  2375. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  2376. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  2377. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  2378. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  2379. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  2380. /**
  2381. * @}
  2382. */
  2383. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  2384. * @brief Force or release AHB1 peripheral reset.
  2385. * @{
  2386. */
  2387. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  2388. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  2389. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  2390. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  2391. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  2392. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  2393. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  2394. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  2395. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  2396. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  2397. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  2398. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  2399. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  2400. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  2401. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  2402. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  2403. /**
  2404. * @}
  2405. */
  2406. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  2407. * @brief Force or release AHB2 peripheral reset.
  2408. * @{
  2409. */
  2410. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  2411. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  2412. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2413. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  2414. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  2415. #endif /* STM32F407xx || STM32F417xx */
  2416. #if defined(STM32F415xx) || defined(STM32F417xx)
  2417. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  2418. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  2419. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  2420. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  2421. #endif /* STM32F415xx || STM32F417xx */
  2422. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  2423. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  2424. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  2425. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  2426. /**
  2427. * @}
  2428. */
  2429. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  2430. * @brief Force or release AHB3 peripheral reset.
  2431. * @{
  2432. */
  2433. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  2434. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  2435. #define __HAL_RCC_FSMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FSMCRST))
  2436. #define __HAL_RCC_FSMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FSMCRST))
  2437. /**
  2438. * @}
  2439. */
  2440. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  2441. * @brief Force or release APB1 peripheral reset.
  2442. * @{
  2443. */
  2444. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  2445. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  2446. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  2447. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  2448. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  2449. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  2450. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  2451. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  2452. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  2453. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  2454. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  2455. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  2456. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  2457. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  2458. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  2459. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  2460. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  2461. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  2462. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  2463. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  2464. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  2465. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  2466. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  2467. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  2468. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  2469. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  2470. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  2471. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  2472. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  2473. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  2474. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  2475. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  2476. /**
  2477. * @}
  2478. */
  2479. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  2480. * @brief Force or release APB2 peripheral reset.
  2481. * @{
  2482. */
  2483. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  2484. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  2485. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  2486. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  2487. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  2488. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  2489. #define __HAL_RCC_TIM10_RELEASE_RESET()(RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  2490. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  2491. /**
  2492. * @}
  2493. */
  2494. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  2495. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  2496. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2497. * power consumption.
  2498. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2499. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2500. * @{
  2501. */
  2502. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  2503. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  2504. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  2505. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  2506. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  2507. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  2508. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  2509. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  2510. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  2511. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  2512. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  2513. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  2514. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  2515. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  2516. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  2517. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  2518. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  2519. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  2520. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  2521. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  2522. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  2523. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  2524. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  2525. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  2526. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  2527. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  2528. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  2529. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  2530. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  2531. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  2532. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  2533. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  2534. /**
  2535. * @}
  2536. */
  2537. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  2538. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  2539. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2540. * power consumption.
  2541. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2542. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2543. * @{
  2544. */
  2545. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  2546. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  2547. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  2548. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  2549. #if defined(STM32F407xx)|| defined(STM32F417xx)
  2550. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  2551. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  2552. #endif /* STM32F407xx || STM32F417xx */
  2553. #if defined(STM32F415xx) || defined(STM32F417xx)
  2554. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  2555. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  2556. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  2557. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  2558. #endif /* STM32F415xx || STM32F417xx */
  2559. /**
  2560. * @}
  2561. */
  2562. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  2563. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  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_FSMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FSMCLPEN))
  2571. #define __HAL_RCC_FSMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FSMCLPEN))
  2572. /**
  2573. * @}
  2574. */
  2575. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  2576. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  2577. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2578. * power consumption.
  2579. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2580. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2581. * @{
  2582. */
  2583. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  2584. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  2585. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  2586. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  2587. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  2588. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  2589. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  2590. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  2591. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  2592. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  2593. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  2594. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  2595. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  2596. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  2597. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  2598. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  2599. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  2600. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  2601. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  2602. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  2603. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  2604. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  2605. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  2606. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  2607. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  2608. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  2609. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  2610. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  2611. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  2612. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  2613. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  2614. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  2615. /**
  2616. * @}
  2617. */
  2618. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  2619. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  2620. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2621. * power consumption.
  2622. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2623. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2624. * @{
  2625. */
  2626. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  2627. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  2628. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  2629. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  2630. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  2631. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  2632. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  2633. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  2634. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  2635. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  2636. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  2637. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  2638. /**
  2639. * @}
  2640. */
  2641. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
  2642. /*----------------------------------------------------------------------------*/
  2643. /*------------------------- STM32F401xE/STM32F401xC --------------------------*/
  2644. #if defined(STM32F401xC) || defined(STM32F401xE)
  2645. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  2646. * @brief Enable or disable the AHB1 peripheral clock.
  2647. * @note After reset, the peripheral clock (used for registers read/write access)
  2648. * is disabled and the application software has to enable this clock before
  2649. * using it.
  2650. * @{
  2651. */
  2652. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  2653. __IO uint32_t tmpreg = 0x00U; \
  2654. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  2655. /* Delay after an RCC peripheral clock enabling */ \
  2656. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  2657. UNUSED(tmpreg); \
  2658. } while(0U)
  2659. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  2660. __IO uint32_t tmpreg = 0x00U; \
  2661. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  2662. /* Delay after an RCC peripheral clock enabling */ \
  2663. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  2664. UNUSED(tmpreg); \
  2665. } while(0U)
  2666. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  2667. __IO uint32_t tmpreg = 0x00U; \
  2668. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  2669. /* Delay after an RCC peripheral clock enabling */ \
  2670. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  2671. UNUSED(tmpreg); \
  2672. } while(0U)
  2673. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  2674. __IO uint32_t tmpreg = 0x00U; \
  2675. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  2676. /* Delay after an RCC peripheral clock enabling */ \
  2677. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  2678. UNUSED(tmpreg); \
  2679. } while(0U)
  2680. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  2681. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  2682. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  2683. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  2684. /**
  2685. * @}
  2686. */
  2687. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  2688. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  2689. * @note After reset, the peripheral clock (used for registers read/write access)
  2690. * is disabled and the application software has to enable this clock before
  2691. * using it.
  2692. * @{
  2693. */
  2694. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  2695. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  2696. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  2697. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  2698. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  2699. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  2700. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  2701. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  2702. /**
  2703. * @}
  2704. */
  2705. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  2706. * @brief Enable or disable the AHB2 peripheral clock.
  2707. * @note After reset, the peripheral clock (used for registers read/write access)
  2708. * is disabled and the application software has to enable this clock before
  2709. * using it.
  2710. * @{
  2711. */
  2712. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  2713. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  2714. }while(0U)
  2715. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  2716. /**
  2717. * @}
  2718. */
  2719. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  2720. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  2721. * @note After reset, the peripheral clock (used for registers read/write access)
  2722. * is disabled and the application software has to enable this clock before
  2723. * using it.
  2724. * @{
  2725. */
  2726. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  2727. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  2728. /**
  2729. * @}
  2730. */
  2731. /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  2732. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  2733. * @note After reset, the peripheral clock (used for registers read/write access)
  2734. * is disabled and the application software has to enable this clock before
  2735. * using it.
  2736. * @{
  2737. */
  2738. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  2739. __IO uint32_t tmpreg = 0x00U; \
  2740. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2741. /* Delay after an RCC peripheral clock enabling */ \
  2742. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  2743. UNUSED(tmpreg); \
  2744. } while(0U)
  2745. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  2746. __IO uint32_t tmpreg = 0x00U; \
  2747. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2748. /* Delay after an RCC peripheral clock enabling */ \
  2749. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  2750. UNUSED(tmpreg); \
  2751. } while(0U)
  2752. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  2753. __IO uint32_t tmpreg = 0x00U; \
  2754. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2755. /* Delay after an RCC peripheral clock enabling */ \
  2756. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  2757. UNUSED(tmpreg); \
  2758. } while(0U)
  2759. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  2760. __IO uint32_t tmpreg = 0x00U; \
  2761. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2762. /* Delay after an RCC peripheral clock enabling */ \
  2763. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  2764. UNUSED(tmpreg); \
  2765. } while(0U)
  2766. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  2767. __IO uint32_t tmpreg = 0x00U; \
  2768. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2769. /* Delay after an RCC peripheral clock enabling */ \
  2770. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  2771. UNUSED(tmpreg); \
  2772. } while(0U)
  2773. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  2774. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  2775. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  2776. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  2777. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  2778. /**
  2779. * @}
  2780. */
  2781. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  2782. * @brief Get the enable or disable status of the APB1 peripheral clock.
  2783. * @note After reset, the peripheral clock (used for registers read/write access)
  2784. * is disabled and the application software has to enable this clock before
  2785. * using it.
  2786. * @{
  2787. */
  2788. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  2789. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  2790. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  2791. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  2792. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  2793. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  2794. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  2795. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  2796. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  2797. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  2798. /**
  2799. * @}
  2800. */
  2801. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  2802. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  2803. * @note After reset, the peripheral clock (used for registers read/write access)
  2804. * is disabled and the application software has to enable this clock before
  2805. * using it.
  2806. * @{
  2807. */
  2808. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  2809. __IO uint32_t tmpreg = 0x00U; \
  2810. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2811. /* Delay after an RCC peripheral clock enabling */ \
  2812. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  2813. UNUSED(tmpreg); \
  2814. } while(0U)
  2815. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  2816. __IO uint32_t tmpreg = 0x00U; \
  2817. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2818. /* Delay after an RCC peripheral clock enabling */ \
  2819. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  2820. UNUSED(tmpreg); \
  2821. } while(0U)
  2822. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  2823. __IO uint32_t tmpreg = 0x00U; \
  2824. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2825. /* Delay after an RCC peripheral clock enabling */ \
  2826. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  2827. UNUSED(tmpreg); \
  2828. } while(0U)
  2829. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  2830. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  2831. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  2832. /**
  2833. * @}
  2834. */
  2835. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  2836. * @brief Get the enable or disable status of the APB2 peripheral clock.
  2837. * @note After reset, the peripheral clock (used for registers read/write access)
  2838. * is disabled and the application software has to enable this clock before
  2839. * using it.
  2840. * @{
  2841. */
  2842. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  2843. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  2844. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  2845. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  2846. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  2847. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  2848. /**
  2849. * @}
  2850. */
  2851. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  2852. * @brief Force or release AHB1 peripheral reset.
  2853. * @{
  2854. */
  2855. #define __HAL_RCC_AHB1_FORCE_RESET() (RCC->AHB1RSTR = 0xFFFFFFFFU)
  2856. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  2857. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  2858. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  2859. #define __HAL_RCC_AHB1_RELEASE_RESET() (RCC->AHB1RSTR = 0x00U)
  2860. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  2861. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  2862. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  2863. /**
  2864. * @}
  2865. */
  2866. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  2867. * @brief Force or release AHB2 peripheral reset.
  2868. * @{
  2869. */
  2870. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  2871. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  2872. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  2873. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  2874. /**
  2875. * @}
  2876. */
  2877. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  2878. * @brief Force or release APB1 peripheral reset.
  2879. * @{
  2880. */
  2881. #define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB1RSTR = 0xFFFFFFFFU)
  2882. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  2883. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  2884. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  2885. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  2886. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  2887. #define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00U)
  2888. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  2889. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  2890. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  2891. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  2892. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  2893. /**
  2894. * @}
  2895. */
  2896. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  2897. * @brief Force or release APB2 peripheral reset.
  2898. * @{
  2899. */
  2900. #define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU)
  2901. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  2902. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  2903. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  2904. #define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00U)
  2905. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  2906. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  2907. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  2908. /**
  2909. * @}
  2910. */
  2911. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  2912. * @brief Force or release AHB3 peripheral reset.
  2913. * @{
  2914. */
  2915. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  2916. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  2917. /**
  2918. * @}
  2919. */
  2920. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  2921. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  2922. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2923. * power consumption.
  2924. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2925. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2926. * @{
  2927. */
  2928. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  2929. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  2930. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  2931. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  2932. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  2933. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  2934. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  2935. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  2936. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  2937. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  2938. /**
  2939. * @}
  2940. */
  2941. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  2942. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  2943. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2944. * power consumption.
  2945. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2946. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2947. * @{
  2948. */
  2949. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  2950. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  2951. /**
  2952. * @}
  2953. */
  2954. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  2955. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  2956. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2957. * power consumption.
  2958. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2959. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2960. * @{
  2961. */
  2962. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  2963. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  2964. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  2965. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  2966. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  2967. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  2968. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  2969. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  2970. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  2971. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  2972. /**
  2973. * @}
  2974. */
  2975. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  2976. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  2977. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2978. * power consumption.
  2979. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  2980. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2981. * @{
  2982. */
  2983. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  2984. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  2985. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  2986. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  2987. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  2988. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  2989. /**
  2990. * @}
  2991. */
  2992. #endif /* STM32F401xC || STM32F401xE*/
  2993. /*----------------------------------------------------------------------------*/
  2994. /*-------------------------------- STM32F410xx -------------------------------*/
  2995. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  2996. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  2997. * @brief Enables or disables the AHB1 peripheral clock.
  2998. * @note After reset, the peripheral clock (used for registers read/write access)
  2999. * is disabled and the application software has to enable this clock before
  3000. * using it.
  3001. * @{
  3002. */
  3003. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  3004. __IO uint32_t tmpreg = 0x00U; \
  3005. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3006. /* Delay after an RCC peripheral clock enabling */ \
  3007. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3008. UNUSED(tmpreg); \
  3009. } while(0U)
  3010. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  3011. __IO uint32_t tmpreg = 0x00U; \
  3012. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_RNGEN);\
  3013. /* Delay after an RCC peripheral clock enabling */ \
  3014. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_RNGEN);\
  3015. UNUSED(tmpreg); \
  3016. } while(0U)
  3017. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  3018. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_RNGEN))
  3019. /**
  3020. * @}
  3021. */
  3022. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  3023. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  3024. * @note After reset, the peripheral clock (used for registers read/write access)
  3025. * is disabled and the application software has to enable this clock before
  3026. * using it.
  3027. * @{
  3028. */
  3029. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  3030. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_RNGEN)) != RESET)
  3031. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  3032. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_RNGEN)) == RESET)
  3033. /**
  3034. * @}
  3035. */
  3036. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  3037. * @brief Enable or disable the High Speed APB (APB1) peripheral clock.
  3038. * @{
  3039. */
  3040. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  3041. __IO uint32_t tmpreg = 0x00U; \
  3042. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3043. /* Delay after an RCC peripheral clock enabling */ \
  3044. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3045. UNUSED(tmpreg); \
  3046. } while(0U)
  3047. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  3048. __IO uint32_t tmpreg = 0x00U; \
  3049. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  3050. /* Delay after an RCC peripheral clock enabling */ \
  3051. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  3052. UNUSED(tmpreg); \
  3053. } while(0U)
  3054. #define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \
  3055. __IO uint32_t tmpreg = 0x00U; \
  3056. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  3057. /* Delay after an RCC peripheral clock enabling */ \
  3058. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  3059. UNUSED(tmpreg); \
  3060. } while(0U)
  3061. #define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \
  3062. __IO uint32_t tmpreg = 0x00U; \
  3063. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3064. /* Delay after an RCC peripheral clock enabling */ \
  3065. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3066. UNUSED(tmpreg); \
  3067. } while(0U)
  3068. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  3069. __IO uint32_t tmpreg = 0x00U; \
  3070. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3071. /* Delay after an RCC peripheral clock enabling */ \
  3072. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3073. UNUSED(tmpreg); \
  3074. } while(0U)
  3075. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  3076. #define __HAL_RCC_RTCAPB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCAPBEN))
  3077. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  3078. #define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN))
  3079. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  3080. /**
  3081. * @}
  3082. */
  3083. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  3084. * @brief Get the enable or disable status of the APB1 peripheral clock.
  3085. * @note After reset, the peripheral clock (used for registers read/write access)
  3086. * is disabled and the application software has to enable this clock before
  3087. * using it.
  3088. * @{
  3089. */
  3090. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  3091. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) != RESET)
  3092. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  3093. #define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET)
  3094. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  3095. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  3096. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) == RESET)
  3097. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  3098. #define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET)
  3099. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  3100. /**
  3101. * @}
  3102. */
  3103. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  3104. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  3105. * @{
  3106. */
  3107. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  3108. __IO uint32_t tmpreg = 0x00U; \
  3109. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3110. /* Delay after an RCC peripheral clock enabling */ \
  3111. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3112. UNUSED(tmpreg); \
  3113. } while(0U)
  3114. #define __HAL_RCC_EXTIT_CLK_ENABLE() do { \
  3115. __IO uint32_t tmpreg = 0x00U; \
  3116. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  3117. /* Delay after an RCC peripheral clock enabling */ \
  3118. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  3119. UNUSED(tmpreg); \
  3120. } while(0U)
  3121. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  3122. #define __HAL_RCC_EXTIT_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_EXTITEN))
  3123. /**
  3124. * @}
  3125. */
  3126. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  3127. * @brief Get the enable or disable status of the APB2 peripheral clock.
  3128. * @note After reset, the peripheral clock (used for registers read/write access)
  3129. * is disabled and the application software has to enable this clock before
  3130. * using it.
  3131. * @{
  3132. */
  3133. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  3134. #define __HAL_RCC_EXTIT_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) != RESET)
  3135. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  3136. #define __HAL_RCC_EXTIT_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) == RESET)
  3137. /**
  3138. * @}
  3139. */
  3140. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  3141. * @brief Force or release AHB1 peripheral reset.
  3142. * @{
  3143. */
  3144. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  3145. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_RNGRST))
  3146. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  3147. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_RNGRST))
  3148. /**
  3149. * @}
  3150. */
  3151. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  3152. * @brief Force or release AHB2 peripheral reset.
  3153. * @{
  3154. */
  3155. #define __HAL_RCC_AHB2_FORCE_RESET()
  3156. #define __HAL_RCC_AHB2_RELEASE_RESET()
  3157. /**
  3158. * @}
  3159. */
  3160. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  3161. * @brief Force or release AHB3 peripheral reset.
  3162. * @{
  3163. */
  3164. #define __HAL_RCC_AHB3_FORCE_RESET()
  3165. #define __HAL_RCC_AHB3_RELEASE_RESET()
  3166. /**
  3167. * @}
  3168. */
  3169. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  3170. * @brief Force or release APB1 peripheral reset.
  3171. * @{
  3172. */
  3173. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  3174. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  3175. #define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST))
  3176. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  3177. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  3178. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  3179. #define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST))
  3180. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  3181. /**
  3182. * @}
  3183. */
  3184. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  3185. * @brief Force or release APB2 peripheral reset.
  3186. * @{
  3187. */
  3188. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  3189. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  3190. /**
  3191. * @}
  3192. */
  3193. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  3194. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  3195. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  3196. * power consumption.
  3197. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  3198. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  3199. * @{
  3200. */
  3201. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_RNGLPEN))
  3202. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  3203. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  3204. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  3205. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_RNGLPEN))
  3206. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  3207. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  3208. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  3209. /**
  3210. * @}
  3211. */
  3212. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  3213. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  3214. * @{
  3215. */
  3216. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  3217. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  3218. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCAPBLPEN))
  3219. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN))
  3220. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  3221. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  3222. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  3223. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCAPBLPEN))
  3224. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN))
  3225. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  3226. /**
  3227. * @}
  3228. */
  3229. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  3230. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  3231. * @{
  3232. */
  3233. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  3234. #define __HAL_RCC_EXTIT_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_EXTITLPEN))
  3235. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  3236. #define __HAL_RCC_EXTIT_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_EXTITLPEN))
  3237. /**
  3238. * @}
  3239. */
  3240. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  3241. /*----------------------------------------------------------------------------*/
  3242. /*-------------------------------- STM32F411xx -------------------------------*/
  3243. #if defined(STM32F411xE)
  3244. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  3245. * @brief Enables or disables the AHB1 peripheral clock.
  3246. * @note After reset, the peripheral clock (used for registers read/write access)
  3247. * is disabled and the application software has to enable this clock before
  3248. * using it.
  3249. * @{
  3250. */
  3251. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  3252. __IO uint32_t tmpreg = 0x00U; \
  3253. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3254. /* Delay after an RCC peripheral clock enabling */ \
  3255. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3256. UNUSED(tmpreg); \
  3257. } while(0U)
  3258. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  3259. __IO uint32_t tmpreg = 0x00U; \
  3260. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3261. /* Delay after an RCC peripheral clock enabling */ \
  3262. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3263. UNUSED(tmpreg); \
  3264. } while(0U)
  3265. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  3266. __IO uint32_t tmpreg = 0x00U; \
  3267. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3268. /* Delay after an RCC peripheral clock enabling */ \
  3269. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3270. UNUSED(tmpreg); \
  3271. } while(0U)
  3272. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  3273. __IO uint32_t tmpreg = 0x00U; \
  3274. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3275. /* Delay after an RCC peripheral clock enabling */ \
  3276. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3277. UNUSED(tmpreg); \
  3278. } while(0U)
  3279. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  3280. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  3281. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  3282. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  3283. /**
  3284. * @}
  3285. */
  3286. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  3287. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  3288. * @note After reset, the peripheral clock (used for registers read/write access)
  3289. * is disabled and the application software has to enable this clock before
  3290. * using it.
  3291. * @{
  3292. */
  3293. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  3294. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  3295. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) != RESET)
  3296. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  3297. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  3298. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  3299. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  3300. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  3301. /**
  3302. * @}
  3303. */
  3304. /** @defgroup RCCEX_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  3305. * @brief Enable or disable the AHB2 peripheral clock.
  3306. * @note After reset, the peripheral clock (used for registers read/write access)
  3307. * is disabled and the application software has to enable this clock before
  3308. * using it.
  3309. * @{
  3310. */
  3311. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  3312. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  3313. }while(0U)
  3314. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  3315. /**
  3316. * @}
  3317. */
  3318. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  3319. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  3320. * @note After reset, the peripheral clock (used for registers read/write access)
  3321. * is disabled and the application software has to enable this clock before
  3322. * using it.
  3323. * @{
  3324. */
  3325. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  3326. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  3327. /**
  3328. * @}
  3329. */
  3330. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  3331. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  3332. * @note After reset, the peripheral clock (used for registers read/write access)
  3333. * is disabled and the application software has to enable this clock before
  3334. * using it.
  3335. * @{
  3336. */
  3337. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  3338. __IO uint32_t tmpreg = 0x00U; \
  3339. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3340. /* Delay after an RCC peripheral clock enabling */ \
  3341. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3342. UNUSED(tmpreg); \
  3343. } while(0U)
  3344. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  3345. __IO uint32_t tmpreg = 0x00U; \
  3346. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3347. /* Delay after an RCC peripheral clock enabling */ \
  3348. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3349. UNUSED(tmpreg); \
  3350. } while(0U)
  3351. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  3352. __IO uint32_t tmpreg = 0x00U; \
  3353. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3354. /* Delay after an RCC peripheral clock enabling */ \
  3355. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3356. UNUSED(tmpreg); \
  3357. } while(0U)
  3358. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  3359. __IO uint32_t tmpreg = 0x00U; \
  3360. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3361. /* Delay after an RCC peripheral clock enabling */ \
  3362. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3363. UNUSED(tmpreg); \
  3364. } while(0U)
  3365. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  3366. __IO uint32_t tmpreg = 0x00U; \
  3367. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3368. /* Delay after an RCC peripheral clock enabling */ \
  3369. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3370. UNUSED(tmpreg); \
  3371. } while(0U)
  3372. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  3373. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  3374. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  3375. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  3376. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  3377. /**
  3378. * @}
  3379. */
  3380. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  3381. * @brief Get the enable or disable status of the APB1 peripheral clock.
  3382. * @note After reset, the peripheral clock (used for registers read/write access)
  3383. * is disabled and the application software has to enable this clock before
  3384. * using it.
  3385. * @{
  3386. */
  3387. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  3388. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  3389. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  3390. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  3391. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  3392. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  3393. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  3394. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  3395. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  3396. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  3397. /**
  3398. * @}
  3399. */
  3400. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  3401. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  3402. * @{
  3403. */
  3404. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  3405. __IO uint32_t tmpreg = 0x00U; \
  3406. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3407. /* Delay after an RCC peripheral clock enabling */ \
  3408. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  3409. UNUSED(tmpreg); \
  3410. } while(0U)
  3411. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  3412. __IO uint32_t tmpreg = 0x00U; \
  3413. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  3414. /* Delay after an RCC peripheral clock enabling */ \
  3415. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  3416. UNUSED(tmpreg); \
  3417. } while(0U)
  3418. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  3419. __IO uint32_t tmpreg = 0x00U; \
  3420. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  3421. /* Delay after an RCC peripheral clock enabling */ \
  3422. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  3423. UNUSED(tmpreg); \
  3424. } while(0U)
  3425. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  3426. __IO uint32_t tmpreg = 0x00U; \
  3427. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  3428. /* Delay after an RCC peripheral clock enabling */ \
  3429. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  3430. UNUSED(tmpreg); \
  3431. } while(0U)
  3432. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  3433. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  3434. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  3435. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  3436. /**
  3437. * @}
  3438. */
  3439. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  3440. * @brief Get the enable or disable status of the APB2 peripheral clock.
  3441. * @note After reset, the peripheral clock (used for registers read/write access)
  3442. * is disabled and the application software has to enable this clock before
  3443. * using it.
  3444. * @{
  3445. */
  3446. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  3447. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  3448. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  3449. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  3450. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  3451. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  3452. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  3453. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  3454. /**
  3455. * @}
  3456. */
  3457. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  3458. * @brief Force or release AHB1 peripheral reset.
  3459. * @{
  3460. */
  3461. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  3462. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  3463. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  3464. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  3465. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  3466. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  3467. /**
  3468. * @}
  3469. */
  3470. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  3471. * @brief Force or release AHB2 peripheral reset.
  3472. * @{
  3473. */
  3474. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  3475. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  3476. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  3477. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  3478. /**
  3479. * @}
  3480. */
  3481. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  3482. * @brief Force or release AHB3 peripheral reset.
  3483. * @{
  3484. */
  3485. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  3486. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  3487. /**
  3488. * @}
  3489. */
  3490. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  3491. * @brief Force or release APB1 peripheral reset.
  3492. * @{
  3493. */
  3494. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  3495. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  3496. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  3497. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  3498. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  3499. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  3500. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  3501. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  3502. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  3503. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  3504. /**
  3505. * @}
  3506. */
  3507. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  3508. * @brief Force or release APB2 peripheral reset.
  3509. * @{
  3510. */
  3511. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  3512. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  3513. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  3514. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  3515. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  3516. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  3517. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  3518. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  3519. /**
  3520. * @}
  3521. */
  3522. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  3523. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  3524. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  3525. * power consumption.
  3526. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  3527. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  3528. * @{
  3529. */
  3530. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  3531. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  3532. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  3533. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  3534. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  3535. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  3536. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  3537. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  3538. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  3539. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  3540. /**
  3541. * @}
  3542. */
  3543. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  3544. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  3545. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  3546. * power consumption.
  3547. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  3548. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  3549. * @{
  3550. */
  3551. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  3552. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  3553. /**
  3554. * @}
  3555. */
  3556. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  3557. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  3558. * @{
  3559. */
  3560. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  3561. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  3562. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  3563. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  3564. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  3565. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  3566. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  3567. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  3568. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  3569. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  3570. /**
  3571. * @}
  3572. */
  3573. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  3574. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  3575. * @{
  3576. */
  3577. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  3578. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  3579. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  3580. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  3581. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  3582. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  3583. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  3584. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  3585. /**
  3586. * @}
  3587. */
  3588. #endif /* STM32F411xE */
  3589. /*----------------------------------------------------------------------------*/
  3590. /*---------------------------------- STM32F446xx -----------------------------*/
  3591. #if defined(STM32F446xx)
  3592. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  3593. * @brief Enables or disables the AHB1 peripheral clock.
  3594. * @note After reset, the peripheral clock (used for registers read/write access)
  3595. * is disabled and the application software has to enable this clock before
  3596. * using it.
  3597. * @{
  3598. */
  3599. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  3600. __IO uint32_t tmpreg = 0x00U; \
  3601. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  3602. /* Delay after an RCC peripheral clock enabling */ \
  3603. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  3604. UNUSED(tmpreg); \
  3605. } while(0U)
  3606. #define __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() do { \
  3607. __IO uint32_t tmpreg = 0x00U; \
  3608. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3609. /* Delay after an RCC peripheral clock enabling */ \
  3610. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CCMDATARAMEN);\
  3611. UNUSED(tmpreg); \
  3612. } while(0U)
  3613. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  3614. __IO uint32_t tmpreg = 0x00U; \
  3615. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3616. /* Delay after an RCC peripheral clock enabling */ \
  3617. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  3618. UNUSED(tmpreg); \
  3619. } while(0U)
  3620. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  3621. __IO uint32_t tmpreg = 0x00U; \
  3622. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3623. /* Delay after an RCC peripheral clock enabling */ \
  3624. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  3625. UNUSED(tmpreg); \
  3626. } while(0U)
  3627. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  3628. __IO uint32_t tmpreg = 0x00U; \
  3629. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3630. /* Delay after an RCC peripheral clock enabling */ \
  3631. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  3632. UNUSED(tmpreg); \
  3633. } while(0U)
  3634. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  3635. __IO uint32_t tmpreg = 0x00U; \
  3636. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  3637. /* Delay after an RCC peripheral clock enabling */ \
  3638. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  3639. UNUSED(tmpreg); \
  3640. } while(0U)
  3641. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  3642. __IO uint32_t tmpreg = 0x00U; \
  3643. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  3644. /* Delay after an RCC peripheral clock enabling */ \
  3645. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  3646. UNUSED(tmpreg); \
  3647. } while(0U)
  3648. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  3649. __IO uint32_t tmpreg = 0x00U; \
  3650. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  3651. /* Delay after an RCC peripheral clock enabling */ \
  3652. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  3653. UNUSED(tmpreg); \
  3654. } while(0U)
  3655. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  3656. __IO uint32_t tmpreg = 0x00U; \
  3657. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  3658. /* Delay after an RCC peripheral clock enabling */ \
  3659. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  3660. UNUSED(tmpreg); \
  3661. } while(0U)
  3662. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  3663. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  3664. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  3665. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  3666. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  3667. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  3668. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  3669. #define __HAL_RCC_CCMDATARAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CCMDATARAMEN))
  3670. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  3671. /**
  3672. * @}
  3673. */
  3674. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  3675. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  3676. * @note After reset, the peripheral clock (used for registers read/write access)
  3677. * is disabled and the application software has to enable this clock before
  3678. * using it.
  3679. * @{
  3680. */
  3681. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  3682. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  3683. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  3684. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  3685. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  3686. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  3687. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  3688. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN))!= RESET)
  3689. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  3690. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  3691. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  3692. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  3693. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  3694. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  3695. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  3696. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  3697. #define __HAL_RCC_CCMDATARAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CCMDATARAMEN)) == RESET)
  3698. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  3699. /**
  3700. * @}
  3701. */
  3702. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  3703. * @brief Enable or disable the AHB2 peripheral clock.
  3704. * @note After reset, the peripheral clock (used for registers read/write access)
  3705. * is disabled and the application software has to enable this clock before
  3706. * using it.
  3707. * @{
  3708. */
  3709. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  3710. __IO uint32_t tmpreg = 0x00U; \
  3711. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  3712. /* Delay after an RCC peripheral clock enabling */ \
  3713. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  3714. UNUSED(tmpreg); \
  3715. } while(0U)
  3716. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  3717. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  3718. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  3719. }while(0U)
  3720. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  3721. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  3722. __IO uint32_t tmpreg = 0x00U; \
  3723. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  3724. /* Delay after an RCC peripheral clock enabling */ \
  3725. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  3726. UNUSED(tmpreg); \
  3727. } while(0U)
  3728. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  3729. /**
  3730. * @}
  3731. */
  3732. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  3733. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  3734. * @note After reset, the peripheral clock (used for registers read/write access)
  3735. * is disabled and the application software has to enable this clock before
  3736. * using it.
  3737. * @{
  3738. */
  3739. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  3740. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  3741. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  3742. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  3743. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  3744. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  3745. /**
  3746. * @}
  3747. */
  3748. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  3749. * @brief Enables or disables the AHB3 peripheral clock.
  3750. * @note After reset, the peripheral clock (used for registers read/write access)
  3751. * is disabled and the application software has to enable this clock before
  3752. * using it.
  3753. * @{
  3754. */
  3755. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  3756. __IO uint32_t tmpreg = 0x00U; \
  3757. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  3758. /* Delay after an RCC peripheral clock enabling */ \
  3759. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  3760. UNUSED(tmpreg); \
  3761. } while(0U)
  3762. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  3763. __IO uint32_t tmpreg = 0x00U; \
  3764. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  3765. /* Delay after an RCC peripheral clock enabling */ \
  3766. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  3767. UNUSED(tmpreg); \
  3768. } while(0U)
  3769. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  3770. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  3771. /**
  3772. * @}
  3773. */
  3774. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  3775. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  3776. * @note After reset, the peripheral clock (used for registers read/write access)
  3777. * is disabled and the application software has to enable this clock before
  3778. * using it.
  3779. * @{
  3780. */
  3781. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  3782. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  3783. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  3784. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  3785. /**
  3786. * @}
  3787. */
  3788. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  3789. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  3790. * @note After reset, the peripheral clock (used for registers read/write access)
  3791. * is disabled and the application software has to enable this clock before
  3792. * using it.
  3793. * @{
  3794. */
  3795. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  3796. __IO uint32_t tmpreg = 0x00U; \
  3797. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3798. /* Delay after an RCC peripheral clock enabling */ \
  3799. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  3800. UNUSED(tmpreg); \
  3801. } while(0U)
  3802. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  3803. __IO uint32_t tmpreg = 0x00U; \
  3804. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  3805. /* Delay after an RCC peripheral clock enabling */ \
  3806. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  3807. UNUSED(tmpreg); \
  3808. } while(0U)
  3809. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  3810. __IO uint32_t tmpreg = 0x00U; \
  3811. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  3812. /* Delay after an RCC peripheral clock enabling */ \
  3813. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  3814. UNUSED(tmpreg); \
  3815. } while(0U)
  3816. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  3817. __IO uint32_t tmpreg = 0x00U; \
  3818. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  3819. /* Delay after an RCC peripheral clock enabling */ \
  3820. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  3821. UNUSED(tmpreg); \
  3822. } while(0U)
  3823. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  3824. __IO uint32_t tmpreg = 0x00U; \
  3825. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  3826. /* Delay after an RCC peripheral clock enabling */ \
  3827. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  3828. UNUSED(tmpreg); \
  3829. } while(0U)
  3830. #define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \
  3831. __IO uint32_t tmpreg = 0x00U; \
  3832. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  3833. /* Delay after an RCC peripheral clock enabling */ \
  3834. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  3835. UNUSED(tmpreg); \
  3836. } while(0U)
  3837. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  3838. __IO uint32_t tmpreg = 0x00U; \
  3839. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  3840. /* Delay after an RCC peripheral clock enabling */ \
  3841. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  3842. UNUSED(tmpreg); \
  3843. } while(0U)
  3844. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  3845. __IO uint32_t tmpreg = 0x00U; \
  3846. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  3847. /* Delay after an RCC peripheral clock enabling */ \
  3848. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  3849. UNUSED(tmpreg); \
  3850. } while(0U)
  3851. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  3852. __IO uint32_t tmpreg = 0x00U; \
  3853. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  3854. /* Delay after an RCC peripheral clock enabling */ \
  3855. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  3856. UNUSED(tmpreg); \
  3857. } while(0U)
  3858. #define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \
  3859. __IO uint32_t tmpreg = 0x00U; \
  3860. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3861. /* Delay after an RCC peripheral clock enabling */ \
  3862. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  3863. UNUSED(tmpreg); \
  3864. } while(0U)
  3865. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  3866. __IO uint32_t tmpreg = 0x00U; \
  3867. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  3868. /* Delay after an RCC peripheral clock enabling */ \
  3869. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  3870. UNUSED(tmpreg); \
  3871. } while(0U)
  3872. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  3873. __IO uint32_t tmpreg = 0x00U; \
  3874. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  3875. /* Delay after an RCC peripheral clock enabling */ \
  3876. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  3877. UNUSED(tmpreg); \
  3878. } while(0U)
  3879. #define __HAL_RCC_CEC_CLK_ENABLE() do { \
  3880. __IO uint32_t tmpreg = 0x00U; \
  3881. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  3882. /* Delay after an RCC peripheral clock enabling */ \
  3883. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  3884. UNUSED(tmpreg); \
  3885. } while(0U)
  3886. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  3887. __IO uint32_t tmpreg = 0x00U; \
  3888. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3889. /* Delay after an RCC peripheral clock enabling */ \
  3890. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  3891. UNUSED(tmpreg); \
  3892. } while(0U)
  3893. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  3894. __IO uint32_t tmpreg = 0x00U; \
  3895. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3896. /* Delay after an RCC peripheral clock enabling */ \
  3897. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  3898. UNUSED(tmpreg); \
  3899. } while(0U)
  3900. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  3901. __IO uint32_t tmpreg = 0x00U; \
  3902. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3903. /* Delay after an RCC peripheral clock enabling */ \
  3904. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  3905. UNUSED(tmpreg); \
  3906. } while(0U)
  3907. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  3908. __IO uint32_t tmpreg = 0x00U; \
  3909. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3910. /* Delay after an RCC peripheral clock enabling */ \
  3911. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  3912. UNUSED(tmpreg); \
  3913. } while(0U)
  3914. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  3915. __IO uint32_t tmpreg = 0x00U; \
  3916. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3917. /* Delay after an RCC peripheral clock enabling */ \
  3918. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  3919. UNUSED(tmpreg); \
  3920. } while(0U)
  3921. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  3922. __IO uint32_t tmpreg = 0x00U; \
  3923. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3924. /* Delay after an RCC peripheral clock enabling */ \
  3925. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  3926. UNUSED(tmpreg); \
  3927. } while(0U)
  3928. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  3929. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  3930. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  3931. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  3932. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  3933. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  3934. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  3935. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  3936. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  3937. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  3938. #define __HAL_RCC_SPDIFRX_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPDIFRXEN))
  3939. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  3940. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  3941. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  3942. #define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN))
  3943. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  3944. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  3945. #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN))
  3946. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  3947. /**
  3948. * @}
  3949. */
  3950. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  3951. * @brief Get the enable or disable status of the APB1 peripheral clock.
  3952. * @note After reset, the peripheral clock (used for registers read/write access)
  3953. * is disabled and the application software has to enable this clock before
  3954. * using it.
  3955. * @{
  3956. */
  3957. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  3958. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  3959. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  3960. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  3961. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  3962. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  3963. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  3964. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  3965. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  3966. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  3967. #define __HAL_RCC_SPDIFRX_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) != RESET)
  3968. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  3969. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  3970. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  3971. #define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET)
  3972. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  3973. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  3974. #define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET)
  3975. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  3976. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  3977. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  3978. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  3979. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  3980. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  3981. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  3982. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  3983. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  3984. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  3985. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  3986. #define __HAL_RCC_SPDIFRX_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) == RESET)
  3987. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  3988. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  3989. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  3990. #define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET)
  3991. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  3992. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  3993. #define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET)
  3994. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  3995. /**
  3996. * @}
  3997. */
  3998. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  3999. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  4000. * @note After reset, the peripheral clock (used for registers read/write access)
  4001. * is disabled and the application software has to enable this clock before
  4002. * using it.
  4003. * @{
  4004. */
  4005. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  4006. __IO uint32_t tmpreg = 0x00U; \
  4007. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4008. /* Delay after an RCC peripheral clock enabling */ \
  4009. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4010. UNUSED(tmpreg); \
  4011. } while(0U)
  4012. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  4013. __IO uint32_t tmpreg = 0x00U; \
  4014. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  4015. /* Delay after an RCC peripheral clock enabling */ \
  4016. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  4017. UNUSED(tmpreg); \
  4018. } while(0U)
  4019. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  4020. __IO uint32_t tmpreg = 0x00U; \
  4021. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  4022. /* Delay after an RCC peripheral clock enabling */ \
  4023. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  4024. UNUSED(tmpreg); \
  4025. } while(0U)
  4026. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  4027. __IO uint32_t tmpreg = 0x00U; \
  4028. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4029. /* Delay after an RCC peripheral clock enabling */ \
  4030. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4031. UNUSED(tmpreg); \
  4032. } while(0U)
  4033. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  4034. __IO uint32_t tmpreg = 0x00U; \
  4035. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  4036. /* Delay after an RCC peripheral clock enabling */ \
  4037. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  4038. UNUSED(tmpreg); \
  4039. } while(0U)
  4040. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  4041. __IO uint32_t tmpreg = 0x00U; \
  4042. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4043. /* Delay after an RCC peripheral clock enabling */ \
  4044. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4045. UNUSED(tmpreg); \
  4046. } while(0U)
  4047. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  4048. __IO uint32_t tmpreg = 0x00U; \
  4049. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4050. /* Delay after an RCC peripheral clock enabling */ \
  4051. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4052. UNUSED(tmpreg); \
  4053. } while(0U)
  4054. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  4055. __IO uint32_t tmpreg = 0x00U; \
  4056. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4057. /* Delay after an RCC peripheral clock enabling */ \
  4058. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4059. UNUSED(tmpreg); \
  4060. } while(0U)
  4061. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  4062. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  4063. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  4064. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  4065. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  4066. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  4067. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  4068. #define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI2EN))
  4069. /**
  4070. * @}
  4071. */
  4072. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  4073. * @brief Get the enable or disable status of the APB2 peripheral clock.
  4074. * @note After reset, the peripheral clock (used for registers read/write access)
  4075. * is disabled and the application software has to enable this clock before
  4076. * using it.
  4077. * @{
  4078. */
  4079. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  4080. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  4081. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  4082. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  4083. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  4084. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  4085. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  4086. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) != RESET)
  4087. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  4088. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  4089. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  4090. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  4091. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  4092. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  4093. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  4094. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) == RESET)
  4095. /**
  4096. * @}
  4097. */
  4098. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  4099. * @brief Force or release AHB1 peripheral reset.
  4100. * @{
  4101. */
  4102. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  4103. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  4104. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  4105. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  4106. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  4107. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  4108. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  4109. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  4110. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  4111. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  4112. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  4113. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  4114. /**
  4115. * @}
  4116. */
  4117. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  4118. * @brief Force or release AHB2 peripheral reset.
  4119. * @{
  4120. */
  4121. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  4122. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  4123. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  4124. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  4125. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  4126. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  4127. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  4128. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  4129. /**
  4130. * @}
  4131. */
  4132. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  4133. * @brief Force or release AHB3 peripheral reset.
  4134. * @{
  4135. */
  4136. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  4137. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  4138. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  4139. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  4140. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  4141. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  4142. /**
  4143. * @}
  4144. */
  4145. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  4146. * @brief Force or release APB1 peripheral reset.
  4147. * @{
  4148. */
  4149. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  4150. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  4151. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  4152. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  4153. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  4154. #define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPDIFRXRST))
  4155. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  4156. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  4157. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  4158. #define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST))
  4159. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  4160. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  4161. #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST))
  4162. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  4163. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  4164. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  4165. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  4166. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  4167. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  4168. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  4169. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  4170. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  4171. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  4172. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  4173. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  4174. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  4175. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  4176. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  4177. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  4178. #define __HAL_RCC_SPDIFRX_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPDIFRXRST))
  4179. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  4180. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  4181. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  4182. #define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST))
  4183. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  4184. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  4185. #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST))
  4186. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  4187. /**
  4188. * @}
  4189. */
  4190. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  4191. * @brief Force or release APB2 peripheral reset.
  4192. * @{
  4193. */
  4194. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  4195. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  4196. #define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI2RST))
  4197. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  4198. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  4199. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  4200. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  4201. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  4202. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  4203. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  4204. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  4205. #define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI2RST))
  4206. /**
  4207. * @}
  4208. */
  4209. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  4210. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  4211. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4212. * power consumption.
  4213. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4214. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4215. * @{
  4216. */
  4217. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  4218. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  4219. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  4220. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  4221. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  4222. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  4223. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  4224. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  4225. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  4226. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  4227. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  4228. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  4229. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  4230. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  4231. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  4232. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  4233. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  4234. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  4235. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  4236. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  4237. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  4238. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  4239. /**
  4240. * @}
  4241. */
  4242. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  4243. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  4244. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4245. * power consumption.
  4246. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  4247. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4248. * @{
  4249. */
  4250. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  4251. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  4252. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  4253. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  4254. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  4255. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  4256. /**
  4257. * @}
  4258. */
  4259. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  4260. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  4261. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4262. * power consumption.
  4263. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4264. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4265. * @{
  4266. */
  4267. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  4268. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  4269. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  4270. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  4271. /**
  4272. * @}
  4273. */
  4274. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  4275. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  4276. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4277. * power consumption.
  4278. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4279. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4280. * @{
  4281. */
  4282. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  4283. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  4284. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  4285. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  4286. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  4287. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPDIFRXLPEN))
  4288. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  4289. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  4290. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  4291. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN))
  4292. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  4293. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  4294. #define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CECLPEN))
  4295. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  4296. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  4297. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  4298. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  4299. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  4300. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  4301. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  4302. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  4303. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  4304. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  4305. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  4306. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  4307. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  4308. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  4309. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  4310. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  4311. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPDIFRXLPEN))
  4312. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  4313. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  4314. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  4315. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN))
  4316. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  4317. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  4318. #define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CECLPEN))
  4319. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  4320. /**
  4321. * @}
  4322. */
  4323. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  4324. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  4325. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  4326. * power consumption.
  4327. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  4328. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  4329. * @{
  4330. */
  4331. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  4332. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  4333. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  4334. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  4335. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI2LPEN))
  4336. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  4337. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  4338. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE()(RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  4339. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  4340. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  4341. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE()(RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  4342. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  4343. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  4344. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  4345. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  4346. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI2LPEN))
  4347. /**
  4348. * @}
  4349. */
  4350. #endif /* STM32F446xx */
  4351. /*----------------------------------------------------------------------------*/
  4352. /*-------STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx-------*/
  4353. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  4354. /** @defgroup RCCEx_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  4355. * @brief Enables or disables the AHB1 peripheral clock.
  4356. * @note After reset, the peripheral clock (used for registers read/write access)
  4357. * is disabled and the application software has to enable this clock before
  4358. * using it.
  4359. * @{
  4360. */
  4361. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  4362. __IO uint32_t tmpreg = 0x00U; \
  4363. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  4364. /* Delay after an RCC peripheral clock enabling */ \
  4365. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  4366. UNUSED(tmpreg); \
  4367. } while(0U)
  4368. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  4369. __IO uint32_t tmpreg = 0x00U; \
  4370. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  4371. /* Delay after an RCC peripheral clock enabling */ \
  4372. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  4373. UNUSED(tmpreg); \
  4374. } while(0U)
  4375. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  4376. __IO uint32_t tmpreg = 0x00U; \
  4377. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  4378. /* Delay after an RCC peripheral clock enabling */ \
  4379. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  4380. UNUSED(tmpreg); \
  4381. } while(0U)
  4382. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  4383. __IO uint32_t tmpreg = 0x00U; \
  4384. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  4385. /* Delay after an RCC peripheral clock enabling */ \
  4386. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  4387. UNUSED(tmpreg); \
  4388. } while(0U)
  4389. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  4390. __IO uint32_t tmpreg = 0x00U; \
  4391. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  4392. /* Delay after an RCC peripheral clock enabling */ \
  4393. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_CRCEN);\
  4394. UNUSED(tmpreg); \
  4395. } while(0U)
  4396. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  4397. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  4398. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  4399. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  4400. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_CRCEN))
  4401. /**
  4402. * @}
  4403. */
  4404. /** @defgroup RCCEx_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enable Disable Status
  4405. * @brief Get the enable or disable status of the AHB1 peripheral clock.
  4406. * @note After reset, the peripheral clock (used for registers read/write access)
  4407. * is disabled and the application software has to enable this clock before
  4408. * using it.
  4409. * @{
  4410. */
  4411. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  4412. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  4413. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  4414. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  4415. #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) != RESET)
  4416. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  4417. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  4418. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  4419. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  4420. #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_CRCEN)) == RESET)
  4421. /**
  4422. * @}
  4423. */
  4424. /** @defgroup RCCEx_AHB2_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  4425. * @brief Enable or disable the AHB2 peripheral clock.
  4426. * @note After reset, the peripheral clock (used for registers read/write access)
  4427. * is disabled and the application software has to enable this clock before
  4428. * using it.
  4429. * @{
  4430. */
  4431. #if defined(STM32F423xx)
  4432. #define __HAL_RCC_AES_CLK_ENABLE() do { \
  4433. __IO uint32_t tmpreg = 0x00U; \
  4434. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  4435. /* Delay after an RCC peripheral clock enabling */ \
  4436. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  4437. UNUSED(tmpreg); \
  4438. } while(0U)
  4439. #define __HAL_RCC_AES_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_AESEN))
  4440. #endif /* STM32F423xx */
  4441. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  4442. __IO uint32_t tmpreg = 0x00U; \
  4443. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  4444. /* Delay after an RCC peripheral clock enabling */ \
  4445. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  4446. UNUSED(tmpreg); \
  4447. } while(0U)
  4448. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  4449. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do {(RCC->AHB2ENR |= (RCC_AHB2ENR_OTGFSEN));\
  4450. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  4451. }while(0U)
  4452. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  4453. /**
  4454. * @}
  4455. */
  4456. /** @defgroup RCCEx_AHB2_Peripheral_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enable Disable Status
  4457. * @brief Get the enable or disable status of the AHB2 peripheral clock.
  4458. * @note After reset, the peripheral clock (used for registers read/write access)
  4459. * is disabled and the application software has to enable this clock before
  4460. * using it.
  4461. * @{
  4462. */
  4463. #if defined(STM32F423xx)
  4464. #define __HAL_RCC_AES_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) != RESET)
  4465. #define __HAL_RCC_AES_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) == RESET)
  4466. #endif /* STM32F423xx */
  4467. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  4468. #define __HAL_RCC_USB_OTG_FS_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  4469. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  4470. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  4471. /**
  4472. * @}
  4473. */
  4474. /** @defgroup RCCEx_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  4475. * @brief Enables or disables the AHB3 peripheral clock.
  4476. * @note After reset, the peripheral clock (used for registers read/write access)
  4477. * is disabled and the application software has to enable this clock before
  4478. * using it.
  4479. * @{
  4480. */
  4481. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4482. #define __HAL_RCC_FSMC_CLK_ENABLE() do { \
  4483. __IO uint32_t tmpreg = 0x00U; \
  4484. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  4485. /* Delay after an RCC peripheral clock enabling */ \
  4486. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);\
  4487. UNUSED(tmpreg); \
  4488. } while(0U)
  4489. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  4490. __IO uint32_t tmpreg = 0x00U; \
  4491. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  4492. /* Delay after an RCC peripheral clock enabling */ \
  4493. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  4494. UNUSED(tmpreg); \
  4495. } while(0U)
  4496. #define __HAL_RCC_FSMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FSMCEN))
  4497. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  4498. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4499. /**
  4500. * @}
  4501. */
  4502. /** @defgroup RCCEx_AHB3_Peripheral_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enable Disable Status
  4503. * @brief Get the enable or disable status of the AHB3 peripheral clock.
  4504. * @note After reset, the peripheral clock (used for registers read/write access)
  4505. * is disabled and the application software has to enable this clock before
  4506. * using it.
  4507. * @{
  4508. */
  4509. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4510. #define __HAL_RCC_FSMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) != RESET)
  4511. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  4512. #define __HAL_RCC_FSMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FSMCEN)) == RESET)
  4513. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  4514. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4515. /**
  4516. * @}
  4517. */
  4518. /** @defgroup RCCEx_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  4519. * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  4520. * @note After reset, the peripheral clock (used for registers read/write access)
  4521. * is disabled and the application software has to enable this clock before
  4522. * using it.
  4523. * @{
  4524. */
  4525. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  4526. __IO uint32_t tmpreg = 0x00U; \
  4527. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  4528. /* Delay after an RCC peripheral clock enabling */ \
  4529. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  4530. UNUSED(tmpreg); \
  4531. } while(0U)
  4532. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  4533. __IO uint32_t tmpreg = 0x00U; \
  4534. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  4535. /* Delay after an RCC peripheral clock enabling */ \
  4536. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  4537. UNUSED(tmpreg); \
  4538. } while(0U)
  4539. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  4540. __IO uint32_t tmpreg = 0x00U; \
  4541. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  4542. /* Delay after an RCC peripheral clock enabling */ \
  4543. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  4544. UNUSED(tmpreg); \
  4545. } while(0U)
  4546. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  4547. __IO uint32_t tmpreg = 0x00U; \
  4548. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  4549. /* Delay after an RCC peripheral clock enabling */ \
  4550. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  4551. UNUSED(tmpreg); \
  4552. } while(0U)
  4553. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  4554. __IO uint32_t tmpreg = 0x00U; \
  4555. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  4556. /* Delay after an RCC peripheral clock enabling */ \
  4557. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  4558. UNUSED(tmpreg); \
  4559. } while(0U)
  4560. #if defined(STM32F413xx) || defined(STM32F423xx)
  4561. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  4562. __IO uint32_t tmpreg = 0x00U; \
  4563. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  4564. /* Delay after an RCC peripheral clock enabling */ \
  4565. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  4566. UNUSED(tmpreg); \
  4567. } while(0U)
  4568. #endif /* STM32F413xx || STM32F423xx */
  4569. #define __HAL_RCC_RTCAPB_CLK_ENABLE() do { \
  4570. __IO uint32_t tmpreg = 0x00U; \
  4571. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  4572. /* Delay after an RCC peripheral clock enabling */ \
  4573. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCAPBEN);\
  4574. UNUSED(tmpreg); \
  4575. } while(0U)
  4576. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4577. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  4578. __IO uint32_t tmpreg = 0x00U; \
  4579. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  4580. /* Delay after an RCC peripheral clock enabling */ \
  4581. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  4582. UNUSED(tmpreg); \
  4583. } while(0U)
  4584. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4585. #if defined(STM32F413xx) || defined(STM32F423xx)
  4586. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  4587. __IO uint32_t tmpreg = 0x00U; \
  4588. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  4589. /* Delay after an RCC peripheral clock enabling */ \
  4590. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  4591. UNUSED(tmpreg); \
  4592. } while(0U)
  4593. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  4594. __IO uint32_t tmpreg = 0x00U; \
  4595. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  4596. /* Delay after an RCC peripheral clock enabling */ \
  4597. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  4598. UNUSED(tmpreg); \
  4599. } while(0U)
  4600. #endif /* STM32F413xx || STM32F423xx */
  4601. #define __HAL_RCC_FMPI2C1_CLK_ENABLE() do { \
  4602. __IO uint32_t tmpreg = 0x00U; \
  4603. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  4604. /* Delay after an RCC peripheral clock enabling */ \
  4605. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_FMPI2C1EN);\
  4606. UNUSED(tmpreg); \
  4607. } while(0U)
  4608. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  4609. __IO uint32_t tmpreg = 0x00U; \
  4610. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  4611. /* Delay after an RCC peripheral clock enabling */ \
  4612. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  4613. UNUSED(tmpreg); \
  4614. } while(0U)
  4615. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  4616. __IO uint32_t tmpreg = 0x00U; \
  4617. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  4618. /* Delay after an RCC peripheral clock enabling */ \
  4619. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  4620. UNUSED(tmpreg); \
  4621. } while(0U)
  4622. #if defined(STM32F413xx) || defined(STM32F423xx)
  4623. #define __HAL_RCC_CAN3_CLK_ENABLE() do { \
  4624. __IO uint32_t tmpreg = 0x00U; \
  4625. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  4626. /* Delay after an RCC peripheral clock enabling */ \
  4627. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  4628. UNUSED(tmpreg); \
  4629. } while(0U)
  4630. #endif /* STM32F413xx || STM32F423xx */
  4631. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  4632. __IO uint32_t tmpreg = 0x00U; \
  4633. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  4634. /* Delay after an RCC peripheral clock enabling */ \
  4635. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  4636. UNUSED(tmpreg); \
  4637. } while(0U)
  4638. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  4639. __IO uint32_t tmpreg = 0x00U; \
  4640. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  4641. /* Delay after an RCC peripheral clock enabling */ \
  4642. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  4643. UNUSED(tmpreg); \
  4644. } while(0U)
  4645. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  4646. __IO uint32_t tmpreg = 0x00U; \
  4647. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  4648. /* Delay after an RCC peripheral clock enabling */ \
  4649. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  4650. UNUSED(tmpreg); \
  4651. } while(0U)
  4652. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  4653. __IO uint32_t tmpreg = 0x00U; \
  4654. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  4655. /* Delay after an RCC peripheral clock enabling */ \
  4656. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  4657. UNUSED(tmpreg); \
  4658. } while(0U)
  4659. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  4660. __IO uint32_t tmpreg = 0x00U; \
  4661. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  4662. /* Delay after an RCC peripheral clock enabling */ \
  4663. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  4664. UNUSED(tmpreg); \
  4665. } while(0U)
  4666. #if defined(STM32F413xx) || defined(STM32F423xx)
  4667. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  4668. __IO uint32_t tmpreg = 0x00U; \
  4669. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  4670. /* Delay after an RCC peripheral clock enabling */ \
  4671. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  4672. UNUSED(tmpreg); \
  4673. } while(0U)
  4674. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  4675. __IO uint32_t tmpreg = 0x00U; \
  4676. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  4677. /* Delay after an RCC peripheral clock enabling */ \
  4678. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  4679. UNUSED(tmpreg); \
  4680. } while(0U)
  4681. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  4682. __IO uint32_t tmpreg = 0x00U; \
  4683. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  4684. /* Delay after an RCC peripheral clock enabling */ \
  4685. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  4686. UNUSED(tmpreg); \
  4687. } while(0U)
  4688. #endif /* STM32F413xx || STM32F423xx */
  4689. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  4690. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  4691. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  4692. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  4693. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  4694. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  4695. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  4696. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  4697. #if defined(STM32F413xx) || defined(STM32F423xx)
  4698. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  4699. #endif /* STM32F413xx || STM32F423xx */
  4700. #define __HAL_RCC_RTCAPB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCAPBEN))
  4701. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  4702. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4703. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  4704. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4705. #if defined(STM32F413xx) || defined(STM32F423xx)
  4706. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  4707. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  4708. #endif /* STM32F413xx || STM32F423xx */
  4709. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  4710. #define __HAL_RCC_FMPI2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_FMPI2C1EN))
  4711. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  4712. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  4713. #if defined(STM32F413xx) || defined(STM32F423xx)
  4714. #define __HAL_RCC_CAN3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN3EN))
  4715. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  4716. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  4717. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  4718. #endif /* STM32F413xx || STM32F423xx */
  4719. /**
  4720. * @}
  4721. */
  4722. /** @defgroup RCCEx_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
  4723. * @brief Get the enable or disable status of the APB1 peripheral clock.
  4724. * @note After reset, the peripheral clock (used for registers read/write access)
  4725. * is disabled and the application software has to enable this clock before
  4726. * using it.
  4727. * @{
  4728. */
  4729. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  4730. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  4731. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  4732. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  4733. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  4734. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  4735. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  4736. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  4737. #if defined(STM32F413xx) || defined(STM32F423xx)
  4738. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  4739. #endif /* STM32F413xx || STM32F423xx */
  4740. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) != RESET)
  4741. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  4742. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4743. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  4744. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx | STM32F423xx */
  4745. #if defined(STM32F413xx) || defined(STM32F423xx)
  4746. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  4747. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  4748. #endif /* STM32F413xx || STM32F423xx */
  4749. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  4750. #define __HAL_RCC_FMPI2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) != RESET)
  4751. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN))!= RESET)
  4752. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  4753. #if defined(STM32F413xx) || defined(STM32F423xx)
  4754. #define __HAL_RCC_CAN3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) != RESET)
  4755. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  4756. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  4757. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  4758. #endif /* STM32F413xx || STM32F423xx */
  4759. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  4760. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  4761. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  4762. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  4763. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  4764. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  4765. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  4766. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  4767. #if defined(STM32F413xx) || defined(STM32F423xx)
  4768. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  4769. #endif /* STM32F413xx || STM32F423xx */
  4770. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCAPBEN)) == RESET)
  4771. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  4772. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4773. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  4774. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx | STM32F423xx */
  4775. #if defined(STM32F413xx) || defined(STM32F423xx)
  4776. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  4777. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  4778. #endif /* STM32F413xx || STM32F423xx */
  4779. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  4780. #define __HAL_RCC_FMPI2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_FMPI2C1EN)) == RESET)
  4781. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  4782. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  4783. #if defined(STM32F413xx) || defined(STM32F423xx)
  4784. #define __HAL_RCC_CAN3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) == RESET)
  4785. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  4786. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  4787. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  4788. #endif /* STM32F413xx || STM32F423xx */
  4789. /**
  4790. * @}
  4791. */
  4792. /** @defgroup RCCEx_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  4793. * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  4794. * @note After reset, the peripheral clock (used for registers read/write access)
  4795. * is disabled and the application software has to enable this clock before
  4796. * using it.
  4797. * @{
  4798. */
  4799. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  4800. __IO uint32_t tmpreg = 0x00U; \
  4801. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4802. /* Delay after an RCC peripheral clock enabling */ \
  4803. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  4804. UNUSED(tmpreg); \
  4805. } while(0U)
  4806. #if defined(STM32F413xx) || defined(STM32F423xx)
  4807. #define __HAL_RCC_UART9_CLK_ENABLE() do { \
  4808. __IO uint32_t tmpreg = 0x00U; \
  4809. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_UART9EN);\
  4810. /* Delay after an RCC peripheral clock enabling */ \
  4811. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_UART9EN);\
  4812. UNUSED(tmpreg); \
  4813. } while(0U)
  4814. #define __HAL_RCC_UART10_CLK_ENABLE() do { \
  4815. __IO uint32_t tmpreg = 0x00U; \
  4816. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_UART10EN);\
  4817. /* Delay after an RCC peripheral clock enabling */ \
  4818. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_UART10EN);\
  4819. UNUSED(tmpreg); \
  4820. } while(0U)
  4821. #endif /* STM32F413xx || STM32F423xx */
  4822. #define __HAL_RCC_SDIO_CLK_ENABLE() do { \
  4823. __IO uint32_t tmpreg = 0x00U; \
  4824. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4825. /* Delay after an RCC peripheral clock enabling */ \
  4826. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDIOEN);\
  4827. UNUSED(tmpreg); \
  4828. } while(0U)
  4829. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  4830. __IO uint32_t tmpreg = 0x00U; \
  4831. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4832. /* Delay after an RCC peripheral clock enabling */ \
  4833. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  4834. UNUSED(tmpreg); \
  4835. } while(0U)
  4836. #define __HAL_RCC_EXTIT_CLK_ENABLE() do { \
  4837. __IO uint32_t tmpreg = 0x00U; \
  4838. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  4839. /* Delay after an RCC peripheral clock enabling */ \
  4840. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_EXTITEN);\
  4841. UNUSED(tmpreg); \
  4842. } while(0U)
  4843. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  4844. __IO uint32_t tmpreg = 0x00U; \
  4845. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4846. /* Delay after an RCC peripheral clock enabling */ \
  4847. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  4848. UNUSED(tmpreg); \
  4849. } while(0U)
  4850. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  4851. __IO uint32_t tmpreg = 0x00U; \
  4852. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  4853. /* Delay after an RCC peripheral clock enabling */ \
  4854. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  4855. UNUSED(tmpreg); \
  4856. } while(0U)
  4857. #if defined(STM32F413xx) || defined(STM32F423xx)
  4858. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  4859. __IO uint32_t tmpreg = 0x00U; \
  4860. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4861. /* Delay after an RCC peripheral clock enabling */ \
  4862. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  4863. UNUSED(tmpreg); \
  4864. } while(0U)
  4865. #endif /* STM32F413xx || STM32F423xx */
  4866. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  4867. __IO uint32_t tmpreg = 0x00U; \
  4868. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  4869. /* Delay after an RCC peripheral clock enabling */ \
  4870. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  4871. UNUSED(tmpreg); \
  4872. } while(0U)
  4873. #if defined(STM32F413xx) || defined(STM32F423xx)
  4874. #define __HAL_RCC_DFSDM2_CLK_ENABLE() do { \
  4875. __IO uint32_t tmpreg = 0x00U; \
  4876. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM2EN);\
  4877. /* Delay after an RCC peripheral clock enabling */ \
  4878. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM2EN);\
  4879. UNUSED(tmpreg); \
  4880. } while(0U)
  4881. #endif /* STM32F413xx || STM32F423xx */
  4882. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  4883. #if defined(STM32F413xx) || defined(STM32F423xx)
  4884. #define __HAL_RCC_UART9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_UART9EN))
  4885. #define __HAL_RCC_UART10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_UART10EN))
  4886. #endif /* STM32F413xx || STM32F423xx */
  4887. #define __HAL_RCC_SDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDIOEN))
  4888. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  4889. #define __HAL_RCC_EXTIT_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_EXTITEN))
  4890. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  4891. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  4892. #if defined(STM32F413xx) || defined(STM32F423xx)
  4893. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  4894. #endif /* STM32F413xx || STM32F423xx */
  4895. #define __HAL_RCC_DFSDM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM1EN))
  4896. #if defined(STM32F413xx) || defined(STM32F423xx)
  4897. #define __HAL_RCC_DFSDM2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM2EN))
  4898. #endif /* STM32F413xx || STM32F423xx */
  4899. /**
  4900. * @}
  4901. */
  4902. /** @defgroup RCCEx_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
  4903. * @brief Get the enable or disable status of the APB2 peripheral clock.
  4904. * @note After reset, the peripheral clock (used for registers read/write access)
  4905. * is disabled and the application software has to enable this clock before
  4906. * using it.
  4907. * @{
  4908. */
  4909. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  4910. #if defined(STM32F413xx) || defined(STM32F423xx)
  4911. #define __HAL_RCC_UART9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART9EN)) != RESET)
  4912. #define __HAL_RCC_UART10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART10EN)) != RESET)
  4913. #endif /* STM32F413xx || STM32F423xx */
  4914. #define __HAL_RCC_SDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) != RESET)
  4915. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  4916. #define __HAL_RCC_EXTIT_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) != RESET)
  4917. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  4918. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  4919. #if defined(STM32F413xx) || defined(STM32F423xx)
  4920. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  4921. #endif /* STM32F413xx || STM32F423xx */
  4922. #define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) != RESET)
  4923. #if defined(STM32F413xx) || defined(STM32F423xx)
  4924. #define __HAL_RCC_DFSDM2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM2EN)) != RESET)
  4925. #endif /* STM32F413xx || STM32F423xx */
  4926. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  4927. #if defined(STM32F413xx) || defined(STM32F423xx)
  4928. #define __HAL_RCC_UART9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART9EN)) == RESET)
  4929. #define __HAL_RCC_UART10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_UART10EN)) == RESET)
  4930. #endif /* STM32F413xx || STM32F423xx */
  4931. #define __HAL_RCC_SDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDIOEN)) == RESET)
  4932. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  4933. #define __HAL_RCC_EXTIT_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_EXTITEN)) == RESET)
  4934. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  4935. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  4936. #if defined(STM32F413xx) || defined(STM32F423xx)
  4937. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  4938. #endif /* STM32F413xx || STM32F423xx */
  4939. #define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) == RESET)
  4940. #if defined(STM32F413xx) || defined(STM32F423xx)
  4941. #define __HAL_RCC_DFSDM2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM2EN)) == RESET)
  4942. #endif /* STM32F413xx || STM32F423xx */
  4943. /**
  4944. * @}
  4945. */
  4946. /** @defgroup RCCEx_AHB1_Force_Release_Reset AHB1 Force Release Reset
  4947. * @brief Force or release AHB1 peripheral reset.
  4948. * @{
  4949. */
  4950. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  4951. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  4952. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  4953. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  4954. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_CRCRST))
  4955. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  4956. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  4957. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  4958. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  4959. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_CRCRST))
  4960. /**
  4961. * @}
  4962. */
  4963. /** @defgroup RCCEx_AHB2_Force_Release_Reset AHB2 Force Release Reset
  4964. * @brief Force or release AHB2 peripheral reset.
  4965. * @{
  4966. */
  4967. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  4968. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  4969. #if defined(STM32F423xx)
  4970. #define __HAL_RCC_AES_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_AESRST))
  4971. #define __HAL_RCC_AES_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_AESRST))
  4972. #endif /* STM32F423xx */
  4973. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  4974. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  4975. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  4976. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  4977. /**
  4978. * @}
  4979. */
  4980. /** @defgroup RCCEx_AHB3_Force_Release_Reset AHB3 Force Release Reset
  4981. * @brief Force or release AHB3 peripheral reset.
  4982. * @{
  4983. */
  4984. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  4985. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  4986. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  4987. #define __HAL_RCC_FSMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FSMCRST))
  4988. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  4989. #define __HAL_RCC_FSMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FSMCRST))
  4990. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  4991. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  4992. #if defined(STM32F412Cx)
  4993. #define __HAL_RCC_AHB3_FORCE_RESET()
  4994. #define __HAL_RCC_AHB3_RELEASE_RESET()
  4995. #define __HAL_RCC_FSMC_FORCE_RESET()
  4996. #define __HAL_RCC_QSPI_FORCE_RESET()
  4997. #define __HAL_RCC_FSMC_RELEASE_RESET()
  4998. #define __HAL_RCC_QSPI_RELEASE_RESET()
  4999. #endif /* STM32F412Cx */
  5000. /**
  5001. * @}
  5002. */
  5003. /** @defgroup RCCEx_APB1_Force_Release_Reset APB1 Force Release Reset
  5004. * @brief Force or release APB1 peripheral reset.
  5005. * @{
  5006. */
  5007. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  5008. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  5009. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  5010. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  5011. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  5012. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  5013. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  5014. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  5015. #if defined(STM32F413xx) || defined(STM32F423xx)
  5016. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  5017. #endif /* STM32F413xx || STM32F423xx */
  5018. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  5019. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5020. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  5021. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5022. #if defined(STM32F413xx) || defined(STM32F423xx)
  5023. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  5024. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  5025. #endif /* STM32F413xx || STM32F423xx */
  5026. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  5027. #define __HAL_RCC_FMPI2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_FMPI2C1RST))
  5028. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  5029. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  5030. #if defined(STM32F413xx) || defined(STM32F423xx)
  5031. #define __HAL_RCC_CAN3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN3RST))
  5032. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  5033. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  5034. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  5035. #endif /* STM32F413xx || STM32F423xx */
  5036. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  5037. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  5038. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  5039. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  5040. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  5041. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  5042. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  5043. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  5044. #if defined(STM32F413xx) || defined(STM32F423xx)
  5045. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  5046. #endif /* STM32F413xx || STM32F423xx */
  5047. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  5048. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5049. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  5050. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5051. #if defined(STM32F413xx) || defined(STM32F423xx)
  5052. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  5053. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  5054. #endif /* STM32F413xx || STM32F423xx */
  5055. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  5056. #define __HAL_RCC_FMPI2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_FMPI2C1RST))
  5057. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  5058. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  5059. #if defined(STM32F413xx) || defined(STM32F423xx)
  5060. #define __HAL_RCC_CAN3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN3RST))
  5061. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  5062. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  5063. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  5064. #endif /* STM32F413xx || STM32F423xx */
  5065. /**
  5066. * @}
  5067. */
  5068. /** @defgroup RCCEx_APB2_Force_Release_Reset APB2 Force Release Reset
  5069. * @brief Force or release APB2 peripheral reset.
  5070. * @{
  5071. */
  5072. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  5073. #if defined(STM32F413xx) || defined(STM32F423xx)
  5074. #define __HAL_RCC_UART9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_UART9RST))
  5075. #define __HAL_RCC_UART10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_UART10RST))
  5076. #endif /* STM32F413xx || STM32F423xx */
  5077. #define __HAL_RCC_SDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDIORST))
  5078. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  5079. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  5080. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  5081. #if defined(STM32F413xx) || defined(STM32F423xx)
  5082. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  5083. #endif /* STM32F413xx || STM32F423xx */
  5084. #define __HAL_RCC_DFSDM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM1RST))
  5085. #if defined(STM32F413xx) || defined(STM32F423xx)
  5086. #define __HAL_RCC_DFSDM2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM2RST))
  5087. #endif /* STM32F413xx || STM32F423xx */
  5088. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  5089. #if defined(STM32F413xx) || defined(STM32F423xx)
  5090. #define __HAL_RCC_UART9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_UART9RST))
  5091. #define __HAL_RCC_UART10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_UART10RST))
  5092. #endif /* STM32F413xx || STM32F423xx */
  5093. #define __HAL_RCC_SDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDIORST))
  5094. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  5095. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  5096. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  5097. #if defined(STM32F413xx) || defined(STM32F423xx)
  5098. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  5099. #endif /* STM32F413xx || STM32F423xx */
  5100. #define __HAL_RCC_DFSDM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM1RST))
  5101. #if defined(STM32F413xx) || defined(STM32F423xx)
  5102. #define __HAL_RCC_DFSDM2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM2RST))
  5103. #endif /* STM32F413xx || STM32F423xx */
  5104. /**
  5105. * @}
  5106. */
  5107. /** @defgroup RCCEx_AHB1_LowPower_Enable_Disable AHB1 Peripheral Low Power Enable Disable
  5108. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  5109. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5110. * power consumption.
  5111. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5112. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5113. * @{
  5114. */
  5115. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  5116. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  5117. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  5118. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  5119. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_CRCLPEN))
  5120. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  5121. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  5122. #if defined(STM32F413xx) || defined(STM32F423xx)
  5123. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  5124. #endif /* STM32F413xx || STM32F423xx */
  5125. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  5126. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  5127. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  5128. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  5129. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_CRCLPEN))
  5130. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  5131. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  5132. #if defined(STM32F413xx) || defined(STM32F423xx)
  5133. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  5134. #endif /* STM32F413xx || STM32F423xx */
  5135. /**
  5136. * @}
  5137. */
  5138. /** @defgroup RCCEx_AHB2_LowPower_Enable_Disable AHB2 Peripheral Low Power Enable Disable
  5139. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  5140. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5141. * power consumption.
  5142. * @note After wake-up from SLEEP mode, the peripheral clock is enabled again.
  5143. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5144. * @{
  5145. */
  5146. #if defined(STM32F423xx)
  5147. #define __HAL_RCC_AES_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_AESLPEN))
  5148. #define __HAL_RCC_AES_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_AESLPEN))
  5149. #endif /* STM32F423xx */
  5150. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  5151. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  5152. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  5153. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  5154. /**
  5155. * @}
  5156. */
  5157. /** @defgroup RCCEx_AHB3_LowPower_Enable_Disable AHB3 Peripheral Low Power Enable Disable
  5158. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  5159. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5160. * power consumption.
  5161. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5162. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5163. * @{
  5164. */
  5165. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5166. #define __HAL_RCC_FSMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FSMCLPEN))
  5167. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  5168. #define __HAL_RCC_FSMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FSMCLPEN))
  5169. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  5170. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5171. /**
  5172. * @}
  5173. */
  5174. /** @defgroup RCCEx_APB1_LowPower_Enable_Disable APB1 Peripheral Low Power Enable Disable
  5175. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  5176. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5177. * power consumption.
  5178. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5179. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5180. * @{
  5181. */
  5182. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  5183. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  5184. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  5185. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  5186. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  5187. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  5188. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  5189. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  5190. #if defined(STM32F413xx) || defined(STM32F423xx)
  5191. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  5192. #endif /* STM32F413xx || STM32F423xx */
  5193. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCAPBLPEN))
  5194. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  5195. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5196. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  5197. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5198. #if defined(STM32F413xx) || defined(STM32F423xx)
  5199. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  5200. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  5201. #endif /* STM32F413xx || STM32F423xx */
  5202. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  5203. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_FMPI2C1LPEN))
  5204. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  5205. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  5206. #if defined(STM32F413xx) || defined(STM32F423xx)
  5207. #define __HAL_RCC_CAN3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN3LPEN))
  5208. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  5209. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  5210. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  5211. #endif /* STM32F413xx || STM32F423xx */
  5212. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  5213. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  5214. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  5215. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  5216. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  5217. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  5218. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  5219. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  5220. #if defined(STM32F413xx) || defined(STM32F423xx)
  5221. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  5222. #endif /* STM32F413xx || STM32F423xx */
  5223. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCAPBLPEN))
  5224. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  5225. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  5226. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  5227. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
  5228. #if defined(STM32F413xx) || defined(STM32F423xx)
  5229. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  5230. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  5231. #endif /* STM32F413xx || STM32F423xx */
  5232. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  5233. #define __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_FMPI2C1LPEN))
  5234. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  5235. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  5236. #if defined(STM32F413xx) || defined(STM32F423xx)
  5237. #define __HAL_RCC_CAN3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN3LPEN))
  5238. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  5239. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  5240. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  5241. #endif /* STM32F413xx || STM32F423xx */
  5242. /**
  5243. * @}
  5244. */
  5245. /** @defgroup RCCEx_APB2_LowPower_Enable_Disable APB2 Peripheral Low Power Enable Disable
  5246. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  5247. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  5248. * power consumption.
  5249. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  5250. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  5251. * @{
  5252. */
  5253. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  5254. #if defined(STM32F413xx) || defined(STM32F423xx)
  5255. #define __HAL_RCC_UART9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_UART9LPEN))
  5256. #define __HAL_RCC_UART10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_UART10LPEN))
  5257. #endif /* STM32F413xx || STM32F423xx */
  5258. #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDIOLPEN))
  5259. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  5260. #define __HAL_RCC_EXTIT_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_EXTITLPEN))
  5261. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  5262. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  5263. #if defined(STM32F413xx) || defined(STM32F423xx)
  5264. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  5265. #endif /* STM32F413xx || STM32F423xx */
  5266. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM1LPEN))
  5267. #if defined(STM32F413xx) || defined(STM32F423xx)
  5268. #define __HAL_RCC_DFSDM2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM2LPEN))
  5269. #endif /* STM32F413xx || STM32F423xx */
  5270. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  5271. #if defined(STM32F413xx) || defined(STM32F423xx)
  5272. #define __HAL_RCC_UART9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_UART9LPEN))
  5273. #define __HAL_RCC_UART10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_UART10LPEN))
  5274. #endif /* STM32F413xx || STM32F423xx */
  5275. #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDIOLPEN))
  5276. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  5277. #define __HAL_RCC_EXTIT_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_EXTITLPEN))
  5278. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  5279. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  5280. #if defined(STM32F413xx) || defined(STM32F423xx)
  5281. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  5282. #endif /* STM32F413xx || STM32F423xx */
  5283. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM1LPEN))
  5284. #if defined(STM32F413xx) || defined(STM32F423xx)
  5285. #define __HAL_RCC_DFSDM2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM2LPEN))
  5286. #endif /* STM32F413xx || STM32F423xx */
  5287. /**
  5288. * @}
  5289. */
  5290. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  5291. /*----------------------------------------------------------------------------*/
  5292. /*------------------------------- PLL Configuration --------------------------*/
  5293. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) ||\
  5294. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  5295. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  5296. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  5297. * @note This function must be used only when the main PLL is disabled.
  5298. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  5299. * This parameter can be one of the following values:
  5300. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  5301. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  5302. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  5303. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  5304. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5305. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  5306. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5307. * of 2 MHz to limit PLL jitter.
  5308. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  5309. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5310. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  5311. * output frequency is between 100 and 432 MHz.
  5312. *
  5313. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  5314. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5315. *
  5316. * @param __PLLQ__ specifies the division factor for OTG FS, SDIO and RNG clocks
  5317. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5318. * @note If the USB OTG FS is used in your application, you have to set the
  5319. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  5320. * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work
  5321. * correctly.
  5322. *
  5323. * @param __PLLR__ PLL division factor for I2S, SAI, SYSTEM, SPDIFRX clocks.
  5324. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5325. * @note This parameter is only available in STM32F446xx/STM32F469xx/STM32F479xx/
  5326. STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F413xx/STM32F423xx devices.
  5327. *
  5328. */
  5329. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__) \
  5330. (RCC->PLLCFGR = ((__RCC_PLLSource__) | (__PLLM__) | \
  5331. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  5332. ((((__PLLP__) >> 1U) -1U) << RCC_PLLCFGR_PLLP_Pos) | \
  5333. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos) | \
  5334. ((__PLLR__) << RCC_PLLCFGR_PLLR_Pos)))
  5335. #else
  5336. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  5337. * @note This function must be used only when the main PLL is disabled.
  5338. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  5339. * This parameter can be one of the following values:
  5340. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  5341. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  5342. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  5343. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  5344. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5345. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  5346. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5347. * of 2 MHz to limit PLL jitter.
  5348. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  5349. * This parameter must be a number between Min_Data = 50 and Max_Data = 432
  5350. * Except for STM32F411xE devices where Min_Data = 192.
  5351. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  5352. * output frequency is between 100 and 432 MHz, Except for STM32F411xE devices
  5353. * where frequency is between 192 and 432 MHz.
  5354. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  5355. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5356. *
  5357. * @param __PLLQ__ specifies the division factor for OTG FS, SDIO and RNG clocks
  5358. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5359. * @note If the USB OTG FS is used in your application, you have to set the
  5360. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  5361. * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work
  5362. * correctly.
  5363. *
  5364. */
  5365. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__) \
  5366. (RCC->PLLCFGR = (0x20000000U | (__RCC_PLLSource__) | (__PLLM__)| \
  5367. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  5368. ((((__PLLP__) >> 1U) -1U) << RCC_PLLCFGR_PLLP_Pos) | \
  5369. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos)))
  5370. #endif /* STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  5371. /*----------------------------------------------------------------------------*/
  5372. /*----------------------------PLLI2S Configuration ---------------------------*/
  5373. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  5374. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  5375. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  5376. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  5377. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  5378. /** @brief Macros to enable or disable the PLLI2S.
  5379. * @note The PLLI2S is disabled by hardware when entering STOP and STANDBY modes.
  5380. */
  5381. #define __HAL_RCC_PLLI2S_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = ENABLE)
  5382. #define __HAL_RCC_PLLI2S_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLI2SON_BB = DISABLE)
  5383. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  5384. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  5385. STM32F412Rx || STM32F412Cx */
  5386. #if defined(STM32F446xx)
  5387. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5388. * @note This macro must be used only when the PLLI2S is disabled.
  5389. * @note PLLI2S clock source is common with the main PLL (configured in
  5390. * HAL_RCC_ClockConfig() API).
  5391. * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock
  5392. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5393. * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input
  5394. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5395. * of 1 MHz to limit PLLI2S jitter.
  5396. *
  5397. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5398. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5399. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5400. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5401. *
  5402. * @param __PLLI2SP__ specifies division factor for SPDIFRX Clock.
  5403. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5404. * @note the PLLI2SP parameter is only available with STM32F446xx Devices
  5405. *
  5406. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5407. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5408. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5409. * on the I2S clock frequency.
  5410. *
  5411. * @param __PLLI2SQ__ specifies the division factor for SAI clock
  5412. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5413. */
  5414. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SP__, __PLLI2SQ__, __PLLI2SR__) \
  5415. (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\
  5416. ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5417. ((((__PLLI2SP__) >> 1U) -1U) << RCC_PLLI2SCFGR_PLLI2SP_Pos) |\
  5418. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  5419. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5420. #elif defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  5421. defined(STM32F413xx) || defined(STM32F423xx)
  5422. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5423. * @note This macro must be used only when the PLLI2S is disabled.
  5424. * @note PLLI2S clock source is common with the main PLL (configured in
  5425. * HAL_RCC_ClockConfig() API).
  5426. * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock
  5427. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5428. * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input
  5429. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5430. * of 1 MHz to limit PLLI2S jitter.
  5431. *
  5432. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5433. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5434. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5435. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5436. *
  5437. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5438. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5439. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5440. * on the I2S clock frequency.
  5441. *
  5442. * @param __PLLI2SQ__ specifies the division factor for SAI clock
  5443. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5444. */
  5445. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) \
  5446. (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\
  5447. ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5448. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  5449. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5450. #else
  5451. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5452. * @note This macro must be used only when the PLLI2S is disabled.
  5453. * @note PLLI2S clock source is common with the main PLL (configured in
  5454. * HAL_RCC_ClockConfig() API).
  5455. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5456. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5457. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5458. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5459. *
  5460. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5461. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5462. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5463. * on the I2S clock frequency.
  5464. *
  5465. */
  5466. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SR__) \
  5467. (RCC->PLLI2SCFGR = (((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5468. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5469. #endif /* STM32F446xx */
  5470. #if defined(STM32F411xE)
  5471. /** @brief Macro to configure the PLLI2S clock multiplication and division factors .
  5472. * @note This macro must be used only when the PLLI2S is disabled.
  5473. * @note This macro must be used only when the PLLI2S is disabled.
  5474. * @note PLLI2S clock source is common with the main PLL (configured in
  5475. * HAL_RCC_ClockConfig() API).
  5476. * @param __PLLI2SM__ specifies the division factor for PLLI2S VCO input clock
  5477. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5478. * @note The PLLI2SM parameter is only used with STM32F411xE/STM32F410xx Devices
  5479. * @note You have to set the PLLI2SM parameter correctly to ensure that the VCO input
  5480. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5481. * of 2 MHz to limit PLLI2S jitter.
  5482. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock
  5483. * This parameter must be a number between Min_Data = 192 and Max_Data = 432.
  5484. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5485. * output frequency is between Min_Data = 192 and Max_Data = 432 MHz.
  5486. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5487. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5488. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5489. * on the I2S clock frequency.
  5490. */
  5491. #define __HAL_RCC_PLLI2S_I2SCLK_CONFIG(__PLLI2SM__, __PLLI2SN__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SM__) |\
  5492. ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  5493. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos)))
  5494. #endif /* STM32F411xE */
  5495. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5496. /** @brief Macro used by the SAI HAL driver to configure the PLLI2S clock multiplication and division factors.
  5497. * @note This macro must be used only when the PLLI2S is disabled.
  5498. * @note PLLI2S clock source is common with the main PLL (configured in
  5499. * HAL_RCC_ClockConfig() API)
  5500. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock.
  5501. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5502. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  5503. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5504. * @param __PLLI2SQ__ specifies the division factor for SAI1 clock.
  5505. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5506. * @note the PLLI2SQ parameter is only available with STM32F427xx/437xx/429xx/439xx/469xx/479xx
  5507. * Devices and can be configured using the __HAL_RCC_PLLI2S_PLLSAICLK_CONFIG() macro
  5508. * @param __PLLI2SR__ specifies the division factor for I2S clock
  5509. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5510. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  5511. * on the I2S clock frequency.
  5512. */
  5513. #define __HAL_RCC_PLLI2S_SAICLK_CONFIG(__PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SN__) << 6U) |\
  5514. ((__PLLI2SQ__) << 24U) |\
  5515. ((__PLLI2SR__) << 28U))
  5516. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  5517. /*----------------------------------------------------------------------------*/
  5518. /*------------------------------ PLLSAI Configuration ------------------------*/
  5519. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5520. /** @brief Macros to Enable or Disable the PLLISAI.
  5521. * @note The PLLSAI is only available with STM32F429x/439x Devices.
  5522. * @note The PLLSAI is disabled by hardware when entering STOP and STANDBY modes.
  5523. */
  5524. #define __HAL_RCC_PLLSAI_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLSAION_BB = ENABLE)
  5525. #define __HAL_RCC_PLLSAI_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLSAION_BB = DISABLE)
  5526. #if defined(STM32F446xx)
  5527. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  5528. *
  5529. * @param __PLLSAIM__ specifies the division factor for PLLSAI VCO input clock
  5530. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  5531. * @note You have to set the PLLSAIM parameter correctly to ensure that the VCO input
  5532. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  5533. * of 1 MHz to limit PLLI2S jitter.
  5534. * @note The PLLSAIM parameter is only used with STM32F446xx Devices
  5535. *
  5536. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  5537. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5538. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  5539. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5540. *
  5541. * @param __PLLSAIP__ specifies division factor for OTG FS, SDIO and RNG clocks.
  5542. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5543. * @note the PLLSAIP parameter is only available with STM32F446xx Devices
  5544. *
  5545. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  5546. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5547. *
  5548. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  5549. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5550. * @note the PLLI2SR parameter is only available with STM32F427/437/429/439xx Devices
  5551. */
  5552. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIM__, __PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \
  5553. (RCC->PLLSAICFGR = ((__PLLSAIM__) | \
  5554. ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) | \
  5555. ((((__PLLSAIP__) >> 1U) -1U) << RCC_PLLSAICFGR_PLLSAIP_Pos) | \
  5556. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos)))
  5557. #endif /* STM32F446xx */
  5558. #if defined(STM32F469xx) || defined(STM32F479xx)
  5559. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  5560. *
  5561. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  5562. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5563. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  5564. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5565. *
  5566. * @param __PLLSAIP__ specifies division factor for SDIO and CLK48 clocks.
  5567. * This parameter must be a number in the range {2, 4, 6, or 8}.
  5568. *
  5569. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  5570. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5571. *
  5572. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  5573. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5574. */
  5575. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \
  5576. (RCC->PLLSAICFGR = (((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\
  5577. ((((__PLLSAIP__) >> 1U) -1U) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\
  5578. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) |\
  5579. ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos)))
  5580. #endif /* STM32F469xx || STM32F479xx */
  5581. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
  5582. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  5583. *
  5584. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  5585. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  5586. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  5587. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  5588. *
  5589. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  5590. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  5591. *
  5592. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  5593. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  5594. * @note the PLLI2SR parameter is only available with STM32F427/437/429/439xx Devices
  5595. */
  5596. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIQ__, __PLLSAIR__) \
  5597. (RCC->PLLSAICFGR = (((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) | \
  5598. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) | \
  5599. ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos)))
  5600. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
  5601. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  5602. /*----------------------------------------------------------------------------*/
  5603. /*------------------- PLLSAI/PLLI2S Dividers Configuration -------------------*/
  5604. #if defined(STM32F413xx) || defined(STM32F423xx)
  5605. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  5606. * @note This function must be called before enabling the PLLI2S.
  5607. * @param __PLLI2SDivR__ specifies the PLLI2S division factor for SAI1 clock.
  5608. * This parameter must be a number between 1 and 32.
  5609. * SAI1 clock frequency = f(PLLI2SR) / __PLLI2SDivR__
  5610. */
  5611. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVR_CONFIG(__PLLI2SDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVR, (__PLLI2SDivR__)-1U))
  5612. /** @brief Macro to configure the SAI clock Divider coming from PLL.
  5613. * @param __PLLDivR__ specifies the PLL division factor for SAI1 clock.
  5614. * This parameter must be a number between 1 and 32.
  5615. * SAI1 clock frequency = f(PLLR) / __PLLDivR__
  5616. */
  5617. #define __HAL_RCC_PLL_PLLSAICLKDIVR_CONFIG(__PLLDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLDIVR, ((__PLLDivR__)-1U)<<8U))
  5618. #endif /* STM32F413xx || STM32F423xx */
  5619. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
  5620. defined(STM32F469xx) || defined(STM32F479xx)
  5621. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  5622. * @note This function must be called before enabling the PLLI2S.
  5623. * @param __PLLI2SDivQ__ specifies the PLLI2S division factor for SAI1 clock.
  5624. * This parameter must be a number between 1 and 32.
  5625. * SAI1 clock frequency = f(PLLI2SQ) / __PLLI2SDivQ__
  5626. */
  5627. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(__PLLI2SDivQ__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLI2SDIVQ, (__PLLI2SDivQ__)-1U))
  5628. /** @brief Macro to configure the SAI clock Divider coming from PLLSAI.
  5629. * @note This function must be called before enabling the PLLSAI.
  5630. * @param __PLLSAIDivQ__ specifies the PLLSAI division factor for SAI1 clock .
  5631. * This parameter must be a number between Min_Data = 1 and Max_Data = 32.
  5632. * SAI1 clock frequency = f(PLLSAIQ) / __PLLSAIDivQ__
  5633. */
  5634. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(__PLLSAIDivQ__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVQ, ((__PLLSAIDivQ__)-1U)<<8U))
  5635. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  5636. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5637. /** @brief Macro to configure the LTDC clock Divider coming from PLLSAI.
  5638. *
  5639. * @note The LTDC peripheral is only available with STM32F427/437/429/439/469/479xx Devices.
  5640. * @note This function must be called before enabling the PLLSAI.
  5641. * @param __PLLSAIDivR__ specifies the PLLSAI division factor for LTDC clock .
  5642. * This parameter must be a number between Min_Data = 2 and Max_Data = 16.
  5643. * LTDC clock frequency = f(PLLSAIR) / __PLLSAIDivR__
  5644. */
  5645. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(__PLLSAIDivR__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_PLLSAIDIVR, (__PLLSAIDivR__)))
  5646. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  5647. /*----------------------------------------------------------------------------*/
  5648. /*------------------------- Peripheral Clock selection -----------------------*/
  5649. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
  5650. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  5651. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) ||\
  5652. defined(STM32F479xx)
  5653. /** @brief Macro to configure the I2S clock source (I2SCLK).
  5654. * @note This function must be called before enabling the I2S APB clock.
  5655. * @param __SOURCE__ specifies the I2S clock source.
  5656. * This parameter can be one of the following values:
  5657. * @arg RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source.
  5658. * @arg RCC_I2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin
  5659. * used as I2S clock source.
  5660. */
  5661. #define __HAL_RCC_I2S_CONFIG(__SOURCE__) (*(__IO uint32_t *) RCC_CFGR_I2SSRC_BB = (__SOURCE__))
  5662. /** @brief Macro to get the I2S clock source (I2SCLK).
  5663. * @retval The clock source can be one of the following values:
  5664. * @arg @ref RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source.
  5665. * @arg @ref RCC_I2SCLKSOURCE_EXT External clock mapped on the I2S_CKIN pin
  5666. * used as I2S clock source
  5667. */
  5668. #define __HAL_RCC_GET_I2S_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC)))
  5669. #endif /* STM32F40xxx || STM32F41xxx || STM32F42xxx || STM32F43xxx || STM32F469xx || STM32F479xx */
  5670. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
  5671. /** @brief Macro to configure SAI1BlockA clock source selection.
  5672. * @note The SAI peripheral is only available with STM32F427/437/429/439/469/479xx Devices.
  5673. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5674. * the SAI clock.
  5675. * @param __SOURCE__ specifies the SAI Block A clock source.
  5676. * This parameter can be one of the following values:
  5677. * @arg RCC_SAIACLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  5678. * as SAI1 Block A clock.
  5679. * @arg RCC_SAIACLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  5680. * as SAI1 Block A clock.
  5681. * @arg RCC_SAIACLKSOURCE_Ext: External clock mapped on the I2S_CKIN pin
  5682. * used as SAI1 Block A clock.
  5683. */
  5684. #define __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC, (__SOURCE__)))
  5685. /** @brief Macro to configure SAI1BlockB clock source selection.
  5686. * @note The SAI peripheral is only available with STM32F427/437/429/439/469/479xx Devices.
  5687. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5688. * the SAI clock.
  5689. * @param __SOURCE__ specifies the SAI Block B clock source.
  5690. * This parameter can be one of the following values:
  5691. * @arg RCC_SAIBCLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  5692. * as SAI1 Block B clock.
  5693. * @arg RCC_SAIBCLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  5694. * as SAI1 Block B clock.
  5695. * @arg RCC_SAIBCLKSOURCE_Ext: External clock mapped on the I2S_CKIN pin
  5696. * used as SAI1 Block B clock.
  5697. */
  5698. #define __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC, (__SOURCE__)))
  5699. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  5700. #if defined(STM32F446xx)
  5701. /** @brief Macro to configure SAI1 clock source selection.
  5702. * @note This configuration is only available with STM32F446xx Devices.
  5703. * @note This function must be called before enabling PLL, PLLSAI, PLLI2S and
  5704. * the SAI clock.
  5705. * @param __SOURCE__ specifies the SAI1 clock source.
  5706. * This parameter can be one of the following values:
  5707. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI1 clock.
  5708. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI1 clock.
  5709. * @arg RCC_SAI1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI1 clock.
  5710. * @arg RCC_SAI1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 clock.
  5711. */
  5712. #define __HAL_RCC_SAI1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1SRC, (__SOURCE__)))
  5713. /** @brief Macro to Get SAI1 clock source selection.
  5714. * @note This configuration is only available with STM32F446xx Devices.
  5715. * @retval The clock source can be one of the following values:
  5716. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI1 clock.
  5717. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI1 clock.
  5718. * @arg RCC_SAI1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI1 clock.
  5719. * @arg RCC_SAI1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 clock.
  5720. */
  5721. #define __HAL_RCC_GET_SAI1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1SRC))
  5722. /** @brief Macro to configure SAI2 clock source selection.
  5723. * @note This configuration is only available with STM32F446xx Devices.
  5724. * @note This function must be called before enabling PLL, PLLSAI, PLLI2S and
  5725. * the SAI clock.
  5726. * @param __SOURCE__ specifies the SAI2 clock source.
  5727. * This parameter can be one of the following values:
  5728. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI2 clock.
  5729. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI2 clock.
  5730. * @arg RCC_SAI2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI2 clock.
  5731. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock used as SAI2 clock.
  5732. */
  5733. #define __HAL_RCC_SAI2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI2SRC, (__SOURCE__)))
  5734. /** @brief Macro to Get SAI2 clock source selection.
  5735. * @note This configuration is only available with STM32F446xx Devices.
  5736. * @retval The clock source can be one of the following values:
  5737. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used as SAI2 clock.
  5738. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used as SAI2 clock.
  5739. * @arg RCC_SAI2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SAI2 clock.
  5740. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock used as SAI2 clock.
  5741. */
  5742. #define __HAL_RCC_GET_SAI2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI2SRC))
  5743. /** @brief Macro to configure I2S APB1 clock source selection.
  5744. * @note This function must be called before enabling PLL, PLLI2S and the I2S clock.
  5745. * @param __SOURCE__ specifies the I2S APB1 clock source.
  5746. * This parameter can be one of the following values:
  5747. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5748. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB1 clock.
  5749. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB1 clock.
  5750. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5751. */
  5752. #define __HAL_RCC_I2S_APB1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC, (__SOURCE__)))
  5753. /** @brief Macro to Get I2S APB1 clock source selection.
  5754. * @retval The clock source can be one of the following values:
  5755. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5756. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB1 clock.
  5757. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB1 clock.
  5758. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5759. */
  5760. #define __HAL_RCC_GET_I2S_APB1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC))
  5761. /** @brief Macro to configure I2S APB2 clock source selection.
  5762. * @note This function must be called before enabling PLL, PLLI2S and the I2S clock.
  5763. * @param __SOURCE__ specifies the SAI Block A clock source.
  5764. * This parameter can be one of the following values:
  5765. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5766. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB2 clock.
  5767. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB2 clock.
  5768. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5769. */
  5770. #define __HAL_RCC_I2S_APB2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC, (__SOURCE__)))
  5771. /** @brief Macro to Get I2S APB2 clock source selection.
  5772. * @retval The clock source can be one of the following values:
  5773. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  5774. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S APB2 clock.
  5775. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as I2S APB2 clock.
  5776. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5777. */
  5778. #define __HAL_RCC_GET_I2S_APB2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC))
  5779. /** @brief Macro to configure the CEC clock.
  5780. * @param __SOURCE__ specifies the CEC clock source.
  5781. * This parameter can be one of the following values:
  5782. * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock
  5783. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  5784. */
  5785. #define __HAL_RCC_CEC_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, (uint32_t)(__SOURCE__)))
  5786. /** @brief Macro to Get the CEC clock.
  5787. * @retval The clock source can be one of the following values:
  5788. * @arg RCC_CECCLKSOURCE_HSI488: HSI selected as CEC clock
  5789. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  5790. */
  5791. #define __HAL_RCC_GET_CEC_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL))
  5792. /** @brief Macro to configure the FMPI2C1 clock.
  5793. * @param __SOURCE__ specifies the FMPI2C1 clock source.
  5794. * This parameter can be one of the following values:
  5795. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  5796. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  5797. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  5798. */
  5799. #define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__)))
  5800. /** @brief Macro to Get the FMPI2C1 clock.
  5801. * @retval The clock source can be one of the following values:
  5802. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  5803. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  5804. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  5805. */
  5806. #define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL))
  5807. /** @brief Macro to configure the CLK48 clock.
  5808. * @param __SOURCE__ specifies the CLK48 clock source.
  5809. * This parameter can be one of the following values:
  5810. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5811. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5812. */
  5813. #define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__SOURCE__)))
  5814. /** @brief Macro to Get the CLK48 clock.
  5815. * @retval The clock source can be one of the following values:
  5816. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5817. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5818. */
  5819. #define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL))
  5820. /** @brief Macro to configure the SDIO clock.
  5821. * @param __SOURCE__ specifies the SDIO clock source.
  5822. * This parameter can be one of the following values:
  5823. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5824. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5825. */
  5826. #define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, (uint32_t)(__SOURCE__)))
  5827. /** @brief Macro to Get the SDIO clock.
  5828. * @retval The clock source can be one of the following values:
  5829. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5830. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5831. */
  5832. #define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL))
  5833. /** @brief Macro to configure the SPDIFRX clock.
  5834. * @param __SOURCE__ specifies the SPDIFRX clock source.
  5835. * This parameter can be one of the following values:
  5836. * @arg RCC_SPDIFRXCLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SPDIFRX clock.
  5837. * @arg RCC_SPDIFRXCLKSOURCE_PLLI2SP: PLLI2S VCO Output divided by PLLI2SP used as SPDIFRX clock.
  5838. */
  5839. #define __HAL_RCC_SPDIFRX_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL, (uint32_t)(__SOURCE__)))
  5840. /** @brief Macro to Get the SPDIFRX clock.
  5841. * @retval The clock source can be one of the following values:
  5842. * @arg RCC_SPDIFRXCLKSOURCE_PLLR: PLL VCO Output divided by PLLR used as SPDIFRX clock.
  5843. * @arg RCC_SPDIFRXCLKSOURCE_PLLI2SP: PLLI2S VCO Output divided by PLLI2SP used as SPDIFRX clock.
  5844. */
  5845. #define __HAL_RCC_GET_SPDIFRX_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SPDIFRXSEL))
  5846. #endif /* STM32F446xx */
  5847. #if defined(STM32F469xx) || defined(STM32F479xx)
  5848. /** @brief Macro to configure the CLK48 clock.
  5849. * @param __SOURCE__ specifies the CLK48 clock source.
  5850. * This parameter can be one of the following values:
  5851. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5852. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5853. */
  5854. #define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL, (uint32_t)(__SOURCE__)))
  5855. /** @brief Macro to Get the CLK48 clock.
  5856. * @retval The clock source can be one of the following values:
  5857. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  5858. * @arg RCC_CLK48CLKSOURCE_PLLSAIP: PLLSAI VCO Output divided by PLLSAIP used as CLK48 clock.
  5859. */
  5860. #define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CK48MSEL))
  5861. /** @brief Macro to configure the SDIO clock.
  5862. * @param __SOURCE__ specifies the SDIO clock source.
  5863. * This parameter can be one of the following values:
  5864. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5865. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5866. */
  5867. #define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL, (uint32_t)(__SOURCE__)))
  5868. /** @brief Macro to Get the SDIO clock.
  5869. * @retval The clock source can be one of the following values:
  5870. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  5871. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  5872. */
  5873. #define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SDIOSEL))
  5874. /** @brief Macro to configure the DSI clock.
  5875. * @param __SOURCE__ specifies the DSI clock source.
  5876. * This parameter can be one of the following values:
  5877. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  5878. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  5879. */
  5880. #define __HAL_RCC_DSI_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL, (uint32_t)(__SOURCE__)))
  5881. /** @brief Macro to Get the DSI clock.
  5882. * @retval The clock source can be one of the following values:
  5883. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  5884. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  5885. */
  5886. #define __HAL_RCC_GET_DSI_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL))
  5887. #endif /* STM32F469xx || STM32F479xx */
  5888. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  5889. defined(STM32F413xx) || defined(STM32F423xx)
  5890. /** @brief Macro to configure the DFSDM1 clock.
  5891. * @param __DFSDM1_CLKSOURCE__ specifies the DFSDM1 clock source.
  5892. * This parameter can be one of the following values:
  5893. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5894. * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5895. * @retval None
  5896. */
  5897. #define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1_CLKSOURCE__) MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, (__DFSDM1_CLKSOURCE__))
  5898. /** @brief Macro to get the DFSDM1 clock source.
  5899. * @retval The clock source can be one of the following values:
  5900. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5901. * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5902. */
  5903. #define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL)))
  5904. /** @brief Macro to configure DFSDM1 Audio clock source selection.
  5905. * @note This configuration is only available with STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/
  5906. STM32F413xx/STM32F423xx Devices.
  5907. * @param __SOURCE__ specifies the DFSDM1 Audio clock source.
  5908. * This parameter can be one of the following values:
  5909. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5910. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5911. */
  5912. #define __HAL_RCC_DFSDM1AUDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1ASEL, (__SOURCE__)))
  5913. /** @brief Macro to Get DFSDM1 Audio clock source selection.
  5914. * @note This configuration is only available with STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/
  5915. STM32F413xx/STM32F423xx Devices.
  5916. * @retval The clock source can be one of the following values:
  5917. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5918. * @arg RCC_DFSDM1AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5919. */
  5920. #define __HAL_RCC_GET_DFSDM1AUDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1ASEL))
  5921. #if defined(STM32F413xx) || defined(STM32F423xx)
  5922. /** @brief Macro to configure the DFSDM2 clock.
  5923. * @param __DFSDM2_CLKSOURCE__ specifies the DFSDM1 clock source.
  5924. * This parameter can be one of the following values:
  5925. * @arg RCC_DFSDM2CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5926. * @arg RCC_DFSDM2CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5927. * @retval None
  5928. */
  5929. #define __HAL_RCC_DFSDM2_CONFIG(__DFSDM2_CLKSOURCE__) MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL, (__DFSDM2_CLKSOURCE__))
  5930. /** @brief Macro to get the DFSDM2 clock source.
  5931. * @retval The clock source can be one of the following values:
  5932. * @arg RCC_DFSDM2CLKSOURCE_PCLK2: PCLK2 clock used as kernel clock.
  5933. * @arg RCC_DFSDM2CLKSOURCE_SYSCLK: System clock used as kernal clock.
  5934. */
  5935. #define __HAL_RCC_GET_DFSDM2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM1SEL)))
  5936. /** @brief Macro to configure DFSDM1 Audio clock source selection.
  5937. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5938. * @param __SOURCE__ specifies the DFSDM2 Audio clock source.
  5939. * This parameter can be one of the following values:
  5940. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5941. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5942. */
  5943. #define __HAL_RCC_DFSDM2AUDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM2ASEL, (__SOURCE__)))
  5944. /** @brief Macro to Get DFSDM2 Audio clock source selection.
  5945. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5946. * @retval The clock source can be one of the following values:
  5947. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S1: CK_I2S_PCLK1 selected as audio clock
  5948. * @arg RCC_DFSDM2AUDIOCLKSOURCE_I2S2: CK_I2S_PCLK2 selected as audio clock
  5949. */
  5950. #define __HAL_RCC_GET_DFSDM2AUDIO_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_CKDFSDM2ASEL))
  5951. /** @brief Macro to configure SAI1BlockA clock source selection.
  5952. * @note The SAI peripheral is only available with STM32F413xx/STM32F423xx Devices.
  5953. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5954. * the SAI clock.
  5955. * @param __SOURCE__ specifies the SAI Block A clock source.
  5956. * This parameter can be one of the following values:
  5957. * @arg RCC_SAIACLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5958. * @arg RCC_SAIACLKSOURCE_EXT: External clock mapped on the I2S_CKIN pinused as SAI1 Block A clock.
  5959. * @arg RCC_SAIACLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5960. * @arg RCC_SAIACLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5961. */
  5962. #define __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC, (__SOURCE__)))
  5963. /** @brief Macro to Get SAI1 BlockA clock source selection.
  5964. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5965. * @retval The clock source can be one of the following values:
  5966. * @arg RCC_SAIACLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5967. * @arg RCC_SAIACLKSOURCE_EXT: External clock mapped on the I2S_CKIN pinused as SAI1 Block A clock.
  5968. * @arg RCC_SAIACLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5969. * @arg RCC_SAIACLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5970. */
  5971. #define __HAL_RCC_GET_SAI_BLOCKA_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1ASRC))
  5972. /** @brief Macro to configure SAI1 BlockB clock source selection.
  5973. * @note The SAI peripheral is only available with STM32F413xx/STM32F423xx Devices.
  5974. * @note This function must be called before enabling PLLSAI, PLLI2S and
  5975. * the SAI clock.
  5976. * @param __SOURCE__ specifies the SAI Block B clock source.
  5977. * This parameter can be one of the following values:
  5978. * @arg RCC_SAIBCLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5979. * @arg RCC_SAIBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 Block A clock.
  5980. * @arg RCC_SAIBCLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5981. * @arg RCC_SAIBCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5982. */
  5983. #define __HAL_RCC_SAI_BLOCKBCLKSOURCE_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC, (__SOURCE__)))
  5984. /** @brief Macro to Get SAI1 BlockB clock source selection.
  5985. * @note This configuration is only available with STM32F413xx/STM32F423xx Devices.
  5986. * @retval The clock source can be one of the following values:
  5987. * @arg RCC_SAIBCLKSOURCE_PLLI2SR: PLLI2S_R clock divided (R2) used as SAI1 Block A clock.
  5988. * @arg RCC_SAIBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as SAI1 Block A clock.
  5989. * @arg RCC_SAIBCLKSOURCE_PLLR: PLL_R clock divided (R1) used as SAI1 Block A clock.
  5990. * @arg RCC_SAIBCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  5991. */
  5992. #define __HAL_RCC_GET_SAI_BLOCKB_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_SAI1BSRC))
  5993. /** @brief Macro to configure the LPTIM1 clock.
  5994. * @param __SOURCE__ specifies the LPTIM1 clock source.
  5995. * This parameter can be one of the following values:
  5996. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  5997. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  5998. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  5999. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6000. */
  6001. #define __HAL_RCC_LPTIM1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__SOURCE__)))
  6002. /** @brief Macro to Get the LPTIM1 clock.
  6003. * @retval The clock source can be one of the following values:
  6004. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  6005. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  6006. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  6007. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6008. */
  6009. #define __HAL_RCC_GET_LPTIM1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL))
  6010. #endif /* STM32F413xx || STM32F423xx */
  6011. /** @brief Macro to configure I2S APB1 clock source selection.
  6012. * @param __SOURCE__ specifies the I2S APB1 clock source.
  6013. * This parameter can be one of the following values:
  6014. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6015. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6016. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6017. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6018. */
  6019. #define __HAL_RCC_I2S_APB1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC, (__SOURCE__)))
  6020. /** @brief Macro to Get I2S APB1 clock source selection.
  6021. * @retval The clock source can be one of the following values:
  6022. * @arg RCC_I2SAPB1CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6023. * @arg RCC_I2SAPB1CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6024. * @arg RCC_I2SAPB1CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6025. * @arg RCC_I2SAPB1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6026. */
  6027. #define __HAL_RCC_GET_I2S_APB1_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S1SRC))
  6028. /** @brief Macro to configure I2S APB2 clock source selection.
  6029. * @param __SOURCE__ specifies the I2S APB2 clock source.
  6030. * This parameter can be one of the following values:
  6031. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6032. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6033. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6034. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6035. */
  6036. #define __HAL_RCC_I2S_APB2_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC, (__SOURCE__)))
  6037. /** @brief Macro to Get I2S APB2 clock source selection.
  6038. * @retval The clock source can be one of the following values:
  6039. * @arg RCC_I2SAPB2CLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR.
  6040. * @arg RCC_I2SAPB2CLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6041. * @arg RCC_I2SAPB2CLKSOURCE_PLLR: PLL VCO Output divided by PLLR.
  6042. * @arg RCC_I2SAPB2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6043. */
  6044. #define __HAL_RCC_GET_I2S_APB2_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2S2SRC))
  6045. /** @brief Macro to configure the PLL I2S clock source (PLLI2SCLK).
  6046. * @note This macro must be called before enabling the I2S APB clock.
  6047. * @param __SOURCE__ specifies the I2S clock source.
  6048. * This parameter can be one of the following values:
  6049. * @arg RCC_PLLI2SCLKSOURCE_PLLSRC: HSI or HSE depending from PLL source Clock.
  6050. * @arg RCC_PLLI2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin
  6051. * used as I2S clock source.
  6052. */
  6053. #define __HAL_RCC_PLL_I2S_CONFIG(__SOURCE__) (*(__IO uint32_t *) RCC_PLLI2SCFGR_PLLI2SSRC_BB = (__SOURCE__))
  6054. /** @brief Macro to configure the FMPI2C1 clock.
  6055. * @param __SOURCE__ specifies the FMPI2C1 clock source.
  6056. * This parameter can be one of the following values:
  6057. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6058. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6059. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6060. */
  6061. #define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__)))
  6062. /** @brief Macro to Get the FMPI2C1 clock.
  6063. * @retval The clock source can be one of the following values:
  6064. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6065. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6066. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6067. */
  6068. #define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL))
  6069. /** @brief Macro to configure the CLK48 clock.
  6070. * @param __SOURCE__ specifies the CLK48 clock source.
  6071. * This parameter can be one of the following values:
  6072. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  6073. * @arg RCC_CLK48CLKSOURCE_PLLI2SQ: PLLI2S VCO Output divided by PLLI2SQ used as CLK48 clock.
  6074. */
  6075. #define __HAL_RCC_CLK48_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__SOURCE__)))
  6076. /** @brief Macro to Get the CLK48 clock.
  6077. * @retval The clock source can be one of the following values:
  6078. * @arg RCC_CLK48CLKSOURCE_PLLQ: PLL VCO Output divided by PLLQ used as CLK48 clock.
  6079. * @arg RCC_CLK48CLKSOURCE_PLLI2SQ: PLLI2S VCO Output divided by PLLI2SQ used as CLK48 clock
  6080. */
  6081. #define __HAL_RCC_GET_CLK48_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL))
  6082. /** @brief Macro to configure the SDIO clock.
  6083. * @param __SOURCE__ specifies the SDIO clock source.
  6084. * This parameter can be one of the following values:
  6085. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  6086. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  6087. */
  6088. #define __HAL_RCC_SDIO_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL, (uint32_t)(__SOURCE__)))
  6089. /** @brief Macro to Get the SDIO clock.
  6090. * @retval The clock source can be one of the following values:
  6091. * @arg RCC_SDIOCLKSOURCE_CLK48: CLK48 output used as SDIO clock.
  6092. * @arg RCC_SDIOCLKSOURCE_SYSCLK: System clock output used as SDIO clock.
  6093. */
  6094. #define __HAL_RCC_GET_SDIO_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDIOSEL))
  6095. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  6096. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6097. /** @brief Macro to configure I2S clock source selection.
  6098. * @param __SOURCE__ specifies the I2S clock source.
  6099. * This parameter can be one of the following values:
  6100. * @arg RCC_I2SAPBCLKSOURCE_PLLR: PLL VCO output clock divided by PLLR.
  6101. * @arg RCC_I2SAPBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6102. * @arg RCC_I2SAPBCLKSOURCE_PLLSRC: HSI/HSE depends on PLLSRC.
  6103. */
  6104. #define __HAL_RCC_I2S_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_I2SSRC, (__SOURCE__)))
  6105. /** @brief Macro to Get I2S clock source selection.
  6106. * @retval The clock source can be one of the following values:
  6107. * @arg RCC_I2SAPBCLKSOURCE_PLLR: PLL VCO output clock divided by PLLR.
  6108. * @arg RCC_I2SAPBCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin.
  6109. * @arg RCC_I2SAPBCLKSOURCE_PLLSRC: HSI/HSE depends on PLLSRC.
  6110. */
  6111. #define __HAL_RCC_GET_I2S_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_I2SSRC))
  6112. /** @brief Macro to configure the FMPI2C1 clock.
  6113. * @param __SOURCE__ specifies the FMPI2C1 clock source.
  6114. * This parameter can be one of the following values:
  6115. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6116. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6117. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6118. */
  6119. #define __HAL_RCC_FMPI2C1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL, (uint32_t)(__SOURCE__)))
  6120. /** @brief Macro to Get the FMPI2C1 clock.
  6121. * @retval The clock source can be one of the following values:
  6122. * @arg RCC_FMPI2C1CLKSOURCE_PCLK1: PCLK1 selected as FMPI2C1 clock
  6123. * @arg RCC_FMPI2C1CLKSOURCE_SYSCLK: SYS clock selected as FMPI2C1 clock
  6124. * @arg RCC_FMPI2C1CLKSOURCE_HSI: HSI selected as FMPI2C1 clock
  6125. */
  6126. #define __HAL_RCC_GET_FMPI2C1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_FMPI2C1SEL))
  6127. /** @brief Macro to configure the LPTIM1 clock.
  6128. * @param __SOURCE__ specifies the LPTIM1 clock source.
  6129. * This parameter can be one of the following values:
  6130. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK1 selected as LPTIM1 clock
  6131. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  6132. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  6133. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6134. */
  6135. #define __HAL_RCC_LPTIM1_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__SOURCE__)))
  6136. /** @brief Macro to Get the LPTIM1 clock.
  6137. * @retval The clock source can be one of the following values:
  6138. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK1 selected as LPTIM1 clock
  6139. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI clock selected as LPTIM1 clock
  6140. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  6141. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  6142. */
  6143. #define __HAL_RCC_GET_LPTIM1_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL))
  6144. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6145. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  6146. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
  6147. defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  6148. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
  6149. defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6150. /** @brief Macro to configure the Timers clocks prescalers
  6151. * @note This feature is only available with STM32F429x/439x Devices.
  6152. * @param __PRESC__ specifies the Timers clocks prescalers selection
  6153. * This parameter can be one of the following values:
  6154. * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is
  6155. * equal to HPRE if PPREx is corresponding to division by 1 or 2,
  6156. * else it is equal to [(HPRE * PPREx) / 2] if PPREx is corresponding to
  6157. * division by 4 or more.
  6158. * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is
  6159. * equal to HPRE if PPREx is corresponding to division by 1, 2 or 4,
  6160. * else it is equal to [(HPRE * PPREx) / 4] if PPREx is corresponding
  6161. * to division by 8 or more.
  6162. */
  6163. #define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) (*(__IO uint32_t *) RCC_DCKCFGR_TIMPRE_BB = (__PRESC__))
  6164. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx) || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE ||\
  6165. STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx ||\
  6166. STM32F423xx */
  6167. /*----------------------------------------------------------------------------*/
  6168. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  6169. /** @brief Enable PLLSAI_RDY interrupt.
  6170. */
  6171. #define __HAL_RCC_PLLSAI_ENABLE_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYIE))
  6172. /** @brief Disable PLLSAI_RDY interrupt.
  6173. */
  6174. #define __HAL_RCC_PLLSAI_DISABLE_IT() (RCC->CIR &= ~(RCC_CIR_PLLSAIRDYIE))
  6175. /** @brief Clear the PLLSAI RDY interrupt pending bits.
  6176. */
  6177. #define __HAL_RCC_PLLSAI_CLEAR_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYF))
  6178. /** @brief Check the PLLSAI RDY interrupt has occurred or not.
  6179. * @retval The new state (TRUE or FALSE).
  6180. */
  6181. #define __HAL_RCC_PLLSAI_GET_IT() ((RCC->CIR & (RCC_CIR_PLLSAIRDYIE)) == (RCC_CIR_PLLSAIRDYIE))
  6182. /** @brief Check PLLSAI RDY flag is set or not.
  6183. * @retval The new state (TRUE or FALSE).
  6184. */
  6185. #define __HAL_RCC_PLLSAI_GET_FLAG() ((RCC->CR & (RCC_CR_PLLSAIRDY)) == (RCC_CR_PLLSAIRDY))
  6186. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  6187. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6188. /** @brief Macros to enable or disable the RCC MCO1 feature.
  6189. */
  6190. #define __HAL_RCC_MCO1_ENABLE() (*(__IO uint32_t *) RCC_CFGR_MCO1EN_BB = ENABLE)
  6191. #define __HAL_RCC_MCO1_DISABLE() (*(__IO uint32_t *) RCC_CFGR_MCO1EN_BB = DISABLE)
  6192. /** @brief Macros to enable or disable the RCC MCO2 feature.
  6193. */
  6194. #define __HAL_RCC_MCO2_ENABLE() (*(__IO uint32_t *) RCC_CFGR_MCO2EN_BB = ENABLE)
  6195. #define __HAL_RCC_MCO2_DISABLE() (*(__IO uint32_t *) RCC_CFGR_MCO2EN_BB = DISABLE)
  6196. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6197. /**
  6198. * @}
  6199. */
  6200. /* Exported functions --------------------------------------------------------*/
  6201. /** @addtogroup RCCEx_Exported_Functions
  6202. * @{
  6203. */
  6204. /** @addtogroup RCCEx_Exported_Functions_Group1
  6205. * @{
  6206. */
  6207. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  6208. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  6209. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  6210. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) ||\
  6211. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
  6212. defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
  6213. defined(STM32F423xx)
  6214. void HAL_RCCEx_SelectLSEMode(uint8_t Mode);
  6215. #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6216. #if defined(RCC_PLLI2S_SUPPORT)
  6217. HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit);
  6218. HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void);
  6219. #endif /* RCC_PLLI2S_SUPPORT */
  6220. #if defined(RCC_PLLSAI_SUPPORT)
  6221. HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI(RCC_PLLSAIInitTypeDef *PLLSAIInit);
  6222. HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI(void);
  6223. #endif /* RCC_PLLSAI_SUPPORT */
  6224. /**
  6225. * @}
  6226. */
  6227. /**
  6228. * @}
  6229. */
  6230. /* Private types -------------------------------------------------------------*/
  6231. /* Private variables ---------------------------------------------------------*/
  6232. /* Private constants ---------------------------------------------------------*/
  6233. /** @defgroup RCCEx_Private_Constants RCCEx Private Constants
  6234. * @{
  6235. */
  6236. /** @defgroup RCCEx_BitAddress_AliasRegion RCC BitAddress AliasRegion
  6237. * @brief RCC registers bit address in the alias region
  6238. * @{
  6239. */
  6240. /* --- CR Register ---*/
  6241. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  6242. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  6243. /* Alias word address of PLLSAION bit */
  6244. #define RCC_PLLSAION_BIT_NUMBER 0x1CU
  6245. #define RCC_CR_PLLSAION_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLSAION_BIT_NUMBER * 4U))
  6246. #define PLLSAI_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */
  6247. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  6248. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  6249. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  6250. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  6251. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  6252. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6253. /* Alias word address of PLLI2SON bit */
  6254. #define RCC_PLLI2SON_BIT_NUMBER 0x1AU
  6255. #define RCC_CR_PLLI2SON_BB (PERIPH_BB_BASE + (RCC_CR_OFFSET * 32U) + (RCC_PLLI2SON_BIT_NUMBER * 4U))
  6256. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  6257. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  6258. STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6259. /* --- DCKCFGR Register ---*/
  6260. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  6261. defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
  6262. defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  6263. defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
  6264. defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6265. /* Alias word address of TIMPRE bit */
  6266. #define RCC_DCKCFGR_OFFSET (RCC_OFFSET + 0x8CU)
  6267. #define RCC_TIMPRE_BIT_NUMBER 0x18U
  6268. #define RCC_DCKCFGR_TIMPRE_BB (PERIPH_BB_BASE + (RCC_DCKCFGR_OFFSET * 32U) + (RCC_TIMPRE_BIT_NUMBER * 4U))
  6269. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F410xx || STM32F401xC ||\
  6270. STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
  6271. STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6272. /* --- CFGR Register ---*/
  6273. #define RCC_CFGR_OFFSET (RCC_OFFSET + 0x08U)
  6274. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  6275. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  6276. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  6277. defined(STM32F469xx) || defined(STM32F479xx)
  6278. /* Alias word address of I2SSRC bit */
  6279. #define RCC_I2SSRC_BIT_NUMBER 0x17U
  6280. #define RCC_CFGR_I2SSRC_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_I2SSRC_BIT_NUMBER * 4U))
  6281. #define PLLI2S_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */
  6282. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  6283. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
  6284. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  6285. defined(STM32F413xx) || defined(STM32F423xx)
  6286. /* --- PLLI2SCFGR Register ---*/
  6287. #define RCC_PLLI2SCFGR_OFFSET (RCC_OFFSET + 0x84U)
  6288. /* Alias word address of PLLI2SSRC bit */
  6289. #define RCC_PLLI2SSRC_BIT_NUMBER 0x16U
  6290. #define RCC_PLLI2SCFGR_PLLI2SSRC_BB (PERIPH_BB_BASE + (RCC_PLLI2SCFGR_OFFSET * 32U) + (RCC_PLLI2SSRC_BIT_NUMBER * 4U))
  6291. #define PLLI2S_TIMEOUT_VALUE 2U /* Timeout value fixed to 2 ms */
  6292. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx | STM32F423xx */
  6293. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6294. /* Alias word address of MCO1EN bit */
  6295. #define RCC_MCO1EN_BIT_NUMBER 0x8U
  6296. #define RCC_CFGR_MCO1EN_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_MCO1EN_BIT_NUMBER * 4U))
  6297. /* Alias word address of MCO2EN bit */
  6298. #define RCC_MCO2EN_BIT_NUMBER 0x9U
  6299. #define RCC_CFGR_MCO2EN_BB (PERIPH_BB_BASE + (RCC_CFGR_OFFSET * 32U) + (RCC_MCO2EN_BIT_NUMBER * 4U))
  6300. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6301. #define PLL_TIMEOUT_VALUE 2U /* 2 ms */
  6302. /**
  6303. * @}
  6304. */
  6305. /**
  6306. * @}
  6307. */
  6308. /* Private macros ------------------------------------------------------------*/
  6309. /** @defgroup RCCEx_Private_Macros RCCEx Private Macros
  6310. * @{
  6311. */
  6312. /** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters
  6313. * @{
  6314. */
  6315. #if defined(STM32F411xE)
  6316. #define IS_RCC_PLLN_VALUE(VALUE) ((192U <= (VALUE)) && ((VALUE) <= 432U))
  6317. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((192U <= (VALUE)) && ((VALUE) <= 432U))
  6318. #else /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||
  6319. STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410Tx || STM32F410Cx ||
  6320. STM32F410Rx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Cx || STM32F412Rx ||
  6321. STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F423xx */
  6322. #define IS_RCC_PLLN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U))
  6323. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U))
  6324. #endif /* STM32F411xE */
  6325. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
  6326. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000007FU))
  6327. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
  6328. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
  6329. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00000007U))
  6330. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
  6331. #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
  6332. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000000FU))
  6333. #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
  6334. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6335. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x0000001FU))
  6336. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6337. #if defined(STM32F446xx)
  6338. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00000FFFU))
  6339. #endif /* STM32F446xx */
  6340. #if defined(STM32F469xx) || defined(STM32F479xx)
  6341. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x000001FFU))
  6342. #endif /* STM32F469xx || STM32F479xx */
  6343. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
  6344. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x000003FFU))
  6345. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
  6346. #if defined(STM32F413xx) || defined(STM32F423xx)
  6347. #define IS_RCC_PERIPHCLOCK(SELECTION) ((1U <= (SELECTION)) && ((SELECTION) <= 0x00007FFFU))
  6348. #endif /* STM32F413xx || STM32F423xx */
  6349. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6350. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
  6351. defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  6352. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U))
  6353. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((50U <= (VALUE)) && ((VALUE) <= 432U))
  6354. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U))
  6355. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6356. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6357. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6358. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDIVR_2) ||\
  6359. ((VALUE) == RCC_PLLSAIDIVR_4) ||\
  6360. ((VALUE) == RCC_PLLSAIDIVR_8) ||\
  6361. ((VALUE) == RCC_PLLSAIDIVR_16))
  6362. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
  6363. #if defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  6364. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  6365. #define IS_RCC_PLLI2SM_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 63U))
  6366. #define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\
  6367. ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
  6368. #endif /* STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6369. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6370. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6371. #define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\
  6372. ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
  6373. #define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\
  6374. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\
  6375. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI))
  6376. #define IS_RCC_LPTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) ||\
  6377. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) ||\
  6378. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) ||\
  6379. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  6380. #define IS_RCC_I2SAPBCLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPBCLKSOURCE_PLLR) ||\
  6381. ((SOURCE) == RCC_I2SAPBCLKSOURCE_EXT) ||\
  6382. ((SOURCE) == RCC_I2SAPBCLKSOURCE_PLLSRC))
  6383. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6384. #if defined(STM32F446xx)
  6385. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6386. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == RCC_PLLI2SP_DIV2) ||\
  6387. ((VALUE) == RCC_PLLI2SP_DIV4) ||\
  6388. ((VALUE) == RCC_PLLI2SP_DIV6) ||\
  6389. ((VALUE) == RCC_PLLI2SP_DIV8))
  6390. #define IS_RCC_PLLSAIM_VALUE(VALUE) ((VALUE) <= 63U)
  6391. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\
  6392. ((VALUE) == RCC_PLLSAIP_DIV4) ||\
  6393. ((VALUE) == RCC_PLLSAIP_DIV6) ||\
  6394. ((VALUE) == RCC_PLLSAIP_DIV8))
  6395. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) ||\
  6396. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) ||\
  6397. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLR) ||\
  6398. ((SOURCE) == RCC_SAI1CLKSOURCE_EXT))
  6399. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) ||\
  6400. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) ||\
  6401. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLR) ||\
  6402. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLSRC))
  6403. #define IS_RCC_I2SAPB1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLI2S) ||\
  6404. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_EXT) ||\
  6405. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLR) ||\
  6406. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLSRC))
  6407. #define IS_RCC_I2SAPB2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLI2S) ||\
  6408. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_EXT) ||\
  6409. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLR) ||\
  6410. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLSRC))
  6411. #define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\
  6412. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\
  6413. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI))
  6414. #define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_HSI) ||\
  6415. ((SOURCE) == RCC_CECCLKSOURCE_LSE))
  6416. #define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\
  6417. ((SOURCE) == RCC_CLK48CLKSOURCE_PLLSAIP))
  6418. #define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\
  6419. ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK))
  6420. #define IS_RCC_SPDIFRXCLKSOURCE(SOURCE) (((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLLR) ||\
  6421. ((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLLI2SP))
  6422. #endif /* STM32F446xx */
  6423. #if defined(STM32F469xx) || defined(STM32F479xx)
  6424. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6425. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\
  6426. ((VALUE) == RCC_PLLSAIP_DIV4) ||\
  6427. ((VALUE) == RCC_PLLSAIP_DIV6) ||\
  6428. ((VALUE) == RCC_PLLSAIP_DIV8))
  6429. #define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\
  6430. ((SOURCE) == RCC_CLK48CLKSOURCE_PLLSAIP))
  6431. #define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\
  6432. ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK))
  6433. #define IS_RCC_DSIBYTELANECLKSOURCE(SOURCE) (((SOURCE) == RCC_DSICLKSOURCE_PLLR) ||\
  6434. ((SOURCE) == RCC_DSICLKSOURCE_DSIPHY))
  6435. #define IS_RCC_LSE_MODE(MODE) (((MODE) == RCC_LSE_LOWPOWER_MODE) ||\
  6436. ((MODE) == RCC_LSE_HIGHDRIVE_MODE))
  6437. #endif /* STM32F469xx || STM32F479xx */
  6438. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\
  6439. defined(STM32F413xx) || defined(STM32F423xx)
  6440. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 15U))
  6441. #define IS_RCC_PLLR_VALUE(VALUE) ((2U <= (VALUE)) && ((VALUE) <= 7U))
  6442. #define IS_RCC_PLLI2SCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLI2SCLKSOURCE_PLLSRC) || \
  6443. ((__SOURCE__) == RCC_PLLI2SCLKSOURCE_EXT))
  6444. #define IS_RCC_I2SAPB1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLI2S) ||\
  6445. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_EXT) ||\
  6446. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLR) ||\
  6447. ((SOURCE) == RCC_I2SAPB1CLKSOURCE_PLLSRC))
  6448. #define IS_RCC_I2SAPB2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLI2S) ||\
  6449. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_EXT) ||\
  6450. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLR) ||\
  6451. ((SOURCE) == RCC_I2SAPB2CLKSOURCE_PLLSRC))
  6452. #define IS_RCC_FMPI2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_FMPI2C1CLKSOURCE_PCLK1) ||\
  6453. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_SYSCLK) ||\
  6454. ((SOURCE) == RCC_FMPI2C1CLKSOURCE_HSI))
  6455. #define IS_RCC_CLK48CLKSOURCE(SOURCE) (((SOURCE) == RCC_CLK48CLKSOURCE_PLLQ) ||\
  6456. ((SOURCE) == RCC_CLK48CLKSOURCE_PLLI2SQ))
  6457. #define IS_RCC_SDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_SDIOCLKSOURCE_CLK48) ||\
  6458. ((SOURCE) == RCC_SDIOCLKSOURCE_SYSCLK))
  6459. #define IS_RCC_DFSDM1CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM1CLKSOURCE_PCLK2) || \
  6460. ((__SOURCE__) == RCC_DFSDM1CLKSOURCE_SYSCLK))
  6461. #define IS_RCC_DFSDM1AUDIOCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM1AUDIOCLKSOURCE_I2S1) || \
  6462. ((__SOURCE__) == RCC_DFSDM1AUDIOCLKSOURCE_I2S2))
  6463. #if defined(STM32F413xx) || defined(STM32F423xx)
  6464. #define IS_RCC_DFSDM2CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM2CLKSOURCE_PCLK2) || \
  6465. ((__SOURCE__) == RCC_DFSDM2CLKSOURCE_SYSCLK))
  6466. #define IS_RCC_DFSDM2AUDIOCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_DFSDM2AUDIOCLKSOURCE_I2S1) || \
  6467. ((__SOURCE__) == RCC_DFSDM2AUDIOCLKSOURCE_I2S2))
  6468. #define IS_RCC_LPTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) ||\
  6469. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) ||\
  6470. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) ||\
  6471. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  6472. #define IS_RCC_SAIACLKSOURCE(SOURCE) (((SOURCE) == RCC_SAIACLKSOURCE_PLLI2SR) ||\
  6473. ((SOURCE) == RCC_SAIACLKSOURCE_EXT) ||\
  6474. ((SOURCE) == RCC_SAIACLKSOURCE_PLLR) ||\
  6475. ((SOURCE) == RCC_SAIACLKSOURCE_PLLSRC))
  6476. #define IS_RCC_SAIBCLKSOURCE(SOURCE) (((SOURCE) == RCC_SAIBCLKSOURCE_PLLI2SR) ||\
  6477. ((SOURCE) == RCC_SAIBCLKSOURCE_EXT) ||\
  6478. ((SOURCE) == RCC_SAIBCLKSOURCE_PLLR) ||\
  6479. ((SOURCE) == RCC_SAIBCLKSOURCE_PLLSRC))
  6480. #define IS_RCC_PLL_DIVR_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6481. #define IS_RCC_PLLI2S_DIVR_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 32U))
  6482. #endif /* STM32F413xx || STM32F423xx */
  6483. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  6484. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  6485. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  6486. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  6487. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  6488. defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
  6489. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_PLLI2SCLK)|| \
  6490. ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK))
  6491. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  6492. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || \
  6493. STM32F412Rx */
  6494. #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
  6495. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_I2SCLK)|| \
  6496. ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK))
  6497. #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
  6498. /**
  6499. * @}
  6500. */
  6501. /**
  6502. * @}
  6503. */
  6504. /**
  6505. * @}
  6506. */
  6507. /**
  6508. * @}
  6509. */
  6510. #ifdef __cplusplus
  6511. }
  6512. #endif
  6513. #endif /* __STM32F4xx_HAL_RCC_EX_H */
  6514. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/