reset.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. #include "interrupts_hc32l136.h"
  59. #ifdef __cplusplus
  60. extern "C"
  61. {
  62. #endif
  63. /**
  64. ******************************************************************************
  65. ** \defgroup ResetGroup Reset (RST)
  66. **
  67. ******************************************************************************/
  68. //@{
  69. /**
  70. *******************************************************************************
  71. ** function prototypes.
  72. ******************************************************************************/
  73. /*******************************************************************************
  74. * Global definitions
  75. ******************************************************************************/
  76. /**
  77. *******************************************************************************
  78. ** \brief 外设复位控制类型定义
  79. ** \note
  80. ******************************************************************************/
  81. typedef enum
  82. {
  83. ResetUart0 = 0x00000001u, ///< 串口0
  84. ResetUart1 = 0x00000002u, ///< 串口1
  85. ResetLpUart0 = 0x00000004u, ///< 低功耗串口0
  86. ResetLpUart1 = 0x00000008u, ///< 低功耗串口1
  87. ResetI2c0 = 0x00000010u, ///< I2C0
  88. ResetI2c1 = 0x00000020u, ///< I2C1
  89. ResetSpi0 = 0x00000040u, ///< SPI0
  90. ResetSpi1 = 0x00000080u, ///< SPI1
  91. ResetBaseTim = 0x00000100u, ///< BASETIM
  92. ResetLpTim = 0x00000200u, ///< LPTIM
  93. ResetAdvTim = 0x00000400u, ///< ADVTIM
  94. ResetTim3 = 0x00000800u, ///< TIM3
  95. ResetOpa = 0x00002000u, ///< OPA
  96. ResetPca = 0x00004000u, ///< PCA
  97. ResetAdc = 0x00010000u, ///< ADC
  98. ResetVc = 0x00020000u, ///< VC
  99. ResetRng = 0x00040000u, ///< RNG
  100. ResetPcnt = 0x00080000u, ///< PCNT
  101. ResetRtc = 0x00100000u, ///< RTC
  102. ResetTrim = 0x00200000u, ///< TRIM
  103. ResetLcd = 0x00400000u, ///< LCD
  104. ResetTick = 0x01000000u, ///< TICK
  105. ResetSwd = 0x02000000u, ///< SWD
  106. ResetCrc = 0x04000000u, ///< CRC
  107. ResetAes = 0x08000000u, ///< AES
  108. ResetGpio = 0x10000000u, ///< GPIO
  109. ResetDma = 0x20000000u, ///< DMA
  110. ResetDiv = 0x40000000u, ///< DIV
  111. }en_reset_peripheral_t;
  112. /**
  113. *******************************************************************************
  114. ** \brief 复位源(标识)显示
  115. **
  116. ** \note
  117. ******************************************************************************/
  118. typedef struct
  119. {
  120. uint8_t u8Por5V :1; ///< 5V启动复位
  121. uint8_t u8Por1_5V :1; ///< 1.5V启动复位
  122. uint8_t u8Lvd :1; ///< 低电压检测复位
  123. uint8_t u8Wdt :1; ///< 看门狗复位
  124. uint8_t u8Pca :1; ///< PCA复位
  125. uint8_t u8Lockup :1; ///< 系统异常复位
  126. uint8_t u8Sysreq :1; ///< 软件复位
  127. uint8_t u8RSTB :1; ///< RESET脚 复位
  128. }stc_reset_cause_t;
  129. /*******************************************************************************
  130. * Global variable declarations ('extern', definition in C source)
  131. ******************************************************************************/
  132. /*******************************************************************************
  133. * Global function prototypes (definition in C source)
  134. ******************************************************************************/
  135. ///< 获得复位源
  136. en_result_t Reset_GetCause(stc_reset_cause_t *pstcOut);
  137. ///< 清除复位源
  138. en_result_t Reset_Clear(stc_reset_cause_t stcval);
  139. ///< 外设模块复位控制
  140. en_result_t Reset_SetPeripheralReset(en_reset_peripheral_t enPeri,boolean_t bFlag);
  141. //@} // ResetGroup
  142. #ifdef __cplusplus
  143. #endif
  144. #endif /* __RESET_H__ */
  145. /*******************************************************************************
  146. * EOF (not truncated)
  147. ******************************************************************************/