2 ******************************************************************************
\r
3 * @file stm32l1xx_dbgmcu.c
\r
4 * @author MCD Application Team
\r
6 * @date 05-March-2012
\r
7 * @brief This file provides all the DBGMCU firmware functions.
\r
8 ******************************************************************************
\r
11 * <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
\r
13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
\r
14 * You may not use this file except in compliance with the License.
\r
15 * You may obtain a copy of the License at:
\r
17 * http://www.st.com/software_license_agreement_liberty_v2
\r
19 * Unless required by applicable law or agreed to in writing, software
\r
20 * distributed under the License is distributed on an "AS IS" BASIS,
\r
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
22 * See the License for the specific language governing permissions and
\r
23 * limitations under the License.
\r
25 ******************************************************************************
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32l1xx_dbgmcu.h"
\r
31 /** @addtogroup STM32L1xx_StdPeriph_Driver
\r
35 /** @defgroup DBGMCU
\r
36 * @brief DBGMCU driver modules
\r
40 /* Private typedef -----------------------------------------------------------*/
\r
41 /* Private define ------------------------------------------------------------*/
\r
42 #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
\r
44 /* Private macro -------------------------------------------------------------*/
\r
45 /* Private variables ---------------------------------------------------------*/
\r
46 /* Private function prototypes -----------------------------------------------*/
\r
47 /* Private functions ---------------------------------------------------------*/
\r
49 /** @defgroup DBGMCU_Private_Functions
\r
54 * @brief Returns the device revision identifier.
\r
56 * @retval Device revision identifier
\r
58 uint32_t DBGMCU_GetREVID(void)
\r
60 return(DBGMCU->IDCODE >> 16);
\r
64 * @brief Returns the device identifier.
\r
66 * @retval Device identifier
\r
68 uint32_t DBGMCU_GetDEVID(void)
\r
70 return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
\r
74 * @brief Configures low power mode behavior when the MCU is in Debug mode.
\r
75 * @param DBGMCU_Periph: specifies the low power mode.
\r
76 * This parameter can be any combination of the following values:
\r
77 * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
\r
78 * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
\r
79 * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
\r
80 * @param NewState: new state of the specified low power mode in Debug mode.
\r
81 * This parameter can be: ENABLE or DISABLE.
\r
84 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
86 /* Check the parameters */
\r
87 assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
\r
88 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
90 if (NewState != DISABLE)
\r
92 DBGMCU->CR |= DBGMCU_Periph;
\r
96 DBGMCU->CR &= ~DBGMCU_Periph;
\r
102 * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode.
\r
103 * @param DBGMCU_Periph: specifies the APB1 peripheral.
\r
104 * This parameter can be any combination of the following values:
\r
105 * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
\r
106 * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
\r
107 * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted
\r
108 * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted
\r
109 * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
\r
110 * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted
\r
111 * @arg DBGMCU_RTC_STOP:
\r
112 * + On STM32L1xx Medium-density devices: RTC Wakeup counter stopped when
\r
114 * + On STM32L1xx High-density and Medium-density Plus devices: RTC Calendar
\r
115 * and Wakeup counter stopped when Core is halted.
\r
116 * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
\r
117 * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
\r
118 * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is
\r
120 * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is
\r
122 * @param NewState: new state of the specified APB1 peripheral in Debug mode.
\r
123 * This parameter can be: ENABLE or DISABLE.
\r
126 void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
128 /* Check the parameters */
\r
129 assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
\r
130 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
132 if (NewState != DISABLE)
\r
134 DBGMCU->APB1FZ |= DBGMCU_Periph;
\r
138 DBGMCU->APB1FZ &= ~DBGMCU_Periph;
\r
143 * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode.
\r
144 * @param DBGMCU_Periph: specifies the APB2 peripheral.
\r
145 * This parameter can be any combination of the following values:
\r
146 * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted
\r
147 * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted
\r
148 * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted
\r
149 * @param NewState: new state of the specified APB2 peripheral in Debug mode.
\r
150 * This parameter can be: ENABLE or DISABLE.
\r
153 void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
155 /* Check the parameters */
\r
156 assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));
\r
157 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
159 if (NewState != DISABLE)
\r
161 DBGMCU->APB2FZ |= DBGMCU_Periph;
\r
165 DBGMCU->APB2FZ &= ~DBGMCU_Periph;
\r
181 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r