blob: 587b360ea04b7f7ea5181545a4a66093686fc8a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
/*!
* @file apm32s10x_dbgmcu.c
*
* @brief This file provides all the DEBUG firmware functions
*
* @version V1.0.1
*
* @date 2022-12-31
*
* @attention
*
* Copyright (C) 2022-2023 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
* and limitations under the License.
*/
/* Includes */
#include "apm32s10x_dbgmcu.h"
/** @addtogroup APM32S10x_StdPeriphDriver
@{
*/
/** @addtogroup DBGMCU_Driver DBGMCU Driver
@{
*/
/** @defgroup DBGMCU_Functions Functions
@{
*/
/*!
* @brief Returns the device identifier.
*
* @param None
*
* @retval Device identifier
*/
uint32_t DBGMCU_ReadDEVID(void)
{
return DBGMCU->IDCODE_B.EQR;
}
/*!
* @brief Returns the device revision identifier.
*
* @param None
*
* @retval Device revision identifier
*/
uint32_t DBGMCU_ReadREVID(void)
{
return DBGMCU->IDCODE_B.WVR;
}
/*!
* @brief Enable the specified peripheral and low power mode behavior
* when the MCU under Debug mode
*
* @param periph: Specifies the peripheral and low power mode
* This parameter can be any combination of the following values:
* @arg DBGMCU_SLEEP : Keep debugger connection during SLEEP mode
* @arg DBGMCU_STOP : Keep debugger connection during STOP mode
* @arg DBGMCU_STANDBY : Keep debugger connection during STANDBY mode
* @arg DBGMCU_IOEN : Trace Debug Pin Enable
* @arg DBGMCU_IOMODE0 : Trace Debug Pin Mode Configure Asynchronization
* @arg DBGMCU_IOMODE1 : Trace Debug Pin Mode Configure Synchronizer data size one
* @arg DBGMCU_IOMODE2 : Trace Debug Pin Mode Configure Synchronizer data size two
* @arg DBGMCU_IOMODE3 : Trace Debug Pin Mode Configure Synchronizer data size four
* @arg DBGMCU_IWDT_STOP : Debug IWDT stopped when Core is halted
* @arg DBGMCU_WWDT_STOP : Debug WWDT stopped when Core is halted
* @arg DBGMCU_TMR1_STOP : TMR1 counter stopped when Core is halted
* @arg DBGMCU_TMR2_STOP : TMR2 counter stopped when Core is halted
* @arg DBGMCU_TMR3_STOP : TMR3 counter stopped when Core is halted
* @arg DBGMCU_TMR4_STOP : TMR4 counter stopped when Core is halted
* @arg DBGMCU_CAN1_STOP : Debug CAN1 stopped when Core is halted
* @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted
* @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted
* @arg DBGMCU_CAN2_STOP : Debug CAN2 stopped when Core is halted
*
* @retval None
*/
void DBGMCU_Enable(uint32_t periph)
{
DBGMCU->CFG |= periph;
}
/*!
* @brief Enable the specified peripheral and low power mode behavior
* when the MCU under Debug mode
*
* @param periph: Specifies the peripheral and low power mode
* This parameter can be any combination of the following values:
* @arg DBGMCU_SLEEP : Keep debugger connection during SLEEP mode
* @arg DBGMCU_STOP : Keep debugger connection during STOP mode
* @arg DBGMCU_STANDBY : Keep debugger connection during STANDBY mode
* @arg DBGMCU_IOEN : Trace Debug Pin Enable
* @arg DBGMCU_IOMODE0 : Trace Debug Pin Mode Configure Asynchronization
* @arg DBGMCU_IOMODE1 : Trace Debug Pin Mode Configure Synchronizer data size one
* @arg DBGMCU_IOMODE2 : Trace Debug Pin Mode Configure Synchronizer data size two
* @arg DBGMCU_IOMODE3 : Trace Debug Pin Mode Configure Synchronizer data size four
* @arg DBGMCU_IWDT_STOP : Debug IWDT stopped when Core is halted
* @arg DBGMCU_WWDT_STOP : Debug WWDT stopped when Core is halted
* @arg DBGMCU_TMR1_STOP : TMR1 counter stopped when Core is halted
* @arg DBGMCU_TMR2_STOP : TMR2 counter stopped when Core is halted
* @arg DBGMCU_TMR3_STOP : TMR3 counter stopped when Core is halted
* @arg DBGMCU_TMR4_STOP : TMR4 counter stopped when Core is halted
* @arg DBGMCU_CAN1_STOP : Debug CAN1 stopped when Core is halted
* @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted
* @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted
* @arg DBGMCU_CAN2_STOP : Debug CAN2 stopped when Core is halted
*
* @retval None
*/
void DBGMCU_Disable(uint32_t periph)
{
DBGMCU->CFG &= ~periph;
}
/**@} end of group DBGMCU_Functions */
/**@} end of group DBGMCU_Driver */
/**@} end of group APM32S10x_StdPeriphDriver */
|