stm32f1xx_ll_system.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_system.h
  4. * @author MCD Application Team
  5. * @brief Header file of SYSTEM LL module.
  6. @verbatim
  7. ==============================================================================
  8. ##### How to use this driver #####
  9. ==============================================================================
  10. [..]
  11. The LL SYSTEM driver contains a set of generic APIs that can be
  12. used by user:
  13. (+) Some of the FLASH features need to be handled in the SYSTEM file.
  14. (+) Access to DBGCMU registers
  15. (+) Access to SYSCFG registers
  16. @endverbatim
  17. ******************************************************************************
  18. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. /* Define to prevent recursive inclusion -------------------------------------*/
  31. #ifndef __STM32F1xx_LL_SYSTEM_H
  32. #define __STM32F1xx_LL_SYSTEM_H
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "stm32f1xx.h"
  38. /** @addtogroup STM32F1xx_LL_Driver
  39. * @{
  40. */
  41. #if defined (FLASH) || defined (DBGMCU)
  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. /**
  52. * @}
  53. */
  54. /* Private macros ------------------------------------------------------------*/
  55. /* Exported types ------------------------------------------------------------*/
  56. /* Exported constants --------------------------------------------------------*/
  57. /** @defgroup SYSTEM_LL_Exported_Constants SYSTEM Exported Constants
  58. * @{
  59. */
  60. /** @defgroup SYSTEM_LL_EC_TRACE DBGMCU TRACE Pin Assignment
  61. * @{
  62. */
  63. #define LL_DBGMCU_TRACE_NONE 0x00000000U /*!< TRACE pins not assigned (default state) */
  64. #define LL_DBGMCU_TRACE_ASYNCH DBGMCU_CR_TRACE_IOEN /*!< TRACE pin assignment for Asynchronous Mode */
  65. #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 */
  66. #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 */
  67. #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 */
  68. /**
  69. * @}
  70. */
  71. /** @defgroup SYSTEM_LL_EC_APB1_GRP1_STOP_IP DBGMCU APB1 GRP1 STOP IP
  72. * @{
  73. */
  74. #define LL_DBGMCU_APB1_GRP1_TIM2_STOP DBGMCU_CR_DBG_TIM2_STOP /*!< TIM2 counter stopped when core is halted */
  75. #define LL_DBGMCU_APB1_GRP1_TIM3_STOP DBGMCU_CR_DBG_TIM3_STOP /*!< TIM3 counter stopped when core is halted */
  76. #define LL_DBGMCU_APB1_GRP1_TIM4_STOP DBGMCU_CR_DBG_TIM4_STOP /*!< TIM4 counter stopped when core is halted */
  77. #if defined(DBGMCU_CR_DBG_TIM5_STOP)
  78. #define LL_DBGMCU_APB1_GRP1_TIM5_STOP DBGMCU_CR_DBG_TIM5_STOP /*!< TIM5 counter stopped when core is halted */
  79. #endif /* DBGMCU_CR_DBG_TIM5_STOP */
  80. #if defined(DBGMCU_CR_DBG_TIM6_STOP)
  81. #define LL_DBGMCU_APB1_GRP1_TIM6_STOP DBGMCU_CR_DBG_TIM6_STOP /*!< TIM6 counter stopped when core is halted */
  82. #endif /* DBGMCU_CR_DBG_TIM6_STOP */
  83. #if defined(DBGMCU_CR_DBG_TIM7_STOP)
  84. #define LL_DBGMCU_APB1_GRP1_TIM7_STOP DBGMCU_CR_DBG_TIM7_STOP /*!< TIM7 counter stopped when core is halted */
  85. #endif /* DBGMCU_CR_DBG_TIM7_STOP */
  86. #if defined(DBGMCU_CR_DBG_TIM12_STOP)
  87. #define LL_DBGMCU_APB1_GRP1_TIM12_STOP DBGMCU_CR_DBG_TIM12_STOP /*!< TIM12 counter stopped when core is halted */
  88. #endif /* DBGMCU_CR_DBG_TIM12_STOP */
  89. #if defined(DBGMCU_CR_DBG_TIM13_STOP)
  90. #define LL_DBGMCU_APB1_GRP1_TIM13_STOP DBGMCU_CR_DBG_TIM13_STOP /*!< TIM13 counter stopped when core is halted */
  91. #endif /* DBGMCU_CR_DBG_TIM13_STOP */
  92. #if defined(DBGMCU_CR_DBG_TIM14_STOP)
  93. #define LL_DBGMCU_APB1_GRP1_TIM14_STOP DBGMCU_CR_DBG_TIM14_STOP /*!< TIM14 counter stopped when core is halted */
  94. #endif /* DBGMCU_CR_DBG_TIM14_STOP */
  95. #define LL_DBGMCU_APB1_GRP1_WWDG_STOP DBGMCU_CR_DBG_WWDG_STOP /*!< Debug Window Watchdog stopped when Core is halted */
  96. #define LL_DBGMCU_APB1_GRP1_IWDG_STOP DBGMCU_CR_DBG_IWDG_STOP /*!< Debug Independent Watchdog stopped when Core is halted */
  97. #define LL_DBGMCU_APB1_GRP1_I2C1_STOP DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT /*!< I2C1 SMBUS timeout mode stopped when Core is halted */
  98. #if defined(DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
  99. #define LL_DBGMCU_APB1_GRP1_I2C2_STOP DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT /*!< I2C2 SMBUS timeout mode stopped when Core is halted */
  100. #endif /* DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT */
  101. #if defined(DBGMCU_CR_DBG_CAN1_STOP)
  102. #define LL_DBGMCU_APB1_GRP1_CAN1_STOP DBGMCU_CR_DBG_CAN1_STOP /*!< CAN1 debug stopped when Core is halted */
  103. #endif /* DBGMCU_CR_DBG_CAN1_STOP */
  104. #if defined(DBGMCU_CR_DBG_CAN2_STOP)
  105. #define LL_DBGMCU_APB1_GRP1_CAN2_STOP DBGMCU_CR_DBG_CAN2_STOP /*!< CAN2 debug stopped when Core is halted */
  106. #endif /* DBGMCU_CR_DBG_CAN2_STOP */
  107. /**
  108. * @}
  109. */
  110. /** @defgroup SYSTEM_LL_EC_APB2_GRP1_STOP_IP DBGMCU APB2 GRP1 STOP IP
  111. * @{
  112. */
  113. #define LL_DBGMCU_APB2_GRP1_TIM1_STOP DBGMCU_CR_DBG_TIM1_STOP /*!< TIM1 counter stopped when core is halted */
  114. #if defined(DBGMCU_CR_DBG_TIM8_STOP)
  115. #define LL_DBGMCU_APB2_GRP1_TIM8_STOP DBGMCU_CR_DBG_TIM8_STOP /*!< TIM8 counter stopped when core is halted */
  116. #endif /* DBGMCU_CR_DBG_CAN1_STOP */
  117. #if defined(DBGMCU_CR_DBG_TIM9_STOP)
  118. #define LL_DBGMCU_APB2_GRP1_TIM9_STOP DBGMCU_CR_DBG_TIM9_STOP /*!< TIM9 counter stopped when core is halted */
  119. #endif /* DBGMCU_CR_DBG_TIM9_STOP */
  120. #if defined(DBGMCU_CR_DBG_TIM10_STOP)
  121. #define LL_DBGMCU_APB2_GRP1_TIM10_STOP DBGMCU_CR_DBG_TIM10_STOP /*!< TIM10 counter stopped when core is halted */
  122. #endif /* DBGMCU_CR_DBG_TIM10_STOP */
  123. #if defined(DBGMCU_CR_DBG_TIM11_STOP)
  124. #define LL_DBGMCU_APB2_GRP1_TIM11_STOP DBGMCU_CR_DBG_TIM11_STOP /*!< TIM11 counter stopped when core is halted */
  125. #endif /* DBGMCU_CR_DBG_TIM11_STOP */
  126. #if defined(DBGMCU_CR_DBG_TIM15_STOP)
  127. #define LL_DBGMCU_APB2_GRP1_TIM15_STOP DBGMCU_CR_DBG_TIM15_STOP /*!< TIM15 counter stopped when core is halted */
  128. #endif /* DBGMCU_CR_DBG_TIM15_STOP */
  129. #if defined(DBGMCU_CR_DBG_TIM16_STOP)
  130. #define LL_DBGMCU_APB2_GRP1_TIM16_STOP DBGMCU_CR_DBG_TIM16_STOP /*!< TIM16 counter stopped when core is halted */
  131. #endif /* DBGMCU_CR_DBG_TIM16_STOP */
  132. #if defined(DBGMCU_CR_DBG_TIM17_STOP)
  133. #define LL_DBGMCU_APB2_GRP1_TIM17_STOP DBGMCU_CR_DBG_TIM17_STOP /*!< TIM17 counter stopped when core is halted */
  134. #endif /* DBGMCU_CR_DBG_TIM17_STOP */
  135. /**
  136. * @}
  137. */
  138. /** @defgroup SYSTEM_LL_EC_LATENCY FLASH LATENCY
  139. * @{
  140. */
  141. #if defined(FLASH_ACR_LATENCY)
  142. #define LL_FLASH_LATENCY_0 0x00000000U /*!< FLASH Zero Latency cycle */
  143. #define LL_FLASH_LATENCY_1 FLASH_ACR_LATENCY_0 /*!< FLASH One Latency cycle */
  144. #define LL_FLASH_LATENCY_2 FLASH_ACR_LATENCY_1 /*!< FLASH Two wait states */
  145. #else
  146. #endif /* FLASH_ACR_LATENCY */
  147. /**
  148. * @}
  149. */
  150. /**
  151. * @}
  152. */
  153. /* Exported macro ------------------------------------------------------------*/
  154. /* Exported functions --------------------------------------------------------*/
  155. /** @defgroup SYSTEM_LL_Exported_Functions SYSTEM Exported Functions
  156. * @{
  157. */
  158. /** @defgroup SYSTEM_LL_EF_DBGMCU DBGMCU
  159. * @{
  160. */
  161. /**
  162. * @brief Return the device identifier
  163. * @note For Low Density devices, the device ID is 0x412
  164. * @note For Medium Density devices, the device ID is 0x410
  165. * @note For High Density devices, the device ID is 0x414
  166. * @note For XL Density devices, the device ID is 0x430
  167. * @note For Connectivity Line devices, the device ID is 0x418
  168. * @rmtoll DBGMCU_IDCODE DEV_ID LL_DBGMCU_GetDeviceID
  169. * @retval Values between Min_Data=0x00 and Max_Data=0xFFF
  170. */
  171. __STATIC_INLINE uint32_t LL_DBGMCU_GetDeviceID(void)
  172. {
  173. return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_DEV_ID));
  174. }
  175. /**
  176. * @brief Return the device revision identifier
  177. * @note This field indicates the revision of the device.
  178. For example, it is read as revA -> 0x1000,for Low Density devices
  179. For example, it is read as revA -> 0x0000, revB -> 0x2000, revZ -> 0x2001, rev1,2,3,X or Y -> 0x2003,for Medium Density devices
  180. For example, it is read as revA or 1 -> 0x1000, revZ -> 0x1001,rev1,2,3,X or Y -> 0x1003,for Medium Density devices
  181. For example, it is read as revA or 1 -> 0x1003,for XL Density devices
  182. For example, it is read as revA -> 0x1000, revZ -> 0x1001 for Connectivity line devices
  183. * @rmtoll DBGMCU_IDCODE REV_ID LL_DBGMCU_GetRevisionID
  184. * @retval Values between Min_Data=0x00 and Max_Data=0xFFFF
  185. */
  186. __STATIC_INLINE uint32_t LL_DBGMCU_GetRevisionID(void)
  187. {
  188. return (uint32_t)(READ_BIT(DBGMCU->IDCODE, DBGMCU_IDCODE_REV_ID) >> DBGMCU_IDCODE_REV_ID_Pos);
  189. }
  190. /**
  191. * @brief Enable the Debug Module during SLEEP mode
  192. * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_EnableDBGSleepMode
  193. * @retval None
  194. */
  195. __STATIC_INLINE void LL_DBGMCU_EnableDBGSleepMode(void)
  196. {
  197. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
  198. }
  199. /**
  200. * @brief Disable the Debug Module during SLEEP mode
  201. * @rmtoll DBGMCU_CR DBG_SLEEP LL_DBGMCU_DisableDBGSleepMode
  202. * @retval None
  203. */
  204. __STATIC_INLINE void LL_DBGMCU_DisableDBGSleepMode(void)
  205. {
  206. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
  207. }
  208. /**
  209. * @brief Enable the Debug Module during STOP mode
  210. * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_EnableDBGStopMode
  211. * @retval None
  212. */
  213. __STATIC_INLINE void LL_DBGMCU_EnableDBGStopMode(void)
  214. {
  215. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
  216. }
  217. /**
  218. * @brief Disable the Debug Module during STOP mode
  219. * @rmtoll DBGMCU_CR DBG_STOP LL_DBGMCU_DisableDBGStopMode
  220. * @retval None
  221. */
  222. __STATIC_INLINE void LL_DBGMCU_DisableDBGStopMode(void)
  223. {
  224. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
  225. }
  226. /**
  227. * @brief Enable the Debug Module during STANDBY mode
  228. * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_EnableDBGStandbyMode
  229. * @retval None
  230. */
  231. __STATIC_INLINE void LL_DBGMCU_EnableDBGStandbyMode(void)
  232. {
  233. SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
  234. }
  235. /**
  236. * @brief Disable the Debug Module during STANDBY mode
  237. * @rmtoll DBGMCU_CR DBG_STANDBY LL_DBGMCU_DisableDBGStandbyMode
  238. * @retval None
  239. */
  240. __STATIC_INLINE void LL_DBGMCU_DisableDBGStandbyMode(void)
  241. {
  242. CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
  243. }
  244. /**
  245. * @brief Set Trace pin assignment control
  246. * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_SetTracePinAssignment\n
  247. * DBGMCU_CR TRACE_MODE LL_DBGMCU_SetTracePinAssignment
  248. * @param PinAssignment This parameter can be one of the following values:
  249. * @arg @ref LL_DBGMCU_TRACE_NONE
  250. * @arg @ref LL_DBGMCU_TRACE_ASYNCH
  251. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1
  252. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2
  253. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4
  254. * @retval None
  255. */
  256. __STATIC_INLINE void LL_DBGMCU_SetTracePinAssignment(uint32_t PinAssignment)
  257. {
  258. MODIFY_REG(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE, PinAssignment);
  259. }
  260. /**
  261. * @brief Get Trace pin assignment control
  262. * @rmtoll DBGMCU_CR TRACE_IOEN LL_DBGMCU_GetTracePinAssignment\n
  263. * DBGMCU_CR TRACE_MODE LL_DBGMCU_GetTracePinAssignment
  264. * @retval Returned value can be one of the following values:
  265. * @arg @ref LL_DBGMCU_TRACE_NONE
  266. * @arg @ref LL_DBGMCU_TRACE_ASYNCH
  267. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE1
  268. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE2
  269. * @arg @ref LL_DBGMCU_TRACE_SYNCH_SIZE4
  270. */
  271. __STATIC_INLINE uint32_t LL_DBGMCU_GetTracePinAssignment(void)
  272. {
  273. return (uint32_t)(READ_BIT(DBGMCU->CR, DBGMCU_CR_TRACE_IOEN | DBGMCU_CR_TRACE_MODE));
  274. }
  275. /**
  276. * @brief Freeze APB1 peripherals (group1 peripherals)
  277. * @rmtoll DBGMCU_CR_APB1 DBG_TIM2_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  278. * DBGMCU_CR_APB1 DBG_TIM3_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  279. * DBGMCU_CR_APB1 DBG_TIM4_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  280. * DBGMCU_CR_APB1 DBG_TIM5_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  281. * DBGMCU_CR_APB1 DBG_TIM6_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  282. * DBGMCU_CR_APB1 DBG_TIM7_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  283. * DBGMCU_CR_APB1 DBG_TIM12_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  284. * DBGMCU_CR_APB1 DBG_TIM13_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  285. * DBGMCU_CR_APB1 DBG_TIM14_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  286. * DBGMCU_CR_APB1 DBG_RTC_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  287. * DBGMCU_CR_APB1 DBG_WWDG_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  288. * DBGMCU_CR_APB1 DBG_IWDG_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  289. * DBGMCU_CR_APB1 DBG_I2C1_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  290. * DBGMCU_CR_APB1 DBG_I2C2_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  291. * DBGMCU_CR_APB1 DBG_CAN1_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph\n
  292. * DBGMCU_CR_APB1 DBG_CAN2_STOP LL_DBGMCU_APB1_GRP1_FreezePeriph
  293. * @param Periphs This parameter can be a combination of the following values:
  294. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP
  295. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP
  296. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP
  297. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP
  298. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP
  299. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP
  300. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP
  301. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP
  302. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP
  303. * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP
  304. * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP
  305. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP
  306. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP (*)
  307. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN1_STOP (*)
  308. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*)
  309. *
  310. * (*) value not defined in all devices.
  311. * @retval None
  312. */
  313. __STATIC_INLINE void LL_DBGMCU_APB1_GRP1_FreezePeriph(uint32_t Periphs)
  314. {
  315. SET_BIT(DBGMCU->CR, Periphs);
  316. }
  317. /**
  318. * @brief Unfreeze APB1 peripherals (group1 peripherals)
  319. * @rmtoll DBGMCU_CR_APB1 DBG_TIM2_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  320. * DBGMCU_CR_APB1 DBG_TIM3_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  321. * DBGMCU_CR_APB1 DBG_TIM4_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  322. * DBGMCU_CR_APB1 DBG_TIM5_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  323. * DBGMCU_CR_APB1 DBG_TIM6_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  324. * DBGMCU_CR_APB1 DBG_TIM7_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  325. * DBGMCU_CR_APB1 DBG_TIM12_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  326. * DBGMCU_CR_APB1 DBG_TIM13_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  327. * DBGMCU_CR_APB1 DBG_TIM14_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  328. * DBGMCU_CR_APB1 DBG_RTC_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  329. * DBGMCU_CR_APB1 DBG_WWDG_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  330. * DBGMCU_CR_APB1 DBG_IWDG_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  331. * DBGMCU_CR_APB1 DBG_I2C1_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  332. * DBGMCU_CR_APB1 DBG_I2C2_SMBUS_TIMEOUT LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  333. * DBGMCU_CR_APB1 DBG_CAN1_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph\n
  334. * DBGMCU_CR_APB1 DBG_CAN2_STOP LL_DBGMCU_APB1_GRP1_UnFreezePeriph
  335. * @param Periphs This parameter can be a combination of the following values:
  336. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM2_STOP
  337. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM3_STOP
  338. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM4_STOP
  339. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM5_STOP
  340. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM6_STOP
  341. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM7_STOP
  342. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM12_STOP
  343. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM13_STOP
  344. * @arg @ref LL_DBGMCU_APB1_GRP1_TIM14_STOP
  345. * @arg @ref LL_DBGMCU_APB1_GRP1_RTC_STOP
  346. * @arg @ref LL_DBGMCU_APB1_GRP1_WWDG_STOP
  347. * @arg @ref LL_DBGMCU_APB1_GRP1_IWDG_STOP
  348. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C1_STOP
  349. * @arg @ref LL_DBGMCU_APB1_GRP1_I2C2_STOP (*)
  350. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN1_STOP (*)
  351. * @arg @ref LL_DBGMCU_APB1_GRP1_CAN2_STOP (*)
  352. *
  353. * (*) value not defined in all devices.
  354. * @retval None
  355. */
  356. __STATIC_INLINE void LL_DBGMCU_APB1_GRP1_UnFreezePeriph(uint32_t Periphs)
  357. {
  358. CLEAR_BIT(DBGMCU->CR, Periphs);
  359. }
  360. /**
  361. * @brief Freeze APB2 peripherals
  362. * @rmtoll DBGMCU_CR_APB2 DBG_TIM1_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  363. * DBGMCU_CR_APB2 DBG_TIM8_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  364. * DBGMCU_CR_APB2 DBG_TIM9_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  365. * DBGMCU_CR_APB2 DBG_TIM10_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  366. * DBGMCU_CR_APB2 DBG_TIM11_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  367. * DBGMCU_CR_APB2 DBG_TIM15_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  368. * DBGMCU_CR_APB2 DBG_TIM16_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  369. * DBGMCU_CR_APB2 DBG_TIM17_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph
  370. * @param Periphs This parameter can be a combination of the following values:
  371. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP
  372. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*)
  373. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM9_STOP (*)
  374. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM10_STOP (*)
  375. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM11_STOP (*)
  376. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP (*)
  377. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP (*)
  378. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP (*)
  379. *
  380. * (*) value not defined in all devices.
  381. * @retval None
  382. */
  383. __STATIC_INLINE void LL_DBGMCU_APB2_GRP1_FreezePeriph(uint32_t Periphs)
  384. {
  385. SET_BIT(DBGMCU->CR, Periphs);
  386. }
  387. /**
  388. * @brief Unfreeze APB2 peripherals
  389. * @rmtoll DBGMCU_CR_APB2 DBG_TIM1_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  390. * DBGMCU_CR_APB2 DBG_TIM8_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  391. * DBGMCU_CR_APB2 DBG_TIM9_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  392. * DBGMCU_CR_APB2 DBG_TIM10_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  393. * DBGMCU_CR_APB2 DBG_TIM11_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  394. * DBGMCU_CR_APB2 DBG_TIM15_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  395. * DBGMCU_CR_APB2 DBG_TIM16_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph\n
  396. * DBGMCU_CR_APB2 DBG_TIM17_STOP LL_DBGMCU_APB2_GRP1_FreezePeriph
  397. * @param Periphs This parameter can be a combination of the following values:
  398. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM1_STOP
  399. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM8_STOP (*)
  400. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM9_STOP (*)
  401. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM10_STOP (*)
  402. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM11_STOP (*)
  403. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM15_STOP (*)
  404. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM16_STOP (*)
  405. * @arg @ref LL_DBGMCU_APB2_GRP1_TIM17_STOP (*)
  406. *
  407. * (*) value not defined in all devices.
  408. * @retval None
  409. */
  410. __STATIC_INLINE void LL_DBGMCU_APB2_GRP1_UnFreezePeriph(uint32_t Periphs)
  411. {
  412. CLEAR_BIT(DBGMCU->CR, Periphs);
  413. }
  414. /**
  415. * @}
  416. */
  417. #if defined(FLASH_ACR_LATENCY)
  418. /** @defgroup SYSTEM_LL_EF_FLASH FLASH
  419. * @{
  420. */
  421. /**
  422. * @brief Set FLASH Latency
  423. * @rmtoll FLASH_ACR LATENCY LL_FLASH_SetLatency
  424. * @param Latency This parameter can be one of the following values:
  425. * @arg @ref LL_FLASH_LATENCY_0
  426. * @arg @ref LL_FLASH_LATENCY_1
  427. * @arg @ref LL_FLASH_LATENCY_2
  428. * @retval None
  429. */
  430. __STATIC_INLINE void LL_FLASH_SetLatency(uint32_t Latency)
  431. {
  432. MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, Latency);
  433. }
  434. /**
  435. * @brief Get FLASH Latency
  436. * @rmtoll FLASH_ACR LATENCY LL_FLASH_GetLatency
  437. * @retval Returned value can be one of the following values:
  438. * @arg @ref LL_FLASH_LATENCY_0
  439. * @arg @ref LL_FLASH_LATENCY_1
  440. * @arg @ref LL_FLASH_LATENCY_2
  441. */
  442. __STATIC_INLINE uint32_t LL_FLASH_GetLatency(void)
  443. {
  444. return (uint32_t)(READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY));
  445. }
  446. /**
  447. * @brief Enable Prefetch
  448. * @rmtoll FLASH_ACR PRFTBE LL_FLASH_EnablePrefetch
  449. * @retval None
  450. */
  451. __STATIC_INLINE void LL_FLASH_EnablePrefetch(void)
  452. {
  453. SET_BIT(FLASH->ACR, FLASH_ACR_PRFTBE);
  454. }
  455. /**
  456. * @brief Disable Prefetch
  457. * @rmtoll FLASH_ACR PRFTBE LL_FLASH_DisablePrefetch
  458. * @retval None
  459. */
  460. __STATIC_INLINE void LL_FLASH_DisablePrefetch(void)
  461. {
  462. CLEAR_BIT(FLASH->ACR, FLASH_ACR_PRFTBE);
  463. }
  464. /**
  465. * @brief Check if Prefetch buffer is enabled
  466. * @rmtoll FLASH_ACR PRFTBS LL_FLASH_IsPrefetchEnabled
  467. * @retval State of bit (1 or 0).
  468. */
  469. __STATIC_INLINE uint32_t LL_FLASH_IsPrefetchEnabled(void)
  470. {
  471. return (READ_BIT(FLASH->ACR, FLASH_ACR_PRFTBS) == (FLASH_ACR_PRFTBS));
  472. }
  473. #endif /* FLASH_ACR_LATENCY */
  474. /**
  475. * @brief Enable Flash Half Cycle Access
  476. * @rmtoll FLASH_ACR HLFCYA LL_FLASH_EnableHalfCycleAccess
  477. * @retval None
  478. */
  479. __STATIC_INLINE void LL_FLASH_EnableHalfCycleAccess(void)
  480. {
  481. SET_BIT(FLASH->ACR, FLASH_ACR_HLFCYA);
  482. }
  483. /**
  484. * @brief Disable Flash Half Cycle Access
  485. * @rmtoll FLASH_ACR HLFCYA LL_FLASH_DisableHalfCycleAccess
  486. * @retval None
  487. */
  488. __STATIC_INLINE void LL_FLASH_DisableHalfCycleAccess(void)
  489. {
  490. CLEAR_BIT(FLASH->ACR, FLASH_ACR_HLFCYA);
  491. }
  492. /**
  493. * @brief Check if Flash Half Cycle Access is enabled or not
  494. * @rmtoll FLASH_ACR HLFCYA LL_FLASH_IsHalfCycleAccessEnabled
  495. * @retval State of bit (1 or 0).
  496. */
  497. __STATIC_INLINE uint32_t LL_FLASH_IsHalfCycleAccessEnabled(void)
  498. {
  499. return (READ_BIT(FLASH->ACR, FLASH_ACR_HLFCYA) == (FLASH_ACR_HLFCYA));
  500. }
  501. /**
  502. * @}
  503. */
  504. /**
  505. * @}
  506. */
  507. /**
  508. * @}
  509. */
  510. #endif /* defined (FLASH) || defined (DBGMCU) */
  511. /**
  512. * @}
  513. */
  514. #ifdef __cplusplus
  515. }
  516. #endif
  517. #endif /* __STM32F1xx_LL_SYSTEM_H */
  518. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/