Files
kunlun/export/inc/bsp/iot_system_api.h
2024-09-28 14:24:04 +08:00

102 lines
3.7 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef IOT_SYSTEM_API_H
#define IOT_SYSTEM_API_H
#ifdef __cplusplus
extern "C" {
#endif
/* SYSTEM_RESET_SOFT category detail reason definition */
/* invalid system soft reset reason */
#define IOT_SYS_RST_REASON_INVALID 0
/* restart due to upgrade */
#define IOT_SYS_RST_REASON_UPGRADE 1
/* restart due to power down and up again */
#define IOT_SYS_RST_REASON_POWER_UP_AGAIN 2
/* restart due to concentrator request */
#define IOT_SYS_RST_REASON_CCTT_REQ 3
/* restart due to infrared radio protocol request */
#define IOT_SYS_RST_REASON_IR_REQ 4
/* restart due to app request */
#define IOT_SYS_RST_REASON_APP_REQ 5
/* restart due to collector II request */
#define IOT_SYS_RST_REASON_CT2_REQ 6
/* restart due to mac tx hang */
#define IOT_SYS_RST_REASON_MAC_TX_HANG 7
/* restart due to collector I request */
#define IOT_SYS_RST_REASON_CT1_REQ 8
/* restart due to power meter request */
#define IOT_SYS_RST_REASON_PM_REQ 9
/* restart due to enter FTM_MODE reason */
#define IOT_SYS_RST_REASON_FTM 10
/* restart due to watchdog dog reason */
#define IOT_SYS_RST_REASON_WDG 14
/* restart due to unkown reason */
#define IOT_SYS_RST_REASON_UNKNOWN 0xF
/**
* @brief Restart SP and AP CPUs This function can be called both from SP and
* AP CPUs. After successful restart, CHIP will boot from ROM.
* @param reason: software restart reason. see IOT_SYS_RST_REASON_XXX
*/
void iot_system_restart(uint8_t reason);
/* fastboot scratch set enable */
#define IOT_FASTBOOT_SCRATCH_ENABLE 0x1
/* fastboot scratch set disable */
#define IOT_FASTBOOT_SCRATCH_DISABLE 0x0
/**
* @brief iot_fastboot_scratch_set() - Set fast boot.
* Bootup process will fast 2 seconds. 1 sec in rom, another 1 sec in sbl.
* Note, once enable, only software set 0 can disable.or, cut off power.
* @param en the fast boot state
* @return
* @return ERR_OK -- Execute successfully
* @return ERR_FAIL -- On failure
*/
uint8_t iot_fastboot_scratch_set(uint8_t en);
/**
* @brief iot_fastboot_scratch_get() - get fast boot state
* @param st Stores the obtained fast boot state
* @return
* @return ERR_OK -- Execute successfully
* @return ERR_FAIL -- On failure
*/
uint8_t iot_fastboot_scratch_get(uint8_t *st);
/**
* @brief iot_data_addr_legal() - Whether the address is legal or not
* @param addr the input address
* @return
* @return true -- the input address is legal
* @return false -- the input address is illegal
*/
bool_t iot_data_addr_legal(uint32_t addr);
/**
* @brief iot_switch_boot_part() - switch boot part
*/
void iot_switch_boot_part(void);
#ifdef __cplusplus
}
#endif
#endif //IOT_SYSTEM_API_H