1 /*
2 *
3 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
38 #ifndef BTBLWRAP_H
39 #define BTBLWRAP_H
40 /********************************************************************************
41 * FILE PURPOSE: Define the IBL wrapper for the TI boot table processor
42 ********************************************************************************
43 * FILE NAM:E btblwrap.h
44 *
45 * DESCRIPTION: Definitions required for the IBL wrapper of the TI boot table
46 * processor
47 *
48 ********************************************************************************/
50 /* chipStartCore does nothing, since multiple core start is not supported */
51 #define chipStartCore(x,y,z)
53 #include "iblloc.h"
55 /* A minimal boot stats structure */
56 typedef struct bootTblStats_s {
58 UINT32 num_sections;
59 UINT32 num_pdma_copies;
61 } bootTblStats_t;
64 typedef struct bootStats_s {
66 bootTblStats_t btbl;
68 } bootStats_t;
70 extern bootStats_t bootStats;
72 /****************************************************************************
73 * Definition: The c64x boot table tools will always pad boot table
74 * entries to 32 bit elements. The boot table works in 16 bit
75 * element sizes. If the size is not an even number of 16 bit
76 * elements, add one word of padding.
77 ****************************************************************************/
78 #define chipAddBtblUint16Pad(x) (((x)+1) & 0xfffffffe)
80 /* Return values */
81 #define CORE_NOERR 0
83 /* Module number */
84 #define BOOT_MODULE_ID_CHIP 0
85 #define BOOT_MODULE_ID_BTBL 1
87 /* Error code creation */
88 #define BOOT_ERROR_CODE(modnum,errnum) (((modnum) << 16) | (errnum))
90 /* Fatal error handling */
91 #define BOOT_EXCEPTION btblBootException
93 /* Macros */
94 #define CHIP_UINT16_TO_BYTES(x) ((x) << 1)
95 #define CHIP_BYTES_TO_UINT16(x) (((x) + 1) >> 1)
98 /* No interblock processing required */
99 #define chipBtblBlockDone()
101 /* No tracing dummy function */
102 #define chipDummy(x)
105 /* gem.c prototypes */
106 UINT16 coreCopyData (UINT32 dest_addr, UINT16 *p_data, UINT32 sizeBytes, UINT16 start_vector);
108 /* btblwrap.c prototypes */
109 void btblBootException (UINT32 ecode);
111 /* The block size allocated through malloc. Chosen to match the value defined
112 * for the coff loader. malloc is used so the same heap section can be used. */
113 #define TI_BTBL_BLOCK_SIZE 0x4000
115 /* Read/Write 32bit values */
116 #define chipStoreWord(x,y) *(x) = (y)
117 #define chipReadWord(x) *(x)
119 /* Boot table wrapper error codes */
120 #define BTBL_WRAP_ECODE_MALLOC_FAIL 100
121 #define BTBL_WRAP_ECODE_READ_FAIL 101
122 #define BTBL_WRAP_ECODE_BTBL_FAIL 102
124 #define btblMemset iblMemset
127 #endif /* BTBLWRAP_H */