annotate serial/atrmain.c @ 81:8c23d2a9c013

doc/GrcardSIM2-programming: update for fcsim1-program
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 09 Apr 2021 08:35:54 +0000
parents fbedb67d234f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the main() function for fcsim-serial-atr utility.
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
40
8f505d413815 serial: full baud/spenh argument parsing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 38
diff changeset
8 extern unsigned baud_base;
8f505d413815 serial: full baud/spenh argument parsing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 38
diff changeset
9
38
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 main(argc, argv)
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 char **argv;
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 int rc;
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 if (argc != 3) {
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 fprintf(stderr, "usage: %s ttyport baud\n", argv[0]);
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 exit(1);
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 }
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 open_serial_port(argv[1]);
40
8f505d413815 serial: full baud/spenh argument parsing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 38
diff changeset
20 parse_baud_spenh_arg(argv[2]);
53
fbedb67d234f serial: fix parity for inverse coding convention
Mychaela Falconia <falcon@freecalypso.org>
parents: 40
diff changeset
21 set_serial_params(baud_base, -1);
38
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 set_serial_nonblock(0);
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 serial_card_reset();
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 rc = collect_atr();
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 if (rc < 0)
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 exit(1);
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 print_atr("ATR:");
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 exit(0);
1d96f3b4f155 serial: started with fcsim-serial-atr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }