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