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