1 /*! 2 * @file apm32f0xx_dbg.h 3 * 4 * @brief This file contains all the functions prototypes for the DBG firmware library 5 * 6 * @version V1.0.3 7 * 8 * @date 2022-09-20 9 * 10 * @attention 11 * 12 * Copyright (C) 2020-2022 Geehy Semiconductor 13 * 14 * You may not use this file except in compliance with the 15 * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE). 16 * 17 * The program is only for reference, which is distributed in the hope 18 * that it will be useful and instructional for customers to develop 19 * their software. Unless required by applicable law or agreed to in 20 * writing, the program is distributed on an "AS IS" BASIS, WITHOUT 21 * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions 23 * and limitations under the License. 24 */ 25 26 /* Define to prevent recursive inclusion */ 27 #ifndef __APM32F0XX_DBG_H 28 #define __APM32F0XX_DBG_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32f0xx.h" 36 37 /** @addtogroup APM32F0xx_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup DBG_Driver 42 @{ 43 */ 44 45 /** @defgroup DBG_Macros Macros 46 @{ 47 */ 48 49 /**@} end of group DBG_Macros*/ 50 51 /** @defgroup DBG_Enumerations Enumerations 52 @{ 53 */ 54 55 /** 56 * @brief MCU Debug mode in the low power mode behavior 57 */ 58 typedef enum 59 { 60 DBG_MODE_STOP = ((uint32_t)0x02), /*!< Keep debugger connection during STOP mode */ 61 DBG_MODE_STANDBY = ((uint32_t)0x04), /*!< Keep debugger connection during STANDBY mode */ 62 } DBG_MODE_T; 63 64 /** 65 * @brief MCU Debug mode in the APB1 peripheral behavior 66 */ 67 typedef enum 68 { 69 DBG_APB1_PER_TMR2_STOP = ((uint32_t)0x01), /*!< TMR2 counter stopped when Core is halted (Only for APM32F072 and APM32F091 devices) */ 70 DBG_APB1_PER_TMR3_STOP = ((uint32_t)0x02), /*!< TMR3 counter stopped when Core is halted */ 71 DBG_APB1_PER_TMR6_STOP = ((uint32_t)0x10), /*!< TMR6 counter stopped when Core is halted */ 72 DBG_APB1_PER_TMR7_STOP = ((uint32_t)0x20), /*!< TMR7 counter stopped when Core is halted (Only for APM32F072 and APM32F091 devices) */ 73 DBG_APB1_PER_TMR14_STOP = ((uint32_t)0x100), /*!< TMR14 counter stopped when Core is halted */ 74 DBG_APB1_PER_RTC_STOP = ((uint32_t)0x400), /*!< RTC counter stopped when Core is halted */ 75 DBG_APB1_PER_WWDT_STOP = ((uint32_t)0x800), /*!< Debug WWDT stopped when Core is halted */ 76 DBG_APB1_PER_IWDT_STOP = ((uint32_t)0x1000), /*!< Debug IWDT stopped when Core is halted */ 77 DBG_APB1_PER_CAN_STOP = ((uint32_t)0x2000000), /*!< Debug CAN stopped when Core is halted (Only for APM32F072 and APM32F091 devices) */ 78 DBG_APB1_PER_I2C1_SMBUS_TIMEOUT = ((uint32_t)0x200000), /*!< I2C1 SMBUS timeout mode stopped when Core is halted */ 79 } DBG_APB1_PER_T; 80 81 /** 82 * @brief MCU Debug mode in the APB2 peripheral behavior 83 */ 84 typedef enum 85 { 86 DBG_APB2_PER_TMR1_STOP = ((uint32_t)0x00800), /*!< TMR1 counter stopped when Core is halted */ 87 DBG_APB2_PER_TMR15_STOP = ((uint32_t)0x10000), /*!< TMR15 counter stopped when Core is halted */ 88 DBG_APB2_PER_TMR16_STOP = ((uint32_t)0x20000), /*!< TMR16 counter stopped when Core is halted */ 89 DBG_APB2_PER_TMR17_STOP = ((uint32_t)0x40000), /*!< TMR17 counter stopped when Core is halted */ 90 } DBG_APB2_PER_T; 91 92 /**@} end of group DBG_Enumerations */ 93 94 /** @defgroup DBG_Structures Structures 95 @{ 96 */ 97 98 /**@} end of group DBG_Structures */ 99 100 /** @defgroup DBG_Variables Variables 101 @{ 102 */ 103 104 /**@} end of group DBG_Variables */ 105 106 /** @defgroup DBG_Functions Functions 107 @{ 108 */ 109 110 /* Read MCU ID Code */ 111 uint32_t DBG_ReadDevId(void); 112 uint32_t DBG_ReadRevId(void); 113 114 /* Debug Mode */ 115 void DBG_EnableDebugMode(uint32_t mode); 116 void DBG_DisableDebugMode(uint32_t mode); 117 118 /* APB1 peripheral */ 119 void DBG_EnableAPB1Periph(uint32_t peripheral); 120 void DBG_DisableAPB1Periph(uint32_t peripheral); 121 122 /* APB2 peripheral */ 123 void DBG_EnableAPB2Periph(uint32_t peripheral); 124 void DBG_DisableAPB2Periph(uint32_t peripheral); 125 126 #ifdef __cplusplus 127 } 128 #endif 129 130 #endif /* __APM32F0XX_DBG_H */ 131 132 /**@} end of group DBG_Functions */ 133 /**@} end of group DBG_Driver */ 134 /**@} end of group APM32F0xx_StdPeriphDriver */ 135