2 ******************************************************************************
\r
3 * @file stm32f0xx_dbgmcu.c
\r
4 * @author MCD Application Team
\r
6 * @date 27-January-2012
\r
7 * @brief This file provides firmware functions to manage the following
\r
8 * functionalities of the Debug MCU (DBGMCU) peripheral:
\r
9 * + Device and Revision ID management
\r
10 * + Peripherals Configuration
\r
14 ******************************************************************************
\r
17 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
18 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
19 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
20 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
21 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
22 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
24 * FOR MORE INFORMATION PLEASE READ CAREFULLY THE LICENSE AGREEMENT FILE
\r
25 * LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
\r
27 * <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
\r
28 ******************************************************************************
\r
31 /* Includes ------------------------------------------------------------------*/
\r
32 #include "stm32f0xx_dbgmcu.h"
\r
34 /** @addtogroup STM32F0xx_StdPeriph_Driver
\r
38 /** @defgroup DBGMCU
\r
39 * @brief DBGMCU driver modules
\r
43 /* Private typedef -----------------------------------------------------------*/
\r
44 /* Private define ------------------------------------------------------------*/
\r
45 #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
\r
47 /* Private macro -------------------------------------------------------------*/
\r
48 /* Private variables ---------------------------------------------------------*/
\r
49 /* Private function prototypes -----------------------------------------------*/
\r
50 /* Private functions ---------------------------------------------------------*/
\r
52 /** @defgroup DBGMCU_Private_Functions
\r
57 /** @defgroup DBGMCU_Group1 Device and Revision ID management functions
\r
58 * @brief Device and Revision ID management functions
\r
61 ==============================================================================
\r
62 ##### Device and Revision ID management functions #####
\r
63 ==============================================================================
\r
70 * @brief Returns the device revision identifier.
\r
72 * @retval Device revision identifier
\r
74 uint32_t DBGMCU_GetREVID(void)
\r
76 return(DBGMCU->IDCODE >> 16);
\r
80 * @brief Returns the device identifier.
\r
82 * @retval Device identifier
\r
84 uint32_t DBGMCU_GetDEVID(void)
\r
86 return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
\r
93 /** @defgroup DBGMCU_Group2 Peripherals Configuration functions
\r
94 * @brief Peripherals Configuration
\r
97 ==============================================================================
\r
98 ##### Peripherals Configuration functions #####
\r
99 ==============================================================================
\r
106 * @brief Configures low power mode behavior when the MCU is in Debug mode.
\r
107 * @param DBGMCU_Periph: specifies the low power mode.
\r
108 * This parameter can be any combination of the following values:
\r
109 * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
\r
110 * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
\r
111 * @param NewState: new state of the specified low power mode in Debug mode.
\r
112 * This parameter can be: ENABLE or DISABLE.
\r
115 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
117 /* Check the parameters */
\r
118 assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
\r
119 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
121 if (NewState != DISABLE)
\r
123 DBGMCU->CR |= DBGMCU_Periph;
\r
127 DBGMCU->CR &= ~DBGMCU_Periph;
\r
133 * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode.
\r
134 * @param DBGMCU_Periph: specifies the APB1 peripheral.
\r
135 * This parameter can be any combination of the following values:
\r
136 * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
\r
137 * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
\r
138 * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
\r
139 * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted
\r
140 * @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter stopped
\r
141 * when Core is halted.
\r
142 * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
\r
143 * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
\r
144 * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped
\r
145 * when Core is halted
\r
146 * @param NewState: new state of the specified APB1 peripheral in Debug mode.
\r
147 * This parameter can be: ENABLE or DISABLE.
\r
150 void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
152 /* Check the parameters */
\r
153 assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
\r
154 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
156 if (NewState != DISABLE)
\r
158 DBGMCU->APB1FZ |= DBGMCU_Periph;
\r
162 DBGMCU->APB1FZ &= ~DBGMCU_Periph;
\r
167 * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode.
\r
168 * @param DBGMCU_Periph: specifies the APB2 peripheral.
\r
169 * This parameter can be any combination of the following values:
\r
170 * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted
\r
171 * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted
\r
172 * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted
\r
173 * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted
\r
174 * @param NewState: new state of the specified APB2 peripheral in Debug mode.
\r
175 * This parameter can be: ENABLE or DISABLE.
\r
178 void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
\r
180 /* Check the parameters */
\r
181 assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));
\r
182 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
184 if (NewState != DISABLE)
\r
186 DBGMCU->APB2FZ |= DBGMCU_Periph;
\r
190 DBGMCU->APB2FZ &= ~DBGMCU_Periph;
\r
210 /******************* (C) COPYRIGHT 2012 STMicroelectronics *****END OF FILE****/
\r