FreeCalypso > hg > freecalypso-reveng
annotate fluid-mnf/fluid.c @ 358:49fe64a5e207
fluid-mnf/serial.c: comment typo fix
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 13 Mar 2020 21:15:41 +0000 |
parents | e77d478e3724 |
children | b4fb0c7dfdf4 |
rev | line source |
---|---|
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /****************************************************************************** |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * FLUID (Flash Loader Utility Independent of Device) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * Copyright Texas Instruments, 2001. |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * Mads Meisner-Jensen, mmj@ti.com. |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * Main, command-line argument parsing, error handling. |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * $Id: fluid.c 1.50 Thu, 14 Nov 2002 13:10:05 +0100 tsj $ |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 ******************************************************************************/ |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "fluid.h" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "flash.h" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "fileio.h" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "trace.h" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 // Secure Calypso Plus |
339
77c86062e253
fluid-mnf/fluid.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents:
311
diff
changeset
|
18 #include "calplus/ram_load.h" |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include <stdio.h> |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include <string.h> |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include <stdlib.h> |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include <stdarg.h> |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #if defined(MSC) || defined(BCC) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "getopt.h" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "windows.h" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #else |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include <getopt.h> |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #endif |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include <errno.h> // for ERANGE |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 /****************************************************************************** |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 * Prototypes and Globals |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 ******************************************************************************/ |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 extern T_RAM_LOADER d_ram_loader; // Secure Calypso Plus |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 char *arg_file_list[ARG_FILE_LIST_SIZE_MAX] = { (char *) 0 }; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 int arg_file_list_size = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 char *arg_erase_override = ""; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 char *arg_read = ""; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 char *arg_write = ""; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 int arg_checksum = 1; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 int arg_compress = 1; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 int arg_dry_run = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 int arg_list_devices = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 char arg_target_type = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 int arg_image_map_show = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 int arg_sector_map_show = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 int arg_sector_list_show = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 int arg_timers_show = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 int arg_timers_extended_show = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 int arg_checksum_show = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 int arg_show_hexdump = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 int arg_target_trace_enable = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 int arg_progress = 'a'; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 char arg_hexfile_type = 'm'; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 char arg_hexfile_memwidth = 2; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 int arg_target_reset = 1; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 int arg_rom_bootloader = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 int arg_boot_delay_rom = 15; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 int arg_boot_delay_fluid = 15; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 int arg_device_id0 = -1; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 int arg_device_id1 = -1; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
348
37b5f94de802
fluid-mnf: sensible target tty specification
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
71 char *arg_uart_ttyport = (char *) 0; |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 int arg_uart_baudrate = 115200; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 char arg_uart_level_convert = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 char arg_verbose = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 int arg_debug_resume = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 int arg_debug_trace_pe = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 int arg_keep_going = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 int arg_show_main_args = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 int arg_skip_erase = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 // Secure Calypso Plus |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 char *arg_die_id_file_name = ""; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 char *arg_imeisv = ""; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 char *arg_platform_certificate_addr = ""; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 int arg_request_certificate = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 int arg_delay_for_changing_cs5 = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 int arg_uart_baudrate_during_cmd_download = 115200; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 int arg_uart_timeout_configuration = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 int arg_block_size = 8 * 1024; // Must be a modulus of 64 bytes, except for the last command. |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 int arg_usage = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 char *argv_0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 int arg_tr_mask = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 int arg_tr_spaces = 2; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 char *arg_tr_file = NULL; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 int arg_errorfd = 2; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 static void main_usage(void); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 static void main_args(int argc, char *argv[]); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 static long arg_long_get(void); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 extern int fluid_machine(void); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 extern int fluid_compress(void); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 extern int fluid_decompress(void); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 extern int serial_is_baudrate(int bps); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 /****************************************************************************** |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 * Error handling |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 ******************************************************************************/ |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 extern char *main_strerror(int error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 |
339
77c86062e253
fluid-mnf/fluid.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents:
311
diff
changeset
|
119 #if 0 |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 char *win32_strerror(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 static char buf[220]; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 int error; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 char *p = buf; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 error = GetLastError(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 p += sprintf(buf, "%d: ", error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 p, sizeof(buf) - 20, NULL) == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 sprintf(p, "(Unknown Win32 error)"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 return buf; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 } |
339
77c86062e253
fluid-mnf/fluid.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents:
311
diff
changeset
|
136 #endif |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 void main_msg(char *format, ...) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 va_list args; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 char buf[1024]; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 va_start(args, format); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 vsprintf(buf, format, args); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 va_end(args); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 if (arg_errorfd == 2) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 fprintf(stderr, "%s", buf); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 fflush(stderr); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 else { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 fprintf(stdout, "%s", buf); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 fflush(stdout); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 void main_error_str(char type, int error, char *string) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 // If it was an OS error... |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 if (error < E_OS) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 error -= E_OS; |
339
77c86062e253
fluid-mnf/fluid.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents:
311
diff
changeset
|
162 main_msg("OS-ERROR: %s", strerror(errno)); |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 main_msg(" %s(%d): %s%s\n", (type == 'w' ? "WARNING" : "ERROR"), |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 -error, main_strerror(error), string); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 void main_warning(int error) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 main_error_str('w', error, ""); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 void main_error(int error) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 main_error_str('e', error, ""); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 if (arg_keep_going == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 exit(-error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 void main_fatal(int error) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 main_error(error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 exit(-error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 /****************************************************************************** |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 * Command line parsing |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 ******************************************************************************/ |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 static void main_help(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 "You have started fluid with no command line arguments\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 "To see all the available command line arguments, start fluid\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 "from a command line prompt (cmd.exe or similar) with:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 " fluid -h\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 "To see some basic and common examples of usage, start fluid with:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 " fluid -ic\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 "You can get an overview of all the available examples with:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 " fluid -ii\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 // "Please read the README file for notes and other info and read the\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 // "HISTORY file to see what has happened with fluid since last release.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 // "\n" |
347
21d38dce4d15
fluid-mnf: removed silly wait for RETURN from no-arguments display
Mychaela Falconia <falcon@freecalypso.org>
parents:
339
diff
changeset
|
215 // "Press RETURN to exit...\n" |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 ); |
347
21d38dce4d15
fluid-mnf: removed silly wait for RETURN from no-arguments display
Mychaela Falconia <falcon@freecalypso.org>
parents:
339
diff
changeset
|
217 // getchar(); |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 static void main_example(int type) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 switch (type) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 case 'c': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 "Download into board:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 " fluid -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 "Simulate a download into board (dry-run):\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 " fluid -n -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 "Check if file has already been downloaded into board:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 " fluid -n -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 "Download into board without erasing boot sector:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 " fluid -e-0 -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 "Download into board with another progress indication:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 " fluid -gc -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 case 'a': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 "Download into board with more output verbosity:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 " fluid -v -v -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 "Show the image map (which parts of the flash are used, which are not):\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 " fluid -si -n -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 "Show both the image and the erase maps:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 " fluid -sis -n -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 "Download into board without delta download:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 " fluid -C -f gsm.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 case 'e': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 "Erase all flash (including boot sector!):\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 " fluid -e+*\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 "Erase all flash except the boot sector:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 " fluid -e+*,-0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 "Erase the last megabyte of a 4MB flash device:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 " fluid -e+3M..4M\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 "Erase all flash except sectors 1..7 and addresses 1984k..2048k:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 " fluid -e+*,-1..8,-1984k..2048k\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 case 'r': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 "Read whole FFS system from a B-Sample:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 " fluid -r3M..4M -f bsffs.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 "Then copy/download it (e.g., to another B-Sample):\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 " fluid -f bsffs.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 "Read serial switch config from a B- or C-Sample:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 "(serial switch config is in sector 2 on TI releases earlier than SSA-5.3.1)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 " fluid -r0x11ffe..0x12000 -f usxx.m0 -sx\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 "Copy it to a(nother) B- or C-sample:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 " fluid -f usxx.m0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 "\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 case 'w': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 "Over-write image with a byte string at a specific address:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 " fluid -f gsm.m0 -w7800=0x11,0x22,0x33,0x44,0x55,0x66\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 "Write zeroes into top-most 2MB of C-Sample flash memory:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 " fluid -w2M..4M=0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 "Write a string to a specific address:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 " fluid -w0x1800=\"\"\"Mads\"\"\",0\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 "\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 case 's': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 "Reset target, doing nothing else (requires special cable):\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 " fluid -n -or\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 default: |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 "Avaliable examples:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 " a = Advanced, common usage\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 " c = Common usage\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 " e = Erase override\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 " r = Read target memory\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 " w = Write target memory\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 " s = Special usage\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 exit(0); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 static void main_debug_usage(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 printf("Debug usage: fluid [OPTIONS...]\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 " -d r Display target (remote) tracing.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 " -d c Resume fluid state machine in command interpreter.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 " -d o Display final command line option values.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 " -d t<char> Trace mask in human format:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 " a = All, except ?\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 " * = All\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 " g = getchar()\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 " p = putchar()\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 " G = target driver receive\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 " P = target driver transmit\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 " w = target wait\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 " t = target/transport layer driver\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 " h = hexfile read/decode\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 " H = hexfile write/encode\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 " r = device file parser\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 " c = Command line argument parser\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 " u = utility functions\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 " m = state machine functions\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 " \n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 " -d v Display info on compiler used.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 " -d f<file> Trace to file.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 " -d i<n> Trace indentation multiplier. Default is 2.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 " -d m<n> Trace mask. Default is 0.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 " -t <char> Trace mask in human format. Same as '-d t<char>'.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 "B-/C-/D-Sample LEDs layout:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 "+---0---+---1---+---2---+---3---+---4---+---5---+---6---+---7---+\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 "| Recv | Erase | Prog | Overhd| Idle | | | Busy |\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 "+-------+-------+-------+-------+-------+-------+-------+-------+\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 exit(0); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 static void main_args_debug_trace(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 while (*optarg) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 switch(*optarg++) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 case 'a': arg_tr_mask |= TrAll & ~(0); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 case '*': arg_tr_mask |= TrAll; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 case 'm': arg_tr_mask |= TrMachines; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 case 'g': arg_tr_mask |= TrGetChar; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 case 'p': arg_tr_mask |= TrPutChar; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 case 'G': arg_tr_mask |= TrDriverGet; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 case 'P': arg_tr_mask |= TrDriverPut; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 case 'w': arg_tr_mask |= TrTargetWait; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 case 't': arg_tr_mask |= TrTargetDrv; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 case 'h': arg_tr_mask |= TrHexRead; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 case 'H': arg_tr_mask |= TrHexWrite; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 case 'r': arg_tr_mask |= TrParser; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 case 'c': arg_tr_mask |= TrArgParser; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 case 'C': arg_tr_mask |= TrCmdLineParser; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 case 'u': arg_tr_mask |= TrUtility; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 static void fluid_welcome(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 flowf(NORMAL, |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 "FLUID Revision 2.27, (23 Aug 2004). Copyright Texas Instruments, 2001-2004.\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 static void fluid_compile_info(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 flowf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 NORMAL, |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 "Compiled " __DATE__ " " __TIME__ " with " |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 #if defined(MSC) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 "Microsoft cl.exe" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 #elif defined(BCC) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 "Borland bcc" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 #else |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 "GNU gcc" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 #endif |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 "\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 static void main_usage(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 "Usage: fluid [OPTIONS...]\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 "\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 if (!arg_usage) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 fluid_welcome(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 printf( |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
414 "FLUID is a Flash Loader Utility Independent of Device\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
415 "This version supports:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 " TI GSM Boot Loader V6.x.x (with fluid patch)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
417 " TI ROM Boot Loader (Calypso devices only)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
418 "\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
419 " -f <file> Flash image file (input or output file).\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
420 " -p <num> Serial port number. Default is 1.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
421 " -b <num> Serial baudrate. Default is 115200.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
422 " -t <char> Target type (Default is auto-detect):\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
423 " h = Hercules\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
424 " u = Ulysses\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
425 " c = Calypso\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 " l = Calypso Lite\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
427 " p = Calypso Plus\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 " -l List all known flash devices.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
429 " -c, -C Do or do not checksum target memory thus enabling delta\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
430 " download (only program changed sectors). Default is on.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
431 " -z, -Z Do or do not compress data on download. Default is on.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
432 " -g <char> Progress indication type:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
433 " a = asterisks (default), c = chars, d = dots,\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
434 " x = address+size, n = none\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
435 " -e [+|-]<addr0>..<addr1>,... or [+|-]<n>,...<\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
436 " Erase/program override. Erase or don't erase flash\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
437 " memory in the range [addr0..addr1[. Use '-ie' to see\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
438 " examples of usage\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
439 " -<...> = do *not* erase and program\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
440 " +<...> = force erase\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
441 " Giving <n> as an asterisk, '*', means all sectors\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
442 " -r <addr0>..<addr1>,...\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
443 " Read target memory range [addr0..addr1[ and write the\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
444 " bytes to output file specified.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 " -w <addr0>..<addr1>=<b0,b1,...,bN>:...\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
446 " Write bytes to image. The bytes b0..bN are replicated\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
447 " through the whole memory range [addr0..addr1[\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
448 " -o <char> Extra options:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
449 " o = Only bootstrap using ROM boot loader (Calypso devices only)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
450 " O = Do NOT use ROM boot loader\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
451 " e = Skip erase (Require empty flash)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
452 " r = Reset target after download (default)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
453 " R = Do NOT reset target after download\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
454 " l = Activate (old-fashioned) UART level conversion\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
455 " m = Select Motorola hexfile output format (default)\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
456 " b = Select binary/raw file output format\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
457 " i<n1>,<n2> = Disable device auto-detection and set manufacturer\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
458 " id and device id\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
459 " d<n1>,<n2> = Set detection delay (in ms) for ROM and fluid boot\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
460 " loader, respectively\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
461 " 1, 2, 4 = Select hexfile memory width 1, 2 or 4. Default is 2\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
462 " -s <char> Show additional info:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
463 " i = image map\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
464 " s = sector erase map\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
465 " l = sector erase list\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
466 " t = target timers, T = extended target timer info\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
467 " x = hexdump of target memory (together with '-r')\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
468 " c = checksums\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
469 " -n Dry run. Do not program the flash device.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
470 " -v Be verbose. Multiple '-v's means more verbosity.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
471 " -q Be quiet.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
472 // " -y Use stdout for error messages.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
473 " -dh Display help on debug and trace options.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
474 " -h Display this help.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
475 " -i <char> Display examples (i = index/overview of examples).\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
476 // Secure Calypso Plus |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
477 "\n Secure Calypso Plus options:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
478 " -I <char> IMEI protection options:\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
479 " d <file> = Retrieve die id from target and write to <file>.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
480 " n <num> = 16 digits representing the IMEI-SV, [8 TAC]+[6 SNR]+\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
481 " [2 SVN], which is used for non-secure E-samples or\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
482 " secure E-samples when the die id is not added to the\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
483 " DIE_ID field of the manufacturer certificate.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
484 " a <addr> = Address of the platform certificate stored in flash.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
485 " -R Request firmware certificate.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
486 " -D <num> Insert a delay before detection of flash type. This delay is used\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
487 " for changing the memory mapping on CS5 due to a bug in ROM code\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
488 " 0x0410 (see SECURITY.txt) or for connecting to target via JTAG.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
489 " -U <num> UART baudrate during flash programmer download. Default is 115200.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
490 " -u <num> UART timeout configuration. Default is 0.\n" |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
491 " -B <num> Block size. Must be a modulus of 64 bytes. Default is %d bytes.\n", arg_block_size |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
492 // End Secure Calypso Plus |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
493 ); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
494 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
495 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
496 static void main_args(int argc, char *argv[]) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
497 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
498 char ch; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
499 int i; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
500 // IMEI Protection |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
501 char d_i, d_digit; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
502 char a_imeisv_format[] = "The IMEI-SV must consist of 16 digits in compliance with the following format:\n[8 TAC]+[6 SNR]+[2 SVN]\n"; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
503 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
504 if (argc == 1) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
505 fluid_welcome(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
506 main_help(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
507 exit(0); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
508 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
509 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
510 for (i = argc - 1; i >= 0; i--) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
511 // TODO?: scan for filenames. |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
512 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
513 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
514 while ((ch = getopt(argc, argv, |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
515 "f:p:b:cCzZjJt:e:s:r:w:nlqg:o:vkd:i:hVyI:RD:U:u:B:")) != -1) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
516 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
517 switch (ch) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
518 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
519 case 'f': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
520 if (arg_file_list_size < ARG_FILE_LIST_SIZE_MAX - 1) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
521 arg_file_list[arg_file_list_size++] = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
522 arg_file_list[arg_file_list_size] = NULL; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
523 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
524 case 'p': |
348
37b5f94de802
fluid-mnf: sensible target tty specification
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
525 arg_uart_ttyport = optarg; |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
526 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
527 case 'b': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
528 arg_uart_baudrate = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
529 arg_uart_baudrate = serial_is_baudrate(arg_uart_baudrate); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
530 if (arg_uart_baudrate == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
531 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
532 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
533 case 't': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
534 arg_target_type = *optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
535 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
536 case 'c': arg_checksum = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
537 case 'C': arg_checksum = 0; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
538 case 'z': arg_compress = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
539 case 'Z': arg_compress = 0; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
540 case 'e': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
541 if (*arg_erase_override != 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
542 main_error(E_ARG_MULTI); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
543 arg_erase_override = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
544 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
545 case 's': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
546 while (*optarg) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
547 switch(*optarg++) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
548 case 'i': arg_image_map_show++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
549 case 's': arg_sector_map_show++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
550 case 'l': arg_sector_list_show++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
551 case 't': arg_timers_show++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
552 case 'T': arg_timers_extended_show++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
553 case 'c': arg_checksum_show++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
554 case 'x': arg_show_hexdump++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
555 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
556 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
557 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
558 case 'r': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
559 if (*arg_read != 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
560 main_error(E_ARG_MULTI); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
561 arg_read = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
562 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
563 case 'w': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
564 if (*arg_write != 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
565 main_error(E_ARG_MULTI); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
566 arg_write = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
567 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
568 case 'l': arg_list_devices = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
569 case 'n': arg_dry_run++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
570 case 'k': arg_keep_going = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
571 case 'v': arg_verbose++; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
572 case 'q': arg_verbose--; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
573 case 'g': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
574 if (*optarg != 'a' && |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
575 *optarg != 'c' && |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
576 *optarg != 'd' && |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
577 *optarg != 'x' && |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
578 *optarg != 'n') |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
579 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
580 arg_progress = *optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
581 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
582 case 'o': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
583 while (*optarg) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
584 tr(TrCmdLineParser, "main_args(): -o%s", optarg); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
585 switch (*optarg) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
586 case 'e': arg_skip_erase = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
587 case 'R': arg_target_reset = 0; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
588 case 'r': arg_target_reset = 2; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
589 case 'o': arg_rom_bootloader = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
590 case 'O': arg_rom_bootloader = -1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
591 case 'l': arg_uart_level_convert = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
592 case 'b': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
593 case 'm': arg_hexfile_type = *optarg; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
594 case 'i': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
595 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
596 arg_device_id0 = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
597 if (*optarg == ',') { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
598 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
599 arg_device_id1 = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
600 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
601 else { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
602 fprintf(stderr, "arg: '%s'", optarg); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
603 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
604 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
605 optarg--; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
606 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
607 case 'd': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
608 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
609 arg_boot_delay_rom = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
610 if (*optarg == ',') { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
611 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
612 arg_boot_delay_fluid = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
613 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
614 else if (*optarg == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
615 arg_boot_delay_fluid = arg_boot_delay_rom; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
616 else { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
617 fprintf(stderr, "arg: '%s'", optarg); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
618 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
619 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
620 optarg--; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
621 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
622 case '1': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
623 case '2': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
624 case '4': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
625 arg_hexfile_memwidth = *optarg - '0'; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
626 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
627 default: |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
628 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
629 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
630 tr(TrCmdLineParser, "\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
631 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
632 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
633 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
634 case 'd': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
635 while (*optarg) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
636 switch (*optarg++) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
637 case 'h': main_debug_usage(); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
638 case 'c': arg_debug_resume = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
639 case 'p': arg_debug_trace_pe = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
640 case 'r': arg_target_trace_enable = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
641 case 'o': arg_show_main_args = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
642 case 't': main_args_debug_trace(); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
643 case 'v': fluid_compile_info(); exit(0); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
644 case 'f': arg_tr_file = optarg; optarg += strlen(optarg); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
645 case 'm': arg_tr_mask = arg_long_get(); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
646 case 'i': arg_tr_spaces = arg_long_get(); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
647 default: |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
648 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
649 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
650 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
651 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
652 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
653 case 'i': main_example(*optarg); break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
654 case 'h': arg_usage = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
655 case 'V': fluid_welcome(); exit(0); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
656 case 'y': arg_errorfd = 1; break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
657 // IMEI Protection |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
658 case 'I': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
659 switch (*optarg++) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
660 case 'd': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
661 if (*arg_die_id_file_name != 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
662 main_error(E_ARG_MULTI); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
663 if (*optarg == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
664 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
665 arg_die_id_file_name = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
666 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
667 case 'n': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
668 if (*arg_imeisv != 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
669 main_error(E_ARG_MULTI); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
670 if (*optarg == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
671 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
672 arg_imeisv = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
673 if (strlen(arg_imeisv) != C_IMEISV_DIGITS) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
674 fprintf(stderr, a_imeisv_format); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
675 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
676 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
677 for (d_i = 0; d_i < C_IMEISV_DIGITS; d_i++) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
678 sscanf(arg_imeisv++, "%1c", &d_digit); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
679 if (d_digit < '0' ||d_digit > '9') { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
680 fprintf(stderr, a_imeisv_format); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
681 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
682 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
683 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
684 arg_imeisv = optarg; // Re-assign arg_imeisv after error check |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
685 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
686 case 'a': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
687 if (*arg_platform_certificate_addr != 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
688 main_error(E_ARG_MULTI); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
689 if (*optarg == 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
690 optarg++; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
691 arg_platform_certificate_addr = optarg; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
692 if ((strlen(arg_platform_certificate_addr) == C_PLATFORM_CERT_ADDR_DIGITS + 2) && |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
693 (arg_platform_certificate_addr[0] == '0') && |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
694 (arg_platform_certificate_addr[1] == 'x')) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
695 arg_platform_certificate_addr += 2; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
696 else if (strlen(arg_platform_certificate_addr) != C_PLATFORM_CERT_ADDR_DIGITS) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
697 fprintf(stderr, "The platform certificate address must comply with the following format, e.g.,\n0x04650000\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
698 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
699 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
700 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
701 default: |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
702 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
703 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
704 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
705 // Secure Calypso Plus |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
706 case 'R': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
707 arg_request_certificate = 1; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
708 d_ram_loader.b_certificate_request = C_TRUE; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
709 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
710 case 'D': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
711 arg_delay_for_changing_cs5 = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
712 if (arg_delay_for_changing_cs5 < 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
713 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
714 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
715 case 'U': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
716 arg_uart_baudrate_during_cmd_download = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
717 if (arg_uart_baudrate_during_cmd_download < 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
718 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
719 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
720 case 'u': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
721 arg_uart_timeout_configuration = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
722 d_ram_loader.d_uart_timeout = (UWORD32) arg_uart_timeout_configuration; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
723 if (d_ram_loader.d_uart_timeout < 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
724 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
725 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
726 case 'B': |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
727 arg_block_size = arg_long_get(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
728 d_ram_loader.d_nb_byte_in_block = (UWORD32) arg_block_size; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
729 if (d_ram_loader.d_nb_byte_in_block < 1) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
730 main_error(E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
731 break; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
732 // End Secure Calypso Plus |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
733 default: |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
734 main_usage(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
735 exit(-E_BADARG); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
736 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
737 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
738 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
739 if (arg_usage) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
740 main_usage(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
741 exit(0); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
742 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
743 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
744 if (arg_show_main_args) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
745 printf("Command line option values:\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
746 printf("argv[0] = '%s'\n", argv[0]); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
747 printf("\n"); |
348
37b5f94de802
fluid-mnf: sensible target tty specification
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
748 printf("port = %s\n", |
37b5f94de802
fluid-mnf: sensible target tty specification
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
749 arg_uart_ttyport ? arg_uart_ttyport : "FLUID_PORT"); |
311
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
750 printf("baudrate = %d\n", arg_uart_baudrate); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
751 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
752 printf("target_trace_enable = %d\n", arg_target_trace_enable); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
753 printf("\n"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
754 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
755 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
756 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
757 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
758 static long arg_long_get(void) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
759 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
760 long value; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
761 char *endp; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
762 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
763 errno = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
764 value = strtol(optarg, &endp, 0); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
765 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
766 if (errno == ERANGE || endp == optarg) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
767 fprintf(stderr, "Invalid command line number argument: '%s'", optarg); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
768 exit(1); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
769 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
770 optarg = endp; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
771 return value; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
772 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
773 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
774 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
775 /****************************************************************************** |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
776 * Globals and Main |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
777 ******************************************************************************/ |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
778 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
779 int flowf(int level, char *format, ...) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
780 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
781 int n = 0; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
782 va_list args; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
783 char buf[1024]; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
784 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
785 if (level <= arg_verbose) { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
786 va_start(args, format); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
787 vsprintf(buf, format, args); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
788 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
789 n = fprintf(stdout, "%s", buf); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
790 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
791 fflush(stdout); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
792 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
793 return n; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
794 } |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
795 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
796 int main(int argc, char *argv[]) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
797 { |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
798 int error; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
799 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
800 file_read_rc(".fluidrc"); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
801 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
802 main_args(argc, argv); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
803 argv_0 = argv[0]; |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
804 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
805 if (arg_verbose >= NORMAL) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
806 fluid_welcome(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
807 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
808 // Init tracing library |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
809 tr_init(arg_tr_spaces, arg_tr_file); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
810 tr_mask(TrMAIN | arg_tr_mask); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
811 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
812 error = fluid_machine(); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
813 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
814 if (error < 0) |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
815 main_error(error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
816 |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
817 exit(-error); |
9cecc930d78f
fluid-mnf: original source from TI,
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
818 } |