# HG changeset patch # User Michael Spacefalcon # Date 1401581392 0 # Node ID 47391b5c15fff8e2f9c63ffa858f106afd4d7202 # Parent 8df6f38d2f3a5cbe0a2b3c40b1c6391910b5885e os_mem_fl.c: os_MemoryInformation() done diff -r 8df6f38d2f3a -r 47391b5c15ff gsm-fw/gpf/osl/os_mem_fl.c --- a/gsm-fw/gpf/osl/os_mem_fl.c Fri May 30 19:50:24 2014 +0000 +++ b/gsm-fw/gpf/osl/os_mem_fl.c Sun Jun 01 00:09:52 2014 +0000 @@ -22,7 +22,6 @@ OS_HANDLE os_int_pool_handle; static USHORT NumOfMemoryPools; -static USHORT Idx; static NU_SEMAPHORE MemSemCB; static NU_MEMORY_POOL mem_pool_head; @@ -89,3 +88,49 @@ Available, Allocated); return(OS_OK); } + +static int +os_GetMemoryPoolEntry(USHORT Index, OS_HANDLE *Handle) +{ + static USHORT Idx; + + switch (Index) { + case FIRST_ENTRY: + Idx = 0; + break; + case NEXT_ENTRY: + Idx++; + break; + default: + Idx = Index; + } + if (Idx == NumOfMemoryPools) + return(OS_ERROR); + *Handle = Idx; + return(OS_OK); +} + +GLOBAL LONG +os_MemoryInformation(USHORT Index, char *Buffer) +{ + OS_HANDLE Handle; + OPTION SuspendType; + UNSIGNED Size, Min, Available, Waiting; + VOID *pStartAddress; + NU_TASK *First; + CHAR Name[8]; + + if (os_GetMemoryPoolEntry(Index, &Handle) == OS_ERROR) + return(OS_ERROR); + if (NU_Memory_Pool_Information(MemPoolTable[Handle].pcb, Name, + &pStartAddress, &Size, &Min, + &Available, &SuspendType, &Waiting, + &First) + != NU_SUCCESS) + return(OS_ERROR); + sprintf(Buffer, + "Heapname:%s Addr:%lx Size:%ld Min:%ld Free:%ld Suspend:%d", + Name, (UNSIGNED) pStartAddress, Size, Min, Available, + SuspendType); + return(OS_OK); +}