annotate loadtools/ltscript.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 358785799844
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This module contains the code that implements the loadtool scripting
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * functionality: init-script setting and the exec command.
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <sys/param.h>
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdio.h>
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <strings.h>
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <stdlib.h>
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 extern char default_helpers_dir[];
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 loadtool_exec_script(script_name)
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 char *script_name;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 {
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 char pathbuf[MAXPATHLEN], *openfname;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 FILE *f;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 char linebuf[512], *cp;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 int lineno, retval = 0;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 if (index(script_name, '/'))
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 openfname = script_name;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 else {
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 sprintf(pathbuf, "%s/%s", default_helpers_dir, script_name);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 openfname = pathbuf;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 }
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 f = fopen(openfname, "r");
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 if (!f) {
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 perror(openfname);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 return(-1);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 }
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 for (lineno = 1; fgets(linebuf, sizeof linebuf, f); lineno++) {
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 cp = index(linebuf, '\n');
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 if (!cp) {
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 fprintf(stderr, "%s line %d: missing newline\n",
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 openfname, lineno);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 fclose(f);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 return(-1);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 }
31
358785799844 loadtool scripting: cosmetic buglet
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 29
diff changeset
41 *cp = '\0';
29
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 retval = loadtool_dispatch_cmd(linebuf, 1);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 if (retval)
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 break;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 }
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 fclose(f);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 return(retval);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 }
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 cmd_exec(argc, argv)
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 char **argv;
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 {
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 return loadtool_exec_script(argv[1]);
dacf45e3d20f loadtool: scripting functionality implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 }