FreeCalypso > hg > freecalypso-sw
annotate 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 |
rev | line source |
---|---|
370
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * os_mem.obj in frame_na7_db_fl.lib from the Leonardo package. |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /* set of included headers from COFF symtab: */ |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <string.h> |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "gpfconf.h" /* FreeCalypso addition */ |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "../../nucleus/nucleus.h" |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "typedefs.h" |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "os.h" |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "gdi.h" |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "os_types.h" |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "os_glob.h" |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 extern T_OS_PART_GRP_TABLE_ENTRY PartGrpTable[]; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 extern T_OS_MEM_POOL_TABLE_ENTRY MemPoolTable[]; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 extern T_OS_POOL_BORDER PoolBorder[]; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 OS_HANDLE os_ext_pool_handle; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 OS_HANDLE os_int_pool_handle; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 static USHORT NumOfMemoryPools; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 static USHORT Idx; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 static NU_SEMAPHORE MemSemCB; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 static NU_MEMORY_POOL mem_pool_head; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 GLOBAL LONG |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 os_SetPoolHandles(OS_HANDLE ext_pool_handle, OS_HANDLE int_pool_handle) |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 { |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 os_ext_pool_handle = ext_pool_handle; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 os_int_pool_handle = int_pool_handle; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 return(OS_OK); |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 } |
371
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
36 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
37 static int |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
38 os_GetPartitionPoolEntry(USHORT Index, T_OS_PART_POOL **pool) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
39 { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
40 static T_OS_PART_POOL *part_pool; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
41 static int grp_hndl; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
42 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
43 switch (Index) { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
44 case FIRST_ENTRY: |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
45 grp_hndl = 0; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
46 *pool = part_pool = PartGrpTable[0].grp_head; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
47 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
48 case NEXT_ENTRY: |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
49 if (part_pool->next) { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
50 *pool = part_pool = part_pool->next; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
51 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
52 } |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
53 grp_hndl++; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
54 if (PartGrpTable[grp_hndl].grp_head) { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
55 *pool = part_pool = PartGrpTable[grp_hndl].grp_head; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
56 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
57 } else |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
58 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
59 default: |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
60 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
61 } |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
62 } |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
63 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
64 GLOBAL LONG |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
65 os_PartitionInformation(USHORT Handle, char *Buffer) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
66 { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
67 T_OS_PART_POOL *pool; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
68 OPTION SuspendType; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
69 UNSIGNED PoolSize; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
70 UNSIGNED PartitionSize; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
71 UNSIGNED Available; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
72 UNSIGNED Waiting; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
73 UNSIGNED Allocated; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
74 VOID *pStartAddress; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
75 NU_TASK *First; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
76 CHAR Name[8]; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
77 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
78 if (os_GetPartitionPoolEntry(Handle, &pool) == OS_ERROR) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
79 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
80 if (NU_Partition_Pool_Information(&pool->pcb, Name, &pStartAddress, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
81 &PoolSize, &PartitionSize, &Available, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
82 &Allocated, &SuspendType, &Waiting, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
83 &First) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
84 != NU_SUCCESS) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
85 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
86 sprintf(Buffer, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
87 "Name:%s Addr:%lx PoolSize:%ld PartSize:%ld Free:%ld Used:%ld", |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
88 Name, (UNSIGNED) pStartAddress, PoolSize, PartitionSize, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
89 Available, Allocated); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
90 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
91 } |