at32f413_debug.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /**
  2. **************************************************************************
  3. * @file at32f413_debug.h
  4. * @brief at32f413 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 __AT32F413_DEBUG_H
  26. #define __AT32F413_DEBUG_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "at32f413.h"
  32. /** @addtogroup AT32F413_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_TMR2_PAUSE 0x00000800 /*!< debug timer2 pause */
  48. #define DEBUG_TMR3_PAUSE 0x00001000 /*!< debug timer3 pause */
  49. #define DEBUG_TMR4_PAUSE 0x00002000 /*!< debug timer4 pause */
  50. #define DEBUG_CAN1_PAUSE 0x00004000 /*!< debug can1 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_TMR8_PAUSE 0x00020000 /*!< debug timer8 pause */
  54. #define DEBUG_TMR5_PAUSE 0x00040000 /*!< debug timer5 pause */
  55. #define DEBUG_CAN2_PAUSE 0x00200000 /*!< debug can2 pause */
  56. #define DEBUG_TMR9_PAUSE 0x10000000 /*!< debug timer9 pause */
  57. #define DEBUG_TMR10_PAUSE 0x20000000 /*!< debug timer10 pause */
  58. #define DEBUG_TMR11_PAUSE 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 reserved2 : 2;/* [20:19] */
  107. __IO uint32_t can2_pause : 1;/* [21] */
  108. __IO uint32_t reserved3 : 6;/* [27:22] */
  109. __IO uint32_t tmr9_pause : 1;/* [28] */
  110. __IO uint32_t tmr10_pause : 1;/* [29] */
  111. __IO uint32_t tmr11_pause : 1;/* [30] */
  112. __IO uint32_t reserved4 : 1;/* [31] */
  113. } ctrl_bit;
  114. };
  115. } debug_type;
  116. /**
  117. * @}
  118. */
  119. #define DEBUGMCU ((debug_type *) DEBUG_BASE)
  120. /** @defgroup DEBUG_exported_functions
  121. * @{
  122. */
  123. uint32_t debug_device_id_get(void);
  124. void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state);
  125. /**
  126. * @}
  127. */
  128. /**
  129. * @}
  130. */
  131. /**
  132. * @}
  133. */
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137. #endif