FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osl/os_pro_fl.c @ 339:2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Fri, 02 May 2014 23:44:12 +0000 |
parents | 42bc1d7068ac |
children | de7141ad907e |
rev | line source |
---|---|
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * os_pro.obj in frame_na7_db_fl.lib from the Leonardo package. |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /* set of included headers from COFF symtab: */ |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <string.h> |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "gpfconf.h" /* FreeCalypso addition */ |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "../../nucleus/nucleus.h" |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "typedefs.h" |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "os.h" |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "gdi.h" |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "os_types.h" |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "os_glob.h" |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 typedef unsigned char u_char; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 extern T_OS_TASK_TABLE_ENTRY TaskTable[]; |
339
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
20 extern VOID *TCD_Current_Thread; |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 /* .bss */ |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 static NU_SEMAPHORE ProSemCB; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
339
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
25 #define OS_NU_TASK_MAGIC 0xdeafbeef |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
26 |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 static int |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 os_GetTaskEntry(USHORT Index, OS_HANDLE *Handle) |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 { |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 static USHORT Idx; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 if (Index == FIRST_ENTRY) |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 Idx = 0; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) { |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 while (++Idx <= MaxTasks && !TaskTable[Idx].Name[0]) |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 ; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 } else |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 Idx = Index; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 if (Idx <= MaxTasks && TaskTable[Idx].Name[0]) { |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 *Handle = Idx; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 return(0); |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 } else |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 return(-1); |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 } |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 GLOBAL LONG |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 os_TaskInformation(USHORT Index, char *Buffer) |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 { |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 DATA_ELEMENT TaskStatus; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 OPTION Prio, Preempt; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 UNSIGNED Count, TimeSlice, Size, MinStack; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 OS_HANDLE Handle; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 CHAR Name[NU_MAX_NAME]; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 u_char *StackBase, *sp; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 USHORT Untouched; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 if (os_GetTaskEntry(Index, &Handle) < 0) |
339
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
58 return(OS_ERROR); |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 if (NU_Task_Information(&TaskTable[Handle].TaskCB.TCB, Name, |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 &TaskStatus, &Count, &Prio, &Preempt, |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 &TimeSlice, (VOID **) &StackBase, |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 &Size, &MinStack) != NU_SUCCESS) |
339
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
63 return(OS_ERROR); |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 Untouched = 0; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 for (sp = StackBase; sp < StackBase + Size; sp++) { |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 if (*sp != 0xFE) |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 break; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 Untouched++; |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 } |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 sprintf(Buffer, |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 "Name:%s Stat:%d Count:%ld Prio:%d Stack:%lx Size:%ld Untouched:%d", |
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 Name, TaskStatus, Count, 255 - Prio, (ULONG) StackBase, |
339
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
73 (LONG) Size, Untouched); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
74 return(OS_OK); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
75 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
76 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
77 GLOBAL LONG |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
78 os_StopTask(OS_HANDLE Caller, OS_HANDLE TaskHandle) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
79 { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
80 if (NU_Suspend_Task(&TaskTable[TaskHandle].TaskCB.TCB) == NU_SUCCESS) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
81 return(OS_OK); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
82 else |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
83 return(OS_ERROR); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
84 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
85 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
86 GLOBAL LONG |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
87 os_StartTask(OS_HANDLE Caller, OS_HANDLE TaskHandle, ULONG Value) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
88 { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
89 if (NU_Resume_Task(&TaskTable[TaskHandle].TaskCB.TCB) == NU_SUCCESS) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
90 return(OS_OK); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
91 else |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
92 return(OS_ERROR); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
93 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
94 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
95 GLOBAL LONG |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
96 os_ProInit(void) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
97 { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
98 USHORT i; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
99 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
100 if (NU_Create_Semaphore(&ProSemCB, "PROSEM", 1, NU_PRIORITY) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
101 != NU_SUCCESS) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
102 return(OS_ERROR); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
103 for (i = 1; i <= MaxTasks; i++) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
104 bzero(&TaskTable[i], sizeof(T_OS_TASK_TABLE_ENTRY)); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
105 return(OS_OK); |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 } |
339
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
107 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
108 GLOBAL unsigned char |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
109 os_GetTaskState(OS_HANDLE Caller, OS_HANDLE Handle) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
110 { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
111 if (TaskTable[Handle].Name[0]) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
112 return(TaskTable[Handle].TaskCB.TCB.tc_status); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
113 else |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
114 return(255); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
115 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
116 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
117 GLOBAL LONG |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
118 os_GetTaskHandle(OS_HANDLE Caller, char *Name, OS_HANDLE *TaskHandle) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
119 { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
120 USHORT i; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
121 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
122 if (!Name) { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
123 OS_NU_TASK *os_nu_task = (OS_NU_TASK *) TCD_Current_Thread; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
124 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
125 if (os_nu_task && os_nu_task->magic_nr == OS_NU_TASK_MAGIC) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
126 *TaskHandle = os_nu_task->handle; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
127 else |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
128 *TaskHandle = OS_NOTASK; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
129 return(OS_OK); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
130 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
131 for (i = 1; i <= MaxTasks; i++) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
132 if (TaskTable[i].Name[0] && |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
133 !strncmp(Name, TaskTable[i].Name, RESOURCE_NAMELEN - 1)) { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
134 *TaskHandle = i; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
135 return(OS_OK); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
136 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
137 return(OS_ERROR); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
138 } |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
139 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
140 GLOBAL LONG |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
141 os_GetTaskData(OS_HANDLE Handle, unsigned **tcb, |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
142 u_char **stackbegin, u_char **stackend) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
143 { |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
144 NU_TASK *task; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
145 |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
146 if (!TaskTable[Handle].Name[0]) |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
147 return(OS_ERROR); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
148 task = &TaskTable[Handle].TaskCB.TCB; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
149 *tcb = (unsigned *) task; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
150 *stackbegin = (u_char *) task->tc_stack_start; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
151 *stackend = (u_char *) task->tc_stack_end; |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
152 return(OS_OK); |
2f88c5b89113
OSL reconstruction: got to os_GetTaskData()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
338
diff
changeset
|
153 } |