annotate rvinterf/g23sh/sendsp.c @ 923:10b4bed10192

gsm-fw/L1: fix for the DSP patch corruption bug The L1 code we got from the LoCosto fw contains a feature for DSP CPU load measurement. This feature is a LoCosto-ism, i.e., not applicable to earlier DBB chips (Calypso) with their respective earlier DSP ROMs. Most of the code dealing with that feature is conditionalized as #if (DSP >= 38), but one spot was missed, and the MCU code was writing into an API word dealing with this feature. In TCS211 this DSP API word happens to be used by the DSP code patch, hence that write was corrupting the patched DSP code.
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 19 Oct 2015 17:13:56 +0000
parents 922efdd65dce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
336
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
2 * g23sh system primitive sending command
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 */
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <string.h>
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <strings.h>
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <stdlib.h>
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "pktmux.h"
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "limits.h"
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12
336
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
13 void
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
14 cmd_sendsp(argc, argv)
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 char **argv;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 {
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 char *stackdest, *primarg;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 unsigned intlen;
336
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
19 u_char sendpkt[MAX_PKT_TO_TARGET+1];
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 unsigned pktlen;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
336
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
22 stackdest = argv[1];
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
23 primarg = argv[2];
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
24 if (strlen(stackdest) > 4) {
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
25 printf(
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
26 "error: stack destination arg may not exceed 4 characters\n");
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
27 return;
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 }
336
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
29 intlen = 12 + strlen(primarg);
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 pktlen = intlen + 4;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 if (pktlen > MAX_PKT_TO_TARGET) {
336
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
32 printf("error: max pkt to target limit exceeded\n");
922efdd65dce g23sh written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 328
diff changeset
33 return;
328
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 }
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 /* fill out the packet */
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 sendpkt[0] = RVT_L23_HEADER;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 sendpkt[1] = 0xB7; /* system prim */
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 sendpkt[2] = intlen;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 sendpkt[3] = intlen >> 8;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 /* send zeros for the timestamp */
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 sendpkt[4] = 0;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 sendpkt[5] = 0;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 sendpkt[6] = 0;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 sendpkt[7] = 0;
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 /* as far as TI's sw is concerned, we are PCO */
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 sendpkt[8] = 'P';
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 sendpkt[9] = 'C';
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 sendpkt[10] = 'O';
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 sendpkt[11] = ' ';
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 sprintf(sendpkt + 12, "%-4s%s", stackdest, primarg);
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 /* send it! */
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 send_pkt_to_target(sendpkt, pktlen);
5d9001f0c3aa fc-sendsp: written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 }