FreeCalypso > hg > freecalypso-sw
comparison loadtools/sertool.c @ 9:fea204bc7674
fc-sertool compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 01 May 2013 02:43:17 +0000 |
parents | |
children | 24b88c119465 |
comparison
equal
deleted
inserted
replaced
8:acaac9162574 | 9:fea204bc7674 |
---|---|
1 /* | |
2 * This module contains the main() function for fc-sertool: the simplest | |
3 * of the FreeCalypso loading tools, which sends the user-specified | |
4 * IRAM SREC image to the boot ROM and then switches into serial tty | |
5 * 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 | |
18 main(argc, argv) | |
19 char **argv; | |
20 { | |
21 extern char *optarg; | |
22 extern int optind; | |
23 int c; | |
24 | |
25 while ((c = getopt(argc, argv, "i:")) != EOF) | |
26 switch (c) { | |
27 case 'i': | |
28 set_beacon_interval(optarg); | |
29 continue; | |
30 case '?': | |
31 default: | |
32 usage: fprintf(stderr, | |
33 "usage: fc-sertool [-i beacon-interval] ttyport iramimage.srec\n"); | |
34 exit(1); | |
35 } | |
36 if (argc - optind != 2) | |
37 goto usage; | |
38 target_ttydev = argv[optind]; | |
39 iramimage.filename = argv[optind+1]; | |
40 | |
41 open_target_serial(); | |
42 perform_romload(); | |
43 tty_passthru(); | |
44 exit(0); | |
45 } |