86 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			86 lines
		
	
	
		
			2.8 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 __COMMON_H
							 | 
						||
| 
								 | 
							
								#define __COMMON_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CMD_BOOT_DELAY "Press any key to stop AutoBoot \r\n"
							 | 
						||
| 
								 | 
							
								#define CMD_PROMPT "kunlun v1.0 > "
							 | 
						||
| 
								 | 
							
								#define CMD_BOOT_TIME "Timeout: "
							 | 
						||
| 
								 | 
							
								#define CMD_MAXARGS   5
							 | 
						||
| 
								 | 
							
								#define CMD_CBSIZE 80
							 | 
						||
| 
								 | 
							
								#define PARAM_MAXARGS 2
							 | 
						||
| 
								 | 
							
								#define PARAM_BOOT_CNT 5
							 | 
						||
| 
								 | 
							
								#define PARAM_NAME_LEN_MAX  11
							 | 
						||
| 
								 | 
							
								#define PARAM_VAL_LEN_MAX   19
							 | 
						||
| 
								 | 
							
								#define PARAM_END_CHAR      0x0A
							 | 
						||
| 
								 | 
							
								#define PARAM_EQUAL_CHAR    0x3D
							 | 
						||
| 
								 | 
							
								#define PARAM_MAX_LENGTH    0x20
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define SBL_DEBUG_CMD_ENABLE    (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CMD_DELAY_TIME_CHAR     '1'
							 | 
						||
| 
								 | 
							
								#define CMD_DELAY_TIME_INT      1
							 | 
						||
| 
								 | 
							
								#define CMD_DELAY_TIME_COUNT    (1 * 1000000) /* 1 * gptiemr0 clk */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define REG32(a)        (*((volatile uint32_t *)(a)))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct cmd_tbl_s {
							 | 
						||
| 
								 | 
							
								    char *name;     /* command name */
							 | 
						||
| 
								 | 
							
								    int minargs;    /* minimum number of arguments */
							 | 
						||
| 
								 | 
							
								    int maxargs;    /* maximum number of arguments */
							 | 
						||
| 
								 | 
							
								    int (*cmd)(struct cmd_tbl_s *, int, int, char *[]);
							 | 
						||
| 
								 | 
							
								    char *desc;     /* command description */
							 | 
						||
| 
								 | 
							
								    char *usage;    /* usage message (short) */
							 | 
						||
| 
								 | 
							
								} cmd_tbl_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct {
							 | 
						||
| 
								 | 
							
								    char name[PARAM_NAME_LEN_MAX];
							 | 
						||
| 
								 | 
							
								    char equal;
							 | 
						||
| 
								 | 
							
								    char value[PARAM_VAL_LEN_MAX];
							 | 
						||
| 
								 | 
							
								    char end;
							 | 
						||
| 
								 | 
							
								} sbl_param_cmd_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* stdin stdout */
							 | 
						||
| 
								 | 
							
								#if SBL_DEBUG_CMD_ENABLE
							 | 
						||
| 
								 | 
							
								int do_get(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_rm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_go_at_adr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int do_mem_print(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_set(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_saveenv(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_print(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_help(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int sbl_param_load();
							 | 
						||
| 
								 | 
							
								void sbl_main_loop(void);
							 | 
						||
| 
								 | 
							
								void sbl_get_start_part(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int sbl_info_print(void);
							 | 
						||
| 
								 | 
							
								void sbl_fw_uncp_success(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* __COMMON_H */
							 | 
						||
| 
								 | 
							
								
							 |