FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osl/os_mem_fl.c @ 371:8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Fri, 30 May 2014 19:50:24 +0000 |
parents | 37e19cbbbc8d |
children | 47391b5c15ff |
comparison
equal
deleted
inserted
replaced
370:37e19cbbbc8d | 371:8df6f38d2f3a |
---|---|
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; | 25 static USHORT Idx; |
26 static T_OS_PART_POOL *part_pool; | |
27 static int grp_hndl; | |
28 static NU_SEMAPHORE MemSemCB; | 26 static NU_SEMAPHORE MemSemCB; |
29 static NU_MEMORY_POOL mem_pool_head; | 27 static NU_MEMORY_POOL mem_pool_head; |
30 | 28 |
31 GLOBAL LONG | 29 GLOBAL LONG |
32 os_SetPoolHandles(OS_HANDLE ext_pool_handle, OS_HANDLE int_pool_handle) | 30 os_SetPoolHandles(OS_HANDLE ext_pool_handle, OS_HANDLE int_pool_handle) |
33 { | 31 { |
34 os_ext_pool_handle = ext_pool_handle; | 32 os_ext_pool_handle = ext_pool_handle; |
35 os_int_pool_handle = int_pool_handle; | 33 os_int_pool_handle = int_pool_handle; |
36 return(OS_OK); | 34 return(OS_OK); |
37 } | 35 } |
36 | |
37 static int | |
38 os_GetPartitionPoolEntry(USHORT Index, T_OS_PART_POOL **pool) | |
39 { | |
40 static T_OS_PART_POOL *part_pool; | |
41 static int grp_hndl; | |
42 | |
43 switch (Index) { | |
44 case FIRST_ENTRY: | |
45 grp_hndl = 0; | |
46 *pool = part_pool = PartGrpTable[0].grp_head; | |
47 return(OS_OK); | |
48 case NEXT_ENTRY: | |
49 if (part_pool->next) { | |
50 *pool = part_pool = part_pool->next; | |
51 return(OS_OK); | |
52 } | |
53 grp_hndl++; | |
54 if (PartGrpTable[grp_hndl].grp_head) { | |
55 *pool = part_pool = PartGrpTable[grp_hndl].grp_head; | |
56 return(OS_OK); | |
57 } else | |
58 return(OS_ERROR); | |
59 default: | |
60 return(OS_ERROR); | |
61 } | |
62 } | |
63 | |
64 GLOBAL LONG | |
65 os_PartitionInformation(USHORT Handle, char *Buffer) | |
66 { | |
67 T_OS_PART_POOL *pool; | |
68 OPTION SuspendType; | |
69 UNSIGNED PoolSize; | |
70 UNSIGNED PartitionSize; | |
71 UNSIGNED Available; | |
72 UNSIGNED Waiting; | |
73 UNSIGNED Allocated; | |
74 VOID *pStartAddress; | |
75 NU_TASK *First; | |
76 CHAR Name[8]; | |
77 | |
78 if (os_GetPartitionPoolEntry(Handle, &pool) == OS_ERROR) | |
79 return(OS_ERROR); | |
80 if (NU_Partition_Pool_Information(&pool->pcb, Name, &pStartAddress, | |
81 &PoolSize, &PartitionSize, &Available, | |
82 &Allocated, &SuspendType, &Waiting, | |
83 &First) | |
84 != NU_SUCCESS) | |
85 return(OS_ERROR); | |
86 sprintf(Buffer, | |
87 "Name:%s Addr:%lx PoolSize:%ld PartSize:%ld Free:%ld Used:%ld", | |
88 Name, (UNSIGNED) pStartAddress, PoolSize, PartitionSize, | |
89 Available, Allocated); | |
90 return(OS_OK); | |
91 } |