stm32l4xx_ll_system.h 67 KB

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