stm32f7xx_hal_rcc_ex.h 227 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_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 __STM32F7xx_HAL_RCC_EX_H
  37. #define __STM32F7xx_HAL_RCC_EX_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f7xx_hal_def.h"
  43. /** @addtogroup STM32F7xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup RCCEx
  47. * @{
  48. */
  49. /* Exported types ------------------------------------------------------------*/
  50. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  51. * @{
  52. */
  53. /**
  54. * @brief RCC PLL configuration structure definition
  55. */
  56. typedef struct
  57. {
  58. uint32_t PLLState; /*!< The new state of the PLL.
  59. This parameter can be a value of @ref RCC_PLL_Config */
  60. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  61. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  62. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  63. This parameter must be a number between Min_Data = 2 and Max_Data = 63 */
  64. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  65. This parameter must be a number between Min_Data = 50 and Max_Data = 432 */
  66. uint32_t PLLP; /*!< PLLP: Division factor for main system clock (SYSCLK).
  67. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  68. uint32_t PLLQ; /*!< PLLQ: Division factor for OTG FS, SDMMC and RNG clocks.
  69. This parameter must be a number between Min_Data = 2 and Max_Data = 15 */
  70. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  71. uint32_t PLLR; /*!< PLLR: Division factor for DSI clock.
  72. This parameter must be a number between Min_Data = 2 and Max_Data = 7 */
  73. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  74. }RCC_PLLInitTypeDef;
  75. /**
  76. * @brief PLLI2S Clock structure definition
  77. */
  78. typedef struct
  79. {
  80. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  81. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  82. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  83. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  84. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  85. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  86. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI1 clock.
  87. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  88. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  89. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  90. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  91. uint32_t PLLI2SP; /*!< Specifies the division factor for SPDIF-RX clock.
  92. This parameter must be a value of @ref RCCEx_PLLI2SP_Clock_Divider.
  93. This parameter will be used only when PLLI2S is selected as Clock Source SPDIF-RX */
  94. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  95. }RCC_PLLI2SInitTypeDef;
  96. /**
  97. * @brief PLLSAI Clock structure definition
  98. */
  99. typedef struct
  100. {
  101. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  102. This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  103. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  104. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI1 clock.
  105. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  106. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  107. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  108. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  109. uint32_t PLLSAIR; /*!< specifies the division factor for LTDC clock
  110. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  111. This parameter will be used only when PLLSAI is selected as Clock Source LTDC */
  112. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  113. uint32_t PLLSAIP; /*!< Specifies the division factor for 48MHz clock.
  114. This parameter must be a value of @ref RCCEx_PLLSAIP_Clock_Divider
  115. This parameter will be used only when PLLSAI is disabled */
  116. }RCC_PLLSAIInitTypeDef;
  117. /**
  118. * @brief RCC extended clocks structure definition
  119. */
  120. typedef struct
  121. {
  122. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  123. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  124. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  125. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  126. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  127. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  128. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  129. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  130. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  131. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  132. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  133. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  134. uint32_t PLLSAIDivR; /*!< Specifies the PLLSAI division factor for LTDC clock.
  135. This parameter must be one value of @ref RCCEx_PLLSAI_DIVR */
  136. uint32_t RTCClockSelection; /*!< Specifies RTC Clock source Selection.
  137. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  138. uint32_t I2sClockSelection; /*!< Specifies I2S Clock source Selection.
  139. This parameter can be a value of @ref RCCEx_I2S_Clock_Source */
  140. uint32_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection.
  141. This parameter can be a value of @ref RCCEx_TIM_Prescaler_Selection */
  142. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 Clock Prescalers Selection
  143. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  144. uint32_t Sai2ClockSelection; /*!< Specifies SAI2 Clock Prescalers Selection
  145. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */
  146. uint32_t Usart1ClockSelection; /*!< USART1 clock source
  147. This parameter can be a value of @ref RCCEx_USART1_Clock_Source */
  148. uint32_t Usart2ClockSelection; /*!< USART2 clock source
  149. This parameter can be a value of @ref RCCEx_USART2_Clock_Source */
  150. uint32_t Usart3ClockSelection; /*!< USART3 clock source
  151. This parameter can be a value of @ref RCCEx_USART3_Clock_Source */
  152. uint32_t Uart4ClockSelection; /*!< UART4 clock source
  153. This parameter can be a value of @ref RCCEx_UART4_Clock_Source */
  154. uint32_t Uart5ClockSelection; /*!< UART5 clock source
  155. This parameter can be a value of @ref RCCEx_UART5_Clock_Source */
  156. uint32_t Usart6ClockSelection; /*!< USART6 clock source
  157. This parameter can be a value of @ref RCCEx_USART6_Clock_Source */
  158. uint32_t Uart7ClockSelection; /*!< UART7 clock source
  159. This parameter can be a value of @ref RCCEx_UART7_Clock_Source */
  160. uint32_t Uart8ClockSelection; /*!< UART8 clock source
  161. This parameter can be a value of @ref RCCEx_UART8_Clock_Source */
  162. uint32_t I2c1ClockSelection; /*!< I2C1 clock source
  163. This parameter can be a value of @ref RCCEx_I2C1_Clock_Source */
  164. uint32_t I2c2ClockSelection; /*!< I2C2 clock source
  165. This parameter can be a value of @ref RCCEx_I2C2_Clock_Source */
  166. uint32_t I2c3ClockSelection; /*!< I2C3 clock source
  167. This parameter can be a value of @ref RCCEx_I2C3_Clock_Source */
  168. uint32_t I2c4ClockSelection; /*!< I2C4 clock source
  169. This parameter can be a value of @ref RCCEx_I2C4_Clock_Source */
  170. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 clock source
  171. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  172. uint32_t CecClockSelection; /*!< CEC clock source
  173. This parameter can be a value of @ref RCCEx_CEC_Clock_Source */
  174. uint32_t Clk48ClockSelection; /*!< Specifies 48Mhz clock source used by USB OTG FS, RNG and SDMMC
  175. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  176. uint32_t Sdmmc1ClockSelection; /*!< SDMMC1 clock source
  177. This parameter can be a value of @ref RCCEx_SDMMC1_Clock_Source */
  178. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  179. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  180. uint32_t Sdmmc2ClockSelection; /*!< SDMMC2 clock source
  181. This parameter can be a value of @ref RCCEx_SDMMC2_Clock_Source */
  182. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  183. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  184. uint32_t Dfsdm1ClockSelection; /*!< DFSDM1 clock source
  185. This parameter can be a value of @ref RCCEx_DFSDM1_Kernel_Clock_Source */
  186. uint32_t Dfsdm1AudioClockSelection; /*!< DFSDM1 clock source
  187. This parameter can be a value of @ref RCCEx_DFSDM1_AUDIO_Clock_Source */
  188. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  189. }RCC_PeriphCLKInitTypeDef;
  190. /**
  191. * @}
  192. */
  193. /* Exported constants --------------------------------------------------------*/
  194. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  195. * @{
  196. */
  197. /** @defgroup RCCEx_Periph_Clock_Selection RCC Periph Clock Selection
  198. * @{
  199. */
  200. #define RCC_PERIPHCLK_I2S ((uint32_t)0x00000001U)
  201. #if defined(STM32F746xx) || defined(STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  202. #define RCC_PERIPHCLK_LTDC ((uint32_t)0x00000008U)
  203. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  204. #define RCC_PERIPHCLK_TIM ((uint32_t)0x00000010U)
  205. #define RCC_PERIPHCLK_RTC ((uint32_t)0x00000020U)
  206. #define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000040U)
  207. #define RCC_PERIPHCLK_USART2 ((uint32_t)0x00000080U)
  208. #define RCC_PERIPHCLK_USART3 ((uint32_t)0x00000100U)
  209. #define RCC_PERIPHCLK_UART4 ((uint32_t)0x00000200U)
  210. #define RCC_PERIPHCLK_UART5 ((uint32_t)0x00000400U)
  211. #define RCC_PERIPHCLK_USART6 ((uint32_t)0x00000800U)
  212. #define RCC_PERIPHCLK_UART7 ((uint32_t)0x00001000U)
  213. #define RCC_PERIPHCLK_UART8 ((uint32_t)0x00002000U)
  214. #define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00004000U)
  215. #define RCC_PERIPHCLK_I2C2 ((uint32_t)0x00008000U)
  216. #define RCC_PERIPHCLK_I2C3 ((uint32_t)0x00010000U)
  217. #define RCC_PERIPHCLK_I2C4 ((uint32_t)0x00020000U)
  218. #define RCC_PERIPHCLK_LPTIM1 ((uint32_t)0x00040000U)
  219. #define RCC_PERIPHCLK_SAI1 ((uint32_t)0x00080000U)
  220. #define RCC_PERIPHCLK_SAI2 ((uint32_t)0x00100000U)
  221. #define RCC_PERIPHCLK_CLK48 ((uint32_t)0x00200000U)
  222. #define RCC_PERIPHCLK_CEC ((uint32_t)0x00400000U)
  223. #define RCC_PERIPHCLK_SDMMC1 ((uint32_t)0x00800000U)
  224. #define RCC_PERIPHCLK_SPDIFRX ((uint32_t)0x01000000U)
  225. #define RCC_PERIPHCLK_PLLI2S ((uint32_t)0x02000000U)
  226. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  227. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  228. #define RCC_PERIPHCLK_SDMMC2 ((uint32_t)0x04000000U)
  229. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  230. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  231. #define RCC_PERIPHCLK_DFSDM1 ((uint32_t)0x08000000U)
  232. #define RCC_PERIPHCLK_DFSDM1_AUDIO ((uint32_t)0x10000000U)
  233. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  234. /**
  235. * @}
  236. */
  237. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  238. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  239. /** @defgroup RCCEx_PLLI2SP_Clock_Divider RCCEx PLLI2SP Clock Divider
  240. * @{
  241. */
  242. #define RCC_PLLI2SP_DIV2 ((uint32_t)0x00000000U)
  243. #define RCC_PLLI2SP_DIV4 ((uint32_t)0x00000001U)
  244. #define RCC_PLLI2SP_DIV6 ((uint32_t)0x00000002U)
  245. #define RCC_PLLI2SP_DIV8 ((uint32_t)0x00000003U)
  246. /**
  247. * @}
  248. */
  249. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  250. /** @defgroup RCCEx_PLLSAIP_Clock_Divider RCCEx PLLSAIP Clock Divider
  251. * @{
  252. */
  253. #define RCC_PLLSAIP_DIV2 ((uint32_t)0x00000000U)
  254. #define RCC_PLLSAIP_DIV4 ((uint32_t)0x00000001U)
  255. #define RCC_PLLSAIP_DIV6 ((uint32_t)0x00000002U)
  256. #define RCC_PLLSAIP_DIV8 ((uint32_t)0x00000003U)
  257. /**
  258. * @}
  259. */
  260. /** @defgroup RCCEx_PLLSAI_DIVR RCCEx PLLSAI DIVR
  261. * @{
  262. */
  263. #define RCC_PLLSAIDIVR_2 ((uint32_t)0x00000000U)
  264. #define RCC_PLLSAIDIVR_4 RCC_DCKCFGR1_PLLSAIDIVR_0
  265. #define RCC_PLLSAIDIVR_8 RCC_DCKCFGR1_PLLSAIDIVR_1
  266. #define RCC_PLLSAIDIVR_16 RCC_DCKCFGR1_PLLSAIDIVR
  267. /**
  268. * @}
  269. */
  270. /** @defgroup RCCEx_I2S_Clock_Source RCCEx I2S Clock Source
  271. * @{
  272. */
  273. #define RCC_I2SCLKSOURCE_PLLI2S ((uint32_t)0x00000000U)
  274. #define RCC_I2SCLKSOURCE_EXT RCC_CFGR_I2SSRC
  275. /**
  276. * @}
  277. */
  278. /** @defgroup RCCEx_SAI1_Clock_Source RCCEx SAI1 Clock Source
  279. * @{
  280. */
  281. #define RCC_SAI1CLKSOURCE_PLLSAI ((uint32_t)0x00000000U)
  282. #define RCC_SAI1CLKSOURCE_PLLI2S RCC_DCKCFGR1_SAI1SEL_0
  283. #define RCC_SAI1CLKSOURCE_PIN RCC_DCKCFGR1_SAI1SEL_1
  284. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  285. #define RCC_SAI1CLKSOURCE_PLLSRC RCC_DCKCFGR1_SAI1SEL
  286. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  287. /**
  288. * @}
  289. */
  290. /** @defgroup RCCEx_SAI2_Clock_Source RCCEx SAI2 Clock Source
  291. * @{
  292. */
  293. #define RCC_SAI2CLKSOURCE_PLLSAI ((uint32_t)0x00000000U)
  294. #define RCC_SAI2CLKSOURCE_PLLI2S RCC_DCKCFGR1_SAI2SEL_0
  295. #define RCC_SAI2CLKSOURCE_PIN RCC_DCKCFGR1_SAI2SEL_1
  296. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  297. #define RCC_SAI2CLKSOURCE_PLLSRC RCC_DCKCFGR1_SAI2SEL
  298. #endif /* STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  299. /**
  300. * @}
  301. */
  302. /** @defgroup RCCEx_CEC_Clock_Source RCCEx CEC Clock Source
  303. * @{
  304. */
  305. #define RCC_CECCLKSOURCE_LSE ((uint32_t)0x00000000U)
  306. #define RCC_CECCLKSOURCE_HSI RCC_DCKCFGR2_CECSEL /* CEC clock is HSI/488*/
  307. /**
  308. * @}
  309. */
  310. /** @defgroup RCCEx_USART1_Clock_Source RCCEx USART1 Clock Source
  311. * @{
  312. */
  313. #define RCC_USART1CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  314. #define RCC_USART1CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART1SEL_0
  315. #define RCC_USART1CLKSOURCE_HSI RCC_DCKCFGR2_USART1SEL_1
  316. #define RCC_USART1CLKSOURCE_LSE RCC_DCKCFGR2_USART1SEL
  317. /**
  318. * @}
  319. */
  320. /** @defgroup RCCEx_USART2_Clock_Source RCCEx USART2 Clock Source
  321. * @{
  322. */
  323. #define RCC_USART2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  324. #define RCC_USART2CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART2SEL_0
  325. #define RCC_USART2CLKSOURCE_HSI RCC_DCKCFGR2_USART2SEL_1
  326. #define RCC_USART2CLKSOURCE_LSE RCC_DCKCFGR2_USART2SEL
  327. /**
  328. * @}
  329. */
  330. /** @defgroup RCCEx_USART3_Clock_Source RCCEx USART3 Clock Source
  331. * @{
  332. */
  333. #define RCC_USART3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  334. #define RCC_USART3CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART3SEL_0
  335. #define RCC_USART3CLKSOURCE_HSI RCC_DCKCFGR2_USART3SEL_1
  336. #define RCC_USART3CLKSOURCE_LSE RCC_DCKCFGR2_USART3SEL
  337. /**
  338. * @}
  339. */
  340. /** @defgroup RCCEx_UART4_Clock_Source RCCEx UART4 Clock Source
  341. * @{
  342. */
  343. #define RCC_UART4CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  344. #define RCC_UART4CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART4SEL_0
  345. #define RCC_UART4CLKSOURCE_HSI RCC_DCKCFGR2_UART4SEL_1
  346. #define RCC_UART4CLKSOURCE_LSE RCC_DCKCFGR2_UART4SEL
  347. /**
  348. * @}
  349. */
  350. /** @defgroup RCCEx_UART5_Clock_Source RCCEx UART5 Clock Source
  351. * @{
  352. */
  353. #define RCC_UART5CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  354. #define RCC_UART5CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART5SEL_0
  355. #define RCC_UART5CLKSOURCE_HSI RCC_DCKCFGR2_UART5SEL_1
  356. #define RCC_UART5CLKSOURCE_LSE RCC_DCKCFGR2_UART5SEL
  357. /**
  358. * @}
  359. */
  360. /** @defgroup RCCEx_USART6_Clock_Source RCCEx USART6 Clock Source
  361. * @{
  362. */
  363. #define RCC_USART6CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  364. #define RCC_USART6CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART6SEL_0
  365. #define RCC_USART6CLKSOURCE_HSI RCC_DCKCFGR2_USART6SEL_1
  366. #define RCC_USART6CLKSOURCE_LSE RCC_DCKCFGR2_USART6SEL
  367. /**
  368. * @}
  369. */
  370. /** @defgroup RCCEx_UART7_Clock_Source RCCEx UART7 Clock Source
  371. * @{
  372. */
  373. #define RCC_UART7CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  374. #define RCC_UART7CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART7SEL_0
  375. #define RCC_UART7CLKSOURCE_HSI RCC_DCKCFGR2_UART7SEL_1
  376. #define RCC_UART7CLKSOURCE_LSE RCC_DCKCFGR2_UART7SEL
  377. /**
  378. * @}
  379. */
  380. /** @defgroup RCCEx_UART8_Clock_Source RCCEx UART8 Clock Source
  381. * @{
  382. */
  383. #define RCC_UART8CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  384. #define RCC_UART8CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART8SEL_0
  385. #define RCC_UART8CLKSOURCE_HSI RCC_DCKCFGR2_UART8SEL_1
  386. #define RCC_UART8CLKSOURCE_LSE RCC_DCKCFGR2_UART8SEL
  387. /**
  388. * @}
  389. */
  390. /** @defgroup RCCEx_I2C1_Clock_Source RCCEx I2C1 Clock Source
  391. * @{
  392. */
  393. #define RCC_I2C1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  394. #define RCC_I2C1CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C1SEL_0
  395. #define RCC_I2C1CLKSOURCE_HSI RCC_DCKCFGR2_I2C1SEL_1
  396. /**
  397. * @}
  398. */
  399. /** @defgroup RCCEx_I2C2_Clock_Source RCCEx I2C2 Clock Source
  400. * @{
  401. */
  402. #define RCC_I2C2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  403. #define RCC_I2C2CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C2SEL_0
  404. #define RCC_I2C2CLKSOURCE_HSI RCC_DCKCFGR2_I2C2SEL_1
  405. /**
  406. * @}
  407. */
  408. /** @defgroup RCCEx_I2C3_Clock_Source RCCEx I2C3 Clock Source
  409. * @{
  410. */
  411. #define RCC_I2C3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  412. #define RCC_I2C3CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C3SEL_0
  413. #define RCC_I2C3CLKSOURCE_HSI RCC_DCKCFGR2_I2C3SEL_1
  414. /**
  415. * @}
  416. */
  417. /** @defgroup RCCEx_I2C4_Clock_Source RCCEx I2C4 Clock Source
  418. * @{
  419. */
  420. #define RCC_I2C4CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  421. #define RCC_I2C4CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C4SEL_0
  422. #define RCC_I2C4CLKSOURCE_HSI RCC_DCKCFGR2_I2C4SEL_1
  423. /**
  424. * @}
  425. */
  426. /** @defgroup RCCEx_LPTIM1_Clock_Source RCCEx LPTIM1 Clock Source
  427. * @{
  428. */
  429. #define RCC_LPTIM1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  430. #define RCC_LPTIM1CLKSOURCE_LSI RCC_DCKCFGR2_LPTIM1SEL_0
  431. #define RCC_LPTIM1CLKSOURCE_HSI RCC_DCKCFGR2_LPTIM1SEL_1
  432. #define RCC_LPTIM1CLKSOURCE_LSE RCC_DCKCFGR2_LPTIM1SEL
  433. /**
  434. * @}
  435. */
  436. /** @defgroup RCCEx_CLK48_Clock_Source RCCEx CLK48 Clock Source
  437. * @{
  438. */
  439. #define RCC_CLK48SOURCE_PLL ((uint32_t)0x00000000U)
  440. #define RCC_CLK48SOURCE_PLLSAIP RCC_DCKCFGR2_CK48MSEL
  441. /**
  442. * @}
  443. */
  444. /** @defgroup RCCEx_TIM_Prescaler_Selection RCCEx TIM Prescaler Selection
  445. * @{
  446. */
  447. #define RCC_TIMPRES_DESACTIVATED ((uint32_t)0x00000000U)
  448. #define RCC_TIMPRES_ACTIVATED RCC_DCKCFGR1_TIMPRE
  449. /**
  450. * @}
  451. */
  452. /** @defgroup RCCEx_SDMMC1_Clock_Source RCCEx SDMMC1 Clock Source
  453. * @{
  454. */
  455. #define RCC_SDMMC1CLKSOURCE_CLK48 ((uint32_t)0x00000000U)
  456. #define RCC_SDMMC1CLKSOURCE_SYSCLK RCC_DCKCFGR2_SDMMC1SEL
  457. /**
  458. * @}
  459. */
  460. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  461. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  462. /** @defgroup RCCEx_SDMMC2_Clock_Source RCCEx SDMMC2 Clock Source
  463. * @{
  464. */
  465. #define RCC_SDMMC2CLKSOURCE_CLK48 ((uint32_t)0x00000000U)
  466. #define RCC_SDMMC2CLKSOURCE_SYSCLK RCC_DCKCFGR2_SDMMC2SEL
  467. /**
  468. * @}
  469. */
  470. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  471. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  472. /** @defgroup RCCEx_DFSDM1_Kernel_Clock_Source RCCEx DFSDM1 Kernel Clock Source
  473. * @{
  474. */
  475. #define RCC_DFSDM1CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  476. #define RCC_DFSDM1CLKSOURCE_SYSCLK RCC_DCKCFGR1_DFSDM1SEL
  477. /**
  478. * @}
  479. */
  480. /** @defgroup RCCEx_DFSDM1_AUDIO_Clock_Source RCCEx DFSDM1 AUDIO Clock Source
  481. * @{
  482. */
  483. #define RCC_DFSDM1AUDIOCLKSOURCE_SAI1 ((uint32_t)0x00000000U)
  484. #define RCC_DFSDM1AUDIOCLKSOURCE_SAI2 RCC_DCKCFGR1_ADFSDM1SEL
  485. /**
  486. * @}
  487. */
  488. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  489. #if defined (STM32F769xx) || defined (STM32F779xx)
  490. /** @defgroup RCCEx_DSI_Clock_Source RCC DSI Clock Source
  491. * @{
  492. */
  493. #define RCC_DSICLKSOURCE_DSIPHY ((uint32_t)0x00000000U)
  494. #define RCC_DSICLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR2_DSISEL)
  495. /**
  496. * @}
  497. */
  498. #endif /* STM32F769xx || STM32F779xx */
  499. /**
  500. * @}
  501. */
  502. /* Exported macro ------------------------------------------------------------*/
  503. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  504. * @{
  505. */
  506. /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable RCCEx_Peripheral_Clock_Enable_Disable
  507. * @brief Enables or disables the AHB/APB peripheral clock.
  508. * @note After reset, the peripheral clock (used for registers read/write access)
  509. * is disabled and the application software has to enable this clock before
  510. * using it.
  511. * @{
  512. */
  513. /** @brief Enables or disables the AHB1 peripheral clock.
  514. * @note After reset, the peripheral clock (used for registers read/write access)
  515. * is disabled and the application software has to enable this clock before
  516. * using it.
  517. */
  518. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  519. __IO uint32_t tmpreg; \
  520. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  521. /* Delay after an RCC peripheral clock enabling */ \
  522. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  523. UNUSED(tmpreg); \
  524. } while(0)
  525. #define __HAL_RCC_DTCMRAMEN_CLK_ENABLE() do { \
  526. __IO uint32_t tmpreg; \
  527. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DTCMRAMEN);\
  528. /* Delay after an RCC peripheral clock enabling */ \
  529. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DTCMRAMEN);\
  530. UNUSED(tmpreg); \
  531. } while(0)
  532. #define __HAL_RCC_DMA2_CLK_ENABLE() do { \
  533. __IO uint32_t tmpreg; \
  534. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  535. /* Delay after an RCC peripheral clock enabling */ \
  536. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  537. UNUSED(tmpreg); \
  538. } while(0)
  539. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  540. __IO uint32_t tmpreg; \
  541. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  542. /* Delay after an RCC peripheral clock enabling */ \
  543. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  544. UNUSED(tmpreg); \
  545. } while(0)
  546. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  547. __IO uint32_t tmpreg; \
  548. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  549. /* Delay after an RCC peripheral clock enabling */ \
  550. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  551. UNUSED(tmpreg); \
  552. } while(0)
  553. #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
  554. __IO uint32_t tmpreg; \
  555. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
  556. /* Delay after an RCC peripheral clock enabling */ \
  557. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
  558. UNUSED(tmpreg); \
  559. } while(0)
  560. #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
  561. __IO uint32_t tmpreg; \
  562. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\
  563. /* Delay after an RCC peripheral clock enabling */ \
  564. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\
  565. UNUSED(tmpreg); \
  566. } while(0)
  567. #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
  568. __IO uint32_t tmpreg; \
  569. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\
  570. /* Delay after an RCC peripheral clock enabling */ \
  571. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\
  572. UNUSED(tmpreg); \
  573. } while(0)
  574. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  575. __IO uint32_t tmpreg; \
  576. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  577. /* Delay after an RCC peripheral clock enabling */ \
  578. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  579. UNUSED(tmpreg); \
  580. } while(0)
  581. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  582. __IO uint32_t tmpreg; \
  583. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  584. /* Delay after an RCC peripheral clock enabling */ \
  585. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  586. UNUSED(tmpreg); \
  587. } while(0)
  588. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  589. __IO uint32_t tmpreg; \
  590. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  591. /* Delay after an RCC peripheral clock enabling */ \
  592. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  593. UNUSED(tmpreg); \
  594. } while(0)
  595. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  596. __IO uint32_t tmpreg; \
  597. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  598. /* Delay after an RCC peripheral clock enabling */ \
  599. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  600. UNUSED(tmpreg); \
  601. } while(0)
  602. #define __HAL_RCC_GPIOH_CLK_ENABLE() do { \
  603. __IO uint32_t tmpreg; \
  604. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\
  605. /* Delay after an RCC peripheral clock enabling */ \
  606. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\
  607. UNUSED(tmpreg); \
  608. } while(0)
  609. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  610. __IO uint32_t tmpreg; \
  611. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  612. /* Delay after an RCC peripheral clock enabling */ \
  613. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  614. UNUSED(tmpreg); \
  615. } while(0)
  616. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  617. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  618. defined (STM32F750xx)
  619. #define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \
  620. __IO uint32_t tmpreg; \
  621. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  622. /* Delay after an RCC peripheral clock enabling */ \
  623. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  624. UNUSED(tmpreg); \
  625. } while(0)
  626. #define __HAL_RCC_GPIOK_CLK_ENABLE() do { \
  627. __IO uint32_t tmpreg; \
  628. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  629. /* Delay after an RCC peripheral clock enabling */ \
  630. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  631. UNUSED(tmpreg); \
  632. } while(0)
  633. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  634. __IO uint32_t tmpreg; \
  635. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  636. /* Delay after an RCC peripheral clock enabling */ \
  637. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  638. UNUSED(tmpreg); \
  639. } while(0)
  640. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  641. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  642. #define __HAL_RCC_DTCMRAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DTCMRAMEN))
  643. #define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2EN))
  644. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  645. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  646. #define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOAEN))
  647. #define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOBEN))
  648. #define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOCEN))
  649. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  650. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  651. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  652. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  653. #define __HAL_RCC_GPIOH_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOHEN))
  654. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  655. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  656. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  657. defined (STM32F750xx)
  658. #define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOJEN))
  659. #define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOKEN))
  660. #define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2DEN))
  661. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  662. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  663. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  664. defined (STM32F750xx)
  665. /**
  666. * @brief Enable ETHERNET clock.
  667. */
  668. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  669. __IO uint32_t tmpreg; \
  670. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  671. /* Delay after an RCC peripheral clock enabling */ \
  672. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  673. UNUSED(tmpreg); \
  674. } while(0)
  675. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  676. __IO uint32_t tmpreg; \
  677. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  678. /* Delay after an RCC peripheral clock enabling */ \
  679. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  680. UNUSED(tmpreg); \
  681. } while(0)
  682. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  683. __IO uint32_t tmpreg; \
  684. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  685. /* Delay after an RCC peripheral clock enabling */ \
  686. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  687. UNUSED(tmpreg); \
  688. } while(0)
  689. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  690. __IO uint32_t tmpreg; \
  691. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  692. /* Delay after an RCC peripheral clock enabling */ \
  693. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  694. UNUSED(tmpreg); \
  695. } while(0)
  696. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  697. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  698. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  699. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  700. } while(0)
  701. /**
  702. * @brief Disable ETHERNET clock.
  703. */
  704. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  705. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  706. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  707. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  708. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  709. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  710. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  711. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  712. } while(0)
  713. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  714. /** @brief Enable or disable the AHB2 peripheral clock.
  715. * @note After reset, the peripheral clock (used for registers read/write access)
  716. * is disabled and the application software has to enable this clock before
  717. * using it.
  718. */
  719. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  720. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  721. defined (STM32F750xx)
  722. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  723. __IO uint32_t tmpreg; \
  724. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  725. /* Delay after an RCC peripheral clock enabling */ \
  726. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  727. UNUSED(tmpreg); \
  728. } while(0)
  729. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  730. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  731. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  732. #define __HAL_RCC_JPEG_CLK_ENABLE() do { \
  733. __IO uint32_t tmpreg; \
  734. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_JPEGEN);\
  735. /* Delay after an RCC peripheral clock enabling */ \
  736. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_JPEGEN);\
  737. UNUSED(tmpreg); \
  738. } while(0)
  739. #define __HAL_RCC_JPEG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_JPEGEN))
  740. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  741. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  742. __IO uint32_t tmpreg; \
  743. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  744. /* Delay after an RCC peripheral clock enabling */ \
  745. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  746. UNUSED(tmpreg); \
  747. } while(0)
  748. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \
  749. __IO uint32_t tmpreg; \
  750. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);\
  751. /* Delay after an RCC peripheral clock enabling */ \
  752. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);\
  753. UNUSED(tmpreg); \
  754. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  755. } while(0)
  756. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  757. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN))
  758. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  759. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  760. __IO uint32_t tmpreg; \
  761. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  762. /* Delay after an RCC peripheral clock enabling */ \
  763. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  764. UNUSED(tmpreg); \
  765. } while(0)
  766. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  767. __IO uint32_t tmpreg; \
  768. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  769. /* Delay after an RCC peripheral clock enabling */ \
  770. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  771. UNUSED(tmpreg); \
  772. } while(0)
  773. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  774. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  775. #endif /* STM32F756x || STM32F777xx || STM32F779xx || STM32F750xx */
  776. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  777. #define __HAL_RCC_AES_CLK_ENABLE() do { \
  778. __IO uint32_t tmpreg; \
  779. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  780. /* Delay after an RCC peripheral clock enabling */ \
  781. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_AESEN);\
  782. UNUSED(tmpreg); \
  783. } while(0)
  784. #define __HAL_RCC_AES_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_AESEN))
  785. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  786. /** @brief Enables or disables the AHB3 peripheral clock.
  787. * @note After reset, the peripheral clock (used for registers read/write access)
  788. * is disabled and the application software has to enable this clock before
  789. * using it.
  790. */
  791. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  792. __IO uint32_t tmpreg; \
  793. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  794. /* Delay after an RCC peripheral clock enabling */ \
  795. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  796. UNUSED(tmpreg); \
  797. } while(0)
  798. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  799. __IO uint32_t tmpreg; \
  800. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  801. /* Delay after an RCC peripheral clock enabling */ \
  802. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  803. UNUSED(tmpreg); \
  804. } while(0)
  805. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  806. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  807. /** @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  808. * @note After reset, the peripheral clock (used for registers read/write access)
  809. * is disabled and the application software has to enable this clock before
  810. * using it.
  811. */
  812. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  813. __IO uint32_t tmpreg; \
  814. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  815. /* Delay after an RCC peripheral clock enabling */ \
  816. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  817. UNUSED(tmpreg); \
  818. } while(0)
  819. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  820. __IO uint32_t tmpreg; \
  821. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  822. /* Delay after an RCC peripheral clock enabling */ \
  823. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  824. UNUSED(tmpreg); \
  825. } while(0)
  826. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  827. __IO uint32_t tmpreg; \
  828. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  829. /* Delay after an RCC peripheral clock enabling */ \
  830. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  831. UNUSED(tmpreg); \
  832. } while(0)
  833. #define __HAL_RCC_TIM5_CLK_ENABLE() do { \
  834. __IO uint32_t tmpreg; \
  835. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
  836. /* Delay after an RCC peripheral clock enabling */ \
  837. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
  838. UNUSED(tmpreg); \
  839. } while(0)
  840. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  841. __IO uint32_t tmpreg; \
  842. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  843. /* Delay after an RCC peripheral clock enabling */ \
  844. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  845. UNUSED(tmpreg); \
  846. } while(0)
  847. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  848. __IO uint32_t tmpreg; \
  849. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  850. /* Delay after an RCC peripheral clock enabling */ \
  851. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  852. UNUSED(tmpreg); \
  853. } while(0)
  854. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  855. __IO uint32_t tmpreg; \
  856. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  857. /* Delay after an RCC peripheral clock enabling */ \
  858. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  859. UNUSED(tmpreg); \
  860. } while(0)
  861. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  862. __IO uint32_t tmpreg; \
  863. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  864. /* Delay after an RCC peripheral clock enabling */ \
  865. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  866. UNUSED(tmpreg); \
  867. } while(0)
  868. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  869. __IO uint32_t tmpreg; \
  870. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  871. /* Delay after an RCC peripheral clock enabling */ \
  872. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  873. UNUSED(tmpreg); \
  874. } while(0)
  875. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  876. __IO uint32_t tmpreg; \
  877. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  878. /* Delay after an RCC peripheral clock enabling */ \
  879. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  880. UNUSED(tmpreg); \
  881. } while(0)
  882. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  883. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  884. defined (STM32F779xx) || defined (STM32F730xx)
  885. #define __HAL_RCC_RTC_CLK_ENABLE() do { \
  886. __IO uint32_t tmpreg; \
  887. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCEN);\
  888. /* Delay after an RCC peripheral clock enabling */ \
  889. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_RTCEN);\
  890. UNUSED(tmpreg); \
  891. } while(0)
  892. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  893. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  894. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  895. #define __HAL_RCC_CAN3_CLK_ENABLE() do { \
  896. __IO uint32_t tmpreg; \
  897. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  898. /* Delay after an RCC peripheral clock enabling */ \
  899. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN3EN);\
  900. UNUSED(tmpreg); \
  901. } while(0)
  902. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  903. #define __HAL_RCC_SPI2_CLK_ENABLE() do { \
  904. __IO uint32_t tmpreg; \
  905. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
  906. /* Delay after an RCC peripheral clock enabling */ \
  907. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
  908. UNUSED(tmpreg); \
  909. } while(0)
  910. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  911. __IO uint32_t tmpreg; \
  912. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  913. /* Delay after an RCC peripheral clock enabling */ \
  914. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  915. UNUSED(tmpreg); \
  916. } while(0)
  917. #define __HAL_RCC_USART2_CLK_ENABLE() do { \
  918. __IO uint32_t tmpreg; \
  919. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
  920. /* Delay after an RCC peripheral clock enabling */ \
  921. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
  922. UNUSED(tmpreg); \
  923. } while(0)
  924. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  925. __IO uint32_t tmpreg; \
  926. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  927. /* Delay after an RCC peripheral clock enabling */ \
  928. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  929. UNUSED(tmpreg); \
  930. } while(0)
  931. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  932. __IO uint32_t tmpreg; \
  933. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  934. /* Delay after an RCC peripheral clock enabling */ \
  935. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  936. UNUSED(tmpreg); \
  937. } while(0)
  938. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  939. __IO uint32_t tmpreg; \
  940. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  941. /* Delay after an RCC peripheral clock enabling */ \
  942. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  943. UNUSED(tmpreg); \
  944. } while(0)
  945. #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
  946. __IO uint32_t tmpreg; \
  947. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
  948. /* Delay after an RCC peripheral clock enabling */ \
  949. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
  950. UNUSED(tmpreg); \
  951. } while(0)
  952. #define __HAL_RCC_I2C2_CLK_ENABLE() do { \
  953. __IO uint32_t tmpreg; \
  954. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
  955. /* Delay after an RCC peripheral clock enabling */ \
  956. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
  957. UNUSED(tmpreg); \
  958. } while(0)
  959. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  960. __IO uint32_t tmpreg; \
  961. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  962. /* Delay after an RCC peripheral clock enabling */ \
  963. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  964. UNUSED(tmpreg); \
  965. } while(0)
  966. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  967. __IO uint32_t tmpreg; \
  968. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  969. /* Delay after an RCC peripheral clock enabling */ \
  970. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  971. UNUSED(tmpreg); \
  972. } while(0)
  973. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  974. __IO uint32_t tmpreg; \
  975. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  976. /* Delay after an RCC peripheral clock enabling */ \
  977. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  978. UNUSED(tmpreg); \
  979. } while(0)
  980. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  981. __IO uint32_t tmpreg; \
  982. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  983. /* Delay after an RCC peripheral clock enabling */ \
  984. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  985. UNUSED(tmpreg); \
  986. } while(0)
  987. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  988. __IO uint32_t tmpreg; \
  989. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  990. /* Delay after an RCC peripheral clock enabling */ \
  991. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  992. UNUSED(tmpreg); \
  993. } while(0)
  994. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  995. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  996. defined (STM32F750xx)
  997. #define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \
  998. __IO uint32_t tmpreg; \
  999. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  1000. /* Delay after an RCC peripheral clock enabling */ \
  1001. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  1002. UNUSED(tmpreg); \
  1003. } while(0)
  1004. #define __HAL_RCC_I2C4_CLK_ENABLE() do { \
  1005. __IO uint32_t tmpreg; \
  1006. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C4EN);\
  1007. /* Delay after an RCC peripheral clock enabling */ \
  1008. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C4EN);\
  1009. UNUSED(tmpreg); \
  1010. } while(0)
  1011. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  1012. __IO uint32_t tmpreg; \
  1013. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  1014. /* Delay after an RCC peripheral clock enabling */ \
  1015. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  1016. UNUSED(tmpreg); \
  1017. } while(0)
  1018. #define __HAL_RCC_CEC_CLK_ENABLE() do { \
  1019. __IO uint32_t tmpreg; \
  1020. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  1021. /* Delay after an RCC peripheral clock enabling */ \
  1022. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  1023. UNUSED(tmpreg); \
  1024. } while(0)
  1025. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1026. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  1027. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  1028. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  1029. #define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN))
  1030. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  1031. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  1032. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  1033. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  1034. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  1035. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  1036. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  1037. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  1038. defined (STM32F779xx) || defined (STM32F730xx)
  1039. #define __HAL_RCC_RTC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_RTCEN))
  1040. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  1041. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1042. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1043. #define __HAL_RCC_CAN3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN3EN))
  1044. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1045. #define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN))
  1046. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  1047. #define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART2EN))
  1048. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  1049. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  1050. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  1051. #define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
  1052. #define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN))
  1053. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  1054. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  1055. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  1056. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  1057. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  1058. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1059. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1060. defined (STM32F750xx)
  1061. #define __HAL_RCC_SPDIFRX_CLK_DISABLE()(RCC->APB1ENR &= ~(RCC_APB1ENR_SPDIFRXEN))
  1062. #define __HAL_RCC_I2C4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C4EN))
  1063. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  1064. #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN))
  1065. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || || STM32F750xx */
  1066. /** @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  1067. * @note After reset, the peripheral clock (used for registers read/write access)
  1068. * is disabled and the application software has to enable this clock before
  1069. * using it.
  1070. */
  1071. #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
  1072. __IO uint32_t tmpreg; \
  1073. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  1074. /* Delay after an RCC peripheral clock enabling */ \
  1075. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  1076. UNUSED(tmpreg); \
  1077. } while(0)
  1078. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1079. __IO uint32_t tmpreg; \
  1080. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1081. /* Delay after an RCC peripheral clock enabling */ \
  1082. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1083. UNUSED(tmpreg); \
  1084. } while(0)
  1085. #define __HAL_RCC_USART1_CLK_ENABLE() do { \
  1086. __IO uint32_t tmpreg; \
  1087. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  1088. /* Delay after an RCC peripheral clock enabling */ \
  1089. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  1090. UNUSED(tmpreg); \
  1091. } while(0)
  1092. #define __HAL_RCC_USART6_CLK_ENABLE() do { \
  1093. __IO uint32_t tmpreg; \
  1094. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  1095. /* Delay after an RCC peripheral clock enabling */ \
  1096. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  1097. UNUSED(tmpreg); \
  1098. } while(0)
  1099. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1100. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1101. #define __HAL_RCC_SDMMC2_CLK_ENABLE() do { \
  1102. __IO uint32_t tmpreg; \
  1103. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC2EN);\
  1104. /* Delay after an RCC peripheral clock enabling */ \
  1105. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC2EN);\
  1106. UNUSED(tmpreg); \
  1107. } while(0)
  1108. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || || STM32F730xx */
  1109. #define __HAL_RCC_ADC1_CLK_ENABLE() do { \
  1110. __IO uint32_t tmpreg; \
  1111. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
  1112. /* Delay after an RCC peripheral clock enabling */ \
  1113. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
  1114. UNUSED(tmpreg); \
  1115. } while(0)
  1116. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  1117. __IO uint32_t tmpreg; \
  1118. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1119. /* Delay after an RCC peripheral clock enabling */ \
  1120. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  1121. UNUSED(tmpreg); \
  1122. } while(0)
  1123. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  1124. __IO uint32_t tmpreg; \
  1125. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1126. /* Delay after an RCC peripheral clock enabling */ \
  1127. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  1128. UNUSED(tmpreg); \
  1129. } while(0)
  1130. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  1131. __IO uint32_t tmpreg; \
  1132. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN);\
  1133. /* Delay after an RCC peripheral clock enabling */ \
  1134. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN);\
  1135. UNUSED(tmpreg); \
  1136. } while(0)
  1137. #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
  1138. __IO uint32_t tmpreg; \
  1139. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  1140. /* Delay after an RCC peripheral clock enabling */ \
  1141. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  1142. UNUSED(tmpreg); \
  1143. } while(0)
  1144. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  1145. __IO uint32_t tmpreg; \
  1146. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1147. /* Delay after an RCC peripheral clock enabling */ \
  1148. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1149. UNUSED(tmpreg); \
  1150. } while(0)
  1151. #define __HAL_RCC_TIM9_CLK_ENABLE() do { \
  1152. __IO uint32_t tmpreg; \
  1153. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
  1154. /* Delay after an RCC peripheral clock enabling */ \
  1155. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
  1156. UNUSED(tmpreg); \
  1157. } while(0)
  1158. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  1159. __IO uint32_t tmpreg; \
  1160. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1161. /* Delay after an RCC peripheral clock enabling */ \
  1162. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  1163. UNUSED(tmpreg); \
  1164. } while(0)
  1165. #define __HAL_RCC_TIM11_CLK_ENABLE() do { \
  1166. __IO uint32_t tmpreg; \
  1167. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
  1168. /* Delay after an RCC peripheral clock enabling */ \
  1169. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
  1170. UNUSED(tmpreg); \
  1171. } while(0)
  1172. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  1173. __IO uint32_t tmpreg; \
  1174. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1175. /* Delay after an RCC peripheral clock enabling */ \
  1176. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1177. UNUSED(tmpreg); \
  1178. } while(0)
  1179. #define __HAL_RCC_SPI6_CLK_ENABLE() do { \
  1180. __IO uint32_t tmpreg; \
  1181. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1182. /* Delay after an RCC peripheral clock enabling */ \
  1183. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  1184. UNUSED(tmpreg); \
  1185. } while(0)
  1186. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1187. __IO uint32_t tmpreg; \
  1188. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1189. /* Delay after an RCC peripheral clock enabling */ \
  1190. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1191. UNUSED(tmpreg); \
  1192. } while(0)
  1193. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  1194. __IO uint32_t tmpreg; \
  1195. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1196. /* Delay after an RCC peripheral clock enabling */ \
  1197. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1198. UNUSED(tmpreg); \
  1199. } while(0)
  1200. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1201. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  1202. __IO uint32_t tmpreg; \
  1203. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1204. /* Delay after an RCC peripheral clock enabling */ \
  1205. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1206. UNUSED(tmpreg); \
  1207. } while(0)
  1208. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1209. #if defined (STM32F769xx) || defined (STM32F779xx)
  1210. #define __HAL_RCC_DSI_CLK_ENABLE() do { \
  1211. __IO uint32_t tmpreg; \
  1212. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1213. /* Delay after an RCC peripheral clock enabling */ \
  1214. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
  1215. UNUSED(tmpreg); \
  1216. } while(0)
  1217. #endif /* STM32F769xx || STM32F779xx */
  1218. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1219. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  1220. __IO uint32_t tmpreg; \
  1221. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  1222. /* Delay after an RCC peripheral clock enabling */ \
  1223. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  1224. UNUSED(tmpreg); \
  1225. } while(0)
  1226. #define __HAL_RCC_MDIO_CLK_ENABLE() do { \
  1227. __IO uint32_t tmpreg; \
  1228. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_MDIOEN);\
  1229. /* Delay after an RCC peripheral clock enabling */ \
  1230. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_MDIOEN);\
  1231. UNUSED(tmpreg); \
  1232. } while(0)
  1233. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1234. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1235. #define __HAL_RCC_OTGPHYC_CLK_ENABLE() do { \
  1236. __IO uint32_t tmpreg; \
  1237. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_OTGPHYCEN);\
  1238. /* Delay after an RCC peripheral clock enabling */ \
  1239. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_OTGPHYCEN);\
  1240. UNUSED(tmpreg); \
  1241. } while(0)
  1242. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1243. #define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN))
  1244. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  1245. #define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN))
  1246. #define __HAL_RCC_USART6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART6EN))
  1247. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1248. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1249. #define __HAL_RCC_SDMMC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDMMC2EN))
  1250. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1251. #define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN))
  1252. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  1253. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  1254. #define __HAL_RCC_SDMMC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDMMC1EN))
  1255. #define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN))
  1256. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  1257. #define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN))
  1258. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  1259. #define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN))
  1260. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  1261. #define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI6EN))
  1262. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  1263. #define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI2EN))
  1264. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1265. #define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_LTDCEN))
  1266. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1267. #if defined (STM32F769xx) || defined (STM32F779xx)
  1268. #define __HAL_RCC_DSI_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DSIEN))
  1269. #endif /* STM32F769xx || STM32F779xx */
  1270. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1271. #define __HAL_RCC_DFSDM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DFSDM1EN))
  1272. #define __HAL_RCC_MDIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_MDIOEN))
  1273. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1274. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1275. #define __HAL_RCC_OTGPHYC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_OTGPHYCEN))
  1276. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1277. /**
  1278. * @}
  1279. */
  1280. /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable_Status Peripheral Clock Enable Disable Status
  1281. * @brief Get the enable or disable status of the AHB/APB peripheral clock.
  1282. * @note After reset, the peripheral clock (used for registers read/write access)
  1283. * is disabled and the application software has to enable this clock before
  1284. * using it.
  1285. * @{
  1286. */
  1287. /** @brief Get the enable or disable status of the AHB1 peripheral clock.
  1288. * @note After reset, the peripheral clock (used for registers read/write access)
  1289. * is disabled and the application software has to enable this clock before
  1290. * using it.
  1291. */
  1292. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1293. #define __HAL_RCC_DTCMRAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DTCMRAMEN)) != RESET)
  1294. #define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2EN)) != RESET)
  1295. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1296. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1297. #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOAEN)) != RESET)
  1298. #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOBEN)) != RESET)
  1299. #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOCEN)) != RESET)
  1300. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1301. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1302. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1303. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1304. #define __HAL_RCC_GPIOH_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOHEN)) != RESET)
  1305. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1306. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1307. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1308. defined (STM32F750xx)
  1309. #define __HAL_RCC_GPIOJ_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) != RESET)
  1310. #define __HAL_RCC_GPIOK_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) != RESET)
  1311. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) != RESET)
  1312. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1313. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1314. #define __HAL_RCC_DTCMRAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DTCMRAMEN)) == RESET)
  1315. #define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2EN)) == RESET)
  1316. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1317. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  1318. #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOAEN)) == RESET)
  1319. #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOBEN)) == RESET)
  1320. #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOCEN)) == RESET)
  1321. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1322. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1323. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1324. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1325. #define __HAL_RCC_GPIOH_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOHEN)) == RESET)
  1326. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1327. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1328. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1329. defined (STM32F750xx)
  1330. #define __HAL_RCC_GPIOJ_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) == RESET)
  1331. #define __HAL_RCC_GPIOK_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) == RESET)
  1332. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) == RESET)
  1333. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1334. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1335. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1336. defined (STM32F750xx)
  1337. /**
  1338. * @brief Enable ETHERNET clock.
  1339. */
  1340. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1341. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  1342. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  1343. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  1344. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  1345. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  1346. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  1347. /**
  1348. * @brief Disable ETHERNET clock.
  1349. */
  1350. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  1351. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  1352. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  1353. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  1354. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  1355. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  1356. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  1357. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1358. /** @brief Get the enable or disable status of the AHB2 peripheral clock.
  1359. * @note After reset, the peripheral clock (used for registers read/write access)
  1360. * is disabled and the application software has to enable this clock before
  1361. * using it.
  1362. */
  1363. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  1364. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  1365. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  1366. #define __HAL_RCC_USB_IS_OTG_FS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  1367. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1368. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  1369. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  1370. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  1371. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  1372. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1373. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1374. #define __HAL_RCC_AES_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) != RESET)
  1375. #define __HAL_RCC_AES_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_AESEN)) == RESET)
  1376. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  1377. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1378. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1379. defined (STM32F750xx)
  1380. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  1381. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  1382. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1383. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1384. #define __HAL_RCC_JPEG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_JPEGEN)) != RESET)
  1385. #define __HAL_RCC_JPEG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_JPEGEN)) == RESET)
  1386. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1387. /** @brief Get the enable or disable status of the AHB3 peripheral clock.
  1388. * @note After reset, the peripheral clock (used for registers read/write access)
  1389. * is disabled and the application software has to enable this clock before
  1390. * using it.
  1391. */
  1392. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  1393. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  1394. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  1395. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  1396. /** @brief Get the enable or disable status of the APB1 peripheral clock.
  1397. * @note After reset, the peripheral clock (used for registers read/write access)
  1398. * is disabled and the application software has to enable this clock before
  1399. * using it.
  1400. */
  1401. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  1402. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  1403. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  1404. #define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET)
  1405. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  1406. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  1407. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  1408. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  1409. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  1410. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  1411. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1412. #define __HAL_RCC_CAN3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) != RESET)
  1413. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1414. #define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET)
  1415. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  1416. #define __HAL_RCC_USART2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET)
  1417. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  1418. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  1419. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  1420. #define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET)
  1421. #define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET)
  1422. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  1423. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  1424. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  1425. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  1426. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  1427. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  1428. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  1429. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  1430. #define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET)
  1431. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  1432. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  1433. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  1434. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  1435. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  1436. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  1437. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1438. #define __HAL_RCC_CAN3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN3EN)) == RESET)
  1439. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1440. #define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET)
  1441. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  1442. #define __HAL_RCC_USART2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET)
  1443. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  1444. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  1445. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  1446. #define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET)
  1447. #define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET)
  1448. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  1449. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  1450. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  1451. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  1452. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  1453. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1454. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1455. defined (STM32F750xx)
  1456. #define __HAL_RCC_SPDIFRX_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) != RESET)
  1457. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  1458. #define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET)
  1459. #define __HAL_RCC_I2C4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C4EN)) != RESET)
  1460. #define __HAL_RCC_SPDIFRX_IS_CLK_DISABLED()((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) == RESET)
  1461. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  1462. #define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET)
  1463. #define __HAL_RCC_I2C4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C4EN)) == RESET)
  1464. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1465. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  1466. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  1467. defined (STM32F779xx) || defined (STM32F730xx)
  1468. #define __HAL_RCC_RTC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCEN)) != RESET)
  1469. #define __HAL_RCC_RTC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_RTCEN)) == RESET)
  1470. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  1471. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1472. /** @brief Get the enable or disable status of the APB2 peripheral clock.
  1473. * @note After reset, the peripheral clock (used for registers read/write access)
  1474. * is disabled and the application software has to enable this clock before
  1475. * using it.
  1476. */
  1477. #define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET)
  1478. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  1479. #define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET)
  1480. #define __HAL_RCC_USART6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) != RESET)
  1481. #define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET)
  1482. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  1483. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  1484. #define __HAL_RCC_SDMMC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC1EN)) != RESET)
  1485. #define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET)
  1486. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  1487. #define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET)
  1488. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  1489. #define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET)
  1490. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  1491. #define __HAL_RCC_SPI6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) != RESET)
  1492. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  1493. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) != RESET)
  1494. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1495. #define __HAL_RCC_LTDC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) != RESET)
  1496. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1497. #if defined (STM32F769xx) || defined (STM32F779xx)
  1498. #define __HAL_RCC_DSI_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) != RESET)
  1499. #endif /* STM32F769xx || STM32F779xx */
  1500. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1501. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1502. #define __HAL_RCC_SDMMC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC2EN)) != RESET)
  1503. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1504. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1505. #define __HAL_RCC_DFSDM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) != RESET)
  1506. #define __HAL_RCC_MDIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_MDIOEN)) != RESET)
  1507. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1508. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1509. #define __HAL_RCC_OTGPHYC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_OTGPHYCEN)) != RESET)
  1510. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1511. #define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET)
  1512. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  1513. #define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET)
  1514. #define __HAL_RCC_USART6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) == RESET)
  1515. #define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET)
  1516. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  1517. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  1518. #define __HAL_RCC_SDMMC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC1EN)) == RESET)
  1519. #define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET)
  1520. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  1521. #define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET)
  1522. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  1523. #define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET)
  1524. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  1525. #define __HAL_RCC_SPI6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) == RESET)
  1526. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  1527. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) == RESET)
  1528. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1529. #define __HAL_RCC_LTDC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) == RESET)
  1530. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1531. #if defined (STM32F769xx) || defined (STM32F779xx)
  1532. #define __HAL_RCC_DSI_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DSIEN)) == RESET)
  1533. #endif /* STM32F769xx || STM32F779xx */
  1534. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1535. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1536. #define __HAL_RCC_SDMMC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC2EN)) == RESET)
  1537. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1538. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1539. #define __HAL_RCC_DFSDM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DFSDM1EN)) == RESET)
  1540. #define __HAL_RCC_MDIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_MDIOEN)) == RESET)
  1541. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1542. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1543. #define __HAL_RCC_OTGPHYC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_OTGPHYCEN)) == RESET)
  1544. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1545. /**
  1546. * @}
  1547. */
  1548. /** @defgroup RCCEx_Force_Release_Peripheral_Reset RCCEx Force Release Peripheral Reset
  1549. * @brief Forces or releases AHB/APB peripheral reset.
  1550. * @{
  1551. */
  1552. /** @brief Force or release AHB1 peripheral reset.
  1553. */
  1554. #define __HAL_RCC_DMA2_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2RST))
  1555. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  1556. #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOARST))
  1557. #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOBRST))
  1558. #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOCRST))
  1559. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  1560. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  1561. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  1562. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  1563. #define __HAL_RCC_GPIOH_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOHRST))
  1564. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  1565. #define __HAL_RCC_DMA2_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2RST))
  1566. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  1567. #define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOARST))
  1568. #define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOBRST))
  1569. #define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOCRST))
  1570. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  1571. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  1572. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  1573. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  1574. #define __HAL_RCC_GPIOH_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOHRST))
  1575. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  1576. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1577. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1578. defined (STM32F750xx)
  1579. #define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2DRST))
  1580. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  1581. #define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOJRST))
  1582. #define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOKRST))
  1583. #define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2DRST))
  1584. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  1585. #define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOJRST))
  1586. #define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOKRST))
  1587. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1588. /** @brief Force or release AHB2 peripheral reset.
  1589. */
  1590. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFFU)
  1591. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  1592. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  1593. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00U)
  1594. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  1595. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  1596. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1597. #define __HAL_RCC_JPEG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_JPEGRST))
  1598. #define __HAL_RCC_JPEG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_JPEGRST))
  1599. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1600. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1601. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  1602. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  1603. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  1604. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  1605. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1606. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1607. #define __HAL_RCC_AES_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_AESRST))
  1608. #define __HAL_RCC_AES_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_AESRST))
  1609. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  1610. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1611. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1612. defined (STM32F750xx)
  1613. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  1614. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  1615. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1616. /** @brief Force or release AHB3 peripheral reset
  1617. */
  1618. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFFU)
  1619. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  1620. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  1621. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00U)
  1622. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  1623. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  1624. /** @brief Force or release APB1 peripheral reset.
  1625. */
  1626. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  1627. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  1628. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  1629. #define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST))
  1630. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  1631. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  1632. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  1633. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  1634. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  1635. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  1636. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1637. #define __HAL_RCC_CAN3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN3RST))
  1638. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1639. #define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST))
  1640. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  1641. #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST))
  1642. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  1643. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  1644. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  1645. #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST))
  1646. #define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST))
  1647. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  1648. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  1649. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  1650. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  1651. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  1652. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  1653. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  1654. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  1655. #define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST))
  1656. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  1657. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  1658. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  1659. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  1660. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  1661. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  1662. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1663. #define __HAL_RCC_CAN3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN3RST))
  1664. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1665. #define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST))
  1666. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  1667. #define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST))
  1668. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  1669. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  1670. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  1671. #define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST))
  1672. #define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST))
  1673. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  1674. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  1675. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  1676. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  1677. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  1678. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1679. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1680. defined (STM32F750xx)
  1681. #define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPDIFRXRST))
  1682. #define __HAL_RCC_I2C4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C4RST))
  1683. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  1684. #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST))
  1685. #define __HAL_RCC_SPDIFRX_RELEASE_RESET()(RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPDIFRXRST))
  1686. #define __HAL_RCC_I2C4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C4RST))
  1687. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  1688. #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST))
  1689. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1690. /** @brief Force or release APB2 peripheral reset.
  1691. */
  1692. #define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST))
  1693. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  1694. #define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST))
  1695. #define __HAL_RCC_USART6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART6RST))
  1696. #define __HAL_RCC_ADC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADCRST))
  1697. #define __HAL_RCC_SDMMC1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDMMC1RST))
  1698. #define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST))
  1699. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  1700. #define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST))
  1701. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  1702. #define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST))
  1703. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  1704. #define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI6RST))
  1705. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  1706. #define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI2RST))
  1707. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1708. #define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_LTDCRST))
  1709. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1710. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1711. #define __HAL_RCC_OTGPHYC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_OTGPHYCRST))
  1712. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1713. #define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST))
  1714. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  1715. #define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST))
  1716. #define __HAL_RCC_USART6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART6RST))
  1717. #define __HAL_RCC_ADC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADCRST))
  1718. #define __HAL_RCC_SDMMC1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDMMC1RST))
  1719. #define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST))
  1720. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  1721. #define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST))
  1722. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  1723. #define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST))
  1724. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  1725. #define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI6RST))
  1726. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  1727. #define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI2RST))
  1728. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1729. #define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_LTDCRST))
  1730. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1731. #if defined (STM32F723xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1732. #define __HAL_RCC_OTGPHYC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_OTGPHYCRST))
  1733. #endif /* STM32F723xx || STM32F733xx || STM32F730xx */
  1734. #if defined (STM32F769xx) || defined (STM32F779xx)
  1735. #define __HAL_RCC_DSI_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DSIRST))
  1736. #define __HAL_RCC_DSI_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DSIRST))
  1737. #endif /* STM32F769xx || STM32F779xx */
  1738. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1739. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1740. #define __HAL_RCC_SDMMC2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDMMC2RST))
  1741. #define __HAL_RCC_SDMMC2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDMMC2RST))
  1742. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1743. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1744. #define __HAL_RCC_DFSDM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DFSDM1RST))
  1745. #define __HAL_RCC_MDIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_MDIORST))
  1746. #define __HAL_RCC_DFSDM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DFSDM1RST))
  1747. #define __HAL_RCC_MDIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_MDIORST))
  1748. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1749. /**
  1750. * @}
  1751. */
  1752. /** @defgroup RCCEx_Peripheral_Clock_Sleep_Enable_Disable RCCEx Peripheral Clock Sleep Enable Disable
  1753. * @brief Enables or disables the AHB/APB peripheral clock during Low Power (Sleep) mode.
  1754. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1755. * power consumption.
  1756. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1757. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1758. * @{
  1759. */
  1760. /** @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1761. */
  1762. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  1763. #define __HAL_RCC_AXI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_AXILPEN))
  1764. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  1765. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  1766. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  1767. #define __HAL_RCC_DTCM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DTCMLPEN))
  1768. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2LPEN))
  1769. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  1770. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  1771. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOALPEN))
  1772. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOBLPEN))
  1773. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOCLPEN))
  1774. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  1775. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  1776. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  1777. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  1778. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOHLPEN))
  1779. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  1780. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  1781. #define __HAL_RCC_AXI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_AXILPEN))
  1782. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  1783. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  1784. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  1785. #define __HAL_RCC_DTCM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DTCMLPEN))
  1786. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2LPEN))
  1787. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  1788. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  1789. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOALPEN))
  1790. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOBLPEN))
  1791. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOCLPEN))
  1792. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  1793. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  1794. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  1795. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  1796. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOHLPEN))
  1797. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  1798. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1799. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1800. defined (STM32F750xx)
  1801. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2DLPEN))
  1802. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  1803. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  1804. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  1805. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  1806. #define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOJLPEN))
  1807. #define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOKLPEN))
  1808. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2DLPEN))
  1809. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  1810. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  1811. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  1812. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  1813. #define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOJLPEN))
  1814. #define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOKLPEN))
  1815. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1816. /** @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1817. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1818. * power consumption.
  1819. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1820. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1821. */
  1822. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1823. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1824. defined (STM32F750xx)
  1825. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  1826. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  1827. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1828. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1829. #define __HAL_RCC_JPEG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_JPEGLPEN))
  1830. #define __HAL_RCC_JPEG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_JPEGLPEN))
  1831. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1832. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  1833. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  1834. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  1835. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  1836. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1837. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  1838. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  1839. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  1840. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  1841. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1842. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  1843. #define __HAL_RCC_AES_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_AESLPEN))
  1844. #define __HAL_RCC_AES_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_AESLPEN))
  1845. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  1846. /** @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1847. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1848. * power consumption.
  1849. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1850. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1851. */
  1852. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  1853. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  1854. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  1855. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  1856. /** @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1857. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1858. * power consumption.
  1859. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1860. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1861. */
  1862. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  1863. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  1864. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  1865. #define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM5LPEN))
  1866. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  1867. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  1868. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  1869. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  1870. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  1871. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  1872. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1873. #define __HAL_RCC_CAN3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN3LPEN))
  1874. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1875. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI2LPEN))
  1876. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  1877. #define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART2LPEN))
  1878. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  1879. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  1880. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  1881. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C1LPEN))
  1882. #define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C2LPEN))
  1883. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  1884. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  1885. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  1886. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  1887. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  1888. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  1889. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  1890. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  1891. #define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM5LPEN))
  1892. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  1893. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  1894. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  1895. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  1896. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  1897. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  1898. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1899. #define __HAL_RCC_CAN3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN3LPEN))
  1900. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1901. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI2LPEN))
  1902. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  1903. #define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART2LPEN))
  1904. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  1905. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  1906. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  1907. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C1LPEN))
  1908. #define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C2LPEN))
  1909. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  1910. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  1911. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  1912. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  1913. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  1914. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  1915. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  1916. defined (STM32F779xx) || defined (STM32F730xx)
  1917. #define __HAL_RCC_RTC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_RTCLPEN))
  1918. #define __HAL_RCC_RTC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_RTCLPEN))
  1919. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  1920. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1921. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1922. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1923. defined (STM32F750xx)
  1924. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPDIFRXLPEN))
  1925. #define __HAL_RCC_I2C4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C4LPEN))
  1926. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  1927. #define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CECLPEN))
  1928. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPDIFRXLPEN))
  1929. #define __HAL_RCC_I2C4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C4LPEN))
  1930. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  1931. #define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CECLPEN))
  1932. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1933. /** @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1934. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1935. * power consumption.
  1936. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1937. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1938. */
  1939. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM1LPEN))
  1940. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  1941. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART1LPEN))
  1942. #define __HAL_RCC_USART6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART6LPEN))
  1943. #define __HAL_RCC_ADC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC1LPEN))
  1944. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  1945. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  1946. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDMMC1LPEN))
  1947. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI1LPEN))
  1948. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  1949. #define __HAL_RCC_TIM9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM9LPEN))
  1950. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  1951. #define __HAL_RCC_TIM11_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM11LPEN))
  1952. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  1953. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  1954. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI2LPEN))
  1955. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  1956. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_LTDCLPEN))
  1957. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1958. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM1LPEN))
  1959. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  1960. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART1LPEN))
  1961. #define __HAL_RCC_USART6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART6LPEN))
  1962. #define __HAL_RCC_ADC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC1LPEN))
  1963. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  1964. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  1965. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDMMC1LPEN))
  1966. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI1LPEN))
  1967. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  1968. #define __HAL_RCC_TIM9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM9LPEN))
  1969. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  1970. #define __HAL_RCC_TIM11_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM11LPEN))
  1971. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  1972. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  1973. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI2LPEN))
  1974. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)|| defined (STM32F750xx)
  1975. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_LTDCLPEN))
  1976. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1977. #if defined (STM32F769xx) || defined (STM32F779xx)
  1978. #define __HAL_RCC_DSI_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DSILPEN))
  1979. #define __HAL_RCC_DSI_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DSILPEN))
  1980. #endif /* STM32F769xx || STM32F779xx */
  1981. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  1982. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_DFSDM1LPEN))
  1983. #define __HAL_RCC_MDIO_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_MDIOLPEN))
  1984. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_DFSDM1LPEN))
  1985. #define __HAL_RCC_MDIO_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_MDIOLPEN))
  1986. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  1987. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  1988. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  1989. #define __HAL_RCC_SDMMC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDMMC2LPEN))
  1990. #define __HAL_RCC_SDMMC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDMMC2LPEN))
  1991. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  1992. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  1993. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  1994. defined (STM32F750xx)
  1995. #define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI6LPEN))
  1996. #define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI6LPEN))
  1997. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  1998. /**
  1999. * @}
  2000. */
  2001. /** @defgroup RCC_Clock_Sleep_Enable_Disable_Status AHB/APB Peripheral Clock Sleep Enable Disable Status
  2002. * @brief Get the enable or disable status of the AHB/APB peripheral clock during Low Power (Sleep) mode.
  2003. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2004. * power consumption.
  2005. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2006. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2007. * @{
  2008. */
  2009. /** @brief Get the enable or disable status of the AHB1 peripheral clock during Low Power (Sleep) mode.
  2010. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2011. * power consumption.
  2012. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2013. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2014. */
  2015. #define __HAL_RCC_FLITF_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_FLITFLPEN)) != RESET)
  2016. #define __HAL_RCC_AXI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_AXILPEN)) != RESET)
  2017. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM1LPEN)) != RESET)
  2018. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM2LPEN)) != RESET)
  2019. #define __HAL_RCC_BKPSRAM_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_BKPSRAMLPEN)) != RESET)
  2020. #define __HAL_RCC_DTCM_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DTCMLPEN)) != RESET)
  2021. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2LPEN)) != RESET)
  2022. #define __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSLPEN)) != RESET)
  2023. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSULPILPEN)) != RESET)
  2024. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOALPEN)) != RESET)
  2025. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOBLPEN)) != RESET)
  2026. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOCLPEN)) != RESET)
  2027. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIODLPEN)) != RESET)
  2028. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOELPEN)) != RESET)
  2029. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOFLPEN)) != RESET)
  2030. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOGLPEN)) != RESET)
  2031. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOHLPEN)) != RESET)
  2032. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOILPEN)) != RESET)
  2033. #define __HAL_RCC_FLITF_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_FLITFLPEN)) == RESET)
  2034. #define __HAL_RCC_AXI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_AXILPEN)) == RESET)
  2035. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM1LPEN)) == RESET)
  2036. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM2LPEN)) == RESET)
  2037. #define __HAL_RCC_BKPSRAM_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_BKPSRAMLPEN)) == RESET)
  2038. #define __HAL_RCC_DTCM_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DTCMLPEN)) == RESET)
  2039. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2LPEN)) == RESET)
  2040. #define __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSLPEN)) == RESET)
  2041. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSULPILPEN)) == RESET)
  2042. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOALPEN)) == RESET)
  2043. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOBLPEN)) == RESET)
  2044. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOCLPEN)) == RESET)
  2045. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIODLPEN)) == RESET)
  2046. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOELPEN)) == RESET)
  2047. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOFLPEN)) == RESET)
  2048. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOGLPEN)) == RESET)
  2049. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOHLPEN)) == RESET)
  2050. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOILPEN)) == RESET)
  2051. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2052. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2053. defined (STM32F750xx)
  2054. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2DLPEN)) != RESET)
  2055. #define __HAL_RCC_ETHMAC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACLPEN)) != RESET)
  2056. #define __HAL_RCC_ETHMACTX_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACTXLPEN)) != RESET)
  2057. #define __HAL_RCC_ETHMACRX_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACRXLPEN)) != RESET)
  2058. #define __HAL_RCC_ETHMACPTP_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACPTPLPEN)) != RESET)
  2059. #define __HAL_RCC_GPIOJ_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOJLPEN)) != RESET)
  2060. #define __HAL_RCC_GPIOK_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOKLPEN)) != RESET)
  2061. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2DLPEN)) == RESET)
  2062. #define __HAL_RCC_ETHMAC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACLPEN)) == RESET)
  2063. #define __HAL_RCC_ETHMACTX_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACTXLPEN)) == RESET)
  2064. #define __HAL_RCC_ETHMACRX_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACRXLPEN)) == RESET)
  2065. #define __HAL_RCC_ETHMACPTP_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACPTPLPEN)) == RESET)
  2066. #define __HAL_RCC_GPIOJ_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOJLPEN)) == RESET)
  2067. #define __HAL_RCC_GPIOK_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOKLPEN)) == RESET)
  2068. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2069. /** @brief Get the enable or disable status of the AHB2 peripheral clock during Low Power (Sleep) mode.
  2070. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2071. * power consumption.
  2072. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2073. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2074. */
  2075. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2076. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2077. defined (STM32F750xx)
  2078. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_DCMILPEN)) != RESET)
  2079. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_DCMILPEN)) == RESET)
  2080. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2081. #if defined(STM32F767xx) || defined(STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2082. #define __HAL_RCC_JPEG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_JPEGLPEN)) != RESET)
  2083. #define __HAL_RCC_JPEG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_JPEGLPEN)) == RESET)
  2084. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2085. #define __HAL_RCC_RNG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_RNGLPEN)) != RESET)
  2086. #define __HAL_RCC_RNG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_RNGLPEN)) == RESET)
  2087. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_OTGFSLPEN)) != RESET)
  2088. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_OTGFSLPEN)) == RESET)
  2089. #if defined(STM32F756xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  2090. #define __HAL_RCC_CRYP_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_CRYPLPEN)) != RESET)
  2091. #define __HAL_RCC_HASH_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_HASHLPEN)) != RESET)
  2092. #define __HAL_RCC_CRYP_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_CRYPLPEN)) == RESET)
  2093. #define __HAL_RCC_HASH_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_HASHLPEN)) == RESET)
  2094. #endif /* STM32F756xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2095. #if defined(STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  2096. #define __HAL_RCC_AES_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_AESLPEN)) != RESET)
  2097. #define __HAL_RCC_AES_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_AESLPEN)) == RESET)
  2098. #endif /* STM32F732xx || STM32F733xx || STM32F730xx */
  2099. /** @brief Get the enable or disable status of the AHB3 peripheral clock during Low Power (Sleep) mode.
  2100. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2101. * power consumption.
  2102. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2103. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2104. */
  2105. #define __HAL_RCC_FMC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_FMCLPEN)) != RESET)
  2106. #define __HAL_RCC_FMC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_FMCLPEN)) == RESET)
  2107. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_QSPILPEN)) != RESET)
  2108. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_QSPILPEN)) == RESET)
  2109. /** @brief Get the enable or disable status of the APB1 peripheral clock during Low Power (Sleep) mode.
  2110. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2111. * power consumption.
  2112. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2113. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2114. */
  2115. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) != RESET)
  2116. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) != RESET)
  2117. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) != RESET)
  2118. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM5LPEN)) != RESET)
  2119. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) != RESET)
  2120. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) != RESET)
  2121. #define __HAL_RCC_TIM12_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM12LPEN)) != RESET)
  2122. #define __HAL_RCC_TIM13_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM13LPEN)) != RESET)
  2123. #define __HAL_RCC_TIM14_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM14LPEN)) != RESET)
  2124. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_LPTIM1LPEN)) != RESET)
  2125. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  2126. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  2127. defined (STM32F779xx) || defined (STM32F730xx)
  2128. #define __HAL_RCC_RTC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_RTCLPEN)) != RESET)
  2129. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  2130. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2131. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2132. #define __HAL_RCC_CAN3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN3LPEN)) != RESET)
  2133. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2134. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) != RESET)
  2135. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI3LPEN)) != RESET)
  2136. #define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) != RESET)
  2137. #define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) != RESET)
  2138. #define __HAL_RCC_UART4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART4LPEN)) != RESET)
  2139. #define __HAL_RCC_UART5_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART5LPEN)) != RESET)
  2140. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) != RESET)
  2141. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) != RESET)
  2142. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C3LPEN)) != RESET)
  2143. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN1LPEN)) != RESET)
  2144. #define __HAL_RCC_DAC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) != RESET)
  2145. #define __HAL_RCC_UART7_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART7LPEN)) != RESET)
  2146. #define __HAL_RCC_UART8_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART8LPEN)) != RESET)
  2147. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) == RESET)
  2148. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) == RESET)
  2149. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) == RESET)
  2150. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM5LPEN)) == RESET)
  2151. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) == RESET)
  2152. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) == RESET)
  2153. #define __HAL_RCC_TIM12_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM12LPEN)) == RESET)
  2154. #define __HAL_RCC_TIM13_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM13LPEN)) == RESET)
  2155. #define __HAL_RCC_TIM14_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM14LPEN)) == RESET)
  2156. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_LPTIM1LPEN)) == RESET)
  2157. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) ||\
  2158. defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) ||\
  2159. defined (STM32F779xx) || defined (STM32F730xx)
  2160. #define __HAL_RCC_RTC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_RTCLPEN)) == RESET)
  2161. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx ||
  2162. STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2163. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2164. #define __HAL_RCC_CAN3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN3LPEN)) == RESET)
  2165. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2166. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) == RESET)
  2167. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI3LPEN)) == RESET)
  2168. #define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) == RESET)
  2169. #define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) == RESET)
  2170. #define __HAL_RCC_UART4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART4LPEN)) == RESET)
  2171. #define __HAL_RCC_UART5_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART5LPEN)) == RESET)
  2172. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) == RESET)
  2173. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) == RESET)
  2174. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C3LPEN)) == RESET)
  2175. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN1LPEN)) == RESET)
  2176. #define __HAL_RCC_DAC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) == RESET)
  2177. #define __HAL_RCC_UART7_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART7LPEN)) == RESET)
  2178. #define __HAL_RCC_UART8_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART8LPEN)) == RESET)
  2179. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2180. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2181. defined (STM32F750xx)
  2182. #define __HAL_RCC_SPDIFRX_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPDIFRXLPEN)) != RESET)
  2183. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C4LPEN)) != RESET)
  2184. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN2LPEN)) != RESET)
  2185. #define __HAL_RCC_CEC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CECLPEN)) != RESET)
  2186. #define __HAL_RCC_SPDIFRX_IS_CLK_SLEEP_DISABLED()((RCC->APB1LPENR & (RCC_APB1LPENR_SPDIFRXLPEN)) == RESET)
  2187. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C4LPEN)) == RESET)
  2188. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN2LPEN)) == RESET)
  2189. #define __HAL_RCC_CEC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CECLPEN)) == RESET)
  2190. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2191. /** @brief Get the enable or disable status of the APB2 peripheral clock during Low Power (Sleep) mode.
  2192. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2193. * power consumption.
  2194. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2195. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2196. */
  2197. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM1LPEN)) != RESET)
  2198. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM8LPEN)) != RESET)
  2199. #define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) != RESET)
  2200. #define __HAL_RCC_USART6_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART6LPEN)) != RESET)
  2201. #define __HAL_RCC_ADC1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) != RESET)
  2202. #define __HAL_RCC_ADC2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC2LPEN)) != RESET)
  2203. #define __HAL_RCC_ADC3_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC3LPEN)) != RESET)
  2204. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC1LPEN)) != RESET)
  2205. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) != RESET)
  2206. #define __HAL_RCC_SPI4_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI4LPEN)) != RESET)
  2207. #define __HAL_RCC_TIM9_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) != RESET)
  2208. #define __HAL_RCC_TIM10_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) != RESET)
  2209. #define __HAL_RCC_TIM11_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) != RESET)
  2210. #define __HAL_RCC_SPI5_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI5LPEN)) != RESET)
  2211. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI1LPEN)) != RESET)
  2212. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI2LPEN)) != RESET)
  2213. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  2214. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_LTDCLPEN)) != RESET)
  2215. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2216. #if defined (STM32F769xx) || defined (STM32F779xx)
  2217. #define __HAL_RCC_DSI_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DSILPEN)) != RESET)
  2218. #endif /* STM32F769xx || STM32F779xx */
  2219. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  2220. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  2221. #define __HAL_RCC_SDMMC2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC2LPEN)) != RESET)
  2222. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2223. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2224. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DFSDM1LPEN)) != RESET)
  2225. #define __HAL_RCC_MDIO_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_MDIOLPEN)) != RESET)
  2226. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2227. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM1LPEN)) == RESET)
  2228. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM8LPEN)) == RESET)
  2229. #define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) == RESET)
  2230. #define __HAL_RCC_USART6_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART6LPEN)) == RESET)
  2231. #define __HAL_RCC_ADC1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) == RESET)
  2232. #define __HAL_RCC_ADC2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC2LPEN)) == RESET)
  2233. #define __HAL_RCC_ADC3_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC3LPEN)) == RESET)
  2234. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC1LPEN)) == RESET)
  2235. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) == RESET)
  2236. #define __HAL_RCC_SPI4_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI4LPEN)) == RESET)
  2237. #define __HAL_RCC_TIM9_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) == RESET)
  2238. #define __HAL_RCC_TIM10_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) == RESET)
  2239. #define __HAL_RCC_TIM11_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) == RESET)
  2240. #define __HAL_RCC_SPI5_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI5LPEN)) == RESET)
  2241. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI1LPEN)) == RESET)
  2242. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI2LPEN)) == RESET)
  2243. #if defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  2244. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_LTDCLPEN)) == RESET)
  2245. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2246. #if defined (STM32F769xx) || defined (STM32F779xx)
  2247. #define __HAL_RCC_DSI_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DSILPEN)) == RESET)
  2248. #endif /* STM32F769xx || STM32F779xx */
  2249. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  2250. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  2251. #define __HAL_RCC_SDMMC2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC2LPEN)) == RESET)
  2252. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2253. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2254. #define __HAL_RCC_DFSDM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_DFSDM1LPEN)) == RESET)
  2255. #define __HAL_RCC_MDIO_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_MDIOLPEN)) == RESET)
  2256. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2257. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2258. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2259. defined (STM32F750xx)
  2260. #define __HAL_RCC_SPI6_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI6LPEN)) != RESET)
  2261. #define __HAL_RCC_SPI6_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI6LPEN)) == RESET)
  2262. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2263. /**
  2264. * @}
  2265. */
  2266. /*------------------------------- PLL Configuration --------------------------*/
  2267. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2268. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  2269. * @note This function must be used only when the main PLL is disabled.
  2270. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  2271. * This parameter can be one of the following values:
  2272. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  2273. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  2274. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  2275. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  2276. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  2277. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2278. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  2279. * of 2 MHz to limit PLL jitter.
  2280. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  2281. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2282. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2283. * output frequency is between 100 and 432 MHz.
  2284. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  2285. * This parameter must be a number in the range {2, 4, 6, or 8}.
  2286. * @note You have to set the PLLP parameter correctly to not exceed 216 MHz on
  2287. * the System clock frequency.
  2288. * @param __PLLQ__ specifies the division factor for OTG FS, SDMMC and RNG clocks
  2289. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2290. * @note If the USB OTG FS is used in your application, you have to set the
  2291. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  2292. * the SDMMC and RNG need a frequency lower than or equal to 48 MHz to work
  2293. * correctly.
  2294. * @param __PLLR__ specifies the division factor for DSI clock
  2295. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2296. */
  2297. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__) \
  2298. (RCC->PLLCFGR = ((__RCC_PLLSource__) | (__PLLM__) | \
  2299. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  2300. ((((__PLLP__) >> 1) -1) << RCC_PLLCFGR_PLLP_Pos) | \
  2301. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos) | \
  2302. ((__PLLR__) << RCC_PLLCFGR_PLLR_Pos)))
  2303. #else
  2304. /** @brief Macro to configure the main PLL clock source, multiplication and division factors.
  2305. * @note This function must be used only when the main PLL is disabled.
  2306. * @param __RCC_PLLSource__ specifies the PLL entry clock source.
  2307. * This parameter can be one of the following values:
  2308. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  2309. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  2310. * @note This clock source (RCC_PLLSource) is common for the main PLL and PLLI2S.
  2311. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  2312. * This parameter must be a number between Min_Data = 2 and Max_Data = 63.
  2313. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2314. * frequency ranges from 1 to 2 MHz. It is recommended to select a frequency
  2315. * of 2 MHz to limit PLL jitter.
  2316. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock
  2317. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2318. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2319. * output frequency is between 100 and 432 MHz.
  2320. * @param __PLLP__ specifies the division factor for main system clock (SYSCLK)
  2321. * This parameter must be a number in the range {2, 4, 6, or 8}.
  2322. * @note You have to set the PLLP parameter correctly to not exceed 216 MHz on
  2323. * the System clock frequency.
  2324. * @param __PLLQ__ specifies the division factor for OTG FS, SDMMC and RNG clocks
  2325. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2326. * @note If the USB OTG FS is used in your application, you have to set the
  2327. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  2328. * the SDMMC and RNG need a frequency lower than or equal to 48 MHz to work
  2329. * correctly.
  2330. */
  2331. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSource__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__) \
  2332. (RCC->PLLCFGR = (0x20000000 | (__RCC_PLLSource__) | (__PLLM__)| \
  2333. ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  2334. ((((__PLLP__) >> 1) -1) << RCC_PLLCFGR_PLLP_Pos) | \
  2335. ((__PLLQ__) << RCC_PLLCFGR_PLLQ_Pos)))
  2336. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2337. /*---------------------------------------------------------------------------------------------*/
  2338. /** @brief Macro to configure the Timers clocks prescalers
  2339. * @param __PRESC__ specifies the Timers clocks prescalers selection
  2340. * This parameter can be one of the following values:
  2341. * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is
  2342. * equal to HPRE if PPREx is corresponding to division by 1 or 2,
  2343. * else it is equal to [(HPRE * PPREx) / 2] if PPREx is corresponding to
  2344. * division by 4 or more.
  2345. * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is
  2346. * equal to HPRE if PPREx is corresponding to division by 1, 2 or 4,
  2347. * else it is equal to [(HPRE * PPREx) / 4] if PPREx is corresponding
  2348. * to division by 8 or more.
  2349. */
  2350. #define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) do {RCC->DCKCFGR1 &= ~(RCC_DCKCFGR1_TIMPRE);\
  2351. RCC->DCKCFGR1 |= (__PRESC__); \
  2352. }while(0)
  2353. /** @brief Macros to Enable or Disable the PLLISAI.
  2354. * @note The PLLSAI is disabled by hardware when entering STOP and STANDBY modes.
  2355. */
  2356. #define __HAL_RCC_PLLSAI_ENABLE() (RCC->CR |= (RCC_CR_PLLSAION))
  2357. #define __HAL_RCC_PLLSAI_DISABLE() (RCC->CR &= ~(RCC_CR_PLLSAION))
  2358. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  2359. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  2360. * @note This function must be used only when the PLLSAI is disabled.
  2361. * @note PLLSAI clock source is common with the main PLL (configured in
  2362. * RCC_PLLConfig function )
  2363. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  2364. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2365. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  2366. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2367. * @param __PLLSAIP__ specifies the division factor for USB, RNG, SDMMC clocks
  2368. * This parameter can be a value of @ref RCCEx_PLLSAIP_Clock_Divider.
  2369. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  2370. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2371. */
  2372. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__) \
  2373. (RCC->PLLSAICFGR = ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\
  2374. ((__PLLSAIP__) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\
  2375. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos))
  2376. /** @brief Macro to configure the PLLI2S clock multiplication and division factors.
  2377. * @note This macro must be used only when the PLLI2S is disabled.
  2378. * @note PLLI2S clock source is common with the main PLL (configured in
  2379. * HAL_RCC_ClockConfig() API)
  2380. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock.
  2381. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2382. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  2383. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2384. * @param __PLLI2SQ__ specifies the division factor for SAI clock.
  2385. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2386. * @param __PLLI2SR__ specifies the division factor for I2S clock
  2387. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2388. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  2389. * on the I2S clock frequency.
  2390. */
  2391. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SQ__, __PLLI2SR__) \
  2392. (RCC->PLLI2SCFGR = ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  2393. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  2394. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))
  2395. #else
  2396. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  2397. * @note This function must be used only when the PLLSAI is disabled.
  2398. * @note PLLSAI clock source is common with the main PLL (configured in
  2399. * RCC_PLLConfig function )
  2400. * @param __PLLSAIN__ specifies the multiplication factor for PLLSAI VCO output clock.
  2401. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2402. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  2403. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2404. * @param __PLLSAIP__ specifies the division factor for USB, RNG, SDMMC clocks
  2405. * This parameter can be a value of @ref RCCEx_PLLSAIP_Clock_Divider.
  2406. * @param __PLLSAIQ__ specifies the division factor for SAI clock
  2407. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2408. * @param __PLLSAIR__ specifies the division factor for LTDC clock
  2409. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2410. */
  2411. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) \
  2412. (RCC->PLLSAICFGR = ((__PLLSAIN__) << RCC_PLLSAICFGR_PLLSAIN_Pos) |\
  2413. ((__PLLSAIP__) << RCC_PLLSAICFGR_PLLSAIP_Pos) |\
  2414. ((__PLLSAIQ__) << RCC_PLLSAICFGR_PLLSAIQ_Pos) |\
  2415. ((__PLLSAIR__) << RCC_PLLSAICFGR_PLLSAIR_Pos))
  2416. /** @brief Macro to configure the PLLI2S clock multiplication and division factors.
  2417. * @note This macro must be used only when the PLLI2S is disabled.
  2418. * @note PLLI2S clock source is common with the main PLL (configured in
  2419. * HAL_RCC_ClockConfig() API)
  2420. * @param __PLLI2SN__ specifies the multiplication factor for PLLI2S VCO output clock.
  2421. * This parameter must be a number between Min_Data = 50 and Max_Data = 432.
  2422. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  2423. * output frequency is between Min_Data = 100 and Max_Data = 432 MHz.
  2424. * @param __PLLI2SP__ specifies the division factor for SPDDIF-RX clock.
  2425. * This parameter can be a value of @ref RCCEx_PLLI2SP_Clock_Divider.
  2426. * @param __PLLI2SQ__ specifies the division factor for SAI clock.
  2427. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  2428. * @param __PLLI2SR__ specifies the division factor for I2S clock
  2429. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  2430. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  2431. * on the I2S clock frequency.
  2432. */
  2433. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SP__, __PLLI2SQ__, __PLLI2SR__) \
  2434. (RCC->PLLI2SCFGR = ((__PLLI2SN__) << RCC_PLLI2SCFGR_PLLI2SN_Pos) |\
  2435. ((__PLLI2SP__) << RCC_PLLI2SCFGR_PLLI2SP_Pos) |\
  2436. ((__PLLI2SQ__) << RCC_PLLI2SCFGR_PLLI2SQ_Pos) |\
  2437. ((__PLLI2SR__) << RCC_PLLI2SCFGR_PLLI2SR_Pos))
  2438. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F730xx */
  2439. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  2440. * @note This function must be called before enabling the PLLI2S.
  2441. * @param __PLLI2SDivQ__ specifies the PLLI2S division factor for SAI1 clock .
  2442. * This parameter must be a number between 1 and 32.
  2443. * SAI1 clock frequency = f(PLLI2SQ) / __PLLI2SDivQ__
  2444. */
  2445. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(__PLLI2SDivQ__) (MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLI2SDIVQ, (__PLLI2SDivQ__)-1))
  2446. /** @brief Macro to configure the SAI clock Divider coming from PLLSAI.
  2447. * @note This function must be called before enabling the PLLSAI.
  2448. * @param __PLLSAIDivQ__ specifies the PLLSAI division factor for SAI1 clock .
  2449. * This parameter must be a number between Min_Data = 1 and Max_Data = 32.
  2450. * SAI1 clock frequency = f(PLLSAIQ) / __PLLSAIDivQ__
  2451. */
  2452. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(__PLLSAIDivQ__) (MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLSAIDIVQ, ((__PLLSAIDivQ__)-1)<<8))
  2453. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  2454. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  2455. defined (STM32F750xx)
  2456. /** @brief Macro to configure the LTDC clock Divider coming from PLLSAI.
  2457. * @note This function must be called before enabling the PLLSAI.
  2458. * @param __PLLSAIDivR__ specifies the PLLSAI division factor for LTDC clock .
  2459. * This parameter can be a value of @ref RCCEx_PLLSAI_DIVR.
  2460. * LTDC clock frequency = f(PLLSAIR) / __PLLSAIDivR__
  2461. */
  2462. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(__PLLSAIDivR__)\
  2463. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLSAIDIVR, (uint32_t)(__PLLSAIDivR__))
  2464. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  2465. /** @brief Macro to configure SAI1 clock source selection.
  2466. * @note This function must be called before enabling PLLSAI, PLLI2S and
  2467. * the SAI clock.
  2468. * @param __SOURCE__ specifies the SAI1 clock source.
  2469. * This parameter can be one of the following values:
  2470. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2471. * as SAI1 clock.
  2472. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2473. * as SAI1 clock.
  2474. * @arg RCC_SAI1CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2475. * used as SAI1 clock.
  2476. * @arg RCC_SAI1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2477. * used as SAI1 clock.
  2478. * @note The RCC_SAI1CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2479. */
  2480. #define __HAL_RCC_SAI1_CONFIG(__SOURCE__)\
  2481. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI1SEL, (uint32_t)(__SOURCE__))
  2482. /** @brief Macro to get the SAI1 clock source.
  2483. * @retval The clock source can be one of the following values:
  2484. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2485. * as SAI1 clock.
  2486. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2487. * as SAI1 clock.
  2488. * @arg RCC_SAI1CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2489. * used as SAI1 clock.
  2490. * @arg RCC_SAI1CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2491. * used as SAI1 clock.
  2492. * @note The RCC_SAI1CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2493. */
  2494. #define __HAL_RCC_GET_SAI1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI1SEL)))
  2495. /** @brief Macro to configure SAI2 clock source selection.
  2496. * @note This function must be called before enabling PLLSAI, PLLI2S and
  2497. * the SAI clock.
  2498. * @param __SOURCE__ specifies the SAI2 clock source.
  2499. * This parameter can be one of the following values:
  2500. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2501. * as SAI2 clock.
  2502. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2503. * as SAI2 clock.
  2504. * @arg RCC_SAI2CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2505. * used as SAI2 clock.
  2506. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2507. * used as SAI2 clock.
  2508. * @note The RCC_SAI2CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2509. */
  2510. #define __HAL_RCC_SAI2_CONFIG(__SOURCE__)\
  2511. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI2SEL, (uint32_t)(__SOURCE__))
  2512. /** @brief Macro to get the SAI2 clock source.
  2513. * @retval The clock source can be one of the following values:
  2514. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  2515. * as SAI2 clock.
  2516. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  2517. * as SAI2 clock.
  2518. * @arg RCC_SAI2CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  2519. * used as SAI2 clock.
  2520. * @arg RCC_SAI2CLKSOURCE_PLLSRC: HSI or HSE depending from PLL Source clock
  2521. * used as SAI2 clock.
  2522. * @note The RCC_SAI2CLKSOURCE_PLLSRC value is only available with STM32F767/769/777/779xx Devices
  2523. */
  2524. #define __HAL_RCC_GET_SAI2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI2SEL)))
  2525. /** @brief Enable PLLSAI_RDY interrupt.
  2526. */
  2527. #define __HAL_RCC_PLLSAI_ENABLE_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYIE))
  2528. /** @brief Disable PLLSAI_RDY interrupt.
  2529. */
  2530. #define __HAL_RCC_PLLSAI_DISABLE_IT() (RCC->CIR &= ~(RCC_CIR_PLLSAIRDYIE))
  2531. /** @brief Clear the PLLSAI RDY interrupt pending bits.
  2532. */
  2533. #define __HAL_RCC_PLLSAI_CLEAR_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYF))
  2534. /** @brief Check the PLLSAI RDY interrupt has occurred or not.
  2535. * @retval The new state (TRUE or FALSE).
  2536. */
  2537. #define __HAL_RCC_PLLSAI_GET_IT() ((RCC->CIR & (RCC_CIR_PLLSAIRDYIE)) == (RCC_CIR_PLLSAIRDYIE))
  2538. /** @brief Check PLLSAI RDY flag is set or not.
  2539. * @retval The new state (TRUE or FALSE).
  2540. */
  2541. #define __HAL_RCC_PLLSAI_GET_FLAG() ((RCC->CR & (RCC_CR_PLLSAIRDY)) == (RCC_CR_PLLSAIRDY))
  2542. /** @brief Macro to Get I2S clock source selection.
  2543. * @retval The clock source can be one of the following values:
  2544. * @arg RCC_I2SCLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  2545. * @arg RCC_I2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S clock source
  2546. */
  2547. #define __HAL_RCC_GET_I2SCLKSOURCE() (READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC))
  2548. /** @brief Macro to configure the I2C1 clock (I2C1CLK).
  2549. *
  2550. * @param __I2C1_CLKSOURCE__ specifies the I2C1 clock source.
  2551. * This parameter can be one of the following values:
  2552. * @arg RCC_I2C1CLKSOURCE_PCLK1: PCLK1 selected as I2C1 clock
  2553. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  2554. * @arg RCC_I2C1CLKSOURCE_SYSCLK: System Clock selected as I2C1 clock
  2555. */
  2556. #define __HAL_RCC_I2C1_CONFIG(__I2C1_CLKSOURCE__) \
  2557. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C1SEL, (uint32_t)(__I2C1_CLKSOURCE__))
  2558. /** @brief Macro to get the I2C1 clock source.
  2559. * @retval The clock source can be one of the following values:
  2560. * @arg RCC_I2C1CLKSOURCE_PCLK1: PCLK1 selected as I2C1 clock
  2561. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  2562. * @arg RCC_I2C1CLKSOURCE_SYSCLK: System Clock selected as I2C1 clock
  2563. */
  2564. #define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C1SEL)))
  2565. /** @brief Macro to configure the I2C2 clock (I2C2CLK).
  2566. *
  2567. * @param __I2C2_CLKSOURCE__ specifies the I2C2 clock source.
  2568. * This parameter can be one of the following values:
  2569. * @arg RCC_I2C2CLKSOURCE_PCLK1: PCLK1 selected as I2C2 clock
  2570. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  2571. * @arg RCC_I2C2CLKSOURCE_SYSCLK: System Clock selected as I2C2 clock
  2572. */
  2573. #define __HAL_RCC_I2C2_CONFIG(__I2C2_CLKSOURCE__) \
  2574. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C2SEL, (uint32_t)(__I2C2_CLKSOURCE__))
  2575. /** @brief Macro to get the I2C2 clock source.
  2576. * @retval The clock source can be one of the following values:
  2577. * @arg RCC_I2C2CLKSOURCE_PCLK1: PCLK1 selected as I2C2 clock
  2578. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  2579. * @arg RCC_I2C2CLKSOURCE_SYSCLK: System Clock selected as I2C2 clock
  2580. */
  2581. #define __HAL_RCC_GET_I2C2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C2SEL)))
  2582. /** @brief Macro to configure the I2C3 clock (I2C3CLK).
  2583. *
  2584. * @param __I2C3_CLKSOURCE__ specifies the I2C3 clock source.
  2585. * This parameter can be one of the following values:
  2586. * @arg RCC_I2C3CLKSOURCE_PCLK1: PCLK1 selected as I2C3 clock
  2587. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  2588. * @arg RCC_I2C3CLKSOURCE_SYSCLK: System Clock selected as I2C3 clock
  2589. */
  2590. #define __HAL_RCC_I2C3_CONFIG(__I2C3_CLKSOURCE__) \
  2591. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C3SEL, (uint32_t)(__I2C3_CLKSOURCE__))
  2592. /** @brief macro to get the I2C3 clock source.
  2593. * @retval The clock source can be one of the following values:
  2594. * @arg RCC_I2C3CLKSOURCE_PCLK1: PCLK1 selected as I2C3 clock
  2595. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  2596. * @arg RCC_I2C3CLKSOURCE_SYSCLK: System Clock selected as I2C3 clock
  2597. */
  2598. #define __HAL_RCC_GET_I2C3_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C3SEL)))
  2599. /** @brief Macro to configure the I2C4 clock (I2C4CLK).
  2600. *
  2601. * @param __I2C4_CLKSOURCE__ specifies the I2C4 clock source.
  2602. * This parameter can be one of the following values:
  2603. * @arg RCC_I2C4CLKSOURCE_PCLK1: PCLK1 selected as I2C4 clock
  2604. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  2605. * @arg RCC_I2C4CLKSOURCE_SYSCLK: System Clock selected as I2C4 clock
  2606. */
  2607. #define __HAL_RCC_I2C4_CONFIG(__I2C4_CLKSOURCE__) \
  2608. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C4SEL, (uint32_t)(__I2C4_CLKSOURCE__))
  2609. /** @brief macro to get the I2C4 clock source.
  2610. * @retval The clock source can be one of the following values:
  2611. * @arg RCC_I2C4CLKSOURCE_PCLK1: PCLK1 selected as I2C4 clock
  2612. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  2613. * @arg RCC_I2C4CLKSOURCE_SYSCLK: System Clock selected as I2C4 clock
  2614. */
  2615. #define __HAL_RCC_GET_I2C4_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C4SEL)))
  2616. /** @brief Macro to configure the USART1 clock (USART1CLK).
  2617. *
  2618. * @param __USART1_CLKSOURCE__ specifies the USART1 clock source.
  2619. * This parameter can be one of the following values:
  2620. * @arg RCC_USART1CLKSOURCE_PCLK2: PCLK2 selected as USART1 clock
  2621. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  2622. * @arg RCC_USART1CLKSOURCE_SYSCLK: System Clock selected as USART1 clock
  2623. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  2624. */
  2625. #define __HAL_RCC_USART1_CONFIG(__USART1_CLKSOURCE__) \
  2626. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART1SEL, (uint32_t)(__USART1_CLKSOURCE__))
  2627. /** @brief macro to get the USART1 clock source.
  2628. * @retval The clock source can be one of the following values:
  2629. * @arg RCC_USART1CLKSOURCE_PCLK2: PCLK2 selected as USART1 clock
  2630. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  2631. * @arg RCC_USART1CLKSOURCE_SYSCLK: System Clock selected as USART1 clock
  2632. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  2633. */
  2634. #define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART1SEL)))
  2635. /** @brief Macro to configure the USART2 clock (USART2CLK).
  2636. *
  2637. * @param __USART2_CLKSOURCE__ specifies the USART2 clock source.
  2638. * This parameter can be one of the following values:
  2639. * @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
  2640. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  2641. * @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
  2642. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  2643. */
  2644. #define __HAL_RCC_USART2_CONFIG(__USART2_CLKSOURCE__) \
  2645. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART2SEL, (uint32_t)(__USART2_CLKSOURCE__))
  2646. /** @brief macro to get the USART2 clock source.
  2647. * @retval The clock source can be one of the following values:
  2648. * @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
  2649. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  2650. * @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
  2651. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  2652. */
  2653. #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART2SEL)))
  2654. /** @brief Macro to configure the USART3 clock (USART3CLK).
  2655. *
  2656. * @param __USART3_CLKSOURCE__ specifies the USART3 clock source.
  2657. * This parameter can be one of the following values:
  2658. * @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock
  2659. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  2660. * @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock
  2661. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  2662. */
  2663. #define __HAL_RCC_USART3_CONFIG(__USART3_CLKSOURCE__) \
  2664. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART3SEL, (uint32_t)(__USART3_CLKSOURCE__))
  2665. /** @brief macro to get the USART3 clock source.
  2666. * @retval The clock source can be one of the following values:
  2667. * @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock
  2668. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  2669. * @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock
  2670. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  2671. */
  2672. #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART3SEL)))
  2673. /** @brief Macro to configure the UART4 clock (UART4CLK).
  2674. *
  2675. * @param __UART4_CLKSOURCE__ specifies the UART4 clock source.
  2676. * This parameter can be one of the following values:
  2677. * @arg RCC_UART4CLKSOURCE_PCLK1: PCLK1 selected as UART4 clock
  2678. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  2679. * @arg RCC_UART4CLKSOURCE_SYSCLK: System Clock selected as UART4 clock
  2680. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  2681. */
  2682. #define __HAL_RCC_UART4_CONFIG(__UART4_CLKSOURCE__) \
  2683. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART4SEL, (uint32_t)(__UART4_CLKSOURCE__))
  2684. /** @brief macro to get the UART4 clock source.
  2685. * @retval The clock source can be one of the following values:
  2686. * @arg RCC_UART4CLKSOURCE_PCLK1: PCLK1 selected as UART4 clock
  2687. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  2688. * @arg RCC_UART4CLKSOURCE_SYSCLK: System Clock selected as UART4 clock
  2689. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  2690. */
  2691. #define __HAL_RCC_GET_UART4_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART4SEL)))
  2692. /** @brief Macro to configure the UART5 clock (UART5CLK).
  2693. *
  2694. * @param __UART5_CLKSOURCE__ specifies the UART5 clock source.
  2695. * This parameter can be one of the following values:
  2696. * @arg RCC_UART5CLKSOURCE_PCLK1: PCLK1 selected as UART5 clock
  2697. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  2698. * @arg RCC_UART5CLKSOURCE_SYSCLK: System Clock selected as UART5 clock
  2699. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  2700. */
  2701. #define __HAL_RCC_UART5_CONFIG(__UART5_CLKSOURCE__) \
  2702. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART5SEL, (uint32_t)(__UART5_CLKSOURCE__))
  2703. /** @brief macro to get the UART5 clock source.
  2704. * @retval The clock source can be one of the following values:
  2705. * @arg RCC_UART5CLKSOURCE_PCLK1: PCLK1 selected as UART5 clock
  2706. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  2707. * @arg RCC_UART5CLKSOURCE_SYSCLK: System Clock selected as UART5 clock
  2708. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  2709. */
  2710. #define __HAL_RCC_GET_UART5_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART5SEL)))
  2711. /** @brief Macro to configure the USART6 clock (USART6CLK).
  2712. *
  2713. * @param __USART6_CLKSOURCE__ specifies the USART6 clock source.
  2714. * This parameter can be one of the following values:
  2715. * @arg RCC_USART6CLKSOURCE_PCLK1: PCLK1 selected as USART6 clock
  2716. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  2717. * @arg RCC_USART6CLKSOURCE_SYSCLK: System Clock selected as USART6 clock
  2718. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  2719. */
  2720. #define __HAL_RCC_USART6_CONFIG(__USART6_CLKSOURCE__) \
  2721. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART6SEL, (uint32_t)(__USART6_CLKSOURCE__))
  2722. /** @brief macro to get the USART6 clock source.
  2723. * @retval The clock source can be one of the following values:
  2724. * @arg RCC_USART6CLKSOURCE_PCLK1: PCLK1 selected as USART6 clock
  2725. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  2726. * @arg RCC_USART6CLKSOURCE_SYSCLK: System Clock selected as USART6 clock
  2727. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  2728. */
  2729. #define __HAL_RCC_GET_USART6_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART6SEL)))
  2730. /** @brief Macro to configure the UART7 clock (UART7CLK).
  2731. *
  2732. * @param __UART7_CLKSOURCE__ specifies the UART7 clock source.
  2733. * This parameter can be one of the following values:
  2734. * @arg RCC_UART7CLKSOURCE_PCLK1: PCLK1 selected as UART7 clock
  2735. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  2736. * @arg RCC_UART7CLKSOURCE_SYSCLK: System Clock selected as UART7 clock
  2737. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  2738. */
  2739. #define __HAL_RCC_UART7_CONFIG(__UART7_CLKSOURCE__) \
  2740. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART7SEL, (uint32_t)(__UART7_CLKSOURCE__))
  2741. /** @brief macro to get the UART7 clock source.
  2742. * @retval The clock source can be one of the following values:
  2743. * @arg RCC_UART7CLKSOURCE_PCLK1: PCLK1 selected as UART7 clock
  2744. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  2745. * @arg RCC_UART7CLKSOURCE_SYSCLK: System Clock selected as UART7 clock
  2746. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  2747. */
  2748. #define __HAL_RCC_GET_UART7_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART7SEL)))
  2749. /** @brief Macro to configure the UART8 clock (UART8CLK).
  2750. *
  2751. * @param __UART8_CLKSOURCE__ specifies the UART8 clock source.
  2752. * This parameter can be one of the following values:
  2753. * @arg RCC_UART8CLKSOURCE_PCLK1: PCLK1 selected as UART8 clock
  2754. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  2755. * @arg RCC_UART8CLKSOURCE_SYSCLK: System Clock selected as UART8 clock
  2756. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  2757. */
  2758. #define __HAL_RCC_UART8_CONFIG(__UART8_CLKSOURCE__) \
  2759. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART8SEL, (uint32_t)(__UART8_CLKSOURCE__))
  2760. /** @brief macro to get the UART8 clock source.
  2761. * @retval The clock source can be one of the following values:
  2762. * @arg RCC_UART8CLKSOURCE_PCLK1: PCLK1 selected as UART8 clock
  2763. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  2764. * @arg RCC_UART8CLKSOURCE_SYSCLK: System Clock selected as UART8 clock
  2765. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  2766. */
  2767. #define __HAL_RCC_GET_UART8_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART8SEL)))
  2768. /** @brief Macro to configure the LPTIM1 clock (LPTIM1CLK).
  2769. *
  2770. * @param __LPTIM1_CLKSOURCE__ specifies the LPTIM1 clock source.
  2771. * This parameter can be one of the following values:
  2772. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  2773. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI selected as LPTIM1 clock
  2774. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  2775. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  2776. */
  2777. #define __HAL_RCC_LPTIM1_CONFIG(__LPTIM1_CLKSOURCE__) \
  2778. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__LPTIM1_CLKSOURCE__))
  2779. /** @brief macro to get the LPTIM1 clock source.
  2780. * @retval The clock source can be one of the following values:
  2781. * @arg RCC_LPTIM1CLKSOURCE_PCLK1: PCLK selected as LPTIM1 clock
  2782. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI selected as LPTIM1 clock
  2783. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  2784. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  2785. */
  2786. #define __HAL_RCC_GET_LPTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL)))
  2787. /** @brief Macro to configure the CEC clock (CECCLK).
  2788. *
  2789. * @param __CEC_CLKSOURCE__ specifies the CEC clock source.
  2790. * This parameter can be one of the following values:
  2791. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  2792. * @arg RCC_CECCLKSOURCE_HSI: HSI divided by 488 selected as CEC clock
  2793. */
  2794. #define __HAL_RCC_CEC_CONFIG(__CEC_CLKSOURCE__) \
  2795. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, (uint32_t)(__CEC_CLKSOURCE__))
  2796. /** @brief macro to get the CEC clock source.
  2797. * @retval The clock source can be one of the following values:
  2798. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  2799. * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock
  2800. */
  2801. #define __HAL_RCC_GET_CEC_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL)))
  2802. /** @brief Macro to configure the CLK48 source (CLK48CLK).
  2803. *
  2804. * @param __CLK48_SOURCE__ specifies the CLK48 clock source.
  2805. * This parameter can be one of the following values:
  2806. * @arg RCC_CLK48SOURCE_PLL: PLL selected as CLK48 source
  2807. * @arg RCC_CLK48SOURCE_PLLSAIP: PLLSAIP selected as CLK48 source
  2808. */
  2809. #define __HAL_RCC_CLK48_CONFIG(__CLK48_SOURCE__) \
  2810. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__CLK48_SOURCE__))
  2811. /** @brief macro to get the CLK48 source.
  2812. * @retval The clock source can be one of the following values:
  2813. * @arg RCC_CLK48SOURCE_PLL: PLL used as CLK48 source
  2814. * @arg RCC_CLK48SOURCE_PLLSAIP: PLLSAIP used as CLK48 source
  2815. */
  2816. #define __HAL_RCC_GET_CLK48_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL)))
  2817. /** @brief Macro to configure the SDMMC1 clock (SDMMC1CLK).
  2818. *
  2819. * @param __SDMMC1_CLKSOURCE__ specifies the SDMMC1 clock source.
  2820. * This parameter can be one of the following values:
  2821. * @arg RCC_SDMMC1CLKSOURCE_CLK48: CLK48 selected as SDMMC clock
  2822. * @arg RCC_SDMMC1CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC clock
  2823. */
  2824. #define __HAL_RCC_SDMMC1_CONFIG(__SDMMC1_CLKSOURCE__) \
  2825. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC1SEL, (uint32_t)(__SDMMC1_CLKSOURCE__))
  2826. /** @brief macro to get the SDMMC1 clock source.
  2827. * @retval The clock source can be one of the following values:
  2828. * @arg RCC_SDMMC1CLKSOURCE_CLK48: CLK48 selected as SDMMC1 clock
  2829. * @arg RCC_SDMMC1CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC1 clock
  2830. */
  2831. #define __HAL_RCC_GET_SDMMC1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC1SEL)))
  2832. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  2833. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  2834. /** @brief Macro to configure the SDMMC2 clock (SDMMC2CLK).
  2835. * @param __SDMMC2_CLKSOURCE__ specifies the SDMMC2 clock source.
  2836. * This parameter can be one of the following values:
  2837. * @arg RCC_SDMMC2CLKSOURCE_CLK48: CLK48 selected as SDMMC2 clock
  2838. * @arg RCC_SDMMC2CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC2 clock
  2839. */
  2840. #define __HAL_RCC_SDMMC2_CONFIG(__SDMMC2_CLKSOURCE__) \
  2841. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC2SEL, (uint32_t)(__SDMMC2_CLKSOURCE__))
  2842. /** @brief macro to get the SDMMC2 clock source.
  2843. * @retval The clock source can be one of the following values:
  2844. * @arg RCC_SDMMC2CLKSOURCE_CLK48: CLK48 selected as SDMMC2 clock
  2845. * @arg RCC_SDMMC2CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC2 clock
  2846. */
  2847. #define __HAL_RCC_GET_SDMMC2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC2SEL)))
  2848. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  2849. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2850. /** @brief Macro to configure the DFSDM1 clock
  2851. * @param __DFSDM1_CLKSOURCE__ specifies the DFSDM1 clock source.
  2852. * This parameter can be one of the following values:
  2853. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 Clock selected as DFSDM clock
  2854. * @arg RCC_DFSDMCLKSOURCE_SYSCLK: System Clock selected as DFSDM clock
  2855. */
  2856. #define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1_CLKSOURCE__) \
  2857. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_DFSDM1SEL, (uint32_t)(__DFSDM1_CLKSOURCE__))
  2858. /** @brief Macro to get the DFSDM1 clock source.
  2859. * @retval The clock source can be one of the following values:
  2860. * @arg RCC_DFSDM1CLKSOURCE_PCLK2: PCLK2 Clock selected as DFSDM1 clock
  2861. * @arg RCC_DFSDM1CLKSOURCE_SYSCLK: System Clock selected as DFSDM1 clock
  2862. */
  2863. #define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_DFSDM1SEL)))
  2864. /** @brief Macro to configure the DFSDM1 Audio clock
  2865. * @param __DFSDM1AUDIO_CLKSOURCE__ specifies the DFSDM1 Audio clock source.
  2866. * This parameter can be one of the following values:
  2867. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI1: SAI1 Clock selected as DFSDM1 Audio clock
  2868. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI2: SAI2 Clock selected as DFSDM1 Audio clock
  2869. */
  2870. #define __HAL_RCC_DFSDM1AUDIO_CONFIG(__DFSDM1AUDIO_CLKSOURCE__) \
  2871. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_ADFSDM1SEL, (uint32_t)(__DFSDM1AUDIO_CLKSOURCE__))
  2872. /** @brief Macro to get the DFSDM1 Audio clock source.
  2873. * @retval The clock source can be one of the following values:
  2874. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI1: SAI1 Clock selected as DFSDM1 Audio clock
  2875. * @arg RCC_DFSDM1AUDIOCLKSOURCE_SAI2: SAI2 Clock selected as DFSDM1 Audio clock
  2876. */
  2877. #define __HAL_RCC_GET_DFSDM1AUDIO_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_ADFSDM1SEL)))
  2878. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  2879. #if defined (STM32F769xx) || defined (STM32F779xx)
  2880. /** @brief Macro to configure the DSI clock.
  2881. * @param __DSI_CLKSOURCE__ specifies the DSI clock source.
  2882. * This parameter can be one of the following values:
  2883. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  2884. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  2885. */
  2886. #define __HAL_RCC_DSI_CONFIG(__DSI_CLKSOURCE__) (MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_DSISEL, (uint32_t)(__DSI_CLKSOURCE__)))
  2887. /** @brief Macro to Get the DSI clock.
  2888. * @retval The clock source can be one of the following values:
  2889. * @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
  2890. * @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
  2891. */
  2892. #define __HAL_RCC_GET_DSI_SOURCE() (READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_DSISEL))
  2893. #endif /* STM32F769xx || STM32F779xx */
  2894. /**
  2895. * @}
  2896. */
  2897. /* Exported functions --------------------------------------------------------*/
  2898. /** @addtogroup RCCEx_Exported_Functions_Group1
  2899. * @{
  2900. */
  2901. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2902. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2903. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  2904. HAL_StatusTypeDef HAL_RCCEx_EnablePLLI2S(RCC_PLLI2SInitTypeDef *PLLI2SInit);
  2905. HAL_StatusTypeDef HAL_RCCEx_DisablePLLI2S(void);
  2906. HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI(RCC_PLLSAIInitTypeDef *PLLSAIInit);
  2907. HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI(void);
  2908. /**
  2909. * @}
  2910. */
  2911. /* Private macros ------------------------------------------------------------*/
  2912. /** @addtogroup RCCEx_Private_Macros RCCEx Private Macros
  2913. * @{
  2914. */
  2915. /** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters
  2916. * @{
  2917. */
  2918. #if defined(STM32F756xx) || defined(STM32F746xx) || defined(STM32F750xx)
  2919. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2920. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2921. (((SELECTION) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC) || \
  2922. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2923. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2924. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2925. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2926. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2927. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2928. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2929. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2930. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2931. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2932. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2933. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2934. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2935. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2936. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2937. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2938. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2939. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2940. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2941. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2942. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2943. #elif defined(STM32F745xx)
  2944. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2945. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2946. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2947. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2948. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2949. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2950. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2951. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2952. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2953. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2954. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2955. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2956. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2957. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2958. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2959. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2960. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2961. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2962. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2963. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2964. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2965. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2966. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2967. #elif defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  2968. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2969. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2970. (((SELECTION) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC) || \
  2971. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2972. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2973. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2974. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2975. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2976. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2977. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2978. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2979. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2980. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2981. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2982. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2983. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2984. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2985. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2986. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2987. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2988. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2989. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2990. (((SELECTION) & RCC_PERIPHCLK_SDMMC2) == RCC_PERIPHCLK_SDMMC2) || \
  2991. (((SELECTION) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) || \
  2992. (((SELECTION) & RCC_PERIPHCLK_DFSDM1_AUDIO) == RCC_PERIPHCLK_DFSDM1_AUDIO) || \
  2993. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2994. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2995. #elif defined (STM32F765xx)
  2996. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2997. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2998. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2999. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  3000. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  3001. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  3002. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  3003. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  3004. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  3005. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  3006. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  3007. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  3008. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  3009. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  3010. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  3011. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  3012. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  3013. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  3014. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  3015. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  3016. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  3017. (((SELECTION) & RCC_PERIPHCLK_SDMMC2) == RCC_PERIPHCLK_SDMMC2) || \
  3018. (((SELECTION) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) || \
  3019. (((SELECTION) & RCC_PERIPHCLK_DFSDM1_AUDIO) == RCC_PERIPHCLK_DFSDM1_AUDIO) || \
  3020. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  3021. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  3022. #elif defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  3023. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  3024. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  3025. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  3026. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  3027. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  3028. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  3029. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  3030. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  3031. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  3032. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  3033. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  3034. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  3035. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  3036. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  3037. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  3038. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  3039. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  3040. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  3041. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  3042. (((SELECTION) & RCC_PERIPHCLK_SDMMC2) == RCC_PERIPHCLK_SDMMC2) || \
  3043. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  3044. #endif /* STM32F746xx || STM32F756xx || STM32F750xx */
  3045. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
  3046. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) || \
  3047. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  3048. #define IS_RCC_PLLI2SP_VALUE(VALUE) (((VALUE) == RCC_PLLI2SP_DIV2) ||\
  3049. ((VALUE) == RCC_PLLI2SP_DIV4) ||\
  3050. ((VALUE) == RCC_PLLI2SP_DIV6) ||\
  3051. ((VALUE) == RCC_PLLI2SP_DIV8))
  3052. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  3053. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
  3054. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  3055. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((50 <= (VALUE)) && ((VALUE) <= 432))
  3056. #define IS_RCC_PLLSAIP_VALUE(VALUE) (((VALUE) == RCC_PLLSAIP_DIV2) ||\
  3057. ((VALUE) == RCC_PLLSAIP_DIV4) ||\
  3058. ((VALUE) == RCC_PLLSAIP_DIV6) ||\
  3059. ((VALUE) == RCC_PLLSAIP_DIV8))
  3060. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
  3061. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  3062. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
  3063. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
  3064. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDIVR_2) ||\
  3065. ((VALUE) == RCC_PLLSAIDIVR_4) ||\
  3066. ((VALUE) == RCC_PLLSAIDIVR_8) ||\
  3067. ((VALUE) == RCC_PLLSAIDIVR_16))
  3068. #define IS_RCC_I2SCLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SCLKSOURCE_PLLI2S) || \
  3069. ((SOURCE) == RCC_I2SCLKSOURCE_EXT))
  3070. #define IS_RCC_SDMMC1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SDMMC1CLKSOURCE_SYSCLK) || \
  3071. ((SOURCE) == RCC_SDMMC1CLKSOURCE_CLK48))
  3072. #define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_HSI) || \
  3073. ((SOURCE) == RCC_CECCLKSOURCE_LSE))
  3074. #define IS_RCC_USART1CLKSOURCE(SOURCE) \
  3075. (((SOURCE) == RCC_USART1CLKSOURCE_PCLK2) || \
  3076. ((SOURCE) == RCC_USART1CLKSOURCE_SYSCLK) || \
  3077. ((SOURCE) == RCC_USART1CLKSOURCE_LSE) || \
  3078. ((SOURCE) == RCC_USART1CLKSOURCE_HSI))
  3079. #define IS_RCC_USART2CLKSOURCE(SOURCE) \
  3080. (((SOURCE) == RCC_USART2CLKSOURCE_PCLK1) || \
  3081. ((SOURCE) == RCC_USART2CLKSOURCE_SYSCLK) || \
  3082. ((SOURCE) == RCC_USART2CLKSOURCE_LSE) || \
  3083. ((SOURCE) == RCC_USART2CLKSOURCE_HSI))
  3084. #define IS_RCC_USART3CLKSOURCE(SOURCE) \
  3085. (((SOURCE) == RCC_USART3CLKSOURCE_PCLK1) || \
  3086. ((SOURCE) == RCC_USART3CLKSOURCE_SYSCLK) || \
  3087. ((SOURCE) == RCC_USART3CLKSOURCE_LSE) || \
  3088. ((SOURCE) == RCC_USART3CLKSOURCE_HSI))
  3089. #define IS_RCC_UART4CLKSOURCE(SOURCE) \
  3090. (((SOURCE) == RCC_UART4CLKSOURCE_PCLK1) || \
  3091. ((SOURCE) == RCC_UART4CLKSOURCE_SYSCLK) || \
  3092. ((SOURCE) == RCC_UART4CLKSOURCE_LSE) || \
  3093. ((SOURCE) == RCC_UART4CLKSOURCE_HSI))
  3094. #define IS_RCC_UART5CLKSOURCE(SOURCE) \
  3095. (((SOURCE) == RCC_UART5CLKSOURCE_PCLK1) || \
  3096. ((SOURCE) == RCC_UART5CLKSOURCE_SYSCLK) || \
  3097. ((SOURCE) == RCC_UART5CLKSOURCE_LSE) || \
  3098. ((SOURCE) == RCC_UART5CLKSOURCE_HSI))
  3099. #define IS_RCC_USART6CLKSOURCE(SOURCE) \
  3100. (((SOURCE) == RCC_USART6CLKSOURCE_PCLK2) || \
  3101. ((SOURCE) == RCC_USART6CLKSOURCE_SYSCLK) || \
  3102. ((SOURCE) == RCC_USART6CLKSOURCE_LSE) || \
  3103. ((SOURCE) == RCC_USART6CLKSOURCE_HSI))
  3104. #define IS_RCC_UART7CLKSOURCE(SOURCE) \
  3105. (((SOURCE) == RCC_UART7CLKSOURCE_PCLK1) || \
  3106. ((SOURCE) == RCC_UART7CLKSOURCE_SYSCLK) || \
  3107. ((SOURCE) == RCC_UART7CLKSOURCE_LSE) || \
  3108. ((SOURCE) == RCC_UART7CLKSOURCE_HSI))
  3109. #define IS_RCC_UART8CLKSOURCE(SOURCE) \
  3110. (((SOURCE) == RCC_UART8CLKSOURCE_PCLK1) || \
  3111. ((SOURCE) == RCC_UART8CLKSOURCE_SYSCLK) || \
  3112. ((SOURCE) == RCC_UART8CLKSOURCE_LSE) || \
  3113. ((SOURCE) == RCC_UART8CLKSOURCE_HSI))
  3114. #define IS_RCC_I2C1CLKSOURCE(SOURCE) \
  3115. (((SOURCE) == RCC_I2C1CLKSOURCE_PCLK1) || \
  3116. ((SOURCE) == RCC_I2C1CLKSOURCE_SYSCLK)|| \
  3117. ((SOURCE) == RCC_I2C1CLKSOURCE_HSI))
  3118. #define IS_RCC_I2C2CLKSOURCE(SOURCE) \
  3119. (((SOURCE) == RCC_I2C2CLKSOURCE_PCLK1) || \
  3120. ((SOURCE) == RCC_I2C2CLKSOURCE_SYSCLK)|| \
  3121. ((SOURCE) == RCC_I2C2CLKSOURCE_HSI))
  3122. #define IS_RCC_I2C3CLKSOURCE(SOURCE) \
  3123. (((SOURCE) == RCC_I2C3CLKSOURCE_PCLK1) || \
  3124. ((SOURCE) == RCC_I2C3CLKSOURCE_SYSCLK)|| \
  3125. ((SOURCE) == RCC_I2C3CLKSOURCE_HSI))
  3126. #define IS_RCC_I2C4CLKSOURCE(SOURCE) \
  3127. (((SOURCE) == RCC_I2C4CLKSOURCE_PCLK1) || \
  3128. ((SOURCE) == RCC_I2C4CLKSOURCE_SYSCLK)|| \
  3129. ((SOURCE) == RCC_I2C4CLKSOURCE_HSI))
  3130. #define IS_RCC_LPTIM1CLK(SOURCE) \
  3131. (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK1) || \
  3132. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) || \
  3133. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) || \
  3134. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  3135. #define IS_RCC_CLK48SOURCE(SOURCE) \
  3136. (((SOURCE) == RCC_CLK48SOURCE_PLLSAIP) || \
  3137. ((SOURCE) == RCC_CLK48SOURCE_PLL))
  3138. #define IS_RCC_TIMPRES(VALUE) \
  3139. (((VALUE) == RCC_TIMPRES_DESACTIVATED) || \
  3140. ((VALUE) == RCC_TIMPRES_ACTIVATED))
  3141. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F745xx) ||\
  3142. defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F730xx) || defined (STM32F750xx)
  3143. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) || \
  3144. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) || \
  3145. ((SOURCE) == RCC_SAI1CLKSOURCE_PIN))
  3146. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) || \
  3147. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) || \
  3148. ((SOURCE) == RCC_SAI2CLKSOURCE_PIN))
  3149. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F745xx || STM32F746xx || STM32F756xx || STM32F750xx || STM32F730xx */
  3150. #if defined (STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  3151. #define IS_RCC_PLLR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  3152. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) || \
  3153. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) || \
  3154. ((SOURCE) == RCC_SAI1CLKSOURCE_PIN) || \
  3155. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLSRC))
  3156. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) || \
  3157. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) || \
  3158. ((SOURCE) == RCC_SAI2CLKSOURCE_PIN) || \
  3159. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLSRC))
  3160. #define IS_RCC_DFSDM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_DFSDM1CLKSOURCE_PCLK2) || \
  3161. ((SOURCE) == RCC_DFSDM1CLKSOURCE_SYSCLK))
  3162. #define IS_RCC_DFSDM1AUDIOCLKSOURCE(SOURCE) (((SOURCE) == RCC_DFSDM1AUDIOCLKSOURCE_SAI1) || \
  3163. ((SOURCE) == RCC_DFSDM1AUDIOCLKSOURCE_SAI2))
  3164. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  3165. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F765xx) ||\
  3166. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F730xx)
  3167. #define IS_RCC_SDMMC2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SDMMC2CLKSOURCE_SYSCLK) || \
  3168. ((SOURCE) == RCC_SDMMC2CLKSOURCE_CLK48))
  3169. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F730xx */
  3170. #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  3171. #define IS_RCC_DSIBYTELANECLKSOURCE(SOURCE) (((SOURCE) == RCC_DSICLKSOURCE_PLLR) ||\
  3172. ((SOURCE) == RCC_DSICLKSOURCE_DSIPHY))
  3173. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  3174. /**
  3175. * @}
  3176. */
  3177. /**
  3178. * @}
  3179. */
  3180. /**
  3181. * @}
  3182. */
  3183. /**
  3184. * @}
  3185. */
  3186. #ifdef __cplusplus
  3187. }
  3188. #endif
  3189. #endif /* __STM32F7xx_HAL_RCC_EX_H */
  3190. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/