2 ===================================================================
3 --- lfd.c (revision 1684)
4 +++ lfd.c (working copy)
5 @@ -493,6 +493,16 @@ static void ldr_send_timeout(int sig)
6 warn("received signal %i: timeout while sending; aborting", sig);
9 +static char ldr_send_prompt(const char *msg)
14 + printf("%s: ", msg);
16 + foo = scanf("%c", &dummy);
17 + return (foo == EOF ? EOF : dummy);
19 static bool ldr_load_uart(LFD *alfd, const void *void_opts)
21 const struct ldr_load_options *opts = void_opts;
22 @@ -515,10 +525,9 @@ static bool ldr_load_uart(LFD *alfd, con
26 - /* give ourselves like ten seconds to do autobaud */
27 old_alarm = signal(SIGALRM, ldr_send_timeout);
31 printf("Opening %s ... ", tty);
33 fd = open(tty, O_RDWR);
34 @@ -538,6 +547,10 @@ static bool ldr_load_uart(LFD *alfd, con
39 + ldr_send_prompt("Press any key to send autobaud");
42 printf("Trying to send autobaud ... ");
43 ret = write(fd, "@", 1);
45 @@ -545,6 +558,10 @@ static bool ldr_load_uart(LFD *alfd, con
50 + ldr_send_prompt("Press any key to read autobaud");
53 printf("Trying to read autobaud ... ");
54 ret = read_retry(fd, autobaud, 4);
56 @@ -567,10 +584,15 @@ static bool ldr_load_uart(LFD *alfd, con
57 autobaud[0], autobaud[1], autobaud[2], autobaud[3]);
61 + ldr_send_prompt("Press any key to send global LDR header");
64 printf("Sending global LDR header ... ");
65 ret = write(fd, ldr->header, ldr->header_size);
66 if (ret != (ssize_t)ldr->header_size)
72 @@ -580,6 +602,9 @@ static bool ldr_load_uart(LFD *alfd, con
73 BLOCK *block = &(ldr->dxes[d].blocks[b]);
77 + ldr_send_prompt("Press any key to send block header");
82 @@ -591,6 +616,9 @@ static bool ldr_load_uart(LFD *alfd, con
86 + if (opts->prompt && block->data != NULL)
87 + ldr_send_prompt("Press any key to send block data");
89 del += printf("%zi] (%2.0f%%)", ldr->dxes[d].num_blocks,
90 ((float)(b+1) / (float)ldr->dxes[d].num_blocks) * 100);
91 if (block->data != NULL) {
93 ===================================================================
94 --- ldr.c (revision 1684)
95 +++ ldr.c (working copy)
96 @@ -101,13 +101,15 @@ static struct option_help const create_o
98 #define show_create_usage(status) show_some_usage("create", create_long_opts, create_opts_help, CREATE_PARSE_FLAGS, status)
100 -#define LOAD_PARSE_FLAGS COMMON_FLAGS "b:f"
101 +#define LOAD_PARSE_FLAGS COMMON_FLAGS "b:p"
102 static struct option const load_long_opts[] = {
103 {"baud", a_argument, NULL, 'b'},
104 + {"prompt", no_argument, NULL, 'p'},
107 static struct option_help const load_opts_help[] = {
108 - {"Set baud rate (default 115200)", "<baud>"},
109 + {"Set baud rate (default 115200)", "<baud>"},
110 + {"Prompt for data flow", NULL},
113 #define show_load_usage(status) show_some_usage("load", load_long_opts, load_opts_help, LOAD_PARSE_FLAGS, status)
114 @@ -238,11 +240,13 @@ static bool load_ldr(const int argc, cha
115 struct ldr_load_options opts = {
121 while ((i=getopt_long(argc, argv, LOAD_PARSE_FLAGS, load_long_opts, NULL)) != -1) {
123 case 'b': opts.baud = atoi(optarg); break;
124 + case 'p': opts.prompt = true; break;
125 case 'h': show_load_usage(0);
129 ===================================================================
130 --- ldr.h (revision 1684)
131 +++ ldr.h (working copy)
132 @@ -46,6 +46,7 @@ struct ldr_create_options {
133 struct ldr_load_options {
139 struct ldr_dump_options {
141 ===================================================================
142 --- .depend (revision 1684)
143 +++ .depend (working copy)
144 @@ -11,3 +11,4 @@ lfd_bf561.o: lfd_bf561.c ldr.h headers.h
145 dxe_jump.h blackfin_defines.h ldr_elf.h
146 lfd.o: lfd.c ldr.h headers.h elf.h helpers.h lfd.h dxes.h dxe_jump.h \
147 blackfin_defines.h ldr_elf.h