stm32l4xx_ll_system.h 64 KB

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