comparison loadtools/sertool.c @ 0:e7502631a0f9

initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Jun 2016 00:13:35 +0000
parents
children 064d4eedb3a6
comparison
equal deleted inserted replaced
-1:000000000000 0:e7502631a0f9
1 /*
2 * This module contains the main() function for fc-iram, previously
3 * called fc-sertool: the simplest of the FreeCalypso loading tools,
4 * which sends the user-specified IRAM SREC image to the boot ROM
5 * and then switches into serial tty pass-through.
6 */
7
8 #include <sys/types.h>
9 #include <stdint.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include "srecreader.h"
14
15 extern char *target_ttydev;
16 extern struct srecreader iramimage;
17 extern int gta_modem_poweron;
18
19 main(argc, argv)
20 char **argv;
21 {
22 extern char *optarg;
23 extern int optind;
24 int c;
25
26 while ((c = getopt(argc, argv, "b:c:C:h:H:i:n")) != EOF)
27 switch (c) {
28 case 'b':
29 set_romload_baudrate(optarg);
30 continue;
31 case 'c':
32 set_compalstage_short(optarg);
33 continue;
34 case 'C':
35 set_compalstage_fullpath(optarg);
36 continue;
37 case 'h':
38 read_hwparam_file_shortname(optarg);
39 continue;
40 case 'H':
41 read_hwparam_file_fullpath(optarg);
42 continue;
43 case 'i':
44 set_beacon_interval(optarg);
45 continue;
46 case 'n':
47 gta_modem_poweron = 0;
48 continue;
49 case '?':
50 default:
51 usage: fprintf(stderr,
52 "usage: fc-iram [options] ttyport iramimage.srec\n");
53 exit(1);
54 }
55 if (argc - optind != 2)
56 goto usage;
57 target_ttydev = argv[optind];
58 iramimage.filename = argv[optind+1];
59
60 open_target_serial();
61 perform_compal_stage(1);
62 perform_romload();
63 tty_passthru();
64 exit(0);
65 }