hc32l196_reset.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /******************************************************************************
  2. * Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
  3. *
  4. * This software is owned and published by:
  5. * Huada Semiconductor Co.,Ltd ("HDSC").
  6. *
  7. * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
  8. * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
  9. *
  10. * This software contains source code for use with HDSC
  11. * components. This software is licensed by HDSC to be adapted only
  12. * for use in systems utilizing HDSC components. HDSC shall not be
  13. * responsible for misuse or illegal use of this software for devices not
  14. * supported herein. HDSC is providing this software "AS IS" and will
  15. * not be responsible for issues arising from incorrect user implementation
  16. * of the software.
  17. *
  18. * Disclaimer:
  19. * HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
  20. * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
  21. * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
  22. * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
  23. * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
  24. * WARRANTY OF NONINFRINGEMENT.
  25. * HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
  26. * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
  27. * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
  28. * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
  29. * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
  30. * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
  31. * SAVINGS OR PROFITS,
  32. * EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  33. * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
  34. * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
  35. * FROM, THE SOFTWARE.
  36. *
  37. * This software may be replicated in part or whole for the licensed use,
  38. * with the restriction that this Disclaimer and Copyright notice must be
  39. * included with each copy of this software, whether used in part or whole,
  40. * at all times.
  41. */
  42. /******************************************************************************/
  43. /** \file reset.h
  44. **
  45. ** Headerfile for reset functions
  46. **
  47. **
  48. ** History:
  49. ** - 2018-04-21 Lux First Version
  50. **
  51. ******************************************************************************/
  52. #ifndef __RESET_H__
  53. #define __RESET_H__
  54. /******************************************************************************
  55. * Include files
  56. ******************************************************************************/
  57. #include "ddl.h"
  58. #ifdef __cplusplus
  59. extern "C"
  60. {
  61. #endif
  62. /**
  63. ******************************************************************************
  64. ** \defgroup ResetGroup Reset (RST)
  65. **
  66. ******************************************************************************/
  67. //@{
  68. /**
  69. *******************************************************************************
  70. ** function prototypes.
  71. ******************************************************************************/
  72. /*******************************************************************************
  73. * Global definitions
  74. ******************************************************************************/
  75. /**
  76. *******************************************************************************
  77. ** \brief 外设复位控制类型定义
  78. ** \note
  79. ******************************************************************************/
  80. typedef enum en_sysctrl_peripheral0
  81. {
  82. ResetMskUart0 = 1u<<0u, ///< 串口0
  83. ResetMskUart1 = 1u<<1u, ///< 串口1
  84. ResetMskLpUart0 = 1u<<2u, ///< 低功耗串口0
  85. ResetMskLpUart1 = 1u<<3u, ///< 低功耗串口1
  86. ResetMskI2c0 = 1u<<4u, ///< I2C0
  87. ResetMskI2c1 = 1u<<5u, ///< I2C1
  88. ResetMskSpi0 = 1u<<6u, ///< SPI0
  89. ResetMskSpi1 = 1u<<7u, ///< SPI1
  90. ResetMskBaseTim = 1u<<8u, ///< 基础定时器TIM0/1/2
  91. ResetMskLpTim0 = 1u<<9u, ///< 低功耗定时器0
  92. ResetMskAdvTim = 1u<<10u, ///< 高级定时器TIM4/5/6
  93. ResetMskTim3 = 1u<<11u, ///< 定时器3
  94. ResetMskOpa = 1u<<13u, ///< OPA
  95. ResetMskPca = 1u<<14u, ///< 可编程计数阵列
  96. ResetMskAdcBgr = 1u<<16u, ///< ADC&BGR
  97. ResetMskVcLvd = 1u<<17u, ///< VC和LVD
  98. ResetMskRng = 1u<<18u, ///< RNG
  99. ResetMskPcnt = 1u<<19u, ///< PCNT
  100. ResetMskRtc = 1u<<20u, ///< RTC
  101. ResetMskTrim = 1u<<21u, ///< 时钟校准
  102. ResetMskLcd = 1u<<22u, ///< LCD
  103. ResetMskTick = 1u<<24u, ///< 系统定时器
  104. ResetMskSwd = 1u<<25u, ///< SWD
  105. ResetMskCrc = 1u<<26u, ///< CRC
  106. ResetMskAes = 1u<<27u, ///< AES
  107. ResetMskGpio = 1u<<28u, ///< GPIO
  108. ResetMskDma = 1u<<29u, ///< DMA
  109. }en_reset_peripheral0_t;
  110. typedef enum en_sysctrl_peripheral1
  111. {
  112. ResetMskDac = 1u<<3u, ///< DAC
  113. ResetMskLpTim1 = 1u<<4u, ///< 低功耗定时器1
  114. ResetMskUart2 = 1u<<8u, ///< UART2
  115. ResetMskUart3 = 1u<<9u, ///< UART3
  116. }en_reset_peripheral1_t;
  117. /**
  118. *******************************************************************************
  119. ** \brief 复位源(标识)显示
  120. **
  121. ** \note
  122. ******************************************************************************/
  123. typedef enum en_reset_flag
  124. {
  125. ResetFlagMskPor5V = 1u<<0u, ///< 5V启动复位
  126. ResetFlagMskPor1_5V = 1u<<1u, ///< 1.5V启动复位
  127. ResetFlagMskLvd = 1u<<2u, ///< 低电压检测复位
  128. ResetFlagMskWdt = 1u<<3u, ///< 看门狗复位
  129. ResetFlagMskPca = 1u<<4u, ///< PCA复位
  130. ResetFlagMskLockup = 1u<<5u, ///< 系统异常复位
  131. ResetFlagMskSysreq = 1u<<6u, ///< 软件复位
  132. ResetFlagMskRstb = 1u<<7u, ///< RESET脚 复位
  133. }en_reset_flag_t;
  134. /*******************************************************************************
  135. * Global variable declarations ('extern', definition in C source)
  136. ******************************************************************************/
  137. /*******************************************************************************
  138. * Global function prototypes (definition in C source)
  139. ******************************************************************************/
  140. ///< 获得复位源状态
  141. boolean_t Reset_GetFlag(en_reset_flag_t enRstFlg);
  142. ///< 清除复位源状态
  143. void Reset_ClearFlag(en_reset_flag_t enRstFlg);
  144. void Reset_ClearFlagAll(void);
  145. ///< 外设模块复位
  146. void Reset_RstPeripheralAll(void);
  147. void Reset_RstPeripheral0(en_reset_peripheral0_t enPeri);
  148. void Reset_RstPeripheral1(en_reset_peripheral1_t enPeri);
  149. //@} // ResetGroup
  150. #ifdef __cplusplus
  151. #endif
  152. #endif /* __RESET_H__ */
  153. /*******************************************************************************
  154. * EOF (not truncated)
  155. ******************************************************************************/