FreeCalypso > hg > freecalypso-sw
annotate target-utils/libcommon/cmd_w16.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 | 4c78fc688127 |
children |
rev | line source |
---|---|
16
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * w16 hexaddr xxxx -- write a 16-bit register or memory location |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <sys/types.h> |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include "types.h" |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 void |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 cmd_w16(argbulk) |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 char *argbulk; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 { |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 char *argv[3]; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 u_long addr, data; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 if (parse_args(argbulk, 2, 2, argv, 0) < 0) |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 return; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 if (parse_hexarg(argv[0], 8, &addr) < 0) { |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 printf("ERROR: arg1 must be a valid 32-bit hex address\n"); |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 return; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 } |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 if (addr & 1) { |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 printf("ERROR: unaligned address\n"); |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 return; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 } |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 if (parse_hexarg(argv[1], 4, &data) < 0) { |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 printf("ERROR: arg2 must be a valid 16-bit hex value\n"); |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 return; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 } |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 *(volatile u16 *)addr = data; |
4c78fc688127
w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 } |