annotate gsm-fw/gpf/frame/vsi_mem.c @ 316:79080922d8e4

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