/* * This function changes the size of a block of memory that was previously allocated with malloc(). */ void * GMM001_realloc (uint32_t size, void * MemPtr) { void * MemPtr1 = NULL; if (MemPtr == NULL) { return(GMM001_malloc(size)); } /*<<<DD_GMM001_API_3_1>>>*/ if (((uint32_t)MemPtr >= (uint32_t)Heap_Bank1_Start) && ((uint32_t)MemPtr <= ((uint32_t)Heap_Bank1_Start + LENGTH1))) { MemPtr1 = LMM001_realloc(&GMM001_handle0, MemPtr, size); } /*<<<DD_GMM001_API_3_2>>>*/ else if (((uint32_t)MemPtr >= (uint32_t)Heap_Bank2_Start) && ((uint32_t)MemPtr <= ((uint32_t)Heap_Bank2_Start + LENGTH2))) { MemPtr1 = LMM001_realloc(&GMM001_handle1, MemPtr, size); } /*<<<DD_GMM001_API_3_3>>>*/ else if (((uint32_t)MemPtr >= (uint32_t)Heap_Bank3_Start) && ((uint32_t)MemPtr <= ((uint32_t)Heap_Bank3_Start + LENGTH3))) { MemPtr1 = LMM001_realloc(&GMM001_handle2, MemPtr, size); } else { MemPtr1 = NULL; } return MemPtr1; }
/* <<<DD_SLTHA003_API_2>>> */ void* _calloc_r( struct _reent *Rptr, size_t NoOfElem, size_t ElemSize ) { void *MemPtr = NULL; /* Call malloc function of GMM App. */ MemPtr = GMM001_malloc( NoOfElem * ElemSize); memset(MemPtr, 0, (NoOfElem * ElemSize)); return MemPtr; }
/* This function can be used to request allocation of an object with at least * Size bytes of storage available. If the space is available, malloc returns a * pointer to a newly allocated block as its result. */ void* _malloc_r( struct _reent* Rptr, size_t Size ) { /* Call malloc function of GMM App. */ return (GMM001_malloc(Size)); }