stm32f1xx_ll_system.h 24 KB

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