Files
kunlun/sbl/inc/sbl_boot.h

115 lines
3.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/****************************************************************************
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);
// kl1会操作一下tms引脚这个操作对kl2和kl3应该是无效的
void sbl_tms_interrupt_disable();
#ifdef __cplusplus
}
#endif
#endif //SBL_BOOT_H