stm32f1xx_ll_system.h 23 KB

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