reg_dbg.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ////////////////////////////////////////////////////////////////////////////////
  2. /// @file reg_dbg.h
  3. /// @author AE TEAM
  4. /// @brief THIS FILE CONTAINS ALL THE FUNCTIONS PROTOTYPES FOR THE SERIES OF
  5. /// MM32 FIRMWARE LIBRARY.
  6. ////////////////////////////////////////////////////////////////////////////////
  7. /// @attention
  8. ///
  9. /// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE
  10. /// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE
  11. /// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR
  12. /// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH
  13. /// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN
  14. /// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS.
  15. ///
  16. /// <H2><CENTER>&COPY; COPYRIGHT MINDMOTION </CENTER></H2>
  17. ////////////////////////////////////////////////////////////////////////////////
  18. // Define to prevent recursive inclusion
  19. #ifndef __REG_DBG_H
  20. #define __REG_DBG_H
  21. // Files includes
  22. #include <stdint.h>
  23. #include <stdbool.h>
  24. #include "types.h"
  25. #if defined ( __CC_ARM )
  26. #pragma anon_unions
  27. #endif
  28. ////////////////////////////////////////////////////////////////////////////////
  29. /// @brief DBG Base Address Definition
  30. ////////////////////////////////////////////////////////////////////////////////
  31. #define DBG_BASE (0x40007080UL) ///< Base Address: 0x40007080
  32. ////////////////////////////////////////////////////////////////////////////////
  33. /// @brief DEBUG Registers Structure Definition
  34. ////////////////////////////////////////////////////////////////////////////////
  35. typedef struct {
  36. __IO u32 IDCODE; ///< Code ID offset: 0x00
  37. __IO u32 CR; ///< Control Register offset: 0x04
  38. } DBGMCU_TypeDef;
  39. ////////////////////////////////////////////////////////////////////////////////
  40. /// @brief DBGMCU type pointer Definition
  41. ////////////////////////////////////////////////////////////////////////////////
  42. #define DBGMCU ((DBGMCU_TypeDef*) DBG_BASE)
  43. ////////////////////////////////////////////////////////////////////////////////
  44. /// @brief DBGMCU_IDCODE Register Bit Definition
  45. ////////////////////////////////////////////////////////////////////////////////
  46. #define DBGMCU_IDCODE_DEV_ID_Pos (0)
  47. #define DBGMCU_IDCODE_DEV_ID (0xFFFFFFFFU << DBGMCU_IDCODE_DEV_ID_Pos) ///< Device identifier
  48. ////////////////////////////////////////////////////////////////////////////////
  49. /// @brief DBGMCU_CR Register Bit Definition
  50. ////////////////////////////////////////////////////////////////////////////////
  51. #define DBGMCU_CR_SLEEP_Pos (0)
  52. #define DBGMCU_CR_SLEEP (0x01U << DBGMCU_CR_SLEEP_Pos) ///< Debug Sleep mode
  53. #define DBGMCU_CR_STOP_Pos (1)
  54. #define DBGMCU_CR_STOP (0x01U << DBGMCU_CR_STOP_Pos) ///< Debug Stop mode
  55. #define DBGMCU_CR_STANDBY_Pos (2)
  56. #define DBGMCU_CR_STANDBY (0x01U << DBGMCU_CR_STANDBY_Pos) ///< Debug Standby mode
  57. #define DBGMCU_CR_TRACE_IOEN_Pos (5)
  58. #define DBGMCU_CR_TRACE_IOEN (0x01U << DBGMCU_CR_TRACE_IOEN_Pos) ///< Trace pin assignment
  59. #define DBGMCU_CR_TRACE_MODE_Pos (6)
  60. #define DBGMCU_CR_TRACE_MODE_Msk (0x03U << DBGMCU_CR_TRACE_MODE_Pos) ///< TRACE_MODE[1:0] bits (Trace Pin Assignment Control)
  61. #define DBGMCU_CR_TRACE_MODE_0 (0x01U << DBGMCU_CR_TRACE_MODE_Pos) ///< Bit 0
  62. #define DBGMCU_CR_TRACE_MODE_1 (0x02U << DBGMCU_CR_TRACE_MODE_Pos) ///< Bit 1
  63. #define DBGMCU_CR_TRACE_MODE_ASYNC (0x00U << DBGMCU_CR_TRACE_MODE_Pos) ///< Tracking pin uses asynchronous mode
  64. #define DBGMCU_CR_TRACE_MODE_SYNC1 (0x01U << DBGMCU_CR_TRACE_MODE_Pos) ///< The trace pin uses synchronous mode, and the data length is 1
  65. #define DBGMCU_CR_TRACE_MODE_SYNC2 (0x02U << DBGMCU_CR_TRACE_MODE_Pos) ///< The trace pin uses synchronous mode, and the data length is 2
  66. #define DBGMCU_CR_IWDG_STOP_Pos (8)
  67. #define DBGMCU_CR_IWDG_STOP (0x01U << DBGMCU_CR_IWDG_STOP_Pos) ///< Debug independent watchdog stopped when core is halted
  68. #define DBGMCU_CR_WWDG_STOP_Pos (9)
  69. #define DBGMCU_CR_WWDG_STOP (0x01U << DBGMCU_CR_WWDG_STOP_Pos) ///< Debug window watchdog stopped when core is halted
  70. #define DBGMCU_CR_TIM_STOP_Pos (10)
  71. #define DBGMCU_CR_TIM1_STOP (0x01U << DBGMCU_CR_TIM_STOP_Pos) ///< TIM1 counter stopped when core is halted
  72. #define DBGMCU_CR_TIM2_STOP (0x02U << DBGMCU_CR_TIM_STOP_Pos) ///< TIM2 counter stopped when core is halted
  73. #define DBGMCU_CR_TIM3_STOP (0x04U << DBGMCU_CR_TIM_STOP_Pos) ///< TIM3 counter stopped when core is halted
  74. #define DBGMCU_CR_TIM4_STOP (0x08U << DBGMCU_CR_TIM_STOP_Pos) ///< TIM4 counter stopped when core is halted
  75. /// @}
  76. /// @}
  77. /// @}
  78. ////////////////////////////////////////////////////////////////////////////////
  79. #endif
  80. ////////////////////////////////////////////////////////////////////////////////