FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osl/os_evt.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 | 43ca9d5e30cb |
children |
rev | line source |
---|---|
366
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * os_evt.obj in frame_na7_db_fl.lib from the Leonardo package. |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /* set of included headers from COFF symtab: */ |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <string.h> |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "gpfconf.h" /* FreeCalypso addition */ |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "../../nucleus/nucleus.h" |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "typedefs.h" |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "os.h" |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "gdi.h" |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "os_types.h" |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "os_glob.h" |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 extern T_OS_EVTGRP_TABLE_ENTRY EvtGrpTable[]; |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 GLOBAL LONG |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 os_SetEvents(OS_HANDLE evt_grp_handle, unsigned event_flags) |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 { |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 if (!EvtGrpTable[evt_grp_handle].Name[0]) |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 return(OS_ERROR); |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 if (NU_Set_Events(&EvtGrpTable[evt_grp_handle].EvtGrp, event_flags, |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 NU_OR) == NU_SUCCESS) |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 return(OS_OK); |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 else |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 return(OS_ERROR); |
227bc7a1c305
OSL: os_evt.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 } |
367
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
30 |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
31 GLOBAL LONG |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
32 os_RetrieveEvents(OS_HANDLE evt_grp_handle, unsigned event_flags, char option, |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
33 unsigned *retrieved_events, unsigned suspend) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
34 { |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
35 if (!EvtGrpTable[evt_grp_handle].Name[0]) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
36 return(OS_ERROR); |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
37 if (NU_Retrieve_Events(&EvtGrpTable[evt_grp_handle].EvtGrp, |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
38 event_flags, option, retrieved_events, suspend) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
39 == NU_SUCCESS) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
40 return(OS_OK); |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
41 else |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
42 return(OS_ERROR); |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
43 } |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
44 |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
45 GLOBAL LONG |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
46 os_GetEventGroupHandle(char *evt_grp_name, OS_HANDLE *evt_grp_handle) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
47 { |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
48 int idx; |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
49 |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
50 for (idx = 0; idx <= MaxEventGroups; idx++) { |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
51 if (!EvtGrpTable[idx].Name[0]) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
52 break; |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
53 if (!strncmp(EvtGrpTable[idx].Name, evt_grp_name, |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
54 RESOURCE_NAMELEN)) |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
55 break; |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
56 } |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
57 if (idx > MaxEventGroups || !EvtGrpTable[idx].Name[0]) { |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
58 *evt_grp_handle = -1; |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
59 return(OS_ERROR); |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
60 } |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
61 *evt_grp_handle = idx; |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
62 return(OS_OK); |
c72feb362ef1
os_evt.c: got some bogus-looking code, decompiled as-is
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
366
diff
changeset
|
63 } |
368
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
64 |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
65 GLOBAL LONG |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
66 os_EventGroupInformation(OS_HANDLE evt_grp_handle, char *Name, |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
67 unsigned *mask_evt, unsigned *tasks_waiting, |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
68 OS_HANDLE *first_task) |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
69 { |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
70 if (!EvtGrpTable[evt_grp_handle].Name[0]) |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
71 return(OS_ERROR); |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
72 if (NU_Event_Group_Information(&EvtGrpTable[evt_grp_handle].EvtGrp, |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
73 Name, mask_evt, tasks_waiting, |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
74 first_task) == NU_SUCCESS) |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
75 return(OS_OK); |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
76 else |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
77 return(OS_ERROR); |
43ca9d5e30cb
os_evt.c: os_EventGroupInformation(): more bogosity
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
367
diff
changeset
|
78 } |