at32f421_debug.h 5.0 KB

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