FreeCalypso > hg > fc-magnetite
annotate src/gpf3/frame/vsi_mem.c @ 458:48ae9825662c
doc/Compiling: update for fc-host-tools-r8 and dsample target
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 19 Mar 2018 06:52:07 +0000 |
parents | c41a534f33c6 |
children |
rev | line source |
---|---|
2
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +------------------------------------------------------------------------------ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | File: vsi_mem.c |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 +------------------------------------------------------------------------------ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 | Copyright 2002 Texas Instruments Berlin, AG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | All rights reserved. |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | This file is confidential and a trade secret of Texas |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | Instruments Berlin, AG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | The receipt of or possession of this file does not convey |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 | any rights to reproduce or disclose its contents or to |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 | manufacture, use, or sell anything it may describe, in |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 | whole, or in part, without the specific written consent of |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 | Texas Instruments Berlin, AG. |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 +----------------------------------------------------------------------------- |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 | Purpose : This Module defines the virtual system interface part |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 | for the dynamic memory pools. |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 +----------------------------------------------------------------------------- |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #ifndef __VSI_MEM_C__ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #define __VSI_MEM_C__ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 /*==== INCLUDES ===================================================*/ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "string.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include "typedefs.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "vsi.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "os.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "frm_defs.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "frm_types.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #include "frm_glob.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #include "frame.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #ifdef MEMORY_SUPERVISION |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #include "tools.h" |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 /*==== CONSTANTS ==================================================*/ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 #ifndef RUN_INT_RAM |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 char const *waited_str = "Waited for partition"; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 char const *bigger_str = "Bigger partition allocated than requested"; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 char const *free_str = "Partition Deallocation failed"; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 #else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 extern char const *waited_str; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 extern char const *bigger_str; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 extern char const *free_str; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 extern char const *freed_str; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 /*==== TYPES ======================================================*/ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 /*==== EXTERNALS ==================================================*/ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 /* -------------- S H A R E D - BEGIN ---------------- */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 #ifdef _TOOLS_ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 #pragma data_seg("FRAME_SHARED") |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 #if !defined (_TOOLS_) && !defined (_LINUX_) && !defined (_SOLARIS_) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 extern const T_FRM_PARTITION_GROUP_CONFIG partition_grp_config[]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 /*==== VARIABLES ==================================================*/ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 #ifndef RUN_INT_RAM |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 char init_partition_memory = DISABLE_PARTITON_INIT; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 char init_partition_pattern = 0; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 T_HANDLE vsi_m_sem_handle = VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 #else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 extern char init_partition_memory; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 extern char init_partition_pattern; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 extern T_HANDLE vsi_m_sem_handle; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 #ifdef _TOOLS_ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 #pragma data_seg() |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 /* -------------- S H A R E D - END ---------------- */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 /*==== FUNCTIONS ==================================================*/ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 #ifndef RUN_FLASH |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 | STATE : code ROUTINE : vsi_m_new | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 PURPOSE : allocate a partition of a pool defined by the parameter type |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 T_VOID_STRUCT * vsi_m_new (ULONG Size, ULONG type FILE_LINE_TYPE) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 LONG Status; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 T_VOID_STRUCT *prim; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 OS_HANDLE pool; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 T_HANDLE Caller; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 ULONG flags; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 ULONG suspend; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 Caller = 0; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 pool = type & VSI_MEM_POOL_MASK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 flags = type & VSI_MEM_FLAG_MASK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 if ( flags & VSI_MEM_NON_BLOCKING ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 suspend = OS_NO_SUSPEND; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 suspend = OS_SUSPEND; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 Status = os_AllocatePartition ( Caller, &prim, Size, suspend, pool ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 switch ( Status ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 case OS_OK: |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 break; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 case OS_WAITED: |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 Caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 pf_handle_warning ( OS_SYST_WRN_WAIT_PARTITION, "%s %s, entity %s, Size %d, %s(%d)", |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 syst_wrn, waited_str, pf_TaskTable[Caller].Name, Size FILE_LINE_MACRO_PASSED ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 break; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 case OS_ERROR: |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 case OS_TIMEOUT: |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 if ( !(flags & VSI_MEM_NON_BLOCKING) ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 /* fatal error for blocking allocation and 'HISR' caller */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 Caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 vsi_o_assert ( NO_TASK, OS_SYST_ERR_NO_PARTITION FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 "No Partition available, entity %s, size %d", |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 pf_TaskTable[Caller].Name, Size ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 return NULL; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 /*lint -e527 suppress Warning -- Unreachable */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 break; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 /*lint +e527 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 case OS_ALLOCATED_BIGGER: |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 Caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 pf_handle_warning ( OS_SYST_WRN_BIG_PARTITION, "%s %s, entity %s, Size %d, %s(%d)", |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 syst_wrn, bigger_str, pf_TaskTable[Caller].Name, Size FILE_LINE_MACRO_PASSED ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 break; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 default: |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 return NULL; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 /*lint -e527 suppress Warning -- Unreachable */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 break; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 /*lint +e527 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 prim = prim + PPM_OFFSET; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 if ( init_partition_memory ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 memset( (char*)prim, init_partition_pattern, (unsigned int)Size ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 #ifdef MEMORY_SUPERVISION |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 * Pools registered via vsi_m_register_pool() cannot be handle by the partition supervision. The |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 * id therefor is set to 0, to allow the supervision functions to ignore them. |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 if ( pool == DmemGroupHandle ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 /* for primitive vsi_ppm_new() is called after the opc has been entered in the header */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 Caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 vsi_ppm_new ( Caller, Size, (T_PRIM_HEADER*)prim, file, line ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 #endif /* MEMORY_SUPERVISION */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 return prim; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 #ifndef RUN_INT_RAM |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 | STATE : code ROUTINE : vsi_m_new_size | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 PURPOSE : allocate partition and retern partition size |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 T_VOID_STRUCT *vsi_m_new_size ( ULONG size, ULONG type, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 ULONG *partition_size FILE_LINE_TYPE) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 T_FRM_PARTITION_POOL_CONFIG * pool_config; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 T_VOID_STRUCT *prim; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 if ( ( prim = vsi_m_new ( size, type FILE_LINE ) ) != NULL ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 #if defined (_TOOLS_) || defined (_LINUX_) || defined (_SOLARIS_) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 *partition_size = size; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 #else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[PrimGroupHandle].grp_config; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 while ( pool_config != NULL ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 if ( size <= pool_config->part_size ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 *partition_size = pool_config->part_size; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 break; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 pool_config++; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 return (prim); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 #ifndef RUN_FLASH |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 | STATE : code ROUTINE : vsi_m_free | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 PURPOSE : deallocate a partition |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 int vsi_m_free (T_VOID_STRUCT **Msg FILE_LINE_TYPE) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 T_HANDLE Caller; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 #ifdef MEMORY_SUPERVISION |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 Caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 vsi_ppm_free ( Caller, (T_PRIM_HEADER*)*Msg, file, line ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 Caller = 0; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 if ( os_DeallocatePartition ( Caller, *Msg - PPM_OFFSET ) != OS_ERROR ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 *Msg = NULL; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 Caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 pf_handle_warning ( OS_SYST_WRN_FREE_FAILED, "%s %s in %s, %s(%d)", |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 syst_wrn, free_str, pf_TaskTable[Caller].Name FILE_LINE_MACRO_PASSED ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 #ifndef RUN_FLASH |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 | STATE : code ROUTINE : vsi_m_cnew | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 PURPOSE : allocate a memory with reference counter |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 T_VOID_STRUCT * vsi_m_cnew (ULONG size, ULONG type FILE_LINE_TYPE) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 T_M_HEADER *mem; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 #ifdef MEMORY_SUPERVISION |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 T_HANDLE caller; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 if ( (mem = (T_M_HEADER*)vsi_m_new ( size+sizeof(T_M_HEADER), type FILE_LINE )) != NULL ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 /* set reference counter */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 mem->ref_cnt = 1; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 /* set descriptor type */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 mem->desc_type = (SHORT)((type & VSI_MEM_DESC_MASK) >> 16); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 /* return pointer to user data */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 #ifdef MEMORY_SUPERVISION |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 vsi_ppm_new ( caller, size+sizeof(T_M_HEADER), (T_PRIM_HEADER*)mem, file, line ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 return (T_VOID_STRUCT*)(mem + 1); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 return NULL; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 #ifndef RUN_FLASH |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 | STATE : code ROUTINE : vsi_m_cfree | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 PURPOSE : allocate a memory with reference counter |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 int vsi_m_cfree (T_VOID_STRUCT **ptr FILE_LINE_TYPE) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 T_HANDLE caller = 0; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 LONG sts; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 T_M_HEADER *mem; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 /* get pointer to start of partition. Here is the reference counter */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 mem = (T_M_HEADER*)*ptr - 1; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 if ( os_is_valid_partition ((T_VOID_STRUCT*)mem) ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 /* free to non-partition memory */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 "MFREE to non-partition memory, entity %s, ptr 0x%x", pf_TaskTable[caller].Name, *ptr ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 sts = os_ObtainSemaphore (caller, vsi_m_sem_handle, OS_SUSPEND); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 if ( sts == OS_ERROR || sts == OS_TIMEOUT ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 /* Semaphore invalid or overrun */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 "Ref Cnt Semaphore overrun, entity %s", pf_TaskTable[caller].Name ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 if ( mem->ref_cnt <= 0 ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 /* partition already freed */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 pf_handle_warning ( OS_SYST_WRN_MULTIPLE_FREE, "%s %s in %s, %s(%d)", |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 syst_wrn, freed_str, pf_TaskTable[caller].Name FILE_LINE_MACRO_PASSED ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 os_ReleaseSemaphore (caller, vsi_m_sem_handle); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 if ( --(mem->ref_cnt) == 0 ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 #ifdef _NUCLEUS_ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 if ( os_PartitionCheck( (ULONG*)mem ) == OS_PARTITION_GUARD_PATTERN_DESTROYED ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 os_ReleaseSemaphore (caller, vsi_m_sem_handle); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 vsi_o_assert ( caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 "Partition Guard Pattern destroyed (MFREE),Task %s,Partition 0x%x", |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 pf_TaskTable[caller].Name, mem ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 if (vsi_m_free ( (T_VOID_STRUCT**)&mem FILE_LINE ) != VSI_OK) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 os_ReleaseSemaphore (caller, vsi_m_sem_handle); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 *ptr=NULL; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 os_ReleaseSemaphore (caller, vsi_m_sem_handle); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 #ifndef RUN_FLASH |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 | STATE : code ROUTINE : vsi_m_cfree | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 PURPOSE : allocate a memory with reference counter |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 int vsi_m_attach (T_VOID_STRUCT *ptr FILE_LINE_TYPE) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 T_HANDLE caller = 0; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 LONG sts; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 T_M_HEADER *mem; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 /* get pointer to start of partition. Here is the reference counter */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 mem = (T_M_HEADER*)ptr - 1; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 #ifdef NU_DEBUG |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 if ( os_is_valid_partition ((T_VOID_STRUCT*)mem) ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 /* attach to non-partition memory */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 "MATTACH to non-partition memory, entity %s, ptr 0x%x", pf_TaskTable[caller].Name, ptr ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 sts = os_ObtainSemaphore (caller, vsi_m_sem_handle, OS_SUSPEND); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 if ( sts == OS_ERROR || sts == OS_TIMEOUT ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 /* Semaphore invalid or overrun */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
414 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
415 vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 "Ref Cnt Semaphore overrun, entity %s", pf_TaskTable[caller].Name ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
417 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
418 if ( mem->ref_cnt <= 0 ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
419 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
420 /* attach to non allocated memory */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
421 caller = e_running[os_MyHandle()]; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
422 vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
423 "MATTACH to free memory, entity %s, ptr 0x%x", pf_TaskTable[caller].Name, ptr ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
424 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
425 else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
427 /* increment reference counter */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 mem->ref_cnt++; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
429 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
430 os_ReleaseSemaphore (caller, vsi_m_sem_handle); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
431 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
432 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
433 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
434 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
435 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
436 #ifndef RUN_INT_RAM |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
437 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
438 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
439 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
440 | STATE : code ROUTINE : vsi_m_status | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
441 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
442 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
443 PURPOSE : retrieve number of used/available partitions |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
444 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
446 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
447 GLOBAL int vsi_m_status ( T_HANDLE caller, ULONG size, USHORT type, USHORT *free, USHORT *alloc ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
448 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
449 #ifdef _NUCLEUS_ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
450 OS_HANDLE pool; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
451 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
452 pool = type & VSI_MEM_POOL_MASK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
453 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
454 if ( os_GetPartitionPoolStatus ( size, pool, free, alloc ) == OS_OK ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
455 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
456 else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
457 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
458 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
459 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
460 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
461 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
462 #ifndef _TOOLS_ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
463 #ifndef RUN_INT_RAM |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
464 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
465 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
466 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
467 | STATE : code ROUTINE : vsi_m_register_pool | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
468 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
469 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
470 PURPOSE : register a new partition pool group to be accessable via VSI |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
471 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
472 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
473 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
474 GLOBAL int vsi_m_register_pool ( char * name, T_HANDLE * pool_gr_id ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
475 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
476 OS_HANDLE pool_gr; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
477 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
478 if ( os_GetPartitionGroupHandle (OS_NOTASK, name, &pool_gr) == OS_OK ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
479 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
480 *pool_gr_id = (T_HANDLE)pool_gr; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
481 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
482 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
483 else |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
484 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
485 return VSI_ERROR; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
486 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
487 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
488 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
489 #endif |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
490 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
491 #ifndef RUN_INT_RAM |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
492 /* |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
493 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
494 | PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
495 | STATE : code ROUTINE : vsi_m_init | |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
496 +--------------------------------------------------------------------+ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
497 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
498 PURPOSE : retrieve number of used/available partitions |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
499 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
500 */ |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
501 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
502 GLOBAL int vsi_m_init ( char enable_init, char pattern ) |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
503 { |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
504 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
505 init_partition_memory = enable_init; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
506 init_partition_pattern = pattern; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
507 os_CreateSemaphore ( 0, (char*)"VSI_MSEM", 1, &vsi_m_sem_handle, 0 ); |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
508 |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
509 return VSI_OK; |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
510 } |
c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
511 #endif |