FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osl/os_mem_fl.c @ 372:47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 01 Jun 2014 00:09:52 +0000 |
parents | 8df6f38d2f3a |
children | 5f7d723b9343 |
comparison
equal
deleted
inserted
replaced
371:8df6f38d2f3a | 372:47391b5c15ff |
---|---|
20 | 20 |
21 OS_HANDLE os_ext_pool_handle; | 21 OS_HANDLE os_ext_pool_handle; |
22 OS_HANDLE os_int_pool_handle; | 22 OS_HANDLE os_int_pool_handle; |
23 | 23 |
24 static USHORT NumOfMemoryPools; | 24 static USHORT NumOfMemoryPools; |
25 static USHORT Idx; | |
26 static NU_SEMAPHORE MemSemCB; | 25 static NU_SEMAPHORE MemSemCB; |
27 static NU_MEMORY_POOL mem_pool_head; | 26 static NU_MEMORY_POOL mem_pool_head; |
28 | 27 |
29 GLOBAL LONG | 28 GLOBAL LONG |
30 os_SetPoolHandles(OS_HANDLE ext_pool_handle, OS_HANDLE int_pool_handle) | 29 os_SetPoolHandles(OS_HANDLE ext_pool_handle, OS_HANDLE int_pool_handle) |
87 "Name:%s Addr:%lx PoolSize:%ld PartSize:%ld Free:%ld Used:%ld", | 86 "Name:%s Addr:%lx PoolSize:%ld PartSize:%ld Free:%ld Used:%ld", |
88 Name, (UNSIGNED) pStartAddress, PoolSize, PartitionSize, | 87 Name, (UNSIGNED) pStartAddress, PoolSize, PartitionSize, |
89 Available, Allocated); | 88 Available, Allocated); |
90 return(OS_OK); | 89 return(OS_OK); |
91 } | 90 } |
91 | |
92 static int | |
93 os_GetMemoryPoolEntry(USHORT Index, OS_HANDLE *Handle) | |
94 { | |
95 static USHORT Idx; | |
96 | |
97 switch (Index) { | |
98 case FIRST_ENTRY: | |
99 Idx = 0; | |
100 break; | |
101 case NEXT_ENTRY: | |
102 Idx++; | |
103 break; | |
104 default: | |
105 Idx = Index; | |
106 } | |
107 if (Idx == NumOfMemoryPools) | |
108 return(OS_ERROR); | |
109 *Handle = Idx; | |
110 return(OS_OK); | |
111 } | |
112 | |
113 GLOBAL LONG | |
114 os_MemoryInformation(USHORT Index, char *Buffer) | |
115 { | |
116 OS_HANDLE Handle; | |
117 OPTION SuspendType; | |
118 UNSIGNED Size, Min, Available, Waiting; | |
119 VOID *pStartAddress; | |
120 NU_TASK *First; | |
121 CHAR Name[8]; | |
122 | |
123 if (os_GetMemoryPoolEntry(Index, &Handle) == OS_ERROR) | |
124 return(OS_ERROR); | |
125 if (NU_Memory_Pool_Information(MemPoolTable[Handle].pcb, Name, | |
126 &pStartAddress, &Size, &Min, | |
127 &Available, &SuspendType, &Waiting, | |
128 &First) | |
129 != NU_SUCCESS) | |
130 return(OS_ERROR); | |
131 sprintf(Buffer, | |
132 "Heapname:%s Addr:%lx Size:%ld Min:%ld Free:%ld Suspend:%d", | |
133 Name, (UNSIGNED) pStartAddress, Size, Min, Available, | |
134 SuspendType); | |
135 return(OS_OK); | |
136 } |