1
0

stm32l4xx_ll_system.h 63 KB

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