at32f423_debug.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /**
  2. **************************************************************************
  3. * @file at32f423_mcudbg.h
  4. * @brief at32f423 mcudbg header file
  5. **************************************************************************
  6. * Copyright notice & Disclaimer
  7. *
  8. * The software Board Support Package (BSP) that is made available to
  9. * download from Artery official website is the copyrighted work of Artery.
  10. * Artery authorizes customers to use, copy, and distribute the BSP
  11. * software and its related documentation for the purpose of design and
  12. * development in conjunction with Artery microcontrollers. Use of the
  13. * software is governed by this copyright notice and the following disclaimer.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  16. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  17. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  18. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  19. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  21. *
  22. **************************************************************************
  23. */
  24. /* Define to prevent recursive inclusion -------------------------------------*/
  25. #ifndef __AT32F423_MCUDBG_H
  26. #define __AT32F423_MCUDBG_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "at32f423.h"
  32. /** @addtogroup AT32F423_periph_driver
  33. * @{
  34. */
  35. /** @addtogroup DEBUG
  36. * @{
  37. */
  38. /** @defgroup DEBUG_mode_definition
  39. * @{
  40. */
  41. /* debug ctrl register bit */
  42. #define DEBUG_SLEEP 0x00000001 /*!< debug sleep mode */
  43. #define DEBUG_DEEPSLEEP 0x00000002 /*!< debug deepsleep mode */
  44. #define DEBUG_STANDBY 0x00000004 /*!< debug standby mode */
  45. /* debug apb1 frz register bit */
  46. #define DEBUG_TMR2_PAUSE 0x00000001 /*!< debug timer2 pause */
  47. #define DEBUG_TMR3_PAUSE 0x00000002 /*!< debug timer3 pause */
  48. #define DEBUG_TMR4_PAUSE 0x00000004 /*!< debug timer4 pause */
  49. #define DEBUG_TMR6_PAUSE 0x00000010 /*!< debug timer6 pause */
  50. #define DEBUG_TMR7_PAUSE 0x00000020 /*!< debug timer7 pause */
  51. #define DEBUG_TMR12_PAUSE 0x00000040 /*!< debug timer12 pause */
  52. #define DEBUG_TMR13_PAUSE 0x00000080 /*!< debug timer13 pause */
  53. #define DEBUG_TMR14_PAUSE 0x00000100 /*!< debug timer14 pause */
  54. #define DEBUG_ERTC_PAUSE 0x00000400 /*!< debug ertc pause */
  55. #define DEBUG_WWDT_PAUSE 0x00000800 /*!< debug window watchdog timer pause */
  56. #define DEBUG_WDT_PAUSE 0x00001000 /*!< debug watchdog timer pause */
  57. #define DEBUG_ERTC_512_PAUSE 0x00008000 /*!< debug ertc_512 pause */
  58. #define DEBUG_I2C1_SMBUS_TIMEOUT 0x01000000 /*!< debug i2c1 smbus timeout */
  59. #define DEBUG_I2C2_SMBUS_TIMEOUT 0x08000000 /*!< debug i2c2 smbus timeout */
  60. #define DEBUG_I2C3_SMBUS_TIMEOUT 0x10000000 /*!< debug i2c3 smbus timeout */
  61. #define DEBUG_CAN1_PAUSE 0x02000000 /*!< debug can1 pause */
  62. #define DEBUG_CAN2_PAUSE 0x04000000 /*!< debug can2 pause */
  63. /* debug apb2 frz register bit */
  64. #define DEBUG_TMR1_PAUSE 0x00000001 /*!< debug timer1 pause */
  65. #define DEBUG_TMR9_PAUSE 0x00010000 /*!< debug timer9 pause */
  66. #define DEBUG_TMR10_PAUSE 0x00020000 /*!< debug timer10 pause */
  67. #define DEBUG_TMR11_PAUSE 0x00040000 /*!< debug timer11 pause */
  68. /**
  69. * @}
  70. */
  71. /** @defgroup DEBUG_exported_types
  72. * @{
  73. */
  74. /**
  75. * @brief type define debug register all
  76. */
  77. typedef struct
  78. {
  79. /**
  80. * @brief debug idcode register, offset:0x00
  81. */
  82. union
  83. {
  84. __IO uint32_t pid;
  85. struct
  86. {
  87. __IO uint32_t pid : 32;/* [31:0] */
  88. } idcode_bit;
  89. };
  90. /**
  91. * @brief debug ctrl register, offset:0x04
  92. */
  93. union
  94. {
  95. __IO uint32_t ctrl;
  96. struct
  97. {
  98. __IO uint32_t sleep_debug : 1;/* [0] */
  99. __IO uint32_t deepsleep_debug : 1;/* [1] */
  100. __IO uint32_t standby_debug : 1;/* [2] */
  101. __IO uint32_t reserved1 : 29;/* [31:3] */
  102. } ctrl_bit;
  103. };
  104. /**
  105. * @brief debug apb1 frz register, offset:0x08
  106. */
  107. union
  108. {
  109. __IO uint32_t apb1_frz;
  110. struct
  111. {
  112. __IO uint32_t tmr2_pause : 1;/* [0] */
  113. __IO uint32_t tmr3_pause : 1;/* [1] */
  114. __IO uint32_t tmr4_pause : 1;/* [2] */
  115. __IO uint32_t reserved1 : 1;/* [3] */
  116. __IO uint32_t tmr6_pause : 1;/* [4] */
  117. __IO uint32_t tmr7_pause : 1;/* [5] */
  118. __IO uint32_t tmr12_pause : 1;/* [6] */
  119. __IO uint32_t tmr13_pause : 1;/* [7] */
  120. __IO uint32_t tmr14_pause : 1;/* [8] */
  121. __IO uint32_t reserved2 : 1;/* [9] */
  122. __IO uint32_t ertc_pause : 1;/* [10] */
  123. __IO uint32_t wwdt_pause : 1;/* [11] */
  124. __IO uint32_t wdt_pause : 1;/* [12] */
  125. __IO uint32_t reserved3 : 2;/* [14:13] */
  126. __IO uint32_t ertc_512_pause : 1;/* [15] */
  127. __IO uint32_t reserved4 : 8;/* [23:16] */
  128. __IO uint32_t i2c1_smbus_timeout : 1;/* [24] */
  129. __IO uint32_t can1_pause : 1;/* [25] */
  130. __IO uint32_t can2_pause : 1;/* [26] */
  131. __IO uint32_t i2c2_smbus_timeout : 1;/* [27] */
  132. __IO uint32_t i2c3_smbus_timeout : 1;/* [28] */
  133. __IO uint32_t reserved5 : 3;/* [31:29] */
  134. } apb1_frz_bit;
  135. };
  136. /**
  137. * @brief debug apb2 frz register, offset:0x0c
  138. */
  139. union
  140. {
  141. __IO uint32_t apb2_frz;
  142. struct
  143. {
  144. __IO uint32_t tmr1_pause : 1;/* [0] */
  145. __IO uint32_t reserved1 : 1;/* [1] */
  146. __IO uint32_t reserved2 : 4;/* [5:2] */
  147. __IO uint32_t reserved3 : 1;/* [6] */
  148. __IO uint32_t reserved4 : 9;/* [15:7] */
  149. __IO uint32_t tmr9_pause : 1;/* [16] */
  150. __IO uint32_t tmr10_pause : 1;/* [17] */
  151. __IO uint32_t tmr11_pause : 1;/* [18] */
  152. __IO uint32_t reserved5 : 13;/* [31:19] */
  153. } apb2_frz_bit;
  154. };
  155. } debug_type;
  156. /**
  157. * @}
  158. */
  159. #define DEBUGMCU ((debug_type *) DEBUG_BASE)
  160. /** @defgroup DEBUG_exported_functions
  161. * @{
  162. */
  163. uint32_t debug_device_id_get(void);
  164. void debug_low_power_mode_set(uint32_t low_power_mode, confirm_state new_state);
  165. void debug_apb1_periph_mode_set(uint32_t apb1_periph, confirm_state new_state);
  166. void debug_apb2_periph_mode_set(uint32_t apb2_periph, confirm_state new_state);
  167. /**
  168. * @}
  169. */
  170. /**
  171. * @}
  172. */
  173. /**
  174. * @}
  175. */
  176. #ifdef __cplusplus
  177. }
  178. #endif
  179. #endif