hc32_ll_dbgc.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /**
  2. *******************************************************************************
  3. * @file hc32_ll_dbgc.h
  4. * @brief This file contains all the functions prototypes of the DBGC driver
  5. * library.
  6. @verbatim
  7. Change Logs:
  8. Date Author Notes
  9. 2022-12-31 CDT First version
  10. @endverbatim
  11. *******************************************************************************
  12. * Copyright (C) 2022, Xiaohua Semiconductor Co., Ltd. All rights reserved.
  13. *
  14. * This software component is licensed by XHSC under BSD 3-Clause license
  15. * (the "License"); You may not use this file except in compliance with the
  16. * License. You may obtain a copy of the License at:
  17. * opensource.org/licenses/BSD-3-Clause
  18. *
  19. *******************************************************************************
  20. */
  21. #ifndef __HC32_LL_DBGC_H__
  22. #define __HC32_LL_DBGC_H__
  23. /* C binding of definitions if building with C++ compiler */
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /*******************************************************************************
  29. * Include files
  30. ******************************************************************************/
  31. #include "hc32_ll_def.h"
  32. #include "hc32f4xx.h"
  33. #include "hc32f4xx_conf.h"
  34. /**
  35. * @addtogroup LL_Driver
  36. * @{
  37. */
  38. /**
  39. * @addtogroup LL_DBGC
  40. * @{
  41. */
  42. #if (LL_DBGC_ENABLE == DDL_ON)
  43. /*******************************************************************************
  44. * Global type definitions ('typedef')
  45. ******************************************************************************/
  46. /**
  47. a * @defgroup DBGC_Global_Types DAC Global Types
  48. * @{
  49. */
  50. /**
  51. * @brief DBGC authenticate ID definition
  52. */
  53. typedef struct {
  54. uint32_t u32AuthID0; /*!< auth ID 0. */
  55. uint32_t u32AuthID1; /*!< auth ID 1. */
  56. uint32_t u32AuthID2; /*!< auth ID 2. */
  57. } stc_dbgc_auth_id_t;
  58. /**
  59. * @}
  60. */
  61. /*******************************************************************************
  62. * Global pre-processor symbols/macros ('#define')
  63. ******************************************************************************/
  64. /**
  65. * @defgroup DBGC_Global_Macros DBGC Global Macros
  66. * @{
  67. */
  68. /**
  69. * @defgroup DBGC_MCU_Status DBGC MCU Status
  70. * @{
  71. */
  72. #define DBGC_MCU_LVL1_FREE_LVL2_FREE (0x00UL)
  73. #define DBGC_MCU_LVL1_LOCK_LVL2_FREE (DBGC_MCUSTAT_SAFTYLOCK1)
  74. #define DBGC_MCU_LVL1_UNLOCK_LVL2_FREE (DBGC_MCUSTAT_SAFTYLOCK1 | DBGC_MCUSTAT_AUTH)
  75. #define DBGC_MCU_LVL1_FREE_LVL2_LOCK (DBGC_MCUSTAT_SAFTYLOCK2)
  76. #define DBGC_MCU_LVL1_LOCK_LVL2_LOCK (DBGC_MCUSTAT_SAFTYLOCK1 | DBGC_MCUSTAT_SAFTYLOCK2)
  77. #define DBGC_MCU_LVL1_UNLOCK_LVL2_LOCK (DBGC_MCUSTAT_SAFTYLOCK1 | DBGC_MCUSTAT_AUTH | DBGC_MCUSTAT_SAFTYLOCK2)
  78. /**
  79. * @}
  80. */
  81. /**
  82. * @defgroup DBGC_Periph_Sel DBGC Periph Selection
  83. * @{
  84. */
  85. #define DBGC_PERIPH_SWDT (DBGC_MCUSTPCTL_SWDTSTP)
  86. #define DBGC_PERIPH_WDT (DBGC_MCUSTPCTL_WDTSTP )
  87. #define DBGC_PERIPH_RTC (DBGC_MCUSTPCTL_RTCSTP )
  88. #define DBGC_PERIPH_LVD1 (DBGC_MCUSTPCTL_PVD1STP)
  89. #define DBGC_PERIPH_LVD2 (DBGC_MCUSTPCTL_PVD2STP)
  90. #define DBGC_PERIPH_TMR0_1 (DBGC_MCUSTPCTL_M06STP)
  91. #define DBGC_PERIPH_TMR0_2 (DBGC_MCUSTPCTL_M07STP)
  92. #define DBGC_PERIPH_TMR4_1 (DBGC_MCUSTPCTL_M12STP)
  93. #define DBGC_PERIPH_TMR4_2 (DBGC_MCUSTPCTL_M13STP)
  94. #define DBGC_PERIPH_TMR4_3 (DBGC_MCUSTPCTL_M14STP)
  95. #define DBGC_PERIPH_TMR6_1 (DBGC_MCUSTPCTL_M15STP)
  96. #define DBGC_PERIPH_TMR6_2 (DBGC_MCUSTPCTL_M16STP)
  97. /**
  98. * @}
  99. */
  100. /**
  101. * @defgroup DBGC_Periph2_Sel DBGC Periph2 Selection
  102. * @{
  103. */
  104. #define DBGC_PERIPH_TMRA_1 (DBGC_MCUSTPCTL2_M23STP)
  105. #define DBGC_PERIPH_TMRA_2 (DBGC_MCUSTPCTL2_M24STP)
  106. #define DBGC_PERIPH_TMRA_3 (DBGC_MCUSTPCTL2_M25STP)
  107. #define DBGC_PERIPH_TMRA_4 (DBGC_MCUSTPCTL2_M26STP)
  108. #define DBGC_PERIPH_TMRA_5 (DBGC_MCUSTPCTL2_M27STP)
  109. /**
  110. * @}
  111. */
  112. /**
  113. * @}
  114. */
  115. /*******************************************************************************
  116. * Global variable definitions ('extern')
  117. ******************************************************************************/
  118. /*******************************************************************************
  119. Global function prototypes (definition in C source)
  120. ******************************************************************************/
  121. /**
  122. * @addtogroup DBGC_Global_Functions
  123. * @{
  124. */
  125. uint32_t DBGC_GetMcuStatus(void);
  126. int32_t DBGC_FlashErase(void);
  127. void DBGC_GetAuthID(stc_dbgc_auth_id_t *pstcAuthID);
  128. void DBGC_PeriphCmd(uint32_t u32Periph, en_functional_state_t enNewState);
  129. void DBGC_Periph2Cmd(uint32_t u32Periph, en_functional_state_t enNewState);
  130. uint32_t DBGC_GetChipID(void);
  131. /**
  132. * @}
  133. */
  134. #endif /* LL_DBGC_ENABLE */
  135. /**
  136. * @}
  137. */
  138. /**
  139. * @}
  140. */
  141. #ifdef __cplusplus
  142. }
  143. #endif
  144. #endif /* __HC32_LL_DBGC_H__ */
  145. /*******************************************************************************
  146. * EOF (not truncated)
  147. ******************************************************************************/