zephyr::raw

Function k_mem_slab_alloc

source
pub unsafe extern "C" fn k_mem_slab_alloc(
    slab: *mut k_mem_slab,
    mem: *mut *mut c_void,
    timeout: k_timeout_t,
) -> i32
Expand description

@brief Allocate memory from a memory slab.

This routine allocates a memory block from a memory slab.

@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 slab Address of the memory slab. @param mem Pointer to block address area. @param timeout Waiting period to wait for operation to complete. Use K_NO_WAIT to return without waiting, or K_FOREVER to wait as long as necessary.

@retval 0 Memory allocated. The block address area pointed at by @a mem is set to the starting address of the memory block. @retval -ENOMEM Returned without waiting. @retval -EAGAIN Waiting period timed out. @retval -EINVAL Invalid data supplied