audio_dma_add_buffer

Schedule a non-blocking read or write operation.

int32_t audio_dma_add_buffer(
    struct audio_dma_descriptor *const desc,
    enum audio_dir dir,
    audio_buffer_handler_t handler,
    void * buf,
    uint32_t size
)

This function schedules a non-blocking read or write operation. The function adds the requests to the hardware instance queue and returns immediately.

Parameters

desc

Type: struct audio_dma_descriptor Struct *const

Pointer to the audio driver descriptor

dir

Type: enum audio_dir Enum

Identifies add the buffer to read or write queue

handler

Type: audio_buffer_handler_t typedef

Pointer the return buffer handle

buf

Type: void *

Buffer where the read or write data will be stored

size

Type: uint32_t

Buffer size in bytes

Returns

Type: int32_t

The state of the buffer operation.

ERR_NONE

Schedule buffer operation success

ERR_NO_RESOURCE

Buffer queue was full