Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
stm32f30x_dbgmcu.c
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f30x_dbgmcu.c 00004 * @author MCD Application Team 00005 * @version V1.2.3 00006 * @date 10-July-2015 00007 * @brief This file provides firmware functions to manage the following 00008 * functionalities of the Debug MCU (DBGMCU) peripheral: 00009 * + Device and Revision ID management 00010 * + Peripherals Configuration 00011 ****************************************************************************** 00012 * @attention 00013 * 00014 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> 00015 * 00016 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00017 * You may not use this file except in compliance with the License. 00018 * You may obtain a copy of the License at: 00019 * 00020 * http://www.st.com/software_license_agreement_liberty_v2 00021 * 00022 * Unless required by applicable law or agreed to in writing, software 00023 * distributed under the License is distributed on an "AS IS" BASIS, 00024 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 * 00028 ****************************************************************************** 00029 */ 00030 00031 /* Includes ------------------------------------------------------------------*/ 00032 #include "stm32f30x_dbgmcu.h" 00033 00034 /** @addtogroup STM32F30x_StdPeriph_Driver 00035 * @{ 00036 */ 00037 00038 /** @defgroup DBGMCU 00039 * @brief DBGMCU driver modules 00040 * @{ 00041 */ 00042 00043 /* Private typedef -----------------------------------------------------------*/ 00044 /* Private define ------------------------------------------------------------*/ 00045 #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF) 00046 00047 /* Private macro -------------------------------------------------------------*/ 00048 /* Private variables ---------------------------------------------------------*/ 00049 /* Private function prototypes -----------------------------------------------*/ 00050 /* Private functions ---------------------------------------------------------*/ 00051 00052 /** @defgroup DBGMCU_Private_Functions 00053 * @{ 00054 */ 00055 00056 /** @defgroup DBGMCU_Group1 Device and Revision ID management functions 00057 * @brief Device and Revision ID management functions 00058 * 00059 @verbatim 00060 ============================================================================== 00061 ##### Device and Revision ID management functions ##### 00062 ============================================================================== 00063 00064 @endverbatim 00065 * @{ 00066 */ 00067 00068 /** 00069 * @brief Returns the device revision identifier. 00070 * @param None 00071 * @retval Device revision identifier 00072 */ 00073 uint32_t DBGMCU_GetREVID(void) 00074 { 00075 return(DBGMCU->IDCODE >> 16); 00076 } 00077 00078 /** 00079 * @brief Returns the device identifier. 00080 * @param None 00081 * @retval Device identifier 00082 */ 00083 uint32_t DBGMCU_GetDEVID(void) 00084 { 00085 return(DBGMCU->IDCODE & IDCODE_DEVID_MASK); 00086 } 00087 00088 /** 00089 * @} 00090 */ 00091 00092 /** @defgroup DBGMCU_Group2 Peripherals Configuration functions 00093 * @brief Peripherals Configuration 00094 * 00095 @verbatim 00096 ============================================================================== 00097 ##### Peripherals Configuration functions ##### 00098 ============================================================================== 00099 00100 @endverbatim 00101 * @{ 00102 */ 00103 00104 /** 00105 * @brief Configures low power mode behavior when the MCU is in Debug mode. 00106 * @param DBGMCU_Periph: specifies the low power mode. 00107 * This parameter can be any combination of the following values: 00108 * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode. 00109 * @arg DBGMCU_STOP: Keep debugger connection during STOP mode. 00110 * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode. 00111 * @param NewState: new state of the specified low power mode in Debug mode. 00112 * This parameter can be: ENABLE or DISABLE. 00113 * @retval None 00114 */ 00115 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState) 00116 { 00117 /* Check the parameters */ 00118 assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph)); 00119 assert_param(IS_FUNCTIONAL_STATE(NewState)); 00120 if (NewState != DISABLE) 00121 { 00122 DBGMCU->CR |= DBGMCU_Periph; 00123 } 00124 else 00125 { 00126 DBGMCU->CR &= ~DBGMCU_Periph; 00127 } 00128 } 00129 00130 /** 00131 * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode. 00132 * @param DBGMCU_Periph: specifies the APB1 peripheral. 00133 * This parameter can be any combination of the following values: 00134 * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted. 00135 * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted. 00136 * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted. 00137 * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted. 00138 * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted. 00139 * @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter are stopped when 00140 * Core is halted. 00141 * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted. 00142 * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted. 00143 * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when 00144 * Core is halted. 00145 * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when 00146 * Core is halted. 00147 * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted. 00148 * @arg DBGMCU_I2C3_SMBUS_TIMEOUT: I2C3 SMBUS timeout mode stopped when 00149 * Core is halted. 00150 * @param NewState: new state of the specified APB1 peripheral in Debug mode. 00151 * This parameter can be: ENABLE or DISABLE. 00152 * @retval None 00153 */ 00154 void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState) 00155 { 00156 /* Check the parameters */ 00157 assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph)); 00158 assert_param(IS_FUNCTIONAL_STATE(NewState)); 00159 00160 if (NewState != DISABLE) 00161 { 00162 DBGMCU->APB1FZ |= DBGMCU_Periph; 00163 } 00164 else 00165 { 00166 DBGMCU->APB1FZ &= ~DBGMCU_Periph; 00167 } 00168 } 00169 00170 /** 00171 * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode. 00172 * @param DBGMCU_Periph: specifies the APB2 peripheral. 00173 * This parameter can be any combination of the following values: 00174 * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted. 00175 * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted. 00176 * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted. 00177 * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted. 00178 * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted. 00179 * @arg DBGMCU_TIM20_STOP: TIM20 counter stopped when Core is halted. 00180 * @param NewState: new state of the specified APB2 peripheral in Debug mode. 00181 * This parameter can be: ENABLE or DISABLE. 00182 * @retval None 00183 */ 00184 void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState) 00185 { 00186 /* Check the parameters */ 00187 assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph)); 00188 assert_param(IS_FUNCTIONAL_STATE(NewState)); 00189 00190 if (NewState != DISABLE) 00191 { 00192 DBGMCU->APB2FZ |= DBGMCU_Periph; 00193 } 00194 else 00195 { 00196 DBGMCU->APB2FZ &= ~DBGMCU_Periph; 00197 } 00198 } 00199 00200 /** 00201 * @} 00202 */ 00203 00204 /** 00205 * @} 00206 */ 00207 00208 /** 00209 * @} 00210 */ 00211 00212 /** 00213 * @} 00214 */ 00215 00216 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 17:34:44 by
