FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/audiocmd.c @ 619:f82551c77e58
libserial-newlnx: ASYNC_LOW_LATENCY patch reverted
Reports from Das Signal indicate that loadtools performance on Debian
is about the same as on Slackware, and that including or omitting the
ASYNC_LOW_LATENCY patch from Serg makes no difference. Because the
patch in question does not appear to be necessary, it is being reverted
until and unless someone other than Serg reports an actual real-world
system on which loadtools operation times are slowed compared to the
Mother's Slackware reference and on which Slackware-like performance
can be restored by setting the ASYNC_LOW_LATENCY flag.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 27 Feb 2020 01:09:48 +0000 |
parents | 0f2db8baf8db |
children |
rev | line source |
---|---|
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * ETM audio commands |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "limits.h" |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "localtypes.h" |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "etm.h" |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
32
diff
changeset
|
13 #include "exitcodes.h" |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
168
7b1624cdc9c0
fc-tmsh: consistent naming of audio command sending functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
167
diff
changeset
|
15 cmd_aul(argc, argv) |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 char **argv; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 u_char cmdpkt[MAX_PKT_TO_TARGET], *dp; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 int slen; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 slen = strlen(argv[1]); |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (slen > 9) { |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 printf("error: audio config name is limited to 9 chars\n"); |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
32
diff
changeset
|
24 return(ERROR_USAGE); |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 dp = cmdpkt + 1; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 *dp++ = ETM_AUDIO; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 *dp++ = 'L'; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 strcpy(dp, argv[1]); |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 dp += slen + 1; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 send_etm_cmd(cmdpkt, dp - cmdpkt - 1); |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
32
diff
changeset
|
32 return(0); |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
168
7b1624cdc9c0
fc-tmsh: consistent naming of audio command sending functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
167
diff
changeset
|
35 cmd_aus(argc, argv) |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 char **argv; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 { |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 u_char cmdpkt[MAX_PKT_TO_TARGET], *dp; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 int slen; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 slen = strlen(argv[1]); |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 if (slen > 9) { |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 printf("error: audio config name is limited to 9 chars\n"); |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
32
diff
changeset
|
44 return(ERROR_USAGE); |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 dp = cmdpkt + 1; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 *dp++ = ETM_AUDIO; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 *dp++ = 'S'; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 strcpy(dp, argv[1]); |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 dp += slen + 1; |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 send_etm_cmd(cmdpkt, dp - cmdpkt - 1); |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
32
diff
changeset
|
52 return(0); |
32
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 } |
ea061975c883
fc-tmsh: implemented sending of ETM audio load and save commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
168
7b1624cdc9c0
fc-tmsh: consistent naming of audio command sending functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
167
diff
changeset
|
55 cmd_aur(argc, argv) |
158
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
56 char **argv; |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
57 { |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
58 unsigned param; |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
59 u_char cmdpkt[5]; |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
60 |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
61 param = strtoul(argv[1], 0, 0); |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
62 if (param > 255) { |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
63 printf("error: argument is too large\n"); |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
64 return(ERROR_USAGE); |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
65 } |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
66 cmdpkt[1] = ETM_AUDIO; |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
67 cmdpkt[2] = 'R'; |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
68 cmdpkt[3] = param; |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
69 send_etm_cmd(cmdpkt, 3); |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
70 return(0); |
86e4d8aea021
fc-tmsh: aur command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
71 } |
167
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
72 |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
73 cmd_auw(argc, argv) |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
74 char **argv; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
75 { |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
76 u32 param, v; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
77 u_char cmdpkt[MAX_PKT_TO_TARGET]; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
78 int di; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
79 char **ap; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
80 |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
81 param = strtoul(argv[1], 0, 0); |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
82 if (param > 255) { |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
83 printf("error: parameter index argument is too large\n"); |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
84 return(ERROR_USAGE); |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
85 } |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
86 cmdpkt[1] = ETM_AUDIO; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
87 cmdpkt[2] = 'W'; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
88 cmdpkt[3] = param; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
89 di = 4; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
90 for (ap = argv + 2; *ap; ap++) { |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
91 v = strtol(*ap, 0, 0); |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
92 cmdpkt[di++] = v; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
93 cmdpkt[di++] = v >> 8; |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
94 } |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
95 send_etm_cmd(cmdpkt, di - 1); |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
96 return(0); |
6e4120cdb456
fc-tmsh: auw command sending implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
166
diff
changeset
|
97 } |
316
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
98 |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
99 cmd_auw_fir(argc, argv) |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
100 char **argv; |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
101 { |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
102 u_char cmdpkt[67]; |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
103 int rc; |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
104 |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
105 cmdpkt[1] = ETM_AUDIO; |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
106 cmdpkt[2] = 'W'; |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
107 if (!strcmp(argv[1], "ul")) |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
108 cmdpkt[3] = 5; /* AUDIO_MICROPHONE_FIR */ |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
109 else if (!strcmp(argv[1], "dl")) |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
110 cmdpkt[3] = 9; /* AUDIO_SPEAKER_FIR */ |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
111 else { |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
112 printf("error: first argument must be dl or ul\n"); |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
113 return(ERROR_USAGE); |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
114 } |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
115 rc = read_fir_coeff_table(argv[2], cmdpkt + 4); |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
116 if (rc) |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
117 return(rc); |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
118 send_etm_cmd(cmdpkt, 65); |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
119 return(0); |
0f2db8baf8db
fc-tmsh: auw-fir command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
168
diff
changeset
|
120 } |