annotate cp2102/decode_baudtab_main.c @ 101:ba741a1af0e3

doc/CP2102-EEPROM-tools: article started
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 28 Sep 2023 06:35:39 +0000
parents 4890ded06a8b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }