FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osl/os_pro_ir.c @ 345:460ed6748e4c
OSL: os_pro_ir.c done
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 07 May 2014 18:45:50 +0000 |
parents | c51d6b3748c3 |
children | fdeea3d6582d |
comparison
equal
deleted
inserted
replaced
344:c51d6b3748c3 | 345:460ed6748e4c |
---|---|
18 | 18 |
19 extern VOID *TCD_Current_Thread; | 19 extern VOID *TCD_Current_Thread; |
20 extern T_OS_TASK_TABLE_ENTRY TaskTable[]; | 20 extern T_OS_TASK_TABLE_ENTRY TaskTable[]; |
21 extern unsigned os_time_to_tick_multiplier; | 21 extern unsigned os_time_to_tick_multiplier; |
22 | 22 |
23 #define OS_NU_TASK_MAGIC 0xdeafbeef | |
24 | |
23 VOID | 25 VOID |
24 os_TaskEntry(UNSIGNED TaskHandle, VOID *argv) | 26 os_TaskEntry(UNSIGNED TaskHandle, VOID *argv) |
25 { | 27 { |
26 TaskTable[TaskHandle].TaskEntry(TaskHandle, 0); | 28 TaskTable[TaskHandle].TaskEntry(TaskHandle, 0); |
27 } | 29 } |
35 if (!SuspendTicks) | 37 if (!SuspendTicks) |
36 SuspendTicks = 1; | 38 SuspendTicks = 1; |
37 NU_Sleep(SuspendTicks); | 39 NU_Sleep(SuspendTicks); |
38 return (OS_OK); | 40 return (OS_OK); |
39 } | 41 } |
42 | |
43 GLOBAL LONG | |
44 os_ResumeTask(OS_HANDLE task_handle) | |
45 { | |
46 if (NU_Resume_Task(&TaskTable[task_handle].TaskCB.TCB) == NU_SUCCESS) | |
47 return(OS_OK); | |
48 else | |
49 return(OS_ERROR); | |
50 } | |
51 | |
52 GLOBAL LONG | |
53 os_Relinquish(void) | |
54 { | |
55 NU_Relinquish(); | |
56 return(OS_OK); | |
57 } | |
58 | |
59 GLOBAL OS_HANDLE | |
60 os_MyHandle(void) | |
61 { | |
62 OS_NU_TASK *os_nu_task = (OS_NU_TASK *) TCD_Current_Thread; | |
63 | |
64 if (os_nu_task && os_nu_task->magic_nr == OS_NU_TASK_MAGIC) | |
65 return(os_nu_task->handle); | |
66 else | |
67 return(OS_NOTASK); | |
68 } | |
69 | |
70 GLOBAL LONG | |
71 os_GetTaskName(OS_HANDLE Caller, OS_HANDLE TaskHandle, char *Name) | |
72 { | |
73 if (TaskHandle) { | |
74 if (TaskHandle > MaxTasks || !TaskTable[TaskHandle].Name[0]) | |
75 return(OS_ERROR); | |
76 strcpy(Name, TaskTable[TaskHandle].Name); | |
77 } else if (TCD_Current_Thread) { | |
78 NU_TASK *curtask = TCD_Current_Thread; | |
79 strcpy(Name, curtask->tc_name); | |
80 } else | |
81 strcpy(Name, "ROOT"); | |
82 return(OS_OK); | |
83 } | |
84 | |
85 GLOBAL LONG | |
86 os_DeferTask(OS_HANDLE task_handle, OS_TIME time) | |
87 { | |
88 if (NU_Suspend_Task(&TaskTable[task_handle].TaskCB.TCB) == NU_SUCCESS) | |
89 return(OS_OK); | |
90 else | |
91 return(OS_ERROR); | |
92 } | |
93 | |
94 GLOBAL LONG | |
95 os_CheckTaskStack(OS_HANDLE Handle) | |
96 { | |
97 register void *sp asm("sp"); | |
98 | |
99 if (*TaskTable[Handle].Stack != GUARD_PATTERN) | |
100 return(OS_ERROR); | |
101 if (TCD_Current_Thread) { | |
102 NU_TASK *curtask = TCD_Current_Thread; | |
103 if (sp < curtask->tc_stack_start) | |
104 return(OS_ERROR); | |
105 } | |
106 return(OS_OK); | |
107 } |