2 **************************************************************************
3 * @file at32f435_437_mcudbg.c
6 * @brief contains all the functions for the mcudbg firmware library
7 **************************************************************************
8 * Copyright notice & Disclaimer
10 * The software Board Support Package (BSP) that is made available to
11 * download from Artery official website is the copyrighted work of Artery.
12 * Artery authorizes customers to use, copy, and distribute the BSP
13 * software and its related documentation for the purpose of design and
14 * development in conjunction with Artery microcontrollers. Use of the
15 * software is governed by this copyright notice and the following disclaimer.
17 * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
18 * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
19 * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
20 * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
21 * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24 **************************************************************************
27 #include "at32f435_437_conf.h"
29 /** @addtogroup AT32F435_437_periph_driver
34 * @brief DEBUG driver modules
38 #ifdef DEBUG_MODULE_ENABLED
40 /** @defgroup DEBUG_private_functions
45 * @brief get debug device id
47 * @retval the debug device id
49 uint32_t debug_device_id_get(void)
54 * @brief set periph debug mode
55 * @param periph_debug_mode
56 * this parameter can be one of the following values:
60 * @param new_state (TRUE or FALSE)
63 void debug_low_power_mode_set(uint32_t low_power_mode
, confirm_state new_state
)
65 if(new_state
!= FALSE
)
67 DEBUGMCU
->ctrl
|= low_power_mode
;
71 DEBUGMCU
->ctrl
&= ~low_power_mode
;
75 * @brief set apb1 periph debug mode
76 * @param periph_debug_mode
77 * this parameter can be any combination of the following values:
78 * - DEBUG_TMR2_PAUSE - DEBUG_TMR3_PAUSE
79 * - DEBUG_TMR4_PAUSE - DEBUG_TMR5_PAUSE
80 * - DEBUG_TMR6_PAUSE - DEBUG_TMR7_PAUSE
81 * - DEBUG_TMR12_PAUSE - DEBUG_TMR13_PAUSE
82 * - DEBUG_TMR14_PAUSE - DEBUG_ERTC_PAUSE
83 * - DEBUG_WWDT_PAUSE - DEBUG_WDT_PAUSE
84 * - DEBUG_ERTC_512_PAUSE - DEBUG_I2C1_SMBUS_TIMEOUT
85 * - DEBUG_I2C2_SMBUS_TIMEOUT - DEBUG_I2C3_SMBUS_TIMEOUT
86 * - DEBUG_CAN1_PAUSE - DEBUG_CAN2_PAUSE
87 * @param new_state (TRUE or FALSE)
90 void debug_apb1_periph_mode_set(uint32_t apb1_periph
, confirm_state new_state
)
92 if(new_state
!= FALSE
)
94 DEBUGMCU
->apb1_frz
|= apb1_periph
;
98 DEBUGMCU
->apb1_frz
&= ~apb1_periph
;
102 * @brief set apb2 periph debug mode
103 * @param periph_debug_mode
104 * this parameter can be any combination of the following values:
105 * - DEBUG_TMR1_PAUSE - DEBUG_TMR8_PAUSE
106 * - DEBUG_TMR20_PAUSE - DEBUG_TMR9_PAUSE
107 * - DEBUG_TMR10_PAUSE - DEBUG_TMR11_PAUSE
108 * @param new_state (TRUE or FALSE)
111 void debug_apb2_periph_mode_set(uint32_t apb2_periph
, confirm_state new_state
)
113 if(new_state
!= FALSE
)
115 DEBUGMCU
->apb2_frz
|= apb2_periph
;
119 DEBUGMCU
->apb2_frz
&= ~apb2_periph
;