FreeCalypso > hg > freecalypso-tools
annotate librftab/rdcommon.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 | a0f79bba0ad8 |
children |
rev | line source |
---|---|
314
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This C file is not a compilation unit in itself, but is the common piece |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * (a set of static variables and functions) included in the librftab modules |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * responsible for reading different kinds of ASCII tables. |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #define MAX_FIELDS_PER_LINE 64 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 static char *filename; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 static FILE *rdfile; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 static unsigned lineno; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 static char linebuf[256], *line_fields[MAX_FIELDS_PER_LINE]; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 static unsigned line_nfields, line_field_ptr; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 static int |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 read_line() |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 char *cp; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 if (!fgets(linebuf, sizeof linebuf, rdfile)) |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 return(0); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 lineno++; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 cp = linebuf; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 for (line_nfields = 0; ; ) { |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 while (isspace(*cp)) |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 cp++; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 if (*cp == '\0' || *cp == '#') |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 break; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 if (line_nfields >= MAX_FIELDS_PER_LINE) { |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 printf("%s line %d: too many fields on one line\n", |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 filename, lineno); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 return(-1); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 line_fields[line_nfields++] = cp; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 while (*cp && !isspace(*cp)) |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 cp++; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 if (*cp) |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 *cp++ = '\0'; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 return(1); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 } |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 static |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 get_field(retp) |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 char **retp; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 { |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 int rc; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 if (line_field_ptr < line_nfields) { |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 *retp = line_fields[line_field_ptr++]; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 return(1); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 } |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 do { |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 rc = read_line(); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 if (rc <= 0) |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return(rc); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 } while (!line_nfields); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 *retp = line_fields[0]; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 line_field_ptr = 1; |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 return(1); |
a0f79bba0ad8
librftab: reading of Tx ramp template files split from rftablerd module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 } |