FreeCalypso > hg > freecalypso-tools
annotate target-utils/simagent/byterx.c @ 1014:961efadd530a default tip
fc-shell TCH DL handler: add support for CSD modes
TCH DL capture mechanism in FC Tourmaline firmware has been extended
to support CSD modes in addition to speech - add the necessary support
on the host tools side.
It needs to be noted that this mechanism in its present state does NOT
provide the debug utility value that was sought: as we learned only
after the code was implemented, TI's DSP has a misfeature in that the
buffer we are reading (a_dd_0[]) is zeroed out when the IDS block
is enabled, i.e., we are reading all zeros and not the real DL bits
we were after. But since the code has already been written, we are
keeping it - perhaps we can do some tests with IDS disabled.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Tue, 26 Nov 2024 06:27:43 +0000 |
| parents | c136a1a2474b |
| children |
| 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" |
|
783
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
4 #include "timeout.h" |
|
771
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 rx_sim_byte(count) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 unsigned count; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 { |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 for (; count; count--) { |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 if (!(SIMREGS.stat & SIM_STAT_FEMPTY)) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 return SIMREGS.drx; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 } |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 return(-1); |
|
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 |
|
783
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
16 rx_sim_byte_hl() |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
17 { |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
18 int rc; |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
19 unsigned parcnt; |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
20 |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
21 for (parcnt = 0; parcnt < 3; parcnt++) { |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
22 rc = rx_sim_byte(SIM_WAIT_TIMEOUT); |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
23 if (rc < 0) { |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
24 printf("ERROR: timeout waiting for SIM response\n"); |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
25 return(-1); |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
26 } |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
27 if (rc & 0x100) |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
28 return rc & 0xFF; |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
29 } |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
30 printf("ERROR: received bad parity 3 times in a row\n"); |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
31 return(-1); |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
32 } |
|
c136a1a2474b
simagent: initial implementation of APDU exchange
Mychaela Falconia <falcon@freecalypso.org>
parents:
782
diff
changeset
|
33 |
|
782
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
34 flush_rx_fifo() |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
35 { |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
36 unsigned count; |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
37 |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
38 for (count = 0; ; ) { |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
39 if (SIMREGS.stat & SIM_STAT_FEMPTY) |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
40 break; |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
41 (void) SIMREGS.drx; |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
42 if (++count >= 32) { |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
43 printf("ERROR: Rx FIFO flush does not end\n"); |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
44 return(-1); |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
45 } |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
46 } |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
47 return(0); |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
48 } |
|
badc5399d641
simagent: flush_rx_fifo() factored out
Mychaela Falconia <falcon@freecalypso.org>
parents:
771
diff
changeset
|
49 |
|
771
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 void |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 cmd_sertimeout(argbulk) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 char *argbulk; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 { |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 char *argv[2]; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 int count; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 if (parse_args(argbulk, 1, 1, argv, 0) < 0) |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 return; |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 count = atoi(argv[0]); |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 rx_sim_byte(count); |
|
9c1d580b50fb
simagent: Rx byte timeout test implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 } |
