FreeCalypso > hg > freecalypso-reveng
comparison fluid-mnf/fluid.h @ 311:9cecc930d78f
fluid-mnf: original source from TI,
defenestrated line endings and rearranged directory structure,
but no *.[ch] source file content changes yet
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 29 Feb 2020 05:36:07 +0000 |
parents | |
children | 37b5f94de802 |
comparison
equal
deleted
inserted
replaced
310:ae39d76d5b7a | 311:9cecc930d78f |
---|---|
1 /****************************************************************************** | |
2 * FLUID (Flash Loader and Utility Independent of Device) | |
3 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com | |
4 * | |
5 * Main | |
6 * | |
7 * $Id: fluid.h 1.43 Fri, 25 Oct 2002 14:46:33 +0200 tsj $ | |
8 * | |
9 ******************************************************************************/ | |
10 | |
11 | |
12 /****************************************************************************** | |
13 * Exception definitions | |
14 ******************************************************************************/ | |
15 | |
16 enum Exceptions { | |
17 E_OK = 0, /* Ok */ | |
18 | |
19 E_DRIVER_INIT = -3, /* Driver failed to initialize */ | |
20 E_DRIVER_WAIT = -4, /* Driver recv_wait() failed */ | |
21 | |
22 E_UART_INIT = -5, /* UART failed to initialize */ | |
23 E_UART_PARAM = -6, /* UART parameter bad or unsupported */ | |
24 E_UART_DRV_SEND = -7, /* UART driver transmit error */ | |
25 E_UART_DRV_RECV = -8, /* UART driver receive error */ | |
26 | |
27 E_RECV_TIMEOUT = -10, /* Receive timeout (no target reply) */ | |
28 E_RECV_ANTITIMEOUT = -11, /* Receive anti-timeout (target replied!?) */ | |
29 E_SEND_CHECKSUM = -12, /* Transmit checksum error */ | |
30 E_RECV_CHECKSUM = -13, /* Receive checksum error */ | |
31 E_PROTO_ERROR = -14, /* Protocol error (bad char from target) */ | |
32 E_INVALID = -15, /* Invalid command parameter */ | |
33 E_FIFO_OVERFLOW = -16, /* RX FIFO overflow in target */ | |
34 | |
35 E_FLASH_UNKNOWN = -20, /* Flash device unknown */ | |
36 E_FLASH_TIMEOUT = -21, /* Flash operation timeout */ | |
37 E_FLASH_VERIFY = -22, /* Flash verify error */ | |
38 E_FLASH_COMMAND = -23, /* Flash command sequence error */ | |
39 E_FLASH_VPPRANGE = -24, /* Flash Vpp range error */ | |
40 E_FLASH_LOCKED = -25, /* Flash block locked error */ | |
41 E_FLASH_ERROR = -26, /* Flash error (unknown!?) */ | |
42 E_TARGET_TYPE = -27, /* Target type not detected, unspecified or unknown */ | |
43 E_TARGET_MEMORY = -28, /* Target out of memory */ | |
44 | |
45 E_PARSER_EOF = -30, /* Unexpected end of file */ | |
46 E_PARSER_KEYWORD = -31, /* Syntax error: keyword expected */ | |
47 E_PARSER_STRING = -32, /* Syntax error: string expected */ | |
48 E_PARSER_NUMBER = -33, /* Syntax error: number expected */ | |
49 E_PARSER_END_BRACE = -34, /* Syntax error: missing end brace */ | |
50 E_PARSER_SYNTAX = -35, /* Syntax error */ | |
51 E_PARSER_MEMMAP = -36, /* Undefined flash memmap */ | |
52 E_PARSER_ALGORITHM = -37, /* Undefined flash algorithm */ | |
53 | |
54 E_BOOTLOADER = -40, /* Unsupported bootloader */ | |
55 | |
56 E_FILE_OPEN = -50, /* File open error */ | |
57 E_FILE_CLOSE = -52, /* File close error */ | |
58 E_FILE_READ = -53, /* File read error */ | |
59 E_FILE_WRITE = -54, /* File write error */ | |
60 E_FILE_FORMAT = -55, /* File format/syntax error */ | |
61 E_FILE_EMPTY = -56, /* File empty or unreadable? */ | |
62 E_FILE_BUF_SMALL = -57, /* File buffer too small */ | |
63 E_FILE_INPUT = -58, /* No input file name supplied */ | |
64 E_FILE_OUTPUT = -59, /* No output file name supplied */ | |
65 | |
66 E_ADDR_RANGE = -70, /* Bad address range */ | |
67 E_ERASE_SPEC = -71, /* Bad erase override specifier */ | |
68 E_READ_SPEC = -72, /* Bad memory read specifier */ | |
69 E_WRITE_SPEC = -73, /* Bad memory write specifier */ | |
70 | |
71 E_BADARG = -80, /* Bad argument or out of range */ | |
72 E_ARG_MULTI = -81, /* Multiple ambiguous arguments supplied */ | |
73 E_ARG_TOOMANY = -82, /* Too many arguments supplied */ | |
74 | |
75 E_MEMORY = -85, /* Out of memory */ | |
76 E_BUFFER = -86, /* Internal (static) buffer too small */ | |
77 | |
78 E_ROM_SSERVICE = -90, /* Secure ROM service error */ | |
79 | |
80 E_INTERNAL = -99, /* Internal program state error */ | |
81 | |
82 E_OS = -100 | |
83 }; | |
84 | |
85 | |
86 /****************************************************************************** | |
87 * Typedefs and Prototypes | |
88 ******************************************************************************/ | |
89 | |
90 typedef unsigned char uint8; | |
91 typedef unsigned short uint16; | |
92 typedef unsigned long uint32; | |
93 typedef signed char int8; | |
94 typedef signed short int16; | |
95 typedef signed long int32; | |
96 | |
97 void main_warning(int error); | |
98 void main_error(int error); | |
99 void main_fatal(int error); | |
100 void main_msg(char *format, ...); | |
101 | |
102 int flowf(int level, char *format, ...); | |
103 | |
104 | |
105 /****************************************************************************** | |
106 * Globals | |
107 ******************************************************************************/ | |
108 | |
109 #define ARG_FILE_LIST_SIZE_MAX 8 | |
110 | |
111 extern char *arg_file_list[ARG_FILE_LIST_SIZE_MAX]; | |
112 extern int arg_file_list_size; | |
113 | |
114 extern char *arg_erase_override; | |
115 extern char *arg_read; | |
116 extern char *arg_write; | |
117 extern int arg_checksum; | |
118 extern int arg_compress; | |
119 extern int arg_flash_read; | |
120 extern int arg_dry_run; | |
121 extern int arg_list_devices; | |
122 extern char arg_target_type; | |
123 extern int arg_image_map_show; | |
124 extern int arg_sector_map_show; | |
125 extern int arg_sector_list_show; | |
126 extern int arg_timers_show; | |
127 extern int arg_timers_extended_show; | |
128 extern int arg_checksum_show; | |
129 extern int arg_show_hexdump; | |
130 extern int arg_target_trace_enable; | |
131 extern int arg_progress; | |
132 extern char arg_hexfile_type; | |
133 extern char arg_hexfile_memwidth; | |
134 | |
135 extern int arg_target_reset; | |
136 extern int arg_rom_bootloader; | |
137 extern int arg_boot_delay_rom; | |
138 extern int arg_boot_delay_fluid; | |
139 extern int arg_device_id0; | |
140 extern int arg_device_id1; | |
141 | |
142 extern int arg_uart_port; | |
143 extern int arg_uart_baudrate; | |
144 extern char arg_uart_flowcontrol[2]; | |
145 extern char arg_uart_level_convert; | |
146 | |
147 extern char arg_verbose; | |
148 extern int arg_debug_resume; | |
149 extern int arg_debug_trace_pe; | |
150 extern int arg_keep_going; | |
151 | |
152 extern char *argv_0; | |
153 | |
154 extern int arg_trlevel; | |
155 extern int arg_trmask; | |
156 extern int arg_trspaces; | |
157 extern int arg_skip_erase; | |
158 | |
159 extern int arg_errorfd; | |
160 | |
161 // Secure Calypso Plus | |
162 extern char *arg_die_id_file_name; | |
163 extern char *arg_imeisv; | |
164 extern char *arg_platform_certificate_addr; | |
165 extern int arg_request_certificate; | |
166 extern int arg_delay_for_changing_cs5; | |
167 extern int arg_uart_baudrate_during_cmd_download; | |
168 extern int arg_uart_timeout_configuration; | |
169 extern int arg_block_size; | |
170 | |
171 // IMEI protection | |
172 #define C_IMEISV_DIGITS 16 | |
173 #define C_IMEISV_BYTES 8 | |
174 #define C_PLATFORM_CERT_ADDR_DIGITS 8 | |
175 #define C_PLATFORM_CERT_ADDR_BYTES 4 | |
176 // End Secure Calypso Plus | |
177 | |
178 enum VERBOSITY_LEVELS { | |
179 TESTOUTPUT = -2, // Only test output. | |
180 ALWAYS = -2, | |
181 QUIET = -1, // No messsages at all. | |
182 NORMAL = 0, // Overview message level. | |
183 VERBOSE = 1, // Detailed messages. Useful for diagnosing problems. | |
184 BLABBER = 2, // Very verbose messages. Useful for debugging. | |
185 DEBUG = 3 // Very very verbose messages. Useful for debugging. | |
186 }; | |
187 | |
188 | |
189 /****************************************************************************** | |
190 * Trace mask bits definition | |
191 ******************************************************************************/ | |
192 | |
193 enum TraceMaskBits { | |
194 TrMAIN = 1 << 24, | |
195 | |
196 TrUtility = TrMAIN | 0x000002, | |
197 TrMachines = TrMAIN | 0x000004, | |
198 | |
199 TrTargetDrv = TrMAIN | 0x000010, | |
200 TrTargetWait = TrMAIN | 0x000020, | |
201 | |
202 TrGetChar = TrMAIN | 0x000100, | |
203 TrPutChar = TrMAIN | 0x000200, | |
204 TrDriverGet = TrMAIN | 0x000400, | |
205 TrDriverPut = TrMAIN | 0x000800, | |
206 | |
207 TrHexRead = TrMAIN | 0x001000, | |
208 TrHexWrite = TrMAIN | 0x002000, | |
209 TrArgParser = TrMAIN | 0x004000, | |
210 TrCmdLineParser = TrMAIN | 0x008000, | |
211 | |
212 TrParser = TrMAIN | 0x010000 | |
213 }; |