FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osl/os_mem_fl.c @ 975:0d7cc054ef72
rvinterf/lowlevel: updates for the new knowledge of TM predating ETM
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 15 Nov 2015 04:26:10 +0000 |
parents | 3adb4154f02f |
children |
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 NU_SEMAPHORE MemSemCB; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 static NU_MEMORY_POOL mem_pool_head; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 GLOBAL LONG |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 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
|
30 { |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 os_ext_pool_handle = ext_pool_handle; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 os_int_pool_handle = int_pool_handle; |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 return(OS_OK); |
37e19cbbbc8d
OSL: os_mem_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 } |
371
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
35 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
36 static int |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
37 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
|
38 { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
39 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
|
40 static int grp_hndl; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
41 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
42 switch (Index) { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
43 case FIRST_ENTRY: |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
44 grp_hndl = 0; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
45 *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
|
46 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
47 case NEXT_ENTRY: |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
48 if (part_pool->next) { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
49 *pool = part_pool = part_pool->next; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
50 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
51 } |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
52 grp_hndl++; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
53 if (PartGrpTable[grp_hndl].grp_head) { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
54 *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
|
55 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
56 } else |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
57 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
58 default: |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
59 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
60 } |
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 GLOBAL LONG |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
64 os_PartitionInformation(USHORT Handle, char *Buffer) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
65 { |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
66 T_OS_PART_POOL *pool; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
67 OPTION SuspendType; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
68 UNSIGNED PoolSize; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
69 UNSIGNED PartitionSize; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
70 UNSIGNED Available; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
71 UNSIGNED Waiting; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
72 UNSIGNED Allocated; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
73 VOID *pStartAddress; |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
74 NU_TASK *First; |
377
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
75 CHAR Name[NU_MAX_NAME]; |
371
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
76 |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
77 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
|
78 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
79 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
|
80 &PoolSize, &PartitionSize, &Available, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
81 &Allocated, &SuspendType, &Waiting, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
82 &First) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
83 != NU_SUCCESS) |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
84 return(OS_ERROR); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
85 sprintf(Buffer, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
86 "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
|
87 Name, (UNSIGNED) pStartAddress, PoolSize, PartitionSize, |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
88 Available, Allocated); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
89 return(OS_OK); |
8df6f38d2f3a
os_mem_fl.c: os_PartitionInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
370
diff
changeset
|
90 } |
372
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
91 |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
92 static int |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
93 os_GetMemoryPoolEntry(USHORT Index, OS_HANDLE *Handle) |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
94 { |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
95 static USHORT Idx; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
96 |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
97 switch (Index) { |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
98 case FIRST_ENTRY: |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
99 Idx = 0; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
100 break; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
101 case NEXT_ENTRY: |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
102 Idx++; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
103 break; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
104 default: |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
105 Idx = Index; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
106 } |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
107 if (Idx == NumOfMemoryPools) |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
108 return(OS_ERROR); |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
109 *Handle = Idx; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
110 return(OS_OK); |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
111 } |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
112 |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
113 GLOBAL LONG |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
114 os_MemoryInformation(USHORT Index, char *Buffer) |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
115 { |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
116 OS_HANDLE Handle; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
117 OPTION SuspendType; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
118 UNSIGNED Size, Min, Available, Waiting; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
119 VOID *pStartAddress; |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
120 NU_TASK *First; |
377
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
121 CHAR Name[NU_MAX_NAME]; |
372
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
122 |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
123 if (os_GetMemoryPoolEntry(Index, &Handle) == OS_ERROR) |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
124 return(OS_ERROR); |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
125 if (NU_Memory_Pool_Information(MemPoolTable[Handle].pcb, Name, |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
126 &pStartAddress, &Size, &Min, |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
127 &Available, &SuspendType, &Waiting, |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
128 &First) |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
129 != NU_SUCCESS) |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
130 return(OS_ERROR); |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
131 sprintf(Buffer, |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
132 "Heapname:%s Addr:%lx Size:%ld Min:%ld Free:%ld Suspend:%d", |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
133 Name, (UNSIGNED) pStartAddress, Size, Min, Available, |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
134 SuspendType); |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
135 return(OS_OK); |
47391b5c15ff
os_mem_fl.c: os_MemoryInformation() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
371
diff
changeset
|
136 } |
373
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
137 |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
138 GLOBAL LONG |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
139 os_MemInit(void) |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
140 { |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
141 USHORT i; |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
142 |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
143 if (NU_Create_Semaphore(&MemSemCB, "MEMSEM", 1, NU_PRIORITY) |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
144 != NU_SUCCESS) |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
145 return(OS_ERROR); |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
146 for (i = 0; i <= MaxPoolGroups; i++) { |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
147 PoolBorder[i].Start = (char *)0xFFFFFFFF; |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
148 PoolBorder[i].End = (char *)0; |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
149 PartGrpTable[i].grp_head = 0; |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
150 PartGrpTable[i].name[0] = 0; |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
151 } |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
152 MemPoolTable[0].pcb = &mem_pool_head; |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
153 return(OS_OK); |
5f7d723b9343
os_mem_fl.c: os_MemInit() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
372
diff
changeset
|
154 } |
374
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
155 |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
156 void |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
157 os_InitPartitionCheck(T_OS_PART_POOL *pool) |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
158 { |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
159 unsigned **Buffer, offset; |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
160 USHORT i, k; |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
161 |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
162 NU_Allocate_Memory(MemPoolTable[0].pcb, (VOID **) &Buffer, |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
163 pool->pcb.pm_available * sizeof(unsigned *), |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
164 NU_NO_SUSPEND); |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
165 offset = pool->pcb.pm_partition_size / sizeof(unsigned) - 1; |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
166 for (i = 0; ; i++) { |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
167 if (NU_Allocate_Partition(&pool->pcb, (VOID **)(Buffer + i), |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
168 NU_NO_SUSPEND) |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
169 != NU_SUCCESS) |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
170 break; |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
171 Buffer[i][offset] = GUARD_PATTERN; |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
172 } |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
173 for (k = 0; k < i; k++) |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
174 if (NU_Deallocate_Partition(Buffer[k]) != NU_SUCCESS) |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
175 break; |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
176 NU_Deallocate_Memory(Buffer); |
3efb28578dad
os_mem_fl.c: os_InitPartitionCheck() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
373
diff
changeset
|
177 } |
375
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
178 |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
179 GLOBAL const ULONG * |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
180 os_GetPrimpoolCB(int grp, int id) |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
181 { |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
182 T_OS_PART_POOL *pool; |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
183 int i; |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
184 |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
185 pool = PartGrpTable[grp].grp_head; |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
186 if (!pool) |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
187 return(0); |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
188 if (id < 0) |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
189 return(0); |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
190 for (i = 0; i < id; i++) { |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
191 pool = pool->next; |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
192 if (!pool) |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
193 return(0); |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
194 } |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
195 return (const ULONG *) &pool->pcb; |
1319bd1d5ac3
os_mem_fl.c: os_GetPrimpoolCB() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
374
diff
changeset
|
196 } |
376
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
197 |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
198 GLOBAL LONG |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
199 os_GetPartitionPoolStatus(ULONG size, OS_HANDLE gr_hndl, |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
200 USHORT *m_free, USHORT *m_alloc) |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
201 { |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
202 T_OS_PART_POOL *pool; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
203 UNSIGNED dummy, allocated, available; |
377
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
204 CHAR Name[NU_MAX_NAME]; |
376
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
205 |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
206 for (pool = PartGrpTable[gr_hndl].grp_head; pool; pool = pool->next) { |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
207 if (!size) |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
208 break; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
209 if (size > pool->size) |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
210 continue; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
211 if (NU_Partition_Pool_Information(&pool->pcb, Name, |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
212 (VOID **)&dummy, &dummy, |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
213 &dummy, &available, |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
214 &allocated, (OPTION *)&dummy, |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
215 &dummy, (NU_TASK **)&dummy) |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
216 != NU_SUCCESS) |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
217 break; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
218 *m_alloc = allocated; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
219 *m_free = available; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
220 return(OS_OK); |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
221 } |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
222 *m_alloc = 0; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
223 *m_free = 0; |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
224 return(OS_ERROR); |
754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
375
diff
changeset
|
225 } |
377
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
226 |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
227 GLOBAL LONG |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
228 os_GetPartitionGroupHandle(OS_HANDLE Caller, char *Name, OS_HANDLE *GroupHandle) |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
229 { |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
230 int i; |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
231 |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
232 for (i = 0; i <= MaxPoolGroups; i++) { |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
233 if (!PartGrpTable[i].grp_head) |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
234 continue; |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
235 if (strncmp(Name, PartGrpTable[i].name, RESOURCE_NAMELEN-1)) |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
236 continue; |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
237 *GroupHandle = i; |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
238 return(OS_OK); |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
239 } |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
240 return(OS_ERROR); |
d148403013c0
os_mem_fl.c: os_GetPartitionGroupHandle() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
376
diff
changeset
|
241 } |
396
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
242 |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
243 GLOBAL LONG |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
244 os_DeallocateMemory(OS_HANDLE TaskHandle, T_VOID_STRUCT *Buffer) |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
245 { |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
246 if (NU_Deallocate_Memory(Buffer) == NU_SUCCESS) |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
247 return(OS_OK); |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
248 else |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
249 return(OS_ERROR); |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
250 } |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
251 |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
252 GLOBAL LONG |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
253 os_AllocateMemory(OS_HANDLE TaskHandle, T_VOID_STRUCT **Buffer, ULONG Size, |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
254 ULONG Suspend, OS_HANDLE PoolHandle) |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
255 { |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
256 int ret, sts; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
257 |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
258 if (Suspend == 0xFFFFFFFF) |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
259 Suspend = 1; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
260 ret = OS_OK; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
261 for (;;) { |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
262 sts = NU_Allocate_Memory(MemPoolTable[PoolHandle].pcb, Buffer, |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
263 Size, Suspend); |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
264 switch (sts) { |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
265 case NU_SUCCESS: |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
266 return(ret); |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
267 case NU_INVALID_SUSPEND: |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
268 Suspend = 0; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
269 continue; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
270 case NU_NO_MEMORY: |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
271 case NU_TIMEOUT: |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
272 if (Suspend == 1) { |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
273 Suspend = 0xFFFFFFFF; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
274 ret = OS_WAITED; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
275 continue; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
276 } else { |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
277 *Buffer = 0; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
278 return(OS_TIMEOUT); |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
279 } |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
280 default: |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
281 /* |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
282 * Disassembly reveals that the original code |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
283 * has an endless loop here, the equivalent |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
284 * of continue. My guess is that they simply |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
285 * forgot the default case, and so control |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
286 * falls onto the closing brace of the switch |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
287 * and then onto the closing brace of the for |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
288 * loop. But I prefer better error handling, |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
289 * hence the present addition. - Space Falcon |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
290 */ |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
291 *Buffer = 0; |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
292 return(OS_ERROR); |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
293 } |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
294 } |
c82d093a2b89
os_mem_fl.c: os_AllocateMemory() and os_DeallocateMemory()
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
377
diff
changeset
|
295 } |
397
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
296 |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
297 GLOBAL LONG |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
298 os_CreatePartitionPool(OS_HANDLE TaskHandle, char *GroupName, void *Addr, |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
299 USHORT Num, ULONG Size, OS_HANDLE *GroupHandle) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
300 { |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
301 STATUS sts; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
302 T_OS_PART_POOL *part_group_head, *opool, *npool; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
303 USHORT part_group; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
304 USHORT i, j; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
305 char PoolName[8], *cp; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
306 |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
307 sts = NU_Obtain_Semaphore(&MemSemCB, NU_SUSPEND); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
308 j = 0; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
309 part_group_head = 0; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
310 for (i = 0; i <= MaxPoolGroups; i++) { |
475
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
311 if (!PartGrpTable[i].grp_head || !PartGrpTable[i].name[0]) |
397
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
312 break; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
313 if (!strncmp(GroupName, PartGrpTable[i].name, |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
314 RESOURCE_NAMELEN - 1)) { |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
315 part_group_head = PartGrpTable[i].grp_head; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
316 opool = part_group_head; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
317 j++; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
318 while (opool->next) { |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
319 opool = opool->next; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
320 j++; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
321 } |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
322 break; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
323 } |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
324 } |
475
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
325 /* |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
326 * This error check logic has been modified from the original |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
327 * faithful reconstruction by Space Falcon. In the original code |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
328 * if MaxPoolGroups had been reached and the for loop above |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
329 * never broke, the code would proceed to overwrite pool #0 |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
330 * instead of catching the error. |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
331 */ |
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
332 if (i > MaxPoolGroups) { |
397
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
333 release_sem_return_err: |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
334 if (sts == NU_SUCCESS) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
335 NU_Release_Semaphore(&MemSemCB); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
336 return(OS_ERROR); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
337 } |
475
dcb543907cbb
os_mem_fl.c: os_CreatePartitionPool(): fixed error check logic
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
399
diff
changeset
|
338 part_group = i; |
397
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
339 if (!part_group_head) { |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
340 strncpy(PartGrpTable[part_group].name, GroupName, |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
341 RESOURCE_NAMELEN); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
342 PartGrpTable[part_group].name[RESOURCE_NAMELEN-1] = 0; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
343 } |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
344 if (os_AllocateMemory(OS_NOTASK, (T_VOID_STRUCT **) &npool, |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
345 sizeof(T_OS_PART_POOL), OS_NO_SUSPEND, |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
346 os_ext_pool_handle) != OS_OK) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
347 goto release_sem_return_err; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
348 sprintf(PoolName, "POOL%1d%1d", part_group + 1, j); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
349 Size &= ~3; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
350 npool->pool_mem = Addr; |
866
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
351 /* |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
352 * FreeCalypso: we need to bzero the PM_PCB before calling |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
353 * NU_Create_Partition_Pool() to prevent the possibility of |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
354 * Nucleus error checker failing the call because the |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
355 * signature word happens to be there already. |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
356 */ |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
357 bzero(&npool->pcb, sizeof(NU_PARTITION_POOL)); |
397
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
358 if (NU_Create_Partition_Pool(&npool->pcb, PoolName, npool->pool_mem, |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
359 POOL_SIZE(Num, Size), Size + 4, NU_FIFO) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
360 != NU_SUCCESS) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
361 goto release_sem_return_err; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
362 if (!part_group_head) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
363 PartGrpTable[part_group].grp_head = npool; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
364 else |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
365 opool->next = npool; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
366 npool->size = Size; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
367 npool->next = 0; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
368 *GroupHandle = part_group; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
369 cp = (char *) npool->pool_mem; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
370 if (PoolBorder[part_group].Start >= cp) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
371 PoolBorder[part_group].Start = cp; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
372 cp += POOL_SIZE(Num, Size); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
373 if (PoolBorder[part_group].End < cp) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
374 PoolBorder[part_group].End = cp; |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
375 os_InitPartitionCheck(npool); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
376 if (sts == NU_SUCCESS) |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
377 NU_Release_Semaphore(&MemSemCB); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
378 return(OS_OK); |
f5b9c6d63718
os_mem_fl.c: os_CreatePartitionPool() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
396
diff
changeset
|
379 } |
398
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
380 |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
381 GLOBAL LONG |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
382 os_CreatePartitionPool_fixed_pool_size(OS_HANDLE TaskHandle, char *GroupName, |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
383 void *Addr, USHORT PoolSize, |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
384 ULONG PartSize, OS_HANDLE *GroupHandle, |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
385 ULONG *NumCreated) |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
386 { |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
387 USHORT num; |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
388 |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
389 num = PoolSize / (PartSize + PT_CHKOVERHEAD + PT_OVERHEAD); |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
390 *NumCreated = num; |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
391 return os_CreatePartitionPool(TaskHandle, GroupName, Addr, num, |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
392 PartSize, GroupHandle); |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
393 } |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
394 |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
395 GLOBAL LONG |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
396 os_CreateMemoryPool(OS_HANDLE TaskHandle, char *Name, void *Addr, |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
397 ULONG PoolSize, OS_HANDLE *PoolHandle) |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
398 { |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
399 STATUS sts; |
399
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
400 USHORT i; |
398
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
401 |
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
402 sts = NU_Obtain_Semaphore(&MemSemCB, NU_SUSPEND); |
399
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
403 for (i = 0; i < NumOfMemoryPools; i++) |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
404 if (!strncmp(Name, MemPoolTable[i].name, RESOURCE_NAMELEN-1)) { |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
405 *PoolHandle = i; |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
406 if (sts == NU_SUCCESS) |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
407 NU_Release_Semaphore(&MemSemCB); |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
408 return(OS_OK); |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
409 } |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
410 if (i >= MaxMemoryPools) { |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
411 release_sem_return_err: |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
412 if (sts == NU_SUCCESS) |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
413 NU_Release_Semaphore(&MemSemCB); |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
414 return(OS_ERROR); |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
415 } |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
416 if (i) { |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
417 if (os_AllocateMemory(OS_NOTASK, |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
418 (T_VOID_STRUCT **) &MemPoolTable[i].pcb, |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
419 sizeof(NU_MEMORY_POOL), OS_NO_SUSPEND, |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
420 os_ext_pool_handle) != OS_OK) |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
421 goto release_sem_return_err; |
866
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
422 /* |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
423 * FreeCalypso: we need to bzero the DM_PCB before calling |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
424 * NU_Create_Memory_Pool() to prevent the possibility of |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
425 * Nucleus error checker failing the call because the |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
426 * signature word happens to be there already. |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
427 */ |
3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
475
diff
changeset
|
428 bzero(MemPoolTable[i].pcb, sizeof(NU_MEMORY_POOL)); |
399
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
429 } |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
430 if (NU_Create_Memory_Pool(MemPoolTable[i].pcb, Name, Addr, PoolSize, |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
431 4, NU_FIFO) != NU_SUCCESS) |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
432 goto release_sem_return_err; |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
433 strncpy(MemPoolTable[i].name, Name, RESOURCE_NAMELEN); |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
434 MemPoolTable[i].name[RESOURCE_NAMELEN-1] = 0; |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
435 *PoolHandle = i; |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
436 NumOfMemoryPools++; |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
437 if (sts == NU_SUCCESS) |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
438 NU_Release_Semaphore(&MemSemCB); |
d26a9e3de626
OSL: os_mem_fl.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
398
diff
changeset
|
439 return(OS_OK); |
398
2dc9f34e3036
os_mem_fl.c: os_CreateMemoryPool() started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
397
diff
changeset
|
440 } |