Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32f1xx_hal.c |
||
4 | * @author MCD Application Team |
||
5 | * @brief HAL module driver. |
||
6 | * This is the common part of the HAL initialization |
||
7 | * |
||
8 | @verbatim |
||
9 | ============================================================================== |
||
10 | ##### How to use this driver ##### |
||
11 | ============================================================================== |
||
12 | [..] |
||
13 | The common HAL driver contains a set of generic and common APIs that can be |
||
14 | used by the PPP peripheral drivers and the user to start using the HAL. |
||
15 | [..] |
||
16 | The HAL contains two APIs' categories: |
||
17 | (+) Common HAL APIs |
||
18 | (+) Services HAL APIs |
||
19 | |||
20 | @endverbatim |
||
21 | ****************************************************************************** |
||
22 | * @attention |
||
23 | * |
||
24 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
||
25 | * All rights reserved.</center></h2> |
||
26 | * |
||
27 | * This software component is licensed by ST under BSD 3-Clause license, |
||
28 | * the "License"; You may not use this file except in compliance with the |
||
29 | * License. You may obtain a copy of the License at: |
||
30 | * opensource.org/licenses/BSD-3-Clause |
||
31 | * |
||
32 | ****************************************************************************** |
||
33 | */ |
||
34 | |||
35 | /* Includes ------------------------------------------------------------------*/ |
||
36 | #include "stm32f1xx_hal.h" |
||
37 | |||
38 | /** @addtogroup STM32F1xx_HAL_Driver |
||
39 | * @{ |
||
40 | */ |
||
41 | |||
42 | /** @defgroup HAL HAL |
||
43 | * @brief HAL module driver. |
||
44 | * @{ |
||
45 | */ |
||
46 | |||
47 | #ifdef HAL_MODULE_ENABLED |
||
48 | |||
49 | /* Private typedef -----------------------------------------------------------*/ |
||
50 | /* Private define ------------------------------------------------------------*/ |
||
51 | |||
52 | /** @defgroup HAL_Private_Constants HAL Private Constants |
||
53 | * @{ |
||
54 | */ |
||
55 | /** |
||
56 | * @brief STM32F1xx HAL Driver version number V1.1.4 |
||
57 | */ |
||
58 | #define __STM32F1xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */ |
||
59 | #define __STM32F1xx_HAL_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */ |
||
60 | #define __STM32F1xx_HAL_VERSION_SUB2 (0x04U) /*!< [15:8] sub2 version */ |
||
61 | #define __STM32F1xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */ |
||
62 | #define __STM32F1xx_HAL_VERSION ((__STM32F1xx_HAL_VERSION_MAIN << 24)\ |
||
63 | |(__STM32F1xx_HAL_VERSION_SUB1 << 16)\ |
||
64 | |(__STM32F1xx_HAL_VERSION_SUB2 << 8 )\ |
||
65 | |(__STM32F1xx_HAL_VERSION_RC)) |
||
66 | |||
67 | #define IDCODE_DEVID_MASK 0x00000FFFU |
||
68 | |||
69 | /** |
||
70 | * @} |
||
71 | */ |
||
72 | |||
73 | /* Private macro -------------------------------------------------------------*/ |
||
74 | /* Private variables ---------------------------------------------------------*/ |
||
75 | |||
76 | /** @defgroup HAL_Private_Variables HAL Private Variables |
||
77 | * @{ |
||
78 | */ |
||
79 | __IO uint32_t uwTick; |
||
80 | uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */ |
||
81 | HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */ |
||
82 | /** |
||
83 | * @} |
||
84 | */ |
||
85 | /* Private function prototypes -----------------------------------------------*/ |
||
86 | /* Exported functions ---------------------------------------------------------*/ |
||
87 | |||
88 | /** @defgroup HAL_Exported_Functions HAL Exported Functions |
||
89 | * @{ |
||
90 | */ |
||
91 | |||
92 | /** @defgroup HAL_Exported_Functions_Group1 Initialization and de-initialization Functions |
||
93 | * @brief Initialization and de-initialization functions |
||
94 | * |
||
95 | @verbatim |
||
96 | =============================================================================== |
||
97 | ##### Initialization and de-initialization functions ##### |
||
98 | =============================================================================== |
||
99 | [..] This section provides functions allowing to: |
||
100 | (+) Initializes the Flash interface, the NVIC allocation and initial clock |
||
101 | configuration. It initializes the systick also when timeout is needed |
||
102 | and the backup domain when enabled. |
||
103 | (+) de-Initializes common part of the HAL. |
||
104 | (+) Configure The time base source to have 1ms time base with a dedicated |
||
105 | Tick interrupt priority. |
||
106 | (++) SysTick timer is used by default as source of time base, but user |
||
107 | can eventually implement his proper time base source (a general purpose |
||
108 | timer for example or other time source), keeping in mind that Time base |
||
109 | duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and |
||
110 | handled in milliseconds basis. |
||
111 | (++) Time base configuration function (HAL_InitTick ()) is called automatically |
||
112 | at the beginning of the program after reset by HAL_Init() or at any time |
||
113 | when clock is configured, by HAL_RCC_ClockConfig(). |
||
114 | (++) Source of time base is configured to generate interrupts at regular |
||
115 | time intervals. Care must be taken if HAL_Delay() is called from a |
||
116 | peripheral ISR process, the Tick interrupt line must have higher priority |
||
117 | (numerically lower) than the peripheral interrupt. Otherwise the caller |
||
118 | ISR process will be blocked. |
||
119 | (++) functions affecting time base configurations are declared as __weak |
||
120 | to make override possible in case of other implementations in user file. |
||
121 | @endverbatim |
||
122 | * @{ |
||
123 | */ |
||
124 | |||
125 | /** |
||
126 | * @brief This function is used to initialize the HAL Library; it must be the first |
||
127 | * instruction to be executed in the main program (before to call any other |
||
128 | * HAL function), it performs the following: |
||
129 | * Configure the Flash prefetch. |
||
130 | * Configures the SysTick to generate an interrupt each 1 millisecond, |
||
131 | * which is clocked by the HSI (at this stage, the clock is not yet |
||
132 | * configured and thus the system is running from the internal HSI at 16 MHz). |
||
133 | * Set NVIC Group Priority to 4. |
||
134 | * Calls the HAL_MspInit() callback function defined in user file |
||
135 | * "stm32f1xx_hal_msp.c" to do the global low level hardware initialization |
||
136 | * |
||
137 | * @note SysTick is used as time base for the HAL_Delay() function, the application |
||
138 | * need to ensure that the SysTick time base is always set to 1 millisecond |
||
139 | * to have correct HAL operation. |
||
140 | * @retval HAL status |
||
141 | */ |
||
142 | HAL_StatusTypeDef HAL_Init(void) |
||
143 | { |
||
144 | /* Configure Flash prefetch */ |
||
145 | #if (PREFETCH_ENABLE != 0) |
||
146 | #if defined(STM32F101x6) || defined(STM32F101xB) || defined(STM32F101xE) || defined(STM32F101xG) || \ |
||
147 | defined(STM32F102x6) || defined(STM32F102xB) || \ |
||
148 | defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || \ |
||
149 | defined(STM32F105xC) || defined(STM32F107xC) |
||
150 | |||
151 | /* Prefetch buffer is not available on value line devices */ |
||
152 | __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); |
||
153 | #endif |
||
154 | #endif /* PREFETCH_ENABLE */ |
||
155 | |||
156 | /* Set Interrupt Group Priority */ |
||
157 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); |
||
158 | |||
159 | /* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */ |
||
160 | HAL_InitTick(TICK_INT_PRIORITY); |
||
161 | |||
162 | /* Init the low level hardware */ |
||
163 | HAL_MspInit(); |
||
164 | |||
165 | /* Return function status */ |
||
166 | return HAL_OK; |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * @brief This function de-Initializes common part of the HAL and stops the systick. |
||
171 | * of time base. |
||
172 | * @note This function is optional. |
||
173 | * @retval HAL status |
||
174 | */ |
||
175 | HAL_StatusTypeDef HAL_DeInit(void) |
||
176 | { |
||
177 | /* Reset of all peripherals */ |
||
178 | __HAL_RCC_APB1_FORCE_RESET(); |
||
179 | __HAL_RCC_APB1_RELEASE_RESET(); |
||
180 | |||
181 | __HAL_RCC_APB2_FORCE_RESET(); |
||
182 | __HAL_RCC_APB2_RELEASE_RESET(); |
||
183 | |||
184 | #if defined(STM32F105xC) || defined(STM32F107xC) |
||
185 | __HAL_RCC_AHB_FORCE_RESET(); |
||
186 | __HAL_RCC_AHB_RELEASE_RESET(); |
||
187 | #endif |
||
188 | |||
189 | /* De-Init the low level hardware */ |
||
190 | HAL_MspDeInit(); |
||
191 | |||
192 | /* Return function status */ |
||
193 | return HAL_OK; |
||
194 | } |
||
195 | |||
196 | /** |
||
197 | * @brief Initialize the MSP. |
||
198 | * @retval None |
||
199 | */ |
||
200 | __weak void HAL_MspInit(void) |
||
201 | { |
||
202 | /* NOTE : This function should not be modified, when the callback is needed, |
||
203 | the HAL_MspInit could be implemented in the user file |
||
204 | */ |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * @brief DeInitializes the MSP. |
||
209 | * @retval None |
||
210 | */ |
||
211 | __weak void HAL_MspDeInit(void) |
||
212 | { |
||
213 | /* NOTE : This function should not be modified, when the callback is needed, |
||
214 | the HAL_MspDeInit could be implemented in the user file |
||
215 | */ |
||
216 | } |
||
217 | |||
218 | /** |
||
219 | * @brief This function configures the source of the time base. |
||
220 | * The time source is configured to have 1ms time base with a dedicated |
||
221 | * Tick interrupt priority. |
||
222 | * @note This function is called automatically at the beginning of program after |
||
223 | * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig(). |
||
224 | * @note In the default implementation, SysTick timer is the source of time base. |
||
225 | * It is used to generate interrupts at regular time intervals. |
||
226 | * Care must be taken if HAL_Delay() is called from a peripheral ISR process, |
||
227 | * The SysTick interrupt must have higher priority (numerically lower) |
||
228 | * than the peripheral interrupt. Otherwise the caller ISR process will be blocked. |
||
229 | * The function is declared as __weak to be overwritten in case of other |
||
230 | * implementation in user file. |
||
231 | * @param TickPriority Tick interrupt priority. |
||
232 | * @retval HAL status |
||
233 | */ |
||
234 | __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) |
||
235 | { |
||
236 | /* Configure the SysTick to have interrupt in 1ms time basis*/ |
||
237 | if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U) |
||
238 | { |
||
239 | return HAL_ERROR; |
||
240 | } |
||
241 | |||
242 | /* Configure the SysTick IRQ priority */ |
||
243 | if (TickPriority < (1UL << __NVIC_PRIO_BITS)) |
||
244 | { |
||
245 | HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U); |
||
246 | uwTickPrio = TickPriority; |
||
247 | } |
||
248 | else |
||
249 | { |
||
250 | return HAL_ERROR; |
||
251 | } |
||
252 | |||
253 | /* Return function status */ |
||
254 | return HAL_OK; |
||
255 | } |
||
256 | |||
257 | /** |
||
258 | * @} |
||
259 | */ |
||
260 | |||
261 | /** @defgroup HAL_Exported_Functions_Group2 HAL Control functions |
||
262 | * @brief HAL Control functions |
||
263 | * |
||
264 | @verbatim |
||
265 | =============================================================================== |
||
266 | ##### HAL Control functions ##### |
||
267 | =============================================================================== |
||
268 | [..] This section provides functions allowing to: |
||
269 | (+) Provide a tick value in millisecond |
||
270 | (+) Provide a blocking delay in millisecond |
||
271 | (+) Suspend the time base source interrupt |
||
272 | (+) Resume the time base source interrupt |
||
273 | (+) Get the HAL API driver version |
||
274 | (+) Get the device identifier |
||
275 | (+) Get the device revision identifier |
||
276 | (+) Enable/Disable Debug module during SLEEP mode |
||
277 | (+) Enable/Disable Debug module during STOP mode |
||
278 | (+) Enable/Disable Debug module during STANDBY mode |
||
279 | |||
280 | @endverbatim |
||
281 | * @{ |
||
282 | */ |
||
283 | |||
284 | /** |
||
285 | * @brief This function is called to increment a global variable "uwTick" |
||
286 | * used as application time base. |
||
287 | * @note In the default implementation, this variable is incremented each 1ms |
||
288 | * in SysTick ISR. |
||
289 | * @note This function is declared as __weak to be overwritten in case of other |
||
290 | * implementations in user file. |
||
291 | * @retval None |
||
292 | */ |
||
293 | __weak void HAL_IncTick(void) |
||
294 | { |
||
295 | uwTick += uwTickFreq; |
||
296 | } |
||
297 | |||
298 | /** |
||
299 | * @brief Provides a tick value in millisecond. |
||
300 | * @note This function is declared as __weak to be overwritten in case of other |
||
301 | * implementations in user file. |
||
302 | * @retval tick value |
||
303 | */ |
||
304 | __weak uint32_t HAL_GetTick(void) |
||
305 | { |
||
306 | return uwTick; |
||
307 | } |
||
308 | |||
309 | /** |
||
310 | * @brief This function returns a tick priority. |
||
311 | * @retval tick priority |
||
312 | */ |
||
313 | uint32_t HAL_GetTickPrio(void) |
||
314 | { |
||
315 | return uwTickPrio; |
||
316 | } |
||
317 | |||
318 | /** |
||
319 | * @brief Set new tick Freq. |
||
320 | * @retval status |
||
321 | */ |
||
322 | HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq) |
||
323 | { |
||
324 | HAL_StatusTypeDef status = HAL_OK; |
||
325 | assert_param(IS_TICKFREQ(Freq)); |
||
326 | |||
327 | if (uwTickFreq != Freq) |
||
328 | { |
||
329 | /* Apply the new tick Freq */ |
||
330 | status = HAL_InitTick(uwTickPrio); |
||
331 | if (status == HAL_OK) |
||
332 | { |
||
333 | uwTickFreq = Freq; |
||
334 | } |
||
335 | } |
||
336 | |||
337 | return status; |
||
338 | } |
||
339 | |||
340 | /** |
||
341 | * @brief Return tick frequency. |
||
342 | * @retval tick period in Hz |
||
343 | */ |
||
344 | HAL_TickFreqTypeDef HAL_GetTickFreq(void) |
||
345 | { |
||
346 | return uwTickFreq; |
||
347 | } |
||
348 | |||
349 | /** |
||
350 | * @brief This function provides minimum delay (in milliseconds) based |
||
351 | * on variable incremented. |
||
352 | * @note In the default implementation , SysTick timer is the source of time base. |
||
353 | * It is used to generate interrupts at regular time intervals where uwTick |
||
354 | * is incremented. |
||
355 | * @note This function is declared as __weak to be overwritten in case of other |
||
356 | * implementations in user file. |
||
357 | * @param Delay specifies the delay time length, in milliseconds. |
||
358 | * @retval None |
||
359 | */ |
||
360 | __weak void HAL_Delay(uint32_t Delay) |
||
361 | { |
||
362 | uint32_t tickstart = HAL_GetTick(); |
||
363 | uint32_t wait = Delay; |
||
364 | |||
365 | /* Add a freq to guarantee minimum wait */ |
||
366 | if (wait < HAL_MAX_DELAY) |
||
367 | { |
||
368 | wait += (uint32_t)(uwTickFreq); |
||
369 | } |
||
370 | |||
371 | while ((HAL_GetTick() - tickstart) < wait) |
||
372 | { |
||
373 | } |
||
374 | } |
||
375 | |||
376 | /** |
||
377 | * @brief Suspend Tick increment. |
||
378 | * @note In the default implementation , SysTick timer is the source of time base. It is |
||
379 | * used to generate interrupts at regular time intervals. Once HAL_SuspendTick() |
||
380 | * is called, the SysTick interrupt will be disabled and so Tick increment |
||
381 | * is suspended. |
||
382 | * @note This function is declared as __weak to be overwritten in case of other |
||
383 | * implementations in user file. |
||
384 | * @retval None |
||
385 | */ |
||
386 | __weak void HAL_SuspendTick(void) |
||
387 | { |
||
388 | /* Disable SysTick Interrupt */ |
||
389 | CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); |
||
390 | } |
||
391 | |||
392 | /** |
||
393 | * @brief Resume Tick increment. |
||
394 | * @note In the default implementation , SysTick timer is the source of time base. It is |
||
395 | * used to generate interrupts at regular time intervals. Once HAL_ResumeTick() |
||
396 | * is called, the SysTick interrupt will be enabled and so Tick increment |
||
397 | * is resumed. |
||
398 | * @note This function is declared as __weak to be overwritten in case of other |
||
399 | * implementations in user file. |
||
400 | * @retval None |
||
401 | */ |
||
402 | __weak void HAL_ResumeTick(void) |
||
403 | { |
||
404 | /* Enable SysTick Interrupt */ |
||
405 | SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); |
||
406 | } |
||
407 | |||
408 | /** |
||
409 | * @brief Returns the HAL revision |
||
410 | * @retval version 0xXYZR (8bits for each decimal, R for RC) |
||
411 | */ |
||
412 | uint32_t HAL_GetHalVersion(void) |
||
413 | { |
||
414 | return __STM32F1xx_HAL_VERSION; |
||
415 | } |
||
416 | |||
417 | /** |
||
418 | * @brief Returns the device revision identifier. |
||
419 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
420 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
421 | * STM32F101xF/G and STM32F103xF/G |
||
422 | * STM32F10xx4 and STM32F10xx6 |
||
423 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
424 | * debug mode (not accessible by the user software in normal mode). |
||
425 | * Refer to errata sheet of these devices for more details. |
||
426 | * @retval Device revision identifier |
||
427 | */ |
||
428 | uint32_t HAL_GetREVID(void) |
||
429 | { |
||
430 | return ((DBGMCU->IDCODE) >> DBGMCU_IDCODE_REV_ID_Pos); |
||
431 | } |
||
432 | |||
433 | /** |
||
434 | * @brief Returns the device identifier. |
||
435 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
436 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
437 | * STM32F101xF/G and STM32F103xF/G |
||
438 | * STM32F10xx4 and STM32F10xx6 |
||
439 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
440 | * debug mode (not accessible by the user software in normal mode). |
||
441 | * Refer to errata sheet of these devices for more details. |
||
442 | * @retval Device identifier |
||
443 | */ |
||
444 | uint32_t HAL_GetDEVID(void) |
||
445 | { |
||
446 | return ((DBGMCU->IDCODE) & IDCODE_DEVID_MASK); |
||
447 | } |
||
448 | |||
449 | /** |
||
450 | * @brief Returns first word of the unique device identifier (UID based on 96 bits) |
||
451 | * @retval Device identifier |
||
452 | */ |
||
453 | uint32_t HAL_GetUIDw0(void) |
||
454 | { |
||
455 | return(READ_REG(*((uint32_t *)UID_BASE))); |
||
456 | } |
||
457 | |||
458 | /** |
||
459 | * @brief Returns second word of the unique device identifier (UID based on 96 bits) |
||
460 | * @retval Device identifier |
||
461 | */ |
||
462 | uint32_t HAL_GetUIDw1(void) |
||
463 | { |
||
464 | return(READ_REG(*((uint32_t *)(UID_BASE + 4U)))); |
||
465 | } |
||
466 | |||
467 | /** |
||
468 | * @brief Returns third word of the unique device identifier (UID based on 96 bits) |
||
469 | * @retval Device identifier |
||
470 | */ |
||
471 | uint32_t HAL_GetUIDw2(void) |
||
472 | { |
||
473 | return(READ_REG(*((uint32_t *)(UID_BASE + 8U)))); |
||
474 | } |
||
475 | |||
476 | /** |
||
477 | * @brief Enable the Debug Module during SLEEP mode |
||
478 | * @retval None |
||
479 | */ |
||
480 | void HAL_DBGMCU_EnableDBGSleepMode(void) |
||
481 | { |
||
482 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); |
||
483 | } |
||
484 | |||
485 | /** |
||
486 | * @brief Disable the Debug Module during SLEEP mode |
||
487 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
488 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
489 | * STM32F101xF/G and STM32F103xF/G |
||
490 | * STM32F10xx4 and STM32F10xx6 |
||
491 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
492 | * debug mode (not accessible by the user software in normal mode). |
||
493 | * Refer to errata sheet of these devices for more details. |
||
494 | * @retval None |
||
495 | */ |
||
496 | void HAL_DBGMCU_DisableDBGSleepMode(void) |
||
497 | { |
||
498 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); |
||
499 | } |
||
500 | |||
501 | /** |
||
502 | * @brief Enable the Debug Module during STOP mode |
||
503 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
504 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
505 | * STM32F101xF/G and STM32F103xF/G |
||
506 | * STM32F10xx4 and STM32F10xx6 |
||
507 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
508 | * debug mode (not accessible by the user software in normal mode). |
||
509 | * Refer to errata sheet of these devices for more details. |
||
510 | * Note: On all STM32F1 devices: |
||
511 | * If the system tick timer interrupt is enabled during the Stop mode |
||
512 | * debug (DBG_STOP bit set in the DBGMCU_CR register ), it will wakeup |
||
513 | * the system from Stop mode. |
||
514 | * Workaround: To debug the Stop mode, disable the system tick timer |
||
515 | * interrupt. |
||
516 | * Refer to errata sheet of these devices for more details. |
||
517 | * Note: On all STM32F1 devices: |
||
518 | * If the system tick timer interrupt is enabled during the Stop mode |
||
519 | * debug (DBG_STOP bit set in the DBGMCU_CR register ), it will wakeup |
||
520 | * the system from Stop mode. |
||
521 | * Workaround: To debug the Stop mode, disable the system tick timer |
||
522 | * interrupt. |
||
523 | * Refer to errata sheet of these devices for more details. |
||
524 | * @retval None |
||
525 | */ |
||
526 | void HAL_DBGMCU_EnableDBGStopMode(void) |
||
527 | { |
||
528 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); |
||
529 | } |
||
530 | |||
531 | /** |
||
532 | * @brief Disable the Debug Module during STOP mode |
||
533 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
534 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
535 | * STM32F101xF/G and STM32F103xF/G |
||
536 | * STM32F10xx4 and STM32F10xx6 |
||
537 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
538 | * debug mode (not accessible by the user software in normal mode). |
||
539 | * Refer to errata sheet of these devices for more details. |
||
540 | * @retval None |
||
541 | */ |
||
542 | void HAL_DBGMCU_DisableDBGStopMode(void) |
||
543 | { |
||
544 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); |
||
545 | } |
||
546 | |||
547 | /** |
||
548 | * @brief Enable the Debug Module during STANDBY mode |
||
549 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
550 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
551 | * STM32F101xF/G and STM32F103xF/G |
||
552 | * STM32F10xx4 and STM32F10xx6 |
||
553 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
554 | * debug mode (not accessible by the user software in normal mode). |
||
555 | * Refer to errata sheet of these devices for more details. |
||
556 | * @retval None |
||
557 | */ |
||
558 | void HAL_DBGMCU_EnableDBGStandbyMode(void) |
||
559 | { |
||
560 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); |
||
561 | } |
||
562 | |||
563 | /** |
||
564 | * @brief Disable the Debug Module during STANDBY mode |
||
565 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
||
566 | * STM32F101xC/D/E and STM32F103xC/D/E, |
||
567 | * STM32F101xF/G and STM32F103xF/G |
||
568 | * STM32F10xx4 and STM32F10xx6 |
||
569 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
||
570 | * debug mode (not accessible by the user software in normal mode). |
||
571 | * Refer to errata sheet of these devices for more details. |
||
572 | * @retval None |
||
573 | */ |
||
574 | void HAL_DBGMCU_DisableDBGStandbyMode(void) |
||
575 | { |
||
576 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); |
||
577 | } |
||
578 | |||
579 | /** |
||
580 | * @} |
||
581 | */ |
||
582 | |||
583 | /** |
||
584 | * @} |
||
585 | */ |
||
586 | |||
587 | #endif /* HAL_MODULE_ENABLED */ |
||
588 | /** |
||
589 | * @} |
||
590 | */ |
||
591 | |||
592 | /** |
||
593 | * @} |
||
594 | */ |
||
595 | |||
596 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |