FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osl/os_pro_fl.c @ 535:30f2e994fcb0
gsm-fw/L1/include/l1_macro.h: #include lines preened
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 02 Aug 2014 01:15:25 +0000 |
parents | 1c94c36ca3e4 |
children |
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 |
341
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
19 extern VOID *TCD_Current_Thread; |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 extern T_OS_TASK_TABLE_ENTRY TaskTable[]; |
341
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
21 extern VOID os_TaskEntry(UNSIGNED, VOID *); |
338
42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
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++) { |
341
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
66 if (*sp != INITIAL_STACK_VALUE) |
338
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 } |
340
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
154 |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
155 GLOBAL LONG |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
156 os_GetScheduleCount(OS_HANDLE task_handle, int *schedule_count) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
157 { |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
158 NU_TASK *task_cb; |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
159 |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
160 if (task_handle > MaxTasks) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
161 return(OS_ERROR); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
162 if (!TaskTable[task_handle].Name[0]) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
163 return(OS_ERROR); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
164 if (task_handle == OS_NOTASK) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
165 task_cb = (NU_TASK *) TCD_Current_Thread; |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
166 else |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
167 task_cb = &TaskTable[task_handle].TaskCB.TCB; |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
168 *schedule_count = task_cb->tc_scheduled; |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
169 return(OS_OK); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
170 } |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
171 |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
172 GLOBAL LONG |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
173 os_DestroyTask(OS_HANDLE Caller, OS_HANDLE TaskHandle) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
174 { |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
175 STATUS sts; |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
176 |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
177 if (NU_Terminate_Task(&TaskTable[TaskHandle].TaskCB.TCB) != NU_SUCCESS) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
178 return(OS_ERROR); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
179 if (NU_Delete_Task(&TaskTable[TaskHandle].TaskCB.TCB) != NU_SUCCESS) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
180 return(OS_ERROR); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
181 if (os_DeallocateMemory(Caller, TaskTable[TaskHandle].Stack) != OS_OK) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
182 return(OS_ERROR); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
183 sts = NU_Obtain_Semaphore(&ProSemCB, NU_SUSPEND); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
184 TaskTable[TaskHandle].Name[0] = 0; |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
185 if (sts == NU_SUCCESS) |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
186 NU_Release_Semaphore(&ProSemCB); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
187 return(OS_OK); |
de7141ad907e
OSL: os_GetScheduleCount() and os_DestroyTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
339
diff
changeset
|
188 } |
341
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
189 |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
190 GLOBAL LONG |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
191 os_CreateTask(OS_HANDLE Caller, char *Name, |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
192 void (*TaskEntry)(OS_HANDLE, ULONG), ULONG StackSize, |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
193 USHORT Priority, OS_HANDLE *TaskHandle, OS_HANDLE MemPoolHandle) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
194 { |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
195 STATUS sem_sts; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
196 USHORT Handle; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
197 u_char *stack; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
198 |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
199 sem_sts = NU_Obtain_Semaphore(&ProSemCB, NU_SUSPEND); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
200 for (Handle = 1; Handle <= MaxTasks; Handle++) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
201 if (!TaskTable[Handle].Name[0]) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
202 break; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
203 if (Handle > MaxTasks) { |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
204 return_error: if (sem_sts == NU_SUCCESS) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
205 NU_Release_Semaphore(&ProSemCB); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
206 return(OS_ERROR); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
207 } |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
208 if (os_AllocateMemory(Handle, &TaskTable[Handle].Stack, StackSize + 4, |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
209 0, MemPoolHandle) != OS_OK) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
210 goto return_error; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
211 stack = (u_char *)TaskTable[Handle].Stack + 4; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
212 memset(stack, INITIAL_STACK_VALUE, StackSize); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
213 *TaskTable[Handle].Stack = GUARD_PATTERN; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
214 if (NU_Create_Task(&TaskTable[Handle].TaskCB.TCB, Name, os_TaskEntry, |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
215 Handle, 0, stack, StackSize, |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
216 255 - Priority, 0, NU_PREEMPT, NU_NO_START) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
217 != NU_SUCCESS) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
218 goto return_error; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
219 strncpy(TaskTable[Handle].Name, Name, RESOURCE_NAMELEN); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
220 TaskTable[Handle].Name[RESOURCE_NAMELEN-1] = 0; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
221 TaskTable[Handle].TaskEntry = TaskEntry; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
222 TaskTable[Handle].TaskCB.magic_nr = OS_NU_TASK_MAGIC; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
223 TaskTable[Handle].TaskCB.handle = Handle; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
224 *TaskHandle = Handle; |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
225 if (sem_sts == NU_SUCCESS) |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
226 NU_Release_Semaphore(&ProSemCB); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
227 return(OS_OK); |
fcbdb2ae1a47
OSL: os_CreateTask() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
340
diff
changeset
|
228 } |
342
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
229 |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
230 GLOBAL LONG |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
231 os_ChangePreemption(char preempt) |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
232 { |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
233 if (NU_Change_Preemption(preempt) == NU_SUCCESS) |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
234 return(OS_OK); |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
235 else |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
236 return(OS_ERROR); |
1c94c36ca3e4
OSL: os_pro_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
341
diff
changeset
|
237 } |