annotate target-utils/simagent/spenh.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 b761029f9c03
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
779
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <sys/types.h>
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <strings.h>
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include "types.h"
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include "simregs.h"
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
786
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
6 extern int sim_if_state;
779
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 extern u16 conf1_reg;
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
786
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
9 const u8 pts_for_spenh[4] = {0xFF, 0x10, 0x94, 0x7B};
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
10
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
11 void
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
12 cmd_spenh()
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
13 {
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
14 int rc;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
15 unsigned count;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
16
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
17 if (sim_if_state != 2) {
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
18 printf("ERROR: SIM interface is not up\n");
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
19 return;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
20 }
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
21 if (conf1_reg & SIM_CONF1_ETU) {
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
22 printf("ERROR: speed enhancement is already on\n");
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
23 return;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
24 }
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
25 rc = flush_rx_fifo();
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
26 if (rc < 0)
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
27 return;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
28 rc = send_to_sim(pts_for_spenh, 4);
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
29 if (rc < 0)
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
30 return;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
31 for (count = 0; count < 4; count++) {
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
32 rc = rx_sim_byte_hl();
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
33 if (rc < 0)
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
34 return;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
35 if (rc != pts_for_spenh[count]) {
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
36 printf("ERROR: PTS response does not match request\n");
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
37 return;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
38 }
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
39 }
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
40 SIMREGS.conf1 = conf1_reg |= SIM_CONF1_ETU;
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
41 }
b761029f9c03 simagent: spenh command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 779
diff changeset
42
779
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 void
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 cmd_set_spenh(argbulk)
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 char *argbulk;
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 {
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 char *argv[2];
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 if (parse_args(argbulk, 1, 1, argv, 0) < 0)
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 return;
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 if (!strcmp(argv[0], "0"))
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 SIMREGS.conf1 = conf1_reg &= ~SIM_CONF1_ETU;
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 else if (!strcmp(argv[0], "1"))
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 SIMREGS.conf1 = conf1_reg |= SIM_CONF1_ETU;
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 else
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 printf("ERROR: \"0\" or \"1\" argument expected\n");
8196bba46318 simagent: set-spenh test command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 }