stm32f1xx_ll_system.h 24 KB

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