1 #ifndef _HAL_8710B_BOOT_
2 #define _HAL_8710B_BOOT_
3 
4 #if defined ( __ICCARM__ )
5 extern u8* __image2_entry_func__;
6 extern u8* __image1_bss_start__;
7 extern u8* __image1_bss_end__;
8 
9 extern u8* __bss_start__;
10 extern u8* __bss_end__;
11 
12 extern u8* __cmd_table_start__;
13 extern u8* __cmd_table_end__;
14 extern u8* __psram_bss_start__;
15 extern u8* __psram_bss_end__;
16 extern u8* __ram_nocache_start__;
17 extern u8* __ram_nocache_end__;
18 extern u8* __image3_bss_start__;
19 extern u8* __image3_bss_end__;
20 #else
21 extern u8 __image1_validate_code__[];
22 extern u8 __image1_bss_start__[];
23 extern u8 __image1_bss_end__[];
24 
25 extern u8 __image2_entry_func__[];
26 extern u8 __bss_start__[];
27 extern u8 __bss_end__[];
28 
29 extern u8 __cmd_table_start__[];
30 extern u8 __cmd_table_end__[];
31 extern u8 __psram_bss_start__[];
32 extern u8 __psram_bss_end__[];
33 extern u8 __ram_nocache_start__[];
34 extern u8 __ram_nocache_end__[];
35 extern u8 __image3_bss_start__[];
36 extern u8 __image3_bss_end__[];
37 #endif
38 extern u8 __rom_bss_start__[];
39 extern u8 __rom_bss_end__[];
40 extern u8 __rom_bss_start_s__[];
41 extern u8 __rom_bss_end_s__[];
42 extern u8 __rom_bss_start_ns__[];
43 extern u8 __rom_bss_end_ns__[];
44 extern u8 __ram_image3_start__[];
45 extern u8 __ram_image3_end__[];
46 
47 extern u8 __flash_text_start__[];
48 extern u8 __flash_img2_end__[];
49 extern u8 __flash_sec_text_start__[];
50 extern u8 __ram_start_table_start__[];
51 extern u8 __rom_top_4k_start_[];
52 
53 extern u8  __rom_entry_ns_start__[];
54 
55 extern u8 __retention_entry_func__[];
56 
57 enum _BOOT_TYPE_ {
58 	BOOT_FROM_FLASH = 0,
59 	BOOT_FROM_SDIO  = 1,
60 	BOOT_FROM_USB   = 2,
61 	BOOT_FROM_UART0   = 3,
62 	BOOT_FROM_UART1   = 4,
63 	BOOT_FROM_SPI   = 5,
64 	BOOT_FROM_RSVD  = 6,
65 };
66 
67 typedef struct {
68 	u32 boot_ram_end;
69 } BOOT_EXPORT_SYMB_TABLE;
70 
71 /* security boot */
72 typedef struct {
73 	int (*ed25519_verify_signature)(const unsigned char sig[],
74 		const unsigned char *m, unsigned long long mlen,
75 		const unsigned char pk[]);
76 	void (*clear_ns_rom_bss)(void);
77 } ROM_SECURE_CALL_NS_ENTRY;
78 
79 enum _CPU_PWRSEQ_ {
80 	CPU_PWRSEQ_CMD_READ = 0xFFFFFF00,
81 	CPU_PWRSEQ_CMD_WRITE  = 0xFFFFFF01,
82 	CPU_PWRSEQ_CMD_POLLING   = 0xFFFFFF02,
83 	CPU_PWRSEQ_CMD_DELAY   = 0xFFFFFF03,
84 	CPU_PWRSEQ_CMD_LOGE   = 0xFFFFFF08,
85 	CPU_PWRSEQ_CMD_END   = 0xFFFFFFFF,
86 };
87 
88 typedef struct {
89 	u32 address;
90 	u32 cmd; /* read/write/polling/delay/end */
91 	u32 bitsc; /* bit mask clear or polling target */
92 	u32 bitss; /* bit mask set or polling mask */
93 } CPU_PWR_SEQ;
94 
95 typedef enum {
96 	IMG_LS_BOOT = 0,
97 	IMG_BACKUP = 1,
98 	IMG_SYSDATA =  2,
99 	IMG_HS_BOOT = 3,
100 	IMG_LS_IMG2_OTA1 = 4,
101 	IMG_HS_IMG_COMB_OTA1 = 5,
102 	IMG_LS_IMG2_OTA2 = 6,
103 	IMG_HS_IMG_COMB_OTA2 = 7,
104 } Image_Type;
105 
106 typedef struct {
107 	u32 VAddrStart;
108 	u32 VAddrEnd;
109 	u32 PAddrStart;
110 	u32 PAddrEnd;
111 } MMU_ConfDef;
112 
113 #define OTA_INDEX_1			0
114 #define OTA_INDEX_2			1
115 
116 typedef struct {
117 	u32 MaskAddr; /*start address for RSIP Mask, should be 4KB aligned*/
118 	u16 MaskSize; /*size of the mask area, unit is 4KB */
119 } RSIP_MaskDef;
120 
121 typedef u8 (*FuncPtr)(void);
122 
123 extern void vPortSVCHandler( void );
124 //extern void xPortPendSVHandler( void );
125 extern void xPortSysTickHandler( void );
126 #if defined (__ICCARM__)
127 extern void xPortPendSVHandler( void );
128 #elif defined (__GNUC__)
129 extern void xPortPendSVHandler( void ) __attribute__ (( naked ));
130 #endif
131 
132 extern u32 BOOT_ROM_CM4PON(u32 pwr_cmd_addr);
133 extern void BOOT_FLASH_Image1(void);
134 extern void BOOT_FLASH_WakeFromPG(void);
135 extern void BOOT_RAM_FuncEnable(void);
136 extern u32 BOOT_RAM_FLASH_Calibration(u8 read_mode);
137 extern PRAM_START_FUNCTION BOOT_RAM_SectionInit(void);
138 
139 extern u32 ROM_SIM_ENABLE;
140 extern u32 IS_FPGA_VERIF; /* set in boot flash, based on MACRO, can not be used in ROM code */
141 extern RAM_START_FUNCTION Img2EntryFun0; //RamWakeupFun
142 #endif   //_HAL_8710B_BOOT_
143