stm32h5xx_ll_system.h 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814
  1. /**
  2. ******************************************************************************
  3. * @file stm32h5xx_ll_system.h
  4. * @author MCD Application Team
  5. * @brief Header file of SYSTEM LL module.
  6. @verbatim
  7. ==============================================================================
  8. ##### How to use this driver #####
  9. ==============================================================================
  10. [..]
  11. The LL SYSTEM driver contains a set of generic APIs that can be
  12. used by user:
  13. (+) Some of the FLASH features need to be handled in the SYSTEM file.
  14. (+) Access to DBGCMU registers
  15. (+) Access to SBS registers
  16. (+) Access to VREFBUF registers
  17. @endverbatim
  18. ******************************************************************************
  19. * @attention
  20. *
  21. * Copyright (c) 2023 STMicroelectronics.
  22. * All rights reserved.
  23. *
  24. * This software is licensed under terms that can be found in the LICENSE file
  25. * in the root directory of this software component.
  26. * If no LICENSE file comes with this software, it is provided AS-IS.
  27. *
  28. ******************************************************************************
  29. */
  30. /* Define to prevent recursive inclusion -------------------------------------*/
  31. #ifndef STM32H5xx_LL_SYSTEM_H
  32. #define STM32H5xx_LL_SYSTEM_H
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "stm32h5xx.h"
  38. /** @addtogroup STM32H5xx_LL_Driver
  39. * @{
  40. */
  41. #if defined (FLASH) || defined (SBS) || defined (DBGMCU) || defined (VREFBUF)
  42. /** @defgroup SYSTEM_LL SYSTEM
  43. * @{
  44. */
  45. /* Private types -------------------------------------------------------------*/
  46. /* Private variables ---------------------------------------------------------*/
  47. /* Private constants ---------------------------------------------------------*/
  48. /** @defgroup SYSTEM_LL_Private_Constants SYSTEM Private Constants
  49. * @{
  50. */
  51. #define LL_SBS_HDPL_INCREMENT_VALUE 0x6AU /*!< Define used for the HDPL increment */
  52. #define LL_SBS_DBG_UNLOCK (0xB4U << SBS_DBGCR_DBG_UNLOCK_Pos) /*!< Define used to unlock debug */
  53. #define LL_SBS_ACCESS_PORT_UNLOCK 0xB4U /*!< Define used to unlock access port */
  54. #define LL_SBS_DBG_CONFIG_LOCK 0xC3U /*!< Define used to lock debug configuration */
  55. #define LL_SBS_DBG_CONFIG_UNLOCK 0xB4U /*!< Define used to unlock debug configuration */
  56. #define LL_SBS_DEBUG_SEC_NSEC 0xB4U /*!< Define used to open debug for secure and non-secure */
  57. #define LL_SBS_DEBUG_NSEC 0x3CU /*!< Define used to open debug for non-secure only */
  58. /**
  59. * @}
  60. */
  61. /* Private macros ------------------------------------------------------------*/
  62. /* Exported types ------------------------------------------------------------*/
  63. /* Exported constants --------------------------------------------------------*/
  64. /** @defgroup SYSTEM_LL_Exported_Constants SYSTEM Exported Constants
  65. * @{
  66. */
  67. /** @defgroup SYSTEM_LL_SBS_EC_FASTMODEPLUS SBS FASTMODEPLUS
  68. * @{
  69. */
  70. #define LL_SBS_FASTMODEPLUS_PB6 SBS_PMCR_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */
  71. #define LL_SBS_FASTMODEPLUS_PB7 SBS_PMCR_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */
  72. #define LL_SBS_FASTMODEPLUS_PB8 SBS_PMCR_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */
  73. #if defined(SBS_PMCR_PB9_FMP)
  74. #define LL_SBS_FASTMODEPLUS_PB9 SBS_PMCR_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */
  75. #endif /* SBS_PMCR_PB9_FMP */
  76. /**
  77. * @}
  78. */
  79. /** @defgroup SYSTEM_LL_SBS_EC_CS1 SBS Vdd compensation cell Code selection
  80. * @{
  81. */
  82. #define LL_SBS_VDD_CELL_CODE 0x0UL /*!< VDD I/Os code from the cell (available in the SBS_CCVALR) */
  83. #define LL_SBS_VDD_REGISTER_CODE SBS_CCCSR_CS1 /*!< VDD I/Os code from the SBS compensation cell code register (SBS_CCSWCR) */
  84. /**
  85. * @}
  86. */
  87. /** @defgroup SYSTEM_LL_SBS_EC_CS2 SBS VddIO compensation cell Code selection
  88. * @{
  89. */
  90. #define LL_SBS_VDDIO_CELL_CODE 0x0UL /*!< VDDIO I/Os code from the cell (available in the SBS_CCVALR)*/
  91. #define LL_SBS_VDDIO_REGISTER_CODE SBS_CCCSR_CS2 /*!< VDDIO I/Os code from the SBS compensation cell code register (SBS_CCSWCR)*/
  92. /**
  93. * @}
  94. */
  95. #if defined(SBS_PMCR_ETH_SEL_PHY)
  96. /** @defgroup SYSTEM_LL_SBS_ETHERNET_CONFIG ETHENET CONFIG
  97. * @{
  98. */
  99. #define LL_SBS_ETH_MII 0x0UL /*!< Select the Media Independent Interface (MII) or GMII */
  100. #define LL_SBS_ETH_RMII SBS_PMCR_ETH_SEL_PHY_2 /*!< Select the Reduced Media Independent Interface (RMII) */
  101. /**
  102. * @}
  103. */
  104. #endif /* SBS_PMCR_ETH_SEL_PHY */
  105. /** @defgroup SYSTEM_Memories_Erase_Flag_Status Memories Erase Flags Status
  106. * @{
  107. */
  108. #define LL_SBS_MEMORIES_ERASE_MCLR_ON_GOING 0x0UL /*!< Erase after Power-on Reset of SRAM2, BKPRAM, ICACHE, DCACHE and PKA RAMs on going or cleared by SW */
  109. #define LL_SBS_MEMORIES_ERASE_MCLR_ENDED SBS_MESR_MCLR /*!< Erase after Power-on Reset of SRAM2, BKPRAM, ICACHE, DCACHE and PKA RAMs done */
  110. #define LL_SBS_MEMORIES_ERASE_IPMEE_ON_GOING 0x0UL /*!< Erase after Power-on Reset or Tamper detection for ICACHE and PKA RAMs on going or cleared by SW */
  111. #define LL_SBS_MEMORIES_ERASE_IPMEE_ENDED SBS_MESR_IPMEE /*!< Erase after Power-on Reset or Tamper detection for ICACHE and PKA RAMs done */
  112. /**
  113. * @}
  114. */
  115. /** @defgroup SYSTEM_LL_SBS_EC_TIMBREAK SBS TIMER BREAK
  116. * @{
  117. */
  118. #define LL_SBS_TIMBREAK_ECC SBS_CFGR2_ECCL /*!< Enables and locks the Flash ECC double error signal
  119. with Break Input of TIM1/8/15/16/17 */
  120. #define LL_SBS_TIMBREAK_PVD SBS_CFGR2_PVDL /*!< Enables and locks the PVD connection
  121. with TIM1/8/15/16/17 Break Input and also the PVDE
  122. and PLS bits of the Power Control Interface */
  123. #define LL_SBS_TIMBREAK_SRAM_ECC SBS_CFGR2_SEL /*!< Enables and locks the SRAM ECC double error signal
  124. with Break Input of TIM1/8/15/16/17 */
  125. #define LL_SBS_TIMBREAK_LOCKUP SBS_CFGR2_CLL /*!< Enables and locks the LOCKUP (Hardfault) output of
  126. Cortex-M33 with Break Input of TIM1/15/16/17 */
  127. /**
  128. * @}
  129. */
  130. /** @defgroup SYSTEM_LL_SBS_EPOCH_Selection EPOCH Selection
  131. * @{
  132. */
  133. #define LL_SBS_EPOCH_SEL_NONSECURE 0x0UL /*!< EPOCH non secure selected */
  134. #define LL_SBS_EPOCH_SEL_SECURE SBS_EPOCHSELCR_EPOCH_SEL_0 /*!< EPOCH secure selected */
  135. #define LL_SBS_EPOCH_SEL_PUFCHECK SBS_EPOCHSELCR_EPOCH_SEL_1 /*!< EPOCH all zeros for PUF integrity check */
  136. /**
  137. * @}
  138. */
  139. /** @defgroup SYSTEM_LL_SBS_NextHDPL_Selection Next HDPL Selection
  140. * @{
  141. */
  142. #define LL_SBS_OBKHDPL_INCR_0 0x00000000U /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */
  143. #define LL_SBS_OBKHDPL_INCR_1 SBS_NEXTHDPLCR_NEXTHDPL_0 /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */
  144. #define LL_SBS_OBKHDPL_INCR_2 SBS_NEXTHDPLCR_NEXTHDPL_1 /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */
  145. #define LL_SBS_OBKHDPL_INCR_3 SBS_NEXTHDPLCR_NEXTHDPL /*!< Index to add to the current HDPL to point (through OBK-HDPL) to the next secure storage areas */
  146. /**
  147. * @}
  148. */
  149. /** @defgroup SYSTEM_LL_SBS_HDPL_Value HDPL Value
  150. * @{
  151. */
  152. #define LL_SBS_HDPL_VALUE_0 0x000000B4U /*!< Hide protection level 0 */
  153. #define LL_SBS_HDPL_VALUE_1 0x00000051U /*!< Hide protection level 1 */
  154. #define LL_SBS_HDPL_VALUE_2 0x0000008AU /*!< Hide protection level 2 */
  155. #define LL_SBS_HDPL_VALUE_3 0x0000006FU /*!< Hide protection level 3 */
  156. /**
  157. * @}
  158. */
  159. /** @defgroup SYSTEM_LL_SBS_NS_Lock_items Lock items
  160. * @brief SBS non secure items to set lock on
  161. * @{
  162. */
  163. #define LL_SBS_MPU_NSEC SBS_CNSLCKR_LOCKNSMPU /*!< Non-secure MPU lock (privileged secure or non-secure only) */
  164. #define LL_SBS_VTOR_NSEC SBS_CNSLCKR_LOCKNSVTOR /*!< Non-secure VTOR lock (privileged secure or non-secure only) */
  165. #define LL_SBS_LOCK_ALL_NSEC (LL_SBS_MPU_NSEC | LL_SBS_VTOR_NSEC) /*!< lock all Non-secure (privileged secure or non-secure only) */
  166. /**
  167. * @}
  168. */
  169. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  170. /** @defgroup SYSTEM_LL_SBS_S_Lock_items SBS Lock items
  171. * @brief SBS secure items to set lock on
  172. * @{
  173. */
  174. #define LL_SBS_SAU SBS_CSLCKR_LOCKSAU /*!< SAU lock (privileged secure code only) */
  175. #define LL_SBS_MPU_SEC SBS_CSLCKR_LOCKSMPU /*!< Secure MPU lock (privileged secure code only) */
  176. #define LL_SBS_VTOR_AIRCR_SEC SBS_CSLCKR_LOCKSVTAIRCR /*!< VTOR_S and AIRCR lock (privileged secure code only) */
  177. #define LL_SBS_LOCK_ALL_SEC (LL_SBS_SAU | LL_SBS_MPU_SEC | LL_SBS_VTOR_AIRCR_SEC) /*!< lock all secure (privileged secure only) */
  178. /**
  179. * @}
  180. */
  181. /** @defgroup SYSTEM_LL_SBS_EC_SECURE_ATTRIBUTES Secure attributes
  182. * @note Only available when system implements security (TZEN=1)
  183. * @{
  184. */
  185. #define LL_SBS_CLOCK_SEC SBS_SECCFGR_SBSSEC /*!< SBS clock configuration secure-only access */
  186. #define LL_SBS_CLOCK_NSEC 0U /*!< SBS clock configuration secure/non-secure access */
  187. #define LL_SBS_CLASSB_SEC SBS_SECCFGR_CLASSBSEC /*!< Class B configuration secure-only access */
  188. #define LL_SBS_CLASSB_NSEC 0U /*!< Class B configuration secure/non-secure access */
  189. #define LL_SBS_FPU_SEC SBS_SECCFGR_FPUSEC /*!< FPU configuration secure-only access */
  190. #define LL_SBS_FPU_NSEC 0U /*!< FPU configuration secure/non-secure access */
  191. /**
  192. * @}
  193. */
  194. #endif /* __ARM_FEATURE_CMSE */
  195. /** @defgroup SYSTEM_LL_DBGMCU_EC_TRACE DBGMCU TRACE Pin Assignment
  196. * @{
  197. */
  198. #define LL_DBGMCU_TRACE_NONE 0x00000000U /*!< TRACE pins not assigned (default state) */
  199. #define LL_DBGMCU_TRACE_ASYNCH DBGMCU_CR_TRACE_IOEN /*!< TRACE pin assignment for Asynchronous Mode */
  200. #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 */
  201. #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 */
  202. #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 */
  203. /**
  204. * @}
  205. */
  206. /** @defgroup SYSTEM_LL_DBGMCU_EC_APB1_GRP1_STOP_IP DBGMCU APB1 GRP1 STOP IP
  207. * @{
  208. */
  209. #define LL_DBGMCU_APB1_GRP1_TIM2_STOP DBGMCU_APB1FZR1_DBG_TIM2_STOP /*!< The counter clock of TIM2 is stopped when the core is halted*/
  210. #define LL_DBGMCU_APB1_GRP1_TIM3_STOP DBGMCU_APB1FZR1_DBG_TIM3_STOP /*!< The counter clock of TIM3 is stopped when the core is halted*/
  211. #if defined(TIM4)
  212. #define LL_DBGMCU_APB1_GRP1_TIM4_STOP DBGMCU_APB1FZR1_DBG_TIM4_STOP /*!< The counter clock of TIM4 is stopped when the core is halted*/
  213. #endif /* TIM4 */
  214. #if defined(TIM5)
  215. #define LL_DBGMCU_APB1_GRP1_TIM5_STOP DBGMCU_APB1FZR1_DBG_TIM5_STOP /*!< The counter clock of TIM5 is stopped when the core is halted*/
  216. #endif /* TIM5 */
  217. #define LL_DBGMCU_APB1_GRP1_TIM6_STOP DBGMCU_APB1FZR1_DBG_TIM6_STOP /*!< The counter clock of TIM6 is stopped when the core is halted*/
  218. #define LL_DBGMCU_APB1_GRP1_TIM7_STOP DBGMCU_APB1FZR1_DBG_TIM7_STOP /*!< The counter clock of TIM7 is stopped when the core is halted*/
  219. #if defined(TIM12)
  220. #define LL_DBGMCU_APB1_GRP1_TIM12_STOP DBGMCU_APB1FZR1_DBG_TIM12_STOP /*!< The counter clock of TIM12 is stopped when the core is halted*/
  221. #endif /* TIM12 */
  222. #if defined(TIM13)
  223. #define LL_DBGMCU_APB1_GRP1_TIM13_STOP DBGMCU_APB1FZR1_DBG_TIM13_STOP /*!< The counter clock of TIM13 is stopped when the core is halted*/
  224. #endif /* TIM13 */
  225. #if defined(TIM14)
  226. #define LL_DBGMCU_APB1_GRP1_TIM14_STOP DBGMCU_APB1FZR1_DBG_TIM14_STOP /*!< The counter clock of TIM14 is stopped when the core is halted*/
  227. #endif /* TIM14 */
  228. #define LL_DBGMCU_APB1_GRP1_WWDG_STOP DBGMCU_APB1FZR1_DBG_WWDG_STOP /*!< The window watchdog counter clock is stopped when the core is halted*/
  229. #define LL_DBGMCU_APB1_GRP1_IWDG_STOP DBGMCU_APB1FZR1_DBG_IWDG_STOP /*!< The independent watchdog counter clock is stopped when the core is halted*/
  230. #define LL_DBGMCU_APB1_GRP1_I2C1_STOP DBGMCU_APB1FZR1_DBG_I2C1_STOP /*!< The I2C1 SMBus timeout is frozen*/
  231. #define LL_DBGMCU_APB1_GRP1_I2C2_STOP DBGMCU_APB1FZR1_DBG_I2C2_STOP /*!< The I2C2 SMBus timeout is frozen*/
  232. #define LL_DBGMCU_APB1_GRP1_I3C1_STOP DBGMCU_APB1FZR1_DBG_I3C1_STOP /*!< The I3C1 SMBus timeout is frozen*/
  233. /**
  234. * @}
  235. */
  236. /** @defgroup SYSTEM_LL_DBGMCU_EC_APB1_GRP2_STOP_IP DBGMCU APB1 GRP2 STOP IP
  237. * @{
  238. */
  239. #define LL_DBGMCU_APB1_GRP2_LPTIM2_STOP DBGMCU_APB1FZR2_DBG_LPTIM2_STOP /*!< The counter clock of LPTIM2 is stopped when the core is halted*/
  240. /**
  241. * @}
  242. */
  243. /** @defgroup SYSTEM_LL_DBGMCU_EC_APB2_GRP1_STOP_IP DBGMCU APB2 GRP1 STOP IP
  244. * @{
  245. */
  246. #define LL_DBGMCU_APB2_GRP1_TIM1_STOP DBGMCU_APB2FZR_DBG_TIM1_STOP /*!< The counter clock of TIM1 is stopped when the core is halted*/
  247. #if defined(TIM8)
  248. #define LL_DBGMCU_APB2_GRP1_TIM8_STOP DBGMCU_APB2FZR_DBG_TIM8_STOP /*!< The counter clock of TIM8 is stopped when the core is halted*/
  249. #endif /* TIM8 */
  250. #if defined(TIM15)
  251. #define LL_DBGMCU_APB2_GRP1_TIM15_STOP DBGMCU_APB2FZR_DBG_TIM15_STOP /*!< The counter clock of TIM15 is stopped when the core is halted*/
  252. #endif /* TIM15 */
  253. #if defined(TIM16)
  254. #define LL_DBGMCU_APB2_GRP1_TIM16_STOP DBGMCU_APB2FZR_DBG_TIM16_STOP /*!< The counter clock of TIM16 is stopped when the core is halted*/
  255. #endif /* TIM16 */
  256. #if defined(TIM17)
  257. #define LL_DBGMCU_APB2_GRP1_TIM17_STOP DBGMCU_APB2FZR_DBG_TIM17_STOP /*!< The counter clock of TIM17 is stopped when the core is halted*/
  258. #endif /* TIM17 */
  259. /**
  260. * @}
  261. */
  262. /** @defgroup SYSTEM_LL_DBGMCU_EC_APB3_GRP1_STOP_IP DBGMCU APB3 GRP1 STOP IP
  263. * @{
  264. */
  265. #if defined(I2C3)
  266. #define LL_DBGMCU_APB3_GRP1_I2C3_STOP DBGMCU_APB3FZR_DBG_I2C3_STOP /*!< The counter clock of I2C3 is stopped when the core is halted*/
  267. #endif /* I2C3 */
  268. #if defined(I2C4)
  269. #define LL_DBGMCU_APB3_GRP1_I2C4_STOP DBGMCU_APB3FZR_DBG_I2C4_STOP /*!< The counter clock of I2C4 is stopped when the core is halted*/
  270. #endif /* I2C4 */
  271. #if defined(I3C2)
  272. #define LL_DBGMCU_APB3_GRP1_I3C2_STOP DBGMCU_APB3FZR_DBG_I3C2_STOP /*!< The counter clock of I3C2 is stopped when the core is halted*/
  273. #endif /* I3C2 */
  274. #define LL_DBGMCU_APB3_GRP1_LPTIM1_STOP DBGMCU_APB3FZR_DBG_LPTIM1_STOP /*!< The counter clock of LPTIM1 is stopped when the core is halted*/
  275. #if defined(LPTIM3)
  276. #define LL_DBGMCU_APB3_GRP1_LPTIM3_STOP DBGMCU_APB3FZR_DBG_LPTIM3_STOP /*!< The counter clock of LPTIM3 is stopped when the core is halted*/
  277. #endif /* LPTIM3 */
  278. #if defined(LPTIM4)
  279. #define LL_DBGMCU_APB3_GRP1_LPTIM4_STOP DBGMCU_APB3FZR_DBG_LPTIM4_STOP /*!< The counter clock of LPTIM4 is stopped when the core is halted*/
  280. #endif /* LPTIM4 */
  281. #if defined(LPTIM5)
  282. #define LL_DBGMCU_APB3_GRP1_LPTIM5_STOP DBGMCU_APB3FZR_DBG_LPTIM5_STOP /*!< The counter clock of LPTIM5 is stopped when the core is halted*/
  283. #endif /* LPTIM5 */
  284. #if defined(LPTIM6)
  285. #define LL_DBGMCU_APB3_GRP1_LPTIM6_STOP DBGMCU_APB3FZR_DBG_LPTIM6_STOP /*!< The counter clock of LPTIM6 is stopped when the core is halted*/
  286. #endif /* LPTIM6 */
  287. #define LL_DBGMCU_APB3_GRP1_RTC_STOP DBGMCU_APB3FZR_DBG_RTC_STOP /*!< The counter clock of RTC is stopped when the core is halted*/
  288. /**
  289. * @}
  290. */
  291. #if defined(VREFBUF)
  292. /** @defgroup SYSTEM_LL_VREFBUF_EC_VOLTAGE VREFBUF VOLTAGE
  293. * @{
  294. */
  295. #define LL_VREFBUF_VOLTAGE_SCALE0 ((uint32_t)0x00000000) /*!< Voltage reference scale 0 (VREF_OUT1) */
  296. #define LL_VREFBUF_VOLTAGE_SCALE1 VREFBUF_CSR_VRS_0 /*!< Voltage reference scale 1 (VREF_OUT2) */
  297. #define LL_VREFBUF_VOLTAGE_SCALE2 VREFBUF_CSR_VRS_1 /*!< Voltage reference scale 2 (VREF_OUT3) */
  298. #define LL_VREFBUF_VOLTAGE_SCALE3 (VREFBUF_CSR_VRS_0 | VREFBUF_CSR_VRS_1) /*!< Voltage reference scale 3 (VREF_OUT4) */
  299. /**
  300. * @}
  301. */
  302. #endif /* VREFBUF */
  303. /** @defgroup SYSTEM_LL_FLASH_EC_LATENCY FLASH LATENCY
  304. * @{
  305. */
  306. #define LL_FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH zero wait state */
  307. #define LL_FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH one wait state */
  308. #define LL_FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH two wait states */
  309. #define LL_FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH three wait states */
  310. #define LL_FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH four wait states */
  311. #define LL_FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH five wait states */
  312. #define LL_FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH six wait state */
  313. #define LL_FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven wait states */
  314. #define LL_FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH Eight wait states */
  315. #define LL_FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH nine wait states */
  316. #define LL_FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH ten wait states */
  317. #define LL_FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH eleven wait states */
  318. #define LL_FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH twelve wait states */
  319. #define LL_FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH thirteen wait states */
  320. #define LL_FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH fourteen wait states */
  321. #define LL_FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH fifteen wait states */
  322. /**
  323. * @}
  324. */
  325. /**
  326. * @}
  327. */
  328. /* Exported macro ------------------------------------------------------------*/
  329. /* Exported functions --------------------------------------------------------*/
  330. /** @defgroup SYSTEM_LL_Exported_Functions SYSTEM Exported Functions
  331. * @{
  332. */
  333. /** @defgroup SYSTEM_LL_EF_SBS SBS
  334. * @{
  335. */
  336. #if defined(SBS_PMCR_ETH_SEL_PHY)
  337. /**
  338. * @brief Select Ethernet PHY interface
  339. * @rmtoll PMCR EPIS_SEL LL_SBS_SetPHYInterface
  340. * @param Interface This parameter can be one of the following values:
  341. * @arg @ref LL_SBS_ETH_MII
  342. * @arg @ref LL_SBS_ETH_RMII
  343. * @retval None
  344. */
  345. __STATIC_INLINE void LL_SBS_SetPHYInterface(uint32_t Interface)
  346. {
  347. MODIFY_REG(SBS->PMCR, SBS_PMCR_ETH_SEL_PHY, Interface);
  348. }
  349. /**
  350. * @brief Get Ethernet PHY interface
  351. * @rmtoll PMCR EPIS_SEL LL_SBS_GetPHYInterface
  352. * @retval Returned value can be one of the following values:
  353. * @arg @ref LL_SBS_ETH_MII
  354. * @arg @ref LL_SBS_ETH_RMII
  355. */
  356. __STATIC_INLINE uint32_t LL_SBS_GetPHYInterface(void)
  357. {
  358. return (uint32_t)(READ_BIT(SBS->PMCR, SBS_PMCR_ETH_SEL_PHY));
  359. }
  360. #endif /* SBS_PMCR_ETH_SEL_PHY */
  361. /**
  362. * @brief Enable the fast mode plus driving capability.
  363. * @rmtoll PMCR PBx_FMP LL_SBS_EnableFastModePlus\n
  364. * PMCR PBx_FMP LL_SBS_EnableFastModePlus
  365. * @param ConfigFastModePlus This parameter can be a combination of the following values:
  366. * @arg @ref LL_SBS_FASTMODEPLUS_PB6
  367. * @arg @ref LL_SBS_FASTMODEPLUS_PB7
  368. * @arg @ref LL_SBS_FASTMODEPLUS_PB8
  369. * @arg @ref LL_SBS_FASTMODEPLUS_PB9
  370. * @retval None
  371. */
  372. __STATIC_INLINE void LL_SBS_EnableFastModePlus(uint32_t ConfigFastModePlus)
  373. {
  374. SET_BIT(SBS->PMCR, ConfigFastModePlus);
  375. }
  376. /**
  377. * @brief Disable the fast mode plus driving capability.
  378. * @rmtoll PMCR PBx_FMP LL_SBS_DisableFastModePlus\n
  379. * PMCR PBx_FMP LL_SBS_DisableFastModePlus
  380. * @param ConfigFastModePlus This parameter can be a combination of the following values:
  381. * @arg @ref LL_SBS_FASTMODEPLUS_PB6
  382. * @arg @ref LL_SBS_FASTMODEPLUS_PB7
  383. * @arg @ref LL_SBS_FASTMODEPLUS_PB8
  384. * @arg @ref LL_SBS_FASTMODEPLUS_PB9
  385. * @retval None
  386. */
  387. __STATIC_INLINE void LL_SBS_DisableFastModePlus(uint32_t ConfigFastModePlus)
  388. {
  389. CLEAR_BIT(SBS->PMCR, ConfigFastModePlus);
  390. }
  391. /**
  392. * @brief Enable Floating Point Unit Invalid operation Interrupt
  393. * @rmtoll FPUIMR FPU_IE_0 LL_SBS_EnableIT_FPU_IOC
  394. * @retval None
  395. */
  396. __STATIC_INLINE void LL_SBS_EnableIT_FPU_IOC(void)
  397. {
  398. SET_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_0);
  399. }
  400. /**
  401. * @brief Enable Floating Point Unit Divide-by-zero Interrupt
  402. * @rmtoll FPUIMR FPU_IE_1 LL_SBS_EnableIT_FPU_DZC
  403. * @retval None
  404. */
  405. __STATIC_INLINE void LL_SBS_EnableIT_FPU_DZC(void)
  406. {
  407. SET_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_1);
  408. }
  409. /**
  410. * @brief Enable Floating Point Unit Underflow Interrupt
  411. * @rmtoll FPUIMR FPU_IE_2 LL_SBS_EnableIT_FPU_UFC
  412. * @retval None
  413. */
  414. __STATIC_INLINE void LL_SBS_EnableIT_FPU_UFC(void)
  415. {
  416. SET_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_2);
  417. }
  418. /**
  419. * @brief Enable Floating Point Unit Overflow Interrupt
  420. * @rmtoll FPUIMR FPU_IE_3 LL_SBS_EnableIT_FPU_OFC
  421. * @retval None
  422. */
  423. __STATIC_INLINE void LL_SBS_EnableIT_FPU_OFC(void)
  424. {
  425. SET_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_3);
  426. }
  427. /**
  428. * @brief Enable Floating Point Unit Input denormal Interrupt
  429. * @rmtoll FPUIMR FPU_IE_4 LL_SBS_EnableIT_FPU_IDC
  430. * @retval None
  431. */
  432. __STATIC_INLINE void LL_SBS_EnableIT_FPU_IDC(void)
  433. {
  434. SET_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_4);
  435. }
  436. /**
  437. * @brief Enable Floating Point Unit Inexact Interrupt
  438. * @rmtoll FPUIMR FPU_IE_5 LL_SBS_EnableIT_FPU_IXC
  439. * @retval None
  440. */
  441. __STATIC_INLINE void LL_SBS_EnableIT_FPU_IXC(void)
  442. {
  443. SET_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_5);
  444. }
  445. /**
  446. * @brief Disable Floating Point Unit Invalid operation Interrupt
  447. * @rmtoll FPUIMR FPU_IE_0 LL_SBS_DisableIT_FPU_IOC
  448. * @retval None
  449. */
  450. __STATIC_INLINE void LL_SBS_DisableIT_FPU_IOC(void)
  451. {
  452. CLEAR_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_0);
  453. }
  454. /**
  455. * @brief Disable Floating Point Unit Divide-by-zero Interrupt
  456. * @rmtoll FPUIMR FPU_IE_1 LL_SBS_DisableIT_FPU_DZC
  457. * @retval None
  458. */
  459. __STATIC_INLINE void LL_SBS_DisableIT_FPU_DZC(void)
  460. {
  461. CLEAR_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_1);
  462. }
  463. /**
  464. * @brief Disable Floating Point Unit Underflow Interrupt
  465. * @rmtoll FPUIMR FPU_IE_2 LL_SBS_DisableIT_FPU_UFC
  466. * @retval None
  467. */
  468. __STATIC_INLINE void LL_SBS_DisableIT_FPU_UFC(void)
  469. {
  470. CLEAR_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_2);
  471. }
  472. /**
  473. * @brief Disable Floating Point Unit Overflow Interrupt
  474. * @rmtoll FPUIMR FPU_IE_3 LL_SBS_DisableIT_FPU_OFC
  475. * @retval None
  476. */
  477. __STATIC_INLINE void LL_SBS_DisableIT_FPU_OFC(void)
  478. {
  479. CLEAR_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_3);
  480. }
  481. /**
  482. * @brief Disable Floating Point Unit Input denormal Interrupt
  483. * @rmtoll FPUIMR FPU_IE_4 LL_SBS_DisableIT_FPU_IDC
  484. * @retval None
  485. */
  486. __STATIC_INLINE void LL_SBS_DisableIT_FPU_IDC(void)
  487. {
  488. CLEAR_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_4);
  489. }
  490. /**
  491. * @brief Disable Floating Point Unit Inexact Interrupt
  492. * @rmtoll FPUIMR FPU_IE_5 LL_SBS_DisableIT_FPU_IXC
  493. * @retval None
  494. */
  495. __STATIC_INLINE void LL_SBS_DisableIT_FPU_IXC(void)
  496. {
  497. CLEAR_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_5);
  498. }
  499. /**
  500. * @brief Check if Floating Point Unit Invalid operation Interrupt source is enabled or disabled.
  501. * @rmtoll FPUIMR FPU_IE_0 LL_SBS_IsEnabledIT_FPU_IOC
  502. * @retval State of bit (1 or 0).
  503. */
  504. __STATIC_INLINE uint32_t LL_SBS_IsEnabledIT_FPU_IOC(void)
  505. {
  506. return ((READ_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_0) == SBS_FPUIMR_FPU_IE_0) ? 1UL : 0UL);
  507. }
  508. /**
  509. * @brief Check if Floating Point Unit Divide-by-zero Interrupt source is enabled or disabled.
  510. * @rmtoll FPUIMR FPU_IE_1 LL_SBS_IsEnabledIT_FPU_DZC
  511. * @retval State of bit (1 or 0).
  512. */
  513. __STATIC_INLINE uint32_t LL_SBS_IsEnabledIT_FPU_DZC(void)
  514. {
  515. return ((READ_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_1) == SBS_FPUIMR_FPU_IE_1) ? 1UL : 0UL);
  516. }
  517. /**
  518. * @brief Check if Floating Point Unit Underflow Interrupt source is enabled or disabled.
  519. * @rmtoll FPUIMR FPU_IE_2 LL_SBS_IsEnabledIT_FPU_UFC
  520. * @retval State of bit (1 or 0).
  521. */
  522. __STATIC_INLINE uint32_t LL_SBS_IsEnabledIT_FPU_UFC(void)
  523. {
  524. return ((READ_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_2) == SBS_FPUIMR_FPU_IE_2) ? 1UL : 0UL);
  525. }
  526. /**
  527. * @brief Check if Floating Point Unit Overflow Interrupt source is enabled or disabled.
  528. * @rmtoll FPUIMR FPU_IE_3 LL_SBS_IsEnabledIT_FPU_OFC
  529. * @retval State of bit (1 or 0).
  530. */
  531. __STATIC_INLINE uint32_t LL_SBS_IsEnabledIT_FPU_OFC(void)
  532. {
  533. return ((READ_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_3) == SBS_FPUIMR_FPU_IE_3) ? 1UL : 0UL);
  534. }
  535. /**
  536. * @brief Check if Floating Point Unit Input denormal Interrupt source is enabled or disabled.
  537. * @rmtoll FPUIMR FPU_IE_4 LL_SBS_IsEnabledIT_FPU_IDC
  538. * @retval State of bit (1 or 0).
  539. */
  540. __STATIC_INLINE uint32_t LL_SBS_IsEnabledIT_FPU_IDC(void)
  541. {
  542. return ((READ_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_4) == SBS_FPUIMR_FPU_IE_4) ? 1UL : 0UL);
  543. }
  544. /**
  545. * @brief Check if Floating Point Unit Inexact Interrupt source is enabled or disabled.
  546. * @rmtoll FPUIMR FPU_IE_5 LL_SBS_IsEnabledIT_FPU_IXC
  547. * @retval State of bit (1 or 0).
  548. */
  549. __STATIC_INLINE uint32_t LL_SBS_IsEnabledIT_FPU_IXC(void)
  550. {
  551. return ((READ_BIT(SBS->FPUIMR, SBS_FPUIMR_FPU_IE_5) == SBS_FPUIMR_FPU_IE_5) ? 1UL : 0UL);
  552. }
  553. /**
  554. * @brief Set connections to TIM1/8/15/16/17 Break inputs
  555. * @rmtoll CFGR2 CLL LL_SBS_SetTIMBreakInputs\n
  556. * CFGR2 SEL LL_SBS_SetTIMBreakInputs\n
  557. * CFGR2 PVDL LL_SBS_SetTIMBreakInputs\n
  558. * CFGR2 ECCL LL_SBS_SetTIMBreakInputs
  559. * @param Break This parameter can be a combination of the following values:
  560. * where non selected TIMBREAK input is disconnected.
  561. * @arg @ref LL_SBS_TIMBREAK_ECC
  562. * @arg @ref LL_SBS_TIMBREAK_PVD
  563. * @arg @ref LL_SBS_TIMBREAK_SRAM_ECC
  564. * @arg @ref LL_SBS_TIMBREAK_LOCKUP
  565. * @retval None
  566. */
  567. __STATIC_INLINE void LL_SBS_SetTIMBreakInputs(uint32_t Break)
  568. {
  569. MODIFY_REG(SBS->CFGR2, SBS_CFGR2_CLL | SBS_CFGR2_SEL | SBS_CFGR2_PVDL | SBS_CFGR2_ECCL, Break);
  570. }
  571. /**
  572. * @brief Get connections to TIM1/8/15/16/17 Break inputs
  573. * @rmtoll CFGR2 CLL LL_SBS_GetTIMBreakInputs\n
  574. * CFGR2 SEL LL_SBS_GetTIMBreakInputs\n
  575. * CFGR2 PVDL LL_SBS_GetTIMBreakInputs\n
  576. * CFGR2 ECCL LL_SBS_GetTIMBreakInputs
  577. * @retval Returned value can be a combination of the following values:
  578. * @arg @ref LL_SBS_TIMBREAK_ECC
  579. * @arg @ref LL_SBS_TIMBREAK_PVD
  580. * @arg @ref LL_SBS_TIMBREAK_SRAM_ECC
  581. * @arg @ref LL_SBS_TIMBREAK_LOCKUP
  582. */
  583. __STATIC_INLINE uint32_t LL_SBS_GetTIMBreakInputs(void)
  584. {
  585. return (uint32_t)(READ_BIT(SBS->CFGR2, SBS_CFGR2_CLL | SBS_CFGR2_SEL | SBS_CFGR2_PVDL | SBS_CFGR2_ECCL));
  586. }
  587. #if defined(SBS_EPOCHSELCR_EPOCH_SEL)
  588. /**
  589. * @brief Select EPOCH security sent to SAES IP to encrypt/decrypt keys
  590. * @rmtoll EPOCHSELCR EPOCH_SEL LL_SBS_EPOCHSelection
  591. * @param Epoch_Selection: Select EPOCH security
  592. * This parameter can be one of the following values:
  593. * @arg LL_SBS_EPOCH_SEL_SECURE : EPOCH secure selected.
  594. * @arg LL_SBS_EPOCH_SEL_NONSECURE : EPOCH non secure selected.
  595. * @arg LL_SBS_EPOCH_SEL_PUFCHECK : EPOCH all zeros for PUF integrity check.
  596. * @retval None
  597. */
  598. __STATIC_INLINE void LL_SBS_EPOCHSelection(uint32_t Epoch_Selection)
  599. {
  600. MODIFY_REG(SBS->EPOCHSELCR, SBS_EPOCHSELCR_EPOCH_SEL, (uint32_t)(Epoch_Selection));
  601. }
  602. /**
  603. * @brief Get EPOCH security selection
  604. * @rmtoll EPOCHSELCR EPOCH_SEL LL_SBS_GetEPOCHSelection
  605. * @retval Returned value can be one of the following values:
  606. * @arg LL_SBS_EPOCH_SEL_SECURE : EPOCH secure selected.
  607. * @arg LL_SBS_EPOCH_SEL_NONSECURE : EPOCH non secure selected.
  608. * @arg LL_SBS_EPOCH_SEL_PUFCHECK : EPOCH all zeros for PUF integrity check.
  609. */
  610. __STATIC_INLINE uint32_t LL_SBS_GetEPOCHSelection(void)
  611. {
  612. return (uint32_t)(READ_BIT(SBS->EPOCHSELCR, SBS_EPOCHSELCR_EPOCH_SEL));
  613. }
  614. #endif /* SBS_EPOCHSELCR_EPOCH_SEL */
  615. /**
  616. * @brief Disable the NMI in case of double ECC error in FLASH Interface.
  617. * @rmtoll ECCNMIR SBS_ECCNMIR_ECCNMI_MASK_EN LL_SBS_FLASH_DisableECCNMI
  618. * @retval None
  619. */
  620. __STATIC_INLINE void LL_SBS_FLASH_DisableECCNMI(void)
  621. {
  622. SET_BIT(SBS->ECCNMIR, SBS_ECCNMIR_ECCNMI_MASK_EN);
  623. }
  624. /**
  625. * @brief Enable the NMI in case of double ECC error in FLASH Interface.
  626. * @rmtoll ECCNMIR SBS_ECCNMIR_ECCNMI_MASK_EN LL_SBS_FLASH_EnableECCNMI
  627. * @retval None
  628. */
  629. __STATIC_INLINE void LL_SBS_FLASH_EnableECCNMI(void)
  630. {
  631. CLEAR_BIT(SBS->ECCNMIR, SBS_ECCNMIR_ECCNMI_MASK_EN);
  632. }
  633. /** @defgroup SYSTEM_LL_SBS_EF_HDPL_Management HDPL Management
  634. * @{
  635. */
  636. /**
  637. * @brief Increment by 1 the HDPL value
  638. * @rmtoll HDPLCR HDPL_INCR LL_SBS_IncrementHDPLValue
  639. * @retval None
  640. */
  641. __STATIC_INLINE void LL_SBS_IncrementHDPLValue(void)
  642. {
  643. MODIFY_REG(SBS->HDPLCR, SBS_HDPLCR_INCR_HDPL, LL_SBS_HDPL_INCREMENT_VALUE);
  644. }
  645. /**
  646. * @brief Get the HDPL Value.
  647. * @rmtoll HDPLSR HDPL LL_SBS_GetHDPLValue
  648. * @retval Returns the HDPL value
  649. * This return value can be one of the following values:
  650. * @arg LL_SBS_HDPL_VALUE_0: HDPL0
  651. * @arg LL_SBS_HDPL_VALUE_1: HDPL1
  652. * @arg LL_SBS_HDPL_VALUE_2: HDPL2
  653. * @arg LL_SBS_HDPL_VALUE_3: HDPL3
  654. */
  655. __STATIC_INLINE uint32_t LL_SBS_GetHDPLValue(void)
  656. {
  657. return (uint32_t)(READ_BIT(SBS->HDPLSR, SBS_HDPLSR_HDPL));
  658. }
  659. #if defined(SBS_NEXTHDPLCR_NEXTHDPL)
  660. /**
  661. * @brief Set the OBK-HDPL Value.
  662. * @rmtoll NEXTHDPLCR NEXTHDPL LL_SBS_SetOBKHDPL
  663. * @param OBKHDPL_Value Value of increment to add to HDPL value to generate the OBK-HDPL.
  664. * This parameter can be one of the following values:
  665. * @arg LL_SBS_OBKHDPL_INCR_0 : HDPL
  666. * @arg LL_SBS_OBKHDPL_INCR_1 : HDPL + 1
  667. * @arg LL_SBS_OBKHDPL_INCR_2 : HDPL + 2
  668. * @arg LL_SBS_OBKHDPL_INCR_3 : HDPL + 3
  669. * @retval None
  670. */
  671. __STATIC_INLINE void LL_SBS_SetOBKHDPL(uint32_t OBKHDPL_Value)
  672. {
  673. MODIFY_REG(SBS->NEXTHDPLCR, SBS_NEXTHDPLCR_NEXTHDPL, (uint32_t)(OBKHDPL_Value));
  674. }
  675. /**
  676. * @brief Get the OBK-HDPL Value.
  677. * @rmtoll NEXTHDPLCR NEXTHDPL LL_SBS_GetOBKHDPL
  678. * @retval Returns the incremement to add to HDPL value to generate OBK-HDPL
  679. * This return value can be one of the following values:
  680. * @arg LL_SBS_OBKHDPL_INCR_0: HDPL
  681. * @arg LL_SBS_OBKHDPL_INCR_1: HDPL + 1
  682. * @arg LL_SBS_OBKHDPL_INCR_2: HDPL + 2
  683. * @arg LL_SBS_OBKHDPL_INCR_3: HDPL + 3
  684. */
  685. __STATIC_INLINE uint32_t LL_SBS_GetOBKHDPL(void)
  686. {
  687. return (uint32_t)(READ_BIT(SBS->NEXTHDPLCR, SBS_NEXTHDPLCR_NEXTHDPL));
  688. }
  689. #endif /* SBS_NEXTHDPLCR_NEXTHDPL */
  690. /**
  691. * @}
  692. */
  693. /** @defgroup SYSTEM_LL_SBS_EF_Debug_Control Debug Control
  694. * @{
  695. */
  696. /**
  697. * @brief Set the authenticated debug hide protection level
  698. * @rmtoll SBS_DBGCR DBG_AUTH_HDPL LL_SBS_SetAuthDbgHDPL
  699. * @param Level This parameter can be one of the following values:
  700. * @arg @ref LL_SBS_HDPL_VALUE_1
  701. * @arg @ref LL_SBS_HDPL_VALUE_2
  702. * @arg @ref LL_SBS_HDPL_VALUE_3
  703. * @retval None
  704. */
  705. __STATIC_INLINE void LL_SBS_SetAuthDbgHDPL(uint32_t Level)
  706. {
  707. MODIFY_REG(SBS->DBGCR, SBS_DBGCR_DBG_AUTH_HDPL, (Level << SBS_DBGCR_DBG_AUTH_HDPL_Pos));
  708. }
  709. /**
  710. * @brief Get current hide protection level
  711. * @rmtoll SBS_DBGCR DBG_AUTH_HDPL LL_SBS_GetAuthDbgHDPL
  712. * @retval Returned value is the hide protection level where the authenticated debug is opened:
  713. * @arg @ref LL_SBS_HDPL_VALUE_1
  714. * @arg @ref LL_SBS_HDPL_VALUE_2
  715. * @arg @ref LL_SBS_HDPL_VALUE_3
  716. */
  717. __STATIC_INLINE uint32_t LL_SBS_GetAuthDbgHDPL(void)
  718. {
  719. return (uint32_t)(READ_BIT(SBS->DBGCR, SBS_DBGCR_DBG_AUTH_HDPL) >> SBS_DBGCR_DBG_AUTH_HDPL_Pos);
  720. }
  721. #if defined(SBS_DBGCR_DBG_AUTH_SEC)
  722. /**
  723. * @brief Configure the authenticated debug security access.
  724. * @rmtoll SBS_DBGCR DBG_AUTH_SEC LL_SBS_SetAuthDbgSec
  725. * @param Control debug opening secure/non-secure or non-secure only
  726. * This parameter can be one of the following values:
  727. * @arg LL_SBS_DEBUG_SEC_NSEC: debug opening for secure and non-secure.
  728. * @arg LL_SBS_DEBUG_NSEC: debug opening for non-secure only.
  729. * @retval None
  730. */
  731. __STATIC_INLINE void LL_SBS_SetAuthDbgSec(uint32_t Security)
  732. {
  733. MODIFY_REG(SBS->DBGCR, SBS_DBGCR_DBG_AUTH_SEC, (Security << SBS_DBGCR_DBG_AUTH_SEC_Pos));
  734. }
  735. /**
  736. * @brief Get the current value of the hide protection level.
  737. * @rmtoll SBS_DBGCR DBG_AUTH_SEC LL_SBS_GetAuthDbgSec
  738. * @note This function can be only used when device state is Closed.
  739. * @retval Returned value can be one of the following values:
  740. * @arg SBS_DEBUG_SEC_NSEC: debug opening for secure and non-secure.
  741. * @arg any other value: debug opening for non-secure only.
  742. */
  743. __STATIC_INLINE uint32_t LL_SBS_GetAuthDbgSec(void)
  744. {
  745. return ((SBS->DBGCR & SBS_DBGCR_DBG_AUTH_SEC) >> SBS_DBGCR_DBG_AUTH_SEC_Pos);
  746. }
  747. #endif /* SBS_DBGCR_DBG_AUTH_SEC */
  748. /**
  749. * @brief Unlock the debug
  750. * @rmtoll SBS_DBGCR DBG_UNLOCK LL_SBS_UnlockDebug
  751. * @retval None
  752. */
  753. __STATIC_INLINE void LL_SBS_UnlockDebug(void)
  754. {
  755. MODIFY_REG(SBS->DBGCR, SBS_DBGCR_DBG_UNLOCK, LL_SBS_DBG_UNLOCK);
  756. }
  757. /**
  758. * @brief Check if the debug is unlocked
  759. * @rmtoll SBS_DBGCR DBG_UNLOCK LL_SBS_IsUnlockedDebug
  760. * @retval State of bit (1 or 0).
  761. */
  762. __STATIC_INLINE uint32_t LL_SBS_IsUnlockedDebug(void)
  763. {
  764. return ((READ_BIT(SBS->DBGCR, SBS_DBGCR_DBG_UNLOCK) == LL_SBS_DBG_UNLOCK) ? 1UL : 0UL);
  765. }
  766. /**
  767. * @brief Unlock the access port
  768. * @rmtoll SBS_DBGCR AP_UNLOCK LL_SBS_UnlockAccessPort
  769. * @retval None
  770. */
  771. __STATIC_INLINE void LL_SBS_UnlockAccessPort(void)
  772. {
  773. MODIFY_REG(SBS->DBGCR, SBS_DBGCR_AP_UNLOCK, LL_SBS_ACCESS_PORT_UNLOCK);
  774. }
  775. /**
  776. * @brief Check if the access port is unlocked
  777. * @rmtoll SBS_DBGCR AP_UNLOCK LL_SBS_IsUnlockedAccessPort
  778. * @retval State of bit (1 or 0).
  779. */
  780. __STATIC_INLINE uint32_t LL_SBS_IsUnlockedAccessPort(void)
  781. {
  782. return ((READ_BIT(SBS->DBGCR, SBS_DBGCR_AP_UNLOCK) == LL_SBS_ACCESS_PORT_UNLOCK) ? 1UL : 0UL);
  783. }
  784. /**
  785. * @brief Lock the debug configuration
  786. * @rmtoll SBS_DBGLOCKR DBGCFG_LOCK LL_SBS_LockDebugConfig
  787. * @retval None
  788. */
  789. __STATIC_INLINE void LL_SBS_LockDebugConfig(void)
  790. {
  791. MODIFY_REG(SBS->DBGLOCKR, SBS_DBGLOCKR_DBGCFG_LOCK, LL_SBS_DBG_CONFIG_LOCK);
  792. }
  793. /**
  794. * @brief Check if the debug configuration is locked
  795. * @rmtoll SBS_DBGLOCKR DBGCFG_LOCK LL_SBS_IsLockedDebugConfig
  796. * @retval State of bit (1 or 0).
  797. */
  798. __STATIC_INLINE uint32_t LL_SBS_IsLockedDebugConfig(void)
  799. {
  800. return ((READ_BIT(SBS->DBGLOCKR, SBS_DBGLOCKR_DBGCFG_LOCK) != LL_SBS_DBG_CONFIG_UNLOCK) ? 1UL : 0UL);
  801. }
  802. /**
  803. * @}
  804. */
  805. /** @defgroup SYSTEM_LL_SBS_EF_lock_Management lock Management
  806. * @{
  807. */
  808. /**
  809. * @brief Non-secure Lock of SBS item(s).
  810. * @note Setting lock(s) depends on privilege mode in secure/non-secure code
  811. * Lock(s) cleared only at system reset
  812. * @rmtoll CNSLCKR LOCKNSVTOR LL_SBS_NonSecureLock\n
  813. * CNSLCKR LOCKNSMPU LL_SBS_NonSecureLock
  814. * @param Item Item(s) to set lock on.
  815. * This parameter can be one of the following values :
  816. * @arg LL_SBS_VTOR_NSEC : VTOR_NS register lock
  817. * @arg LL_SBS_MPU_NSEC : Non-secure MPU registers lock
  818. * @arg LL_SBS_LOCK_ALL_NSEC : Non-secure MPU and VTOR_NS lock
  819. * @retval None
  820. */
  821. __STATIC_INLINE void LL_SBS_NonSecureLock(uint32_t Item)
  822. {
  823. /* Privilege secure/non-secure locks */
  824. SBS->CNSLCKR = Item;
  825. }
  826. /**
  827. * @brief Get the non secure lock state of SBS items.
  828. * @note Getting lock(s) depends on privilege mode in secure/non-secure code
  829. * @rmtoll CNSLCKR LOCKNSVTOR LL_SBS_NonSecureLock\n
  830. * CNSLCKR LOCKNSMPU LL_SBS_NonSecureLock
  831. * @retval the return value can be one of the following values :
  832. * @arg LL_SBS_VTOR_NSEC : VTOR_NS register lock
  833. * @arg LL_SBS_MPU_NSEC : Non-secure MPU registers lock
  834. * @arg LL_SBS_LOCK_ALL_NSEC : VTOR_NS and Non-secure MPU registers lock
  835. */
  836. __STATIC_INLINE uint32_t LL_SBS_GetNonSecureLock(void)
  837. {
  838. return (uint32_t)(READ_BIT(SBS->CNSLCKR, LL_SBS_LOCK_ALL_NSEC));
  839. }
  840. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  841. /**
  842. * @brief Secure Lock of System item(s).
  843. * @note Setting lock(s) depends on privilege mode in secure code
  844. * Lock(s) cleared only at system reset
  845. * @rmtoll CSLCKR LOCKSVTAIRCR LL_SBS_SecureLock\n
  846. * CSLCKR LOCKSMPU LL_SBS_SecureLock\n
  847. * CSLCKR LOCKSAU LL_SBS_SecureLock
  848. * @param Item Item(s) to set lock on.
  849. * This parameter can be a combination of the following values :
  850. * @arg LL_SBS_VTOR_AIRCR_SEC : VTOR_S and AIRCR registers lock
  851. * @arg LL_SBS_MPU_SEC : Secure MPU registers lock
  852. * @arg LL_SBS_SAU : SAU registers lock
  853. * @arg LL_SBS_LOCK_ALL_SEC : VTOR_S, AIRCR, Secure MPU and SAU registers lock
  854. * @retval None
  855. */
  856. __STATIC_INLINE void LL_SBS_SecureLock(uint32_t Item)
  857. {
  858. /* Privilege secure only locks */
  859. SBS->CSLCKR = Item;
  860. }
  861. /**
  862. * @brief Get the secure lock state of System items.
  863. * @note Getting lock(s) depends on privilege mode in secure code
  864. * @rmtoll CSLCKR LOCKSVTAIRCR LL_SBS_GetSecureLock\n
  865. * CSLCKR LOCKSMPU LL_SBS_GetSecureLock\n
  866. * CSLCKR LOCKSAU LL_SBS_GetSecureLock
  867. * @retval the return value is a combination of the following values :
  868. * @arg LL_SBS_VTOR_AIRCR_SEC : VTOR_S and AIRCR registers lock
  869. * @arg LL_SBS_MPU_SEC : Secure MPU registers lock
  870. * @arg LL_SBS_SAU : SAU registers lock
  871. * @arg LL_SBS_LOCK_ALL_SEC : VTOR_S, AIRCR, Secure MPU and SAU registers lock
  872. */
  873. __STATIC_INLINE uint32_t LL_SBS_GetSecureLock(void)
  874. {
  875. return (uint32_t)(READ_BIT(SBS->CSLCKR, LL_SBS_LOCK_ALL_SEC));
  876. }
  877. #endif /* __ARM_FEATURE_CMSE && __ARM_FEATURE_CMSE == 3U */
  878. /**
  879. * @}
  880. */
  881. /** @defgroup SYSTEM_LL_SBS_EF_Secure_Management Secure Management
  882. * @{
  883. */
  884. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  885. /**
  886. * @brief Configure Secure mode
  887. * @note Only available from secure state when system implements security (TZEN=1)
  888. * @rmtoll SECCFGR SBSSEC LL_SBS_ConfigSecure\n
  889. * SECCFGR CLASSBSEC LL_SBS_ConfigSecure\n
  890. * SECCFGR FPUSEC LL_SBS_ConfigSecure
  891. * @param Configuration This parameter shall be the full combination
  892. * of the following values:
  893. * @arg @ref LL_SBS_CLOCK_SEC or LL_SBS_CLOCK_NSEC
  894. * @arg @ref LL_SBS_CLASSB_SEC or LL_SBS_CLASSB_NSEC
  895. * @arg @ref LL_SBS_FPU_SEC or LL_SBS_FPU_NSEC
  896. * @retval None
  897. */
  898. __STATIC_INLINE void LL_SBS_ConfigSecure(uint32_t Configuration)
  899. {
  900. WRITE_REG(SBS->SECCFGR, Configuration);
  901. }
  902. /**
  903. * @brief Get Secure mode configuration
  904. * @note Only available when system implements security (TZEN=1)
  905. * @rmtoll SECCFGR SBSSEC LL_SBS_ConfigSecure\n
  906. * SECCFGR CLASSBSEC LL_SBS_ConfigSecure\n
  907. * SECCFGR FPUSEC LL_SBS_ConfigSecure
  908. * @retval Returned value is the combination of the following values:
  909. * @arg @ref LL_SBS_CLOCK_SEC or LL_SBS_CLOCK_NSEC
  910. * @arg @ref LL_SBS_CLASSB_SEC or LL_SBS_CLASSB_NSEC
  911. * @arg @ref LL_SBS_FPU_SEC or LL_SBS_FPU_NSEC
  912. */
  913. __STATIC_INLINE uint32_t LL_SBS_GetConfigSecure(void)
  914. {
  915. return (uint32_t)(READ_BIT(SBS->SECCFGR, LL_SBS_CLOCK_SEC | LL_SBS_CLASSB_SEC | LL_SBS_FPU_SEC));
  916. }
  917. #endif /* __ARM_FEATURE_CMSE && __ARM_FEATURE_CMSE == 3U */
  918. /**
  919. * @}
  920. */
  921. /**
  922. * @}
  923. */
  924. /** @defgroup SYSTEM_LL_SBS_EF_COMPENSATION Compensation Cell Control
  925. * @{
  926. */
  927. /**
  928. * @brief Get the compensation cell value of the GPIO PMOS transistor supplied by VDD
  929. * @rmtoll CCVALR APSRC1 LL_SBS_GetPMOSVddCompensationValue
  930. * @retval Returned value is the PMOS compensation cell
  931. */
  932. __STATIC_INLINE uint32_t LL_SBS_GetPMOSVddCompensationValue(void)
  933. {
  934. return (uint32_t)(READ_BIT(SBS->CCVALR, SBS_CCVALR_APSRC1));
  935. }
  936. /**
  937. * @brief Get the compensation cell value of the GPIO NMOS transistor supplied by VDD
  938. * @rmtoll CCVALR ANSRC1 LL_SBS_GetNMOSVddCompensationValue
  939. * @retval Returned value is the NMOS compensation cell
  940. */
  941. __STATIC_INLINE uint32_t LL_SBS_GetNMOSVddCompensationValue(void)
  942. {
  943. return (uint32_t)(READ_BIT(SBS->CCVALR, SBS_CCVALR_ANSRC1));
  944. }
  945. /**
  946. * @brief Get the compensation cell value of the GPIO PMOS transistor supplied by VDDIO2
  947. * @rmtoll CCVALR APSRC2 LL_SBS_GetPMOSVddIO2CompensationValue
  948. * @retval Returned value is the PMOS compensation cell
  949. */
  950. __STATIC_INLINE uint32_t LL_SBS_GetPMOSVddIO2CompensationValue(void)
  951. {
  952. return (uint32_t)(READ_BIT(SBS->CCVALR, SBS_CCVALR_APSRC2));
  953. }
  954. /**
  955. * @brief Get the compensation cell value of the GPIO NMOS transistor supplied by VDDIO2
  956. * @rmtoll CCVALR ANSRC2 LL_SBS_GetNMOSVddIO2CompensationValue
  957. * @retval Returned value is the NMOS compensation cell
  958. */
  959. __STATIC_INLINE uint32_t LL_SBS_GetNMOSVddIO2CompensationValue(void)
  960. {
  961. return (uint32_t)(READ_BIT(SBS->CCVALR, SBS_CCVALR_ANSRC2));
  962. }
  963. /**
  964. * @brief Set the compensation cell code of the GPIO PMOS transistor supplied by VDD
  965. * @rmtoll CCSWCR SW_APSRC1 LL_SBS_SetPMOSVddCompensationCode
  966. * @param PMOSCode PMOS compensation code
  967. * This code is applied to the PMOS compensation cell when the CS1 bit of the
  968. * SBS_CCCSR is set
  969. * @retval None
  970. */
  971. __STATIC_INLINE void LL_SBS_SetPMOSVddCompensationCode(uint32_t PMOSCode)
  972. {
  973. MODIFY_REG(SBS->CCSWCR, SBS_CCSWCR_SW_APSRC1, PMOSCode << SBS_CCSWCR_SW_APSRC1_Pos);
  974. }
  975. /**
  976. * @brief Get the compensation cell code of the GPIO PMOS transistor supplied by VDD
  977. * @rmtoll CCSWCR SW_APSRC1 LL_SBS_GetPMOSVddCompensationCode
  978. * @retval Returned value is the PMOS compensation cell
  979. */
  980. __STATIC_INLINE uint32_t LL_SBS_GetPMOSVddCompensationCode(void)
  981. {
  982. return (uint32_t)(READ_BIT(SBS->CCSWCR, SBS_CCSWCR_SW_APSRC1));
  983. }
  984. /**
  985. * @brief Set the compensation cell code of the GPIO PMOS transistor supplied by VDDIO
  986. * @rmtoll CCSWCR SW_APSRC2 LL_SBS_SetPMOSVddIOCompensationCode
  987. * @param PMOSCode PMOS compensation code
  988. * This code is applied to the PMOS compensation cell when the CS2 bit of the
  989. * SBS_CCCSR is set
  990. * @retval None
  991. */
  992. __STATIC_INLINE void LL_SBS_SetPMOSVddIOCompensationCode(uint32_t PMOSCode)
  993. {
  994. MODIFY_REG(SBS->CCSWCR, SBS_CCSWCR_SW_APSRC2, PMOSCode << SBS_CCSWCR_SW_APSRC2_Pos);
  995. }
  996. /**
  997. * @brief Get the compensation cell code of the GPIO PMOS transistor supplied by VDDIO
  998. * @rmtoll CCSWCR SW_APSRC2 LL_SBS_GetPMOSVddIOCompensationCode
  999. * @retval Returned value is the PMOS compensation
  1000. */
  1001. __STATIC_INLINE uint32_t LL_SBS_GetPMOSVddIOCompensationCode(void)
  1002. {
  1003. return (uint32_t)(READ_BIT(SBS->CCSWCR, SBS_CCSWCR_SW_APSRC2));
  1004. }
  1005. /**
  1006. * @brief Set the compensation cell code of the GPIO NMOS transistor supplied by VDD
  1007. * @rmtoll CCSWCR PCC2 LL_SBS_SetNMOSVddCompensationCode
  1008. * @param NMOSCode NMOS compensation code
  1009. * This code is applied to the NMOS compensation cell when the CS2 bit of the
  1010. * SBS_CCCSR is set
  1011. * @retval None
  1012. */
  1013. __STATIC_INLINE void LL_SBS_SetNMOSVddCompensationCode(uint32_t NMOSCode)
  1014. {
  1015. MODIFY_REG(SBS->CCSWCR, SBS_CCSWCR_SW_ANSRC1, NMOSCode << SBS_CCSWCR_SW_ANSRC1_Pos);
  1016. }
  1017. /**
  1018. * @brief Get the compensation cell code of the GPIO NMOS transistor supplied by VDD
  1019. * @rmtoll CCSWCR NCC1 LL_SBS_GetNMOSVddCompensationCode
  1020. * @retval Returned value is the Vdd compensation cell code for NMOS transistors
  1021. */
  1022. __STATIC_INLINE uint32_t LL_SBS_GetNMOSVddCompensationCode(void)
  1023. {
  1024. return (uint32_t)(READ_BIT(SBS->CCSWCR, SBS_CCSWCR_SW_ANSRC1));
  1025. }
  1026. /**
  1027. * @brief Set the compensation cell code of the GPIO NMOS transistor supplied by VDDIO
  1028. * @rmtoll CCSWCR NCC2 LL_SBS_SetNMOSVddIOCompensationCode
  1029. * @param NMOSCode NMOS compensation cell code
  1030. * This code is applied to the NMOS compensation cell when the CS2 bit of the
  1031. * SBS_CCCSR is set
  1032. * @retval None
  1033. */
  1034. __STATIC_INLINE void LL_SBS_SetNMOSVddIOCompensationCode(uint32_t NMOSCode)
  1035. {
  1036. MODIFY_REG(SBS->CCSWCR, SBS_CCSWCR_SW_ANSRC2, NMOSCode << SBS_CCSWCR_SW_ANSRC2_Pos);
  1037. }
  1038. /**
  1039. * @brief Get the compensation cell code of the GPIO NMOS transistor supplied by VDDIO
  1040. * @rmtoll CCSWCR NCC2 LL_SBS_GetNMOSVddIOCompensationCode
  1041. * @retval Returned value is the NMOS compensation cell code
  1042. */
  1043. __STATIC_INLINE uint32_t LL_SBS_GetNMOSVddIOCompensationCode(void)
  1044. {
  1045. return (uint32_t)(READ_BIT(SBS->CCSWCR, SBS_CCSWCR_SW_ANSRC2));
  1046. }
  1047. /**
  1048. * @brief Enable the Compensation Cell of GPIO supplied by VDD
  1049. * @rmtoll CCCSR EN1 LL_SBS_EnableVddCompensationCell
  1050. * @note The vdd compensation cell can be used only when the device supply
  1051. * voltage ranges from 1.71 to 3.6 V
  1052. * @retval None
  1053. */
  1054. __STATIC_INLINE void LL_SBS_EnableVddCompensationCell(void)
  1055. {
  1056. SET_BIT(SBS->CCCSR, SBS_CCCSR_EN1);
  1057. }
  1058. /**
  1059. * @brief Enable the Compensation Cell of GPIO supplied by VDDIO
  1060. * @rmtoll CCCSR EN2 LL_SBS_EnableVddIOCompensationCell
  1061. * @note The Vdd I/O compensation cell can be used only when the device supply
  1062. * voltage ranges from 1.08 to 3.6 V
  1063. * @retval None
  1064. */
  1065. __STATIC_INLINE void LL_SBS_EnableVddIOCompensationCell(void)
  1066. {
  1067. SET_BIT(SBS->CCCSR, SBS_CCCSR_EN2);
  1068. }
  1069. /**
  1070. * @brief Disable the Compensation Cell of GPIO supplied by VDD
  1071. * @rmtoll CCCSR EN1 LL_SBS_DisableVddCompensationCell
  1072. * @note The Vdd compensation cell can be used only when the device supply
  1073. * voltage ranges from 1.71 to 3.6 V
  1074. * @retval None
  1075. */
  1076. __STATIC_INLINE void LL_SBS_DisableVddCompensationCell(void)
  1077. {
  1078. CLEAR_BIT(SBS->CCCSR, SBS_CCCSR_EN1);
  1079. }
  1080. /**
  1081. * @brief Disable the Compensation Cell of GPIO supplied by VDDIO
  1082. * @rmtoll CCCSR EN2 LL_SBS_DisableVddIOCompensationCell
  1083. * @note The Vdd I/O compensation cell can be used only when the device supply
  1084. * voltage ranges from 1.08 to 3.6 V
  1085. * @retval None
  1086. */
  1087. __STATIC_INLINE void LL_SBS_DisableVddIOCompensationCell(void)
  1088. {
  1089. CLEAR_BIT(SBS->CCCSR, SBS_CCCSR_EN2);
  1090. }
  1091. /**
  1092. * @brief Check if the Compensation Cell of GPIO supplied by VDD is enable
  1093. * @rmtoll CCCSR EN1 LL_SBS_IsEnabled_VddCompensationCell
  1094. * @retval State of bit (1 or 0).
  1095. */
  1096. __STATIC_INLINE uint32_t LL_SBS_IsEnabled_VddCompensationCell(void)
  1097. {
  1098. return ((READ_BIT(SBS->CCCSR, SBS_CCCSR_EN1) == SBS_CCCSR_EN1) ? 1UL : 0UL);
  1099. }
  1100. /**
  1101. * @brief Check if the Compensation Cell of GPIO supplied by VDDIO is enable
  1102. * @rmtoll CCCSR EN2 LL_SBS_IsEnabled_VddIOCompensationCell
  1103. * @retval State of bit (1 or 0).
  1104. */
  1105. __STATIC_INLINE uint32_t LL_SBS_IsEnabled_VddIOCompensationCell(void)
  1106. {
  1107. return ((READ_BIT(SBS->CCCSR, SBS_CCCSR_EN2) == SBS_CCCSR_EN2) ? 1UL : 0UL);
  1108. }
  1109. /**
  1110. * @brief Get Compensation Cell ready Flag of GPIO supplied by VDD
  1111. * @rmtoll CCCSR RDY1 LL_SBS_IsActiveFlag_VddCMPCR
  1112. * @retval State of bit (1 or 0).
  1113. */
  1114. __STATIC_INLINE uint32_t LL_SBS_IsActiveFlag_VddCMPCR(void)
  1115. {
  1116. return ((READ_BIT(SBS->CCCSR, SBS_CCCSR_RDY1) == (SBS_CCCSR_RDY1)) ? 1UL : 0UL);
  1117. }
  1118. /**
  1119. * @brief Get Compensation Cell ready Flag of GPIO supplied by VDDIO
  1120. * @rmtoll CCCSR RDY2 LL_SBS_IsActiveFlag_VddIOCMPCR
  1121. * @retval State of bit (1 or 0).
  1122. */
  1123. __STATIC_INLINE uint32_t LL_SBS_IsActiveFlag_VddIOCMPCR(void)
  1124. {
  1125. return ((READ_BIT(SBS->CCCSR, SBS_CCCSR_RDY2) == (SBS_CCCSR_RDY2)) ? 1UL : 0UL);
  1126. }
  1127. /**
  1128. * @brief Set the compensation cell code selection of GPIO supplied by VDD
  1129. * @rmtoll CCCSR CS1 LL_SBS_SetVddCellCompensationCode
  1130. * @param CompCode: Selects the code to be applied for the Vdd compensation cell
  1131. * This parameter can be one of the following values:
  1132. * @arg LL_SBS_VDD_CELL_CODE : Select Code from the cell (available in the SBS_CCVALR)
  1133. * @arg LL_SBS_VDD_REGISTER_CODE: Select Code from the SBS compensation cell code register (SBS_CCSWCR)
  1134. * @retval None
  1135. */
  1136. __STATIC_INLINE void LL_SBS_SetVddCellCompensationCode(uint32_t CompCode)
  1137. {
  1138. SET_BIT(SBS->CCCSR, CompCode);
  1139. }
  1140. /**
  1141. * @brief Set the compensation cell code selection of GPIO supplied by VDDIO
  1142. * @rmtoll CCCSR CS2 LL_SBS_SetVddIOCellCompensationCode
  1143. * @param CompCode: Selects the code to be applied for the VddIO compensation cell
  1144. * This parameter can be one of the following values:
  1145. * @arg LL_SBS_VDDIO_CELL_CODE : Select Code from the cell (available in the SBS_CCVALR)
  1146. * @arg LL_SBS_VDDIO_REGISTER_CODE: Select Code from the SBS compensation cell code register (SBS_CCSWCR)
  1147. * @retval None
  1148. */
  1149. __STATIC_INLINE void LL_SBS_SetVddIOCellCompensationCode(uint32_t CompCode)
  1150. {
  1151. SET_BIT(SBS->CCCSR, CompCode);
  1152. }
  1153. /**
  1154. * @brief Get the compensation cell code selection of GPIO supplied by VDD
  1155. * @rmtoll CCCSR CS1 LL_SBS_GetVddCellCompensationCode
  1156. * @retval Returned value can be one of the following values:
  1157. * @arg LL_SBS_VDD_CELL_CODE : Selected Code is from the cell (available in the SBS_CCVALR)
  1158. * @arg LL_SBS_VDD_REGISTER_CODE: Selected Code is from the SBS compensation cell code register (SBS_CCSWCR)
  1159. */
  1160. __STATIC_INLINE uint32_t LL_SBS_GetVddCellCompensationCode(void)
  1161. {
  1162. return (uint32_t)(READ_BIT(SBS->CCCSR, SBS_CCCSR_CS1));
  1163. }
  1164. /**
  1165. * @brief Get the compensation cell code selection of GPIO supplied by VDDIO
  1166. * @rmtoll CCCSR CS2 LL_SBS_GetVddIOCellCompensationCode
  1167. * @retval Returned value can be one of the following values:
  1168. * @arg LL_SBS_VDDIO_CELL_CODE : Selected Code is from the cell (available in the SBS_CCVALR)
  1169. * @arg LL_SBS_VDDIO_REGISTER_CODE: Selected Code is from the SBS compensation cell code register (SBS_CCSWCR)
  1170. */
  1171. __STATIC_INLINE uint32_t LL_SBS_GetVddIOCellCompensationCode(void)
  1172. {
  1173. return (uint32_t)(READ_BIT(SBS->CCCSR, SBS_CCCSR_CS2));
  1174. }
  1175. /**
  1176. * @}
  1177. */
  1178. /** @defgroup SYSTEM_LL_DBGMCU_EF DBGMCU
  1179. * @{
  1180. */
  1181. /**
  1182. * @brief Return the device identifier
  1183. * @rmtoll DBGMCU_IDCODE DEV_ID LL_DBGMCU_GetDeviceID
  1184. * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF (ex: device ID is 0x6415)
  1185. */
  1186. __STATIC_INLINE uint32_t LL_DBGMCU_GetDeviceID(void)
  1187. {
  1188. return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_DEV_ID));
  1189. }
  1190. /**
  1191. * @brief Return the device revision identifier
  1192. * @note This field indicates the revision of the device.
  1193. * @rmtoll DBGMCU_IDCODE REV_ID LL_DBGMCU_GetRevisionID
  1194. * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF
  1195. */
  1196. __STATIC_INLINE uint32_t LL_DBGMCU_GetRevisionID(void)
  1197. {
  1198. return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_REV_ID) >> DBGMCU_IDCODE_REV_ID_Pos);
  1199. }
  1200. /**
  1201. * @brief Enable the Debug Module during STOP mode
  1202. * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_EnableDBGStopMode
  1203. * @retval None
  1204. */
  1205. __STATIC_INLINE void LL_DBGMCU_EnableDBGStopMode(void)
  1206. {
  1207. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
  1208. }
  1209. /**
  1210. * @brief Disable the Debug Module during STOP mode
  1211. * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_DisableDBGStopMode
  1212. * @retval None
  1213. */
  1214. __STATIC_INLINE void LL_DBGMCU_DisableDBGStopMode(void)
  1215. {
  1216. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
  1217. }
  1218. /**
  1219. * @brief Enable the Debug Module during STANDBY mode
  1220. * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_EnableDBGStandbyMode
  1221. * @retval None
  1222. */
  1223. __STATIC_INLINE void LL_DBGMCU_EnableDBGStandbyMode(void)
  1224. {
  1225. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
  1226. }
  1227. /**
  1228. * @brief Disable the Debug Module during STANDBY mode
  1229. * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_DisableDBGStandbyMode
  1230. * @retval None
  1231. */
  1232. __STATIC_INLINE void LL_DBGMCU_DisableDBGStandbyMode(void)
  1233. {
  1234. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
  1235. }
  1236. /**
  1237. * @brief Enable the Debug Clock Trace
  1238. * @rmtoll DBGMCU_CR TRACE_CLKEN LL_DBGMCU_EnableTraceClock
  1239. * @retval None
  1240. */
  1241. __STATIC_INLINE void LL_DBGMCU_EnableTraceClock(void)
  1242. {
  1243. SET_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_CLKEN);
  1244. }
  1245. /**
  1246. * @brief Disable the Debug Clock Trace
  1247. * @rmtoll DBGMCU_CR TRACE_CLKEN LL_DBGMCU_DisableTraceClock
  1248. * @retval None
  1249. */
  1250. __STATIC_INLINE void LL_DBGMCU_DisableTraceClock(void)
  1251. {
  1252. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_CLKEN);
  1253. }
  1254. /**
  1255. * @brief Check if clock trace is enabled or disabled.
  1256. * @rmtoll DBGMCU_CR_TRACE_CLKEN LL_DBGMCU_IsEnabledTraceClock
  1257. * @retval State of bit (1 or 0).
  1258. */
  1259. __STATIC_INLINE uint32_t LL_DBGMCU_IsEnabledTraceClock(void)
  1260. {
  1261. return ((READ_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_CLKEN) == DBGMCU_CR_TRACE_CLKEN) ? 1UL : 0UL);
  1262. }
  1263. /**
  1264. * @brief Set Trace pin assignment control
  1265. * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_SetTracePinAssignment\n
  1266. * DBGMCU_CR TRACE_MODE LL_DBGMCU_SetTracePinAssignment
  1267. * @param PinAssignment This parameter can be one of the following values:
  1268. * @arg @ref LL_DBGMCU_TRACE_NONE
  1269. * @arg @ref LL_DBGMCU_TRACE_ASYNCH
  1270. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1
  1271. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2
  1272. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4
  1273. * @retval None
  1274. */
  1275. __STATIC_INLINE void LL_DBGMCU_SetTracePinAssignment(uint32_t PinAssignment)
  1276. {
  1277. MODIFY_REG(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE, PinAssignment);
  1278. }
  1279. /**
  1280. * @brief Get Trace pin assignment control
  1281. * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_GetTracePinAssignment\n
  1282. * DBGMCU_CR TRACE_MODE LL_DBGMCU_GetTracePinAssignment
  1283. * @retval Returned value can be one of the following values:
  1284. * @arg @ref LL_DBGMCU_TRACE_NONE
  1285. * @arg @ref LL_DBGMCU_TRACE_ASYNCH
  1286. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1
  1287. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2
  1288. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4
  1289. */
  1290. __STATIC_INLINE uint32_t LL_DBGMCU_GetTracePinAssignment(void)
  1291. {
  1292. return (uint32_t)(READ_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE));
  1293. }
  1294. /**
  1295. * @brief Freeze APB1 peripherals (group1 peripherals)
  1296. * @rmtoll DBGMCU_APB1FZR1 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph
  1297. * @param Periphs This parameter can be a combination of the following values:
  1298. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP
  1299. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP
  1300. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP
  1301. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP
  1302. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP
  1303. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP
  1304. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP
  1305. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP
  1306. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP
  1307. * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP
  1308. * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP
  1309. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP
  1310. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP
  1311. * @arg @ref LL_DBGMCU_APB1_GRP1_I3C1_STOP
  1312. * @retval None
  1313. */
  1314. __STATIC_INLINE void LL_DBGMCU_APB1_GRP1_FreezePeriph(uint32_t Periphs)
  1315. {
  1316. SET_BIT(DBGMCU->APB1FZR1, Periphs);
  1317. }
  1318. /**
  1319. * @brief Freeze APB1 peripherals (group2 peripherals)
  1320. * @rmtoll DBGMCU_APB1FZR2 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP2_FreezePeriph
  1321. * @param Periphs This parameter can be a combination of the following values:
  1322. * @arg @ref LL_DBGMCU_APB1_GRP2_LPTIM2_STOP
  1323. * @retval None
  1324. */
  1325. __STATIC_INLINE void LL_DBGMCU_APB1_GRP2_FreezePeriph(uint32_t Periphs)
  1326. {
  1327. SET_BIT(DBGMCU->APB1FZR2, Periphs);
  1328. }
  1329. /**
  1330. * @brief Unfreeze APB1 peripherals (group1 peripherals)
  1331. * @rmtoll DBGMCU_APB1FZR1 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph
  1332. * @param Periphs This parameter can be a combination of the following values:
  1333. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP
  1334. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP
  1335. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP
  1336. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP
  1337. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP
  1338. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP
  1339. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP
  1340. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP
  1341. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP
  1342. * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP
  1343. * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP
  1344. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP
  1345. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP
  1346. * @arg @ref LL_DBGMCU_APB1_GRP1_I3C1_STOP
  1347. * @retval None
  1348. */
  1349. __STATIC_INLINE void LL_DBGMCU_APB1_GRP1_UnFreezePeriph(uint32_t Periphs)
  1350. {
  1351. CLEAR_BIT(DBGMCU->APB1FZR1, Periphs);
  1352. }
  1353. /**
  1354. * @brief Unfreeze APB1 peripherals (group2 peripherals)
  1355. * @rmtoll DBGMCU_APB1FZR2 DBG_xxxx_STOP LL_DBGMCU_APB1_GRP2_UnFreezePeriph
  1356. * @param Periphs This parameter can be a combination of the following values:
  1357. * @arg @ref LL_DBGMCU_APB1_GRP2_LPTIM2_STOP
  1358. * @retval None
  1359. */
  1360. __STATIC_INLINE void LL_DBGMCU_APB1_GRP2_UnFreezePeriph(uint32_t Periphs)
  1361. {
  1362. CLEAR_BIT(DBGMCU->APB1FZR2, Periphs);
  1363. }
  1364. /**
  1365. * @brief Freeze APB2 peripherals
  1366. * @rmtoll DBGMCU_APB2FZ DBG_TIMx_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph
  1367. * @param Periphs This parameter can be a combination of the following values:
  1368. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP
  1369. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP
  1370. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP
  1371. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP
  1372. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP
  1373. * @retval None
  1374. */
  1375. __STATIC_INLINE void LL_DBGMCU_APB2_GRP1_FreezePeriph(uint32_t Periphs)
  1376. {
  1377. SET_BIT(DBGMCU->APB2FZR, Periphs);
  1378. }
  1379. /**
  1380. * @brief Unfreeze APB2 peripherals
  1381. * @rmtoll DBGMCU_APB2FZR DBG_TIMx_STOP LL_DBGMCU_APB2_GRP1_UnFreezePeriph
  1382. * @param Periphs This parameter can be a combination of the following values:
  1383. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP
  1384. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP
  1385. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP
  1386. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP
  1387. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP
  1388. * @retval None
  1389. */
  1390. __STATIC_INLINE void LL_DBGMCU_APB2_GRP1_UnFreezePeriph(uint32_t Periphs)
  1391. {
  1392. CLEAR_BIT(DBGMCU->APB2FZR, Periphs);
  1393. }
  1394. /**
  1395. * @brief Freeze APB3 peripherals
  1396. * @rmtoll DBGMCU_APB3FZ DBG_TIMx_STOP LL_DBGMCU_APB3_GRP1_FreezePeriph
  1397. * @param Periphs This parameter can be a combination of the following values:
  1398. * @arg @ref LL_DBGMCU_APB3_GRP1_I2C3_STOP
  1399. * @arg @ref LL_DBGMCU_APB3_GRP1_I2C4_STOP
  1400. * @arg @ref LL_DBGMCU_APB3_GRP1_LPTIM1_STOP
  1401. * @arg @ref LL_DBGMCU_APB3_GRP1_RTC_STOP
  1402. * @retval None
  1403. */
  1404. __STATIC_INLINE void LL_DBGMCU_APB3_GRP1_FreezePeriph(uint32_t Periphs)
  1405. {
  1406. SET_BIT(DBGMCU->APB3FZR, Periphs);
  1407. }
  1408. /**
  1409. * @brief Unfreeze APB3 peripherals
  1410. * @rmtoll DBGMCU_APB3FZR DBG_TIMx_STOP LL_DBGMCU_APB3_GRP1_UnFreezePeriph
  1411. * @param Periphs This parameter can be a combination of the following values:
  1412. * @arg @ref LL_DBGMCU_APB3_GRP1_I2C3_STOP
  1413. * @arg @ref LL_DBGMCU_APB3_GRP1_I2C4_STOP
  1414. * @arg @ref LL_DBGMCU_APB3_GRP1_LPTIM1_STOP
  1415. * @arg @ref LL_DBGMCU_APB3_GRP1_RTC_STOP
  1416. * @retval None
  1417. */
  1418. __STATIC_INLINE void LL_DBGMCU_APB3_GRP1_UnFreezePeriph(uint32_t Periphs)
  1419. {
  1420. CLEAR_BIT(DBGMCU->APB3FZR, Periphs);
  1421. }
  1422. /**
  1423. * @}
  1424. */
  1425. #if defined(VREFBUF)
  1426. /** @defgroup SYSTEM_LL_VREFBUF_EF VREFBUF
  1427. * @{
  1428. */
  1429. /**
  1430. * @brief Enable Internal voltage reference
  1431. * @rmtoll VREFBUF_CSR ENVR LL_VREFBUF_Enable
  1432. * @retval None
  1433. */
  1434. __STATIC_INLINE void LL_VREFBUF_Enable(void)
  1435. {
  1436. SET_BIT(VREFBUF->CSR, VREFBUF_CSR_ENVR);
  1437. }
  1438. /**
  1439. * @brief Disable Internal voltage reference
  1440. * @rmtoll VREFBUF_CSR ENVR LL_VREFBUF_Disable
  1441. * @retval None
  1442. */
  1443. __STATIC_INLINE void LL_VREFBUF_Disable(void)
  1444. {
  1445. CLEAR_BIT(VREFBUF->CSR, VREFBUF_CSR_ENVR);
  1446. }
  1447. /**
  1448. * @brief Enable high impedance (VREF+pin is high impedance)
  1449. * @rmtoll VREFBUF_CSR HIZ LL_VREFBUF_EnableHIZ
  1450. * @retval None
  1451. */
  1452. __STATIC_INLINE void LL_VREFBUF_EnableHIZ(void)
  1453. {
  1454. SET_BIT(VREFBUF->CSR, VREFBUF_CSR_HIZ);
  1455. }
  1456. /**
  1457. * @brief Disable high impedance (VREF+pin is internally connected to the voltage reference buffer output)
  1458. * @rmtoll VREFBUF_CSR HIZ LL_VREFBUF_DisableHIZ
  1459. * @retval None
  1460. */
  1461. __STATIC_INLINE void LL_VREFBUF_DisableHIZ(void)
  1462. {
  1463. CLEAR_BIT(VREFBUF->CSR, VREFBUF_CSR_HIZ);
  1464. }
  1465. /**
  1466. * @brief Set the Voltage reference scale
  1467. * @rmtoll VREFBUF_CSR VRS LL_VREFBUF_SetVoltageScaling
  1468. * @param Scale This parameter can be one of the following values:
  1469. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE0
  1470. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE1
  1471. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE2
  1472. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE3
  1473. * @retval None
  1474. */
  1475. __STATIC_INLINE void LL_VREFBUF_SetVoltageScaling(uint32_t Scale)
  1476. {
  1477. MODIFY_REG(VREFBUF->CSR, VREFBUF_CSR_VRS, Scale);
  1478. }
  1479. /**
  1480. * @brief Get the Voltage reference scale
  1481. * @rmtoll VREFBUF_CSR VRS LL_VREFBUF_GetVoltageScaling
  1482. * @retval Returned value can be one of the following values:
  1483. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE0
  1484. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE1
  1485. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE2
  1486. * @arg @ref LL_VREFBUF_VOLTAGE_SCALE3
  1487. */
  1488. __STATIC_INLINE uint32_t LL_VREFBUF_GetVoltageScaling(void)
  1489. {
  1490. return (uint32_t)(READ_BIT(VREFBUF->CSR, VREFBUF_CSR_VRS));
  1491. }
  1492. /**
  1493. * @brief Check if Voltage reference buffer is ready
  1494. * @rmtoll VREFBUF_CSR VRR LL_VREFBUF_IsVREFReady
  1495. * @retval State of bit (1 or 0).
  1496. */
  1497. __STATIC_INLINE uint32_t LL_VREFBUF_IsVREFReady(void)
  1498. {
  1499. return ((READ_BIT(VREFBUF->CSR, VREFBUF_CSR_VRR) == VREFBUF_CSR_VRR) ? 1UL : 0UL);
  1500. }
  1501. /**
  1502. * @brief Get the trimming code for VREFBUF calibration
  1503. * @rmtoll VREFBUF_CCR TRIM LL_VREFBUF_GetTrimming
  1504. * @retval Between 0 and 0x3F
  1505. */
  1506. __STATIC_INLINE uint32_t LL_VREFBUF_GetTrimming(void)
  1507. {
  1508. return (uint32_t)(READ_BIT(VREFBUF->CCR, VREFBUF_CCR_TRIM));
  1509. }
  1510. /**
  1511. * @brief Set the trimming code for VREFBUF calibration (Tune the internal reference buffer voltage)
  1512. * @rmtoll VREFBUF_CCR TRIM LL_VREFBUF_SetTrimming
  1513. * @param Value Between 0 and 0x3F
  1514. * @retval None
  1515. */
  1516. __STATIC_INLINE void LL_VREFBUF_SetTrimming(uint32_t Value)
  1517. {
  1518. WRITE_REG(VREFBUF->CCR, Value);
  1519. }
  1520. /**
  1521. * @}
  1522. */
  1523. #endif /* VREFBUF */
  1524. /** @defgroup SYSTEM_LL_FLASH_EF FLASH
  1525. * @{
  1526. */
  1527. /**
  1528. * @brief Set FLASH Latency
  1529. * @rmtoll FLASH_ACR LATENCY LL_FLASH_SetLatency
  1530. * @param Latency This parameter can be one of the following values:
  1531. * @arg @ref LL_FLASH_LATENCY_0
  1532. * @arg @ref LL_FLASH_LATENCY_1
  1533. * @arg @ref LL_FLASH_LATENCY_2
  1534. * @arg @ref LL_FLASH_LATENCY_3
  1535. * @arg @ref LL_FLASH_LATENCY_4
  1536. * @arg @ref LL_FLASH_LATENCY_5
  1537. * @arg @ref LL_FLASH_LATENCY_6
  1538. * @arg @ref LL_FLASH_LATENCY_7
  1539. * @arg @ref LL_FLASH_LATENCY_8
  1540. * @arg @ref LL_FLASH_LATENCY_9
  1541. * @arg @ref LL_FLASH_LATENCY_10
  1542. * @arg @ref LL_FLASH_LATENCY_11
  1543. * @arg @ref LL_FLASH_LATENCY_12
  1544. * @arg @ref LL_FLASH_LATENCY_13
  1545. * @arg @ref LL_FLASH_LATENCY_14
  1546. * @arg @ref LL_FLASH_LATENCY_15
  1547. * @retval None
  1548. */
  1549. __STATIC_INLINE void LL_FLASH_SetLatency(uint32_t Latency)
  1550. {
  1551. MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, Latency);
  1552. }
  1553. /**
  1554. * @brief Get FLASH Latency
  1555. * @rmtoll FLASH_ACR LATENCY LL_FLASH_GetLatency
  1556. * @retval Returned value can be one of the following values:
  1557. * @arg @ref LL_FLASH_LATENCY_0
  1558. * @arg @ref LL_FLASH_LATENCY_1
  1559. * @arg @ref LL_FLASH_LATENCY_2
  1560. * @arg @ref LL_FLASH_LATENCY_3
  1561. * @arg @ref LL_FLASH_LATENCY_4
  1562. * @arg @ref LL_FLASH_LATENCY_5
  1563. * @arg @ref LL_FLASH_LATENCY_6
  1564. * @arg @ref LL_FLASH_LATENCY_7
  1565. * @arg @ref LL_FLASH_LATENCY_8
  1566. * @arg @ref LL_FLASH_LATENCY_9
  1567. * @arg @ref LL_FLASH_LATENCY_10
  1568. * @arg @ref LL_FLASH_LATENCY_11
  1569. * @arg @ref LL_FLASH_LATENCY_12
  1570. * @arg @ref LL_FLASH_LATENCY_13
  1571. * @arg @ref LL_FLASH_LATENCY_14
  1572. * @arg @ref LL_FLASH_LATENCY_15
  1573. */
  1574. __STATIC_INLINE uint32_t LL_FLASH_GetLatency(void)
  1575. {
  1576. return (uint32_t)(READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY));
  1577. }
  1578. /**
  1579. * @}
  1580. */
  1581. /** @defgroup SYSTEM_LL_SBS_EF_ERASE_MEMORY_STATUS_CLEAR Erase Memory Status
  1582. * @{
  1583. */
  1584. /**
  1585. * @brief Clear Status of End of Erase for ICACHE and PKA RAMs
  1586. * @rmtoll MESR IPMEE LL_SBS_ClearEraseEndStatus
  1587. * @retval None
  1588. */
  1589. __STATIC_INLINE void LL_SBS_ClearEraseEndStatus(void)
  1590. {
  1591. WRITE_REG(SBS->MESR, SBS_MESR_IPMEE);
  1592. }
  1593. /**
  1594. * @brief Get Status of End of Erase for ICACHE and PKA RAMs
  1595. * @rmtoll MESR IPMEE LL_SBS_GetEraseEndStatus
  1596. * @retval Returned value can be one of the following values:
  1597. * @arg LL_SBS_MEMORIES_ERASE_IPMEE_ON_GOING : Erase of ICACHE and PKA RAMs on going or flag cleared by SW
  1598. * @arg LL_SBS_MEMORIES_ERASE_IPMEE_ENDED: Erase of ICACHE and PKA RAMs ended
  1599. */
  1600. __STATIC_INLINE uint32_t LL_SBS_GetEraseEndStatus(void)
  1601. {
  1602. return (uint32_t)(READ_BIT(SBS->MESR, SBS_MESR_IPMEE));
  1603. }
  1604. /**
  1605. * @brief Clear Status of End of Erase after Power-on Reset for SRAM2, BKPRAM, ICACHE, DCACHE and PKA RAMs
  1606. * @rmtoll MESR MCLR LL_SBS_ClearEraseAfterResetStatus
  1607. * @retval None
  1608. */
  1609. __STATIC_INLINE void LL_SBS_ClearEraseAfterResetStatus(void)
  1610. {
  1611. WRITE_REG(SBS->MESR, SBS_MESR_MCLR);
  1612. }
  1613. /**
  1614. * @brief Get Status of End of Erase after Power-on Reset for SRAM2, BKPRAM, ICACHE, DCACHE and PKA RAMs
  1615. * @rmtoll MESR MCLR LL_SBS_GetEraseAfterResetStatus
  1616. * @retval Returned value can be one of the following values:
  1617. * @arg LL_SBS_MEMORIES_ERASE_MCLR_ON_GOING : Erase of memories on going or flag cleared by SW
  1618. * @arg LL_SBS_MEMORIES_ERASE_MCLR_ENDED: Erase of memories ended
  1619. */
  1620. __STATIC_INLINE uint32_t LL_SBS_GetEraseAfterResetStatus(void)
  1621. {
  1622. return (uint32_t)(READ_BIT(SBS->MESR, SBS_MESR_MCLR));
  1623. }
  1624. /**
  1625. * @}
  1626. */
  1627. /**
  1628. * @}
  1629. */
  1630. /**
  1631. * @}
  1632. */
  1633. #endif /* defined (FLASH) || defined (SBS) || defined (DBGMCU) || defined (VREFBUF) */
  1634. /**
  1635. * @}
  1636. */
  1637. #ifdef __cplusplus
  1638. }
  1639. #endif
  1640. #endif /* STM32H5xx_LL_SYSTEM_H */