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 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 en_sysctrl_peripheral0 90 { 91 ResetMskUart0 = 1u<<0u, ///< 串口0 92 ResetMskUart1 = 1u<<1u, ///< 串口1 93 ResetMskLpUart0 = 1u<<2u, ///< 低功耗串口0 94 ResetMskLpUart1 = 1u<<3u, ///< 低功耗串口1 95 ResetMskI2c0 = 1u<<4u, ///< I2C0 96 ResetMskI2c1 = 1u<<5u, ///< I2C1 97 ResetMskSpi0 = 1u<<6u, ///< SPI0 98 ResetMskSpi1 = 1u<<7u, ///< SPI1 99 ResetMskBaseTim = 1u<<8u, ///< 基础定时器TIM0/1/2 100 ResetMskLpTim0 = 1u<<9u, ///< 低功耗定时器0 101 ResetMskAdvTim = 1u<<10u, ///< 高级定时器TIM4/5/6 102 ResetMskTim3 = 1u<<11u, ///< 定时器3 103 ResetMskOpa = 1u<<13u, ///< OPA 104 ResetMskPca = 1u<<14u, ///< 可编程计数阵列 105 ResetMskAdcBgr = 1u<<16u, ///< ADC&BGR 106 ResetMskVcLvd = 1u<<17u, ///< VC和LVD 107 ResetMskRng = 1u<<18u, ///< RNG 108 ResetMskPcnt = 1u<<19u, ///< PCNT 109 ResetMskRtc = 1u<<20u, ///< RTC 110 ResetMskTrim = 1u<<21u, ///< 时钟校准 111 ResetMskLcd = 1u<<22u, ///< LCD 112 ResetMskTick = 1u<<24u, ///< 系统定时器 113 ResetMskSwd = 1u<<25u, ///< SWD 114 ResetMskCrc = 1u<<26u, ///< CRC 115 ResetMskAes = 1u<<27u, ///< AES 116 ResetMskGpio = 1u<<28u, ///< GPIO 117 ResetMskDma = 1u<<29u, ///< DMA 118 }en_reset_peripheral0_t; 119 120 typedef enum en_sysctrl_peripheral1 121 { 122 ResetMskDac = 1u<<3u, ///< DAC 123 ResetMskLpTim1 = 1u<<4u, ///< 低功耗定时器1 124 ResetMskUart2 = 1u<<8u, ///< UART2 125 ResetMskUart3 = 1u<<9u, ///< UART3 126 }en_reset_peripheral1_t; 127 128 /** 129 ******************************************************************************* 130 ** \brief 复位源(标识)显示 131 ** 132 ** \note 133 ******************************************************************************/ 134 typedef enum en_reset_flag 135 { 136 ResetFlagMskPor5V = 1u<<0u, ///< 5V启动复位 137 ResetFlagMskPor1_5V = 1u<<1u, ///< 1.5V启动复位 138 ResetFlagMskLvd = 1u<<2u, ///< 低电压检测复位 139 ResetFlagMskWdt = 1u<<3u, ///< 看门狗复位 140 ResetFlagMskPca = 1u<<4u, ///< PCA复位 141 ResetFlagMskLockup = 1u<<5u, ///< 系统异常复位 142 ResetFlagMskSysreq = 1u<<6u, ///< 软件复位 143 ResetFlagMskRstb = 1u<<7u, ///< RESET脚 复位 144 }en_reset_flag_t; 145 146 /******************************************************************************* 147 * Global variable declarations ('extern', definition in C source) 148 ******************************************************************************/ 149 150 /******************************************************************************* 151 * Global function prototypes (definition in C source) 152 ******************************************************************************/ 153 ///< 获得复位源状态 154 boolean_t Reset_GetFlag(en_reset_flag_t enRstFlg); 155 ///< 清除复位源状态 156 void Reset_ClearFlag(en_reset_flag_t enRstFlg); 157 void Reset_ClearFlagAll(void); 158 159 ///< 外设模块复位 160 void Reset_RstPeripheralAll(void); 161 void Reset_RstPeripheral0(en_reset_peripheral0_t enPeri); 162 void Reset_RstPeripheral1(en_reset_peripheral1_t enPeri); 163 164 //@} // ResetGroup 165 166 #ifdef __cplusplus 167 #endif 168 169 170 #endif /* __RESET_H__ */ 171 /******************************************************************************* 172 * EOF (not truncated) 173 ******************************************************************************/ 174 175 176