zephyr::raw

Function k_heap_aligned_alloc

source
pub unsafe extern "C" fn k_heap_aligned_alloc(
    h: *mut k_heap,
    align: usize,
    bytes: usize,
    timeout: k_timeout_t,
) -> *mut c_void
Expand description

@brief Allocate aligned memory from a k_heap

Behaves in all ways like k_heap_alloc(), except that the returned memory (if available) will have a starting address in memory which is a multiple of the specified power-of-two alignment value in bytes. The resulting memory can be returned to the heap using k_heap_free().

@note @a timeout must be set to K_NO_WAIT if called from ISR. @note When CONFIG_MULTITHREADING=n any @a timeout is treated as K_NO_WAIT.

@funcprops \isr_ok

@param h Heap from which to allocate @param align Alignment in bytes, must be a power of two @param bytes Number of bytes requested @param timeout How long to wait, or K_NO_WAIT @return Pointer to memory the caller can now use