stm32h7xx_hal_rcc.h 183 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064
  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_hal_rcc.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 21-April-2017
  7. * @brief Header file of RCC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32H7xx_HAL_RCC_H
  39. #define __STM32H7xx_HAL_RCC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32h7xx_hal_def.h"
  45. /** @addtogroup STM32H7xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup RCC
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup RCC_Exported_Types RCC Exported Types
  53. * @{
  54. */
  55. /**
  56. * @brief RCC PLL configuration structure definition
  57. */
  58. typedef struct
  59. {
  60. uint32_t PLLState; /*!< The new state of the PLL.
  61. This parameter can be a value of @ref RCC_PLL_Config */
  62. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  63. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  64. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  65. This parameter must be a number between Min_Data = 1 and Max_Data = 63 */
  66. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  67. This parameter must be a number between Min_Data = 4 and Max_Data = 512 */
  68. uint32_t PLLP; /*!< PLLP: Division factor for system clock.
  69. This parameter must be a number between Min_Data = 2 and Max_Data = 128
  70. odd division factors are not allowed */
  71. uint32_t PLLQ; /*!< PLLQ: Division factor for peripheral clocks.
  72. This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
  73. uint32_t PLLR; /*!< PLLR: Division factor for peripheral clocks.
  74. This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
  75. uint32_t PLLRGE; /*!<PLLRGE: PLL1 clock Input range
  76. This parameter must be a value of @ref RCC_PLL1_VCI_Range */
  77. uint32_t PLLVCOSEL; /*!<PLLVCOSEL: PLL1 clock Output range
  78. This parameter must be a value of @ref RCC_PLL1_VCO_Range */
  79. uint32_t PLLFRACN; /*!<PLLFRACN: Specifies Fractional Part Of The Multiplication Factor for
  80. PLL1 VCO It should be a value between 0 and 8191 */
  81. }RCC_PLLInitTypeDef;
  82. /**
  83. * @brief RCC Internal/External Oscillator (HSE, HSI, CSI, LSE and LSI) configuration structure definition
  84. */
  85. typedef struct
  86. {
  87. uint32_t OscillatorType; /*!< The oscillators to be configured.
  88. This parameter can be a value of @ref RCC_Oscillator_Type */
  89. uint32_t HSEState; /*!< The new state of the HSE.
  90. This parameter can be a value of @ref RCC_HSE_Config */
  91. uint32_t LSEState; /*!< The new state of the LSE.
  92. This parameter can be a value of @ref RCC_LSE_Config */
  93. uint32_t HSIState; /*!< The new state of the HSI.
  94. This parameter can be a value of @ref RCC_HSI_Config */
  95. uint32_t HSICalibrationValue; /*!< The calibration trimming value.
  96. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x3F */
  97. uint32_t LSIState; /*!< The new state of the LSI.
  98. This parameter can be a value of @ref RCC_LSI_Config */
  99. uint32_t HSI48State; /*!< The new state of the HSI48.
  100. This parameter can be a value of @ref RCC_HSI48_Config */
  101. uint32_t CSIState; /*!< The new state of the CSI.
  102. This parameter can be a value of @ref RCC_CSI_Config */
  103. uint32_t CSICalibrationValue; /*!< The calibration trimming value.
  104. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
  105. RCC_PLLInitTypeDef PLL; /*!< PLL structure parameters */
  106. }RCC_OscInitTypeDef;
  107. /**
  108. * @brief RCC System, AHB and APB busses clock configuration structure definition
  109. */
  110. typedef struct
  111. {
  112. uint32_t ClockType; /*!< The clock to be configured.
  113. This parameter can be a value of @ref RCC_System_Clock_Type */
  114. uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock.
  115. This parameter can be a value of @ref RCC_System_Clock_Source */
  116. uint32_t SYSCLKDivider; /*!< The system clock divider. This parameter can be
  117. a value of @ref RCC_SYS_Clock_Source */
  118. uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
  119. This parameter can be a value of @ref RCC_HCLK_Clock_Source */
  120. uint32_t APB3CLKDivider; /*!< The APB3 clock (D1PCLK1) divider. This clock is derived from the AHB clock (HCLK).
  121. This parameter can be a value of @ref RCC_APB3_Clock_Source */
  122. uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
  123. This parameter can be a value of @ref RCC_APB1_Clock_Source */
  124. uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK).
  125. This parameter can be a value of @ref RCC_APB2_Clock_Source */
  126. uint32_t APB4CLKDivider; /*!< The APB4 clock (D3PCLK1) divider. This clock is derived from the AHB clock (HCLK).
  127. This parameter can be a value of @ref RCC_APB4_Clock_Source */
  128. }RCC_ClkInitTypeDef;
  129. /**
  130. * @}
  131. */
  132. /* Exported constants --------------------------------------------------------*/
  133. /** @defgroup RCC_Exported_Constants RCC Exported Constants
  134. * @{
  135. */
  136. /** @defgroup RCC_Oscillator_Type RCC Oscillator Type
  137. * @{
  138. */
  139. #define RCC_OSCILLATORTYPE_NONE ((uint32_t)0x00000000)
  140. #define RCC_OSCILLATORTYPE_HSE ((uint32_t)0x00000001)
  141. #define RCC_OSCILLATORTYPE_HSI ((uint32_t)0x00000002)
  142. #define RCC_OSCILLATORTYPE_LSE ((uint32_t)0x00000004)
  143. #define RCC_OSCILLATORTYPE_LSI ((uint32_t)0x00000008)
  144. #define RCC_OSCILLATORTYPE_CSI ((uint32_t)0x00000010)
  145. #define RCC_OSCILLATORTYPE_HSI48 ((uint32_t)0x00000020)
  146. /**
  147. * @}
  148. */
  149. /** @defgroup RCC_HSE_Config RCC HSE Config
  150. * @{
  151. */
  152. #define RCC_HSE_OFF ((uint32_t)0x00000000)
  153. #define RCC_HSE_ON RCC_CR_HSEON
  154. #define RCC_HSE_BYPASS ((uint32_t)(RCC_CR_HSEBYP | RCC_CR_HSEON))
  155. /**
  156. * @}
  157. */
  158. /** @defgroup RCC_LSE_Config RCC LSE Config
  159. * @{
  160. */
  161. #define RCC_LSE_OFF ((uint32_t)0x00000000)
  162. #define RCC_LSE_ON RCC_BDCR_LSEON
  163. #define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON))
  164. /**
  165. * @}
  166. */
  167. /** @defgroup RCC_HSI_Config RCC HSI Config
  168. * @{
  169. */
  170. #define RCC_HSI_OFF ((uint32_t)0x00000000) /*!< HSI clock deactivation */
  171. #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */
  172. #define RCC_HSI_DIV1 (RCC_CR_HSIDIV_1 | RCC_CR_HSION) /*!< HSI_DIV1 clock activation */
  173. #define RCC_HSI_DIV2 (RCC_CR_HSIDIV_2 | RCC_CR_HSION) /*!< HSI_DIV2 clock activation */
  174. #define RCC_HSI_DIV4 (RCC_CR_HSIDIV_4 | RCC_CR_HSION) /*!< HSI_DIV4 clock activation */
  175. #define RCC_HSI_DIV8 (RCC_CR_HSIDIV | RCC_CR_HSION) /*!< HSI_DIV8 clock activation */
  176. #define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x20U) /* Default HSI calibration trimming value */
  177. /**
  178. * @}
  179. */
  180. /** @defgroup RCC_HSI48_Config RCC HSI48 Config
  181. * @{
  182. */
  183. #define RCC_HSI48_OFF ((uint8_t)0x00)
  184. #define RCC_HSI48_ON ((uint8_t)0x01)
  185. /**
  186. * @}
  187. */
  188. /** @defgroup RCC_LSI_Config RCC LSI Config
  189. * @{
  190. */
  191. #define RCC_LSI_OFF ((uint32_t)0x00000000)
  192. #define RCC_LSI_ON RCC_CSR_LSION
  193. /**
  194. * @}
  195. */
  196. /** @defgroup RCC_CSI_Config RCC CSI Config
  197. * @{
  198. */
  199. #define RCC_CSI_OFF ((uint32_t)0x00000000)
  200. #define RCC_CSI_ON RCC_CR_CSION
  201. #define RCC_CSICALIBRATION_DEFAULT ((uint32_t)0x10U) /* Default CSI calibration trimming value */
  202. /**
  203. * @}
  204. */
  205. /** @defgroup RCC_PLL_Config RCC PLL Config
  206. * @{
  207. */
  208. #define RCC_PLL_NONE ((uint32_t)0x00000000)
  209. #define RCC_PLL_OFF ((uint32_t)0x00000001)
  210. #define RCC_PLL_ON ((uint32_t)0x00000002)
  211. /**
  212. * @}
  213. */
  214. /** @defgroup RCC_PLL_Clock_Source RCC PLL Clock Source
  215. * @{
  216. */
  217. #define RCC_PLLSOURCE_HSI ((uint32_t)0x00000000)
  218. #define RCC_PLLSOURCE_CSI ((uint32_t)0x00000001)
  219. #define RCC_PLLSOURCE_HSE ((uint32_t)0x00000002)
  220. #define RCC_PLLSOURCE_NONE ((uint32_t)0x00000003)
  221. /**
  222. * @}
  223. */
  224. /** @defgroup RCC_PLL_Clock_Output RCC PLL Clock Output
  225. * @{
  226. */
  227. #define RCC_PLL1_DIVP RCC_PLLCFGR_DIVP1EN
  228. #define RCC_PLL1_DIVQ RCC_PLLCFGR_DIVQ1EN
  229. #define RCC_PLL1_DIVR RCC_PLLCFGR_DIVR1EN
  230. /**
  231. * @}
  232. */
  233. /** @defgroup RCC_PLL1_VCI_Range RCC PLL1 VCI Range
  234. * @{
  235. */
  236. #define RCC_PLL1VCIRANGE_0 RCC_PLLCFGR_PLL1RGE_0
  237. #define RCC_PLL1VCIRANGE_1 RCC_PLLCFGR_PLL1RGE_1
  238. #define RCC_PLL1VCIRANGE_2 RCC_PLLCFGR_PLL1RGE_2
  239. #define RCC_PLL1VCIRANGE_3 RCC_PLLCFGR_PLL1RGE_3
  240. /**
  241. * @}
  242. */
  243. /** @defgroup RCC_PLL1_VCO_Range RCC PLL1 VCO Range
  244. * @{
  245. */
  246. #define RCC_PLL1VCOWIDE ((uint32_t)0x00000000)
  247. #define RCC_PLL1VCOMEDIUM RCC_PLLCFGR_PLL1VCOSEL
  248. /**
  249. * @}
  250. */
  251. /** @defgroup RCC_System_Clock_Type RCC System Clock Type
  252. * @{
  253. */
  254. #define RCC_CLOCKTYPE_SYSCLK ((uint32_t)0x00000001)
  255. #define RCC_CLOCKTYPE_HCLK ((uint32_t)0x00000002)
  256. #define RCC_CLOCKTYPE_D1PCLK1 ((uint32_t)0x00000004)
  257. #define RCC_CLOCKTYPE_PCLK1 ((uint32_t)0x00000008)
  258. #define RCC_CLOCKTYPE_PCLK2 ((uint32_t)0x00000010)
  259. #define RCC_CLOCKTYPE_D3PCLK1 ((uint32_t)0x00000020)
  260. /**
  261. * @}
  262. */
  263. /** @defgroup RCC_System_Clock_Source RCC System Clock Source
  264. * @{
  265. */
  266. #define RCC_SYSCLKSOURCE_CSI RCC_CFGR_SW_CSI
  267. #define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI
  268. #define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE
  269. #define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL1
  270. /**
  271. * @}
  272. */
  273. /** @defgroup RCC_SYS_Clock_Source RCC SYS Clock Source
  274. * @{
  275. */
  276. #define RCC_SYSCLK_DIV1 RCC_D1CFGR_D1CPRE_DIV1
  277. #define RCC_SYSCLK_DIV2 RCC_D1CFGR_D1CPRE_DIV2
  278. #define RCC_SYSCLK_DIV4 RCC_D1CFGR_D1CPRE_DIV4
  279. #define RCC_SYSCLK_DIV8 RCC_D1CFGR_D1CPRE_DIV8
  280. #define RCC_SYSCLK_DIV16 RCC_D1CFGR_D1CPRE_DIV16
  281. #define RCC_SYSCLK_DIV64 RCC_D1CFGR_D1CPRE_DIV64
  282. #define RCC_SYSCLK_DIV128 RCC_D1CFGR_D1CPRE_DIV128
  283. #define RCC_SYSCLK_DIV256 RCC_D1CFGR_D1CPRE_DIV256
  284. #define RCC_SYSCLK_DIV512 RCC_D1CFGR_D1CPRE_DIV512
  285. /**
  286. * @}
  287. */
  288. /** @defgroup RCC_HCLK_Clock_Source RCC HCLK Clock Source
  289. * @{
  290. */
  291. #define RCC_HCLK_DIV1 RCC_D1CFGR_HPRE_DIV1
  292. #define RCC_HCLK_DIV2 RCC_D1CFGR_HPRE_DIV2
  293. #define RCC_HCLK_DIV4 RCC_D1CFGR_HPRE_DIV4
  294. #define RCC_HCLK_DIV8 RCC_D1CFGR_HPRE_DIV8
  295. #define RCC_HCLK_DIV16 RCC_D1CFGR_HPRE_DIV16
  296. #define RCC_HCLK_DIV64 RCC_D1CFGR_HPRE_DIV64
  297. #define RCC_HCLK_DIV128 RCC_D1CFGR_HPRE_DIV128
  298. #define RCC_HCLK_DIV256 RCC_D1CFGR_HPRE_DIV256
  299. #define RCC_HCLK_DIV512 RCC_D1CFGR_HPRE_DIV512
  300. /**
  301. * @}
  302. */
  303. /** @defgroup RCC_APB3_Clock_Source RCC APB3 Clock Source
  304. * @{
  305. */
  306. #define RCC_APB3_DIV1 RCC_D1CFGR_D1PPRE_DIV1
  307. #define RCC_APB3_DIV2 RCC_D1CFGR_D1PPRE_DIV2
  308. #define RCC_APB3_DIV4 RCC_D1CFGR_D1PPRE_DIV4
  309. #define RCC_APB3_DIV8 RCC_D1CFGR_D1PPRE_DIV8
  310. #define RCC_APB3_DIV16 RCC_D1CFGR_D1PPRE_DIV16
  311. /**
  312. * @}
  313. */
  314. /** @defgroup RCC_APB1_Clock_Source RCC APB1 Clock Source
  315. * @{
  316. */
  317. #define RCC_APB1_DIV1 RCC_D2CFGR_D2PPRE1_DIV1
  318. #define RCC_APB1_DIV2 RCC_D2CFGR_D2PPRE1_DIV2
  319. #define RCC_APB1_DIV4 RCC_D2CFGR_D2PPRE1_DIV4
  320. #define RCC_APB1_DIV8 RCC_D2CFGR_D2PPRE1_DIV8
  321. #define RCC_APB1_DIV16 RCC_D2CFGR_D2PPRE1_DIV16
  322. /**
  323. * @}
  324. */
  325. /** @defgroup RCC_APB2_Clock_Source RCC APB2 Clock Source
  326. * @{
  327. */
  328. #define RCC_APB2_DIV1 RCC_D2CFGR_D2PPRE2_DIV1
  329. #define RCC_APB2_DIV2 RCC_D2CFGR_D2PPRE2_DIV2
  330. #define RCC_APB2_DIV4 RCC_D2CFGR_D2PPRE2_DIV4
  331. #define RCC_APB2_DIV8 RCC_D2CFGR_D2PPRE2_DIV8
  332. #define RCC_APB2_DIV16 RCC_D2CFGR_D2PPRE2_DIV16
  333. /**
  334. * @}
  335. */
  336. /** @defgroup RCC_APB4_Clock_Source RCC APB4 Clock Source
  337. * @{
  338. */
  339. #define RCC_APB4_DIV1 RCC_D3CFGR_D3PPRE_DIV1
  340. #define RCC_APB4_DIV2 RCC_D3CFGR_D3PPRE_DIV2
  341. #define RCC_APB4_DIV4 RCC_D3CFGR_D3PPRE_DIV4
  342. #define RCC_APB4_DIV8 RCC_D3CFGR_D3PPRE_DIV8
  343. #define RCC_APB4_DIV16 RCC_D3CFGR_D3PPRE_DIV16
  344. /**
  345. * @}
  346. */
  347. /** @defgroup RCC_RTC_Clock_Source RCC RTC Clock Source
  348. * @{
  349. */
  350. #define RCC_RTCCLKSOURCE_LSE ((uint32_t)0x00000100U)
  351. #define RCC_RTCCLKSOURCE_LSI ((uint32_t)0x00000200U)
  352. #define RCC_RTCCLKSOURCE_HSE_DIV2 ((uint32_t)0x00002300U)
  353. #define RCC_RTCCLKSOURCE_HSE_DIV3 ((uint32_t)0x00003300U)
  354. #define RCC_RTCCLKSOURCE_HSE_DIV4 ((uint32_t)0x00004300U)
  355. #define RCC_RTCCLKSOURCE_HSE_DIV5 ((uint32_t)0x00005300U)
  356. #define RCC_RTCCLKSOURCE_HSE_DIV6 ((uint32_t)0x00006300U)
  357. #define RCC_RTCCLKSOURCE_HSE_DIV7 ((uint32_t)0x00007300U)
  358. #define RCC_RTCCLKSOURCE_HSE_DIV8 ((uint32_t)0x00008300U)
  359. #define RCC_RTCCLKSOURCE_HSE_DIV9 ((uint32_t)0x00009300U)
  360. #define RCC_RTCCLKSOURCE_HSE_DIV10 ((uint32_t)0x0000A300U)
  361. #define RCC_RTCCLKSOURCE_HSE_DIV11 ((uint32_t)0x0000B300U)
  362. #define RCC_RTCCLKSOURCE_HSE_DIV12 ((uint32_t)0x0000C300U)
  363. #define RCC_RTCCLKSOURCE_HSE_DIV13 ((uint32_t)0x0000D300U)
  364. #define RCC_RTCCLKSOURCE_HSE_DIV14 ((uint32_t)0x0000E300U)
  365. #define RCC_RTCCLKSOURCE_HSE_DIV15 ((uint32_t)0x0000F300U)
  366. #define RCC_RTCCLKSOURCE_HSE_DIV16 ((uint32_t)0x00010300U)
  367. #define RCC_RTCCLKSOURCE_HSE_DIV17 ((uint32_t)0x00011300U)
  368. #define RCC_RTCCLKSOURCE_HSE_DIV18 ((uint32_t)0x00012300U)
  369. #define RCC_RTCCLKSOURCE_HSE_DIV19 ((uint32_t)0x00013300U)
  370. #define RCC_RTCCLKSOURCE_HSE_DIV20 ((uint32_t)0x00014300U)
  371. #define RCC_RTCCLKSOURCE_HSE_DIV21 ((uint32_t)0x00015300U)
  372. #define RCC_RTCCLKSOURCE_HSE_DIV22 ((uint32_t)0x00016300U)
  373. #define RCC_RTCCLKSOURCE_HSE_DIV23 ((uint32_t)0x00017300U)
  374. #define RCC_RTCCLKSOURCE_HSE_DIV24 ((uint32_t)0x00018300U)
  375. #define RCC_RTCCLKSOURCE_HSE_DIV25 ((uint32_t)0x00019300U)
  376. #define RCC_RTCCLKSOURCE_HSE_DIV26 ((uint32_t)0x0001A300U)
  377. #define RCC_RTCCLKSOURCE_HSE_DIV27 ((uint32_t)0x0001B300U)
  378. #define RCC_RTCCLKSOURCE_HSE_DIV28 ((uint32_t)0x0001C300U)
  379. #define RCC_RTCCLKSOURCE_HSE_DIV29 ((uint32_t)0x0001D300U)
  380. #define RCC_RTCCLKSOURCE_HSE_DIV30 ((uint32_t)0x0001E300U)
  381. #define RCC_RTCCLKSOURCE_HSE_DIV31 ((uint32_t)0x0001F300U)
  382. #define RCC_RTCCLKSOURCE_HSE_DIV32 ((uint32_t)0x00020300U)
  383. #define RCC_RTCCLKSOURCE_HSE_DIV33 ((uint32_t)0x00021300U)
  384. #define RCC_RTCCLKSOURCE_HSE_DIV34 ((uint32_t)0x00022300U)
  385. #define RCC_RTCCLKSOURCE_HSE_DIV35 ((uint32_t)0x00023300U)
  386. #define RCC_RTCCLKSOURCE_HSE_DIV36 ((uint32_t)0x00024300U)
  387. #define RCC_RTCCLKSOURCE_HSE_DIV37 ((uint32_t)0x00025300U)
  388. #define RCC_RTCCLKSOURCE_HSE_DIV38 ((uint32_t)0x00026300U)
  389. #define RCC_RTCCLKSOURCE_HSE_DIV39 ((uint32_t)0x00027300U)
  390. #define RCC_RTCCLKSOURCE_HSE_DIV40 ((uint32_t)0x00028300U)
  391. #define RCC_RTCCLKSOURCE_HSE_DIV41 ((uint32_t)0x00029300U)
  392. #define RCC_RTCCLKSOURCE_HSE_DIV42 ((uint32_t)0x0002A300U)
  393. #define RCC_RTCCLKSOURCE_HSE_DIV43 ((uint32_t)0x0002B300U)
  394. #define RCC_RTCCLKSOURCE_HSE_DIV44 ((uint32_t)0x0002C300U)
  395. #define RCC_RTCCLKSOURCE_HSE_DIV45 ((uint32_t)0x0002D300U)
  396. #define RCC_RTCCLKSOURCE_HSE_DIV46 ((uint32_t)0x0002E300U)
  397. #define RCC_RTCCLKSOURCE_HSE_DIV47 ((uint32_t)0x0002F300U)
  398. #define RCC_RTCCLKSOURCE_HSE_DIV48 ((uint32_t)0x00030300U)
  399. #define RCC_RTCCLKSOURCE_HSE_DIV49 ((uint32_t)0x00031300U)
  400. #define RCC_RTCCLKSOURCE_HSE_DIV50 ((uint32_t)0x00032300U)
  401. #define RCC_RTCCLKSOURCE_HSE_DIV51 ((uint32_t)0x00033300U)
  402. #define RCC_RTCCLKSOURCE_HSE_DIV52 ((uint32_t)0x00034300U)
  403. #define RCC_RTCCLKSOURCE_HSE_DIV53 ((uint32_t)0x00035300U)
  404. #define RCC_RTCCLKSOURCE_HSE_DIV54 ((uint32_t)0x00036300U)
  405. #define RCC_RTCCLKSOURCE_HSE_DIV55 ((uint32_t)0x00037300U)
  406. #define RCC_RTCCLKSOURCE_HSE_DIV56 ((uint32_t)0x00038300U)
  407. #define RCC_RTCCLKSOURCE_HSE_DIV57 ((uint32_t)0x00039300U)
  408. #define RCC_RTCCLKSOURCE_HSE_DIV58 ((uint32_t)0x0003A300U)
  409. #define RCC_RTCCLKSOURCE_HSE_DIV59 ((uint32_t)0x0003B300U)
  410. #define RCC_RTCCLKSOURCE_HSE_DIV60 ((uint32_t)0x0003C300U)
  411. #define RCC_RTCCLKSOURCE_HSE_DIV61 ((uint32_t)0x0003D300U)
  412. #define RCC_RTCCLKSOURCE_HSE_DIV62 ((uint32_t)0x0003E300U)
  413. #define RCC_RTCCLKSOURCE_HSE_DIV63 ((uint32_t)0x0003F300U)
  414. /**
  415. * @}
  416. */
  417. /** @defgroup RCC_MCO_Index RCC MCO Index
  418. * @{
  419. */
  420. #define RCC_MCO1 ((uint32_t)0x00000000)
  421. #define RCC_MCO2 ((uint32_t)0x00000001)
  422. /**
  423. * @}
  424. */
  425. /** @defgroup RCC_MCO1_Clock_Source RCC MCO1 Clock Source
  426. * @{
  427. */
  428. #define RCC_MCO1SOURCE_HSI ((uint32_t)0x00000000)
  429. #define RCC_MCO1SOURCE_LSE RCC_CFGR_MCO1_0
  430. #define RCC_MCO1SOURCE_HSE RCC_CFGR_MCO1_1
  431. #define RCC_MCO1SOURCE_PLL1QCLK ((uint32_t)RCC_CFGR_MCO1_0 | RCC_CFGR_MCO1_1)
  432. #define RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCO1_2
  433. /**
  434. * @}
  435. */
  436. /** @defgroup RCC_MCO2_Clock_Source RCC MCO2 Clock Source
  437. * @{
  438. */
  439. #define RCC_MCO2SOURCE_SYSCLK ((uint32_t)0x00000000)
  440. #define RCC_MCO2SOURCE_PLL2PCLK RCC_CFGR_MCO2_0
  441. #define RCC_MCO2SOURCE_HSE RCC_CFGR_MCO2_1
  442. #define RCC_MCO2SOURCE_PLLCLK ((uint32_t)RCC_CFGR_MCO2_0 | RCC_CFGR_MCO2_1)
  443. #define RCC_MCO2SOURCE_CSICLK RCC_CFGR_MCO2_2
  444. #define RCC_MCO2SOURCE_LSICLK ((uint32_t)RCC_CFGR_MCO2_0 | RCC_CFGR_MCO2_2)
  445. /**
  446. * @}
  447. */
  448. /** @defgroup RCC_MCOx_Clock_Prescaler RCC MCOx Clock Prescaler
  449. * @{
  450. */
  451. #define RCC_MCODIV_1 RCC_CFGR_MCO1PRE_0
  452. #define RCC_MCODIV_2 RCC_CFGR_MCO1PRE_1
  453. #define RCC_MCODIV_3 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_1)
  454. #define RCC_MCODIV_4 RCC_CFGR_MCO1PRE_2
  455. #define RCC_MCODIV_5 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_2)
  456. #define RCC_MCODIV_6 ((uint32_t)RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2)
  457. #define RCC_MCODIV_7 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2)
  458. #define RCC_MCODIV_8 RCC_CFGR_MCO1PRE_3
  459. #define RCC_MCODIV_9 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_3)
  460. #define RCC_MCODIV_10 ((uint32_t)RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_3)
  461. #define RCC_MCODIV_11 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_3)
  462. #define RCC_MCODIV_12 ((uint32_t)RCC_CFGR_MCO1PRE_2 | RCC_CFGR_MCO1PRE_3)
  463. #define RCC_MCODIV_13 ((uint32_t)RCC_CFGR_MCO1PRE_0 | RCC_CFGR_MCO1PRE_2 | RCC_CFGR_MCO1PRE_3)
  464. #define RCC_MCODIV_14 ((uint32_t)RCC_CFGR_MCO1PRE_1 | RCC_CFGR_MCO1PRE_2 | RCC_CFGR_MCO1PRE_3)
  465. #define RCC_MCODIV_15 RCC_CFGR_MCO1PRE
  466. /**
  467. * @}
  468. */
  469. /** @defgroup RCC_Interrupt RCC Interrupt
  470. * @{
  471. */
  472. #define RCC_IT_LSIRDY ((uint32_t)0x00000001)
  473. #define RCC_IT_LSERDY ((uint32_t)0x00000002)
  474. #define RCC_IT_HSIRDY ((uint32_t)0x00000004)
  475. #define RCC_IT_HSERDY ((uint32_t)0x00000008)
  476. #define RCC_IT_CSIRDY ((uint32_t)0x00000010)
  477. #define RCC_IT_HSI48RDY ((uint32_t)0x00000020)
  478. #define RCC_IT_PLLRDY ((uint32_t)0x00000040)
  479. #define RCC_IT_PLL2RDY ((uint32_t)0x00000080)
  480. #define RCC_IT_PLL3RDY ((uint32_t)0x00000100)
  481. #define RCC_IT_LSECSS ((uint32_t)0x00000200)
  482. #define RCC_IT_CSS ((uint32_t)0x00000400)
  483. /**
  484. * @}
  485. */
  486. /** @defgroup RCC_Flag RCC Flag
  487. * Elements values convention: 0XXYYYYYb
  488. * - YYYYY : Flag position in the register
  489. * - 0XX : Register index
  490. * - 01: CR register
  491. * - 10: BDCR register
  492. * - 11: CSR register
  493. * @{
  494. */
  495. /* Flags in the CR register */
  496. #define RCC_FLAG_HSIRDY ((uint8_t)0x22)
  497. #define RCC_FLAG_HSIDIV ((uint8_t)0x25)
  498. #define RCC_FLAG_CSIRDY ((uint8_t)0x28)
  499. #define RCC_FLAG_HSI48RDY ((uint8_t)0x2D)
  500. #define RCC_FLAG_D1CKRDY ((uint8_t)0x2E)
  501. #define RCC_FLAG_D2CKRDY ((uint8_t)0x2F)
  502. #define RCC_FLAG_HSERDY ((uint8_t)0x31)
  503. #define RCC_FLAG_PLLRDY ((uint8_t)0x39)
  504. #define RCC_FLAG_PLL2RDY ((uint8_t)0x3B)
  505. #define RCC_FLAG_PLL3RDY ((uint8_t)0x3D)
  506. /* Flags in the BDCR register */
  507. #define RCC_FLAG_LSERDY ((uint8_t)0x41)
  508. /* Flags in the CSR register */
  509. #define RCC_FLAG_LSIRDY ((uint8_t)0x61)
  510. /* Flags in the RSR register */
  511. #define RCC_FLAG_RMVF ((uint8_t)0x90)
  512. #define RCC_FLAG_CPURST ((uint8_t)0x91)
  513. #define RCC_FLAG_D1RST ((uint8_t)0x93)
  514. #define RCC_FLAG_D2RST ((uint8_t)0x94)
  515. #define RCC_FLAG_BORRST ((uint8_t)0x95)
  516. #define RCC_FLAG_PINRST ((uint8_t)0x96)
  517. #define RCC_FLAG_PORRST ((uint8_t)0x97)
  518. #define RCC_FLAG_SFTRST ((uint8_t)0x98)
  519. #define RCC_FLAG_IWDG1RST ((uint8_t)0x9A)
  520. #define RCC_FLAG_WWDG1RST ((uint8_t)0x9C)
  521. #define RCC_FLAG_LPWR1RST ((uint8_t)0x9E)
  522. #define RCC_FLAG_LPWR2RST ((uint8_t)0x9F)
  523. /**
  524. * @}
  525. */
  526. /** @defgroup RCC_LSEDrive_Config LSE Drive Config
  527. * @{
  528. */
  529. #define RCC_LSEDRIVE_LOW ((uint32_t)0x00000000) /*!< LSE low drive capability */
  530. #define RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< LSE medium low drive capability */
  531. /* Workaround implementation on medium low */
  532. #define RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< LSE medium high drive capability */
  533. /* Workaround implementation on medium high */
  534. #define RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< LSE high drive capability */
  535. /**
  536. * @}
  537. */
  538. /** @defgroup RCC_Stop_WakeUpClock RCC Stop WakeUpClock
  539. * @{
  540. */
  541. #define RCC_STOP_WAKEUPCLOCK_HSI ((uint32_t)0x00000000)
  542. #define RCC_STOP_WAKEUPCLOCK_CSI RCC_CFGR_STOPWUCK
  543. /**
  544. * @}
  545. */
  546. /** @defgroup RCC_Stop_KernelWakeUpClock RCC Stop KernelWakeUpClock
  547. * @{
  548. */
  549. #define RCC_STOP_KERWAKEUPCLOCK_HSI ((uint32_t)0x00000000)
  550. #define RCC_STOP_KERWAKEUPCLOCK_CSI RCC_CFGR_STOPKERWUCK
  551. /**
  552. * @}
  553. */
  554. /**
  555. * @}
  556. */
  557. /* Exported macros -----------------------------------------------------------*/
  558. /** @defgroup RCC_Exported_Macros RCC Exported Macros
  559. * @{
  560. */
  561. /** @brief Enable or disable the AHB3 peripheral clock.
  562. * @note After reset, the peripheral clock (used for registers read/write access)
  563. * is disabled and the application software has to enable this clock before
  564. * using it.
  565. */
  566. #define __HAL_RCC_MDMA_CLK_ENABLE() do { \
  567. __IO uint32_t tmpreg; \
  568. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_MDMAEN);\
  569. /* Delay after an RCC peripheral clock enabling */ \
  570. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_MDMAEN);\
  571. UNUSED(tmpreg); \
  572. } while(0)
  573. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  574. __IO uint32_t tmpreg; \
  575. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_DMA2DEN);\
  576. /* Delay after an RCC peripheral clock enabling */ \
  577. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_DMA2DEN);\
  578. UNUSED(tmpreg); \
  579. } while(0)
  580. #define __HAL_RCC_JPGDECEN_CLK_ENABLE() do { \
  581. __IO uint32_t tmpreg; \
  582. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_JPGDECEN);\
  583. /* Delay after an RCC peripheral clock enabling */ \
  584. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_JPGDECEN);\
  585. UNUSED(tmpreg); \
  586. } while(0)
  587. #define __HAL_RCC_FLASH_CLK_ENABLE() do { \
  588. __IO uint32_t tmpreg; \
  589. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FLASHEN);\
  590. /* Delay after an RCC peripheral clock enabling */ \
  591. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FLASHEN);\
  592. UNUSED(tmpreg); \
  593. } while(0)
  594. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  595. __IO uint32_t tmpreg; \
  596. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  597. /* Delay after an RCC peripheral clock enabling */ \
  598. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  599. UNUSED(tmpreg); \
  600. } while(0)
  601. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  602. __IO uint32_t tmpreg; \
  603. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  604. /* Delay after an RCC peripheral clock enabling */ \
  605. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  606. UNUSED(tmpreg); \
  607. } while(0)
  608. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  609. __IO uint32_t tmpreg; \
  610. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_SDMMC1EN);\
  611. /* Delay after an RCC peripheral clock enabling */ \
  612. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_SDMMC1EN);\
  613. UNUSED(tmpreg); \
  614. } while(0)
  615. #define __HAL_RCC_MDMA_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_MDMAEN))
  616. #define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_DMA2DEN))
  617. #define __HAL_RCC_JPGDECEN_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_JPGDECEN))
  618. #define __HAL_RCC_FLASH_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_FLASHEN))
  619. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_FMCEN))
  620. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_QSPIEN))
  621. #define __HAL_RCC_SDMMC1_CLK_DISABLE() (RCC->AHB3ENR &= ~ (RCC_AHB3ENR_SDMMC1EN))
  622. /** @brief Enable or disable the AHB1 peripheral clock.
  623. * @note After reset, the peripheral clock (used for registers read/write access)
  624. * is disabled and the application software has to enable this clock before
  625. * using it.
  626. */
  627. #define __HAL_RCC_DMA1_CLK_ENABLE() do { \
  628. __IO uint32_t tmpreg; \
  629. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN);\
  630. /* Delay after an RCC peripheral clock enabling */ \
  631. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA1EN);\
  632. UNUSED(tmpreg); \
  633. } while(0)
  634. #define __HAL_RCC_DMA2_CLK_ENABLE() do { \
  635. __IO uint32_t tmpreg; \
  636. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  637. /* Delay after an RCC peripheral clock enabling */ \
  638. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  639. UNUSED(tmpreg); \
  640. } while(0)
  641. #define __HAL_RCC_ADC12_CLK_ENABLE() do { \
  642. __IO uint32_t tmpreg; \
  643. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ADC12EN);\
  644. /* Delay after an RCC peripheral clock enabling */ \
  645. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ADC12EN);\
  646. UNUSED(tmpreg); \
  647. } while(0)
  648. #define __HAL_RCC_ETH1MAC_CLK_ENABLE() do { \
  649. __IO uint32_t tmpreg; \
  650. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETH1MACEN);\
  651. /* Delay after an RCC peripheral clock enabling */ \
  652. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETH1MACEN);\
  653. UNUSED(tmpreg); \
  654. } while(0)
  655. #define __HAL_RCC_ETH1TX_CLK_ENABLE() do { \
  656. __IO uint32_t tmpreg; \
  657. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETH1TXEN);\
  658. /* Delay after an RCC peripheral clock enabling */ \
  659. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETH1TXEN);\
  660. UNUSED(tmpreg); \
  661. } while(0)
  662. #define __HAL_RCC_ETH1RX_CLK_ENABLE() do { \
  663. __IO uint32_t tmpreg; \
  664. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETH1RXEN);\
  665. /* Delay after an RCC peripheral clock enabling */ \
  666. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETH1RXEN);\
  667. UNUSED(tmpreg); \
  668. } while(0)
  669. #define __HAL_RCC_USB1_OTG_HS_CLK_ENABLE() do { \
  670. __IO uint32_t tmpreg; \
  671. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB1OTGHSEN);\
  672. /* Delay after an RCC peripheral clock enabling */ \
  673. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB1OTGHSEN);\
  674. UNUSED(tmpreg); \
  675. } while(0)
  676. #define __HAL_RCC_USB1_OTG_HS_ULPI_CLK_ENABLE() do { \
  677. __IO uint32_t tmpreg; \
  678. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB1OTGHSULPIEN);\
  679. /* Delay after an RCC peripheral clock enabling */ \
  680. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB1OTGHSULPIEN);\
  681. UNUSED(tmpreg); \
  682. } while(0)
  683. #define __HAL_RCC_USB2_OTG_FS_CLK_ENABLE() do { \
  684. __IO uint32_t tmpreg; \
  685. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB2OTGHSEN);\
  686. /* Delay after an RCC peripheral clock enabling */ \
  687. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB2OTGHSEN);\
  688. UNUSED(tmpreg); \
  689. } while(0)
  690. #define __HAL_RCC_USB2_OTG_FS_ULPI_CLK_ENABLE() do { \
  691. __IO uint32_t tmpreg; \
  692. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB2OTGHSULPIEN);\
  693. /* Delay after an RCC peripheral clock enabling */ \
  694. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_USB2OTGHSULPIEN);\
  695. UNUSED(tmpreg); \
  696. } while(0)
  697. #define __HAL_RCC_DMA1_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_DMA1EN))
  698. #define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_DMA2EN))
  699. #define __HAL_RCC_ADC12_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_ADC12EN))
  700. #define __HAL_RCC_ETH1MAC_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_ETH1MACEN))
  701. #define __HAL_RCC_ETH1TX_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_ETH1TXEN))
  702. #define __HAL_RCC_ETH1RX_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_ETH1RXEN))
  703. #define __HAL_RCC_USB1_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_USB1OTGHSEN))
  704. #define __HAL_RCC_USB1_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_USB1OTGHSULPIEN))
  705. #define __HAL_RCC_USB2_OTG_FS_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_USB2OTGHSEN))
  706. #define __HAL_RCC_USB2_OTG_FS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~ (RCC_AHB1ENR_USB2OTGHSULPIEN))
  707. /** @brief Enable or disable the AHB2 peripheral clock.
  708. * @note After reset, the peripheral clock (used for registers read/write access)
  709. * is disabled and the application software has to enable this clock before
  710. * using it.
  711. */
  712. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  713. __IO uint32_t tmpreg; \
  714. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  715. /* Delay after an RCC peripheral clock enabling */ \
  716. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  717. UNUSED(tmpreg); \
  718. } while(0)
  719. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  720. __IO uint32_t tmpreg; \
  721. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  722. /* Delay after an RCC peripheral clock enabling */ \
  723. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  724. UNUSED(tmpreg); \
  725. } while(0)
  726. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  727. __IO uint32_t tmpreg; \
  728. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  729. /* Delay after an RCC peripheral clock enabling */ \
  730. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  731. UNUSED(tmpreg); \
  732. } while(0)
  733. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  734. __IO uint32_t tmpreg; \
  735. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  736. /* Delay after an RCC peripheral clock enabling */ \
  737. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  738. UNUSED(tmpreg); \
  739. } while(0)
  740. #define __HAL_RCC_SDMMC2_CLK_ENABLE() do { \
  741. __IO uint32_t tmpreg; \
  742. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_SDMMC2EN);\
  743. /* Delay after an RCC peripheral clock enabling */ \
  744. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_SDMMC2EN);\
  745. UNUSED(tmpreg); \
  746. } while(0)
  747. #define __HAL_RCC_D2SRAM1_CLK_ENABLE() do { \
  748. __IO uint32_t tmpreg; \
  749. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_D2SRAM1EN);\
  750. /* Delay after an RCC peripheral clock enabling */ \
  751. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_D2SRAM1EN);\
  752. UNUSED(tmpreg); \
  753. } while(0)
  754. #define __HAL_RCC_D2SRAM2_CLK_ENABLE() do { \
  755. __IO uint32_t tmpreg; \
  756. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_D2SRAM2EN);\
  757. /* Delay after an RCC peripheral clock enabling */ \
  758. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_D2SRAM2EN);\
  759. UNUSED(tmpreg); \
  760. } while(0)
  761. #define __HAL_RCC_D2SRAM3_CLK_ENABLE() do { \
  762. __IO uint32_t tmpreg; \
  763. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_D2SRAM3EN);\
  764. /* Delay after an RCC peripheral clock enabling */ \
  765. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_D2SRAM3EN);\
  766. UNUSED(tmpreg); \
  767. } while(0)
  768. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_DCMIEN))
  769. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_CRYPEN))
  770. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_HASHEN))
  771. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_RNGEN))
  772. #define __HAL_RCC_SDMMC2_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_SDMMC2EN))
  773. #define __HAL_RCC_D2SRAM1_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_D2SRAM1EN))
  774. #define __HAL_RCC_D2SRAM2_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_D2SRAM2EN))
  775. #define __HAL_RCC_D2SRAM3_CLK_DISABLE() (RCC->AHB2ENR &= ~ (RCC_AHB2ENR_D2SRAM3EN))
  776. /** @brief Enable or disable the AHB4 peripheral clock.
  777. * @note After reset, the peripheral clock (used for registers read/write access)
  778. * is disabled and the application software has to enable this clock before
  779. * using it.
  780. */
  781. #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
  782. __IO uint32_t tmpreg; \
  783. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOAEN);\
  784. /* Delay after an RCC peripheral clock enabling */ \
  785. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOAEN);\
  786. UNUSED(tmpreg); \
  787. } while(0)
  788. #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
  789. __IO uint32_t tmpreg; \
  790. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOBEN);\
  791. /* Delay after an RCC peripheral clock enabling */ \
  792. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOBEN);\
  793. UNUSED(tmpreg); \
  794. } while(0)
  795. #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
  796. __IO uint32_t tmpreg; \
  797. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOCEN);\
  798. /* Delay after an RCC peripheral clock enabling */ \
  799. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOCEN);\
  800. UNUSED(tmpreg); \
  801. } while(0)
  802. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  803. __IO uint32_t tmpreg; \
  804. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIODEN);\
  805. /* Delay after an RCC peripheral clock enabling */ \
  806. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIODEN);\
  807. UNUSED(tmpreg); \
  808. } while(0)
  809. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  810. __IO uint32_t tmpreg; \
  811. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOEEN);\
  812. /* Delay after an RCC peripheral clock enabling */ \
  813. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOEEN);\
  814. UNUSED(tmpreg); \
  815. } while(0)
  816. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  817. __IO uint32_t tmpreg; \
  818. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOFEN);\
  819. /* Delay after an RCC peripheral clock enabling */ \
  820. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOFEN);\
  821. UNUSED(tmpreg); \
  822. } while(0)
  823. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  824. __IO uint32_t tmpreg; \
  825. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOGEN);\
  826. /* Delay after an RCC peripheral clock enabling */ \
  827. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOGEN);\
  828. UNUSED(tmpreg); \
  829. } while(0)
  830. #define __HAL_RCC_GPIOH_CLK_ENABLE() do { \
  831. __IO uint32_t tmpreg; \
  832. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOHEN);\
  833. /* Delay after an RCC peripheral clock enabling */ \
  834. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOHEN);\
  835. UNUSED(tmpreg); \
  836. } while(0)
  837. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  838. __IO uint32_t tmpreg; \
  839. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOIEN);\
  840. /* Delay after an RCC peripheral clock enabling */ \
  841. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOIEN);\
  842. UNUSED(tmpreg); \
  843. } while(0)
  844. #define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \
  845. __IO uint32_t tmpreg; \
  846. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOJEN);\
  847. /* Delay after an RCC peripheral clock enabling */ \
  848. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOJEN);\
  849. UNUSED(tmpreg); \
  850. } while(0)
  851. #define __HAL_RCC_GPIOK_CLK_ENABLE() do { \
  852. __IO uint32_t tmpreg; \
  853. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOKEN);\
  854. /* Delay after an RCC peripheral clock enabling */ \
  855. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_GPIOKEN);\
  856. UNUSED(tmpreg); \
  857. } while(0)
  858. #define __HAL_RCC_CRC_CLK_ENABLE() do { \
  859. __IO uint32_t tmpreg; \
  860. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_CRCEN);\
  861. /* Delay after an RCC peripheral clock enabling */ \
  862. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_CRCEN);\
  863. UNUSED(tmpreg); \
  864. } while(0)
  865. #define __HAL_RCC_BDMA_CLK_ENABLE() do { \
  866. __IO uint32_t tmpreg; \
  867. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_BDMAEN);\
  868. /* Delay after an RCC peripheral clock enabling */ \
  869. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_BDMAEN);\
  870. UNUSED(tmpreg); \
  871. } while(0)
  872. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  873. __IO uint32_t tmpreg; \
  874. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_ADC3EN);\
  875. /* Delay after an RCC peripheral clock enabling */ \
  876. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_ADC3EN);\
  877. UNUSED(tmpreg); \
  878. } while(0)
  879. #define __HAL_RCC_HSEM_CLK_ENABLE() do { \
  880. __IO uint32_t tmpreg; \
  881. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_HSEMEN);\
  882. /* Delay after an RCC peripheral clock enabling */ \
  883. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_HSEMEN);\
  884. UNUSED(tmpreg); \
  885. } while(0)
  886. #define __HAL_RCC_BKPRAM_CLK_ENABLE() do { \
  887. __IO uint32_t tmpreg; \
  888. SET_BIT(RCC->AHB4ENR, RCC_AHB4ENR_BKPRAMEN);\
  889. /* Delay after an RCC peripheral clock enabling */ \
  890. tmpreg = READ_BIT(RCC->AHB4ENR, RCC_AHB4ENR_BKPRAMEN);\
  891. UNUSED(tmpreg); \
  892. } while(0)
  893. #define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOAEN)
  894. #define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOBEN)
  895. #define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOCEN)
  896. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIODEN)
  897. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOEEN)
  898. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOFEN)
  899. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOGEN)
  900. #define __HAL_RCC_GPIOH_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOHEN)
  901. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOIEN)
  902. #define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOJEN)
  903. #define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_GPIOKEN)
  904. #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_CRCEN)
  905. #define __HAL_RCC_BDMA_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_BDMAEN)
  906. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_ADC3EN)
  907. #define __HAL_RCC_HSEM_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_HSEMEN)
  908. #define __HAL_RCC_BKPRAM_CLK_DISABLE() (RCC->AHB4ENR) &= ~ (RCC_AHB4ENR_BKPRAMEN)
  909. /** @brief Enable or disable the APB3 peripheral clock.
  910. * @note After reset, the peripheral clock (used for registers read/write access)
  911. * is disabled and the application software has to enable this clock before
  912. * using it.
  913. */
  914. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  915. __IO uint32_t tmpreg; \
  916. SET_BIT(RCC->APB3ENR, RCC_APB3ENR_LTDCEN);\
  917. /* Delay after an RCC peripheral clock enabling */ \
  918. tmpreg = READ_BIT(RCC->APB3ENR, RCC_APB3ENR_LTDCEN);\
  919. UNUSED(tmpreg); \
  920. } while(0)
  921. #define __HAL_RCC_WWDG1_CLK_ENABLE() do { \
  922. __IO uint32_t tmpreg; \
  923. SET_BIT(RCC->APB3ENR, RCC_APB3ENR_WWDG1EN);\
  924. /* Delay after an RCC peripheral clock enabling */ \
  925. tmpreg = READ_BIT(RCC->APB3ENR, RCC_APB3ENR_WWDG1EN);\
  926. UNUSED(tmpreg); \
  927. } while(0)
  928. #define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB3ENR) &= ~ (RCC_APB3ENR_LTDCEN)
  929. #define __HAL_RCC_WWDG1_CLK_DISABLE() (RCC->APB3ENR) &= ~ (RCC_APB3ENR_WWDG1EN)
  930. /** @brief Enable or disable the APB1 peripheral clock.
  931. * @note After reset, the peripheral clock (used for registers read/write access)
  932. * is disabled and the application software has to enable this clock before
  933. * using it.
  934. */
  935. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  936. __IO uint32_t tmpreg; \
  937. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM2EN);\
  938. /* Delay after an RCC peripheral clock enabling */ \
  939. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM2EN);\
  940. UNUSED(tmpreg); \
  941. } while(0)
  942. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  943. __IO uint32_t tmpreg; \
  944. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM3EN);\
  945. /* Delay after an RCC peripheral clock enabling */ \
  946. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM3EN);\
  947. UNUSED(tmpreg); \
  948. } while(0)
  949. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  950. __IO uint32_t tmpreg; \
  951. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM4EN);\
  952. /* Delay after an RCC peripheral clock enabling */ \
  953. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM4EN);\
  954. UNUSED(tmpreg); \
  955. } while(0)
  956. #define __HAL_RCC_TIM5_CLK_ENABLE() do { \
  957. __IO uint32_t tmpreg; \
  958. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM5EN);\
  959. /* Delay after an RCC peripheral clock enabling */ \
  960. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM5EN);\
  961. UNUSED(tmpreg); \
  962. } while(0)
  963. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  964. __IO uint32_t tmpreg; \
  965. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM6EN);\
  966. /* Delay after an RCC peripheral clock enabling */ \
  967. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM6EN);\
  968. UNUSED(tmpreg); \
  969. } while(0)
  970. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  971. __IO uint32_t tmpreg; \
  972. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM7EN);\
  973. /* Delay after an RCC peripheral clock enabling */ \
  974. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM7EN);\
  975. UNUSED(tmpreg); \
  976. } while(0)
  977. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  978. __IO uint32_t tmpreg; \
  979. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM12EN);\
  980. /* Delay after an RCC peripheral clock enabling */ \
  981. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM12EN);\
  982. UNUSED(tmpreg); \
  983. } while(0)
  984. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  985. __IO uint32_t tmpreg; \
  986. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM13EN);\
  987. /* Delay after an RCC peripheral clock enabling */ \
  988. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM13EN);\
  989. UNUSED(tmpreg); \
  990. } while(0)
  991. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  992. __IO uint32_t tmpreg; \
  993. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM14EN);\
  994. /* Delay after an RCC peripheral clock enabling */ \
  995. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_TIM14EN);\
  996. UNUSED(tmpreg); \
  997. } while(0)
  998. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  999. __IO uint32_t tmpreg; \
  1000. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_LPTIM1EN);\
  1001. /* Delay after an RCC peripheral clock enabling */ \
  1002. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_LPTIM1EN);\
  1003. UNUSED(tmpreg); \
  1004. } while(0)
  1005. #define __HAL_RCC_SPI2_CLK_ENABLE() do { \
  1006. __IO uint32_t tmpreg; \
  1007. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_SPI2EN);\
  1008. /* Delay after an RCC peripheral clock enabling */ \
  1009. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_SPI2EN);\
  1010. UNUSED(tmpreg); \
  1011. } while(0)
  1012. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  1013. __IO uint32_t tmpreg; \
  1014. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_SPI3EN);\
  1015. /* Delay after an RCC peripheral clock enabling */ \
  1016. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_SPI3EN);\
  1017. UNUSED(tmpreg); \
  1018. } while(0)
  1019. #define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \
  1020. __IO uint32_t tmpreg; \
  1021. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_SPDIFRXEN);\
  1022. /* Delay after an RCC peripheral clock enabling */ \
  1023. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_SPDIFRXEN);\
  1024. UNUSED(tmpreg); \
  1025. } while(0)
  1026. #define __HAL_RCC_USART2_CLK_ENABLE() do { \
  1027. __IO uint32_t tmpreg; \
  1028. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_USART2EN);\
  1029. /* Delay after an RCC peripheral clock enabling */ \
  1030. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_USART2EN);\
  1031. UNUSED(tmpreg); \
  1032. } while(0)
  1033. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  1034. __IO uint32_t tmpreg; \
  1035. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_USART3EN);\
  1036. /* Delay after an RCC peripheral clock enabling */ \
  1037. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_USART3EN);\
  1038. UNUSED(tmpreg); \
  1039. } while(0)
  1040. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  1041. __IO uint32_t tmpreg; \
  1042. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_UART4EN);\
  1043. /* Delay after an RCC peripheral clock enabling */ \
  1044. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_UART4EN);\
  1045. UNUSED(tmpreg); \
  1046. } while(0)
  1047. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  1048. __IO uint32_t tmpreg; \
  1049. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_UART5EN);\
  1050. /* Delay after an RCC peripheral clock enabling */ \
  1051. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_UART5EN);\
  1052. UNUSED(tmpreg); \
  1053. } while(0)
  1054. #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
  1055. __IO uint32_t tmpreg; \
  1056. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_I2C1EN);\
  1057. /* Delay after an RCC peripheral clock enabling */ \
  1058. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_I2C1EN);\
  1059. UNUSED(tmpreg); \
  1060. } while(0)
  1061. #define __HAL_RCC_I2C2_CLK_ENABLE() do { \
  1062. __IO uint32_t tmpreg; \
  1063. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_I2C2EN);\
  1064. /* Delay after an RCC peripheral clock enabling */ \
  1065. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_I2C2EN);\
  1066. UNUSED(tmpreg); \
  1067. } while(0)
  1068. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  1069. __IO uint32_t tmpreg; \
  1070. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_I2C3EN);\
  1071. /* Delay after an RCC peripheral clock enabling */ \
  1072. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_I2C3EN);\
  1073. UNUSED(tmpreg); \
  1074. } while(0)
  1075. #define __HAL_RCC_CEC_CLK_ENABLE() do { \
  1076. __IO uint32_t tmpreg; \
  1077. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_CECEN);\
  1078. /* Delay after an RCC peripheral clock enabling */ \
  1079. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_CECEN);\
  1080. UNUSED(tmpreg); \
  1081. } while(0)
  1082. #define __HAL_RCC_DAC12_CLK_ENABLE() do { \
  1083. __IO uint32_t tmpreg; \
  1084. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_DAC12EN);\
  1085. /* Delay after an RCC peripheral clock enabling */ \
  1086. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_DAC12EN);\
  1087. UNUSED(tmpreg); \
  1088. } while(0)
  1089. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  1090. __IO uint32_t tmpreg; \
  1091. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_UART7EN);\
  1092. /* Delay after an RCC peripheral clock enabling */ \
  1093. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_UART7EN);\
  1094. UNUSED(tmpreg); \
  1095. } while(0)
  1096. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  1097. __IO uint32_t tmpreg; \
  1098. SET_BIT(RCC->APB1LENR, RCC_APB1LENR_UART8EN);\
  1099. /* Delay after an RCC peripheral clock enabling */ \
  1100. tmpreg = READ_BIT(RCC->APB1LENR, RCC_APB1LENR_UART8EN);\
  1101. UNUSED(tmpreg); \
  1102. } while(0)
  1103. #define __HAL_RCC_CRS_CLK_ENABLE() do { \
  1104. __IO uint32_t tmpreg; \
  1105. SET_BIT(RCC->APB1HENR, RCC_APB1HENR_CRSEN);\
  1106. /* Delay after an RCC peripheral clock enabling */ \
  1107. tmpreg = READ_BIT(RCC->APB1HENR, RCC_APB1HENR_CRSEN);\
  1108. UNUSED(tmpreg); \
  1109. } while(0)
  1110. #define __HAL_RCC_SWPMI1_CLK_ENABLE() do { \
  1111. __IO uint32_t tmpreg; \
  1112. SET_BIT(RCC->APB1HENR, RCC_APB1HENR_SWPMIEN);\
  1113. /* Delay after an RCC peripheral clock enabling */ \
  1114. tmpreg = READ_BIT(RCC->APB1HENR, RCC_APB1HENR_SWPMIEN);\
  1115. UNUSED(tmpreg); \
  1116. } while(0)
  1117. #define __HAL_RCC_OPAMP_CLK_ENABLE() do { \
  1118. __IO uint32_t tmpreg; \
  1119. SET_BIT(RCC->APB1HENR, RCC_APB1HENR_OPAMPEN);\
  1120. /* Delay after an RCC peripheral clock enabling */ \
  1121. tmpreg = READ_BIT(RCC->APB1HENR, RCC_APB1HENR_OPAMPEN);\
  1122. UNUSED(tmpreg); \
  1123. } while(0)
  1124. #define __HAL_RCC_MDIOS_CLK_ENABLE() do { \
  1125. __IO uint32_t tmpreg; \
  1126. SET_BIT(RCC->APB1HENR, RCC_APB1HENR_MDIOSEN);\
  1127. /* Delay after an RCC peripheral clock enabling */ \
  1128. tmpreg = READ_BIT(RCC->APB1HENR, RCC_APB1HENR_MDIOSEN);\
  1129. UNUSED(tmpreg); \
  1130. } while(0)
  1131. #define __HAL_RCC_FDCAN_CLK_ENABLE() do { \
  1132. __IO uint32_t tmpreg; \
  1133. SET_BIT(RCC->APB1HENR, RCC_APB1HENR_FDCANEN);\
  1134. /* Delay after an RCC peripheral clock enabling */ \
  1135. tmpreg = READ_BIT(RCC->APB1HENR, RCC_APB1HENR_FDCANEN);\
  1136. UNUSED(tmpreg); \
  1137. } while(0)
  1138. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM2EN)
  1139. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM3EN)
  1140. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM4EN)
  1141. #define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM5EN)
  1142. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM6EN)
  1143. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM7EN)
  1144. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM12EN)
  1145. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM13EN)
  1146. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_TIM14EN)
  1147. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_LPTIM1EN)
  1148. #define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_SPI2EN)
  1149. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_SPI3EN)
  1150. #define __HAL_RCC_SPDIFRX_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_SPDIFRXEN)
  1151. #define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_USART2EN)
  1152. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_USART3EN)
  1153. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_UART4EN)
  1154. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_UART5EN)
  1155. #define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_I2C1EN)
  1156. #define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_I2C2EN)
  1157. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_I2C3EN)
  1158. #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_CECEN)
  1159. #define __HAL_RCC_DAC12_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_DAC12EN)
  1160. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_UART7EN)
  1161. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1LENR) &= ~ (RCC_APB1LENR_UART8EN)
  1162. #define __HAL_RCC_CRS_CLK_DISABLE() (RCC->APB1HENR) &= ~ (RCC_APB1HENR_CRSEN)
  1163. #define __HAL_RCC_SWPMI1_CLK_DISABLE() (RCC->APB1HENR) &= ~ (RCC_APB1HENR_SWPMIEN)
  1164. #define __HAL_RCC_OPAMP_CLK_DISABLE() (RCC->APB1HENR) &= ~ (RCC_APB1HENR_OPAMPEN)
  1165. #define __HAL_RCC_MDIOS_CLK_DISABLE() (RCC->APB1HENR) &= ~ (RCC_APB1HENR_MDIOSEN)
  1166. #define __HAL_RCC_FDCAN_CLK_DISABLE() (RCC->APB1HENR) &= ~ (RCC_APB1HENR_FDCANEN)
  1167. /** @brief Enable or disable the APB2 peripheral clock.
  1168. * @note After reset, the peripheral clock (used for registers read/write access)
  1169. * is disabled and the application software has to enable this clock before
  1170. * using it.
  1171. */
  1172. #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
  1173. __IO uint32_t tmpreg; \
  1174. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  1175. /* Delay after an RCC peripheral clock enabling */ \
  1176. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  1177. UNUSED(tmpreg); \
  1178. } while(0)
  1179. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  1180. __IO uint32_t tmpreg; \
  1181. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1182. /* Delay after an RCC peripheral clock enabling */ \
  1183. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  1184. UNUSED(tmpreg); \
  1185. } while(0)
  1186. #define __HAL_RCC_USART1_CLK_ENABLE() do { \
  1187. __IO uint32_t tmpreg; \
  1188. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  1189. /* Delay after an RCC peripheral clock enabling */ \
  1190. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  1191. UNUSED(tmpreg); \
  1192. } while(0)
  1193. #define __HAL_RCC_USART6_CLK_ENABLE() do { \
  1194. __IO uint32_t tmpreg; \
  1195. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  1196. /* Delay after an RCC peripheral clock enabling */ \
  1197. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  1198. UNUSED(tmpreg); \
  1199. } while(0)
  1200. #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
  1201. __IO uint32_t tmpreg; \
  1202. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  1203. /* Delay after an RCC peripheral clock enabling */ \
  1204. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  1205. UNUSED(tmpreg); \
  1206. } while(0)
  1207. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  1208. __IO uint32_t tmpreg; \
  1209. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1210. /* Delay after an RCC peripheral clock enabling */ \
  1211. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  1212. UNUSED(tmpreg); \
  1213. } while(0)
  1214. #define __HAL_RCC_TIM15_CLK_ENABLE() do { \
  1215. __IO uint32_t tmpreg; \
  1216. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\
  1217. /* Delay after an RCC peripheral clock enabling */ \
  1218. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM15EN);\
  1219. UNUSED(tmpreg); \
  1220. } while(0)
  1221. #define __HAL_RCC_TIM16_CLK_ENABLE() do { \
  1222. __IO uint32_t tmpreg; \
  1223. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\
  1224. /* Delay after an RCC peripheral clock enabling */ \
  1225. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\
  1226. UNUSED(tmpreg); \
  1227. } while(0)
  1228. #define __HAL_RCC_TIM17_CLK_ENABLE() do { \
  1229. __IO uint32_t tmpreg; \
  1230. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\
  1231. /* Delay after an RCC peripheral clock enabling */ \
  1232. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\
  1233. UNUSED(tmpreg); \
  1234. } while(0)
  1235. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  1236. __IO uint32_t tmpreg; \
  1237. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1238. /* Delay after an RCC peripheral clock enabling */ \
  1239. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  1240. UNUSED(tmpreg); \
  1241. } while(0)
  1242. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1243. __IO uint32_t tmpreg; \
  1244. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1245. /* Delay after an RCC peripheral clock enabling */ \
  1246. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1247. UNUSED(tmpreg); \
  1248. } while(0)
  1249. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  1250. __IO uint32_t tmpreg; \
  1251. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1252. /* Delay after an RCC peripheral clock enabling */ \
  1253. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1254. UNUSED(tmpreg); \
  1255. } while(0)
  1256. #define __HAL_RCC_SAI3_CLK_ENABLE() do { \
  1257. __IO uint32_t tmpreg; \
  1258. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI3EN);\
  1259. /* Delay after an RCC peripheral clock enabling */ \
  1260. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI3EN);\
  1261. UNUSED(tmpreg); \
  1262. } while(0)
  1263. #define __HAL_RCC_DFSDM1_CLK_ENABLE() do { \
  1264. __IO uint32_t tmpreg; \
  1265. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  1266. /* Delay after an RCC peripheral clock enabling */ \
  1267. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DFSDM1EN);\
  1268. UNUSED(tmpreg); \
  1269. } while(0)
  1270. #define __HAL_RCC_HRTIM1_CLK_ENABLE() do { \
  1271. __IO uint32_t tmpreg; \
  1272. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_HRTIMEN);\
  1273. /* Delay after an RCC peripheral clock enabling */ \
  1274. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_HRTIMEN);\
  1275. UNUSED(tmpreg); \
  1276. } while(0)
  1277. #define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_TIM1EN)
  1278. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_TIM8EN)
  1279. #define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_USART1EN)
  1280. #define __HAL_RCC_USART6_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_USART6EN)
  1281. #define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_SPI1EN)
  1282. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_SPI4EN)
  1283. #define __HAL_RCC_TIM15_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_TIM15EN)
  1284. #define __HAL_RCC_TIM16_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_TIM16EN)
  1285. #define __HAL_RCC_TIM17_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_TIM17EN)
  1286. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_SPI5EN)
  1287. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_SAI1EN)
  1288. #define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_SAI2EN)
  1289. #define __HAL_RCC_SAI3_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_SAI3EN)
  1290. #define __HAL_RCC_DFSDM1_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_DFSDM1EN)
  1291. #define __HAL_RCC_HRTIM1_CLK_DISABLE() (RCC->APB2ENR) &= ~ (RCC_APB2ENR_HRTIMEN)
  1292. /** @brief Enable or disable the APB4 peripheral clock.
  1293. * @note After reset, the peripheral clock (used for registers read/write access)
  1294. * is disabled and the application software has to enable this clock before
  1295. * using it.
  1296. */
  1297. #define __HAL_RCC_SYSCFG_CLK_ENABLE() do { \
  1298. __IO uint32_t tmpreg; \
  1299. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_SYSCFGEN);\
  1300. /* Delay after an RCC peripheral clock enabling */ \
  1301. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_SYSCFGEN);\
  1302. UNUSED(tmpreg); \
  1303. } while(0)
  1304. #define __HAL_RCC_LPUART1_CLK_ENABLE() do { \
  1305. __IO uint32_t tmpreg; \
  1306. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_LPUART1EN);\
  1307. /* Delay after an RCC peripheral clock enabling */ \
  1308. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_LPUART1EN);\
  1309. UNUSED(tmpreg); \
  1310. } while(0)
  1311. #define __HAL_RCC_SPI6_CLK_ENABLE() do { \
  1312. __IO uint32_t tmpreg; \
  1313. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_SPI6EN);\
  1314. /* Delay after an RCC peripheral clock enabling */ \
  1315. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_SPI6EN);\
  1316. UNUSED(tmpreg); \
  1317. } while(0)
  1318. #define __HAL_RCC_I2C4_CLK_ENABLE() do { \
  1319. __IO uint32_t tmpreg; \
  1320. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_I2C4EN);\
  1321. /* Delay after an RCC peripheral clock enabling */ \
  1322. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_I2C4EN);\
  1323. UNUSED(tmpreg); \
  1324. } while(0)
  1325. #define __HAL_RCC_LPTIM2_CLK_ENABLE() do { \
  1326. __IO uint32_t tmpreg; \
  1327. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM2EN);\
  1328. /* Delay after an RCC peripheral clock enabling */ \
  1329. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM2EN);\
  1330. UNUSED(tmpreg); \
  1331. } while(0)
  1332. #define __HAL_RCC_LPTIM3_CLK_ENABLE() do { \
  1333. __IO uint32_t tmpreg; \
  1334. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM3EN);\
  1335. /* Delay after an RCC peripheral clock enabling */ \
  1336. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM3EN);\
  1337. UNUSED(tmpreg); \
  1338. } while(0)
  1339. #define __HAL_RCC_LPTIM4_CLK_ENABLE() do { \
  1340. __IO uint32_t tmpreg; \
  1341. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM4EN);\
  1342. /* Delay after an RCC peripheral clock enabling */ \
  1343. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM4EN);\
  1344. UNUSED(tmpreg); \
  1345. } while(0)
  1346. #define __HAL_RCC_LPTIM5_CLK_ENABLE() do { \
  1347. __IO uint32_t tmpreg; \
  1348. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM5EN);\
  1349. /* Delay after an RCC peripheral clock enabling */ \
  1350. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_LPTIM5EN);\
  1351. UNUSED(tmpreg); \
  1352. } while(0)
  1353. #define __HAL_RCC_COMP12_CLK_ENABLE() do { \
  1354. __IO uint32_t tmpreg; \
  1355. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_COMP12EN);\
  1356. /* Delay after an RCC peripheral clock enabling */ \
  1357. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_COMP12EN);\
  1358. UNUSED(tmpreg); \
  1359. } while(0)
  1360. #define __HAL_RCC_VREF_CLK_ENABLE() do { \
  1361. __IO uint32_t tmpreg; \
  1362. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_VREFEN);\
  1363. /* Delay after an RCC peripheral clock enabling */ \
  1364. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_VREFEN);\
  1365. UNUSED(tmpreg); \
  1366. } while(0)
  1367. #define __HAL_RCC_SAI4_CLK_ENABLE() do { \
  1368. __IO uint32_t tmpreg; \
  1369. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_SAI4EN);\
  1370. /* Delay after an RCC peripheral clock enabling */ \
  1371. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_SAI4EN);\
  1372. UNUSED(tmpreg); \
  1373. } while(0)
  1374. #define __HAL_RCC_RTC_CLK_ENABLE() do { \
  1375. __IO uint32_t tmpreg; \
  1376. SET_BIT(RCC->APB4ENR, RCC_APB4ENR_RTCAPBEN);\
  1377. /* Delay after an RCC peripheral clock enabling */ \
  1378. tmpreg = READ_BIT(RCC->APB4ENR, RCC_APB4ENR_RTCAPBEN);\
  1379. UNUSED(tmpreg); \
  1380. } while(0)
  1381. #define __HAL_RCC_SYSCFG_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_SYSCFGEN)
  1382. #define __HAL_RCC_LPUART1_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_LPUART1EN)
  1383. #define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_SPI6EN)
  1384. #define __HAL_RCC_I2C4_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_I2C4EN)
  1385. #define __HAL_RCC_LPTIM2_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_LPTIM2EN)
  1386. #define __HAL_RCC_LPTIM3_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_LPTIM3EN)
  1387. #define __HAL_RCC_LPTIM4_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_LPTIM4EN)
  1388. #define __HAL_RCC_LPTIM5_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_LPTIM5EN)
  1389. #define __HAL_RCC_COMP12_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_COMP12EN)
  1390. #define __HAL_RCC_VREF_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_VREFEN)
  1391. #define __HAL_RCC_RTC_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_RTCAPBEN)
  1392. #define __HAL_RCC_SAI4_CLK_DISABLE() (RCC->APB4ENR) &= ~ (RCC_APB4ENR_SAI4EN)
  1393. /** @brief Enable or disable the AHB3 peripheral reset.
  1394. */
  1395. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFF)
  1396. #define __HAL_RCC_MDMA_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_MDMARST))
  1397. #define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_DMA2DRST))
  1398. #define __HAL_RCC_JPGDECRST_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_JPGDECRST))
  1399. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  1400. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  1401. #define __HAL_RCC_SDMMC1_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_SDMMC1RST))
  1402. #define __HAL_RCC_CPU_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_CPURST))
  1403. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00)
  1404. #define __HAL_RCC_MDMA_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_MDMARST))
  1405. #define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_DMA2DRST))
  1406. #define __HAL_RCC_JPGDECRST_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_JPGDECRST))
  1407. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_FMCRST))
  1408. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_QSPIRST))
  1409. #define __HAL_RCC_SDMMC1_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_SDMMC1RST))
  1410. #define __HAL_RCC_CPU_RELEASE_RESET() (RCC->AHB3RSTR &= ~ (RCC_AHB3RSTR_CPURST))
  1411. /** @brief Force or release the AHB1 peripheral reset.
  1412. */
  1413. #define __HAL_RCC_AHB1_FORCE_RESET() (RCC->AHB1RSTR = 0xFFFFFFFF)
  1414. #define __HAL_RCC_DMA1_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA1RST))
  1415. #define __HAL_RCC_DMA2_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2RST))
  1416. #define __HAL_RCC_ADC12_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ADC12RST))
  1417. #define __HAL_RCC_ETH1MAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETH1MACRST))
  1418. #define __HAL_RCC_USB1_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_USB1OTGHSRST))
  1419. #define __HAL_RCC_USB2_OTG_FS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_USB2OTGHSRST))
  1420. #define __HAL_RCC_AHB1_RELEASE_RESET() (RCC->AHB1RSTR = 0x00)
  1421. #define __HAL_RCC_DMA1_RELEASE_RESET() (RCC->AHB1RSTR &= ~ (RCC_AHB1RSTR_DMA1RST))
  1422. #define __HAL_RCC_DMA2_RELEASE_RESET() (RCC->AHB1RSTR &= ~ (RCC_AHB1RSTR_DMA2RST))
  1423. #define __HAL_RCC_ADC12_RELEASE_RESET() (RCC->AHB1RSTR &= ~ (RCC_AHB1RSTR_ADC12RST))
  1424. #define __HAL_RCC_ETH1MAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~ (RCC_AHB1RSTR_ETH1MACRST))
  1425. #define __HAL_RCC_USB1_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~ (RCC_AHB1RSTR_USB1OTGHSRST))
  1426. #define __HAL_RCC_USB2_OTG_FS_RELEASE_RESET() (RCC->AHB1RSTR &= ~ (RCC_AHB1RSTR_USB2OTGHSRST))
  1427. /** @brief Force or release the AHB2 peripheral reset.
  1428. */
  1429. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFF)
  1430. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  1431. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  1432. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  1433. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  1434. #define __HAL_RCC_SDMMC2_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_SDMMC2RST))
  1435. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00)
  1436. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~ (RCC_AHB2RSTR_DCMIRST))
  1437. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~ (RCC_AHB2RSTR_CRYPRST))
  1438. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~ (RCC_AHB2RSTR_HASHRST))
  1439. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~ (RCC_AHB2RSTR_RNGRST))
  1440. #define __HAL_RCC_SDMMC2_RELEASE_RESET() (RCC->AHB2RSTR &= ~ (RCC_AHB2RSTR_SDMMC2RST))
  1441. /** @brief Force or release the AHB4 peripheral reset.
  1442. */
  1443. #define __HAL_RCC_AHB4_FORCE_RESET() (RCC->AHB4RSTR = 0xFFFFFFFF)
  1444. #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOARST)
  1445. #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOBRST)
  1446. #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOCRST)
  1447. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIODRST)
  1448. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOERST)
  1449. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOFRST)
  1450. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOGRST)
  1451. #define __HAL_RCC_GPIOH_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOHRST)
  1452. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOIRST)
  1453. #define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOJRST)
  1454. #define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_GPIOKRST)
  1455. #define __HAL_RCC_PWR_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_PWRRST)
  1456. #define __HAL_RCC_CRC_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_CRCRST)
  1457. #define __HAL_RCC_BDMA_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_BDMARST)
  1458. #define __HAL_RCC_ADC3_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_ADC3RST)
  1459. #define __HAL_RCC_HSEM_FORCE_RESET() (RCC->AHB4RSTR) |= (RCC_AHB4RSTR_HSEMRST)
  1460. #define __HAL_RCC_AHB4_RELEASE_RESET() (RCC->AHB4RSTR = 0x00)
  1461. #define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOARST)
  1462. #define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOBRST)
  1463. #define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOCRST)
  1464. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIODRST)
  1465. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOERST)
  1466. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOFRST)
  1467. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOGRST)
  1468. #define __HAL_RCC_GPIOH_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOHRST)
  1469. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOIRST)
  1470. #define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOJRST)
  1471. #define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_GPIOKRST)
  1472. #define __HAL_RCC_PWR_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_PWRRST)
  1473. #define __HAL_RCC_CRC_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_CRCRST)
  1474. #define __HAL_RCC_BDMA_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_BDMARST)
  1475. #define __HAL_RCC_ADC3_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_ADC3RST)
  1476. #define __HAL_RCC_HSEM_RELEASE_RESET() (RCC->AHB4RSTR) &= ~ (RCC_AHB4RSTR_HSEMRST)
  1477. /** @brief Force or release the APB3 peripheral reset.
  1478. */
  1479. #define __HAL_RCC_APB3_FORCE_RESET() (RCC->APB3RSTR = 0xFFFFFFFF)
  1480. #define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB3RSTR) |= (RCC_APB3RSTR_LTDCRST)
  1481. #define __HAL_RCC_APB3_RELEASE_RESET() (RCC->APB3RSTR = 0x00)
  1482. #define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB3RSTR) &= ~ (RCC_APB3RSTR_LTDCRST)
  1483. /** @brief Force or release the APB1 peripheral reset.
  1484. */
  1485. #define __HAL_RCC_APB1L_FORCE_RESET() (RCC->APB1LRSTR = 0xFFFFFFFF)
  1486. #define __HAL_RCC_APB1H_FORCE_RESET() (RCC->APB1HRSTR = 0xFFFFFFFF)
  1487. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM2RST)
  1488. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM3RST)
  1489. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM4RST)
  1490. #define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM5RST)
  1491. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM6RST)
  1492. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM7RST)
  1493. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM12RST)
  1494. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM13RST)
  1495. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_TIM14RST)
  1496. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_LPTIM1RST)
  1497. #define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_SPI2RST)
  1498. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_SPI3RST)
  1499. #define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_SPDIFRXRST)
  1500. #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_USART2RST)
  1501. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_USART3RST)
  1502. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_UART4RST)
  1503. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_UART5RST)
  1504. #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_I2C1RST)
  1505. #define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_I2C2RST)
  1506. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_I2C3RST)
  1507. #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_CECRST)
  1508. #define __HAL_RCC_DAC12_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_DAC12RST)
  1509. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_UART7RST)
  1510. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1LRSTR) |= (RCC_APB1LRSTR_UART8RST)
  1511. #define __HAL_RCC_CRS_FORCE_RESET() (RCC->APB1HRSTR) |= (RCC_APB1HRSTR_CRSRST)
  1512. #define __HAL_RCC_SWPMI1_FORCE_RESET() (RCC->APB1HRSTR) |= (RCC_APB1HRSTR_SWPMIRST)
  1513. #define __HAL_RCC_OPAMP_FORCE_RESET() (RCC->APB1HRSTR) |= (RCC_APB1HRSTR_OPAMPRST)
  1514. #define __HAL_RCC_MDIOS_FORCE_RESET() (RCC->APB1HRSTR) |= (RCC_APB1HRSTR_MDIOSRST)
  1515. #define __HAL_RCC_FDCAN_FORCE_RESET() (RCC->APB1HRSTR) |= (RCC_APB1HRSTR_FDCANRST)
  1516. #define __HAL_RCC_APB1L_RELEASE_RESET() (RCC->APB1LRSTR = 0x00)
  1517. #define __HAL_RCC_APB1H_RELEASE_RESET() (RCC->APB1HRSTR = 0x00)
  1518. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM2RST)
  1519. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM3RST)
  1520. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM4RST)
  1521. #define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM5RST)
  1522. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM6RST)
  1523. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM7RST)
  1524. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM12RST)
  1525. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM13RST)
  1526. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_TIM14RST)
  1527. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_LPTIM1RST)
  1528. #define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_SPI2RST)
  1529. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_SPI3RST)
  1530. #define __HAL_RCC_SPDIFRX_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_SPDIFRXRST)
  1531. #define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_USART2RST)
  1532. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_USART3RST)
  1533. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_UART4RST)
  1534. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_UART5RST)
  1535. #define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_I2C1RST)
  1536. #define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_I2C2RST)
  1537. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_I2C3RST)
  1538. #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_CECRST)
  1539. #define __HAL_RCC_DAC12_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_DAC12RST)
  1540. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_UART7RST)
  1541. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1LRSTR) &= ~ (RCC_APB1LRSTR_UART8RST)
  1542. #define __HAL_RCC_CRS_RELEASE_RESET() (RCC->APB1HRSTR) &= ~ (RCC_APB1HRSTR_CRSRST)
  1543. #define __HAL_RCC_SWPMI1_RELEASE_RESET() (RCC->APB1HRSTR) &= ~ (RCC_APB1HRSTR_SWPMIRST)
  1544. #define __HAL_RCC_OPAMP_RELEASE_RESET() (RCC->APB1HRSTR) &= ~ (RCC_APB1HRSTR_OPAMPRST)
  1545. #define __HAL_RCC_MDIOS_RELEASE_RESET() (RCC->APB1HRSTR) &= ~ (RCC_APB1HRSTR_MDIOSRST)
  1546. #define __HAL_RCC_FDCAN_RELEASE_RESET() (RCC->APB1HRSTR) &= ~ (RCC_APB1HRSTR_FDCANRST)
  1547. /** @brief Force or release the APB2 peripheral reset.
  1548. */
  1549. #define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFF)
  1550. #define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_TIM1RST)
  1551. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_TIM8RST)
  1552. #define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_USART1RST)
  1553. #define __HAL_RCC_USART6_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_USART6RST)
  1554. #define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_SPI1RST)
  1555. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_SPI4RST)
  1556. #define __HAL_RCC_TIM15_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_TIM15RST)
  1557. #define __HAL_RCC_TIM16_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_TIM16RST)
  1558. #define __HAL_RCC_TIM17_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_TIM17RST)
  1559. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_SPI5RST)
  1560. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_SAI1RST)
  1561. #define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_SAI2RST)
  1562. #define __HAL_RCC_SAI3_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_SAI3RST)
  1563. #define __HAL_RCC_DFSDM1_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_DFSDM1RST)
  1564. #define __HAL_RCC_HRTIM1_FORCE_RESET() (RCC->APB2RSTR) |= (RCC_APB2RSTR_HRTIMRST)
  1565. #define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00)
  1566. #define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_TIM1RST)
  1567. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_TIM8RST)
  1568. #define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_USART1RST)
  1569. #define __HAL_RCC_USART6_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_USART6RST)
  1570. #define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_SPI1RST)
  1571. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_SPI4RST)
  1572. #define __HAL_RCC_TIM15_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_TIM15RST)
  1573. #define __HAL_RCC_TIM16_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_TIM16RST)
  1574. #define __HAL_RCC_TIM17_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_TIM17RST)
  1575. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_SPI5RST)
  1576. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_SAI1RST)
  1577. #define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_SAI2RST)
  1578. #define __HAL_RCC_SAI3_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_SAI3RST)
  1579. #define __HAL_RCC_DFSDM1_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_DFSDM1RST)
  1580. #define __HAL_RCC_HRTIM1_RELEASE_RESET() (RCC->APB2RSTR) &= ~ (RCC_APB2RSTR_HRTIMRST)
  1581. /** @brief Force or release the APB4 peripheral reset.
  1582. */
  1583. #define __HAL_RCC_APB4_FORCE_RESET() (RCC->APB4RSTR = 0xFFFFFFFF)
  1584. #define __HAL_RCC_SYSCFG_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_SYSCFGRST)
  1585. #define __HAL_RCC_LPUART1_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_LPUART1RST)
  1586. #define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_SPI6RST)
  1587. #define __HAL_RCC_I2C4_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_I2C4RST)
  1588. #define __HAL_RCC_LPTIM2_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_LPTIM2RST)
  1589. #define __HAL_RCC_LPTIM3_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_LPTIM3RST)
  1590. #define __HAL_RCC_LPTIM4_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_LPTIM4RST)
  1591. #define __HAL_RCC_LPTIM5_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_LPTIM5RST)
  1592. #define __HAL_RCC_COMP12_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_COMP12RST)
  1593. #define __HAL_RCC_VREF_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_VREFRST)
  1594. #define __HAL_RCC_SAI4_FORCE_RESET() (RCC->APB4RSTR) |= (RCC_APB4RSTR_SAI4RST)
  1595. #define __HAL_RCC_APB4_RELEASE_RESET() (RCC->APB4RSTR = 0x00)
  1596. #define __HAL_RCC_SYSCFG_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_SYSCFGRST)
  1597. #define __HAL_RCC_LPUART1_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_LPUART1RST)
  1598. #define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_SPI6RST)
  1599. #define __HAL_RCC_I2C4_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_I2C4RST)
  1600. #define __HAL_RCC_LPTIM2_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_LPTIM2RST)
  1601. #define __HAL_RCC_LPTIM3_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_LPTIM3RST)
  1602. #define __HAL_RCC_LPTIM4_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_LPTIM4RST)
  1603. #define __HAL_RCC_LPTIM5_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_LPTIM5RST)
  1604. #define __HAL_RCC_COMP12_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_COMP12RST)
  1605. #define __HAL_RCC_VREF_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_VREFRST)
  1606. #define __HAL_RCC_SAI4_RELEASE_RESET() (RCC->APB4RSTR) &= ~ (RCC_APB4RSTR_SAI4RST)
  1607. /** @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1608. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1609. * power consumption.
  1610. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1611. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1612. */
  1613. #define __HAL_RCC_MDMA_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_MDMALPEN))
  1614. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_DMA2DLPEN))
  1615. #define __HAL_RCC_JPGDEC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_JPGDECLPEN))
  1616. #define __HAL_RCC_FLASH_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FLASHLPEN))
  1617. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  1618. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  1619. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_SDMMC1LPEN))
  1620. #define __HAL_RCC_DTCM1_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_DTCM1LPEN))
  1621. #define __HAL_RCC_DTCM2_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_DTCM2LPEN))
  1622. #define __HAL_RCC_ITCM_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_ITCMLPEN))
  1623. #define __HAL_RCC_D1SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_AXISRAMLPEN))
  1624. #define __HAL_RCC_MDMA_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_MDMALPEN))
  1625. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_DMA2DLPEN))
  1626. #define __HAL_RCC_JPGDEC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_JPGDECLPEN))
  1627. #define __HAL_RCC_FLASH_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_FLASHLPEN))
  1628. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_FMCLPEN))
  1629. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_QSPILPEN))
  1630. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_SDMMC1LPEN))
  1631. #define __HAL_RCC_DTCM1_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_DTCM1LPEN))
  1632. #define __HAL_RCC_DTCM2_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_DTCM2LPEN))
  1633. #define __HAL_RCC_ITCM_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_ITCMLPEN))
  1634. #define __HAL_RCC_D1SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~ (RCC_AHB3LPENR_AXISRAMLPEN))
  1635. /** @brief ENABLE or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1636. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1637. * power consumption.
  1638. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1639. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1640. */
  1641. #define __HAL_RCC_DMA1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA1LPEN))
  1642. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2LPEN))
  1643. #define __HAL_RCC_ADC12_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ADC12LPEN))
  1644. #define __HAL_RCC_ETH1MAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETH1MACLPEN))
  1645. #define __HAL_RCC_ETH1TX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETH1TXLPEN))
  1646. #define __HAL_RCC_ETH1RX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETH1RXLPEN))
  1647. #define __HAL_RCC_ETH1PTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETH1PTPLPEN))
  1648. #define __HAL_RCC_USB1_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_USB1OTGHSLPEN))
  1649. #define __HAL_RCC_USB1_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_USB1OTGHSULPILPEN))
  1650. #define __HAL_RCC_USB2_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_USB2OTGHSLPEN))
  1651. #define __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_USB2OTGHSULPILPEN))
  1652. #define __HAL_RCC_DMA1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_DMA1LPEN))
  1653. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_DMA2LPEN))
  1654. #define __HAL_RCC_ADC12_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_ADC12LPEN))
  1655. #define __HAL_RCC_ETH1MAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_ETH1MACLPEN))
  1656. #define __HAL_RCC_ETH1TX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_ETH1TXLPEN))
  1657. #define __HAL_RCC_ETH1RX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_ETH1RXLPEN))
  1658. #define __HAL_RCC_ETH1PTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_ETH1PTPLPEN))
  1659. #define __HAL_RCC_USB1_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_USB1OTGHSLPEN))
  1660. #define __HAL_RCC_USB1_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_USB1OTGHSULPILPEN))
  1661. #define __HAL_RCC_USB2_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_USB2OTGHSLPEN))
  1662. #define __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~ (RCC_AHB1LPENR_USB2OTGHSULPILPEN))
  1663. /** @brief ENABLE or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1664. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1665. * power consumption.
  1666. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1667. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1668. */
  1669. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  1670. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  1671. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  1672. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  1673. #define __HAL_RCC_SDMMC2_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_SDMMC2LPEN))
  1674. #define __HAL_RCC_D2SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_D2SRAM1LPEN))
  1675. #define __HAL_RCC_D2SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_D2SRAM2LPEN))
  1676. #define __HAL_RCC_D2SRAM3_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_D2SRAM3LPEN))
  1677. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_DCMILPEN))
  1678. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_CRYPLPEN))
  1679. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_HASHLPEN))
  1680. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_RNGLPEN))
  1681. #define __HAL_RCC_SDMMC2_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_SDMMC2LPEN))
  1682. #define __HAL_RCC_D2SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_D2SRAM1LPEN))
  1683. #define __HAL_RCC_D2SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_D2SRAM2LPEN))
  1684. #define __HAL_RCC_D2SRAM3_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~ (RCC_AHB2LPENR_D2SRAM3LPEN))
  1685. /** @brief ENABLE or disable the AHB4 peripheral clock during Low Power (Sleep) mode.
  1686. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1687. * power consumption.
  1688. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1689. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1690. */
  1691. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOALPEN)
  1692. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOBLPEN)
  1693. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOCLPEN)
  1694. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIODLPEN)
  1695. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOELPEN)
  1696. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOFLPEN)
  1697. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOGLPEN)
  1698. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOHLPEN)
  1699. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOILPEN)
  1700. #define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOJLPEN)
  1701. #define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_GPIOKLPEN)
  1702. #define __HAL_RCC_PWR_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_PWRLPEN)
  1703. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_CRCLPEN)
  1704. #define __HAL_RCC_BDMA_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_BDMALPEN)
  1705. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_ADC3LPEN)
  1706. #define __HAL_RCC_BKPRAM_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR) |= (RCC_AHB4LPENR_BKPRAMLPEN)
  1707. #define __HAL_RCC_D3SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB4LPENR |= (RCC_AHB4LPENR_D3SRAM1LPEN))
  1708. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOALPEN)
  1709. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOBLPEN)
  1710. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOCLPEN)
  1711. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIODLPEN)
  1712. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOELPEN)
  1713. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOFLPEN)
  1714. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOGLPEN)
  1715. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOHLPEN)
  1716. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOILPEN)
  1717. #define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOJLPEN)
  1718. #define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_GPIOKLPEN)
  1719. #define __HAL_RCC_PWR_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_PWRLPEN)
  1720. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_CRCLPEN)
  1721. #define __HAL_RCC_BDMA_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_BDMALPEN)
  1722. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_ADC3LPEN)
  1723. #define __HAL_RCC_BKPRAM_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR) &= ~ (RCC_AHB4LPENR_BKPRAMLPEN)
  1724. #define __HAL_RCC_D3SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB4LPENR &= ~ (RCC_AHB4LPENR_D3SRAM1LPEN))
  1725. /** @brief ENABLE or disable the APB3 peripheral clock during Low Power (Sleep) mode.
  1726. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1727. * power consumption.
  1728. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1729. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1730. */
  1731. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB3LPENR) |= (RCC_APB3LPENR_LTDCLPEN)
  1732. #define __HAL_RCC_WWDG1_CLK_SLEEP_ENABLE() (RCC->APB3LPENR) |= (RCC_APB3LPENR_WWDG1LPEN)
  1733. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB3LPENR) &= ~ (RCC_APB3LPENR_LTDCLPEN)
  1734. #define __HAL_RCC_WWDG1_CLK_SLEEP_DISABLE() (RCC->APB3LPENR) &= ~ (RCC_APB3LPENR_WWDG1LPEN)
  1735. /** @brief ENABLE or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1736. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1737. * power consumption.
  1738. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1739. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1740. */
  1741. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM2LPEN)
  1742. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM3LPEN)
  1743. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM4LPEN)
  1744. #define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM5LPEN)
  1745. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM6LPEN)
  1746. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM7LPEN)
  1747. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM12LPEN)
  1748. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM13LPEN)
  1749. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_TIM14LPEN)
  1750. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_LPTIM1LPEN)
  1751. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_SPI2LPEN)
  1752. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_SPI3LPEN)
  1753. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_SPDIFRXLPEN)
  1754. #define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_USART2LPEN)
  1755. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_USART3LPEN)
  1756. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_UART4LPEN)
  1757. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_UART5LPEN)
  1758. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_I2C1LPEN)
  1759. #define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_I2C2LPEN)
  1760. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_I2C3LPEN)
  1761. #define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_CECLPEN)
  1762. #define __HAL_RCC_DAC12_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_DAC12LPEN)
  1763. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_UART7LPEN)
  1764. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LLPENR) |= (RCC_APB1LLPENR_UART8LPEN)
  1765. #define __HAL_RCC_CRS_CLK_SLEEP_ENABLE() (RCC->APB1HLPENR) |= (RCC_APB1HLPENR_CRSLPEN)
  1766. #define __HAL_RCC_SWPMI1_CLK_SLEEP_ENABLE() (RCC->APB1HLPENR) |= (RCC_APB1HLPENR_SWPMILPEN)
  1767. #define __HAL_RCC_OPAMP_CLK_SLEEP_ENABLE() (RCC->APB1HLPENR) |= (RCC_APB1HLPENR_OPAMPLPEN)
  1768. #define __HAL_RCC_MDIOS_CLK_SLEEP_ENABLE() (RCC->APB1HLPENR) |= (RCC_APB1HLPENR_MDIOSLPEN)
  1769. #define __HAL_RCC_FDCAN_CLK_SLEEP_ENABLE() (RCC->APB1HLPENR) |= (RCC_APB1HLPENR_FDCANLPEN)
  1770. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM2LPEN)
  1771. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM3LPEN)
  1772. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM4LPEN)
  1773. #define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM5LPEN)
  1774. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM6LPEN)
  1775. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM7LPEN)
  1776. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM12LPEN)
  1777. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM13LPEN)
  1778. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_TIM14LPEN)
  1779. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_LPTIM1LPEN)
  1780. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_SPI2LPEN)
  1781. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_SPI3LPEN)
  1782. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_SPDIFRXLPEN)
  1783. #define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_USART2LPEN)
  1784. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_USART3LPEN)
  1785. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_UART4LPEN)
  1786. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_UART5LPEN)
  1787. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_I2C1LPEN)
  1788. #define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_I2C2LPEN)
  1789. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_I2C3LPEN)
  1790. #define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_CECLPEN)
  1791. #define __HAL_RCC_DAC12_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_DAC12LPEN)
  1792. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_UART7LPEN)
  1793. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LLPENR) &= ~ (RCC_APB1LLPENR_UART8LPEN)
  1794. #define __HAL_RCC_CRS_CLK_SLEEP_DISABLE() (RCC->APB1HLPENR) &= ~ (RCC_APB1HLPENR_CRSLPEN)
  1795. #define __HAL_RCC_SWPMI1_CLK_SLEEP_DISABLE() (RCC->APB1HLPENR) &= ~ (RCC_APB1HLPENR_SWPMILPEN)
  1796. #define __HAL_RCC_OPAMP_CLK_SLEEP_DISABLE() (RCC->APB1HLPENR) &= ~ (RCC_APB1HLPENR_OPAMPLPEN)
  1797. #define __HAL_RCC_MDIOS_CLK_SLEEP_DISABLE() (RCC->APB1HLPENR) &= ~ (RCC_APB1HLPENR_MDIOSLPEN)
  1798. #define __HAL_RCC_FDCAN_CLK_SLEEP_DISABLE() (RCC->APB1HLPENR) &= ~ (RCC_APB1HLPENR_FDCANLPEN)
  1799. /** @brief ENABLE or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1800. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1801. * power consumption.
  1802. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1803. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1804. */
  1805. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_TIM1LPEN)
  1806. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_TIM8LPEN)
  1807. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_USART1LPEN)
  1808. #define __HAL_RCC_USART6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_USART6LPEN)
  1809. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_SPI1LPEN)
  1810. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_SPI4LPEN)
  1811. #define __HAL_RCC_TIM15_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_TIM15LPEN)
  1812. #define __HAL_RCC_TIM16_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_TIM16LPEN)
  1813. #define __HAL_RCC_TIM17_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_TIM17LPEN)
  1814. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_SPI5LPEN)
  1815. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_SAI1LPEN)
  1816. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_SAI2LPEN)
  1817. #define __HAL_RCC_SAI3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_SAI3LPEN)
  1818. #define __HAL_RCC_DFSDM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_DFSDM1LPEN)
  1819. #define __HAL_RCC_HRTIM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR) |= (RCC_APB2LPENR_HRTIMLPEN)
  1820. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_TIM1LPEN)
  1821. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_TIM8LPEN)
  1822. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_USART1LPEN)
  1823. #define __HAL_RCC_USART6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_USART6LPEN)
  1824. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_SPI1LPEN)
  1825. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_SPI4LPEN)
  1826. #define __HAL_RCC_TIM15_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_TIM15LPEN)
  1827. #define __HAL_RCC_TIM16_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_TIM16LPEN)
  1828. #define __HAL_RCC_TIM17_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_TIM17LPEN)
  1829. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_SPI5LPEN)
  1830. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_SAI1LPEN)
  1831. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_SAI2LPEN)
  1832. #define __HAL_RCC_SAI3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_SAI3LPEN)
  1833. #define __HAL_RCC_DFSDM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_DFSDM1LPEN)
  1834. #define __HAL_RCC_HRTIM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR) &= ~ (RCC_APB2LPENR_HRTIMLPEN)
  1835. /** @brief ENABLE or disable the APB4 peripheral clock during Low Power (Sleep) mode.
  1836. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1837. * power consumption.
  1838. * @note After wakeup from SLEEP mode, the peripheral clock is ENABLEd again.
  1839. * @note By default, all peripheral clocks are ENABLEd during SLEEP mode.
  1840. */
  1841. #define __HAL_RCC_SYSCFG_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_SYSCFGLPEN)
  1842. #define __HAL_RCC_LPUART1_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_LPUART1LPEN)
  1843. #define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_SPI6LPEN)
  1844. #define __HAL_RCC_I2C4_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_I2C4LPEN)
  1845. #define __HAL_RCC_LPTIM2_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_LPTIM2LPEN)
  1846. #define __HAL_RCC_LPTIM3_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_LPTIM3LPEN)
  1847. #define __HAL_RCC_LPTIM4_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_LPTIM4LPEN)
  1848. #define __HAL_RCC_LPTIM5_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_LPTIM5LPEN)
  1849. #define __HAL_RCC_COMP12_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_COMP12LPEN)
  1850. #define __HAL_RCC_VREF_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_VREFLPEN)
  1851. #define __HAL_RCC_RTC_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_RTCAPBLPEN)
  1852. #define __HAL_RCC_SAI4_CLK_SLEEP_ENABLE() (RCC->APB4LPENR) |= (RCC_APB4LPENR_SAI4LPEN)
  1853. #define __HAL_RCC_SYSCFG_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_SYSCFGLPEN)
  1854. #define __HAL_RCC_LPUART1_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_LPUART1LPEN)
  1855. #define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_SPI6LPEN)
  1856. #define __HAL_RCC_I2C4_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_I2C4LPEN)
  1857. #define __HAL_RCC_LPTIM2_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_LPTIM2LPEN)
  1858. #define __HAL_RCC_LPTIM3_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_LPTIM3LPEN)
  1859. #define __HAL_RCC_LPTIM4_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_LPTIM4LPEN)
  1860. #define __HAL_RCC_LPTIM5_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_LPTIM5LPEN)
  1861. #define __HAL_RCC_COMP12_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_COMP12LPEN)
  1862. #define __HAL_RCC_VREF_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_VREFLPEN)
  1863. #define __HAL_RCC_RTC_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_RTCAPBLPEN)
  1864. #define __HAL_RCC_SAI4_CLK_SLEEP_DISABLE() (RCC->APB4LPENR) &= ~ (RCC_APB4LPENR_SAI4LPEN)
  1865. /** @brief Enable or disable peripheral bus clock when D3 domain is in DRUN
  1866. * @note After reset, peripheral clock is disabled when CPU is in CSTOP
  1867. */
  1868. #define __HAL_RCC_BDMA_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_BDMAAMEN)
  1869. #define __HAL_RCC_LPUART1_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_LPUART1AMEN)
  1870. #define __HAL_RCC_SPI6_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_SPI6AMEN)
  1871. #define __HAL_RCC_I2C4_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_I2C4AMEN)
  1872. #define __HAL_RCC_LPTIM2_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_LPTIM2AMEN)
  1873. #define __HAL_RCC_LPTIM3_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_LPTIM3AMEN)
  1874. #define __HAL_RCC_LPTIM4_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_LPTIM4AMEN)
  1875. #define __HAL_RCC_LPTIM5_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_LPTIM5AMEN)
  1876. #define __HAL_RCC_COMP12_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_COMP12AMEN)
  1877. #define __HAL_RCC_VREF_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_VREFAMEN)
  1878. #define __HAL_RCC_RTC_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_RTCAMEN)
  1879. #define __HAL_RCC_CRC_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_CRCAMEN)
  1880. #define __HAL_RCC_SAI4_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_SAI4AMEN)
  1881. #define __HAL_RCC_ADC3_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_ADC3AMEN)
  1882. #define __HAL_RCC_BKPRAM_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_BKPRAMAMEN)
  1883. #define __HAL_RCC_D3SRAM1_CLKAM_ENABLE() (RCC->D3AMR) |= (RCC_D3AMR_SRAM4AMEN)
  1884. #define __HAL_RCC_BDMA_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_BDMAAMEN)
  1885. #define __HAL_RCC_LPUART1_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_LPUART1AMEN)
  1886. #define __HAL_RCC_SPI6_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_SPI6AMEN)
  1887. #define __HAL_RCC_I2C4_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_I2C4AMEN)
  1888. #define __HAL_RCC_LPTIM2_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_LPTIM2AMEN)
  1889. #define __HAL_RCC_LPTIM3_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_LPTIM3AMEN)
  1890. #define __HAL_RCC_LPTIM4_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_LPTIM4AMEN)
  1891. #define __HAL_RCC_LPTIM5_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_LPTIM5AMEN)
  1892. #define __HAL_RCC_COMP12_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_COMP12AMEN)
  1893. #define __HAL_RCC_VREF_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_VREFAMEN)
  1894. #define __HAL_RCC_RTC_CLKAM_DISABLE() (RCC->D3AMR) &= ~(RCC_D3AMR_RTCAMEN)
  1895. #define __HAL_RCC_CRC_CLKAM_DISABLE() (RCC->D3AMR) &= ~(RCC_D3AMR_CRCAMEN)
  1896. #define __HAL_RCC_SAI4_CLKAM_DISABLE() (RCC->D3AMR) &= ~(RCC_D3AMR_SAI4AMEN)
  1897. #define __HAL_RCC_ADC3_CLKAM_DISABLE() (RCC->D3AMR) &= ~(RCC_D3AMR_ADC3AMEN)
  1898. #define __HAL_RCC_BKPRAM_CLKAM_DISABLE() (RCC->D3AMR) &= ~ (RCC_D3AMR_BKPRAMAMEN)
  1899. #define __HAL_RCC_D3SRAM1_CLKAM_DISABLE() (RCC->D3AMR)&= ~ (RCC_D3AMR_SRAM4AMEN)
  1900. /** @brief Macro to enable or disable the Internal High Speed oscillator (HSI).
  1901. * @note After enabling the HSI, the application software should wait on
  1902. * HSIRDY flag to be set indicating that HSI clock is stable and can
  1903. * be used to clock the PLL and/or system clock.
  1904. * @note HSI can not be stopped if it is used directly or through the PLL
  1905. * as system clock. In this case, you have to select another source
  1906. * of the system clock then stop the HSI.
  1907. * @note The HSI is stopped by hardware when entering STOP and STANDBY modes.
  1908. * @param __STATE__ specifies the new state of the HSI.
  1909. * This parameter can be one of the following values:
  1910. * @arg RCC_HSI_OFF turn OFF the HSI oscillator
  1911. * @arg RCC_HSI_ON turn ON the HSI oscillator
  1912. * @arg RCC_HSI_DIV1 turn ON the HSI oscillator and divide it by 1 (default after reset)
  1913. * @arg RCC_HSI_DIV2 turn ON the HSI oscillator and divide it by 2
  1914. * @arg RCC_HSI_DIV4 turn ON the HSI oscillator and divide it by 4
  1915. * @arg RCC_HSI_DIV8 turn ON the HSI oscillator and divide it by 8
  1916. * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
  1917. * clock cycles.
  1918. */
  1919. #define __HAL_RCC_HSI_CONFIG(__STATE__) \
  1920. MODIFY_REG(RCC->CR, RCC_CR_HSION | RCC_CR_HSIDIV , (uint32_t)(__STATE__))
  1921. /** @brief Macro to get the HSI divider.
  1922. * @retval The HSI divider. The returned value can be one
  1923. * of the following:
  1924. * - RCC_CR_HSIDIV_1 HSI oscillator divided by 1 (default after reset)
  1925. * - RCC_CR_HSIDIV_2 HSI oscillator divided by 2
  1926. * - RCC_CR_HSIDIV_4 HSI oscillator divided by 4
  1927. * - RCC_CR_HSIDIV_8 HSI oscillator divided by 8
  1928. */
  1929. #define __HAL_RCC_GET_HSI_DIVIDER() ((uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSIDIV)))
  1930. /** @brief Macros to enable or disable the Internal High Speed oscillator (HSI).
  1931. * @note The HSI is stopped by hardware when entering STOP and STANDBY modes.
  1932. * It is used (enabled by hardware) as system clock source after start-up
  1933. * from Reset, wakeup from STOP and STANDBY mode, or in case of failure
  1934. * of the HSE used directly or indirectly as system clock (if the Clock
  1935. * Security System CSS is enabled).
  1936. * @note HSI can not be stopped if it is used as system clock source. In this case,
  1937. * you have to select another source of the system clock then stop the HSI.
  1938. * @note After enabling the HSI, the application software should wait on HSIRDY
  1939. * flag to be set indicating that HSI clock is stable and can be used as
  1940. * system clock source.
  1941. * This parameter can be: ENABLE or DISABLE.
  1942. * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
  1943. * clock cycles.
  1944. */
  1945. #define __HAL_RCC_HSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSION)
  1946. #define __HAL_RCC_HSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSION)
  1947. /** @brief Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
  1948. * @note The calibration is used to compensate for the variations in voltage
  1949. * and temperature that influence the frequency of the internal HSI RC.
  1950. * @param __HSICalibrationValue__: specifies the calibration trimming value.
  1951. * This parameter must be a number between 0 and 0x3F.
  1952. */
  1953. #define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(__HSICalibrationValue__) \
  1954. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, (uint32_t)(__HSICalibrationValue__) << POSITION_VAL(RCC_ICSCR_HSITRIM))
  1955. /**
  1956. * @brief Macros to enable or disable the force of the Internal High Speed oscillator (HSI)
  1957. * in STOP mode to be quickly available as kernel clock for some peripherals.
  1958. * @note Keeping the HSI ON in STOP mode allows to avoid slowing down the communication
  1959. * speed because of the HSI start-up time.
  1960. * @note The enable of this function has not effect on the HSION bit.
  1961. * This parameter can be: ENABLE or DISABLE.
  1962. * @retval None
  1963. */
  1964. #define __HAL_RCC_HSISTOP_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSIKERON)
  1965. #define __HAL_RCC_HSISTOP_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSIKERON)
  1966. /**
  1967. * @brief Macro to enable or disable the Internal High Speed oscillator for USB (HSI48).
  1968. * @note After enabling the HSI48, the application software should wait on
  1969. * HSI48RDY flag to be set indicating that HSI48 clock is stable and can
  1970. * be used to clock the USB.
  1971. * @note The HSI48 is stopped by hardware when entering STOP and STANDBY modes.
  1972. */
  1973. #define __HAL_RCC_HSI48_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSI48ON);
  1974. #define __HAL_RCC_HSI48_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSI48ON);
  1975. /**
  1976. * @brief Macros to enable or disable the Internal oscillator (CSI).
  1977. * @note The CSI is stopped by hardware when entering STOP and STANDBY modes.
  1978. * It is used (enabled by hardware) as system clock source after
  1979. * start-up from Reset, wakeup from STOP and STANDBY mode, or in case
  1980. * of failure of the HSE used directly or indirectly as system clock
  1981. * (if the Clock Security System CSS is enabled).
  1982. * @note CSI can not be stopped if it is used as system clock source.
  1983. * In this case, you have to select another source of the system
  1984. * clock then stop the CSI.
  1985. * @note After enabling the CSI, the application software should wait on
  1986. * CSIRDY flag to be set indicating that CSI clock is stable and can
  1987. * be used as system clock source.
  1988. * @note When the CSI is stopped, CSIRDY flag goes low after 6 CSI oscillator
  1989. * clock cycles.
  1990. */
  1991. #define __HAL_RCC_CSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_CSION)
  1992. #define __HAL_RCC_CSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_CSION)
  1993. /** @brief Macro Adjusts the Internal oscillator (CSI) calibration value.
  1994. * @note The calibration is used to compensate for the variations in voltage
  1995. * and temperature that influence the frequency of the internal CSI RC.
  1996. * @param __CSICalibrationValue__: specifies the calibration trimming value.
  1997. * This parameter must be a number between 0 and 0x1F.
  1998. */
  1999. #define __HAL_RCC_CSI_CALIBRATIONVALUE_ADJUST(__CSICalibrationValue__) \
  2000. MODIFY_REG(RCC->ICSCR, RCC_ICSCR_CSITRIM, (uint32_t)(__CSICalibrationValue__) << POSITION_VAL(RCC_ICSCR_CSITRIM))
  2001. /**
  2002. * @brief Macros to enable or disable the force of the Low-power Internal oscillator (CSI)
  2003. * in STOP mode to be quickly available as kernel clock for USARTs and I2Cs.
  2004. * @note Keeping the CSI ON in STOP mode allows to avoid slowing down the communication
  2005. * speed because of the CSI start-up time.
  2006. * @note The enable of this function has not effect on the CSION bit.
  2007. * This parameter can be: ENABLE or DISABLE.
  2008. * @retval None
  2009. */
  2010. #define __HAL_RCC_CSISTOP_ENABLE() SET_BIT(RCC->CR, RCC_CR_CSIKERON)
  2011. #define __HAL_RCC_CSISTOP_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_CSIKERON)
  2012. /** @brief Macros to enable or disable the Internal Low Speed oscillator (LSI).
  2013. * @note After enabling the LSI, the application software should wait on
  2014. * LSIRDY flag to be set indicating that LSI clock is stable and can
  2015. * be used to clock the IWDG and/or the RTC.
  2016. * @note LSI can not be disabled if the IWDG is running.
  2017. * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
  2018. * clock cycles.
  2019. */
  2020. #define __HAL_RCC_LSI_ENABLE() SET_BIT(RCC->CSR, RCC_CSR_LSION)
  2021. #define __HAL_RCC_LSI_DISABLE() CLEAR_BIT(RCC->CSR, RCC_CSR_LSION)
  2022. /**
  2023. * @brief Macro to configure the External High Speed oscillator (__HSE__).
  2024. * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application
  2025. * software should wait on HSERDY flag to be set indicating that HSE clock
  2026. * is stable and can be used to clock the PLL and/or system clock.
  2027. * @note HSE state can not be changed if it is used directly or through the
  2028. * PLL as system clock. In this case, you have to select another source
  2029. * of the system clock then change the HSE state (ex. disable it).
  2030. * @note The HSE is stopped by hardware when entering STOP and STANDBY modes.
  2031. * @note This function reset the CSSON bit, so if the clock security system(CSS)
  2032. * was previously enabled you have to enable it again after calling this
  2033. * function.
  2034. * @param __STATE__: specifies the new state of the HSE.
  2035. * This parameter can be one of the following values:
  2036. * @arg RCC_HSE_OFF: turn OFF the HSE oscillator, HSERDY flag goes low after
  2037. * 6 HSE oscillator clock cycles.
  2038. * @arg RCC_HSE_ON: turn ON the HSE oscillator.
  2039. * @arg RCC_HSE_BYPASS: HSE oscillator bypassed with external clock.
  2040. */
  2041. #define __HAL_RCC_HSE_CONFIG(__STATE__) \
  2042. do { \
  2043. if ((__STATE__) == RCC_HSE_ON) \
  2044. { \
  2045. SET_BIT(RCC->CR, RCC_CR_HSEON); \
  2046. } \
  2047. else if ((__STATE__) == RCC_HSE_OFF) \
  2048. { \
  2049. CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
  2050. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2051. } \
  2052. else if ((__STATE__) == RCC_HSE_BYPASS) \
  2053. { \
  2054. SET_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2055. SET_BIT(RCC->CR, RCC_CR_HSEON); \
  2056. } \
  2057. else \
  2058. { \
  2059. CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
  2060. CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
  2061. } \
  2062. } while(0)
  2063. /** @defgroup RCC_LSE_Configuration LSE Configuration
  2064. * @{
  2065. */
  2066. /**
  2067. * @brief Macro to configure the External Low Speed oscillator (LSE).
  2068. * @note Transition LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro.
  2069. * User should request a transition to LSE Off first and then LSE On or LSE Bypass.
  2070. * @note As the LSE is in the Backup domain and write access is denied to
  2071. * this domain after reset, you have to enable write access using
  2072. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2073. * (to be done once after reset).
  2074. * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
  2075. * software should wait on LSERDY flag to be set indicating that LSE clock
  2076. * is stable and can be used to clock the RTC.
  2077. * @param __STATE__: specifies the new state of the LSE.
  2078. * This parameter can be one of the following values:
  2079. * @arg RCC_LSE_OFF: turn OFF the LSE oscillator, LSERDY flag goes low after
  2080. * 6 LSE oscillator clock cycles.
  2081. * @arg RCC_LSE_ON: turn ON the LSE oscillator.
  2082. * @arg RCC_LSE_BYPASS: LSE oscillator bypassed with external clock.
  2083. */
  2084. #define __HAL_RCC_LSE_CONFIG(__STATE__) \
  2085. do { \
  2086. if((__STATE__) == RCC_LSE_ON) \
  2087. { \
  2088. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2089. } \
  2090. else if((__STATE__) == RCC_LSE_OFF) \
  2091. { \
  2092. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2093. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  2094. } \
  2095. else if((__STATE__) == RCC_LSE_BYPASS) \
  2096. { \
  2097. SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  2098. SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2099. } \
  2100. else \
  2101. { \
  2102. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
  2103. CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
  2104. } \
  2105. } while(0)
  2106. /**
  2107. * @}
  2108. */
  2109. /** @brief Macros to enable or disable the the RTC clock.
  2110. * @note These macros must be used only after the RTC clock source was selected.
  2111. */
  2112. #define __HAL_RCC_RTC_ENABLE() SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
  2113. #define __HAL_RCC_RTC_DISABLE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
  2114. /** @brief Macros to configure the RTC clock (RTCCLK).
  2115. * @note As the RTC clock configuration bits are in the Backup domain and write
  2116. * access is denied to this domain after reset, you have to enable write
  2117. * access using the Power Backup Access macro before to configure
  2118. * the RTC clock source (to be done once after reset).
  2119. * @note Once the RTC clock is configured it can't be changed unless the
  2120. * Backup domain is reset using __HAL_RCC_BackupReset_RELEASE() macro, or by
  2121. * a Power On Reset (POR).
  2122. * @param __RTCCLKSource__: specifies the RTC clock source.
  2123. * This parameter can be one of the following values:
  2124. * @arg RCC_RTCCLKSOURCE_LSE: LSE selected as RTC clock.
  2125. * @arg RCC_RTCCLKSOURCE_LSI: LSI selected as RTC clock.
  2126. * @arg RCC_RTCCLKSOURCE_HSE_DIVx: HSE clock divided by x selected
  2127. * as RTC clock, where x:[2,31]
  2128. * @note If the LSE or LSI is used as RTC clock source, the RTC continues to
  2129. * work in STOP and STANDBY modes, and can be used as wakeup source.
  2130. * However, when the HSE clock is used as RTC clock source, the RTC
  2131. * cannot be used in STOP and STANDBY modes.
  2132. * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as
  2133. * RTC clock source).
  2134. */
  2135. #define __HAL_RCC_RTC_CLKPRESCALER(__RTCCLKSource__) (((__RTCCLKSource__) & RCC_BDCR_RTCSEL) == RCC_BDCR_RTCSEL) ? \
  2136. MODIFY_REG(RCC->CFGR, RCC_CFGR_RTCPRE, (((__RTCCLKSource__) & 0xFFFFCFF) >> 4)) : CLEAR_BIT(RCC->CFGR, RCC_CFGR_RTCPRE)
  2137. #define __HAL_RCC_RTC_CONFIG(__RTCCLKSource__) do { __HAL_RCC_RTC_CLKPRESCALER(__RTCCLKSource__); \
  2138. RCC->BDCR |= ((__RTCCLKSource__) & 0x00000FFF); \
  2139. } while (0)
  2140. #define __HAL_RCC_GET_RTC_SOURCE() ((uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)))
  2141. /** @brief Macros to force or release the Backup domain reset.
  2142. * @note This function resets the RTC peripheral (including the backup registers)
  2143. * and the RTC clock source selection in RCC_CSR register.
  2144. * @note The BKPSRAM is not affected by this reset.
  2145. */
  2146. #define __HAL_RCC_BACKUPRESET_FORCE() SET_BIT(RCC->BDCR, RCC_BDCR_BDRST)
  2147. #define __HAL_RCC_BACKUPRESET_RELEASE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST)
  2148. /** @brief Macros to enable or disable the main PLL.
  2149. * @note After enabling the main PLL, the application software should wait on
  2150. * PLLRDY flag to be set indicating that PLL clock is stable and can
  2151. * be used as system clock source.
  2152. * @note The main PLL can not be disabled if it is used as system clock source
  2153. * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes.
  2154. */
  2155. #define __HAL_RCC_PLL_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLL1ON)
  2156. #define __HAL_RCC_PLL_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLL1ON)
  2157. /**
  2158. * @brief Enables or disables each clock output (PLL_P_CLK, PLL_Q_CLK, PLL_R_CLK)
  2159. * @note Enabling/disabling Those Clocks can be any time without the need to stop the PLL,
  2160. * (except the ck_pll_p of the System PLL that cannot be stopped if used as System
  2161. * Clock.This is mainly used to save Power.
  2162. * @param __RCC_PLL1ClockOut__: specifies the PLL clock to be outputted
  2163. * This parameter can be one of the following values:
  2164. * @arg RCC_PLL1_DIVP: This clock is used to generate system clock (up to 400MHZ)
  2165. * @arg RCC_PLL1_DIVQ: This clock is used to generate peripherals clock (up to 400MHZ)
  2166. * @arg RCC_PLL1_DIVR: This clock is used to generate peripherals clock (up to 400MHZ)
  2167. * @retval None
  2168. */
  2169. #define __HAL_RCC_PLLCLKOUT_ENABLE(__RCC_PLL1ClockOut__) SET_BIT(RCC->PLLCFGR, (__RCC_PLL1ClockOut__))
  2170. #define __HAL_RCC_PLLCLKOUT_DISABLE(__RCC_PLL1ClockOut__) CLEAR_BIT(RCC->PLLCFGR, (__RCC_PLL1ClockOut__))
  2171. /**
  2172. * @brief Enables or disables Fractional Part Of The Multiplication Factor of PLL1 VCO
  2173. * @note Enabling/disabling Fractional Part can be any time without the need to stop the PLL1
  2174. * @retval None
  2175. */
  2176. #define __HAL_RCC_PLLFRACN_ENABLE() SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL1FRACEN)
  2177. #define __HAL_RCC_PLLFRACN_DISABLE() CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL1FRACEN)
  2178. /**
  2179. * @brief Macro to configures the main PLL clock source, multiplication and division factors.
  2180. * @note This function must be used only when the main PLL is disabled.
  2181. *
  2182. * @param __RCC_PLLSOURCE__: specifies the PLL entry clock source.
  2183. * This parameter can be one of the following values:
  2184. * @arg RCC_PLLSOURCE_CSI: CSI oscillator clock selected as PLL clock entry
  2185. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  2186. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  2187. * @note This clock source (__RCC_PLLSource__) is common for the main PLL1 (main PLL) and PLL2 & PLL3 .
  2188. *
  2189. * @param __PLLM1__: specifies the division factor for PLL VCO input clock
  2190. * This parameter must be a number between 1 and 63.
  2191. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2192. * frequency ranges from 1 to 16 MHz.
  2193. *
  2194. * @param __PLLN1__: specifies the multiplication factor for PLL VCO output clock
  2195. * This parameter must be a number between 4 and 512.
  2196. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2197. * output frequency is between 150 and 420 MHz (when in medium VCO range) or
  2198. * between 192 and 836 MHZ (when in wide VCO range)
  2199. *
  2200. * @param __PLLP1__: specifies the division factor for system clock.
  2201. * This parameter must be a number between 2 and 128 (where odd numbers not allowed)
  2202. *
  2203. * @param __PLLQ1__: specifies the division factor for peripheral kernel clocks
  2204. * This parameter must be a number between 1 and 128
  2205. *
  2206. * @param __PLLR1__: specifies the division factor for peripheral kernel clocks
  2207. * This parameter must be a number between 1 and 128
  2208. *
  2209. * @retval None
  2210. */
  2211. #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLM1__, __PLLN1__, __PLLP1__, __PLLQ1__,__PLLR1__ ) \
  2212. do{ MODIFY_REG(RCC->PLLCKSELR, (RCC_PLLCKSELR_PLLSRC | RCC_PLLCKSELR_DIVM1) , ((__RCC_PLLSOURCE__) | ( (__PLLM1__) <<4U))); \
  2213. WRITE_REG (RCC->PLL1DIVR , ( (((__PLLN1__) - 1U )& RCC_PLL1DIVR_N1) | ((((__PLLP1__) -1U ) << 9U) & RCC_PLL1DIVR_P1) | \
  2214. ((((__PLLQ1__) -1U) << 16U)& RCC_PLL1DIVR_Q1) | ((((__PLLR1__) - 1U) << 24U)& RCC_PLL1DIVR_R1))); \
  2215. } while(0)
  2216. /** @brief Macro to configure the PLLs clock source.
  2217. * @note This function must be used only when all PLLs are disabled.
  2218. * @param __PLLSOURCE__: specifies the PLLs entry clock source.
  2219. * This parameter can be one of the following values:
  2220. * @arg RCC_PLLSOURCE_CSI: CSI oscillator clock selected as PLL clock entry
  2221. * @arg RCC_PLLSOURCE_HSI: HSI oscillator clock selected as PLL clock entry
  2222. * @arg RCC_PLLSOURCE_HSE: HSE oscillator clock selected as PLL clock entry
  2223. *
  2224. */
  2225. #define __HAL_RCC_PLL_PLLSOURCE_CONFIG(__PLLSOURCE__) MODIFY_REG(RCC->PLLCKSELR, RCC_PLLCKSELR_PLLSRC, (__PLLSOURCE__))
  2226. /**
  2227. * @brief Macro to configures the main PLL clock Fractional Part Of The Multiplication Factor
  2228. *
  2229. * @note These bits can be written at any time, allowing dynamic fine-tuning of the PLL1 VCO
  2230. *
  2231. * @param __RCC_PLL1FRACN__: specifies Fractional Part Of The Multiplication Factor for PLL1 VCO
  2232. * It should be a value between 0 and 8191
  2233. * @note Warning: The software has to set correctly these bits to insure that the VCO
  2234. * output frequency is between its valid frequency range, which is:
  2235. * 192 to 836 MHz if PLL1VCOSEL = 0
  2236. * 150 to 420 MHz if PLL1VCOSEL = 1.
  2237. *
  2238. *
  2239. * @retval None
  2240. */
  2241. #define __HAL_RCC_PLLFRACN_CONFIG(__RCC_PLL1FRACN__) MODIFY_REG(RCC->PLL1FRACR, RCC_PLL1FRACR_FRACN1, (uint32_t)(__RCC_PLL1FRACN__) << POSITION_VAL(RCC_PLL1FRACR_FRACN1))
  2242. /** @brief Macro to select the PLL1 reference frequency range.
  2243. * @param __RCC_PLL1VCIRange__: specifies the PLL1 input frequency range
  2244. * This parameter can be one of the following values:
  2245. * @arg RCC_PLL1VCIRANGE_0: Range frequency is between 1 and 2 MHz
  2246. * @arg RCC_PLL1VCIRANGE_1: Range frequency is between 2 and 4 MHz
  2247. * @arg RCC_PLL1VCIRANGE_2: Range frequency is between 4 and 8 MHz
  2248. * @arg RCC_PLL1VCIRANGE_3: Range frequency is between 8 and 16 MHz
  2249. * @retval None
  2250. */
  2251. #define __HAL_RCC_PLL_VCIRANGE(__RCC_PLL1VCIRange__) \
  2252. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL1RGE, (__RCC_PLL1VCIRange__))
  2253. /** @brief Macro to select the PLL1 reference frequency range.
  2254. * @param __RCC_PLL1VCORange__: specifies the PLL1 input frequency range
  2255. * This parameter can be one of the following values:
  2256. * @arg RCC_PLL1VCOWIDE: Range frequency is between 192 and 836 MHz
  2257. * @arg RCC_PLL1VCOMEDIUM: Range frequency is between 150 and 420 MHz
  2258. * @retval None
  2259. */
  2260. #define __HAL_RCC_PLL_VCORANGE(__RCC_PLL1VCORange__) \
  2261. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL1VCOSEL, (__RCC_PLL1VCORange__))
  2262. /** @brief Macro to get the clock source used as system clock.
  2263. * @retval The clock source used as system clock. The returned value can be one
  2264. * of the following:
  2265. * - RCC_CFGR_SWS_CSI: CSI used as system clock.
  2266. * - RCC_CFGR_SWS_HSI: HSI used as system clock.
  2267. * - RCC_CFGR_SWS_HSE: HSE used as system clock.
  2268. * - RCC_CFGR_SWS_PLL: PLL used as system clock.
  2269. */
  2270. #define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(RCC->CFGR & RCC_CFGR_SWS))
  2271. /**
  2272. * @brief Macro to configure the system clock source.
  2273. * @param __RCC_SYSCLKSOURCE__: specifies the system clock source.
  2274. * This parameter can be one of the following values:
  2275. * - RCC_SYSCLKSOURCE_HSI: HSI oscillator is used as system clock source.
  2276. * - RCC_SYSCLKSOURCE_CSI: CSI oscillator is used as system clock source.
  2277. * - RCC_SYSCLKSOURCE_HSE: HSE oscillator is used as system clock source.
  2278. * - RCC_SYSCLKSOURCE_PLLCLK: PLL output is used as system clock source.
  2279. */
  2280. #define __HAL_RCC_SYSCLK_CONFIG(__RCC_SYSCLKSOURCE__) MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__RCC_SYSCLKSOURCE__))
  2281. /** @brief Macro to get the oscillator used as PLL clock source.
  2282. * @retval The oscillator used as PLL clock source. The returned value can be one
  2283. * of the following:
  2284. * - RCC_PLLSOURCE_NONE: No oscillator is used as PLL clock source.
  2285. * - RCC_PLLSOURCE_CSI: CSI oscillator is used as PLL clock source.
  2286. * - RCC_PLLSOURCE_HSI: HSI oscillator is used as PLL clock source.
  2287. * - RCC_PLLSOURCE_HSE: HSE oscillator is used as PLL clock source.
  2288. */
  2289. #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC))
  2290. /**
  2291. * @brief Macro to configure the External Low Speed oscillator (LSE) drive capability.
  2292. * @note As the LSE is in the Backup domain and write access is denied to
  2293. * this domain after reset, you have to enable write access using
  2294. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2295. * (to be done once after reset).
  2296. * @param __LSEDRIVE__: specifies the new state of the LSE drive capability.
  2297. * This parameter can be one of the following values:
  2298. * @arg RCC_LSEDRIVE_LOW: LSE oscillator low drive capability.
  2299. * @arg RCC_LSEDRIVE_MEDIUMLOW: LSE oscillator medium low drive capability.
  2300. * @arg RCC_LSEDRIVE_MEDIUMHIGH: LSE oscillator medium high drive capability.
  2301. * @arg RCC_LSEDRIVE_HIGH: LSE oscillator high drive capability.
  2302. * @retval None
  2303. */
  2304. #define __HAL_RCC_LSEDRIVE_CONFIG(__LSEDRIVE__) \
  2305. MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, (uint32_t)(__LSEDRIVE__))
  2306. /**
  2307. * @brief Macro to configure the wake up from stop clock.
  2308. * @param __RCC_STOPWUCLK__: specifies the clock source used after wake up from stop
  2309. * This parameter can be one of the following values:
  2310. * @arg RCC_STOP_WAKEUPCLOCK_CSI: CSI selected as system clock source
  2311. * @arg RCC_STOP_WAKEUPCLOCK_HSI: HSI selected as system clock source
  2312. * @retval None
  2313. */
  2314. #define __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(__RCC_STOPWUCLK__) \
  2315. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPWUCK, (__RCC_STOPWUCLK__))
  2316. /**
  2317. * @brief Macro to configure the Kernel wake up from stop clock.
  2318. * @param __RCC_STOPKERWUCLK__: specifies the Kernel clock source used after wake up from stop
  2319. * This parameter can be one of the following values:
  2320. * @arg RCC_STOP_KERWAKEUPCLOCK_CSI: CSI selected as Kernel clock source
  2321. * @arg RCC_STOP_KERWAKEUPCLOCK_HSI: HSI selected as Kernel clock source
  2322. * @retval None
  2323. */
  2324. #define __HAL_RCC_KERWAKEUPSTOP_CLK_CONFIG(__RCC_STOPKERWUCLK__) \
  2325. MODIFY_REG(RCC->CFGR, RCC_CFGR_STOPKERWUCK, (__RCC_STOPKERWUCLK__))
  2326. /** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management
  2327. * @brief macros to manage the specified RCC Flags and interrupts.
  2328. * @{
  2329. */
  2330. /** @brief Enable RCC interrupt.
  2331. * @param __INTERRUPT__: specifies the RCC interrupt sources to be enabled.
  2332. * This parameter can be any combination of the following values:
  2333. * @arg RCC_IT_LSIRDY: LSI ready interrupt
  2334. * @arg RCC_IT_LSERDY: LSE ready interrupt
  2335. * @arg RCC_IT_CSIRDY: HSI ready interrupt
  2336. * @arg RCC_IT_HSIRDY: HSI ready interrupt
  2337. * @arg RCC_IT_HSERDY: HSE ready interrupt
  2338. * @arg RCC_IT_HSI48RDY: HSI48 ready interrupt
  2339. * @arg RCC_IT_PLLRDY: main PLL ready interrupt
  2340. * @arg RCC_IT_PLL2RDY: PLL2 ready interrupt
  2341. * @arg RCC_IT_PLL3RDY: PLL3 ready interrupt
  2342. * @arg RCC_IT_LSECSS: Clock security system interrupt
  2343. */
  2344. #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) SET_BIT(RCC->CIER, (__INTERRUPT__))
  2345. /** @brief Disable RCC interrupt
  2346. * @param __INTERRUPT__: specifies the RCC interrupt sources to be disabled.
  2347. * This parameter can be any combination of the following values:
  2348. * @arg RCC_IT_LSIRDY: LSI ready interrupt
  2349. * @arg RCC_IT_LSERDY: LSE ready interrupt
  2350. * @arg RCC_IT_CSIRDY: HSI ready interrupt
  2351. * @arg RCC_IT_HSIRDY: HSI ready interrupt
  2352. * @arg RCC_IT_HSERDY: HSE ready interrupt
  2353. * @arg RCC_IT_HSI48RDY: HSI48 ready interrupt
  2354. * @arg RCC_IT_PLLRDY: main PLL ready interrupt
  2355. * @arg RCC_IT_PLL2RDY: PLL2 ready interrupt
  2356. * @arg RCC_IT_PLL3RDY: PLL3 ready interrupt
  2357. * @arg RCC_IT_LSECSS: Clock security system interrupt
  2358. */
  2359. #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(RCC->CIER, (__INTERRUPT__))
  2360. /** @brief Clear the RCC's interrupt pending bits
  2361. * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
  2362. * This parameter can be any combination of the following values:
  2363. * @arg RCC_IT_LSIRDY: LSI ready interrupt
  2364. * @arg RCC_IT_LSERDY: LSE ready interrupt
  2365. * @arg RCC_IT_CSIRDY: CSI ready interrupt
  2366. * @arg RCC_IT_HSIRDY: HSI ready interrupt
  2367. * @arg RCC_IT_HSERDY: HSE ready interrupt
  2368. * @arg RCC_IT_HSI48RDY: HSI48 ready interrupt
  2369. * @arg RCC_IT_PLLRDY: main PLL ready interrupt
  2370. * @arg RCC_IT_PLL2RDY: PLL2 ready interrupt
  2371. * @arg RCC_IT_PLL3RDY: PLL3 ready interrupt
  2372. * @arg RCC_IT_HSECSS: HSE Clock Security interrupt
  2373. * @arg RCC_IT_LSECSS: Clock security system interrupt
  2374. */
  2375. #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (RCC->CICR = (__INTERRUPT__))
  2376. /** @brief Check the RCC's interrupt has occurred or not.
  2377. * @param __INTERRUPT__: specifies the RCC interrupt source to check.
  2378. * This parameter can be any combination of the following values:
  2379. * @arg RCC_IT_LSIRDY: LSI ready interrupt
  2380. * @arg RCC_IT_LSERDY: LSE ready interrupt
  2381. * @arg RCC_IT_CSIRDY: CSI ready interrupt
  2382. * @arg RCC_IT_HSIRDY: HSI ready interrupt
  2383. * @arg RCC_IT_HSERDY: HSE ready interrupt
  2384. * @arg RCC_IT_HSI48RDY: HSI48 ready interrupt
  2385. * @arg RCC_IT_PLLRDY: main PLL ready interrupt
  2386. * @arg RCC_IT_PLL2RDY: PLL2 ready interrupt
  2387. * @arg RCC_IT_PLL3RDY: PLL3 ready interrupt
  2388. * @arg RCC_IT_HSECSS: HSE Clock Security interrupt
  2389. * @arg RCC_IT_LSECSS: Clock security system interrupt
  2390. * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
  2391. */
  2392. #define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIFR & (__INTERRUPT__)) == (__INTERRUPT__))
  2393. /** @brief Set RMVF bit to clear the reset flags.
  2394. */
  2395. #define __HAL_RCC_CLEAR_RESET_FLAGS() (RCC->RSR |= RCC_RSR_RMVF)
  2396. /** @brief Check RCC flag is set or not.
  2397. * @param __FLAG__: specifies the flag to check.
  2398. * This parameter can be one of the following values:
  2399. * @arg RCC_FLAG_HSIRDY: HSI oscillator clock ready
  2400. * @arg RCC_FLAG_HSIDIV: HSI divider flag
  2401. * @arg RCC_FLAG_CSIRDY: CSI oscillator clock ready
  2402. * @arg RCC_FLAG_HSI48RDY: HSI48 oscillator clock ready
  2403. * @arg RCC_FLAG_HSERDY: HSE oscillator clock ready
  2404. * @arg RCC_FLAG_D1CKRDY: Domain1 clock ready
  2405. * @arg RCC_FLAG_D2CKRDY: Domain2 clock ready
  2406. * @arg RCC_FLAG_PLLRDY: PLL1 clock ready
  2407. * @arg RCC_FLAG_PLL2RDY: PLL2 clock ready
  2408. * @arg RCC_FLAG_PLL3RDY: PLL3 clock ready
  2409. * @arg RCC_FLAG_LSERDY: LSE oscillator clock ready
  2410. * @arg RCC_FLAG_LSIRDY: LSI oscillator clock ready
  2411. * @arg RCC_FLAG_RMVF: Remove reset Flag
  2412. * @arg RCC_FLAG_CPURST: CPU reset flag
  2413. * @arg RCC_FLAG_D1RST: D1 domain power switch reset flag
  2414. * @arg RCC_FLAG_D2RST: D2 domain power switch reset flag
  2415. * @arg RCC_FLAG_BORRST: BOR reset flag
  2416. * @arg RCC_FLAG_PINRST: Pin reset
  2417. * @arg RCC_FLAG_PORRST: POR/PDR reset
  2418. * @arg RCC_FLAG_SFTRST: System reset from CPU reset flag
  2419. * @arg RCC_FLAG_BORRST: D2 domain power switch reset flag
  2420. * @arg RCC_FLAG_IWDG1RST: CPU Independent Watchdog reset
  2421. * @arg RCC_FLAG_WWDG1RST: Window Watchdog1 reset
  2422. * @arg RCC_FLAG_LPWR1RST: Reset due to illegal D1 DSTANDBY or CPU CSTOP flag
  2423. * @arg RCC_FLAG_LPWR2RST: Reset due to illegal D2 DSTANDBY flag
  2424. * @retval The new state of __FLAG__ (TRUE or FALSE).
  2425. */
  2426. #define RCC_FLAG_MASK ((uint8_t)0x1F)
  2427. #define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5) == 1)? RCC->CR :((((__FLAG__) >> 5) == 2) ? RCC->BDCR : \
  2428. ((((__FLAG__) >> 5) == 3)? RCC->CSR : ((((__FLAG__) >> 5) == 4)? RCC->RSR :RCC->CIFR)))) & ((uint32_t)1 << ((__FLAG__) & RCC_FLAG_MASK)))!= 0)? 1 : 0)
  2429. /**
  2430. * @}
  2431. */
  2432. #define RCC_GET_PLL_OSCSOURCE() ((RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC) >> POSITION_VAL(RCC_PLLCKSELR_PLLSRC))
  2433. /**
  2434. * @}
  2435. */
  2436. /* Include RCC HAL Extension module */
  2437. #include "stm32h7xx_hal_rcc_ex.h"
  2438. /* Exported functions --------------------------------------------------------*/
  2439. /** @addtogroup RCC_Exported_Functions
  2440. * @{
  2441. */
  2442. /** @addtogroup RCC_Exported_Functions_Group1
  2443. * @{
  2444. */
  2445. /* Initialization and de-initialization functions ******************************/
  2446. void HAL_RCC_DeInit(void);
  2447. HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  2448. HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency);
  2449. /**
  2450. * @}
  2451. */
  2452. /** @addtogroup RCC_Exported_Functions_Group2
  2453. * @{
  2454. */
  2455. /* Peripheral Control functions ************************************************/
  2456. void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
  2457. void HAL_RCC_EnableCSS(void);
  2458. void HAL_RCC_DisableCSS(void);
  2459. uint32_t HAL_RCC_GetSysClockFreq(void);
  2460. uint32_t HAL_RCC_GetHCLKFreq(void);
  2461. uint32_t HAL_RCC_GetPCLK1Freq(void);
  2462. uint32_t HAL_RCC_GetPCLK2Freq(void);
  2463. void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  2464. void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency);
  2465. /* CSS NMI IRQ handler */
  2466. void HAL_RCC_NMI_IRQHandler(void);
  2467. /* User Callbacks in non blocking mode (IT mode) */
  2468. void HAL_RCC_CCSCallback(void);
  2469. /**
  2470. * @}
  2471. */
  2472. /**
  2473. * @}
  2474. */
  2475. /* Private types -------------------------------------------------------------*/
  2476. /* Private variables ---------------------------------------------------------*/
  2477. /* Private constants ---------------------------------------------------------*/
  2478. /** @defgroup RCC_Private_Constants RCC Private Constants
  2479. * @{
  2480. */
  2481. #define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT
  2482. #define HSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms */
  2483. #define HSI48_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms */
  2484. #define CSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms */
  2485. #define LSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms */
  2486. #define PLL_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms */
  2487. #define CLOCKSWITCH_TIMEOUT_VALUE ((uint32_t)5000) /* 5 s */
  2488. #define RCC_DBP_TIMEOUT_VALUE ((uint32_t)100)
  2489. #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT
  2490. /**
  2491. * @}
  2492. */
  2493. /* Private macros ------------------------------------------------------------*/
  2494. /** @addtogroup RCC_Private_Macros RCC Private Macros
  2495. * @{
  2496. */
  2497. /** @defgroup RCC_IS_RCC_Definitions RCC Private macros to check input parameters
  2498. * @{
  2499. */
  2500. #define IS_RCC_OSCILLATORTYPE(OSCILLATOR) (((OSCILLATOR) == RCC_OSCILLATORTYPE_NONE) || \
  2501. (((OSCILLATOR) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  2502. (((OSCILLATOR) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  2503. (((OSCILLATOR) & RCC_OSCILLATORTYPE_CSI) == RCC_OSCILLATORTYPE_CSI) || \
  2504. (((OSCILLATOR) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \
  2505. (((OSCILLATOR) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE) || \
  2506. (((OSCILLATOR) & RCC_OSCILLATORTYPE_HSI48) == RCC_OSCILLATORTYPE_HSI48))
  2507. #define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \
  2508. ((HSE) == RCC_HSE_BYPASS))
  2509. #define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \
  2510. ((LSE) == RCC_LSE_BYPASS))
  2511. #define IS_RCC_HSI(HSI) (((HSI) == RCC_HSI_OFF) || ((HSI) == RCC_HSI_ON) || \
  2512. ((HSI) == RCC_HSI_DIV1) || ((HSI) == RCC_HSI_DIV2) || \
  2513. ((HSI) == RCC_HSI_DIV4) || ((HSI) == RCC_HSI_DIV8))
  2514. #define IS_RCC_HSI48(HSI48) (((HSI48) == RCC_HSI48_OFF) || ((HSI48) == RCC_HSI48_ON))
  2515. #define IS_RCC_LSI(LSI) (((LSI) == RCC_LSI_OFF) || ((LSI) == RCC_LSI_ON))
  2516. #define IS_RCC_CSI(CSI) (((CSI) == RCC_CSI_OFF) || ((CSI) == RCC_CSI_ON))
  2517. #define IS_RCC_PLL(PLL) (((PLL) == RCC_PLL_NONE) ||((PLL) == RCC_PLL_OFF) || \
  2518. ((PLL) == RCC_PLL_ON))
  2519. #define IS_RCC_PLLSOURCE(SOURCE) (((SOURCE) == RCC_PLLSOURCE_CSI) || \
  2520. ((SOURCE) == RCC_PLLSOURCE_HSI) || \
  2521. ((SOURCE) == RCC_PLLSOURCE_NONE) || \
  2522. ((SOURCE) == RCC_PLLSOURCE_HSE))
  2523. #define IS_RCC_PLLM_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 63))
  2524. #define IS_RCC_PLLN_VALUE(VALUE) ((4 <= (VALUE)) && ((VALUE) <= 512))
  2525. #define IS_RCC_PLLP_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 128))
  2526. #define IS_RCC_PLLQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 128))
  2527. #define IS_RCC_PLLR_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 128))
  2528. #define IS_RCC_PLLCLOCKOUT_VALUE(VALUE) (((VALUE) == RCC_PLL1_DIVP) || \
  2529. ((VALUE) == RCC_PLL1_DIVQ) || \
  2530. ((VALUE) == RCC_PLL1_DIVR))
  2531. #define IS_RCC_CLOCKTYPE(CLK) ((1 <= (CLK)) && ((CLK) <= 0x3F))
  2532. #define IS_RCC_SYSCLKSOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSOURCE_CSI) || \
  2533. ((SOURCE) == RCC_SYSCLKSOURCE_HSI) || \
  2534. ((SOURCE) == RCC_SYSCLKSOURCE_HSE) || \
  2535. ((SOURCE) == RCC_SYSCLKSOURCE_PLLCLK))
  2536. #define IS_RCC_SYSCLK(SYSCLK) (((SYSCLK) == RCC_SYSCLK_DIV1) || ((SYSCLK) == RCC_SYSCLK_DIV2) || \
  2537. ((SYSCLK) == RCC_SYSCLK_DIV4) || ((SYSCLK) == RCC_SYSCLK_DIV8) || \
  2538. ((SYSCLK) == RCC_SYSCLK_DIV16) || ((SYSCLK) == RCC_SYSCLK_DIV64) || \
  2539. ((SYSCLK) == RCC_SYSCLK_DIV128) || ((SYSCLK) == RCC_SYSCLK_DIV256) || \
  2540. ((SYSCLK) == RCC_SYSCLK_DIV512))
  2541. #define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_HCLK_DIV1) || ((HCLK) == RCC_HCLK_DIV2) || \
  2542. ((HCLK) == RCC_HCLK_DIV4) || ((HCLK) == RCC_HCLK_DIV8) || \
  2543. ((HCLK) == RCC_HCLK_DIV16) || ((HCLK) == RCC_HCLK_DIV64) || \
  2544. ((HCLK) == RCC_HCLK_DIV128) || ((HCLK) == RCC_HCLK_DIV256) || \
  2545. ((HCLK) == RCC_HCLK_DIV512))
  2546. #define IS_RCC_D1PCLK1(D1PCLK1) (((D1PCLK1) == RCC_APB3_DIV1) || ((D1PCLK1) == RCC_APB3_DIV2) || \
  2547. ((D1PCLK1) == RCC_APB3_DIV4) || ((D1PCLK1) == RCC_APB3_DIV8) || \
  2548. ((D1PCLK1) == RCC_APB3_DIV16))
  2549. #define IS_RCC_PCLK1(PCLK1) (((PCLK1) == RCC_APB1_DIV1) || ((PCLK1) == RCC_APB1_DIV2) || \
  2550. ((PCLK1) == RCC_APB1_DIV4) || ((PCLK1) == RCC_APB1_DIV8) || \
  2551. ((PCLK1) == RCC_APB1_DIV16))
  2552. #define IS_RCC_PCLK2(PCLK2) (((PCLK2) == RCC_APB2_DIV1) || ((PCLK2) == RCC_APB2_DIV2) || \
  2553. ((PCLK2) == RCC_APB2_DIV4) || ((PCLK2) == RCC_APB2_DIV8) || \
  2554. ((PCLK2) == RCC_APB2_DIV16))
  2555. #define IS_RCC_D3PCLK1(D3PCLK1) (((D3PCLK1) == RCC_APB4_DIV1) || ((D3PCLK1) == RCC_APB4_DIV2) || \
  2556. ((D3PCLK1) == RCC_APB4_DIV4) || ((D3PCLK1) == RCC_APB4_DIV8) || \
  2557. ((D3PCLK1) == RCC_APB4_DIV16))
  2558. #define IS_RCC_RTCCLKSOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSOURCE_LSE) || ((SOURCE) == RCC_RTCCLKSOURCE_LSI) || \
  2559. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV2) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV3) || \
  2560. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV4) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV5) || \
  2561. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV6) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV7) || \
  2562. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV8) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV9) || \
  2563. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV10) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV11) || \
  2564. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV12) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV13) || \
  2565. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV14) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV15) || \
  2566. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV16) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV17) || \
  2567. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV18) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV19) || \
  2568. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV20) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV21) || \
  2569. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV22) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV23) || \
  2570. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV24) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV25) || \
  2571. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV26) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV27) || \
  2572. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV28) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV29) || \
  2573. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV30) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV31) || \
  2574. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV32) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV33) || \
  2575. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV34) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV35) || \
  2576. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV36) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV37) || \
  2577. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV38) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV39) || \
  2578. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV40) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV41) || \
  2579. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV42) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV43) || \
  2580. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV44) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV45) || \
  2581. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV46) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV47) || \
  2582. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV48) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV49) || \
  2583. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV50) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV51) || \
  2584. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV52) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV53) || \
  2585. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV54) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV55) || \
  2586. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV56) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV57) || \
  2587. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV58) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV59) || \
  2588. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV60) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV61) || \
  2589. ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV62) || ((SOURCE) == RCC_RTCCLKSOURCE_HSE_DIV63))
  2590. #define IS_RCC_MCO(MCOx) (((MCOx) == RCC_MCO1) || ((MCOx) == RCC_MCO2))
  2591. #define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1SOURCE_HSI) || ((SOURCE) == RCC_MCO1SOURCE_LSE) || \
  2592. ((SOURCE) == RCC_MCO1SOURCE_HSE) || ((SOURCE) == RCC_MCO1SOURCE_PLL1QCLK) || \
  2593. ((SOURCE) == RCC_MCO1SOURCE_HSI48))
  2594. #define IS_RCC_MCO2SOURCE(SOURCE) (((SOURCE) == RCC_MCO2SOURCE_SYSCLK) || ((SOURCE) == RCC_MCO2SOURCE_PLL2PCLK) || \
  2595. ((SOURCE) == RCC_MCO2SOURCE_HSE) || ((SOURCE) == RCC_MCO2SOURCE_PLLCLK) || \
  2596. ((SOURCE) == RCC_MCO2SOURCE_CSICLK) || ((SOURCE) == RCC_MCO2SOURCE_LSICLK))
  2597. #define IS_RCC_MCODIV(DIV) (((DIV) == RCC_MCODIV_1) || ((DIV) == RCC_MCODIV_2) || \
  2598. ((DIV) == RCC_MCODIV_3) || ((DIV) == RCC_MCODIV_4) || \
  2599. ((DIV) == RCC_MCODIV_5) || ((DIV) == RCC_MCODIV_6) || \
  2600. ((DIV) == RCC_MCODIV_7) || ((DIV) == RCC_MCODIV_8) || \
  2601. ((DIV) == RCC_MCODIV_9) || ((DIV) == RCC_MCODIV_10) || \
  2602. ((DIV) == RCC_MCODIV_11) || ((DIV) == RCC_MCODIV_12) || \
  2603. ((DIV) == RCC_MCODIV_13) || ((DIV) == RCC_MCODIV_14) || \
  2604. ((DIV) == RCC_MCODIV_15))
  2605. #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_CSIRDY) || \
  2606. ((FLAG) == RCC_FLAG_HSI48RDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
  2607. ((FLAG) == RCC_FLAG_D1CKRDY) || ((FLAG) == RCC_FLAG_D2CKRDY) || \
  2608. ((FLAG) == RCC_FLAG_PLLRDY) || ((FLAG) == RCC_FLAG_PLL2RDY) || \
  2609. ((FLAG) == RCC_FLAG_PLL3RDY) || ((FLAG) == RCC_FLAG_LSERDY) || \
  2610. ((FLAG) == RCC_FLAG_LSIRDY) || ((FLAG) == RCC_FLAG_RMVF) || \
  2611. ((FLAG) == RCC_FLAG_CPURST) || ((FLAG) == RCC_FLAG_D1RST) || \
  2612. ((FLAG) == RCC_FLAG_D2RST) || ((FLAG) == RCC_FLAG_BORRST) || \
  2613. ((FLAG) == RCC_FLAG_PINRST) || ((FLAG) == RCC_FLAG_PORRST) || \
  2614. ((FLAG) == RCC_FLAG_SFTRST) || ((FLAG) == RCC_FLAG_IWDG1RST)|| \
  2615. ((FLAG) == RCC_FLAG_WWDGR1ST) || ((FLAG) == RCC_FLAG_LPWR1RST)|| \
  2616. ((FLAG) == RCC_FLAG_LPWR2RST) || ((FLAG) == RCC_FLAG_HSIDIV ))
  2617. #define IS_RCC_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0xFFF)
  2618. #define IS_RCC_CSICALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
  2619. #define IS_RCC_STOP_WAKEUPCLOCK(SOURCE) (((SOURCE) == RCC_STOP_WAKEUPCLOCK_CSI) || \
  2620. ((SOURCE) == RCC_STOP_WAKEUPCLOCK_HSI))
  2621. #define IS_RCC_STOP_KERWAKEUPCLOCK(SOURCE) (((SOURCE) == RCC_STOP_KERWAKEUPCLOCK_CSI) || \
  2622. ((SOURCE) == RCC_STOP_KERWAKEUPCLOCK_HSI))
  2623. /**
  2624. * @}
  2625. */
  2626. /**
  2627. * @}
  2628. */
  2629. /**
  2630. * @}
  2631. */
  2632. /**
  2633. * @}
  2634. */
  2635. #ifdef __cplusplus
  2636. }
  2637. #endif
  2638. #endif /* __STM32H7xx_HAL_RCC_H */
  2639. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/