FreeCalypso > hg > freecalypso-hwlab
annotate fteeprom/test/fteeprom-prog-bad.c @ 104:a60645b75a57
fc-simtool: phonebook dump implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 25 Jan 2021 05:55:40 +0000 |
parents | 86db7b4bfca4 |
children |
rev | line source |
---|---|
77
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This "bad" version of fteeprom-prog is being presented in order to show |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * what happens on FT232R chips when a certain magic sequence is omitted. |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <ctype.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdio.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdlib.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <unistd.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <ftdi.h> |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 unsigned eeprom_size; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 u_short eeprom[256]; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 read_eeprom_common(inf, filename_for_errs) |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 FILE *inf; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 char *filename_for_errs; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 char linebuf[1024], *cp; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 int lineno, rc; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 unsigned ptr = 0, input_off; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 for (cp = linebuf; isspace(*cp); cp++) |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 if (*cp == '\0' || *cp == '#') |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 continue; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 if (ptr >= 256) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 fprintf(stderr, |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 "%s line %d: maximum EEPROM size exceeded\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 filename_for_errs, lineno); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 rc = sscanf(linebuf, "%x: %hx %hx %hx %hx %hx %hx %hx %hx", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 &input_off, eeprom + ptr, eeprom + ptr + 1, |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 eeprom + ptr + 2, eeprom + ptr + 3, |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 eeprom + ptr + 4, eeprom + ptr + 5, |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 eeprom + ptr + 6, eeprom + ptr + 7); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 if (rc != 9 || input_off != ptr * 2) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 fprintf(stderr, "%s line %d: invalid input\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 filename_for_errs, lineno); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 ptr += 8; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 if (ptr != 64 && ptr != 128 && ptr != 256) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 fprintf(stderr, "%s: not an EEPROM image of recognized size\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 filename_for_errs); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 eeprom_size = ptr; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 read_eeprom_from_file(filename) |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 char *filename; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 FILE *inf; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 inf = fopen(filename, "r"); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 if (!inf) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 perror(filename); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 read_eeprom_common(inf, filename); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 fclose(inf); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 read_eeprom_from_stdin() |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 read_eeprom_common(stdin, "stdin"); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 main(argc, argv) |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 char **argv; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 struct ftdi_context ftdi; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 u_short modem_status; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 unsigned n; |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 if (argc < 2 || argc > 3) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 fprintf(stderr, "usage: %s device-selector [eeprom-image]\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 argv[0]); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 if (argv[2]) |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 read_eeprom_from_file(argv[2]); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 else |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 read_eeprom_from_stdin(); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 ftdi_init(&ftdi); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 if (ftdi_usb_open_string(&ftdi, argv[1]) < 0) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 fprintf(stderr, "FTDI USB open failed: %s\n", ftdi.error_str); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 #if 0 /* FT232R magic sequence omitted! */ |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 if (ftdi_usb_reset(&ftdi) < 0) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 fprintf(stderr, "ftdi_usb_reset() failed: %s\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 ftdi.error_str); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 if (ftdi_poll_modem_status(&ftdi, &modem_status) < 0) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 fprintf(stderr, "ftdi_poll_modem_status() failed: %s\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 ftdi.error_str); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 if (ftdi_set_latency_timer(&ftdi, 0x77) < 0) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 fprintf(stderr, "ftdi_set_latency_timer() failed: %s\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 ftdi.error_str); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 #endif |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 for (n = 0; n < eeprom_size; n++) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 if (ftdi_write_eeprom_location(&ftdi, n, eeprom[n]) < 0) { |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 fprintf(stderr, "EEPROM write error: %s\n", |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 ftdi.error_str); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 exit(1); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 } |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 ftdi_usb_close(&ftdi); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 exit(0); |
86db7b4bfca4
fteeprom-prog-bad: make the "bad" version easily accessible for testing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 } |