annotate gsm-fw/gpf/osl/os_sem_fl.c @ 441:b23743555ca8

OSL: os_sem_fl.c started
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 23 Jun 2014 00:23:49 +0000
parents
children 0dbc1795ff42
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This C module is a reconstruction based on the disassembly of
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * os_sem.obj in frame_na7_db_fl.lib from the Leonardo package.
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 /* set of included headers from COFF symtab: */
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdio.h>
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "gpfconf.h" /* FreeCalypso addition */
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "../../nucleus/nucleus.h"
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "typedefs.h"
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include "os.h"
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #include "gdi.h"
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "os_types.h"
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 #include "os_glob.h"
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 extern T_OS_SEM_TABLE_ENTRY SemTable[];
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 static NU_SEMAPHORE SemSemCB;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 static int
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 os_GetSemaphoreEntry(USHORT Index, OS_HANDLE *Handle)
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 {
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 static USHORT Idx;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 if (Index == FIRST_ENTRY)
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 Idx = 0;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) {
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 for (;;) {
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 Idx++;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 if (Idx > MaxSemaphores)
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 return(OS_ERROR);
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 if (SemTable[Idx].Name[0])
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 break;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 }
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 } else
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 Idx = Index;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 if (Idx > MaxSemaphores)
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 return(OS_ERROR);
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 if (SemTable[Idx].Name[0]) {
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 *Handle = Idx;
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 return(OS_OK);
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 } else
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 return(OS_ERROR);
b23743555ca8 OSL: os_sem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 }