stm32l4xx_ll_system.h 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_system.h
  4. * @author MCD Application Team
  5. * @brief Header file of SYSTEM LL module.
  6. *
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2017 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. @verbatim
  19. ==============================================================================
  20. ##### How to use this driver #####
  21. ==============================================================================
  22. [..]
  23. The LL SYSTEM driver contains a set of generic APIs that can be
  24. used by user:
  25. (+) Some of the FLASH features need to be handled in the SYSTEM file.
  26. (+) Access to DBGCMU registers
  27. (+) Access to SYSCFG registers
  28. (+) Access to VREFBUF registers
  29. @endverbatim
  30. ******************************************************************************
  31. */
  32. /* Define to prevent recursive inclusion -------------------------------------*/
  33. #ifndef STM32L4xx_LL_SYSTEM_H
  34. #define STM32L4xx_LL_SYSTEM_H
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. /* Includes ------------------------------------------------------------------*/
  39. #include "stm32l4xx.h"
  40. /** @addtogroup STM32L4xx_LL_Driver
  41. * @{
  42. */
  43. #if defined (FLASH) || defined (SYSCFG) || defined (DBGMCU) || defined (VREFBUF)
  44. /** @defgroup SYSTEM_LL SYSTEM
  45. * @{
  46. */
  47. /* Private types -------------------------------------------------------------*/
  48. /* Private variables ---------------------------------------------------------*/
  49. /* Private constants ---------------------------------------------------------*/
  50. /** @defgroup SYSTEM_LL_Private_Constants SYSTEM Private Constants
  51. * @{
  52. */
  53. #define LL_EXTI_REGISTER_PINPOS_SHFT 16U /*!< Define used to shift pin position in EXTICR register */
  54. /**
  55. * @brief Power-down in Run mode Flash key
  56. */
  57. #define FLASH_PDKEY1 0x04152637U /*!< Flash power down key1 */
  58. #define FLASH_PDKEY2 0xFAFBFCFDU /*!< Flash power down key2: used with FLASH_PDKEY1
  59. to unlock the RUN_PD bit in FLASH_ACR */
  60. /**
  61. * @}
  62. */
  63. /* Private macros ------------------------------------------------------------*/
  64. /* Exported types ------------------------------------------------------------*/
  65. /* Exported constants --------------------------------------------------------*/
  66. /** @defgroup SYSTEM_LL_Exported_Constants SYSTEM Exported Constants
  67. * @{
  68. */
  69. /** @defgroup SYSTEM_LL_EC_REMAP SYSCFG REMAP
  70. * @{
  71. */
  72. #define LL_SYSCFG_REMAP_FLASH 0x00000000U /*!< Main Flash memory mapped at 0x00000000 */
  73. #define LL_SYSCFG_REMAP_SYSTEMFLASH SYSCFG_MEMRMP_MEM_MODE_0 /*!< System Flash memory mapped at 0x00000000 */
  74. #define LL_SYSCFG_REMAP_SRAM (SYSCFG_MEMRMP_MEM_MODE_1 | SYSCFG_MEMRMP_MEM_MODE_0) /*!< SRAM1 mapped at 0x00000000 */
  75. #if defined(FMC_Bank1_R)
  76. #define LL_SYSCFG_REMAP_FMC SYSCFG_MEMRMP_MEM_MODE_1 /*!< FMC bank 1 (NOR/PSRAM 1 and 2) mapped at 0x00000000 */
  77. #endif /* FMC_Bank1_R */
  78. #define LL_SYSCFG_REMAP_QUADSPI (SYSCFG_MEMRMP_MEM_MODE_2 | SYSCFG_MEMRMP_MEM_MODE_1) /*!< QUADSPI memory mapped at 0x00000000 */
  79. /**
  80. * @}
  81. */
  82. #if defined(SYSCFG_MEMRMP_FB_MODE)
  83. /** @defgroup SYSTEM_LL_EC_BANKMODE SYSCFG BANK MODE
  84. * @{
  85. */
  86. #define LL_SYSCFG_BANKMODE_BANK1 0x00000000U /*!< Flash Bank1 mapped at 0x08000000 (and aliased @0x00000000)
  87. and Flash Bank2 mapped at 0x08080000 (and aliased at 0x00080000) */
  88. #define LL_SYSCFG_BANKMODE_BANK2 SYSCFG_MEMRMP_FB_MODE /*!< Flash Bank2 mapped at 0x08000000 (and aliased @0x00000000)
  89. and Flash Bank1 mapped at 0x08080000 (and aliased at 0x00080000) */
  90. /**
  91. * @}
  92. */
  93. #endif /* SYSCFG_MEMRMP_FB_MODE */
  94. /** @defgroup SYSTEM_LL_EC_I2C_FASTMODEPLUS SYSCFG I2C FASTMODEPLUS
  95. * @{
  96. */
  97. #define LL_SYSCFG_I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */
  98. #define LL_SYSCFG_I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */
  99. #if defined(SYSCFG_CFGR1_I2C_PB8_FMP)
  100. #define LL_SYSCFG_I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */
  101. #endif /* SYSCFG_CFGR1_I2C_PB8_FMP */
  102. #if defined(SYSCFG_CFGR1_I2C_PB9_FMP)
  103. #define LL_SYSCFG_I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */
  104. #endif /* SYSCFG_CFGR1_I2C_PB9_FMP */
  105. #define LL_SYSCFG_I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */
  106. #if defined(I2C2)
  107. #define LL_SYSCFG_I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */
  108. #endif /* I2C2 */
  109. #define LL_SYSCFG_I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */
  110. #if defined(I2C4)
  111. #define LL_SYSCFG_I2C_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */
  112. #endif /* I2C4 */
  113. /**
  114. * @}
  115. */
  116. /** @defgroup SYSTEM_LL_EC_EXTI_PORT SYSCFG EXTI PORT
  117. * @{
  118. */
  119. #define LL_SYSCFG_EXTI_PORTA 0U /*!< EXTI PORT A */
  120. #define LL_SYSCFG_EXTI_PORTB 1U /*!< EXTI PORT B */
  121. #define LL_SYSCFG_EXTI_PORTC 2U /*!< EXTI PORT C */
  122. #define LL_SYSCFG_EXTI_PORTD 3U /*!< EXTI PORT D */
  123. #define LL_SYSCFG_EXTI_PORTE 4U /*!< EXTI PORT E */
  124. #if defined(GPIOF)
  125. #define LL_SYSCFG_EXTI_PORTF 5U /*!< EXTI PORT F */
  126. #endif /* GPIOF */
  127. #if defined(GPIOG)
  128. #define LL_SYSCFG_EXTI_PORTG 6U /*!< EXTI PORT G */
  129. #endif /* GPIOG */
  130. #define LL_SYSCFG_EXTI_PORTH 7U /*!< EXTI PORT H */
  131. #if defined(GPIOI)
  132. #define LL_SYSCFG_EXTI_PORTI 8U /*!< EXTI PORT I */
  133. #endif /* GPIOI */
  134. /**
  135. * @}
  136. */
  137. /** @defgroup SYSTEM_LL_EC_EXTI_LINE SYSCFG EXTI LINE
  138. * @{
  139. */
  140. #define LL_SYSCFG_EXTI_LINE0 (uint32_t)((0x000FU << LL_EXTI_REGISTER_PINPOS_SHFT) | 0U) /* !< EXTI_POSITION_0 | EXTICR[0] */
  141. #define LL_SYSCFG_EXTI_LINE1 (uint32_t)((0x00F0U << LL_EXTI_REGISTER_PINPOS_SHFT) | 0U) /* !< EXTI_POSITION_4 | EXTICR[0] */
  142. #define LL_SYSCFG_EXTI_LINE2 (uint32_t)((0x0F00U << LL_EXTI_REGISTER_PINPOS_SHFT) | 0U) /* !< EXTI_POSITION_8 | EXTICR[0] */
  143. #define LL_SYSCFG_EXTI_LINE3 (uint32_t)((0xF000U << LL_EXTI_REGISTER_PINPOS_SHFT) | 0U) /* !< EXTI_POSITION_12 | EXTICR[0] */
  144. #define LL_SYSCFG_EXTI_LINE4 (uint32_t)((0x000FU << LL_EXTI_REGISTER_PINPOS_SHFT) | 1U) /* !< EXTI_POSITION_0 | EXTICR[1] */
  145. #define LL_SYSCFG_EXTI_LINE5 (uint32_t)((0x00F0U << LL_EXTI_REGISTER_PINPOS_SHFT) | 1U) /* !< EXTI_POSITION_4 | EXTICR[1] */
  146. #define LL_SYSCFG_EXTI_LINE6 (uint32_t)((0x0F00U << LL_EXTI_REGISTER_PINPOS_SHFT) | 1U) /* !< EXTI_POSITION_8 | EXTICR[1] */
  147. #define LL_SYSCFG_EXTI_LINE7 (uint32_t)((0xF000U << LL_EXTI_REGISTER_PINPOS_SHFT) | 1U) /* !< EXTI_POSITION_12 | EXTICR[1] */
  148. #define LL_SYSCFG_EXTI_LINE8 (uint32_t)((0x000FU << LL_EXTI_REGISTER_PINPOS_SHFT) | 2U) /* !< EXTI_POSITION_0 | EXTICR[2] */
  149. #define LL_SYSCFG_EXTI_LINE9 (uint32_t)((0x00F0U << LL_EXTI_REGISTER_PINPOS_SHFT) | 2U) /* !< EXTI_POSITION_4 | EXTICR[2] */
  150. #define LL_SYSCFG_EXTI_LINE10 (uint32_t)((0x0F00U << LL_EXTI_REGISTER_PINPOS_SHFT) | 2U) /* !< EXTI_POSITION_8 | EXTICR[2] */
  151. #define LL_SYSCFG_EXTI_LINE11 (uint32_t)((0xF000U << LL_EXTI_REGISTER_PINPOS_SHFT) | 2U) /* !< EXTI_POSITION_12 | EXTICR[2] */
  152. #define LL_SYSCFG_EXTI_LINE12 (uint32_t)((0x000FU << LL_EXTI_REGISTER_PINPOS_SHFT) | 3U) /* !< EXTI_POSITION_0 | EXTICR[3] */
  153. #define LL_SYSCFG_EXTI_LINE13 (uint32_t)((0x00F0U << LL_EXTI_REGISTER_PINPOS_SHFT) | 3U) /* !< EXTI_POSITION_4 | EXTICR[3] */
  154. #define LL_SYSCFG_EXTI_LINE14 (uint32_t)((0x0F00U << LL_EXTI_REGISTER_PINPOS_SHFT) | 3U) /* !< EXTI_POSITION_8 | EXTICR[3] */
  155. #define LL_SYSCFG_EXTI_LINE15 (uint32_t)((0xF000U << LL_EXTI_REGISTER_PINPOS_SHFT) | 3U) /* !< EXTI_POSITION_12 | EXTICR[3] */
  156. /**
  157. * @}
  158. */
  159. /** @defgroup SYSTEM_LL_EC_TIMBREAK SYSCFG TIMER BREAK
  160. * @{
  161. */
  162. #define LL_SYSCFG_TIMBREAK_ECC SYSCFG_CFGR2_ECCL /*!< Enables and locks the ECC error signal
  163. with Break Input of TIM1/8/15/16/17 */
  164. #define LL_SYSCFG_TIMBREAK_PVD SYSCFG_CFGR2_PVDL /*!< Enables and locks the PVD connection
  165. with TIM1/8/15/16/17 Break Input
  166. and also the PVDE and PLS bits of the Power Control Interface */
  167. #define LL_SYSCFG_TIMBREAK_SRAM2_PARITY SYSCFG_CFGR2_SPL /*!< Enables and locks the SRAM2_PARITY error signal
  168. with Break Input of TIM1/8/15/16/17 */
  169. #define LL_SYSCFG_TIMBREAK_LOCKUP SYSCFG_CFGR2_CLL /*!< Enables and locks the LOCKUP output of CortexM4
  170. with Break Input of TIM1/15/16/17 */
  171. /**
  172. * @}
  173. */
  174. /** @defgroup SYSTEM_LL_EC_SRAM2WRP SYSCFG SRAM2 WRP
  175. * @{
  176. */
  177. #define LL_SYSCFG_SRAM2WRP_PAGE0 SYSCFG_SWPR_PAGE0 /*!< SRAM2 Write protection page 0 */
  178. #define LL_SYSCFG_SRAM2WRP_PAGE1 SYSCFG_SWPR_PAGE1 /*!< SRAM2 Write protection page 1 */
  179. #define LL_SYSCFG_SRAM2WRP_PAGE2 SYSCFG_SWPR_PAGE2 /*!< SRAM2 Write protection page 2 */
  180. #define LL_SYSCFG_SRAM2WRP_PAGE3 SYSCFG_SWPR_PAGE3 /*!< SRAM2 Write protection page 3 */
  181. #define LL_SYSCFG_SRAM2WRP_PAGE4 SYSCFG_SWPR_PAGE4 /*!< SRAM2 Write protection page 4 */
  182. #define LL_SYSCFG_SRAM2WRP_PAGE5 SYSCFG_SWPR_PAGE5 /*!< SRAM2 Write protection page 5 */
  183. #define LL_SYSCFG_SRAM2WRP_PAGE6 SYSCFG_SWPR_PAGE6 /*!< SRAM2 Write protection page 6 */
  184. #define LL_SYSCFG_SRAM2WRP_PAGE7 SYSCFG_SWPR_PAGE7 /*!< SRAM2 Write protection page 7 */
  185. #define LL_SYSCFG_SRAM2WRP_PAGE8 SYSCFG_SWPR_PAGE8 /*!< SRAM2 Write protection page 8 */
  186. #define LL_SYSCFG_SRAM2WRP_PAGE9 SYSCFG_SWPR_PAGE9 /*!< SRAM2 Write protection page 9 */
  187. #define LL_SYSCFG_SRAM2WRP_PAGE10 SYSCFG_SWPR_PAGE10 /*!< SRAM2 Write protection page 10 */
  188. #define LL_SYSCFG_SRAM2WRP_PAGE11 SYSCFG_SWPR_PAGE11 /*!< SRAM2 Write protection page 11 */
  189. #define LL_SYSCFG_SRAM2WRP_PAGE12 SYSCFG_SWPR_PAGE12 /*!< SRAM2 Write protection page 12 */
  190. #define LL_SYSCFG_SRAM2WRP_PAGE13 SYSCFG_SWPR_PAGE13 /*!< SRAM2 Write protection page 13 */
  191. #define LL_SYSCFG_SRAM2WRP_PAGE14 SYSCFG_SWPR_PAGE14 /*!< SRAM2 Write protection page 14 */
  192. #define LL_SYSCFG_SRAM2WRP_PAGE15 SYSCFG_SWPR_PAGE15 /*!< SRAM2 Write protection page 15 */
  193. #if defined(SYSCFG_SWPR_PAGE31)
  194. #define LL_SYSCFG_SRAM2WRP_PAGE16 SYSCFG_SWPR_PAGE16 /*!< SRAM2 Write protection page 16 */
  195. #define LL_SYSCFG_SRAM2WRP_PAGE17 SYSCFG_SWPR_PAGE17 /*!< SRAM2 Write protection page 17 */
  196. #define LL_SYSCFG_SRAM2WRP_PAGE18 SYSCFG_SWPR_PAGE18 /*!< SRAM2 Write protection page 18 */
  197. #define LL_SYSCFG_SRAM2WRP_PAGE19 SYSCFG_SWPR_PAGE19 /*!< SRAM2 Write protection page 19 */
  198. #define LL_SYSCFG_SRAM2WRP_PAGE20 SYSCFG_SWPR_PAGE20 /*!< SRAM2 Write protection page 20 */
  199. #define LL_SYSCFG_SRAM2WRP_PAGE21 SYSCFG_SWPR_PAGE21 /*!< SRAM2 Write protection page 21 */
  200. #define LL_SYSCFG_SRAM2WRP_PAGE22 SYSCFG_SWPR_PAGE22 /*!< SRAM2 Write protection page 22 */
  201. #define LL_SYSCFG_SRAM2WRP_PAGE23 SYSCFG_SWPR_PAGE23 /*!< SRAM2 Write protection page 23 */
  202. #define LL_SYSCFG_SRAM2WRP_PAGE24 SYSCFG_SWPR_PAGE24 /*!< SRAM2 Write protection page 24 */
  203. #define LL_SYSCFG_SRAM2WRP_PAGE25 SYSCFG_SWPR_PAGE25 /*!< SRAM2 Write protection page 25 */
  204. #define LL_SYSCFG_SRAM2WRP_PAGE26 SYSCFG_SWPR_PAGE26 /*!< SRAM2 Write protection page 26 */
  205. #define LL_SYSCFG_SRAM2WRP_PAGE27 SYSCFG_SWPR_PAGE27 /*!< SRAM2 Write protection page 27 */
  206. #define LL_SYSCFG_SRAM2WRP_PAGE28 SYSCFG_SWPR_PAGE28 /*!< SRAM2 Write protection page 28 */
  207. #define LL_SYSCFG_SRAM2WRP_PAGE29 SYSCFG_SWPR_PAGE29 /*!< SRAM2 Write protection page 29 */
  208. #define LL_SYSCFG_SRAM2WRP_PAGE30 SYSCFG_SWPR_PAGE30 /*!< SRAM2 Write protection page 30 */
  209. #define LL_SYSCFG_SRAM2WRP_PAGE31 SYSCFG_SWPR_PAGE31 /*!< SRAM2 Write protection page 31 */
  210. #endif /* SYSCFG_SWPR_PAGE31 */
  211. #if defined(SYSCFG_SWPR2_PAGE63)
  212. #define LL_SYSCFG_SRAM2WRP_PAGE32 SYSCFG_SWPR2_PAGE32 /*!< SRAM2 Write protection page 32 */
  213. #define LL_SYSCFG_SRAM2WRP_PAGE33 SYSCFG_SWPR2_PAGE33 /*!< SRAM2 Write protection page 33 */
  214. #define LL_SYSCFG_SRAM2WRP_PAGE34 SYSCFG_SWPR2_PAGE34 /*!< SRAM2 Write protection page 34 */
  215. #define LL_SYSCFG_SRAM2WRP_PAGE35 SYSCFG_SWPR2_PAGE35 /*!< SRAM2 Write protection page 35 */
  216. #define LL_SYSCFG_SRAM2WRP_PAGE36 SYSCFG_SWPR2_PAGE36 /*!< SRAM2 Write protection page 36 */
  217. #define LL_SYSCFG_SRAM2WRP_PAGE37 SYSCFG_SWPR2_PAGE37 /*!< SRAM2 Write protection page 37 */
  218. #define LL_SYSCFG_SRAM2WRP_PAGE38 SYSCFG_SWPR2_PAGE38 /*!< SRAM2 Write protection page 38 */
  219. #define LL_SYSCFG_SRAM2WRP_PAGE39 SYSCFG_SWPR2_PAGE39 /*!< SRAM2 Write protection page 39 */
  220. #define LL_SYSCFG_SRAM2WRP_PAGE40 SYSCFG_SWPR2_PAGE40 /*!< SRAM2 Write protection page 40 */
  221. #define LL_SYSCFG_SRAM2WRP_PAGE41 SYSCFG_SWPR2_PAGE41 /*!< SRAM2 Write protection page 41 */
  222. #define LL_SYSCFG_SRAM2WRP_PAGE42 SYSCFG_SWPR2_PAGE42 /*!< SRAM2 Write protection page 42 */
  223. #define LL_SYSCFG_SRAM2WRP_PAGE43 SYSCFG_SWPR2_PAGE43 /*!< SRAM2 Write protection page 43 */
  224. #define LL_SYSCFG_SRAM2WRP_PAGE44 SYSCFG_SWPR2_PAGE44 /*!< SRAM2 Write protection page 44 */
  225. #define LL_SYSCFG_SRAM2WRP_PAGE45 SYSCFG_SWPR2_PAGE45 /*!< SRAM2 Write protection page 45 */
  226. #define LL_SYSCFG_SRAM2WRP_PAGE46 SYSCFG_SWPR2_PAGE46 /*!< SRAM2 Write protection page 46 */
  227. #define LL_SYSCFG_SRAM2WRP_PAGE47 SYSCFG_SWPR2_PAGE47 /*!< SRAM2 Write protection page 47 */
  228. #define LL_SYSCFG_SRAM2WRP_PAGE48 SYSCFG_SWPR2_PAGE48 /*!< SRAM2 Write protection page 48 */
  229. #define LL_SYSCFG_SRAM2WRP_PAGE49 SYSCFG_SWPR2_PAGE49 /*!< SRAM2 Write protection page 49 */
  230. #define LL_SYSCFG_SRAM2WRP_PAGE50 SYSCFG_SWPR2_PAGE50 /*!< SRAM2 Write protection page 50 */
  231. #define LL_SYSCFG_SRAM2WRP_PAGE51 SYSCFG_SWPR2_PAGE51 /*!< SRAM2 Write protection page 51 */
  232. #define LL_SYSCFG_SRAM2WRP_PAGE52 SYSCFG_SWPR2_PAGE52 /*!< SRAM2 Write protection page 52 */
  233. #define LL_SYSCFG_SRAM2WRP_PAGE53 SYSCFG_SWPR2_PAGE53 /*!< SRAM2 Write protection page 53 */
  234. #define LL_SYSCFG_SRAM2WRP_PAGE54 SYSCFG_SWPR2_PAGE54 /*!< SRAM2 Write protection page 54 */
  235. #define LL_SYSCFG_SRAM2WRP_PAGE55 SYSCFG_SWPR2_PAGE55 /*!< SRAM2 Write protection page 55 */
  236. #define LL_SYSCFG_SRAM2WRP_PAGE56 SYSCFG_SWPR2_PAGE56 /*!< SRAM2 Write protection page 56 */
  237. #define LL_SYSCFG_SRAM2WRP_PAGE57 SYSCFG_SWPR2_PAGE57 /*!< SRAM2 Write protection page 57 */
  238. #define LL_SYSCFG_SRAM2WRP_PAGE58 SYSCFG_SWPR2_PAGE58 /*!< SRAM2 Write protection page 58 */
  239. #define LL_SYSCFG_SRAM2WRP_PAGE59 SYSCFG_SWPR2_PAGE59 /*!< SRAM2 Write protection page 59 */
  240. #define LL_SYSCFG_SRAM2WRP_PAGE60 SYSCFG_SWPR2_PAGE60 /*!< SRAM2 Write protection page 60 */
  241. #define LL_SYSCFG_SRAM2WRP_PAGE61 SYSCFG_SWPR2_PAGE61 /*!< SRAM2 Write protection page 61 */
  242. #define LL_SYSCFG_SRAM2WRP_PAGE62 SYSCFG_SWPR2_PAGE62 /*!< SRAM2 Write protection page 62 */
  243. #define LL_SYSCFG_SRAM2WRP_PAGE63 SYSCFG_SWPR2_PAGE63 /*!< SRAM2 Write protection page 63 */
  244. #endif /* SYSCFG_SWPR2_PAGE63 */
  245. /**
  246. * @}
  247. */
  248. /** @defgroup SYSTEM_LL_EC_TRACE DBGMCU TRACE Pin Assignment
  249. * @{
  250. */
  251. #define LL_DBGMCU_TRACE_NONE 0x00000000U /*!< TRACE pins not assigned (default state) */
  252. #define LL_DBGMCU_TRACE_ASYNCH DBGMCU_CR_TRACE_IOEN /*!< TRACE pin assignment for Asynchronous Mode */
  253. #define LL_DBGMCU_TRACE_SYNCH_SIZE1 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE_0) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 1 */
  254. #define LL_DBGMCU_TRACE_SYNCH_SIZE2 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE_1) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 2 */
  255. #define LL_DBGMCU_TRACE_SYNCH_SIZE4 (DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE) /*!< TRACE pin assignment for Synchronous Mode with a TRACEDATA size of 4 */
  256. /**
  257. * @}
  258. */
  259. /** @defgroup SYSTEM_LL_EC_APB1_GRP1_STOP_IP DBGMCU APB1 GRP1 STOP IP
  260. * @{
  261. */
  262. #define LL_DBGMCU_APB1_GRP1_TIM2_STOP DBGMCU_APB1FZR1_DBG_TIM2_STOP /*!< The counter clock of TIM2 is stopped when the core is halted*/
  263. #if defined(TIM3)
  264. #define LL_DBGMCU_APB1_GRP1_TIM3_STOP DBGMCU_APB1FZR1_DBG_TIM3_STOP /*!< The counter clock of TIM3 is stopped when the core is halted*/
  265. #endif /* TIM3 */
  266. #if defined(TIM4)
  267. #define LL_DBGMCU_APB1_GRP1_TIM4_STOP DBGMCU_APB1FZR1_DBG_TIM4_STOP /*!< The counter clock of TIM4 is stopped when the core is halted*/
  268. #endif /* TIM4 */
  269. #if defined(TIM5)
  270. #define LL_DBGMCU_APB1_GRP1_TIM5_STOP DBGMCU_APB1FZR1_DBG_TIM5_STOP /*!< The counter clock of TIM5 is stopped when the core is halted*/
  271. #endif /* TIM5 */
  272. #define LL_DBGMCU_APB1_GRP1_TIM6_STOP DBGMCU_APB1FZR1_DBG_TIM6_STOP /*!< The counter clock of TIM6 is stopped when the core is halted*/
  273. #if defined(TIM7)
  274. #define LL_DBGMCU_APB1_GRP1_TIM7_STOP DBGMCU_APB1FZR1_DBG_TIM7_STOP /*!< The counter clock of TIM7 is stopped when the core is halted*/
  275. #endif /* TIM7 */
  276. #define LL_DBGMCU_APB1_GRP1_RTC_STOP DBGMCU_APB1FZR1_DBG_RTC_STOP /*!< The clock of the RTC counter is stopped when the core is halted*/
  277. #define LL_DBGMCU_APB1_GRP1_WWDG_STOP DBGMCU_APB1FZR1_DBG_WWDG_STOP /*!< The window watchdog counter clock is stopped when the core is halted*/
  278. #define LL_DBGMCU_APB1_GRP1_IWDG_STOP DBGMCU_APB1FZR1_DBG_IWDG_STOP /*!< The independent watchdog counter clock is stopped when the core is halted*/
  279. #define LL_DBGMCU_APB1_GRP1_I2C1_STOP DBGMCU_APB1FZR1_DBG_I2C1_STOP /*!< The I2C1 SMBus timeout is frozen*/
  280. #if defined(I2C2)
  281. #define LL_DBGMCU_APB1_GRP1_I2C2_STOP DBGMCU_APB1FZR1_DBG_I2C2_STOP /*!< The I2C2 SMBus timeout is frozen*/
  282. #endif /* I2C2 */
  283. #define LL_DBGMCU_APB1_GRP1_I2C3_STOP DBGMCU_APB1FZR1_DBG_I2C3_STOP /*!< The I2C3 SMBus timeout is frozen*/
  284. #define LL_DBGMCU_APB1_GRP1_CAN_STOP DBGMCU_APB1FZR1_DBG_CAN_STOP /*!< The bxCAN receive registers are frozen*/
  285. #if defined(CAN2)
  286. #define LL_DBGMCU_APB1_GRP1_CAN2_STOP DBGMCU_APB1FZR1_DBG_CAN2_STOP /*!< The bxCAN2 receive registers are frozen*/
  287. #endif /* CAN2 */
  288. #define LL_DBGMCU_APB1_GRP1_LPTIM1_STOP DBGMCU_APB1FZR1_DBG_LPTIM1_STOP /*!< The counter clock of LPTIM1 is stopped when the core is halted*/
  289. /**
  290. * @}
  291. */
  292. /** @defgroup SYSTEM_LL_EC_APB1_GRP2_STOP_IP DBGMCU APB1 GRP2 STOP IP
  293. * @{
  294. */
  295. #if defined(I2C4)
  296. #define LL_DBGMCU_APB1_GRP2_I2C4_STOP DBGMCU_APB1FZR2_DBG_I2C4_STOP /*!< The I2C4 SMBus timeout is frozen*/
  297. #endif /* I2C4 */
  298. #define LL_DBGMCU_APB1_GRP2_LPTIM2_STOP DBGMCU_APB1FZR2_DBG_LPTIM2_STOP /*!< The counter clock of LPTIM2 is stopped when the core is halted*/
  299. /**
  300. * @}
  301. */
  302. /** @defgroup SYSTEM_LL_EC_APB2_GRP1_STOP_IP DBGMCU APB2 GRP1 STOP IP
  303. * @{
  304. */
  305. #define LL_DBGMCU_APB2_GRP1_TIM1_STOP DBGMCU_APB2FZ_DBG_TIM1_STOP /*!< The counter clock of TIM1 is stopped when the core is halted*/
  306. #if defined(TIM8)
  307. #define LL_DBGMCU_APB2_GRP1_TIM8_STOP DBGMCU_APB2FZ_DBG_TIM8_STOP /*!< The counter clock of TIM8 is stopped when the core is halted*/
  308. #endif /* TIM8 */
  309. #define LL_DBGMCU_APB2_GRP1_TIM15_STOP DBGMCU_APB2FZ_DBG_TIM15_STOP /*!< The counter clock of TIM15 is stopped when the core is halted*/
  310. #define LL_DBGMCU_APB2_GRP1_TIM16_STOP DBGMCU_APB2FZ_DBG_TIM16_STOP /*!< The counter clock of TIM16 is stopped when the core is halted*/
  311. #if defined(TIM17)
  312. #define LL_DBGMCU_APB2_GRP1_TIM17_STOP DBGMCU_APB2FZ_DBG_TIM17_STOP /*!< The counter clock of TIM17 is stopped when the core is halted*/
  313. #endif /* TIM17 */
  314. /**
  315. * @}
  316. */
  317. #if defined(VREFBUF)
  318. /** @defgroup SYSTEM_LL_EC_VOLTAGE VREFBUF VOLTAGE
  319. * @{
  320. */
  321. #define LL_VREFBUF_VOLTAGE_SCALE0 ((uint32_t)0x00000000) /*!< Voltage reference scale 0 (VREF_OUT1) */
  322. #define LL_VREFBUF_VOLTAGE_SCALE1 VREFBUF_CSR_VRS /*!< Voltage reference scale 1 (VREF_OUT2) */
  323. /**
  324. * @}
  325. */
  326. #endif /* VREFBUF */
  327. /** @defgroup SYSTEM_LL_EC_LATENCY FLASH LATENCY
  328. * @{
  329. */
  330. #define LL_FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero wait state */
  331. #define LL_FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One wait state */
  332. #define LL_FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two wait states */
  333. #define LL_FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three wait states */
  334. #define LL_FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four wait states */
  335. #if defined(FLASH_ACR_LATENCY_5WS)
  336. #define LL_FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH five wait state */
  337. #define LL_FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH six wait state */
  338. #define LL_FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH seven wait states */
  339. #define LL_FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH eight wait states */
  340. #define LL_FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH nine wait states */
  341. #define LL_FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH ten wait states */
  342. #define LL_FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH eleven wait states */
  343. #define LL_FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH twelve wait states */
  344. #define LL_FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH thirteen wait states */
  345. #define LL_FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH fourteen wait states */
  346. #define LL_FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH fifteen wait states */
  347. #endif
  348. /**
  349. * @}
  350. */
  351. /**
  352. * @}
  353. */
  354. /* Exported macro ------------------------------------------------------------*/
  355. /* Exported functions --------------------------------------------------------*/
  356. /** @defgroup SYSTEM_LL_Exported_Functions SYSTEM Exported Functions
  357. * @{
  358. */
  359. /** @defgroup SYSTEM_LL_EF_SYSCFG SYSCFG
  360. * @{
  361. */
  362. /**
  363. * @brief Set memory mapping at address 0x00000000
  364. * @rmtoll SYSCFG_MEMRMP MEM_MODE LL_SYSCFG_SetRemapMemory
  365. * @param Memory This parameter can be one of the following values:
  366. * @arg @ref LL_SYSCFG_REMAP_FLASH
  367. * @arg @ref LL_SYSCFG_REMAP_SYSTEMFLASH
  368. * @arg @ref LL_SYSCFG_REMAP_SRAM
  369. * @arg @ref LL_SYSCFG_REMAP_FMC (*)
  370. * @arg @ref LL_SYSCFG_REMAP_QUADSPI
  371. *
  372. * (*) value not defined in all devices
  373. * @retval None
  374. */
  375. __STATIC_INLINE void LL_SYSCFG_SetRemapMemory(uint32_t Memory)
  376. {
  377. MODIFY_REG(SYSCFG->MEMRMP, SYSCFG_MEMRMP_MEM_MODE, Memory);
  378. }
  379. /**
  380. * @brief Get memory mapping at address 0x00000000
  381. * @rmtoll SYSCFG_MEMRMP MEM_MODE LL_SYSCFG_GetRemapMemory
  382. * @retval Returned value can be one of the following values:
  383. * @arg @ref LL_SYSCFG_REMAP_FLASH
  384. * @arg @ref LL_SYSCFG_REMAP_SYSTEMFLASH
  385. * @arg @ref LL_SYSCFG_REMAP_SRAM
  386. * @arg @ref LL_SYSCFG_REMAP_FMC (*)
  387. * @arg @ref LL_SYSCFG_REMAP_QUADSPI
  388. *
  389. * (*) value not defined in all devices
  390. */
  391. __STATIC_INLINE uint32_t LL_SYSCFG_GetRemapMemory(void)
  392. {
  393. return (uint32_t)(READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_MEM_MODE));
  394. }
  395. #if defined(SYSCFG_MEMRMP_FB_MODE)
  396. /**
  397. * @brief Select Flash bank mode (Bank flashed at 0x08000000)
  398. * @rmtoll SYSCFG_MEMRMP FB_MODE LL_SYSCFG_SetFlashBankMode
  399. * @param Bank This parameter can be one of the following values:
  400. * @arg @ref LL_SYSCFG_BANKMODE_BANK1
  401. * @arg @ref LL_SYSCFG_BANKMODE_BANK2
  402. * @retval None
  403. */
  404. __STATIC_INLINE void LL_SYSCFG_SetFlashBankMode(uint32_t Bank)
  405. {
  406. MODIFY_REG(SYSCFG->MEMRMP, SYSCFG_MEMRMP_FB_MODE, Bank);
  407. }
  408. /**
  409. * @brief Get Flash bank mode (Bank flashed at 0x08000000)
  410. * @rmtoll SYSCFG_MEMRMP FB_MODE LL_SYSCFG_GetFlashBankMode
  411. * @retval Returned value can be one of the following values:
  412. * @arg @ref LL_SYSCFG_BANKMODE_BANK1
  413. * @arg @ref LL_SYSCFG_BANKMODE_BANK2
  414. */
  415. __STATIC_INLINE uint32_t LL_SYSCFG_GetFlashBankMode(void)
  416. {
  417. return (uint32_t)(READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_FB_MODE));
  418. }
  419. #endif /* SYSCFG_MEMRMP_FB_MODE */
  420. /**
  421. * @brief Firewall protection enabled
  422. * @rmtoll SYSCFG_CFGR1 FWDIS LL_SYSCFG_EnableFirewall
  423. * @retval None
  424. */
  425. __STATIC_INLINE void LL_SYSCFG_EnableFirewall(void)
  426. {
  427. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FWDIS);
  428. }
  429. /**
  430. * @brief Check if Firewall protection is enabled or not
  431. * @rmtoll SYSCFG_CFGR1 FWDIS LL_SYSCFG_IsEnabledFirewall
  432. * @retval State of bit (1 or 0).
  433. */
  434. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledFirewall(void)
  435. {
  436. return !(READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FWDIS) == SYSCFG_CFGR1_FWDIS);
  437. }
  438. /**
  439. * @brief Enable I/O analog switch voltage booster.
  440. * @note When voltage booster is enabled, I/O analog switches are supplied
  441. * by a dedicated voltage booster, from VDD power domain. This is
  442. * the recommended configuration with low VDDA voltage operation.
  443. * @note The I/O analog switch voltage booster is relevant for peripherals
  444. * using I/O in analog input: ADC, COMP, OPAMP.
  445. * However, COMP and OPAMP inputs have a high impedance and
  446. * voltage booster do not impact performance significantly.
  447. * Therefore, the voltage booster is mainly intended for
  448. * usage with ADC.
  449. * @rmtoll SYSCFG_CFGR1 BOOSTEN LL_SYSCFG_EnableAnalogBooster
  450. * @retval None
  451. */
  452. __STATIC_INLINE void LL_SYSCFG_EnableAnalogBooster(void)
  453. {
  454. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_BOOSTEN);
  455. }
  456. /**
  457. * @brief Disable I/O analog switch voltage booster.
  458. * @note When voltage booster is enabled, I/O analog switches are supplied
  459. * by a dedicated voltage booster, from VDD power domain. This is
  460. * the recommended configuration with low VDDA voltage operation.
  461. * @note The I/O analog switch voltage booster is relevant for peripherals
  462. * using I/O in analog input: ADC, COMP, OPAMP.
  463. * However, COMP and OPAMP inputs have a high impedance and
  464. * voltage booster do not impact performance significantly.
  465. * Therefore, the voltage booster is mainly intended for
  466. * usage with ADC.
  467. * @rmtoll SYSCFG_CFGR1 BOOSTEN LL_SYSCFG_DisableAnalogBooster
  468. * @retval None
  469. */
  470. __STATIC_INLINE void LL_SYSCFG_DisableAnalogBooster(void)
  471. {
  472. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_BOOSTEN);
  473. }
  474. /**
  475. * @brief Enable the I2C fast mode plus driving capability.
  476. * @rmtoll SYSCFG_CFGR1 I2C_PBx_FMP LL_SYSCFG_EnableFastModePlus\n
  477. * SYSCFG_CFGR1 I2Cx_FMP LL_SYSCFG_EnableFastModePlus
  478. * @param ConfigFastModePlus This parameter can be a combination of the following values:
  479. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB6
  480. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB7
  481. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB8 (*)
  482. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB9 (*)
  483. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C1
  484. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C2 (*)
  485. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C3
  486. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C4 (*)
  487. *
  488. * (*) value not defined in all devices
  489. * @retval None
  490. */
  491. __STATIC_INLINE void LL_SYSCFG_EnableFastModePlus(uint32_t ConfigFastModePlus)
  492. {
  493. SET_BIT(SYSCFG->CFGR1, ConfigFastModePlus);
  494. }
  495. /**
  496. * @brief Disable the I2C fast mode plus driving capability.
  497. * @rmtoll SYSCFG_CFGR1 I2C_PBx_FMP LL_SYSCFG_DisableFastModePlus\n
  498. * SYSCFG_CFGR1 I2Cx_FMP LL_SYSCFG_DisableFastModePlus
  499. * @param ConfigFastModePlus This parameter can be a combination of the following values:
  500. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB6
  501. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB7
  502. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB8 (*)
  503. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_PB9 (*)
  504. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C1
  505. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C2 (*)
  506. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C3
  507. * @arg @ref LL_SYSCFG_I2C_FASTMODEPLUS_I2C4 (*)
  508. *
  509. * (*) value not defined in all devices
  510. * @retval None
  511. */
  512. __STATIC_INLINE void LL_SYSCFG_DisableFastModePlus(uint32_t ConfigFastModePlus)
  513. {
  514. CLEAR_BIT(SYSCFG->CFGR1, ConfigFastModePlus);
  515. }
  516. /**
  517. * @brief Enable Floating Point Unit Invalid operation Interrupt
  518. * @rmtoll SYSCFG_CFGR1 FPU_IE_0 LL_SYSCFG_EnableIT_FPU_IOC
  519. * @retval None
  520. */
  521. __STATIC_INLINE void LL_SYSCFG_EnableIT_FPU_IOC(void)
  522. {
  523. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_0);
  524. }
  525. /**
  526. * @brief Enable Floating Point Unit Divide-by-zero Interrupt
  527. * @rmtoll SYSCFG_CFGR1 FPU_IE_1 LL_SYSCFG_EnableIT_FPU_DZC
  528. * @retval None
  529. */
  530. __STATIC_INLINE void LL_SYSCFG_EnableIT_FPU_DZC(void)
  531. {
  532. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_1);
  533. }
  534. /**
  535. * @brief Enable Floating Point Unit Underflow Interrupt
  536. * @rmtoll SYSCFG_CFGR1 FPU_IE_2 LL_SYSCFG_EnableIT_FPU_UFC
  537. * @retval None
  538. */
  539. __STATIC_INLINE void LL_SYSCFG_EnableIT_FPU_UFC(void)
  540. {
  541. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_2);
  542. }
  543. /**
  544. * @brief Enable Floating Point Unit Overflow Interrupt
  545. * @rmtoll SYSCFG_CFGR1 FPU_IE_3 LL_SYSCFG_EnableIT_FPU_OFC
  546. * @retval None
  547. */
  548. __STATIC_INLINE void LL_SYSCFG_EnableIT_FPU_OFC(void)
  549. {
  550. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_3);
  551. }
  552. /**
  553. * @brief Enable Floating Point Unit Input denormal Interrupt
  554. * @rmtoll SYSCFG_CFGR1 FPU_IE_4 LL_SYSCFG_EnableIT_FPU_IDC
  555. * @retval None
  556. */
  557. __STATIC_INLINE void LL_SYSCFG_EnableIT_FPU_IDC(void)
  558. {
  559. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_4);
  560. }
  561. /**
  562. * @brief Enable Floating Point Unit Inexact Interrupt
  563. * @rmtoll SYSCFG_CFGR1 FPU_IE_5 LL_SYSCFG_EnableIT_FPU_IXC
  564. * @retval None
  565. */
  566. __STATIC_INLINE void LL_SYSCFG_EnableIT_FPU_IXC(void)
  567. {
  568. SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_5);
  569. }
  570. /**
  571. * @brief Disable Floating Point Unit Invalid operation Interrupt
  572. * @rmtoll SYSCFG_CFGR1 FPU_IE_0 LL_SYSCFG_DisableIT_FPU_IOC
  573. * @retval None
  574. */
  575. __STATIC_INLINE void LL_SYSCFG_DisableIT_FPU_IOC(void)
  576. {
  577. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_0);
  578. }
  579. /**
  580. * @brief Disable Floating Point Unit Divide-by-zero Interrupt
  581. * @rmtoll SYSCFG_CFGR1 FPU_IE_1 LL_SYSCFG_DisableIT_FPU_DZC
  582. * @retval None
  583. */
  584. __STATIC_INLINE void LL_SYSCFG_DisableIT_FPU_DZC(void)
  585. {
  586. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_1);
  587. }
  588. /**
  589. * @brief Disable Floating Point Unit Underflow Interrupt
  590. * @rmtoll SYSCFG_CFGR1 FPU_IE_2 LL_SYSCFG_DisableIT_FPU_UFC
  591. * @retval None
  592. */
  593. __STATIC_INLINE void LL_SYSCFG_DisableIT_FPU_UFC(void)
  594. {
  595. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_2);
  596. }
  597. /**
  598. * @brief Disable Floating Point Unit Overflow Interrupt
  599. * @rmtoll SYSCFG_CFGR1 FPU_IE_3 LL_SYSCFG_DisableIT_FPU_OFC
  600. * @retval None
  601. */
  602. __STATIC_INLINE void LL_SYSCFG_DisableIT_FPU_OFC(void)
  603. {
  604. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_3);
  605. }
  606. /**
  607. * @brief Disable Floating Point Unit Input denormal Interrupt
  608. * @rmtoll SYSCFG_CFGR1 FPU_IE_4 LL_SYSCFG_DisableIT_FPU_IDC
  609. * @retval None
  610. */
  611. __STATIC_INLINE void LL_SYSCFG_DisableIT_FPU_IDC(void)
  612. {
  613. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_4);
  614. }
  615. /**
  616. * @brief Disable Floating Point Unit Inexact Interrupt
  617. * @rmtoll SYSCFG_CFGR1 FPU_IE_5 LL_SYSCFG_DisableIT_FPU_IXC
  618. * @retval None
  619. */
  620. __STATIC_INLINE void LL_SYSCFG_DisableIT_FPU_IXC(void)
  621. {
  622. CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_5);
  623. }
  624. /**
  625. * @brief Check if Floating Point Unit Invalid operation Interrupt source is enabled or disabled.
  626. * @rmtoll SYSCFG_CFGR1 FPU_IE_0 LL_SYSCFG_IsEnabledIT_FPU_IOC
  627. * @retval State of bit (1 or 0).
  628. */
  629. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledIT_FPU_IOC(void)
  630. {
  631. return (READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_0) == (SYSCFG_CFGR1_FPU_IE_0));
  632. }
  633. /**
  634. * @brief Check if Floating Point Unit Divide-by-zero Interrupt source is enabled or disabled.
  635. * @rmtoll SYSCFG_CFGR1 FPU_IE_1 LL_SYSCFG_IsEnabledIT_FPU_DZC
  636. * @retval State of bit (1 or 0).
  637. */
  638. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledIT_FPU_DZC(void)
  639. {
  640. return (READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_1) == (SYSCFG_CFGR1_FPU_IE_1));
  641. }
  642. /**
  643. * @brief Check if Floating Point Unit Underflow Interrupt source is enabled or disabled.
  644. * @rmtoll SYSCFG_CFGR1 FPU_IE_2 LL_SYSCFG_IsEnabledIT_FPU_UFC
  645. * @retval State of bit (1 or 0).
  646. */
  647. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledIT_FPU_UFC(void)
  648. {
  649. return (READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_2) == (SYSCFG_CFGR1_FPU_IE_2));
  650. }
  651. /**
  652. * @brief Check if Floating Point Unit Overflow Interrupt source is enabled or disabled.
  653. * @rmtoll SYSCFG_CFGR1 FPU_IE_3 LL_SYSCFG_IsEnabledIT_FPU_OFC
  654. * @retval State of bit (1 or 0).
  655. */
  656. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledIT_FPU_OFC(void)
  657. {
  658. return (READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_3) == (SYSCFG_CFGR1_FPU_IE_3));
  659. }
  660. /**
  661. * @brief Check if Floating Point Unit Input denormal Interrupt source is enabled or disabled.
  662. * @rmtoll SYSCFG_CFGR1 FPU_IE_4 LL_SYSCFG_IsEnabledIT_FPU_IDC
  663. * @retval State of bit (1 or 0).
  664. */
  665. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledIT_FPU_IDC(void)
  666. {
  667. return (READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_4) == (SYSCFG_CFGR1_FPU_IE_4));
  668. }
  669. /**
  670. * @brief Check if Floating Point Unit Inexact Interrupt source is enabled or disabled.
  671. * @rmtoll SYSCFG_CFGR1 FPU_IE_5 LL_SYSCFG_IsEnabledIT_FPU_IXC
  672. * @retval State of bit (1 or 0).
  673. */
  674. __STATIC_INLINE uint32_t LL_SYSCFG_IsEnabledIT_FPU_IXC(void)
  675. {
  676. return (READ_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FPU_IE_5) == (SYSCFG_CFGR1_FPU_IE_5));
  677. }
  678. /**
  679. * @brief Configure source input for the EXTI external interrupt.
  680. * @rmtoll SYSCFG_EXTICR1 EXTIx LL_SYSCFG_SetEXTISource\n
  681. * SYSCFG_EXTICR2 EXTIx LL_SYSCFG_SetEXTISource\n
  682. * SYSCFG_EXTICR3 EXTIx LL_SYSCFG_SetEXTISource\n
  683. * SYSCFG_EXTICR4 EXTIx LL_SYSCFG_SetEXTISource
  684. * @param Port This parameter can be one of the following values:
  685. * @arg @ref LL_SYSCFG_EXTI_PORTA
  686. * @arg @ref LL_SYSCFG_EXTI_PORTB
  687. * @arg @ref LL_SYSCFG_EXTI_PORTC
  688. * @arg @ref LL_SYSCFG_EXTI_PORTD
  689. * @arg @ref LL_SYSCFG_EXTI_PORTE
  690. * @arg @ref LL_SYSCFG_EXTI_PORTF (*)
  691. * @arg @ref LL_SYSCFG_EXTI_PORTG (*)
  692. * @arg @ref LL_SYSCFG_EXTI_PORTH
  693. * @arg @ref LL_SYSCFG_EXTI_PORTI (*)
  694. *
  695. * (*) value not defined in all devices
  696. * @param Line This parameter can be one of the following values:
  697. * @arg @ref LL_SYSCFG_EXTI_LINE0
  698. * @arg @ref LL_SYSCFG_EXTI_LINE1
  699. * @arg @ref LL_SYSCFG_EXTI_LINE2
  700. * @arg @ref LL_SYSCFG_EXTI_LINE3
  701. * @arg @ref LL_SYSCFG_EXTI_LINE4
  702. * @arg @ref LL_SYSCFG_EXTI_LINE5
  703. * @arg @ref LL_SYSCFG_EXTI_LINE6
  704. * @arg @ref LL_SYSCFG_EXTI_LINE7
  705. * @arg @ref LL_SYSCFG_EXTI_LINE8
  706. * @arg @ref LL_SYSCFG_EXTI_LINE9
  707. * @arg @ref LL_SYSCFG_EXTI_LINE10
  708. * @arg @ref LL_SYSCFG_EXTI_LINE11
  709. * @arg @ref LL_SYSCFG_EXTI_LINE12
  710. * @arg @ref LL_SYSCFG_EXTI_LINE13
  711. * @arg @ref LL_SYSCFG_EXTI_LINE14
  712. * @arg @ref LL_SYSCFG_EXTI_LINE15
  713. * @retval None
  714. */
  715. __STATIC_INLINE void LL_SYSCFG_SetEXTISource(uint32_t Port, uint32_t Line)
  716. {
  717. MODIFY_REG(SYSCFG->EXTICR[Line & 0x03U], (Line >> LL_EXTI_REGISTER_PINPOS_SHFT), Port << POSITION_VAL((Line >> LL_EXTI_REGISTER_PINPOS_SHFT)));
  718. }
  719. /**
  720. * @brief Get the configured defined for specific EXTI Line
  721. * @rmtoll SYSCFG_EXTICR1 EXTIx LL_SYSCFG_GetEXTISource\n
  722. * SYSCFG_EXTICR2 EXTIx LL_SYSCFG_GetEXTISource\n
  723. * SYSCFG_EXTICR3 EXTIx LL_SYSCFG_GetEXTISource\n
  724. * SYSCFG_EXTICR4 EXTIx LL_SYSCFG_GetEXTISource
  725. * @param Line This parameter can be one of the following values:
  726. * @arg @ref LL_SYSCFG_EXTI_LINE0
  727. * @arg @ref LL_SYSCFG_EXTI_LINE1
  728. * @arg @ref LL_SYSCFG_EXTI_LINE2
  729. * @arg @ref LL_SYSCFG_EXTI_LINE3
  730. * @arg @ref LL_SYSCFG_EXTI_LINE4
  731. * @arg @ref LL_SYSCFG_EXTI_LINE5
  732. * @arg @ref LL_SYSCFG_EXTI_LINE6
  733. * @arg @ref LL_SYSCFG_EXTI_LINE7
  734. * @arg @ref LL_SYSCFG_EXTI_LINE8
  735. * @arg @ref LL_SYSCFG_EXTI_LINE9
  736. * @arg @ref LL_SYSCFG_EXTI_LINE10
  737. * @arg @ref LL_SYSCFG_EXTI_LINE11
  738. * @arg @ref LL_SYSCFG_EXTI_LINE12
  739. * @arg @ref LL_SYSCFG_EXTI_LINE13
  740. * @arg @ref LL_SYSCFG_EXTI_LINE14
  741. * @arg @ref LL_SYSCFG_EXTI_LINE15
  742. * @retval Returned value can be one of the following values:
  743. * @arg @ref LL_SYSCFG_EXTI_PORTA
  744. * @arg @ref LL_SYSCFG_EXTI_PORTB
  745. * @arg @ref LL_SYSCFG_EXTI_PORTC
  746. * @arg @ref LL_SYSCFG_EXTI_PORTD
  747. * @arg @ref LL_SYSCFG_EXTI_PORTE
  748. * @arg @ref LL_SYSCFG_EXTI_PORTF (*)
  749. * @arg @ref LL_SYSCFG_EXTI_PORTG (*)
  750. * @arg @ref LL_SYSCFG_EXTI_PORTH
  751. * @arg @ref LL_SYSCFG_EXTI_PORTI (*)
  752. *
  753. * (*) value not defined in all devices
  754. */
  755. __STATIC_INLINE uint32_t LL_SYSCFG_GetEXTISource(uint32_t Line)
  756. {
  757. return (uint32_t)(READ_BIT(SYSCFG->EXTICR[Line & 0x03U], (Line >> LL_EXTI_REGISTER_PINPOS_SHFT)) >> POSITION_VAL(Line >> LL_EXTI_REGISTER_PINPOS_SHFT));
  758. }
  759. /**
  760. * @brief Enable SRAM2 Erase (starts a hardware SRAM2 erase operation. This bit is
  761. * automatically cleared at the end of the SRAM2 erase operation.)
  762. * @note This bit is write-protected: setting this bit is possible only after the
  763. * correct key sequence is written in the SYSCFG_SKR register as described in
  764. * the Reference Manual.
  765. * @rmtoll SYSCFG_SCSR SRAM2ER LL_SYSCFG_EnableSRAM2Erase
  766. * @retval None
  767. */
  768. __STATIC_INLINE void LL_SYSCFG_EnableSRAM2Erase(void)
  769. {
  770. /* Starts a hardware SRAM2 erase operation*/
  771. SET_BIT(SYSCFG->SCSR, SYSCFG_SCSR_SRAM2ER);
  772. }
  773. /**
  774. * @brief Check if SRAM2 erase operation is on going
  775. * @rmtoll SYSCFG_SCSR SRAM2BSY LL_SYSCFG_IsSRAM2EraseOngoing
  776. * @retval State of bit (1 or 0).
  777. */
  778. __STATIC_INLINE uint32_t LL_SYSCFG_IsSRAM2EraseOngoing(void)
  779. {
  780. return (READ_BIT(SYSCFG->SCSR, SYSCFG_SCSR_SRAM2BSY) == (SYSCFG_SCSR_SRAM2BSY));
  781. }
  782. /**
  783. * @brief Set connections to TIM1/8/15/16/17 Break inputs
  784. * @rmtoll SYSCFG_CFGR2 CLL LL_SYSCFG_SetTIMBreakInputs\n
  785. * SYSCFG_CFGR2 SPL LL_SYSCFG_SetTIMBreakInputs\n
  786. * SYSCFG_CFGR2 PVDL LL_SYSCFG_SetTIMBreakInputs\n
  787. * SYSCFG_CFGR2 ECCL LL_SYSCFG_SetTIMBreakInputs
  788. * @param Break This parameter can be a combination of the following values:
  789. * @arg @ref LL_SYSCFG_TIMBREAK_ECC
  790. * @arg @ref LL_SYSCFG_TIMBREAK_PVD
  791. * @arg @ref LL_SYSCFG_TIMBREAK_SRAM2_PARITY
  792. * @arg @ref LL_SYSCFG_TIMBREAK_LOCKUP
  793. * @retval None
  794. */
  795. __STATIC_INLINE void LL_SYSCFG_SetTIMBreakInputs(uint32_t Break)
  796. {
  797. MODIFY_REG(SYSCFG->CFGR2, SYSCFG_CFGR2_CLL | SYSCFG_CFGR2_SPL | SYSCFG_CFGR2_PVDL | SYSCFG_CFGR2_ECCL, Break);
  798. }
  799. /**
  800. * @brief Get connections to TIM1/8/15/16/17 Break inputs
  801. * @rmtoll SYSCFG_CFGR2 CLL LL_SYSCFG_GetTIMBreakInputs\n
  802. * SYSCFG_CFGR2 SPL LL_SYSCFG_GetTIMBreakInputs\n
  803. * SYSCFG_CFGR2 PVDL LL_SYSCFG_GetTIMBreakInputs\n
  804. * SYSCFG_CFGR2 ECCL LL_SYSCFG_GetTIMBreakInputs
  805. * @retval Returned value can be can be a combination of the following values:
  806. * @arg @ref LL_SYSCFG_TIMBREAK_ECC
  807. * @arg @ref LL_SYSCFG_TIMBREAK_PVD
  808. * @arg @ref LL_SYSCFG_TIMBREAK_SRAM2_PARITY
  809. * @arg @ref LL_SYSCFG_TIMBREAK_LOCKUP
  810. */
  811. __STATIC_INLINE uint32_t LL_SYSCFG_GetTIMBreakInputs(void)
  812. {
  813. return (uint32_t)(READ_BIT(SYSCFG->CFGR2, SYSCFG_CFGR2_CLL | SYSCFG_CFGR2_SPL | SYSCFG_CFGR2_PVDL | SYSCFG_CFGR2_ECCL));
  814. }
  815. /**
  816. * @brief Check if SRAM2 parity error detected
  817. * @rmtoll SYSCFG_CFGR2 SPF LL_SYSCFG_IsActiveFlag_SP
  818. * @retval State of bit (1 or 0).
  819. */
  820. __STATIC_INLINE uint32_t LL_SYSCFG_IsActiveFlag_SP(void)
  821. {
  822. return (READ_BIT(SYSCFG->CFGR2, SYSCFG_CFGR2_SPF) == (SYSCFG_CFGR2_SPF));
  823. }
  824. /**
  825. * @brief Clear SRAM2 parity error flag
  826. * @rmtoll SYSCFG_CFGR2 SPF LL_SYSCFG_ClearFlag_SP
  827. * @retval None
  828. */
  829. __STATIC_INLINE void LL_SYSCFG_ClearFlag_SP(void)
  830. {
  831. SET_BIT(SYSCFG->CFGR2, SYSCFG_CFGR2_SPF);
  832. }
  833. /**
  834. * @brief Enable SRAM2 page write protection for Pages in range 0 to 31
  835. * @note Write protection is cleared only by a system reset
  836. * @rmtoll SYSCFG_SWPR PxWP LL_SYSCFG_EnableSRAM2PageWRP_0_31
  837. * @param SRAM2WRP This parameter can be a combination of the following values:
  838. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE0
  839. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE1
  840. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE2
  841. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE3
  842. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE4
  843. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE5
  844. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE6
  845. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE7
  846. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE8
  847. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE9
  848. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE10
  849. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE11
  850. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE12
  851. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE13
  852. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE14
  853. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE15
  854. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE16 (*)
  855. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE17 (*)
  856. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE18 (*)
  857. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE19 (*)
  858. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE20 (*)
  859. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE21 (*)
  860. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE22 (*)
  861. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE23 (*)
  862. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE24 (*)
  863. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE25 (*)
  864. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE26 (*)
  865. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE27 (*)
  866. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE28 (*)
  867. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE29 (*)
  868. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE30 (*)
  869. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE31 (*)
  870. *
  871. * (*) value not defined in all devices
  872. * @retval None
  873. */
  874. /* Legacy define */
  875. #define LL_SYSCFG_EnableSRAM2PageWRP LL_SYSCFG_EnableSRAM2PageWRP_0_31
  876. __STATIC_INLINE void LL_SYSCFG_EnableSRAM2PageWRP_0_31(uint32_t SRAM2WRP)
  877. {
  878. SET_BIT(SYSCFG->SWPR, SRAM2WRP);
  879. }
  880. #if defined(SYSCFG_SWPR2_PAGE63)
  881. /**
  882. * @brief Enable SRAM2 page write protection for Pages in range 32 to 63
  883. * @note Write protection is cleared only by a system reset
  884. * @rmtoll SYSCFG_SWPR2 PxWP LL_SYSCFG_EnableSRAM2PageWRP_32_63
  885. * @param SRAM2WRP This parameter can be a combination of the following values:
  886. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE32 (*)
  887. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE33 (*)
  888. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE34 (*)
  889. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE35 (*)
  890. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE36 (*)
  891. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE37 (*)
  892. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE38 (*)
  893. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE39 (*)
  894. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE40 (*)
  895. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE41 (*)
  896. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE42 (*)
  897. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE43 (*)
  898. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE44 (*)
  899. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE45 (*)
  900. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE46 (*)
  901. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE47 (*)
  902. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE48 (*)
  903. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE49 (*)
  904. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE50 (*)
  905. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE51 (*)
  906. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE52 (*)
  907. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE53 (*)
  908. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE54 (*)
  909. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE55 (*)
  910. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE56 (*)
  911. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE57 (*)
  912. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE58 (*)
  913. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE59 (*)
  914. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE60 (*)
  915. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE61 (*)
  916. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE62 (*)
  917. * @arg @ref LL_SYSCFG_SRAM2WRP_PAGE63 (*)
  918. *
  919. * (*) value not defined in all devices
  920. * @retval None
  921. */
  922. __STATIC_INLINE void LL_SYSCFG_EnableSRAM2PageWRP_32_63(uint32_t SRAM2WRP)
  923. {
  924. SET_BIT(SYSCFG->SWPR2, SRAM2WRP);
  925. }
  926. #endif /* SYSCFG_SWPR2_PAGE63 */
  927. /**
  928. * @brief SRAM2 page write protection lock prior to erase
  929. * @rmtoll SYSCFG_SKR KEY LL_SYSCFG_LockSRAM2WRP
  930. * @retval None
  931. */
  932. __STATIC_INLINE void LL_SYSCFG_LockSRAM2WRP(void)
  933. {
  934. /* Writing a wrong key reactivates the write protection */
  935. WRITE_REG(SYSCFG->SKR, 0x00);
  936. }
  937. /**
  938. * @brief SRAM2 page write protection unlock prior to erase
  939. * @rmtoll SYSCFG_SKR KEY LL_SYSCFG_UnlockSRAM2WRP
  940. * @retval None
  941. */
  942. __STATIC_INLINE void LL_SYSCFG_UnlockSRAM2WRP(void)
  943. {
  944. /* unlock the write protection of the SRAM2ER bit */
  945. WRITE_REG(SYSCFG->SKR, 0xCA);
  946. WRITE_REG(SYSCFG->SKR, 0x53);
  947. }
  948. /**
  949. * @}
  950. */
  951. /** @defgroup SYSTEM_LL_EF_DBGMCU DBGMCU
  952. * @{
  953. */
  954. /**
  955. * @brief Return the device identifier
  956. * @rmtoll DBGMCU_IDCODE DEV_ID LL_DBGMCU_GetDeviceID
  957. * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF (ex: device ID is 0x6415)
  958. */
  959. __STATIC_INLINE uint32_t LL_DBGMCU_GetDeviceID(void)
  960. {
  961. return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_DEV_ID));
  962. }
  963. /**
  964. * @brief Return the device revision identifier
  965. * @note This field indicates the revision of the device.
  966. * @rmtoll DBGMCU_IDCODE REV_ID LL_DBGMCU_GetRevisionID
  967. * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF
  968. */
  969. __STATIC_INLINE uint32_t LL_DBGMCU_GetRevisionID(void)
  970. {
  971. return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_REV_ID) >> DBGMCU_IDCODE_REV_ID_Pos);
  972. }
  973. /**
  974. * @brief Enable the Debug Module during SLEEP mode
  975. * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_EnableDBGSleepMode
  976. * @retval None
  977. */
  978. __STATIC_INLINE void LL_DBGMCU_EnableDBGSleepMode(void)
  979. {
  980. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
  981. }
  982. /**
  983. * @brief Disable the Debug Module during SLEEP mode
  984. * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_DisableDBGSleepMode
  985. * @retval None
  986. */
  987. __STATIC_INLINE void LL_DBGMCU_DisableDBGSleepMode(void)
  988. {
  989. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
  990. }
  991. /**
  992. * @brief Enable the Debug Module during STOP mode
  993. * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_EnableDBGStopMode
  994. * @retval None
  995. */
  996. __STATIC_INLINE void LL_DBGMCU_EnableDBGStopMode(void)
  997. {
  998. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
  999. }
  1000. /**
  1001. * @brief Disable the Debug Module during STOP mode
  1002. * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_DisableDBGStopMode
  1003. * @retval None
  1004. */
  1005. __STATIC_INLINE void LL_DBGMCU_DisableDBGStopMode(void)
  1006. {
  1007. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
  1008. }
  1009. /**
  1010. * @brief Enable the Debug Module during STANDBY mode
  1011. * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_EnableDBGStandbyMode
  1012. * @retval None
  1013. */
  1014. __STATIC_INLINE void LL_DBGMCU_EnableDBGStandbyMode(void)
  1015. {
  1016. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
  1017. }
  1018. /**
  1019. * @brief Disable the Debug Module during STANDBY mode
  1020. * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_DisableDBGStandbyMode
  1021. * @retval None
  1022. */
  1023. __STATIC_INLINE void LL_DBGMCU_DisableDBGStandbyMode(void)
  1024. {
  1025. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
  1026. }
  1027. /**
  1028. * @brief Set Trace pin assignment control
  1029. * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_SetTracePinAssignment\n
  1030. * DBGMCU_CR TRACE_MODE LL_DBGMCU_SetTracePinAssignment
  1031. * @param PinAssignment This parameter can be one of the following values:
  1032. * @arg @ref LL_DBGMCU_TRACE_NONE
  1033. * @arg @ref LL_DBGMCU_TRACE_ASYNCH
  1034. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1
  1035. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2
  1036. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4
  1037. * @retval None
  1038. */
  1039. __STATIC_INLINE void LL_DBGMCU_SetTracePinAssignment(uint32_t PinAssignment)
  1040. {
  1041. MODIFY_REG(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE, PinAssignment);
  1042. }
  1043. /**
  1044. * @brief Get Trace pin assignment control
  1045. * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_GetTracePinAssignment\n
  1046. * DBGMCU_CR TRACE_MODE LL_DBGMCU_GetTracePinAssignment
  1047. * @retval Returned value can be one of the following values:
  1048. * @arg @ref LL_DBGMCU_TRACE_NONE
  1049. * @arg @ref LL_DBGMCU_TRACE_ASYNCH
  1050. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1
  1051. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2
  1052. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4
  1053. */
  1054. __STATIC_INLINE uint32_t LL_DBGMCU_GetTracePinAssignment(void)
  1055. {
  1056. return (uint32_t)(READ_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE));
  1057. }
  1058. /**
  1059. * @brief Freeze APB1 peripherals (group1 peripherals)
  1060. * @rmtoll DBGMCU_APB1FZR1 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph
  1061. * @param Periphs This parameter can be a combination of the following values:
  1062. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP
  1063. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP (*)
  1064. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP (*)
  1065. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP (*)
  1066. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP
  1067. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP (*)
  1068. * @arg @ref LL_DBGMCU_APB1_GRP1_RTC_STOP
  1069. * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP
  1070. * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP
  1071. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP
  1072. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP (*)
  1073. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C3_STOP
  1074. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN_STOP
  1075. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*)
  1076. * @arg @ref LL_DBGMCU_APB1_GRP1_LPTIM1_STOP
  1077. *
  1078. * (*) value not defined in all devices.
  1079. * @retval None
  1080. */
  1081. __STATIC_INLINE void LL_DBGMCU_APB1_GRP1_FreezePeriph(uint32_t Periphs)
  1082. {
  1083. SET_BIT(DBGMCU->APB1FZR1, Periphs);
  1084. }
  1085. /**
  1086. * @brief Freeze APB1 peripherals (group2 peripherals)
  1087. * @rmtoll DBGMCU_APB1FZR2 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP2_FreezePeriph
  1088. * @param Periphs This parameter can be a combination of the following values:
  1089. * @arg @ref LL_DBGMCU_APB1_GRP2_I2C4_STOP (*)
  1090. * @arg @ref LL_DBGMCU_APB1_GRP2_LPTIM2_STOP
  1091. *
  1092. * (*) value not defined in all devices.
  1093. * @retval None
  1094. */
  1095. __STATIC_INLINE void LL_DBGMCU_APB1_GRP2_FreezePeriph(uint32_t Periphs)
  1096. {
  1097. SET_BIT(DBGMCU->APB1FZR2, Periphs);
  1098. }
  1099. /**
  1100. * @brief Unfreeze APB1 peripherals (group1 peripherals)
  1101. * @rmtoll DBGMCU_APB1FZR1 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph
  1102. * @param Periphs This parameter can be a combination of the following values:
  1103. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP
  1104. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP (*)
  1105. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP (*)
  1106. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP (*)
  1107. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP
  1108. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP (*)
  1109. * @arg @ref LL_DBGMCU_APB1_GRP1_RTC_STOP
  1110. * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP
  1111. * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP
  1112. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP
  1113. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP (*)
  1114. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C3_STOP
  1115. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN_STOP
  1116. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*)
  1117. * @arg @ref LL_DBGMCU_APB1_GRP1_LPTIM1_STOP
  1118. *
  1119. * (*) value not defined in all devices.
  1120. * @retval None
  1121. */
  1122. __STATIC_INLINE void LL_DBGMCU_APB1_GRP1_UnFreezePeriph(uint32_t Periphs)
  1123. {
  1124. CLEAR_BIT(DBGMCU->APB1FZR1, Periphs);
  1125. }
  1126. /**
  1127. * @brief Unfreeze APB1 peripherals (group2 peripherals)
  1128. * @rmtoll DBGMCU_APB1FZR2 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP2_UnFreezePeriph
  1129. * @param Periphs This parameter can be a combination of the following values:
  1130. * @arg @ref LL_DBGMCU_APB1_GRP2_I2C4_STOP (*)
  1131. * @arg @ref LL_DBGMCU_APB1_GRP2_LPTIM2_STOP
  1132. *
  1133. * (*) value not defined in all devices.
  1134. * @retval None
  1135. */
  1136. __STATIC_INLINE void LL_DBGMCU_APB1_GRP2_UnFreezePeriph(uint32_t Periphs)
  1137. {
  1138. CLEAR_BIT(DBGMCU->APB1FZR2, Periphs);
  1139. }
  1140. /**
  1141. * @brief Freeze APB2 peripherals
  1142. * @rmtoll DBGMCU_APB2FZ DBG_TIMx_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph
  1143. * @param Periphs This parameter can be a combination of the following values:
  1144. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP
  1145. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*)
  1146. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP
  1147. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP
  1148. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP (*)
  1149. *
  1150. * (*) value not defined in all devices.
  1151. * @retval None
  1152. */
  1153. __STATIC_INLINE void LL_DBGMCU_APB2_GRP1_FreezePeriph(uint32_t Periphs)
  1154. {
  1155. SET_BIT(DBGMCU->APB2FZ, Periphs);
  1156. }
  1157. /**
  1158. * @brief Unfreeze APB2 peripherals
  1159. * @rmtoll DBGMCU_APB2FZ DBG_TIMx_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph
  1160. * @param Periphs This parameter can be a combination of the following values:
  1161. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP
  1162. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*)
  1163. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP
  1164. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP
  1165. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP (*)
  1166. *
  1167. * (*) value not defined in all devices.
  1168. * @retval None
  1169. */
  1170. __STATIC_INLINE void LL_DBGMCU_APB2_GRP1_UnFreezePeriph(uint32_t Periphs)
  1171. {
  1172. CLEAR_BIT(DBGMCU->APB2FZ, Periphs);
  1173. }
  1174. /**
  1175. * @}
  1176. */
  1177. #if defined(VREFBUF)
  1178. /** @defgroup SYSTEM_LL_EF_VREFBUF VREFBUF
  1179. * @{
  1180. */
  1181. /**
  1182. * @brief Enable Internal voltage reference
  1183. * @rmtoll VREFBUF_CSR ENVR LL_VREFBUF_Enable
  1184. * @retval None
  1185. */
  1186. __STATIC_INLINE void LL_VREFBUF_Enable(void)
  1187. {
  1188. SET_BIT(VREFBUF->CSR, VREFBUF_CSR_ENVR);
  1189. }
  1190. /**
  1191. * @brief Disable Internal voltage reference
  1192. * @rmtoll VREFBUF_CSR ENVR LL_VREFBUF_Disable
  1193. * @retval None
  1194. */
  1195. __STATIC_INLINE void LL_VREFBUF_Disable(void)
  1196. {
  1197. CLEAR_BIT(VREFBUF->CSR, VREFBUF_CSR_ENVR);
  1198. }
  1199. /**
  1200. * @brief Enable high impedance (VREF+pin is high impedance)
  1201. * @rmtoll VREFBUF_CSR HIZ LL_VREFBUF_EnableHIZ
  1202. * @retval None
  1203. */
  1204. __STATIC_INLINE void LL_VREFBUF_EnableHIZ(void)
  1205. {
  1206. SET_BIT(VREFBUF->CSR, VREFBUF_CSR_HIZ);
  1207. }
  1208. /**
  1209. * @brief Disable high impedance (VREF+pin is internally connected to the voltage reference buffer output)
  1210. * @rmtoll VREFBUF_CSR HIZ LL_VREFBUF_DisableHIZ
  1211. * @retval None
  1212. */
  1213. __STATIC_INLINE void LL_VREFBUF_DisableHIZ(void)
  1214. {
  1215. CLEAR_BIT(VREFBUF->CSR, VREFBUF_CSR_HIZ);
  1216. }
  1217. /**
  1218. * @brief Set the Voltage reference scale
  1219. * @rmtoll VREFBUF_CSR VRS LL_VREFBUF_SetVoltageScaling
  1220. * @param Scale This parameter can be one of the following values:
  1221. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE0
  1222. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE1
  1223. * @retval None
  1224. */
  1225. __STATIC_INLINE void LL_VREFBUF_SetVoltageScaling(uint32_t Scale)
  1226. {
  1227. MODIFY_REG(VREFBUF->CSR, VREFBUF_CSR_VRS, Scale);
  1228. }
  1229. /**
  1230. * @brief Get the Voltage reference scale
  1231. * @rmtoll VREFBUF_CSR VRS LL_VREFBUF_GetVoltageScaling
  1232. * @retval Returned value can be one of the following values:
  1233. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE0
  1234. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE1
  1235. */
  1236. __STATIC_INLINE uint32_t LL_VREFBUF_GetVoltageScaling(void)
  1237. {
  1238. return (uint32_t)(READ_BIT(VREFBUF->CSR, VREFBUF_CSR_VRS));
  1239. }
  1240. /**
  1241. * @brief Check if Voltage reference buffer is ready
  1242. * @rmtoll VREFBUF_CSR VRR LL_VREFBUF_IsVREFReady
  1243. * @retval State of bit (1 or 0).
  1244. */
  1245. __STATIC_INLINE uint32_t LL_VREFBUF_IsVREFReady(void)
  1246. {
  1247. return (READ_BIT(VREFBUF->CSR, VREFBUF_CSR_VRR) == (VREFBUF_CSR_VRR));
  1248. }
  1249. /**
  1250. * @brief Get the trimming code for VREFBUF calibration
  1251. * @rmtoll VREFBUF_CCR TRIM LL_VREFBUF_GetTrimming
  1252. * @retval Between 0 and 0x3F
  1253. */
  1254. __STATIC_INLINE uint32_t LL_VREFBUF_GetTrimming(void)
  1255. {
  1256. return (uint32_t)(READ_BIT(VREFBUF->CCR, VREFBUF_CCR_TRIM));
  1257. }
  1258. /**
  1259. * @brief Set the trimming code for VREFBUF calibration (Tune the internal reference buffer voltage)
  1260. * @rmtoll VREFBUF_CCR TRIM LL_VREFBUF_SetTrimming
  1261. * @param Value Between 0 and 0x3F
  1262. * @retval None
  1263. */
  1264. __STATIC_INLINE void LL_VREFBUF_SetTrimming(uint32_t Value)
  1265. {
  1266. WRITE_REG(VREFBUF->CCR, Value);
  1267. }
  1268. /**
  1269. * @}
  1270. */
  1271. #endif /* VREFBUF */
  1272. /** @defgroup SYSTEM_LL_EF_FLASH FLASH
  1273. * @{
  1274. */
  1275. /**
  1276. * @brief Set FLASH Latency
  1277. * @rmtoll FLASH_ACR LATENCY LL_FLASH_SetLatency
  1278. * @param Latency This parameter can be one of the following values:
  1279. * @arg @ref LL_FLASH_LATENCY_0
  1280. * @arg @ref LL_FLASH_LATENCY_1
  1281. * @arg @ref LL_FLASH_LATENCY_2
  1282. * @arg @ref LL_FLASH_LATENCY_3
  1283. * @arg @ref LL_FLASH_LATENCY_4
  1284. * @arg @ref LL_FLASH_LATENCY_5 (*)
  1285. * @arg @ref LL_FLASH_LATENCY_6 (*)
  1286. * @arg @ref LL_FLASH_LATENCY_7 (*)
  1287. * @arg @ref LL_FLASH_LATENCY_8 (*)
  1288. * @arg @ref LL_FLASH_LATENCY_9 (*)
  1289. * @arg @ref LL_FLASH_LATENCY_10 (*)
  1290. * @arg @ref LL_FLASH_LATENCY_11 (*)
  1291. * @arg @ref LL_FLASH_LATENCY_12 (*)
  1292. * @arg @ref LL_FLASH_LATENCY_13 (*)
  1293. * @arg @ref LL_FLASH_LATENCY_14 (*)
  1294. * @arg @ref LL_FLASH_LATENCY_15 (*)
  1295. *
  1296. * (*) value not defined in all devices.
  1297. * @retval None
  1298. */
  1299. __STATIC_INLINE void LL_FLASH_SetLatency(uint32_t Latency)
  1300. {
  1301. MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, Latency);
  1302. }
  1303. /**
  1304. * @brief Get FLASH Latency
  1305. * @rmtoll FLASH_ACR LATENCY LL_FLASH_GetLatency
  1306. * @retval Returned value can be one of the following values:
  1307. * @arg @ref LL_FLASH_LATENCY_0
  1308. * @arg @ref LL_FLASH_LATENCY_1
  1309. * @arg @ref LL_FLASH_LATENCY_2
  1310. * @arg @ref LL_FLASH_LATENCY_3
  1311. * @arg @ref LL_FLASH_LATENCY_4
  1312. * @arg @ref LL_FLASH_LATENCY_5 (*)
  1313. * @arg @ref LL_FLASH_LATENCY_6 (*)
  1314. * @arg @ref LL_FLASH_LATENCY_7 (*)
  1315. * @arg @ref LL_FLASH_LATENCY_8 (*)
  1316. * @arg @ref LL_FLASH_LATENCY_9 (*)
  1317. * @arg @ref LL_FLASH_LATENCY_10 (*)
  1318. * @arg @ref LL_FLASH_LATENCY_11 (*)
  1319. * @arg @ref LL_FLASH_LATENCY_12 (*)
  1320. * @arg @ref LL_FLASH_LATENCY_13 (*)
  1321. * @arg @ref LL_FLASH_LATENCY_14 (*)
  1322. * @arg @ref LL_FLASH_LATENCY_15 (*)
  1323. *
  1324. * (*) value not defined in all devices.
  1325. */
  1326. __STATIC_INLINE uint32_t LL_FLASH_GetLatency(void)
  1327. {
  1328. return (uint32_t)(READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY));
  1329. }
  1330. /**
  1331. * @brief Enable Prefetch
  1332. * @rmtoll FLASH_ACR PRFTEN LL_FLASH_EnablePrefetch
  1333. * @retval None
  1334. */
  1335. __STATIC_INLINE void LL_FLASH_EnablePrefetch(void)
  1336. {
  1337. SET_BIT(FLASH->ACR, FLASH_ACR_PRFTEN);
  1338. }
  1339. /**
  1340. * @brief Disable Prefetch
  1341. * @rmtoll FLASH_ACR PRFTEN LL_FLASH_DisablePrefetch
  1342. * @retval None
  1343. */
  1344. __STATIC_INLINE void LL_FLASH_DisablePrefetch(void)
  1345. {
  1346. CLEAR_BIT(FLASH->ACR, FLASH_ACR_PRFTEN);
  1347. }
  1348. /**
  1349. * @brief Check if Prefetch buffer is enabled
  1350. * @rmtoll FLASH_ACR PRFTEN LL_FLASH_IsPrefetchEnabled
  1351. * @retval State of bit (1 or 0).
  1352. */
  1353. __STATIC_INLINE uint32_t LL_FLASH_IsPrefetchEnabled(void)
  1354. {
  1355. return (READ_BIT(FLASH->ACR, FLASH_ACR_PRFTEN) == (FLASH_ACR_PRFTEN));
  1356. }
  1357. /**
  1358. * @brief Enable Instruction cache
  1359. * @rmtoll FLASH_ACR ICEN LL_FLASH_EnableInstCache
  1360. * @retval None
  1361. */
  1362. __STATIC_INLINE void LL_FLASH_EnableInstCache(void)
  1363. {
  1364. SET_BIT(FLASH->ACR, FLASH_ACR_ICEN);
  1365. }
  1366. /**
  1367. * @brief Disable Instruction cache
  1368. * @rmtoll FLASH_ACR ICEN LL_FLASH_DisableInstCache
  1369. * @retval None
  1370. */
  1371. __STATIC_INLINE void LL_FLASH_DisableInstCache(void)
  1372. {
  1373. CLEAR_BIT(FLASH->ACR, FLASH_ACR_ICEN);
  1374. }
  1375. /**
  1376. * @brief Enable Data cache
  1377. * @rmtoll FLASH_ACR DCEN LL_FLASH_EnableDataCache
  1378. * @retval None
  1379. */
  1380. __STATIC_INLINE void LL_FLASH_EnableDataCache(void)
  1381. {
  1382. SET_BIT(FLASH->ACR, FLASH_ACR_DCEN);
  1383. }
  1384. /**
  1385. * @brief Disable Data cache
  1386. * @rmtoll FLASH_ACR DCEN LL_FLASH_DisableDataCache
  1387. * @retval None
  1388. */
  1389. __STATIC_INLINE void LL_FLASH_DisableDataCache(void)
  1390. {
  1391. CLEAR_BIT(FLASH->ACR, FLASH_ACR_DCEN);
  1392. }
  1393. /**
  1394. * @brief Enable Instruction cache reset
  1395. * @note bit can be written only when the instruction cache is disabled
  1396. * @rmtoll FLASH_ACR ICRST LL_FLASH_EnableInstCacheReset
  1397. * @retval None
  1398. */
  1399. __STATIC_INLINE void LL_FLASH_EnableInstCacheReset(void)
  1400. {
  1401. SET_BIT(FLASH->ACR, FLASH_ACR_ICRST);
  1402. }
  1403. /**
  1404. * @brief Disable Instruction cache reset
  1405. * @rmtoll FLASH_ACR ICRST LL_FLASH_DisableInstCacheReset
  1406. * @retval None
  1407. */
  1408. __STATIC_INLINE void LL_FLASH_DisableInstCacheReset(void)
  1409. {
  1410. CLEAR_BIT(FLASH->ACR, FLASH_ACR_ICRST);
  1411. }
  1412. /**
  1413. * @brief Enable Data cache reset
  1414. * @note bit can be written only when the data cache is disabled
  1415. * @rmtoll FLASH_ACR DCRST LL_FLASH_EnableDataCacheReset
  1416. * @retval None
  1417. */
  1418. __STATIC_INLINE void LL_FLASH_EnableDataCacheReset(void)
  1419. {
  1420. SET_BIT(FLASH->ACR, FLASH_ACR_DCRST);
  1421. }
  1422. /**
  1423. * @brief Disable Data cache reset
  1424. * @rmtoll FLASH_ACR DCRST LL_FLASH_DisableDataCacheReset
  1425. * @retval None
  1426. */
  1427. __STATIC_INLINE void LL_FLASH_DisableDataCacheReset(void)
  1428. {
  1429. CLEAR_BIT(FLASH->ACR, FLASH_ACR_DCRST);
  1430. }
  1431. /**
  1432. * @brief Enable Flash Power-down mode during run mode or Low-power run mode
  1433. * @note Flash memory can be put in power-down mode only when the code is executed
  1434. * from RAM
  1435. * @note Flash must not be accessed when power down is enabled
  1436. * @note Flash must not be put in power-down while a program or an erase operation
  1437. * is on-going
  1438. * @rmtoll FLASH_ACR RUN_PD LL_FLASH_EnableRunPowerDown\n
  1439. * FLASH_PDKEYR PDKEY1 LL_FLASH_EnableRunPowerDown\n
  1440. * FLASH_PDKEYR PDKEY2 LL_FLASH_EnableRunPowerDown
  1441. * @retval None
  1442. */
  1443. __STATIC_INLINE void LL_FLASH_EnableRunPowerDown(void)
  1444. {
  1445. /* Following values must be written consecutively to unlock the RUN_PD bit in
  1446. FLASH_ACR */
  1447. WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY1);
  1448. WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY2);
  1449. SET_BIT(FLASH->ACR, FLASH_ACR_RUN_PD);
  1450. }
  1451. /**
  1452. * @brief Disable Flash Power-down mode during run mode or Low-power run mode
  1453. * @rmtoll FLASH_ACR RUN_PD LL_FLASH_DisableRunPowerDown\n
  1454. * FLASH_PDKEYR PDKEY1 LL_FLASH_DisableRunPowerDown\n
  1455. * FLASH_PDKEYR PDKEY2 LL_FLASH_DisableRunPowerDown
  1456. * @retval None
  1457. */
  1458. __STATIC_INLINE void LL_FLASH_DisableRunPowerDown(void)
  1459. {
  1460. /* Following values must be written consecutively to unlock the RUN_PD bit in
  1461. FLASH_ACR */
  1462. WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY1);
  1463. WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY2);
  1464. CLEAR_BIT(FLASH->ACR, FLASH_ACR_RUN_PD);
  1465. }
  1466. /**
  1467. * @brief Enable Flash Power-down mode during Sleep or Low-power sleep mode
  1468. * @note Flash must not be put in power-down while a program or an erase operation
  1469. * is on-going
  1470. * @rmtoll FLASH_ACR SLEEP_PD LL_FLASH_EnableSleepPowerDown
  1471. * @retval None
  1472. */
  1473. __STATIC_INLINE void LL_FLASH_EnableSleepPowerDown(void)
  1474. {
  1475. SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD);
  1476. }
  1477. /**
  1478. * @brief Disable Flash Power-down mode during Sleep or Low-power sleep mode
  1479. * @rmtoll FLASH_ACR SLEEP_PD LL_FLASH_DisableSleepPowerDown
  1480. * @retval None
  1481. */
  1482. __STATIC_INLINE void LL_FLASH_DisableSleepPowerDown(void)
  1483. {
  1484. CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD);
  1485. }
  1486. /**
  1487. * @}
  1488. */
  1489. /**
  1490. * @}
  1491. */
  1492. /**
  1493. * @}
  1494. */
  1495. #endif /* defined (FLASH) || defined (SYSCFG) || defined (DBGMCU) || defined (VREFBUF) */
  1496. /**
  1497. * @}
  1498. */
  1499. #ifdef __cplusplus
  1500. }
  1501. #endif
  1502. #endif /* STM32L4xx_LL_SYSTEM_H */