# HG changeset patch # User Michael Spacefalcon # Date 1399012577 0 # Node ID 42bc1d7068aca100c59e7f43a0b3e4efee562726 # Parent a26470040d89b457ff1c04c66ec5a231e6ba5679 OSL reconstruction: os_pro_fl.c started diff -r a26470040d89 -r 42bc1d7068ac gsm-fw/gpf/Makefile --- a/gsm-fw/gpf/Makefile Tue Apr 22 07:42:40 2014 +0000 +++ b/gsm-fw/gpf/Makefile Fri May 02 06:36:17 2014 +0000 @@ -1,4 +1,4 @@ -SUBDIR= frame misc tst_drv tst_pei +SUBDIR= frame misc osl tst_drv tst_pei all: ${SUBDIR} diff -r a26470040d89 -r 42bc1d7068ac gsm-fw/gpf/osl/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/osl/Makefile Fri May 02 06:36:17 2014 +0000 @@ -0,0 +1,10 @@ +CC= arm-elf-gcc +CFLAGS= -O2 -fno-builtin -mthumb-interwork -mthumb +CPPFLAGS=-I../inc -DRUN_FLASH + +XOBJS= os_pro_fl.o + +all: ${XOBJS} + +clean: + rm -f *.[oa] *errs diff -r a26470040d89 -r 42bc1d7068ac gsm-fw/gpf/osl/os_pro_fl.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/osl/os_pro_fl.c Fri May 02 06:36:17 2014 +0000 @@ -0,0 +1,72 @@ +/* + * This C module is a reconstruction based on the disassembly of + * os_pro.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" + +typedef unsigned char u_char; + +extern T_OS_TASK_TABLE_ENTRY TaskTable[]; + +/* .bss */ +static NU_SEMAPHORE ProSemCB; + +static int +os_GetTaskEntry(USHORT Index, OS_HANDLE *Handle) +{ + static USHORT Idx; + + if (Index == FIRST_ENTRY) + Idx = 0; + if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) { + while (++Idx <= MaxTasks && !TaskTable[Idx].Name[0]) + ; + } else + Idx = Index; + if (Idx <= MaxTasks && TaskTable[Idx].Name[0]) { + *Handle = Idx; + return(0); + } else + return(-1); +} + +GLOBAL LONG +os_TaskInformation(USHORT Index, char *Buffer) +{ + DATA_ELEMENT TaskStatus; + OPTION Prio, Preempt; + UNSIGNED Count, TimeSlice, Size, MinStack; + OS_HANDLE Handle; + CHAR Name[NU_MAX_NAME]; + u_char *StackBase, *sp; + USHORT Untouched; + + if (os_GetTaskEntry(Index, &Handle) < 0) + return(-1); + if (NU_Task_Information(&TaskTable[Handle].TaskCB.TCB, Name, + &TaskStatus, &Count, &Prio, &Preempt, + &TimeSlice, (VOID **) &StackBase, + &Size, &MinStack) != NU_SUCCESS) + return(-1); + Untouched = 0; + for (sp = StackBase; sp < StackBase + Size; sp++) { + if (*sp != 0xFE) + break; + Untouched++; + } + sprintf(Buffer, + "Name:%s Stat:%d Count:%ld Prio:%d Stack:%lx Size:%ld Untouched:%d", + Name, TaskStatus, Count, 255 - Prio, (ULONG) StackBase, + (ULONG) Size, Untouched); + return(0); +}