FreeCalypso > hg > freecalypso-tools
comparison loadtools/romload.c @ 250:8c011177adb9
loadtools reworked to use factored-out libserial
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 21 Sep 2017 23:07:01 +0000 |
parents | e7502631a0f9 |
children | aba969153d20 |
comparison
equal
deleted
inserted
replaced
249:d0a4c05d98dc | 250:8c011177adb9 |
---|---|
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <strings.h> | 13 #include <strings.h> |
14 #include <termios.h> | 14 #include <termios.h> |
15 #include <unistd.h> | 15 #include <unistd.h> |
16 #include "baudrate.h" | 16 #include "../libserial/baudrate.h" |
17 #include "srecreader.h" | 17 #include "srecreader.h" |
18 | 18 |
19 extern int errno; | 19 extern int errno; |
20 | 20 |
21 extern char *target_ttydev; | 21 extern char *target_ttydev; |
177 unsigned long rec_count; | 177 unsigned long rec_count; |
178 static int zero = 0; | 178 static int zero = 0; |
179 | 179 |
180 if (open_srec_file(&iramimage) < 0) | 180 if (open_srec_file(&iramimage) < 0) |
181 exit(1); | 181 exit(1); |
182 set_fixed_baudrate("19200"); | |
182 ioctl(target_fd, FIONBIO, &zero); | 183 ioctl(target_fd, FIONBIO, &zero); |
183 send_beacons(); | 184 send_beacons(); |
184 printf("Got beacon response, attempting download\n"); | 185 printf("Got beacon response, attempting download\n"); |
185 | 186 |
186 usleep(SERIAL_FLUSH_DELAY * 1000); | 187 usleep(SERIAL_FLUSH_DELAY * 1000); |
201 resp); | 202 resp); |
202 exit(1); | 203 exit(1); |
203 } | 204 } |
204 printf("<p command successful, switching to %s baud\n", | 205 printf("<p command successful, switching to %s baud\n", |
205 romload_baud_rate->name); | 206 romload_baud_rate->name); |
206 switch_baud_rate(romload_baud_rate); | 207 set_serial_baudrate(romload_baud_rate); |
207 usleep(SERIAL_FLUSH_DELAY * 1000); | 208 usleep(SERIAL_FLUSH_DELAY * 1000); |
208 tcflush(target_fd, TCIFLUSH); | 209 tcflush(target_fd, TCIFLUSH); |
209 | 210 |
210 image_cksum = 0; | 211 image_cksum = 0; |
211 for (rec_count = 0; ; ) { | 212 for (rec_count = 0; ; ) { |