FreeCalypso > hg > freecalypso-sw
changeset 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 | e63ab4a97e24 |
children | 5bc6a8f8b4a8 |
files | gsm-fw/gpf/osl/Makefile gsm-fw/gpf/osl/os_com_fl.c |
diffstat | 2 files changed, 65 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/Makefile Thu May 08 02:58:05 2014 +0000 +++ b/gsm-fw/gpf/osl/Makefile Thu May 08 05:47:38 2014 +0000 @@ -4,7 +4,7 @@ XOPTS= -DRUN_FLASH -mthumb IOBJS= os_pro_ir.o -XOBJS= os_isr.o os_pro_fl.o +XOBJS= os_com_fl.o os_isr.o os_pro_fl.o all: ${IOBJS} ${XOBJS}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/osl/os_com_fl.c Thu May 08 05:47:38 2014 +0000 @@ -0,0 +1,64 @@ +/* + * This C module is a reconstruction based on the disassembly of + * os_com.obj in frame_na7_db_fl.lib from the Leonardo package. + */ + +/* set of included headers from COFF symtab: */ +#include <stdio.h> +#include <string.h> +#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" + +typedef unsigned char u_char; + +extern T_OS_COM_TABLE_ENTRY ComTable[]; + +static NU_SEMAPHORE ComSemCB; +static USHORT entry = 0; + +static int +os_GetQueueEntry(USHORT Index, OS_HANDLE *Handle) +{ + static USHORT Idx; + + if (Index == FIRST_ENTRY) + Idx = 0; + if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) { + while (++Idx <= MaxCommunications && !ComTable[Idx].Name[0]) + ; + } else + Idx = Index; + if (Idx <= MaxCommunications && ComTable[Idx].Name[0]) { + *Handle = Idx; + return(0); + } else + return(-1); +} + +GLOBAL LONG +os_QueueInformation(USHORT Index, char *Buffer) +{ + OS_HANDLE Handle; + T_OS_COM_TABLE_ENTRY *ent; + UNSIGNED Used; + OPTION SuspendType; + UNSIGNED TasksWaiting; + NU_TASK *First; + CHAR Name[NU_MAX_NAME]; + + if (os_GetQueueEntry(Index, &Handle) < 0) + return(OS_ERROR); + ent = ComTable + Handle; + if (NU_Semaphore_Information(&ent->UsedSemCB, Name, &Used, &SuspendType, + &TasksWaiting, &First) != NU_SUCCESS) + return(OS_ERROR); + sprintf(Buffer, "Name:%s Startadr:%lx Entries:%d Used:%ld MaxUsed:%d", + ent->Name, (ULONG)ent->pQueueMemory, ent->Entries, (LONG)Used, + ent->MaxUsed); + return(OS_OK); +}