|
Embedded Artistry Framework
Embedded Systems C++ Framework
|
#include <stddef.h>

Macros | |
| #define | memalign(align, size) aligned_malloc(align, size) |
| A convenience macro for the Linux API. More... | |
Functions | |
| void * | aligned_malloc (size_t align, size_t size) |
| Allocated aligned memory. More... | |
| int | posix_memalign (void **memptr, size_t alignment, size_t size) |
| Posix Memory Alignment Extension. More... | |
| void | aligned_free (void *ptr) |
| Free aligned memory. More... | |
| #define memalign | ( | align, | |
| size | |||
| ) | aligned_malloc(align, size) |
A convenience macro for the Linux API.
memalign() is simply a convenience definition which provides the commonly-used Linux API memalign. This forwards the arguments to aligned_malloc() and behaves in the same manner.
| align | Alignment of the memory block. Alignment refers to the starting address of the memory block. If 32-byte alignment is requested, the start address of the returned pointer will be 32-byte aligned. Note: Alignment must be a power of two. (1, 2, 4, 8, etc.) |
| size | Size of the memory allocation |
| void aligned_free | ( | void * | ptr | ) |
Free aligned memory.
Free memory that was allocated using aligned_malloc(). This function must not be called on memory which was not allocated with aligned_malloc().
| ptr | Pointer to the aligned_memory() block that will be freed. |
Free aligned memory.
References assert, free(), and p.
Referenced by aligned_malloc_test(), embutil::aligned_sptr(), embutil::aligned_uptr(), and posix_memalign_test().

Allocated aligned memory.
Allocate memory with at least alignment align and size size Memory which has been allocated with aligned_malloc() must be freed by calling aligned_free(). Calling free() will result in a panic or other negative effects.
| align | Alignment of the memory block. Alignment refers to the starting address of the memory block. If 32-byte alignment is requested, the start address of the returned pointer will be 32-byte aligned. Note: Alignment must be a power of two. (1, 2, 4, 8, etc.) |
| size | Size of the memory allocation |
Allocated aligned memory.
References align_up, assert, malloc(), NULL, p, and PTR_OFFSET_SZ.
Referenced by aligned_malloc_test(), embutil::aligned_sptr(), embutil::aligned_uptr(), and posix_memalign().

Posix Memory Alignment Extension.
Generated aligned memory. This function forwards the request to aligned malloc. Allocated memory must be freed with aligned_free().
| memptr | A pointer to the pointer which will store the aligned memory. The memory must be freed with aligned_free(). memptr must not be NULL. |
| alignment | The target alignment for the memory. Must be a power of 2. |
| size | The size of the allocation. Must be > 0. |
memptr is not NULL. alignment is power-of-2. size > 0.References aligned_malloc(), assert, EINVAL, ENOMEM, IS_POWER_2, NULL, and r.
Referenced by posix_memalign_test().

1.8.15