at32f425_debug.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /**
  2. **************************************************************************
  3. * @file at32f425_debug.h
  4. * @brief at32f425 debug 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 __AT32F425_DEBUG_H
  26. #define __AT32F425_DEBUG_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "at32f425.h"
  32. /** @addtogroup AT32F425_periph_driver
  33. * @{
  34. */
  35. /** @addtogroup DEBUG
  36. * @{
  37. */
  38. /** @defgroup DEBUG_mode_definition
  39. * @{
  40. */
  41. #define DEBUG_SLEEP 0x00000001 /*!< debug sleep mode */
  42. #define DEBUG_DEEPSLEEP 0x00000002 /*!< debug deepsleep mode */
  43. #define DEBUG_STANDBY 0x00000004 /*!< debug standby mode */
  44. #define DEBUG_CAN_PAUSE 0x00000008 /*!< debug can pause */
  45. #define DEBUG_WDT_PAUSE 0x00000100 /*!< debug watchdog timer pause */
  46. #define DEBUG_WWDT_PAUSE 0x00000200 /*!< debug window watchdog timer pause */
  47. #define DEBUG_TMR1_PAUSE 0x00000400 /*!< debug timer1 pause */
  48. #define DEBUG_TMR2_PAUSE 0x00000800 /*!< debug timer2 pause */
  49. #define DEBUG_TMR3_PAUSE 0x00001000 /*!< debug timer3 pause */
  50. #define DEBUG_ERTC_PAUSE 0x00004000 /*!< debug ertc pause */
  51. #define DEBUG_I2C1_SMBUS_TIMEOUT 0x00008000 /*!< debug i2c1 smbus timeout */
  52. #define DEBUG_I2C2_SMBUS_TIMEOUT 0x00010000 /*!< debug i2c2 smbus timeout */
  53. #define DEBUG_TMR6_PAUSE 0x00080000 /*!< debug timer6 pause */
  54. #define DEBUG_TMR7_PAUSE 0x00100000 /*!< debug timer7 pause */
  55. #define DEBUG_ERTC_512_PAUSE 0x00200000 /*!< debug ertc 512 pause */
  56. #define DEBUG_TMR15_PAUSE 0x00400000 /*!< debug timer15 pause */
  57. #define DEBUG_TMR16_PAUSE 0x00800000 /*!< debug timer16 pause */
  58. #define DEBUG_TMR17_PAUSE 0x01000000 /*!< debug timer17 pause */
  59. #define DEBUG_TMR13_PAUSE 0x04000000 /*!< debug timer13 pause */
  60. #define DEBUG_TMR14_PAUSE 0x08000000 /*!< debug timer14 pause */
  61. /**
  62. * @}
  63. */
  64. /** @defgroup DEBUG_exported_types
  65. * @{
  66. */
  67. /**
  68. * @brief type define debug register all
  69. */
  70. typedef struct
  71. {
  72. /**
  73. * @brief debug idcode register, offset:0x00
  74. */
  75. union
  76. {
  77. __IO uint32_t pid;
  78. struct
  79. {
  80. __IO uint32_t pid : 32;/* [31:0] */
  81. } idcode_bit;
  82. };
  83. /**
  84. * @brief debug ctrl register, offset:0x04
  85. */
  86. union
  87. {
  88. __IO uint32_t ctrl;
  89. struct
  90. {
  91. __IO uint32_t sleep_debug : 1;/* [0] */
  92. __IO uint32_t deepsleep_debug : 1;/* [1] */
  93. __IO uint32_t standby_debug : 1;/* [2] */
  94. __IO uint32_t can_debug : 1;/* [3] */
  95. __IO uint32_t reserved1 : 4;/* [7:4] */
  96. __IO uint32_t wdt_pause : 1;/* [8] */
  97. __IO uint32_t wwdt_pause : 1;/* [9] */
  98. __IO uint32_t tmr1_pause : 1;/* [10] */
  99. __IO uint32_t tmr2_pause : 1;/* [11] */
  100. __IO uint32_t tmr3_pause : 1;/* [12] */
  101. __IO uint32_t reserved2 : 1;/* [13] */
  102. __IO uint32_t ertc_pause : 1;/* [14] */
  103. __IO uint32_t i2c1_smbus_timeout : 1;/* [15] */
  104. __IO uint32_t i2c2_smbus_timeout : 1;/* [16] */
  105. __IO uint32_t reserved3 : 2;/* [18:17] */
  106. __IO uint32_t tmr6_pause : 1;/* [19] */
  107. __IO uint32_t tmr7_pause : 1;/* [20] */
  108. __IO uint32_t ertc_512_pause : 1;/* [21] */
  109. __IO uint32_t tmr15_pause : 1;/* [22] */
  110. __IO uint32_t tmr16_pause : 1;/* [23] */
  111. __IO uint32_t tmr17_pause : 1;/* [24] */
  112. __IO uint32_t reserved4 : 1;/* [25] */
  113. __IO uint32_t tmr13_pause : 1;/* [26] */
  114. __IO uint32_t tmr14_pause : 1;/* [27] */
  115. __IO uint32_t reserved5 : 4;/* [31:28] */
  116. } ctrl_bit;
  117. };
  118. } debug_type;
  119. /**
  120. * @}
  121. */
  122. #define DEBUGMCU ((debug_type *) DEBUG_BASE)
  123. /** @defgroup DEBUG_exported_functions
  124. * @{
  125. */
  126. uint16_t debug_device_id_get(void);
  127. void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state);
  128. /**
  129. * @}
  130. */
  131. /**
  132. * @}
  133. */
  134. /**
  135. * @}
  136. */
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif