diff gsm-fw/gpf/osl/os_mem_fl.c @ 374:3efb28578dad

os_mem_fl.c: os_InitPartitionCheck() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 09 Jun 2014 03:31:20 +0000
parents 5f7d723b9343
children 1319bd1d5ac3
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_mem_fl.c	Sun Jun 01 00:46:47 2014 +0000
+++ b/gsm-fw/gpf/osl/os_mem_fl.c	Mon Jun 09 03:31:20 2014 +0000
@@ -152,3 +152,26 @@
 	MemPoolTable[0].pcb = &mem_pool_head;
 	return(OS_OK);
 }
+
+void
+os_InitPartitionCheck(T_OS_PART_POOL *pool)
+{
+	unsigned **Buffer, offset;
+	USHORT i, k;
+
+	NU_Allocate_Memory(MemPoolTable[0].pcb, (VOID **) &Buffer,
+			   pool->pcb.pm_available * sizeof(unsigned *),
+			   NU_NO_SUSPEND);
+	offset = pool->pcb.pm_partition_size / sizeof(unsigned) - 1;
+	for (i = 0; ; i++) {
+		if (NU_Allocate_Partition(&pool->pcb, (VOID **)(Buffer + i),
+					  NU_NO_SUSPEND)
+				!= NU_SUCCESS)
+			break;
+		Buffer[i][offset] = GUARD_PATTERN;
+	}
+	for (k = 0; k < i; k++)
+		if (NU_Deallocate_Partition(Buffer[k]) != NU_SUCCESS)
+			break;
+	NU_Deallocate_Memory(Buffer);
+}