]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/Libraries/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_dbgmcu.c
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS / Demo / CORTEX_M0_STM32F0518_IAR / Libraries / STM32F0xx_StdPeriph_Driver / src / stm32f0xx_dbgmcu.c
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32f0xx_dbgmcu.c\r
4   * @author  MCD Application Team\r
5   * @version V1.0.0RC1\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
11   *  @verbatim\r
12   *  @endverbatim\r
13   *\r
14   ******************************************************************************\r
15   * @attention\r
16   *\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
23   *\r
24   * FOR MORE INFORMATION PLEASE READ CAREFULLY THE LICENSE AGREEMENT FILE\r
25   * LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.\r
26   *\r
27   * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>\r
28   ******************************************************************************\r
29   */\r
30 \r
31 /* Includes ------------------------------------------------------------------*/\r
32 #include "stm32f0xx_dbgmcu.h"\r
33 \r
34 /** @addtogroup STM32F0xx_StdPeriph_Driver\r
35   * @{\r
36   */\r
37 \r
38 /** @defgroup DBGMCU \r
39   * @brief DBGMCU driver modules\r
40   * @{\r
41   */\r
42 \r
43 /* Private typedef -----------------------------------------------------------*/\r
44 /* Private define ------------------------------------------------------------*/\r
45 #define IDCODE_DEVID_MASK    ((uint32_t)0x00000FFF)\r
46 \r
47 /* Private macro -------------------------------------------------------------*/\r
48 /* Private variables ---------------------------------------------------------*/\r
49 /* Private function prototypes -----------------------------------------------*/\r
50 /* Private functions ---------------------------------------------------------*/\r
51 \r
52 /** @defgroup DBGMCU_Private_Functions \r
53   * @{\r
54   */\r
55   \r
56 \r
57 /** @defgroup DBGMCU_Group1 Device and Revision ID management functions\r
58  *  @brief   Device and Revision ID management functions\r
59  *\r
60 @verbatim\r
61   ==============================================================================\r
62             ##### Device and Revision ID management functions #####\r
63   ==============================================================================\r
64 \r
65 @endverbatim\r
66   * @{\r
67   */\r
68 \r
69 /**\r
70   * @brief  Returns the device revision identifier.\r
71   * @param  None\r
72   * @retval Device revision identifier\r
73   */\r
74 uint32_t DBGMCU_GetREVID(void)\r
75 {\r
76    return(DBGMCU->IDCODE >> 16);\r
77 }\r
78 \r
79 /**\r
80   * @brief  Returns the device identifier.\r
81   * @param  None\r
82   * @retval Device identifier\r
83   */\r
84 uint32_t DBGMCU_GetDEVID(void)\r
85 {\r
86    return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);\r
87 }\r
88 \r
89 /**\r
90   * @}\r
91   */\r
92   \r
93 /** @defgroup DBGMCU_Group2 Peripherals Configuration functions\r
94  *  @brief   Peripherals Configuration\r
95  *\r
96 @verbatim\r
97   ==============================================================================\r
98                ##### Peripherals Configuration functions #####\r
99   ==============================================================================\r
100 \r
101 @endverbatim\r
102   * @{\r
103   */\r
104 \r
105 /**\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
113   * @retval None\r
114   */\r
115 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)\r
116 {\r
117   /* Check the parameters */\r
118   assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));\r
119   assert_param(IS_FUNCTIONAL_STATE(NewState));\r
120 \r
121   if (NewState != DISABLE)\r
122   {\r
123     DBGMCU->CR |= DBGMCU_Periph;\r
124   }\r
125   else\r
126   {\r
127     DBGMCU->CR &= ~DBGMCU_Periph;\r
128   }\r
129 }\r
130 \r
131 \r
132 /**\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
148   * @retval None\r
149   */\r
150 void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)\r
151 {\r
152   /* Check the parameters */\r
153   assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));\r
154   assert_param(IS_FUNCTIONAL_STATE(NewState));\r
155 \r
156   if (NewState != DISABLE)\r
157   {\r
158     DBGMCU->APB1FZ |= DBGMCU_Periph;\r
159   }\r
160   else\r
161   {\r
162     DBGMCU->APB1FZ &= ~DBGMCU_Periph;\r
163   }\r
164 }\r
165 \r
166 /**\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
176   * @retval None\r
177   */\r
178 void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)\r
179 {\r
180   /* Check the parameters */\r
181   assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));\r
182   assert_param(IS_FUNCTIONAL_STATE(NewState));\r
183 \r
184   if (NewState != DISABLE)\r
185   {\r
186     DBGMCU->APB2FZ |= DBGMCU_Periph;\r
187   }\r
188   else\r
189   {\r
190     DBGMCU->APB2FZ &= ~DBGMCU_Periph;\r
191   }\r
192 }\r
193 \r
194 /**\r
195   * @}\r
196   */\r
197   \r
198 /**\r
199   * @}\r
200   */\r
201 \r
202 /**\r
203   * @}\r
204   */\r
205 \r
206 /**\r
207   * @}\r
208   */\r
209 \r
210 /******************* (C) COPYRIGHT 2012 STMicroelectronics *****END OF FILE****/\r