at32f415_debug.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /**
  2. **************************************************************************
  3. * @file at32f415_debug.h
  4. * @version v2.0.5
  5. * @date 2022-05-20
  6. * @brief at32f415 debug header file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  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.
  16. *
  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.
  23. *
  24. **************************************************************************
  25. */
  26. /* Define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __AT32F415_DEBUG_H
  28. #define __AT32F415_DEBUG_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* Includes ------------------------------------------------------------------*/
  33. #include "at32f415.h"
  34. /** @addtogroup AT32F415_periph_driver
  35. * @{
  36. */
  37. /** @addtogroup DEBUG
  38. * @{
  39. */
  40. /** @defgroup DEBUG_mode_definition
  41. * @{
  42. */
  43. #define DEBUG_SLEEP ((uint32_t)0x00000001) /*!< debug sleep mode */
  44. #define DEBUG_DEEPSLEEP ((uint32_t)0x00000002) /*!< debug deepsleep mode */
  45. #define DEBUG_STANDBY ((uint32_t)0x00000004) /*!< debug standby mode */
  46. #define DEBUG_WDT_PAUSE ((uint32_t)0x00000100) /*!< debug watchdog timer pause */
  47. #define DEBUG_WWDT_PAUSE ((uint32_t)0x00000200) /*!< debug window watchdog timer pause */
  48. #define DEBUG_TMR1_PAUSE ((uint32_t)0x00000400) /*!< debug timer1 pause */
  49. #define DEBUG_TMR3_PAUSE ((uint32_t)0x00001000) /*!< debug timer3 pause */
  50. #define DEBUG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) /*!< debug i2c1 smbus timeout */
  51. #define DEBUG_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) /*!< debug i2c2 smbus timeout */
  52. #define DEBUG_TMR2_PAUSE ((uint32_t)0x00000800) /*!< debug timer2 pause */
  53. #define DEBUG_TMR4_PAUSE ((uint32_t)0x00002000) /*!< debug timer4 pause */
  54. #define DEBUG_CAN1_PAUSE ((uint32_t)0x00004000) /*!< debug can1 pause */
  55. #define DEBUG_TMR5_PAUSE ((uint32_t)0x00040000) /*!< debug timer5 pause */
  56. #define DEBUG_TMR9_PAUSE ((uint32_t)0x10000000) /*!< debug timer9 pause */
  57. #define DEBUG_TMR10_PAUSE ((uint32_t)0x20000000) /*!< debug timer10 pause */
  58. #define DEBUG_TMR11_PAUSE ((uint32_t)0x40000000) /*!< debug timer11 pause */
  59. /**
  60. * @}
  61. */
  62. /** @defgroup DEBUG_exported_types
  63. * @{
  64. */
  65. /**
  66. * @brief type define debug register all
  67. */
  68. typedef struct
  69. {
  70. /**
  71. * @brief debug idcode register, offset:0x00
  72. */
  73. union
  74. {
  75. __IO uint32_t pid;
  76. struct
  77. {
  78. __IO uint32_t pid : 32;/* [31:0] */
  79. } idcode_bit;
  80. };
  81. /**
  82. * @brief debug ctrl register, offset:0x04
  83. */
  84. union
  85. {
  86. __IO uint32_t ctrl;
  87. struct
  88. {
  89. __IO uint32_t sleep_debug : 1;/* [0] */
  90. __IO uint32_t deepsleep_debug : 1;/* [1] */
  91. __IO uint32_t standby_debug : 1;/* [2] */
  92. __IO uint32_t reserved1 : 2;/* [4:3] */
  93. __IO uint32_t trace_ioen : 1;/* [5] */
  94. __IO uint32_t trace_mode : 2;/* [7:6] */
  95. __IO uint32_t wdt_pause : 1;/* [8] */
  96. __IO uint32_t wwdt_pause : 1;/* [9] */
  97. __IO uint32_t tmr1_pause : 1;/* [10] */
  98. __IO uint32_t tmr2_pause : 1;/* [11] */
  99. __IO uint32_t tmr3_pause : 1;/* [12] */
  100. __IO uint32_t tmr4_pause : 1;/* [13] */
  101. __IO uint32_t can1_pause : 1;/* [14] */
  102. __IO uint32_t i2c1_smbus_timeout : 1;/* [15] */
  103. __IO uint32_t i2c2_smbus_timeout : 1;/* [16] */
  104. __IO uint32_t tmr8_pause : 1;/* [17] */
  105. __IO uint32_t tmr5_pause : 1;/* [18] */
  106. __IO uint32_t tmr6_pause : 1;/* [19] */
  107. __IO uint32_t tmr7_pause : 1;/* [20] */
  108. __IO uint32_t can2_pause : 1;/* [21] */
  109. __IO uint32_t reserved2 : 3;/* [24:22] */
  110. __IO uint32_t tmr12_pause : 1;/* [25] */
  111. __IO uint32_t tmr13_pause : 1;/* [26] */
  112. __IO uint32_t tmr14_pause : 1;/* [27] */
  113. __IO uint32_t tmr9_pause : 1;/* [28] */
  114. __IO uint32_t tmr10_pause : 1;/* [29] */
  115. __IO uint32_t tmr11_pause : 1;/* [30] */
  116. __IO uint32_t i2c3_smbus_timeout : 1;/* [31] */
  117. } ctrl_bit;
  118. };
  119. } debug_type;
  120. /**
  121. * @}
  122. */
  123. #define DEBUGMCU ((debug_type *) DEBUG_BASE)
  124. /** @defgroup DEBUG_exported_functions
  125. * @{
  126. */
  127. uint32_t debug_device_id_get(void);
  128. void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state);
  129. /**
  130. * @}
  131. */
  132. /**
  133. * @}
  134. */
  135. /**
  136. * @}
  137. */
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif