FreeCalypso > hg > freecalypso-tools
annotate target-utils/simagent/byterx.c @ 776:fac3176de18d
simagent: bare Tx implemented
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 12 Mar 2021 23:36:46 +0000 |
| parents | 9c1d580b50fb |
| children | badc5399d641 |
| rev | line source |
|---|---|
|
771
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include <stdlib.h> |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 #include "types.h" |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include "simregs.h" |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 rx_sim_byte(count) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 unsigned count; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 { |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 for (; count; count--) { |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 if (!(SIMREGS.stat & SIM_STAT_FEMPTY)) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 return SIMREGS.drx; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 } |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 return(-1); |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 } |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 void |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 cmd_sertimeout(argbulk) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 char *argbulk; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 { |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 char *argv[2]; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 int count; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (parse_args(argbulk, 1, 1, argv, 0) < 0) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 return; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 count = atoi(argv[0]); |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 rx_sim_byte(count); |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 } |
