FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osl/os_mem_fl.c @ 399:d26a9e3de626
OSL: os_mem_fl.c done
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 15 Jun 2014 00:47:06 +0000 |
parents | 2dc9f34e3036 |
children | dcb543907cbb |
comparison
equal
deleted
inserted
replaced
398:2dc9f34e3036 | 399:d26a9e3de626 |
---|---|
384 GLOBAL LONG | 384 GLOBAL LONG |
385 os_CreateMemoryPool(OS_HANDLE TaskHandle, char *Name, void *Addr, | 385 os_CreateMemoryPool(OS_HANDLE TaskHandle, char *Name, void *Addr, |
386 ULONG PoolSize, OS_HANDLE *PoolHandle) | 386 ULONG PoolSize, OS_HANDLE *PoolHandle) |
387 { | 387 { |
388 STATUS sts; | 388 STATUS sts; |
389 USHORT i; | |
389 | 390 |
390 sts = NU_Obtain_Semaphore(&MemSemCB, NU_SUSPEND); | 391 sts = NU_Obtain_Semaphore(&MemSemCB, NU_SUSPEND); |
391 | 392 for (i = 0; i < NumOfMemoryPools; i++) |
392 | 393 if (!strncmp(Name, MemPoolTable[i].name, RESOURCE_NAMELEN-1)) { |
393 } | 394 *PoolHandle = i; |
395 if (sts == NU_SUCCESS) | |
396 NU_Release_Semaphore(&MemSemCB); | |
397 return(OS_OK); | |
398 } | |
399 if (i >= MaxMemoryPools) { | |
400 release_sem_return_err: | |
401 if (sts == NU_SUCCESS) | |
402 NU_Release_Semaphore(&MemSemCB); | |
403 return(OS_ERROR); | |
404 } | |
405 if (i) { | |
406 if (os_AllocateMemory(OS_NOTASK, | |
407 (T_VOID_STRUCT **) &MemPoolTable[i].pcb, | |
408 sizeof(NU_MEMORY_POOL), OS_NO_SUSPEND, | |
409 os_ext_pool_handle) != OS_OK) | |
410 goto release_sem_return_err; | |
411 } | |
412 if (NU_Create_Memory_Pool(MemPoolTable[i].pcb, Name, Addr, PoolSize, | |
413 4, NU_FIFO) != NU_SUCCESS) | |
414 goto release_sem_return_err; | |
415 strncpy(MemPoolTable[i].name, Name, RESOURCE_NAMELEN); | |
416 MemPoolTable[i].name[RESOURCE_NAMELEN-1] = 0; | |
417 *PoolHandle = i; | |
418 NumOfMemoryPools++; | |
419 if (sts == NU_SUCCESS) | |
420 NU_Release_Semaphore(&MemSemCB); | |
421 return(OS_OK); | |
422 } |