Create release.yml
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F30x_StdPeriph_Driver / src / stm32f30x_dbgmcu.c
blobced108ab773844c5f40a13aa1da4a79e3558af28
1 /**
2 ******************************************************************************
3 * @file stm32f30x_dbgmcu.c
4 * @author MCD Application Team
5 * @version V1.1.1
6 * @date 04-April-2014
7 * @brief This file provides firmware functions to manage the following
8 * functionalities of the Debug MCU (DBGMCU) peripheral:
9 * + Device and Revision ID management
10 * + Peripherals Configuration
11 ******************************************************************************
12 * @attention
14 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
16 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
17 * You may not use this file except in compliance with the License.
18 * You may obtain a copy of the License at:
20 * http://www.st.com/software_license_agreement_liberty_v2
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS,
24 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
28 ******************************************************************************
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32f30x_dbgmcu.h"
34 /** @addtogroup STM32F30x_StdPeriph_Driver
35 * @{
38 /** @defgroup DBGMCU
39 * @brief DBGMCU driver modules
40 * @{
41 */
43 /* Private typedef -----------------------------------------------------------*/
44 /* Private define ------------------------------------------------------------*/
45 #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
47 /* Private macro -------------------------------------------------------------*/
48 /* Private variables ---------------------------------------------------------*/
49 /* Private function prototypes -----------------------------------------------*/
50 /* Private functions ---------------------------------------------------------*/
52 /** @defgroup DBGMCU_Private_Functions
53 * @{
54 */
56 /** @defgroup DBGMCU_Group1 Device and Revision ID management functions
57 * @brief Device and Revision ID management functions
59 @verbatim
60 ==============================================================================
61 ##### Device and Revision ID management functions #####
62 ==============================================================================
64 @endverbatim
65 * @{
68 /**
69 * @brief Returns the device revision identifier.
70 * @param None
71 * @retval Device revision identifier
73 uint32_t DBGMCU_GetREVID(void)
75 return(DBGMCU->IDCODE >> 16);
78 /**
79 * @brief Returns the device identifier.
80 * @param None
81 * @retval Device identifier
83 uint32_t DBGMCU_GetDEVID(void)
85 return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
88 /**
89 * @}
92 /** @defgroup DBGMCU_Group2 Peripherals Configuration functions
93 * @brief Peripherals Configuration
95 @verbatim
96 ==============================================================================
97 ##### Peripherals Configuration functions #####
98 ==============================================================================
100 @endverbatim
101 * @{
105 * @brief Configures low power mode behavior when the MCU is in Debug mode.
106 * @param DBGMCU_Periph: specifies the low power mode.
107 * This parameter can be any combination of the following values:
108 * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode.
109 * @arg DBGMCU_STOP: Keep debugger connection during STOP mode.
110 * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode.
111 * @param NewState: new state of the specified low power mode in Debug mode.
112 * This parameter can be: ENABLE or DISABLE.
113 * @retval None
115 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
117 /* Check the parameters */
118 assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
119 assert_param(IS_FUNCTIONAL_STATE(NewState));
120 if (NewState != DISABLE)
122 DBGMCU->CR |= DBGMCU_Periph;
124 else
126 DBGMCU->CR &= ~DBGMCU_Periph;
131 * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode.
132 * @param DBGMCU_Periph: specifies the APB1 peripheral.
133 * This parameter can be any combination of the following values:
134 * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted.
135 * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted.
136 * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted.
137 * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted.
138 * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted.
139 * @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter are stopped when
140 * Core is halted.
141 * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted.
142 * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted.
143 * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when
144 * Core is halted.
145 * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when
146 * Core is halted.
147 * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted.
148 * @param NewState: new state of the specified APB1 peripheral in Debug mode.
149 * This parameter can be: ENABLE or DISABLE.
150 * @retval None
152 void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
154 /* Check the parameters */
155 assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
156 assert_param(IS_FUNCTIONAL_STATE(NewState));
158 if (NewState != DISABLE)
160 DBGMCU->APB1FZ |= DBGMCU_Periph;
162 else
164 DBGMCU->APB1FZ &= ~DBGMCU_Periph;
169 * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode.
170 * @param DBGMCU_Periph: specifies the APB2 peripheral.
171 * This parameter can be any combination of the following values:
172 * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted.
173 * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted.
174 * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted.
175 * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted.
176 * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted.
177 * @param NewState: new state of the specified APB2 peripheral in Debug mode.
178 * This parameter can be: ENABLE or DISABLE.
179 * @retval None
181 void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
183 /* Check the parameters */
184 assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));
185 assert_param(IS_FUNCTIONAL_STATE(NewState));
187 if (NewState != DISABLE)
189 DBGMCU->APB2FZ |= DBGMCU_Periph;
191 else
193 DBGMCU->APB2FZ &= ~DBGMCU_Periph;
198 * @}
202 * @}
206 * @}
210 * @}
213 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/