/*
|
* Copyright (c) 2019-2023 Beijing Hanwei Innovation Technology Ltd. Co. and
|
* its subsidiaries and affiliates (collectly called MKSEMI).
|
*
|
* All rights reserved.
|
*
|
* Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
*
|
* 1. Redistributions of source code must retain the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
*
|
* 2. Redistributions in binary form, except as embedded into an MKSEMI
|
* integrated circuit in a product or a software update for such product,
|
* must reproduce the above copyright notice, this list of conditions and
|
* the following disclaimer in the documentation and/or other materials
|
* provided with the distribution.
|
*
|
* 3. Neither the name of MKSEMI nor the names of its contributors may be used
|
* to endorse or promote products derived from this software without
|
* specific prior written permission.
|
*
|
* 4. This software, with or without modification, must only be used with a
|
* MKSEMI integrated circuit.
|
*
|
* 5. Any software provided in binary form under this license must not be
|
* reverse engineered, decompiled, modified and/or disassembled.
|
*
|
* THIS SOFTWARE IS PROVIDED BY MKSEMI "AS IS" AND ANY EXPRESS OR IMPLIED
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* DISCLAIMED. IN NO EVENT SHALL MKSEMI OR CONTRIBUTORS BE LIABLE FOR ANY
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
*/
|
|
#ifndef MK_RESET_H_
|
#define MK_RESET_H_
|
#include "mk_common.h"
|
|
/**
|
* @addtogroup MK8000_Reset
|
* @{
|
*/
|
|
/** System reset causes */
|
enum RESET_CAUSE_T
|
{
|
RESET_CAUSE_NONE = 0,
|
RESET_CAUSE_POR = 1,
|
RESET_CAUSE_BOR = 2,
|
RESET_CAUSE_EXT_PIN = 3,
|
RESET_CAUSE_WDT = 4,
|
RESET_CAUSE_LOCKUP = 5,
|
RESET_CAUSE_SW_REBOOT = 6,
|
RESET_CAUSE_SYSREQ = 7,
|
RESET_CAUSE_WAKEUP = 8,
|
};
|
|
/** Modules can be reset independent */
|
enum RESET_MODULE_T
|
{
|
RESET_MODULE_GPIO = 1,
|
RESET_MODULE_SPI0 = 2,
|
RESET_MODULE_SPI1 = 3,
|
RESET_MODULE_LSP = 4,
|
RESET_MODULE_DMA = 5,
|
RESET_MODULE_MAC = 6,
|
RESET_MODULE_UART0 = 8,
|
RESET_MODULE_UART1 = 9,
|
RESET_MODULE_I2C = 10,
|
RESET_MODULE_EFUSE = 11,
|
RESET_MODULE_TIMER0 = 12,
|
RESET_MODULE_TIMER1 = 13,
|
RESET_MODULE_DUAL_TIMER = 14,
|
RESET_MODULE_WDT = 16,
|
RESET_MODULE_RTC = 17,
|
RESET_MODULE_PWM = 18,
|
RESET_MODULE_ADC = 19,
|
RESET_MODULE_TRNG = 20,
|
RESET_MODULE_FLASH_CTRL = 21,
|
RESET_MODULE_AES = 22,
|
RESET_MODULE_CALIB = 23,
|
RESET_MODULE_DPRX = 24,
|
RESET_MODULE_DPTX = 25,
|
RESET_MODULE_SYSREG = 26,
|
RESET_MODULE_REBOOT = 30,
|
RESET_MODULE_LOCKUP_EN = 31,
|
};
|
|
#ifdef __cplusplus
|
extern "C" {
|
#endif
|
|
/**
|
* @brief Get system reset cause.
|
* @return @ref RESET_CAUSE_T reset cause
|
*/
|
enum RESET_CAUSE_T reset_cause_get(void);
|
|
/**
|
* @brief Clear system reset cause.
|
*/
|
void reset_cause_clear(void);
|
|
/**
|
* @brief Reset a module.
|
* @param[in] id module ID @ref RESET_MODULE_T
|
*/
|
void reset_module(enum RESET_MODULE_T id);
|
|
#ifdef __cplusplus
|
}
|
#endif
|
|
/**
|
* @}
|
*/
|
|
#endif /* MK_RESET_H_ */
|