annotate loadtools/simmain.c @ 964:a96cb97b66a2

ringtools/imy: fix duplicate definition of tdma_durations[] The bug was reported by Vadim Yanitskiy <fixeria@osmocom.org>, although the present fix is slightly different from the contributed patch: because main.c doesn't need this tdma_durations[] array at all, let's simply remove the reference to this array from main.c rather than turn it into an extern. I no longer remember my original thought flow that resulted (by mistake) in tdma_durations[] being multiply defined in main.c and durations.c. My intent might have been to define all globals in main.c and have the reference in durations.c be an extern - and I missed that extern - but without clear memory, I have no certainty. In any case, having this data array defined in the same module that fills it (durations.c) is sensible, so let's make it the new way.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 31 Aug 2023 19:38:18 +0000
parents 02490e26f53d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
2 * This module contains the main() function for fc-simint.
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdint.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <unistd.h>
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "../libserial/baudrate.h"
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "srecreader.h"
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 char *target_ttydev;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 extern struct srecreader iramimage;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 extern struct baudrate *current_baud_rate;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 extern void (*default_exit)();
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 extern struct baudrate *find_baudrate_by_name();
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
23 static char simagent_pathname[] = "/opt/freecalypso/target-bin/simagent.srec";
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
24 static char simtool_pathname[] = "/opt/freecalypso/bin/fc-simtool";
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
25 static char uicc_tool_pathname[] = "/opt/freecalypso/bin/fc-uicc-tool";
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
26
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
27 static char *selected_simtool = simtool_pathname;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
28 static struct baudrate *session_baudrate;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
29
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
30 int sim_voltage_mode_1v8;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
31 int sim_allow_spenh = 1;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
32
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
33 static void
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
34 tool_select_arg(arg)
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
35 char *arg;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
36 {
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
37 if (!strcmp(arg, "sim"))
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
38 selected_simtool = simtool_pathname;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
39 else if (!strcmp(arg, "uicc"))
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
40 selected_simtool = uicc_tool_pathname;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
41 else {
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
42 fprintf(stderr, "error: invalid -T argument\n");
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
43 exit(1);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
44 }
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
45 }
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
47 static void
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
48 voltage_select_arg(arg)
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
49 char *arg;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
50 {
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
51 if (!strcmp(arg, "1.8"))
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
52 sim_voltage_mode_1v8 = 1;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
53 else if (!strcmp(arg, "3") || !strcmp(arg, "3.0"))
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
54 sim_voltage_mode_1v8 = 0;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
55 else {
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
56 fprintf(stderr, "error: invalid -v argument\n");
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
57 exit(1);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
58 }
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
59 }
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
60
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
61 static void
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
62 exec_simtool(passon_argc, passon_argv)
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
63 char **passon_argv;
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 {
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
65 char **exec_argv, *prog_base_name;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
66 char **sp, **dp;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
67 extern int target_fd;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
68 char desc_arg[16];
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
69
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
70 prog_base_name = rindex(selected_simtool, '/') + 1;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
71 sprintf(desc_arg, "-C%d", target_fd);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
72 exec_argv = (char **) malloc(sizeof(char *) * (passon_argc + 3));
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
73 if (!exec_argv) {
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
74 perror("malloc argv for execv");
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
75 exit(1);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
76 }
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
77 sp = passon_argv;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
78 dp = exec_argv;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
79 *dp++ = prog_base_name;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
80 *dp++ = desc_arg;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
81 while (*sp)
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
82 *dp++ = *sp++;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
83 *dp = NULL;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
84 execv(selected_simtool, exec_argv);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
85 fprintf(stderr, "Unable to exec %s\n", selected_simtool);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
86 exit(1);
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 }
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 main(argc, argv)
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 char **argv;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 {
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 extern char *optarg;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 extern int optind;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 int c;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
96 while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:nP:t:T:v:")) != EOF)
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 switch (c) {
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 case 'a':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 iramimage.filename = optarg;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 case 'b':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 set_romload_baudrate(optarg);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 case 'B':
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
105 session_baudrate = find_baudrate_by_name(optarg);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
106 if (!session_baudrate)
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 exit(1); /* error msg already printed */
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 case 'c':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 set_compalstage_short(optarg);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 case 'C':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 set_compalstage_fullpath(optarg);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 case 'h':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 read_hwparam_file_shortname(optarg);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 case 'H':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 read_hwparam_file_fullpath(optarg);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 continue;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 case 'i':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 set_beacon_interval(optarg);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 continue;
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
124 case 'n':
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
125 sim_allow_spenh = 0;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
126 continue;
575
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 574
diff changeset
127 case 'P':
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 574
diff changeset
128 if (find_bootctrl_entry(optarg) < 0)
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 574
diff changeset
129 exit(1); /* error msg already printed */
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 574
diff changeset
130 continue;
683
ecea01f65146 loadtools: implemented -t option for boot ROM wait timeout
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
131 case 't':
ecea01f65146 loadtools: implemented -t option for boot ROM wait timeout
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
132 set_romload_timeout(optarg);
ecea01f65146 loadtools: implemented -t option for boot ROM wait timeout
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
133 continue;
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
134 case 'T':
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
135 tool_select_arg(optarg);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
136 continue;
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
137 case 'v':
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
138 voltage_select_arg(optarg);
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
139 continue;
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 case '?':
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 default:
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 usage: fprintf(stderr,
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
143 "usage: fc-simint [options] ttyport [batch command]\n");
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 exit(1);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 }
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
146 if (argc - optind < 1)
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 goto usage;
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 target_ttydev = argv[optind];
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 if (!iramimage.filename)
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
150 iramimage.filename = simagent_pathname;
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 open_serial_port(target_ttydev);
575
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 574
diff changeset
153 pwon_if_needed();
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 perform_compal_stage();
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 perform_romload();
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
156 /* simagent target program should be running now */
793
02490e26f53d fc-simint: cosmetic enhancements
Mychaela Falconia <falcon@freecalypso.org>
parents: 790
diff changeset
157 putchar('\n');
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 if (tpinterf_pass_output(1) < 0)
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 exit(1);
793
02490e26f53d fc-simint: cosmetic enhancements
Mychaela Falconia <falcon@freecalypso.org>
parents: 790
diff changeset
160 putchar('\n');
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
161 if (session_baudrate && session_baudrate != current_baud_rate) {
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
162 c = loadagent_switch_baud(session_baudrate);
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 if (c)
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 exit(1);
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 }
790
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
166 do_sim_up();
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
167 sim_atr_validate();
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
168 sim_spenh_logic();
0bbe0213812d fc-simint put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 789
diff changeset
169 exec_simtool(argc - optind - 1, argv + optind + 1);
548
2e4ab60919b9 fc-dspromdump front end program implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 }