# HG changeset patch # User Michael Spacefalcon # Date 1403483029 0 # Node ID b23743555ca8d4e31e76174cb07f2797791cffe7 # Parent 631d273bb65e9902106bb9f93f302d45a8b78982 OSL: os_sem_fl.c started diff -r 631d273bb65e -r b23743555ca8 gsm-fw/gpf/osl/Makefile --- a/gsm-fw/gpf/osl/Makefile Sun Jun 22 23:22:55 2014 +0000 +++ b/gsm-fw/gpf/osl/Makefile Mon Jun 23 00:23:49 2014 +0000 @@ -4,7 +4,7 @@ XOPTS= -DRUN_FLASH -mthumb IOBJS= os_com_ir.o os_mem_ir.o os_mis_ir.o os_pro_ir.o -XOBJS= os_com_fl.o os_drv.o os_isr.o os_mem_fl.o os_pro_fl.o +XOBJS= os_com_fl.o os_drv.o os_isr.o os_mem_fl.o os_pro_fl.o os_sem_fl.o all: ${IOBJS} ${XOBJS} diff -r 631d273bb65e -r b23743555ca8 gsm-fw/gpf/osl/os_sem_fl.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/osl/os_sem_fl.c Mon Jun 23 00:23:49 2014 +0000 @@ -0,0 +1,45 @@ +/* + * This C module is a reconstruction based on the disassembly of + * os_sem.obj in frame_na7_db_fl.lib from the Leonardo package. + */ + +/* set of included headers from COFF symtab: */ +#include +#include +#include "gpfconf.h" /* FreeCalypso addition */ +#include "../../nucleus/nucleus.h" +#include "typedefs.h" +#include "os.h" +#include "gdi.h" +#include "os_types.h" +#include "os_glob.h" + +extern T_OS_SEM_TABLE_ENTRY SemTable[]; + +static NU_SEMAPHORE SemSemCB; + +static int +os_GetSemaphoreEntry(USHORT Index, OS_HANDLE *Handle) +{ + static USHORT Idx; + + if (Index == FIRST_ENTRY) + Idx = 0; + if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) { + for (;;) { + Idx++; + if (Idx > MaxSemaphores) + return(OS_ERROR); + if (SemTable[Idx].Name[0]) + break; + } + } else + Idx = Index; + if (Idx > MaxSemaphores) + return(OS_ERROR); + if (SemTable[Idx].Name[0]) { + *Handle = Idx; + return(OS_OK); + } else + return(OS_ERROR); +}