heap: added aligned calloc function plus tests

This commit is contained in:
Felipe Neves
2019-12-20 12:48:35 -03:00
parent 8e5ea171d3
commit 0d8a5ebec7
3 changed files with 98 additions and 0 deletions

View File

@@ -99,6 +99,20 @@ void *heap_caps_realloc( void *ptr, size_t size, int caps);
*/
void *heap_caps_aligned_alloc(size_t alignment, size_t size, int caps);
/**
* @brief Allocate a aligned chunk of memory which has the given capabilities. The initialized value in the memory is set to zero.
*
* @param alignment How the pointer received needs to be aligned
* must be a power of two
* @param n Number of continuing chunks of memory to allocate
* @param size Size, in bytes, of a chunk of memory to allocate
* @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type
* of memory to be returned
*
* @return A pointer to the memory allocated on success, NULL on failure
*/
void *heap_caps_aligned_calloc(size_t alignment, size_t n, size_t size, uint32_t caps);
/**
* @brief Used to deallocate memory previously allocated with heap_caps_aligned_alloc
*