hc32_ll_rmu.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /**
  2. *******************************************************************************
  3. * @file hc32_ll_rmu.h
  4. * @brief This file contains all the functions prototypes of the RMU 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_RMU_H__
  22. #define __HC32_LL_RMU_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_RMU
  40. * @{
  41. */
  42. #if (LL_RMU_ENABLE == DDL_ON)
  43. /*******************************************************************************
  44. * Global type definitions ('typedef')
  45. ******************************************************************************/
  46. /*******************************************************************************
  47. * Global pre-processor symbols/macros ('#define')
  48. ******************************************************************************/
  49. /**
  50. * @defgroup RMU_Global_Macros RMU Global Macros
  51. * @{
  52. */
  53. /**
  54. * @defgroup RMU_ResetCause Rmu reset cause
  55. * @{
  56. */
  57. #define RMU_FLAG_PWR_ON (RMU_RSTF0_PORF) /*!< Power on reset */
  58. #define RMU_FLAG_PIN (RMU_RSTF0_PINRF) /*!< Reset pin reset */
  59. #define RMU_FLAG_BROWN_OUT (RMU_RSTF0_BORF) /*!< Brown-out reset */
  60. #define RMU_FLAG_PVD1 (RMU_RSTF0_PVD1RF) /*!< Program voltage Detection 1 reset */
  61. #define RMU_FLAG_PVD2 (RMU_RSTF0_PVD2RF) /*!< Program voltage Detection 2 reset */
  62. #define RMU_FLAG_WDT (RMU_RSTF0_WDRF) /*!< Watchdog timer reset */
  63. #define RMU_FLAG_SWDT (RMU_RSTF0_SWDRF) /*!< Special watchdog timer reset */
  64. #define RMU_FLAG_PWR_DOWN (RMU_RSTF0_PDRF) /*!< Power down reset */
  65. #define RMU_FLAG_SW (RMU_RSTF0_SWRF) /*!< Software reset */
  66. #define RMU_FLAG_MPU_ERR (RMU_RSTF0_MPUERF) /*!< Mpu error reset */
  67. #define RMU_FLAG_RAM_PARITY_ERR (RMU_RSTF0_RAPERF) /*!< Ram parity error reset */
  68. #define RMU_FLAG_RAM_ECC (RMU_RSTF0_RAECRF) /*!< Ram ECC reset */
  69. #define RMU_FLAG_CLK_ERR (RMU_RSTF0_CKFERF) /*!< Clk frequency error reset */
  70. #define RMU_FLAG_XTAL_ERR (RMU_RSTF0_XTALERF) /*!< Xtal error reset */
  71. #define RMU_FLAG_CPU_LOCKUP (RMU_RSTF0_LKUPRF) /*!< M4 Lockup reset */
  72. #define RMU_FLAG_MX (RMU_RSTF0_MULTIRF) /*!< Multiply reset cause */
  73. #define RMU_FLAG_ALL (RMU_FLAG_PWR_ON | RMU_FLAG_PIN | RMU_FLAG_BROWN_OUT | RMU_FLAG_PVD1 | \
  74. RMU_FLAG_PVD2 | RMU_FLAG_WDT | RMU_FLAG_SWDT | RMU_FLAG_PWR_DOWN | \
  75. RMU_FLAG_SW | RMU_FLAG_MPU_ERR | RMU_FLAG_RAM_PARITY_ERR | RMU_FLAG_RAM_ECC | \
  76. RMU_FLAG_CLK_ERR | RMU_FLAG_XTAL_ERR | RMU_FLAG_CPU_LOCKUP | RMU_FLAG_MX)
  77. /**
  78. * @}
  79. */
  80. /**
  81. * @defgroup RMU_ResetRegSel Rmu reset register
  82. * @{
  83. */
  84. #define RMU_FRST0 (0U)
  85. #define RMU_FRST1 (1U)
  86. #define RMU_FRST2 (2U)
  87. #define RMU_FRST3 (3U)
  88. /**
  89. * @}
  90. */
  91. /**
  92. * @defgroup RMU_ResetModuleSel Rmu reset module
  93. * @{
  94. */
  95. #define RMU_FRST0_KEY_RST (RMU_FRST0_KEY)
  96. #define RMU_FRST0_DMA1_RST (RMU_FRST0_DMA1)
  97. #define RMU_FRST0_DMA2_RST (RMU_FRST0_DMA2)
  98. #define RMU_FRST0_FCM_RST (RMU_FRST0_FCM)
  99. #define RMU_FRST0_AOS_RST (RMU_FRST0_AOS)
  100. #define RMU_FRST0_CTC_RST (RMU_FRST0_CTC)
  101. #define RMU_FRST0_AES_RST (RMU_FRST0_AES)
  102. #define RMU_FRST0_HASH_RST (RMU_FRST0_HASH)
  103. #define RMU_FRST0_TRNG_RST (RMU_FRST0_TRNG)
  104. #define RMU_FRST0_CRC_RST (RMU_FRST0_CRC)
  105. #define RMU_FRST0_DCU1_RST (RMU_FRST0_DCU1)
  106. #define RMU_FRST0_DCU2_RST (RMU_FRST0_DCU2)
  107. #define RMU_FRST0_DCU3_RST (RMU_FRST0_DCU3)
  108. #define RMU_FRST0_DCU4_RST (RMU_FRST0_DCU4)
  109. #define RMU_FRST0_RST_ALL (0x0FF7E000UL)
  110. #define RMU_FRST1_QSPI_RST (RMU_FRST1_QSPI)
  111. #define RMU_FRST1_SPI1_RST (RMU_FRST1_SPI1)
  112. #define RMU_FRST1_SPI2_RST (RMU_FRST1_SPI2)
  113. #define RMU_FRST1_SPI3_RST (RMU_FRST1_SPI3)
  114. #define RMU_FRST1_RST_ALL (0x00070008UL)
  115. #define RMU_FRST2_TMR6_RST (RMU_FRST2_TIMER6)
  116. #define RMU_FRST2_TMR4_RST (RMU_FRST2_TIMER4)
  117. #define RMU_FRST2_TMR0_RST (RMU_FRST2_TIMER0)
  118. #define RMU_FRST2_EMB_RST (RMU_FRST2_EMB)
  119. #define RMU_FRST2_TMRA_RST (RMU_FRST2_TIMERA)
  120. #define RMU_FRST2_RST_ALL (0x00109401UL)
  121. #define RMU_FRST3_ADC1_RST (RMU_FRST3_ADC1)
  122. #define RMU_FRST3_ADC2_RST (RMU_FRST3_ADC2)
  123. #define RMU_FRST3_ADC3_RST (RMU_FRST3_ADC3)
  124. #define RMU_FRST3_DAC_RST (RMU_FRST3_DAC)
  125. #define RMU_FRST3_CMP1_2_RST (RMU_FRST3_CMP12)
  126. #define RMU_FRST3_CMP3_4_RST (RMU_FRST3_CMP34)
  127. #define RMU_FRST3_SMC_RST (RMU_FRST3_EXMC_SMC)
  128. #define RMU_FRST3_USART1_RST (RMU_FRST3_USART1)
  129. #define RMU_FRST3_USART2_RST (RMU_FRST3_USART2)
  130. #define RMU_FRST3_USART3_RST (RMU_FRST3_USART3)
  131. #define RMU_FRST3_USART4_RST (RMU_FRST3_USART4)
  132. #define RMU_FRST3_USART5_RST (RMU_FRST3_USART5)
  133. #define RMU_FRST3_USART6_RST (RMU_FRST3_USART6)
  134. #define RMU_FRST3_RST_ALL (0x03F10317UL)
  135. /**
  136. * @}
  137. */
  138. /**
  139. * @}
  140. */
  141. /*******************************************************************************
  142. * Global variable definitions ('extern')
  143. ******************************************************************************/
  144. /*******************************************************************************
  145. Global function prototypes (definition in C source)
  146. ******************************************************************************/
  147. /**
  148. * @addtogroup RMU_Global_Functions
  149. * @{
  150. */
  151. en_flag_status_t RMU_GetStatus(uint32_t u32RmuResetCause);
  152. void RMU_ClearStatus(void);
  153. void RMU_CPULockUpCmd(en_functional_state_t enNewState);
  154. void RMU_PeriphRstCmd(uint8_t u8RstReg, uint32_t u32RstModule, en_functional_state_t enNewState);
  155. /**
  156. * @}
  157. */
  158. #endif /* LL_RMU_ENABLE */
  159. /**
  160. * @}
  161. */
  162. /**
  163. * @}
  164. */
  165. #ifdef __cplusplus
  166. }
  167. #endif
  168. #endif /* __HC32_LL_RMU_H__ */
  169. /*******************************************************************************
  170. * EOF (not truncated)
  171. ******************************************************************************/