annotate rvinterf/tmsh/oneshot.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 27c41e4b21ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
71
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the one-shot mode of operation for fc-tmsh.
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/errno.h>
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <unistd.h>
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "exitcodes.h"
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 extern int oneshot_nowait;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 extern int sock;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern int got_tm_response;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 oneshot_command(argc, argv)
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 char **argv;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 fd_set fds;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 int rc;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 if (!oneshot_nowait)
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 init(); /* to catch the response properly */
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 rc = dispatch_oneshot_cmd(argc, argv);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 if (rc)
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 exit(rc);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (oneshot_nowait)
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 exit(0);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 /* wait for response */
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 for (;;) {
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 FD_ZERO(&fds);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 FD_SET(sock, &fds);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 rc = select(sock+1, &fds, 0, 0, 0);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 if (rc < 0) {
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 if (errno == EINTR)
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 continue;
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 perror("select");
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 exit(ERROR_UNIX);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 }
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 if (FD_ISSET(sock, &fds))
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 handle_rvinterf_input();
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 if (got_tm_response)
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 exit(0);
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }
27c41e4b21ae fc-tmsh one-shot operation mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }