annotate target-utils/simtest/poll.c @ 574:aba969153d20

loadtools code: removed provisions for special GTA02 AP build
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 02 Feb 2020 19:37:50 +0000
parents d96ea6ae6aa5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
454
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <sys/types.h>
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <strings.h>
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include "types.h"
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include "simregs.h"
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 extern int serial_in_poll();
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 int enable_poll;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 void
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 poll_sim_rx()
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 u32 drx;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
457
d96ea6ae6aa5 simtest: setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 454
diff changeset
15 if (SIMREGS.stat & SIM_STAT_FEMPTY)
454
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 return;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 drx = SIMREGS.drx & 0xFF;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 printf("%02X ", drx);
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 }
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 int
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 mygetchar()
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 register int c;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 do {
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (enable_poll)
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 poll_sim_rx();
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 c = serial_in_poll();
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 }
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 while (c < 0);
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 return c;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 void
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 cmd_poll(argbulk)
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 char *argbulk;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 {
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 char *argv[2];
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 if (parse_args(argbulk, 1, 1, argv, 0) < 0)
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 return;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 if (!strcmp(argv[0], "on"))
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 enable_poll = 1;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 else if (!strcmp(argv[0], "off"))
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 enable_poll = 0;
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 else
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 printf("ERROR: \"on\" or \"off\" argument expected\n");
daaab2701761 target-utils: simtest program started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 }