FreeCalypso > hg > fc-usbser-tools
annotate cp2102/decode_baudtab_main.c @ 106:de3b299561b3
udev: add rules file that works on my system
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Oct 2023 01:08:28 +0000 |
parents | 4890ded06a8b |
children |
rev | line source |
---|---|
58
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program reads a CP2102 EEPROM image from an Intel HEX file |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * and decodes the baud rate table contained therein. |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include "cp210x_defs.h" |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 u_char eeprom[SIZE_EEPROM]; |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 main(argc, argv) |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 char **argv; |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 { |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 if (argc != 2) { |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 fprintf(stderr, "usage: %s ihex-file\n", argv[0]); |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 exit(1); |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 } |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 read_intel_hex(argv[1]); |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 decode_baud_table(stdout); |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 exit(0); |
4890ded06a8b
cp2102-decode-baudtab program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } |