1 #ifndef __BTBL_H__
2 #define __BTBL_H__
3 /*******************************************************************************
4 * FILE PURPOSE: Defines API and public data definitions for the Boot table (BTBL)
5 *******************************************************************************
6 * FILE NAME: BTBL.h
7 *
8 * DESCRIPTION: Defines API and public data definitions for boot table
9 * processing (BTBL) module
10 *
11 * (C) Copyright 2004, TELOGY Networks, Inc.
12 ******************************************************************************/
14 /* System level header files */
15 #include "types.h"
17 #if 0
18 #include "device.h"
19 #endif
21 /* BTBL error codes */
22 enum {
23 BTBL_NOERR = 0,
24 BTBL_ERR_GEN = 1,
25 BTBL_ERR_INVALID_STATE = 2,
26 BTBL_ERR_INVALID_SECTION_ADDR = 3,
27 BTBL_ERR_INVALID_START_VECTOR = 4
28 };
30 /*
31 * We need to reserve some space in the front of the buffer used to store
32 * the partial content of the boot table since the data may be shifted to
33 * achieve the 32-bit data alignment for PDMA transfer during the boot table
34 * processing
35 */
36 #define BOOT_TBL_RESERVED_HEADER_SIZE CHIP_BTBL_RSVD_SIZE_UINT16 /* in terms of 16-bit word */
39 /*******************************************************************************
40 * Data Definition : BOOT_TBL_T
41 *******************************************************************************
42 * DESCRIPTION :
43 * This is an instance of a boot table procssing control block.
44 * It defines all the variables used during the boot table processing
45 ******************************************************************************/
46 typedef struct boot_tbl_cb_s
47 {
48 UINT16 state; /* Boot table prossing state */
49 BOOL f_wait_lsw; /* TRUE: waiting for the least significant
50 16-bit word of the control
51 word such as I/O register
52 configuration, code section
53 byte count and etc. */
54 UINT32 code_start_addr; /* record the entry point byte addr */
55 UINT32 num_io_regs; /* number of the remaining IO registers
56 needed to be initialized */
57 UINT16 io_addr; /* Record the address of the IO register
58 to be processed */
59 UINT16 core_start_vector; /* Record the core start vector */
60 /*
61 * Record the size and address of the remaining portion of the code section
62 * to be programmed
63 */
64 UINT32 section_size_bytes; /* In bytes */
65 UINT32 section_addr; /* 32-bit byte address */
66 UINT16 last_word; /* Record the last UINT16 word in the
67 previous code section */
70 UINT16* p_data; /* Point to the UINT16 data to be
71 processed */
72 UINT32 data_size_uint16; /* the size of the remaing 16-bit
73 data needs to be processed */
74 } BOOT_TBL_CB_T;
77 /*******************************************************************************
78 * Public function prototypes
79 ******************************************************************************/
80 /*******************************************************************************
81 * FUNCTION PURPOSE: Initialize the boot table control instance
82 *******************************************************************************
83 * DESCRIPTION: Allocate and initializea boot table control instance
84 *
85 * void boot_init_boot_tbl_inst (
86 * void **p_inst) - A pointer to Boot Table Control instance
87 *
88 *****************************************************************************/
89 void boot_init_boot_tbl_inst(BOOT_TBL_CB_T *inst);
91 /*******************************************************************************
92 * FUNCTION PURPOSE: Process the boot table
93 *******************************************************************************
94 * DESCRIPTION: Process the whole or partial boot table received by going
95 * through the boot table processing state machine until all
96 * the UINT16 words are processed or the end of table condition
97 * (section size == 0) is satisfied.
98 *
99 * void boot_proc_boot_tbl (
100 * UINT16 *p_data, - 16-bit boot table content to be processed
101 * UINT32 size) - number of 16-bit words
102 *
103 *
104 * Note: It is up to the caller to reserve 4 16-bit word space in front of the
105 * input buffer since the data may be moved to achieve 32-bit alignment
106 * requirement for PDMA transfer
107 *****************************************************************************/
108 void boot_proc_boot_tbl(BOOT_TBL_CB_T *inst, UINT16* p_data, UINT32 size);
110 /* Generic block boot table information for non-secure boot over a master periheral.
111 * The data section of the block contains boot table data */
112 typedef struct bootTableBlock_s
113 {
114 UINT32 blockLenBytes;
115 UINT32 data;
117 } bootTableBlock_t;
120 #endif /* __BTBL_H__ */
122 /* Nothing past this point */