annotate loadtools/lacrc32.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 5385aca4d813
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
640
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the function for getting a CRC-32 computation
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * from loadagent.
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdint.h>
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdlib.h>
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 extern char target_response_line[];
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 crc32_on_target(area_base, area_len, retptr)
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 u_long area_base, area_len, *retptr;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 char arg1[10], arg2[10], *argv[4];
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 int stat;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 char *strtoul_endp;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 sprintf(arg1, "%lx", area_base);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 sprintf(arg2, "%lx", area_len);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 argv[0] = "crc32";
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 argv[1] = arg1;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 argv[2] = arg2;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 argv[3] = 0;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 tpinterf_make_cmd(argv);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 if (tpinterf_send_cmd() < 0)
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 return(-1);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 stat = tpinterf_capture_output_oneline(10); /* 10 s timeout */
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 if (stat != 1) {
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 errout: fprintf(stderr, "error: malformed response to crc32 command\n");
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 return(-1);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 if (strlen(target_response_line) != 8)
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 goto errout;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 *retptr = strtoul(target_response_line, &strtoul_endp, 16);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 if (strtoul_endp != target_response_line + 8)
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 goto errout;
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 return(0);
5385aca4d813 fc-loadtool module refactoring: CRC-32 functions split out
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }