2 ******************************************************************************
\r
3 * @file stm32l1xx_dbgmcu.c
\r
4 * @author MCD Application Team
\r
6 * @date 31-December-2010
\r
7 * @brief This file provides all the DBGMCU firmware functions.
\r
8 ******************************************************************************
\r
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
13 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
18 * <h2><center>© COPYRIGHT 2010 STMicroelectronics</center></h2>
\r
19 ******************************************************************************
\r
22 /* Includes ------------------------------------------------------------------*/
\r
23 #include "stm32l1xx_dbgmcu.h"
\r
25 /** @addtogroup STM32L1xx_StdPeriph_Driver
\r
29 /** @defgroup DBGMCU
\r
30 * @brief DBGMCU driver modules
\r
34 /* Private typedef -----------------------------------------------------------*/
\r
35 /* Private define ------------------------------------------------------------*/
\r
36 #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
\r
38 /* Private macro -------------------------------------------------------------*/
\r
39 /* Private variables ---------------------------------------------------------*/
\r
40 /* Private function prototypes -----------------------------------------------*/
\r
41 /* Private functions ---------------------------------------------------------*/
\r
43 /** @defgroup DBGMCU_Private_Functions
\r
48 * @brief Returns the device revision identifier.
\r
50 * @retval Device revision identifier
\r
52 uint32_t DBGMCU_GetREVID(void)
\r
54 return(DBGMCU->IDCODE >> 16);
\r
58 * @brief Returns the device identifier.
\r
60 * @retval Device identifier
\r
62 uint32_t DBGMCU_GetDEVID(void)
\r
64 return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
\r
68 * @brief Configures low power mode behavior when the MCU is in Debug mode.
\r
69 * @param DBGMCU_Periph: specifies the low power mode.
\r
70 * This parameter can be any combination of the following values:
\r
71 * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
\r
72 * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
\r
73 * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
\r
74 * @param NewState: new state of the specified low power mode in Debug mode.
\r
75 * This parameter can be: ENABLE or DISABLE.
\r
78 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
80 /* Check the parameters */
\r
81 assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
\r
82 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
84 if (NewState != DISABLE)
\r
86 DBGMCU->CR |= DBGMCU_Periph;
\r
90 DBGMCU->CR &= ~DBGMCU_Periph;
\r
96 * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode.
\r
97 * @param DBGMCU_Periph: specifies the APB1 peripheral.
\r
98 * This parameter can be any combination of the following values:
\r
99 * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
\r
100 * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
\r
101 * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted
\r
102 * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
\r
103 * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted
\r
104 * @arg DBGMCU_RTC_STOP: RTC Wakeup counter stopped when Core is halted
\r
105 * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
\r
106 * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
\r
107 * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is
\r
109 * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is
\r
111 * @param NewState: new state of the specified APB1 peripheral in Debug mode.
\r
112 * This parameter can be: ENABLE or DISABLE.
\r
115 void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
117 /* Check the parameters */
\r
118 assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
\r
119 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
121 if (NewState != DISABLE)
\r
123 DBGMCU->APB1FZ |= DBGMCU_Periph;
\r
127 DBGMCU->APB1FZ &= ~DBGMCU_Periph;
\r
132 * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode.
\r
133 * @param DBGMCU_Periph: specifies the APB2 peripheral.
\r
134 * This parameter can be any combination of the following values:
\r
135 * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted
\r
136 * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted
\r
137 * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted
\r
138 * @param NewState: new state of the specified APB2 peripheral in Debug mode.
\r
139 * This parameter can be: ENABLE or DISABLE.
\r
142 void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
144 /* Check the parameters */
\r
145 assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));
\r
146 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
148 if (NewState != DISABLE)
\r
150 DBGMCU->APB2FZ |= DBGMCU_Periph;
\r
154 DBGMCU->APB2FZ &= ~DBGMCU_Periph;
\r
170 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
\r