110 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			110 lines
		
	
	
		
			3.1 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 _SYSTEM_H
 | ||
|  | #define _SYSTEM_H
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | typedef struct { | ||
|  |     int fw_mode;      /* fw mode select */ | ||
|  |     int print_ena;    /* enable iot_printf */ | ||
|  |     int flash_size;   /* virtual flash size */ | ||
|  |     int run_in_psram; /* fw run in psram or not */ | ||
|  | } sbl_param_input_t; | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_get_mac_addr: get internal mac address information. | ||
|  |  * @param mac: pointer of mac address buffer. | ||
|  |  * @return 0: succeed, 0xffffffff: failed. | ||
|  |  */ | ||
|  | uint32_t system_get_mac_addr(uint8_t *mac); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_get_chip_info: get internal chip id information. | ||
|  |  * @return chip id. | ||
|  |  */ | ||
|  | uint32_t system_get_chip_info(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_get_chip_subid_info: get internal chip sub id information. | ||
|  |  * @return sub id. | ||
|  |  */ | ||
|  | uint32_t system_get_chip_subid_info(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_get_chip_efuse_check_status: | ||
|  |  *      get internal chip efuse check status. | ||
|  |  * @return chip efuse check status. | ||
|  |  *  0x00: check succeed; other: the corresponding item fails to be verified. | ||
|  |  *      bit 0: chip id check result; | ||
|  |  *      bit 1: mac address check result; | ||
|  |  *      bit 2: ate calibration check result; | ||
|  |  *      bit 3: sadc meter check result. | ||
|  |  */ | ||
|  | uint8_t system_get_chip_efuse_check_status(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_check_lic: check license status | ||
|  |  * @return 1->internal pa, 0->external pa. | ||
|  |  */ | ||
|  | uint8_t system_check_lic(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_set_restart_reason: set restart reason. | ||
|  |  * @param reason: restart reason. | ||
|  |  * @return none. | ||
|  |  */ | ||
|  | void system_set_restart_reason(uint8_t reason); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief scratch_p_set_fast_boot: set fast boot. | ||
|  |  * @param en: set enable or disable. | ||
|  |  * @return none. | ||
|  |  */ | ||
|  | void scratch_p_set_fast_boot(bool_t en); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief scratch_p_get_fast_boot: get fast boot stat. | ||
|  |  * @return true->fast boot enable; false->fast boot disable. | ||
|  |  */ | ||
|  | bool_t scratch_p_get_fast_boot(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_get_fw_boot_param - get firmware boot parameter. | ||
|  |  * @param ptr: pointer of parameter that sbl load firmware. | ||
|  |  * @return none. | ||
|  |  */ | ||
|  | void system_get_fw_boot_param(sbl_param_input_t *ptr); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_restart_chip_by_soft - restart chip by software. | ||
|  |  * @return none. | ||
|  |  */ | ||
|  | void system_restart_chip_by_soft(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief system_get_rst_flag_reg - get rest flag in register set by hardware. | ||
|  |  * @return reset flag. | ||
|  |  */ | ||
|  | uint32_t system_get_rst_flag_reg(); | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif //_SYSTEM_H
 |