comparison 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
comparison
equal deleted inserted replaced
440:631d273bb65e 441:b23743555ca8
1 /*
2 * This C module is a reconstruction based on the disassembly of
3 * os_sem.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 extern T_OS_SEM_TABLE_ENTRY SemTable[];
18
19 static NU_SEMAPHORE SemSemCB;
20
21 static int
22 os_GetSemaphoreEntry(USHORT Index, OS_HANDLE *Handle)
23 {
24 static USHORT Idx;
25
26 if (Index == FIRST_ENTRY)
27 Idx = 0;
28 if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) {
29 for (;;) {
30 Idx++;
31 if (Idx > MaxSemaphores)
32 return(OS_ERROR);
33 if (SemTable[Idx].Name[0])
34 break;
35 }
36 } else
37 Idx = Index;
38 if (Idx > MaxSemaphores)
39 return(OS_ERROR);
40 if (SemTable[Idx].Name[0]) {
41 *Handle = Idx;
42 return(OS_OK);
43 } else
44 return(OS_ERROR);
45 }