/** ******************************************************************************* * @file hc32_ll_rmu.h * @brief This file contains all the functions prototypes of the RMU driver * library. @verbatim Change Logs: Date Author Notes 2022-12-31 CDT First version @endverbatim ******************************************************************************* * Copyright (C) 2022, Xiaohua Semiconductor Co., Ltd. All rights reserved. * * This software component is licensed by XHSC under BSD 3-Clause license * (the "License"); You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ******************************************************************************* */ #ifndef __HC32_LL_RMU_H__ #define __HC32_LL_RMU_H__ /* C binding of definitions if building with C++ compiler */ #ifdef __cplusplus extern "C" { #endif /******************************************************************************* * Include files ******************************************************************************/ #include "hc32_ll_def.h" #include "hc32f4xx.h" #include "hc32f4xx_conf.h" /** * @addtogroup LL_Driver * @{ */ /** * @addtogroup LL_RMU * @{ */ #if (LL_RMU_ENABLE == DDL_ON) /******************************************************************************* * Global type definitions ('typedef') ******************************************************************************/ /******************************************************************************* * Global pre-processor symbols/macros ('#define') ******************************************************************************/ /** * @defgroup RMU_Global_Macros RMU Global Macros * @{ */ /** * @defgroup RMU_ResetCause Rmu reset cause * @{ */ #define RMU_FLAG_PWR_ON (RMU_RSTF0_PORF) /*!< Power on reset */ #define RMU_FLAG_PIN (RMU_RSTF0_PINRF) /*!< Reset pin reset */ #define RMU_FLAG_BROWN_OUT (RMU_RSTF0_BORF) /*!< Brown-out reset */ #define RMU_FLAG_PVD1 (RMU_RSTF0_PVD1RF) /*!< Program voltage Detection 1 reset */ #define RMU_FLAG_PVD2 (RMU_RSTF0_PVD2RF) /*!< Program voltage Detection 2 reset */ #define RMU_FLAG_WDT (RMU_RSTF0_WDRF) /*!< Watchdog timer reset */ #define RMU_FLAG_SWDT (RMU_RSTF0_SWDRF) /*!< Special watchdog timer reset */ #define RMU_FLAG_PWR_DOWN (RMU_RSTF0_PDRF) /*!< Power down reset */ #define RMU_FLAG_SW (RMU_RSTF0_SWRF) /*!< Software reset */ #define RMU_FLAG_MPU_ERR (RMU_RSTF0_MPUERF) /*!< Mpu error reset */ #define RMU_FLAG_RAM_PARITY_ERR (RMU_RSTF0_RAPERF) /*!< Ram parity error reset */ #define RMU_FLAG_RAM_ECC (RMU_RSTF0_RAECRF) /*!< Ram ECC reset */ #define RMU_FLAG_CLK_ERR (RMU_RSTF0_CKFERF) /*!< Clk frequency error reset */ #define RMU_FLAG_XTAL_ERR (RMU_RSTF0_XTALERF) /*!< Xtal error reset */ #define RMU_FLAG_CPU_LOCKUP (RMU_RSTF0_LKUPRF) /*!< M4 Lockup reset */ #define RMU_FLAG_MX (RMU_RSTF0_MULTIRF) /*!< Multiply reset cause */ #define RMU_FLAG_ALL (RMU_FLAG_PWR_ON | RMU_FLAG_PIN | RMU_FLAG_BROWN_OUT | RMU_FLAG_PVD1 | \ RMU_FLAG_PVD2 | RMU_FLAG_WDT | RMU_FLAG_SWDT | RMU_FLAG_PWR_DOWN | \ RMU_FLAG_SW | RMU_FLAG_MPU_ERR | RMU_FLAG_RAM_PARITY_ERR | RMU_FLAG_RAM_ECC | \ RMU_FLAG_CLK_ERR | RMU_FLAG_XTAL_ERR | RMU_FLAG_CPU_LOCKUP | RMU_FLAG_MX) /** * @} */ /** * @defgroup RMU_ResetRegSel Rmu reset register * @{ */ #define RMU_FRST0 (0U) #define RMU_FRST1 (1U) #define RMU_FRST2 (2U) #define RMU_FRST3 (3U) /** * @} */ /** * @defgroup RMU_ResetModuleSel Rmu reset module * @{ */ #define RMU_FRST0_KEY_RST (RMU_FRST0_KEY) #define RMU_FRST0_DMA1_RST (RMU_FRST0_DMA1) #define RMU_FRST0_DMA2_RST (RMU_FRST0_DMA2) #define RMU_FRST0_FCM_RST (RMU_FRST0_FCM) #define RMU_FRST0_AOS_RST (RMU_FRST0_AOS) #define RMU_FRST0_CTC_RST (RMU_FRST0_CTC) #define RMU_FRST0_AES_RST (RMU_FRST0_AES) #define RMU_FRST0_HASH_RST (RMU_FRST0_HASH) #define RMU_FRST0_TRNG_RST (RMU_FRST0_TRNG) #define RMU_FRST0_CRC_RST (RMU_FRST0_CRC) #define RMU_FRST0_DCU1_RST (RMU_FRST0_DCU1) #define RMU_FRST0_DCU2_RST (RMU_FRST0_DCU2) #define RMU_FRST0_DCU3_RST (RMU_FRST0_DCU3) #define RMU_FRST0_DCU4_RST (RMU_FRST0_DCU4) #define RMU_FRST0_RST_ALL (0x0FF7E000UL) #define RMU_FRST1_QSPI_RST (RMU_FRST1_QSPI) #define RMU_FRST1_SPI1_RST (RMU_FRST1_SPI1) #define RMU_FRST1_SPI2_RST (RMU_FRST1_SPI2) #define RMU_FRST1_SPI3_RST (RMU_FRST1_SPI3) #define RMU_FRST1_RST_ALL (0x00070008UL) #define RMU_FRST2_TMR6_RST (RMU_FRST2_TIMER6) #define RMU_FRST2_TMR4_RST (RMU_FRST2_TIMER4) #define RMU_FRST2_TMR0_RST (RMU_FRST2_TIMER0) #define RMU_FRST2_EMB_RST (RMU_FRST2_EMB) #define RMU_FRST2_TMRA_RST (RMU_FRST2_TIMERA) #define RMU_FRST2_RST_ALL (0x00109401UL) #define RMU_FRST3_ADC1_RST (RMU_FRST3_ADC1) #define RMU_FRST3_ADC2_RST (RMU_FRST3_ADC2) #define RMU_FRST3_ADC3_RST (RMU_FRST3_ADC3) #define RMU_FRST3_DAC_RST (RMU_FRST3_DAC) #define RMU_FRST3_CMP1_2_RST (RMU_FRST3_CMP12) #define RMU_FRST3_CMP3_4_RST (RMU_FRST3_CMP34) #define RMU_FRST3_SMC_RST (RMU_FRST3_EXMC_SMC) #define RMU_FRST3_USART1_RST (RMU_FRST3_USART1) #define RMU_FRST3_USART2_RST (RMU_FRST3_USART2) #define RMU_FRST3_USART3_RST (RMU_FRST3_USART3) #define RMU_FRST3_USART4_RST (RMU_FRST3_USART4) #define RMU_FRST3_USART5_RST (RMU_FRST3_USART5) #define RMU_FRST3_USART6_RST (RMU_FRST3_USART6) #define RMU_FRST3_RST_ALL (0x03F10317UL) /** * @} */ /** * @} */ /******************************************************************************* * Global variable definitions ('extern') ******************************************************************************/ /******************************************************************************* Global function prototypes (definition in C source) ******************************************************************************/ /** * @addtogroup RMU_Global_Functions * @{ */ en_flag_status_t RMU_GetStatus(uint32_t u32RmuResetCause); void RMU_ClearStatus(void); void RMU_CPULockUpCmd(en_functional_state_t enNewState); void RMU_PeriphRstCmd(uint8_t u8RstReg, uint32_t u32RstModule, en_functional_state_t enNewState); /** * @} */ #endif /* LL_RMU_ENABLE */ /** * @} */ /** * @} */ #ifdef __cplusplus } #endif #endif /* __HC32_LL_RMU_H__ */ /******************************************************************************* * EOF (not truncated) ******************************************************************************/