comparison gpf/frame/vsi_ppm.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +------------------------------------------------------------------------------
3 | File: vsi_ppm.c
4 +------------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +-----------------------------------------------------------------------------
16 | Purpose : This Module defines the virtual system interface part
17 | for the primitive partition pool supervision.
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef __VSI_PPM_C__
22 #define __VSI_PPM_C__
23 #endif
24
25 #include "gpfconf.h"
26
27 #ifdef MEMORY_SUPERVISION
28
29 /*==== INCLUDES ===================================================*/
30
31 #include <string.h>
32 #include "typedefs.h"
33 #include "os.h"
34 #include "vsi.h"
35 #include "tools.h"
36 #include "frm_defs.h"
37 #include "frm_types.h"
38 #include "frm_glob.h"
39
40 /*==== TYPES ======================================================*/
41
42 typedef struct
43 {
44 USHORT pool_nr;
45 USHORT group_nr;
46 } T_POOL_GROUP;
47
48 typedef struct
49 {
50 SHORT state_id;
51 char const * state_name;
52 } T_PARTITION_STATE;
53 /*
54 * indices to read the stored counters
55 */
56 typedef enum { TOTAL,CURRENT_BYTE,CURRENT_PART,MAX_RANGES,MAX_BYTE_MEM,MAX_PART_MEM } T_COUNTER_READ;
57
58 /*
59 * indices to update the counters
60 */
61 typedef enum { DECREMENT, INCREMENT, STORE_MAX_BYTE, STORE_MAX_PART } T_COUNTER_UPDATE;
62
63 /*==== CONSTANTS ==================================================*/
64
65 #define OWNER_IS_COM_HANDLE 0x8000
66 /*
67 * Partition States
68 */
69 #define PARTITION_FREED 0x0001
70 #define PARTITION_ALLOCATED 0x0002
71 #define PARTITION_RECEIVED 0x0004
72 #define PARTITION_SENT 0x0008
73 #define PARTITION_REUSED 0x0010
74 #define PARTITION_ACCESSED 0x0020
75 #define PARTITION_STORED 0x0040
76 #define MAX_PARTITION_STATE 7
77
78 #define ALLOWED_ALLOCATE_STATES (PARTITION_FREED)
79 #define ALLOWED_RECEIVE_STATES (PARTITION_SENT|PARTITION_RECEIVED)
80 #define ALLOWED_SEND_STATES (PARTITION_ALLOCATED|PARTITION_REUSED|\
81 PARTITION_RECEIVED|PARTITION_ACCESSED|\
82 PARTITION_STORED)
83 #define ALLOWED_REUSE_STATES (PARTITION_ALLOCATED|PARTITION_RECEIVED|\
84 PARTITION_STORED|PARTITION_REUSED)
85 #define ALLOWED_DEALLOCATE_STATES (PARTITION_RECEIVED|PARTITION_ALLOCATED|\
86 PARTITION_SENT|PARTITION_REUSED|\
87 PARTITION_ACCESSED|PARTITION_STORED)
88 #define ALLOWED_ACCESS_STATES (PARTITION_ALLOCATED|PARTITION_RECEIVED|\
89 PARTITION_REUSED|PARTITION_ACCESSED|\
90 PARTITION_STORED)
91 #define ALLOWED_STORE_STATES (PARTITION_ALLOCATED|PARTITION_RECEIVED|\
92 PARTITION_REUSED|PARTITION_ACCESSED|\
93 PARTITION_SENT)
94
95 #define FORBIDDEN_ALLOCATE_STATES (0xffff&~ALLOWED_ALLOCATE_STATES)
96 #define FORBIDDEN_RECEIVE_STATES (0xffff&~ALLOWED_RECEIVE_STATES)
97 #define FORBIDDEN_SEND_STATES (0xffff&~ALLOWED_SEND_STATES)
98 #define FORBIDDEN_REUSE_STATES (0xffff&~ALLOWED_REUSE_STATES)
99 #define FORBIDDEN_DEALLOCATE_STATES (0xffff&~ALLOWED_DEALLOCATE_STATES)
100 #define FORBIDDEN_ACCESS_STATES (0xffff&~ALLOWED_ACCESS_STATES)
101 #define FORBIDDEN_STORE_STATES (0xffff&~ALLOWED_STORE_STATES)
102
103 #define PPM_END_MARKER ((char)0xff)
104
105 #define PARTITION_SIZE(g,p) (partition_grp_config[g].grp_config[p].part_size)
106
107 #ifndef RUN_INT_RAM
108 const T_PARTITION_STATE partition_state[MAX_PARTITION_STATE+1] =
109 {
110 { PARTITION_FREED, "FREED" },
111 { PARTITION_ALLOCATED, "ALLOCATED" },
112 { PARTITION_RECEIVED, "RECEIVED" },
113 { PARTITION_SENT, "SENT" },
114 { PARTITION_REUSED, "REUSED" },
115 { PARTITION_ACCESSED, "ACCESSED" },
116 { PARTITION_STORED, "STORED" },
117 { 0, NULL }
118 };
119 #endif
120
121 /*==== EXTERNALS ==================================================*/
122
123 /* -------------- S H A R E D - BEGIN ---------------- */
124 #ifdef _TOOLS_
125 #pragma data_seg("FRAME_SHARED")
126 #endif
127
128 extern T_HANDLE TST_Handle;
129 extern const T_FRM_PARTITION_GROUP_CONFIG partition_grp_config[];
130 extern T_HANDLE * PoolGroupHandle [];
131 extern OS_HANDLE ext_data_pool_handle;
132 extern USHORT MaxPoolGroups;
133
134 /*==== VARIABLES ==================================================*/
135
136 #ifndef RUN_INT_RAM
137
138 USHORT NumberOfPPMPartitions = 0;
139 USHORT NumOfPPMPools = 0;
140 USHORT NumOfPPMGroups;
141 USHORT NumOfPrimPools;
142 USHORT NumOfDmemPools;
143 T_PARTITION_POOL_STATUS PoolStatus;
144 T_PARTITION_STATUS *PartitionStatus;
145 T_OVERSIZE_STATUS *PartitionOversize;
146 T_COUNTER *PartitionCounter;
147 T_POOL_GROUP *PoolGroup;
148 #ifdef OPTIMIZE_POOL
149 T_COUNTER *ByteCounter;
150 T_COUNTER *RangeCounter;
151 int *GroupStartRange;
152 int *GroupStartCnt;
153 #endif /* OPTIMIZE_POOL */
154 int ppm_check_partition_owner;
155
156 #else /* RUN_INT_RAM */
157
158 extern int ppm_check_partition_owner;
159 extern T_PARTITION_POOL_STATUS PoolStatus;
160 extern T_POOL_GROUP * PoolGroup;
161 extern USHORT NumOfPrimPools;
162 extern USHORT NumOfDmemPools;
163 extern int *GroupStartRange;
164
165 #endif /* RUN_INT_RAM */
166
167 #ifdef _TOOLS_
168 #pragma data_seg()
169 #endif
170 /* -------------- S H A R E D - END ---------------- */
171
172 /*==== FUNCTIONS ==================================================*/
173
174 GLOBAL void SetPartitionStatus ( T_PARTITION_STATUS *pPoolStatus, const char *file, int line,
175 ULONG opc, USHORT Status, T_HANDLE owner );
176
177 USHORT update_dyn_state ( T_HANDLE Caller, T_PRIM_HEADER *prim, T_HANDLE owner, USHORT state, const char* file, int line );
178 BOOL UpdatePoolCounter ( T_COUNTER *pCounter, T_COUNTER_UPDATE Status, ULONG Value );
179 void StoreRangeCounters ( T_PRIM_HEADER *prim, T_COUNTER_UPDATE Status );
180 int GetPartitionRange ( ULONG size, USHORT group_nr, USHORT pool_nr );
181 LONG get_partition_group ( T_PRIM_HEADER *prim, USHORT *group_nr, USHORT *pool_nr );
182 char const *get_partition_state_name ( USHORT partition_state );
183
184
185 #ifndef RUN_FLASH
186 USHORT update_dyn_state ( T_HANDLE Caller, T_PRIM_HEADER *prim, T_HANDLE owner, USHORT state, const char* file, int line )
187 {
188 T_desc *desc;
189 T_desc3 *desc3;
190 T_M_HEADER *mem;
191 T_DP_HEADER *dp_hdr;
192 USHORT ret = TRUE;
193
194 if ( prim->dph_offset != 0 )
195 {
196 dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset);
197 if ( *((ULONG*)dp_hdr) == GUARD_PATTERN )
198 {
199 dp_hdr = (T_DP_HEADER*)dp_hdr->next;
200 while (dp_hdr != NULL)
201 {
202 SetPartitionStatus ( &PoolStatus.PartitionStatus [ P_PNR(dp_hdr) ], file, line, P_OPC(prim), state, owner );
203 dp_hdr = (T_DP_HEADER*)dp_hdr->next;
204 }
205 }
206 else
207 {
208 if ( Caller != TST_Handle )
209 {
210 /* do not check and update the states of the primitives in descriptor lists when called by TST, because
211 descriptor lists are not routed to TST and will result in the warning generated below */
212 desc = (T_desc*)(((T_desc_list*)dp_hdr)->first);
213 while (desc != NULL)
214 {
215 #ifdef _NUCLEUS_
216 if ( *(((ULONG*)desc)-4) == 0 )
217 #endif
218 {
219 mem = ((T_M_HEADER*)desc)-1;
220 SetPartitionStatus ( &PoolStatus.PartitionStatus [P_PNR(mem)], file, line, P_OPC(prim), state, owner );
221 if ( mem->desc_type == (VSI_DESC_TYPE3 >> 16) )
222 {
223 desc3 = (T_desc3*)desc;
224 mem = ((T_M_HEADER*)desc3->buffer)-1;
225 SetPartitionStatus ( &PoolStatus.PartitionStatus [P_PNR(mem)], file, line, P_OPC(prim), state, owner );
226 }
227 }
228 #ifdef _NUCLEUS_
229 else
230 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: FREED PARTITION 0x%lx IN DESCLIST, %s(%d)", prim,rm_path(file),line );
231 #endif
232 desc = (T_desc *)desc->next;
233 }
234 }
235 }
236 }
237 else
238 ret = FALSE;
239 return ret;
240 }
241 #endif
242
243 #ifndef RUN_INT_RAM
244 /*
245 +------------------------------------------------------------------------+
246 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
247 | STATE : code ROUTINE : get_partition_state_name|
248 +------------------------------------------------------------------------+
249
250 PURPOSE : update counter.
251
252 */
253 char const *get_partition_state_name ( USHORT state )
254 {
255 USHORT i = 0;
256
257 while ( partition_state[i].state_id )
258 {
259 if ( partition_state[i].state_id == state )
260 return partition_state[i].state_name;
261 i++;
262 }
263 return NULL;
264 }
265 #endif
266
267 #ifndef RUN_FLASH
268 /*
269 +----------------------------------------------------------------------+
270 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
271 | STATE : code ROUTINE : check_partition_group |
272 +----------------------------------------------------------------------+
273
274 PURPOSE : update counter.
275
276 */
277 LONG get_partition_group ( T_PRIM_HEADER *prim, USHORT *group_nr, USHORT *pool_nr )
278 {
279 SHORT invalid_pool = 0;
280 T_HANDLE Caller;
281
282 *pool_nr = PoolGroup [ (USHORT)(P_PGR(prim)) ].pool_nr;
283 *group_nr = PoolGroup [ (USHORT)(P_PGR(prim)) ].group_nr;
284
285 if ( *group_nr > MaxPoolGroups )
286 invalid_pool = 1;
287
288 if ( *group_nr == PrimGroupHandle )
289 {
290 if ( *pool_nr > NumOfPrimPools )
291 invalid_pool = 1;
292 }
293 else if ( *group_nr == DmemGroupHandle )
294 {
295 if ( *pool_nr > NumOfDmemPools )
296 invalid_pool = 1;
297 }
298
299 if ( invalid_pool == 1 )
300 {
301 Caller = e_running[os_MyHandle()];
302 vsi_o_ttrace (Caller, TC_SYSTEM,
303 "[PPM]: Invalid Partition Pool, group: %d, pool: %d", *group_nr, *pool_nr );
304 return VSI_ERROR;
305 }
306
307 return VSI_OK;
308 }
309 #endif
310
311 #ifndef RUN_FLASH
312 /*
313 +--------------------------------------------------------------------+
314 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
315 | STATE : code ROUTINE : GetPartitionRange |
316 +--------------------------------------------------------------------+
317
318 PURPOSE : update counter.
319
320 */
321 int GetPartitionRange ( ULONG size, USHORT group_nr, USHORT pool_nr )
322 {
323 int partition_range;
324 int size_offset;
325 int range;
326
327 if ( pool_nr != 0 )
328 {
329 partition_range = (int)(PARTITION_SIZE(group_nr,pool_nr) - PARTITION_SIZE(group_nr,pool_nr-1));
330
331 size_offset = (int)(size - (USHORT)(PARTITION_SIZE(group_nr,pool_nr-1)) - 1);
332 if ( size_offset < 0 )
333 size_offset = 0;
334 }
335 else
336 {
337 partition_range = (USHORT)(PARTITION_SIZE(group_nr,pool_nr));
338 if ( size == 0 )
339 size_offset = 0;
340 else
341 size_offset = (int)(size - 1);
342 }
343
344 range = (USHORT)((size_offset * RANGES_PER_POOL)/partition_range + pool_nr * RANGES_PER_POOL + GroupStartRange[group_nr]);
345
346 return range;
347 }
348 #endif
349
350 #ifndef RUN_FLASH
351 /*
352 +--------------------------------------------------------------------+
353 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
354 | STATE : code ROUTINE : UpdatePoolCounter |
355 +--------------------------------------------------------------------+
356
357 PURPOSE : update counter.
358
359 */
360 BOOL UpdatePoolCounter ( T_COUNTER *pCounter, T_COUNTER_UPDATE Status, ULONG Value )
361 {
362
363 switch ( Status )
364 {
365 case INCREMENT:
366 pCounter->Total += Value; /* total number */
367 pCounter->Current += Value; /* current number */
368 if ( pCounter->Current > pCounter->Maximum ) /* current > maximum ? */
369 {
370 pCounter->Maximum = pCounter->Current; /* Maximum = Current */
371 return TRUE ;
372 }
373 break;
374 case DECREMENT:
375 pCounter->Current -= Value; /* current number */
376 break;
377 case STORE_MAX_BYTE:
378 pCounter->MaxByteMemory = pCounter->Current; /* store current number */
379 break;
380 case STORE_MAX_PART:
381 pCounter->MaxPartMemory = pCounter->Current; /* store current number */
382 break;
383 }
384 return FALSE;
385 }
386 #endif
387
388 #ifndef RUN_FLASH
389 /*
390 +--------------------------------------------------------------------+
391 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
392 | STATE : code ROUTINE : SetPartitionStatus |
393 +--------------------------------------------------------------------+
394
395 PURPOSE : update the status of the partition.
396
397 */
398 GLOBAL void SetPartitionStatus ( T_PARTITION_STATUS *pPoolStatus, const char *file, int line, ULONG opc, USHORT Status, T_HANDLE owner )
399 {
400
401 pPoolStatus->Status = Status;
402 pPoolStatus->PrimOPC = opc;
403 pPoolStatus->owner = owner;
404 if ( Status NEQ PARTITION_FREED )
405 {
406 os_GetTime (0,&pPoolStatus->time);
407 pPoolStatus->Userfile = file;
408 pPoolStatus->Line = line;
409 }
410 }
411 #endif
412
413 #ifdef OPTIMIZE_POOL
414 #ifndef RUN_FLASH
415 /*
416 +--------------------------------------------------------------------+
417 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
418 | STATE : code ROUTINE : StoreRangeCounters |
419 +--------------------------------------------------------------------+
420
421 PURPOSE : stores the range counters for a specified partition.
422
423 */
424 void StoreRangeCounters ( T_PRIM_HEADER *prim, T_COUNTER_UPDATE Status )
425 {
426 USHORT i;
427
428 for ( i=0; i<5; i++ )
429 UpdatePoolCounter ( &PoolStatus.RangeCounter [ P_PGR(prim)*5+i ], Status,0 );
430 }
431 #endif
432
433 #ifndef RUN_INT_RAM
434 /*
435 +--------------------------------------------------------------------+
436 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
437 | STATE : code ROUTINE : TracePoolStatistic |
438 +--------------------------------------------------------------------+
439
440 PURPOSE : send the statistic information specified by the parameters
441 to the tst interface.
442
443 */
444 LOCAL void TracePoolStatistic ( T_HANDLE Caller, USHORT group_nr, USHORT pool_nr, char const *Src,
445 T_COUNTER_READ Status )
446 {
447 #define RNG_COUNT_IDX(g,p,i) (GroupStartRange[g]+p*RANGES_PER_POOL+i)
448 #define COUNT_IDX(g,p) (GroupStartCnt[g]+p)
449 T_FRM_PARTITION_POOL_CONFIG * pool_config;
450 ULONG Value1;
451 ULONG Value2;
452 char const *Resource;
453 BOOL TraceRange = FALSE;
454 BOOL TraceValue = FALSE;
455 ULONG Value[5];
456 int i;
457
458 pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[group_nr].grp_config + pool_nr;
459
460 switch ( Status )
461 {
462 case TOTAL:
463 TraceRange = TRUE;
464 for ( i = 0; i < RANGES_PER_POOL; i++ )
465 Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].Total;
466 break;
467 case CURRENT_BYTE:
468 TraceValue = TRUE;
469 Resource = "max bytes ";
470 Value1 = PoolStatus.ByteCounter [ COUNT_IDX(group_nr,pool_nr) ].Current;
471 Value2 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].Current * pool_config->part_size;
472 break;
473 case CURRENT_PART:
474 TraceValue = TRUE;
475 Resource = "part";
476 Value1 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].Current;
477 Value2 = pool_config->part_num;
478
479 break;
480 case MAX_RANGES:
481 TraceRange = TRUE;
482 for ( i = 0; i < RANGES_PER_POOL; i++ )
483 Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].Maximum;
484 break;
485 case MAX_BYTE_MEM:
486 TraceRange = TRUE;
487 TraceValue = TRUE;
488 Resource = "bytes ";
489 Value1 = PoolStatus.ByteCounter [COUNT_IDX(group_nr,pool_nr)].Maximum;
490 Value2 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].MaxByteMemory * pool_config->part_size;
491 for ( i = 0; i < RANGES_PER_POOL; i++ )
492 Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].MaxByteMemory;
493 break;
494 case MAX_PART_MEM:
495 TraceRange = TRUE;
496 TraceValue = TRUE;
497 Resource = "partitions";
498 Value1 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].Maximum;
499 Value2 = pool_config->part_num;
500 for ( i = 0; i < RANGES_PER_POOL; i++ )
501 Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].MaxPartMemory;
502 break;
503 default:
504 break;
505 }
506
507 /*lint -e644, suppress Warning -- Variable may not have been initialized */
508 if ( TraceValue )
509 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: %s pool %d:%5d %s =>%3d%%",
510 Src, pool_nr, Value1, Resource, (Value1*100)/(Value2==0?1:Value2) );
511
512 if ( TraceRange )
513 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: %s partitions pool %d: %3d, %3d, %3d, %3d, %3d",Src, pool_nr,
514 Value[0],Value[1],Value[2],Value[3],Value[4]);
515 /*lint +e644 */
516
517 }
518 #endif
519 #endif /* OPTIMIZE_POOL */
520
521 #ifndef RUN_INT_RAM
522 /*
523 +--------------------------------------------------------------------+
524 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
525 | STATE : code ROUTINE : TracePoolStatus |
526 +--------------------------------------------------------------------+
527
528 PURPOSE : send the statistic information to the test interface.
529
530 */
531 GLOBAL void TracePoolstatus ( T_HANDLE Caller )
532 {
533 T_PARTITION_STATUS *pPoolStatus;
534 T_FRM_PARTITION_POOL_CONFIG * pool_config;
535 USHORT i, m;
536 USHORT group_nr, pool_nr;
537 USHORT PartitionError = FALSE, OversizeError = FALSE;
538 T_OVERSIZE_STATUS *pOversizeStatus;
539 T_HANDLE owner;
540 char *opc;
541
542 pOversizeStatus = &PoolStatus.PartitionOversize[0];
543 pPoolStatus = &PoolStatus.PartitionStatus [0];
544 for ( i = 0; i < NumberOfPPMPartitions; i++ )
545 {
546 if ( pPoolStatus->Status > 0 && pPoolStatus->Status NEQ PARTITION_FREED )
547 {
548 if ( pPoolStatus->owner & OWNER_IS_COM_HANDLE )
549 owner = pPoolStatus->owner&~OWNER_IS_COM_HANDLE;
550 else
551 owner = pPoolStatus->owner;
552
553 if ( pPoolStatus->PrimOPC && ( ((T_PRIM_HEADER*)pPoolStatus->ptr)->opc != pPoolStatus->PrimOPC ) )
554 opc = "in desclist of OPC";
555 else
556 opc = "OPC";
557 get_partition_group ( pPoolStatus->ptr, &group_nr, &pool_nr );
558
559 pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[group_nr].grp_config + pool_nr;
560
561 vsi_o_ttrace ( Caller, TC_SYSTEM, "POOL%d%d(%s), PARTITION 0x%lx(%d), %s 0x%lx, \
562 %s, %s, TIME %d, %s(%d)", group_nr,pool_nr,partition_grp_config[group_nr].name, pPoolStatus->ptr,pool_config->part_size,
563 opc, pPoolStatus->PrimOPC, get_partition_state_name(pPoolStatus->Status), pf_TaskTable[owner].Name, pPoolStatus->time,
564 rm_path(pPoolStatus->Userfile), pPoolStatus->Line);
565 PartitionError = TRUE;
566 }
567 pPoolStatus++;
568 }
569
570 for (m = 0; partition_grp_config[m].grp_config != NULL; m++ )
571 {
572 if ( strcmp ("TEST", partition_grp_config[m].name ) )
573 {
574 vsi_o_ttrace ( Caller, TC_SYSTEM, "---------------------------------------------------------" );
575 vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: POOL NAME: %s", partition_grp_config[m].name );
576 pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[m].grp_config;
577 for ( i = 0; pool_config != NULL; i++)
578 {
579 if ( pool_config->part_size )
580 {
581 #ifdef OPTIMIZE_POOL
582 vsi_o_ttrace ( Caller, TC_SYSTEM, "---------------------------------------------------------" );
583 vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: POOL %d (size %d) ",i, pool_config->part_size );
584 TracePoolStatistic ( Caller, m, i, "MAXBYTE ", MAX_BYTE_MEM );
585 TracePoolStatistic ( Caller, m, i, "MAXPART ", MAX_PART_MEM );
586 TracePoolStatistic ( Caller, m, i, "MAXRANGE", MAX_RANGES );
587 TracePoolStatistic ( Caller, m, i, "TOTAL ", TOTAL );
588 #endif /* OPTIMIZE_POOL */
589 if ( pOversizeStatus->PrimOPC )
590 {
591 vsi_o_ttrace ( Caller, TC_SYSTEM, "PPM: PARTITION OF SIZE %d USED BY OVERSIZED \
592 PRIMITIVE %lx AT %s(%d)", pool_config->part_size,
593 pOversizeStatus->PrimOPC, rm_path(pOversizeStatus->Userfile), pPoolStatus->Line);
594 OversizeError = TRUE;
595 }
596 pOversizeStatus++;
597 }
598 else
599 {
600 break;
601 }
602 pool_config++;
603 }
604 if ( !PartitionError )
605 vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: ALL PARTITIONS FREED" );
606 if ( !OversizeError )
607 vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: NO OVERSIZE ERRORS OCCURED" );
608 }
609 }
610
611 }
612 #endif
613
614 #ifndef RUN_INT_RAM
615 /*
616 +--------------------------------------------------------------------+
617 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
618 | STATE : code ROUTINE : InitializePPM |
619 +--------------------------------------------------------------------+
620
621 PURPOSE : initialize supervision, write index to each partition.
622
623 */
624 void InitializePPM ( void )
625 {
626 T_FRM_PARTITION_POOL_CONFIG * pool_config;
627 ULONG *Prims;
628 USHORT i,j,k,m,n;
629 int status;
630 static int last_range = 0;
631 static int last_cnt = 0;
632
633 status = os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&Prims, sizeof(int)*NumberOfPPMPartitions, OS_NO_SUSPEND, ext_data_pool_handle );
634 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PoolGroup, sizeof(T_POOL_GROUP)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle );
635 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PartitionStatus, sizeof(T_PARTITION_STATUS)*NumberOfPPMPartitions, OS_NO_SUSPEND, ext_data_pool_handle );
636 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PartitionOversize, sizeof(T_OVERSIZE_STATUS)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle );
637 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PartitionCounter, sizeof(T_COUNTER)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle );
638 #ifdef OPTIMIZE_POOL
639 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&ByteCounter, sizeof(T_COUNTER)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle );
640 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&RangeCounter, sizeof(T_COUNTER)*NumberOfPPMPartitions, OS_NO_SUSPEND, ext_data_pool_handle );
641 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&GroupStartRange, sizeof(int)*NumOfPPMGroups, OS_NO_SUSPEND, ext_data_pool_handle );
642 status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&GroupStartCnt, sizeof(int)*NumOfPPMGroups, OS_NO_SUSPEND, ext_data_pool_handle );
643 #endif
644 if ( status > 0 )
645 {
646 vsi_o_assert ( 0, OS_SYST_ERR, __FILE__, __LINE__, "Memory allocation for partition supervision failed" );
647 }
648 ppm_check_partition_owner = 0;
649 PoolStatus.PartitionStatus = PartitionStatus;
650 PoolStatus.PartitionOversize = PartitionOversize;
651 PoolStatus.PartitionCounter = PartitionCounter;
652 #ifdef OPTIMIZE_POOL
653 PoolStatus.ByteCounter = ByteCounter;
654 PoolStatus.RangeCounter = RangeCounter;
655 #endif
656
657 for ( j = 0; j<NumberOfPPMPartitions; j++)
658 Prims[j] = 0;
659
660 for (m = 0, j = 0, i = 0; partition_grp_config[m].grp_config != NULL; m++ )
661 {
662 if ( strcmp ("TEST", partition_grp_config[m].name ) )
663 {
664 pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[m].grp_config;
665
666 for (n = 0; pool_config != NULL; i++, n++)
667 {
668 if ( pool_config->part_size )
669 {
670 PoolGroup[i].group_nr = m;
671 PoolGroup[i].pool_nr = n;
672 for (k = 0; k < pool_config->part_num; k++ , j++)
673 {
674 if ( os_AllocatePartition ( NO_TASK, (T_VOID_STRUCT**)&Prims[j], pool_config->part_size,
675 OS_NO_SUSPEND, *PoolGroupHandle[m] ) == OS_OK )
676 {
677 P_IDX((T_PRIM_HEADER*)(Prims[j]+PPM_IDX_OFFSET)) = ( ((USHORT)i<<16) | j );
678 }
679 else
680 {
681 P_IDX((T_PRIM_HEADER*)(Prims[j]+PPM_IDX_OFFSET)) = 0;
682 }
683 }
684 }
685 else
686 {
687 break;
688 }
689 pool_config++;
690 }
691 if ( m == 0 )
692 {
693 GroupStartCnt[m] = 0;
694 GroupStartRange[m] = 0;
695 last_cnt = n;
696 last_range = RANGES_PER_POOL * n;
697 }
698 else
699 {
700 GroupStartCnt[m] = last_cnt;
701 GroupStartRange[m] = last_range;
702 last_cnt = GroupStartCnt[m] + n;
703 last_range = GroupStartRange[m] + RANGES_PER_POOL * n;
704 }
705
706 }
707 }
708 for ( j = 0; j<NumberOfPPMPartitions; j++)
709 {
710 if ( Prims[j] )
711 {
712 os_DeallocatePartition ( NO_TASK, (T_VOID_STRUCT*)Prims[j] );
713 PoolStatus.PartitionStatus [ P_PNR(Prims[j]+4) ].Status = PARTITION_FREED;
714 }
715 }
716 }
717 #endif
718
719 #ifndef RUN_FLASH
720 /*
721 +--------------------------------------------------------------------+
722 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
723 | STATE : code ROUTINE : vsi_ppm_new |
724 +--------------------------------------------------------------------+
725
726 PURPOSE : supervision of allocating a partition.
727
728 */
729 GLOBAL void vsi_ppm_new ( T_HANDLE Caller, ULONG Size, T_PRIM_HEADER *prim, const char* file, int line )
730 {
731 T_PARTITION_STATUS *pPoolStatus;
732 USHORT group_nr, pool_nr;
733
734 if ( prim != NULL )
735 {
736 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
737 {
738 vsi_ppm_setend(prim, Size);
739 /*
740 * set pointer to status entry of the currently used partition
741 */
742 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
743
744 pPoolStatus->ptr = prim;
745 /*
746 * send error message in case of an illegal state transition
747 */
748 if ( pPoolStatus->Status & FORBIDDEN_ALLOCATE_STATES )
749 vsi_o_ttrace (Caller, TC_SYSTEM,
750 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
751 get_partition_state_name(PARTITION_ALLOCATED),rm_path(file),line );
752
753 /*
754 * update partition status
755 */
756 SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), PARTITION_ALLOCATED, Caller );
757
758 #ifdef OPTIMIZE_POOL
759 /*
760 * get primitive size and update range counter
761 */
762 pPoolStatus->UsedSize = Size;
763 UpdatePoolCounter ( &PoolStatus.RangeCounter [GetPartitionRange(pPoolStatus->UsedSize,group_nr,pool_nr)], INCREMENT,1 );
764 #endif /* OPTIMIZE_POOL */
765
766 /*
767 * update partition counter, if new maximum and OPTIMIZE_POOL, then
768 * - store the counters of the ranges within this partition
769 * - send a message that a new maximum has occurred
770 */
771 if ( UpdatePoolCounter ( &PoolStatus.PartitionCounter [P_PGR(prim)],INCREMENT,1 ) )
772 #ifndef OPTIMIZE_POOL
773 ;
774 #else
775 {
776 StoreRangeCounters ( prim, STORE_MAX_PART );
777 }
778
779 /*
780 * update byte counter, if new maximum, then
781 * - store the counters of the ranges within this partition
782 * - store the number of currently allocated partitions
783 */
784 if ( UpdatePoolCounter ( &PoolStatus.ByteCounter [P_PGR(prim)],INCREMENT,pPoolStatus->UsedSize ) )
785 {
786 StoreRangeCounters ( prim, STORE_MAX_BYTE );
787 UpdatePoolCounter ( &PoolStatus.PartitionCounter [ P_PGR(prim) ], STORE_MAX_BYTE,0 );
788 }
789 #endif /* OPTIMIZE_POOL */
790 }
791 else
792 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
793 }
794 }
795 #endif
796
797 #ifndef RUN_FLASH
798 /*
799 +--------------------------------------------------------------------+
800 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
801 | STATE : code ROUTINE : vsi_ppm_rec |
802 +--------------------------------------------------------------------+
803
804 PURPOSE : supervision of receiving a partition.
805
806 */
807 GLOBAL void vsi_ppm_rec ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line )
808 {
809 T_PARTITION_STATUS *pPoolStatus;
810 USHORT group_nr, pool_nr;
811
812 if ( prim != NULL )
813 {
814 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
815 {
816 Caller = e_running[os_MyHandle()];
817 /*
818 * set pointer to status entry of the currently used partition
819 */
820 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
821
822 /*
823 * send error message in case of an illegal state transition
824 */
825 if ( pPoolStatus->Status & FORBIDDEN_RECEIVE_STATES )
826 vsi_o_ttrace (Caller, TC_SYSTEM,
827 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
828 get_partition_state_name(PARTITION_RECEIVED),rm_path(file),line );
829
830 /*
831 * update partition status
832 */
833 SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), PARTITION_RECEIVED, Caller );
834 update_dyn_state ( Caller, prim, Caller, PARTITION_RECEIVED, file, line );
835 }
836 else
837 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
838 }
839 }
840 #endif
841
842 #ifndef RUN_INT_RAM
843 /*
844 +--------------------------------------------------------------------+
845 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
846 | STATE : code ROUTINE : vsi_ppm_access |
847 +--------------------------------------------------------------------+
848
849 PURPOSE : supervision of receiving a partition.
850
851 */
852 GLOBAL void vsi_ppm_access ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line )
853 {
854 T_PARTITION_STATUS *pPoolStatus;
855 USHORT group_nr, pool_nr;
856
857 if ( prim != NULL )
858 {
859 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
860 {
861 Caller = e_running[os_MyHandle()];
862 /*
863 * set pointer to status entry of the currently used partition
864 */
865 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
866
867 /*
868 * send error message in case of an illegal state transition
869 */
870 if ( pPoolStatus->Status & FORBIDDEN_ACCESS_STATES )
871 vsi_o_ttrace (Caller, TC_SYSTEM,
872 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
873 get_partition_state_name(PARTITION_ACCESSED),rm_path(file),line );
874
875 /*
876 * update partition status
877 */
878 SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), pPoolStatus->Status, Caller );
879 update_dyn_state ( Caller, prim, Caller, PARTITION_ACCESSED, file, line );
880 }
881 else
882 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
883 }
884 }
885 #endif
886
887 #ifndef RUN_FLASH
888 /*
889 +--------------------------------------------------------------------+
890 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
891 | STATE : code ROUTINE : vsi_ppm_send |
892 +--------------------------------------------------------------------+
893
894 PURPOSE : supervision of receiving a partition.
895
896 */
897 GLOBAL void vsi_ppm_send ( T_HANDLE Caller, T_HANDLE rcv, T_PRIM_HEADER *prim, const char *file, int line )
898 {
899 T_PARTITION_STATUS *pPoolStatus;
900 USHORT NewStatus = PARTITION_SENT;
901 USHORT group_nr, pool_nr;
902
903 if ( prim != NULL )
904 {
905 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
906 {
907 Caller = e_running[os_MyHandle()];
908 /*
909 * set pointer to status entry of the currently used partition
910 */
911 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
912
913
914 /*
915 * send error message in case of an illegal state transition
916 */
917 if ( pPoolStatus->Status & FORBIDDEN_SEND_STATES )
918 vsi_o_ttrace (Caller, TC_SYSTEM,
919 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
920 get_partition_state_name(PARTITION_SENT),rm_path(file),line );
921
922 /*
923 * check if more bytes written than requested during allocation
924 */
925 if ( *((char*)prim + pPoolStatus->RequestedSize - 1) != PPM_END_MARKER )
926 {
927 if ( prim->dph_offset == 0 )
928 vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "SYSTEM WARNING: Bytes written > requested partition size, %s(%d)", rm_path(file), line );
929 }
930 /*
931 * update partition status
932 */
933 SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), NewStatus, (T_HANDLE)(OWNER_IS_COM_HANDLE|rcv) );
934 update_dyn_state ( Caller, prim, rcv, PARTITION_SENT, file, line );
935 }
936 else
937 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
938 }
939 }
940 #endif
941
942 #ifndef RUN_INT_RAM
943 /*
944 +--------------------------------------------------------------------+
945 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
946 | STATE : code ROUTINE : vsi_ppm_store |
947 +--------------------------------------------------------------------+
948
949 PURPOSE : supervision of storing a partition.
950
951 */
952 GLOBAL void vsi_ppm_store ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line )
953 {
954 T_PARTITION_STATUS *pPoolStatus;
955 USHORT group_nr, pool_nr;
956
957 if ( prim != NULL )
958 {
959 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
960 {
961 Caller = e_running[os_MyHandle()];
962 /*
963 * set pointer to status entry of the currently used partition
964 */
965 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
966
967 /*
968 * send error message in case of an illegal state transition
969 */
970 if ( pPoolStatus->Status & FORBIDDEN_STORE_STATES )
971 vsi_o_ttrace (Caller, TC_SYSTEM,
972 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
973 get_partition_state_name(PARTITION_STORED),rm_path(file),line );
974
975 /*
976 * update partition status
977 */
978 SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), pPoolStatus->Status, Caller );
979 }
980 else
981 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
982 }
983 }
984 #endif
985
986 #ifndef RUN_INT_RAM
987 /*
988 +--------------------------------------------------------------------+
989 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
990 | STATE : code ROUTINE : vsi_ppm_reuse |
991 +--------------------------------------------------------------------+
992
993 PURPOSE : supervision of reusing a partition.
994
995 */
996 GLOBAL void vsi_ppm_reuse ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line )
997 {
998 T_PARTITION_STATUS *pPoolStatus;
999 ULONG OldSize, NewSize;
1000 USHORT group_nr, pool_nr;
1001
1002 if ( prim != NULL )
1003 {
1004 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
1005 {
1006 Caller = e_running[os_MyHandle()];
1007 /*
1008 * set pointer to status entry of the currently used partition
1009 */
1010 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
1011
1012 /*
1013 * send error message in case of an illegal state transition
1014 */
1015 if ( pPoolStatus->Status & FORBIDDEN_REUSE_STATES )
1016 vsi_o_ttrace (Caller, TC_SYSTEM,
1017 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
1018 get_partition_state_name(PARTITION_REUSED),rm_path(file),line );
1019
1020 /*
1021 * update partition status
1022 */
1023 SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), PARTITION_REUSED, Caller );
1024 update_dyn_state ( Caller, prim, Caller, PARTITION_REUSED, file, line );
1025 /*
1026 * if the new primitive exceeds the size of the partition, then
1027 * - store file, line and primitive opc
1028 * - send an error message
1029 */
1030 #if 0
1031 if ( (ULONG)(P_LEN(prim)) > PoolGroupConfig[PrimGroupHandle]->PoolConfig[P_PGR(prim)].PartitionSize )
1032 {
1033 PoolStatus.PartitionOversize [P_PGR(prim)].Userfile = file;
1034 PoolStatus.PartitionOversize [P_PGR(prim)].Line = line;
1035 PoolStatus.PartitionOversize [P_PGR(prim)].PrimOPC = P_OPC(prim);
1036 vsi_o_assert (NO_TASK, OS_SYST_ERR_OVERSIZE, file, line, "PREUSE - oversize error in %s",
1037 pf_TaskTable[Caller].Name );
1038 }
1039 #endif
1040 #ifdef OPTIMIZE_POOL
1041 /*
1042 * if the old and new primitve have different sizes, then
1043 * - decrement byte counter by old size
1044 * - decrement old range counter
1045 * - increment new range counter
1046 * - increment byte counter by new size
1047 */
1048 if ( (OldSize=pPoolStatus->UsedSize) NEQ (NewSize=P_LEN(prim)) )
1049 {
1050 UpdatePoolCounter ( &PoolStatus.ByteCounter [P_PGR(prim)],DECREMENT,OldSize );
1051 UpdatePoolCounter ( &PoolStatus.RangeCounter [ GetPartitionRange(OldSize,group_nr,pool_nr) ], DECREMENT, 1 );
1052 UpdatePoolCounter ( &PoolStatus.RangeCounter [ GetPartitionRange(NewSize,group_nr,pool_nr) ], INCREMENT, 1 );
1053 pPoolStatus->UsedSize = NewSize;
1054 if ( UpdatePoolCounter ( &PoolStatus.ByteCounter [P_PGR(prim)],INCREMENT,NewSize ) )
1055 {
1056 StoreRangeCounters ( prim, STORE_MAX_BYTE );
1057 UpdatePoolCounter ( &PoolStatus.PartitionCounter [ P_PGR(prim) ], STORE_MAX_BYTE,0 );
1058 }
1059 }
1060 #endif /* OPTIMIZE_POOL */
1061 }
1062 else
1063 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
1064 }
1065 }
1066 #endif
1067
1068 #ifndef RUN_FLASH
1069 /*
1070 +--------------------------------------------------------------------+
1071 | PROJECT : GSM-Frame (8415) MODULE : VSI_PPM |
1072 | STATE : code ROUTINE : vsi_ppm_free |
1073 +--------------------------------------------------------------------+
1074
1075 PURPOSE : supervision of deallocating a partition.
1076
1077 */
1078 GLOBAL void vsi_ppm_free ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line )
1079 {
1080 T_PARTITION_STATUS *pPoolStatus;
1081 USHORT group_nr, pool_nr;
1082 T_HANDLE owner;
1083
1084 if ( prim != NULL )
1085 {
1086 if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK )
1087 {
1088 Caller = e_running[os_MyHandle()];
1089 prim->opc = 0;
1090 /*
1091 * set pointer to status entry of the currently used partition
1092 */
1093 pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ];
1094
1095 /*
1096 * send error message in case of an illegal state transition
1097 */
1098 if ( pPoolStatus->Status & FORBIDDEN_DEALLOCATE_STATES )
1099 vsi_o_ttrace (Caller, TC_SYSTEM,
1100 "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status),
1101 get_partition_state_name(PARTITION_FREED),file,line );
1102
1103
1104 /* CURRENTLY DISABLED FOR UMTS RELEASE */
1105 if ( pPoolStatus->owner & OWNER_IS_COM_HANDLE )
1106 {
1107 owner = pPoolStatus->owner&~OWNER_IS_COM_HANDLE;
1108 vsi_o_ttrace (NO_TASK, TC_SYSTEM,
1109 "SYSTEM WARNING: %s freed partition stored in %s queue, %s(%d)",
1110 pf_TaskTable[Caller].Name,pf_TaskTable[owner].Name,rm_path(file),line );
1111 }
1112 if ( ppm_check_partition_owner == 1 )
1113 {
1114 if ( (pPoolStatus->owner & ~OWNER_IS_COM_HANDLE) != Caller )
1115 {
1116 owner = pPoolStatus->owner&~OWNER_IS_COM_HANDLE;
1117 vsi_o_ttrace (NO_TASK, TC_SYSTEM,
1118 "SYSTEM WARNING: %s freed partition belonging to %s, %s(%d)",
1119 pf_TaskTable[Caller].Name,pf_TaskTable[owner].Name,rm_path(file),line );
1120 }
1121 }
1122
1123 if ( !(pPoolStatus->Status & PARTITION_FREED) )
1124 {
1125 #ifdef OPTIMIZE_POOL
1126 /*
1127 * decrement byte counter by primitive size
1128 * decrement range counter
1129 * decrement partition counter
1130 */
1131 UpdatePoolCounter ( &PoolStatus.ByteCounter [ P_PGR(prim) ], DECREMENT, pPoolStatus->UsedSize );
1132 UpdatePoolCounter ( &PoolStatus.RangeCounter [GetPartitionRange(pPoolStatus->UsedSize,group_nr,pool_nr)], DECREMENT, 1 ) ;
1133 #endif /* OPTIMIZE_POOL */
1134 UpdatePoolCounter ( &PoolStatus.PartitionCounter [ P_PGR(prim) ], DECREMENT, 1 );
1135 }
1136
1137 /*
1138 * update partition status
1139 */
1140 SetPartitionStatus ( pPoolStatus, file, line, 0, PARTITION_FREED, 0 );
1141 }
1142 else
1143 vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr );
1144 }
1145 }
1146 #endif
1147
1148 #ifndef RUN_FLASH
1149 GLOBAL void vsi_ppm_setend ( T_PRIM_HEADER *prim, ULONG size )
1150 {
1151 *((char*)prim + size ) = PPM_END_MARKER;
1152 PoolStatus.PartitionStatus[P_PNR(prim)].RequestedSize = size+1;
1153 }
1154 #endif
1155 #endif /* MEMORY_SUPERVISION */