112 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			112 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 SBL_BOOT_H
 | 
						|
#define SBL_BOOT_H
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_boot_hw_init(): hardware init.
 | 
						|
 * @return -1: failed;  0: succeed.
 | 
						|
 */
 | 
						|
uint32_t sbl_boot_hw_init(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_wdg_ena(): enable watchdog.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
void sbl_wdg_ena(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_wdg_disable(): disable watchdog.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
void sbl_wdg_disable(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_scratch_reg_set(): set scratch regsiter with watchdog reset flag.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
void sbl_scratch_reg_set(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_check_reset_by_wdg(): judge reset cause is watchdog or not.
 | 
						|
 * @return 1 -> is watchdog reset, 0 -> not 1.
 | 
						|
 */
 | 
						|
uint32_t sbl_check_reset_by_wdg(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_timer_run: start gp-timer.
 | 
						|
 * @param ms: timeout counter, unit is ms.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
void sbl_timer_run(int ms);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_timer_clr: clear gp-timer interrupt flag.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
void sbl_timer_clr(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_timer_cnt_done: get gp-timer cnt_done interrupt state.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
int sbl_timer_cnt_done(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_fastboot_flag_set: set(save) fastboot flag.
 | 
						|
 * @param fboot: fastboot flag.
 | 
						|
 * @return none.
 | 
						|
 */
 | 
						|
void sbl_fastboot_flag_set(uint32_t fboot);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_fastboot_flag_get: get fastboot flag.
 | 
						|
 * @return 1 -> is fast boot mode, 0 -> not 1.
 | 
						|
 */
 | 
						|
uint32_t sbl_fastboot_flag_get(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_load_next_firmware(): load custom app or plc app firmware.
 | 
						|
 * @param run_addr: pointer of run address.
 | 
						|
 * @param flash_size: flash size
 | 
						|
 * @param start_part: start part.
 | 
						|
 * @psram psram_eb: next firmware run in psram or not.
 | 
						|
 * @return 0: load firmware succeed, 1: load firmware failed.
 | 
						|
 */
 | 
						|
uint32_t sbl_load_next_firmware(uint32_t *run_addr,
 | 
						|
    uint32_t flash_size, uint32_t start_part, uint32_t psram_eb);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief sbl_jump_next_firmware(): jump to custom app or plc app firmware.
 | 
						|
 * @param run_addr: next firmware run address.
 | 
						|
 * @param mode: firmware run mode.
 | 
						|
 * @param print_eb: printf function enable or not.
 | 
						|
 * @param flash_size: flash size.
 | 
						|
 * @param psram_eb: next firmware run in psram or not.
 | 
						|
 * @return 0: jump to firmware succeed, 1: jump to firmware failed.
 | 
						|
 */
 | 
						|
uint32_t sbl_jump_next_firmware(uint32_t run_addr,
 | 
						|
    int mode, int print_eb, int flash_size, int psram_eb);
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif //SBL_BOOT_H
 |