1 /* Includes ------------------------------------------------------------------*/
2 #include "air32f10x_dbgmcu.h"
3
4
5 /** @defgroup DBGMCU
6 * @brief DBGMCU driver modules
7 * @{
8 */
9
10 /** @defgroup DBGMCU_Private_TypesDefinitions
11 * @{
12 */
13
14 /**
15 * @}
16 */
17
18 /** @defgroup DBGMCU_Private_Defines
19 * @{
20 */
21
22 #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
23 /**
24 * @}
25 */
26
27 /** @defgroup DBGMCU_Private_Macros
28 * @{
29 */
30
31 /**
32 * @}
33 */
34
35 /** @defgroup DBGMCU_Private_Variables
36 * @{
37 */
38
39 /**
40 * @}
41 */
42
43 /** @defgroup DBGMCU_Private_FunctionPrototypes
44 * @{
45 */
46
47 /**
48 * @}
49 */
50
51 /** @defgroup DBGMCU_Private_Functions
52 * @{
53 */
54
55 /**
56 * @brief Returns the device revision identifier.
57 * @param None
58 * @retval Device revision identifier
59 */
DBGMCU_GetREVID(void)60 uint32_t DBGMCU_GetREVID(void)
61 {
62 return(DBGMCU->IDCODE >> 16);
63 }
64
65 /**
66 * @brief Returns the device identifier.
67 * @param None
68 * @retval Device identifier
69 */
DBGMCU_GetDEVID(void)70 uint32_t DBGMCU_GetDEVID(void)
71 {
72 return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
73 }
74
75 /**
76 * @brief Configures the specified peripheral and low power mode behavior
77 * when the MCU under Debug mode.
78 * @param DBGMCU_Periph: specifies the peripheral and low power mode.
79 * This parameter can be any combination of the following values:
80 * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
81 * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
82 * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
83 * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
84 * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
85 * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted
86 * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
87 * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
88 * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted
89 * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted
90 * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted
91 * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted
92 * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted
93 * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
94 * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted
95 * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted
96 * @arg DBGMCU_CAN2_STOP: Debug CAN2 stopped when Core is halted
97 * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted
98 * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted
99 * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted
100 * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted
101 * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted
102 * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted
103 * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted
104 * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted
105 * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted
106 * @param NewState: new state of the specified peripheral in Debug mode.
107 * This parameter can be: ENABLE or DISABLE.
108 * @retval None
109 */
DBGMCU_Config(uint32_t DBGMCU_Periph,FunctionalState NewState)110 void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
111 {
112 /* Check the parameters */
113 assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
114 assert_param(IS_FUNCTIONAL_STATE(NewState));
115
116 if (NewState != DISABLE)
117 {
118 DBGMCU->CR |= DBGMCU_Periph;
119 }
120 else
121 {
122 DBGMCU->CR &= ~DBGMCU_Periph;
123 }
124 }
125
126 /**
127 * @}
128 */
129
130 /**
131 * @}
132 */
133
134 /**
135 * @}
136 */
137