FreeCalypso > hg > freecalypso-sw
changeset 422:833e8fa93330
fc-loadtool -r (reattach) option implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 19 Jun 2014 00:57:02 +0000 |
parents | 4f8a9b2229e9 |
children | 2e699aa67f03 |
files | loadtools/ltmain.c |
diffstat | 1 files changed, 23 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/loadtools/ltmain.c Thu Jun 19 00:23:28 2014 +0000 +++ b/loadtools/ltmain.c Thu Jun 19 00:57:02 2014 +0000 @@ -16,6 +16,10 @@ extern void (*default_exit)(); extern int gta_modem_poweron; +extern struct baudrate *find_baudrate_by_name(); + +static struct baudrate *reattach; + main(argc, argv) char **argv; { @@ -24,7 +28,7 @@ int c; char command[512]; - while ((c = getopt(argc, argv, "a:b:c:C:h:H:i:n")) != EOF) + while ((c = getopt(argc, argv, "a:b:c:C:h:H:i:nr:")) != EOF) switch (c) { case 'a': iramimage.filename = optarg; @@ -50,6 +54,11 @@ case 'n': gta_modem_poweron = 0; continue; + case 'r': + reattach = find_baudrate_by_name(optarg); + if (!reattach) + exit(1); /* error msg already printed */ + continue; case '?': default: usage: fprintf(stderr, @@ -63,15 +72,19 @@ iramimage.filename = default_loadagent_image; open_target_serial(); - perform_compal_stage(1); - perform_romload(); - putchar('\n'); - if (tpinterf_pass_output(1) < 0) - exit(1); - putchar('\n'); - if (hw_init_script[0]) { - printf("Executing init script %s\n", hw_init_script); - loadtool_exec_script(hw_init_script); + if (reattach) + switch_baud_rate(reattach); + else { + perform_compal_stage(1); + perform_romload(); + putchar('\n'); + if (tpinterf_pass_output(1) < 0) + exit(1); + putchar('\n'); + if (hw_init_script[0]) { + printf("Executing init script %s\n", hw_init_script); + loadtool_exec_script(hw_init_script); + } } for (;;) { if (isatty(0)) {