FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osl/os_pro_ir.c @ 744:20bb8855c015
rr_pei.c compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 05 Oct 2014 22:29:40 +0000 |
parents | fdeea3d6582d |
children |
rev | line source |
---|---|
343
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * os_pro.obj in frame_na7_db_ir.lib from the Leonardo package. |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /* set of included headers from COFF symtab: */ |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <string.h> |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "gpfconf.h" /* FreeCalypso addition */ |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "../../nucleus/nucleus.h" |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "typedefs.h" |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "os.h" |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "gdi.h" |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "os_types.h" |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "os_glob.h" |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 extern VOID *TCD_Current_Thread; |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 extern T_OS_TASK_TABLE_ENTRY TaskTable[]; |
344
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
19 extern unsigned os_time_to_tick_multiplier; |
343
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
345
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
21 #define OS_NU_TASK_MAGIC 0xdeafbeef |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
22 |
343
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 VOID |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 os_TaskEntry(UNSIGNED TaskHandle, VOID *argv) |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 { |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 TaskTable[TaskHandle].TaskEntry(TaskHandle, 0); |
e3a2e6e875de
OSL reconstruction: beginning of os_pro_ir.c
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 } |
344
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
28 |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
29 GLOBAL LONG |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
30 os_SuspendTask(OS_HANDLE Caller, ULONG Time) |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
31 { |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
32 UNSIGNED SuspendTicks; |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
33 |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
34 SuspendTicks = TIME_TO_SYSTEM_TICKS(Time); |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
35 if (!SuspendTicks) |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
36 SuspendTicks = 1; |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
37 NU_Sleep(SuspendTicks); |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
38 return (OS_OK); |
c51d6b3748c3
OSL: os_SuspendTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
343
diff
changeset
|
39 } |
345
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
40 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
41 GLOBAL LONG |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
42 os_ResumeTask(OS_HANDLE task_handle) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
43 { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
44 if (NU_Resume_Task(&TaskTable[task_handle].TaskCB.TCB) == NU_SUCCESS) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
45 return(OS_OK); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
46 else |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
47 return(OS_ERROR); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
48 } |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
49 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
50 GLOBAL LONG |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
51 os_Relinquish(void) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
52 { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
53 NU_Relinquish(); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
54 return(OS_OK); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
55 } |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
56 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
57 GLOBAL OS_HANDLE |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
58 os_MyHandle(void) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
59 { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
60 OS_NU_TASK *os_nu_task = (OS_NU_TASK *) TCD_Current_Thread; |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
61 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
62 if (os_nu_task && os_nu_task->magic_nr == OS_NU_TASK_MAGIC) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
63 return(os_nu_task->handle); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
64 else |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
65 return(OS_NOTASK); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
66 } |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
67 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
68 GLOBAL LONG |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
69 os_GetTaskName(OS_HANDLE Caller, OS_HANDLE TaskHandle, char *Name) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
70 { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
71 if (TaskHandle) { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
72 if (TaskHandle > MaxTasks || !TaskTable[TaskHandle].Name[0]) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
73 return(OS_ERROR); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
74 strcpy(Name, TaskTable[TaskHandle].Name); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
75 } else if (TCD_Current_Thread) { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
76 NU_TASK *curtask = TCD_Current_Thread; |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
77 strcpy(Name, curtask->tc_name); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
78 } else |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
79 strcpy(Name, "ROOT"); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
80 return(OS_OK); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
81 } |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
82 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
83 GLOBAL LONG |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
84 os_DeferTask(OS_HANDLE task_handle, OS_TIME time) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
85 { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
86 if (NU_Suspend_Task(&TaskTable[task_handle].TaskCB.TCB) == NU_SUCCESS) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
87 return(OS_OK); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
88 else |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
89 return(OS_ERROR); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
90 } |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
91 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
92 GLOBAL LONG |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
93 os_CheckTaskStack(OS_HANDLE Handle) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
94 { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
95 register void *sp asm("sp"); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
96 |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
97 if (*TaskTable[Handle].Stack != GUARD_PATTERN) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
98 return(OS_ERROR); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
99 if (TCD_Current_Thread) { |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
100 NU_TASK *curtask = TCD_Current_Thread; |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
101 if (sp < curtask->tc_stack_start) |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
102 return(OS_ERROR); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
103 } |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
104 return(OS_OK); |
460ed6748e4c
OSL: os_pro_ir.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
344
diff
changeset
|
105 } |