ciu32f003_std_dbg(1).h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /************************************************************************************************/
  2. /**
  3. * @file ciu32f003_std_dbg.h
  4. * @author MCU Ecosystem Development Team
  5. * @brief DBG STD库驱动头文件。
  6. * 提供DBG相关的STD库操作函数声明、数据类型以及常量的定义。
  7. *
  8. *
  9. **************************************************************************************************
  10. * @attention
  11. * Copyright (c) CEC Huada Electronic Design Co.,Ltd. All rights reserved.
  12. *
  13. **************************************************************************************************
  14. */
  15. /* 避免头文件重复引用 */
  16. #ifndef CIU32F003_STD_DBG_H
  17. #define CIU32F003_STD_DBG_H
  18. /************************************************************************************************/
  19. /**
  20. * @addtogroup CIU32F003_STD_Driver
  21. * @{
  22. */
  23. /**
  24. * @defgroup DBG DBG
  25. * @brief 调试接口的STD库驱动
  26. * @{
  27. */
  28. /************************************************************************************************/
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /*------------------------------------------includes--------------------------------------------*/
  33. #include "ciu32f003_std_common.h"
  34. /*--------------------------------------------define--------------------------------------------*/
  35. /************************************************************************************************/
  36. /**
  37. * @defgroup DBG_Constants DBG Constants
  38. * @brief DBG常量定义及宏定义
  39. * @{
  40. *
  41. */
  42. /************************************************************************************************/
  43. /* 外设的计数控制选择 */
  44. #define DBG_PERIPH_TIM3 DBG_APB_FZ1_TIM3_HOLD /**< TIM3 计数控制位 */
  45. #define DBG_PERIPH_IWDG DBG_APB_FZ1_IWDG_HOLD /**< IWDG 计数控制位 */
  46. #define DBG_PERIPH_LPTIM1 DBG_APB_FZ1_LPTIM1_HOLD /**< LPTIM1 计数控制位 */
  47. /**
  48. * @}
  49. */
  50. /*------------------------------------functions-------------------------------------------------*/
  51. /************************************************************************************************/
  52. /**
  53. * @defgroup DBG_External_Functions DBG External Functions
  54. * @brief DBG对外函数
  55. * @{
  56. *
  57. */
  58. /************************************************************************************************/
  59. /**
  60. * @brief 使能Stop模式调试功能
  61. * @note 只能通过POR复位
  62. * @retval 无
  63. */
  64. __STATIC_INLINE void std_dbg_stop_enable(void)
  65. {
  66. DBG->CR = DBG_CR_DBG_STOP;
  67. }
  68. /**
  69. * @brief 禁止Stop模式调试功能
  70. * @note 只能通过POR复位
  71. * @retval 无
  72. */
  73. __STATIC_INLINE void std_dbg_stop_disable(void)
  74. {
  75. DBG->CR = (~DBG_CR_DBG_STOP);
  76. }
  77. /**
  78. * @brief 内核停止时停止计数
  79. * @param periph_hold 指定停止的计数控制
  80. * @arg DBG_PERIPH_TIM3
  81. * @arg DBG_PERIPH_IWDG
  82. * @arg DBG_PERIPH_LPTIM1
  83. * @note 只能通过POR复位
  84. * @retval 无
  85. */
  86. __STATIC_INLINE void std_dbg_apb1_hold_enable(uint32_t periph_hold)
  87. {
  88. DBG->APB_FZ1 |= periph_hold;
  89. }
  90. /**
  91. * @brief 内核停止时正常计数
  92. * @param periph_hold 指定正常的计数控制
  93. * @arg DBG_PERIPH_TIM3
  94. * @arg DBG_PERIPH_IWDG
  95. * @arg DBG_PERIPH_LPTIM1
  96. * @note 只能通过POR复位
  97. * @retval 无
  98. */
  99. __STATIC_INLINE void std_dbg_apb1_hold_disable(uint32_t periph_hold)
  100. {
  101. DBG->APB_FZ1 &= (~periph_hold);
  102. }
  103. /**
  104. * @brief 内核停止时TIM1停止计数
  105. * @note 只能通过POR复位
  106. * @retval 无
  107. */
  108. __STATIC_INLINE void std_dbg_tim1_hold_enable(void)
  109. {
  110. DBG->APB_FZ2 = DBG_APB_FZ2_TIM1_HOLD;
  111. }
  112. /**
  113. * @brief 内核停止时TIM1正常计数
  114. * @note 只能通过POR复位
  115. * @retval 无
  116. */
  117. __STATIC_INLINE void std_dbg_tim1_hold_disable(void)
  118. {
  119. DBG->APB_FZ2 = (~DBG_APB_FZ2_TIM1_HOLD);
  120. }
  121. /**
  122. * @}
  123. */
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127. /**
  128. * @}
  129. */
  130. /**
  131. * @}
  132. */
  133. #endif /* CIU32F003_STD_DBG_H */