FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osl/os_com_fl.c @ 349:a163da322bc5
OSL: os_com_fl.c started
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 08 May 2014 05:47:38 +0000 |
parents | |
children | 5bc6a8f8b4a8 |
comparison
equal
deleted
inserted
replaced
348:e63ab4a97e24 | 349:a163da322bc5 |
---|---|
1 /* | |
2 * This C module is a reconstruction based on the disassembly of | |
3 * os_com.obj in frame_na7_db_fl.lib from the Leonardo package. | |
4 */ | |
5 | |
6 /* set of included headers from COFF symtab: */ | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 #include "gpfconf.h" /* FreeCalypso addition */ | |
10 #include "../../nucleus/nucleus.h" | |
11 #include "typedefs.h" | |
12 #include "os.h" | |
13 #include "gdi.h" | |
14 #include "os_types.h" | |
15 #include "os_glob.h" | |
16 | |
17 typedef unsigned char u_char; | |
18 | |
19 extern T_OS_COM_TABLE_ENTRY ComTable[]; | |
20 | |
21 static NU_SEMAPHORE ComSemCB; | |
22 static USHORT entry = 0; | |
23 | |
24 static int | |
25 os_GetQueueEntry(USHORT Index, OS_HANDLE *Handle) | |
26 { | |
27 static USHORT Idx; | |
28 | |
29 if (Index == FIRST_ENTRY) | |
30 Idx = 0; | |
31 if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) { | |
32 while (++Idx <= MaxCommunications && !ComTable[Idx].Name[0]) | |
33 ; | |
34 } else | |
35 Idx = Index; | |
36 if (Idx <= MaxCommunications && ComTable[Idx].Name[0]) { | |
37 *Handle = Idx; | |
38 return(0); | |
39 } else | |
40 return(-1); | |
41 } | |
42 | |
43 GLOBAL LONG | |
44 os_QueueInformation(USHORT Index, char *Buffer) | |
45 { | |
46 OS_HANDLE Handle; | |
47 T_OS_COM_TABLE_ENTRY *ent; | |
48 UNSIGNED Used; | |
49 OPTION SuspendType; | |
50 UNSIGNED TasksWaiting; | |
51 NU_TASK *First; | |
52 CHAR Name[NU_MAX_NAME]; | |
53 | |
54 if (os_GetQueueEntry(Index, &Handle) < 0) | |
55 return(OS_ERROR); | |
56 ent = ComTable + Handle; | |
57 if (NU_Semaphore_Information(&ent->UsedSemCB, Name, &Used, &SuspendType, | |
58 &TasksWaiting, &First) != NU_SUCCESS) | |
59 return(OS_ERROR); | |
60 sprintf(Buffer, "Name:%s Startadr:%lx Entries:%d Used:%ld MaxUsed:%d", | |
61 ent->Name, (ULONG)ent->pQueueMemory, ent->Entries, (LONG)Used, | |
62 ent->MaxUsed); | |
63 return(OS_OK); | |
64 } |