Sound Open Firmware
Loading...
Searching...
No Matches

Component interconnect buffer allocation and stream handling. More...

Include dependency graph for buffer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  comp_buffer
 Audio component interconnect buffer connecting two pipeline components. More...
 
struct  buffer_cb_transact
 Transaction descriptor passed to buffer probe callbacks. More...
 

Macros

#define buffer_from_list(ptr, dir)
 Retrieve enclosing comp_buffer from a list node depending on traversal direction.
 
#define buffer_set_cb(buffer, func, data, type)
 Set transaction callback on a component buffer.
 
Buffer callback types
#define BUFF_CB_TYPE_PRODUCE   BIT(0)
 Callback triggered on buffer produce.
 
#define BUFF_CB_TYPE_CONSUME   BIT(1)
 Callback triggered on buffer consume.
 
Buffer parameter update modes
#define BUFFER_UPDATE_IF_UNSET   0
 Update buffer parameters only if currently unset.
 
#define BUFFER_UPDATE_FORCE   1
 Force update buffer parameters regardless of current state.
 
Buffer parameter bitmasks
#define BUFF_PARAMS_FRAME_FMT   BIT(0)
 Buffer parameter bitmask: frame format.
 
#define BUFF_PARAMS_BUFFER_FMT   BIT(1)
 Buffer parameter bitmask: buffer format.
 
#define BUFF_PARAMS_RATE   BIT(2)
 Buffer parameter bitmask: sample rate.
 
#define BUFF_PARAMS_CHANNELS   BIT(3)
 Buffer parameter bitmask: channels count.
 
Buffer memory sharing usage
#define BUFFER_USAGE_SHARED   true
 Buffer used by multiple DSP cores and/or HW blocks.
 
#define BUFFER_USAGE_NOT_SHARED   false
 Buffer only used by one HW block.
 

Functions

static struct comp_dev * comp_buffer_get_source_component (const struct comp_buffer *buffer)
 Get component providing data to the buffer.
 
static struct comp_dev * comp_buffer_get_sink_component (const struct comp_buffer *buffer)
 Get component consuming data from the buffer.
 
static void comp_buffer_set_source_component (struct comp_buffer *buffer, struct comp_dev *comp)
 Set component providing data to the buffer.
 
static void comp_buffer_set_sink_component (struct comp_buffer *buffer, struct comp_dev *comp)
 Set component consuming data from the buffer.
 
static void comp_buffer_reset_source_list (struct comp_buffer *buffer)
 Reset buffer source list node.
 
static void comp_buffer_reset_sink_list (struct comp_buffer *buffer)
 Reset buffer sink list node.
 
struct comp_buffer * buffer_alloc (struct mod_alloc_ctx *alloc, size_t size, uint32_t flags, uint32_t align, bool is_shared)
 Allocate a pipeline component audio buffer with explicit size and alignment.
 
struct comp_buffer * buffer_alloc_range (struct mod_alloc_ctx *alloc, size_t preferred_size, size_t minimum_size, uint32_t flags, uint32_t align, bool is_shared)
 Allocate a pipeline component buffer with an elastic size range.
 
struct comp_buffer * buffer_new (struct mod_alloc_ctx *alloc, const struct sof_ipc_buffer *desc, bool is_shared)
 Instantiate a pipeline component buffer from an IPC configuration descriptor.
 
int buffer_set_size (struct comp_buffer *buffer, uint32_t size, uint32_t alignment)
 Resize an existing pipeline component buffer.
 
int buffer_set_size_range (struct comp_buffer *buffer, size_t preferred_size, size_t minimum_size, uint32_t alignment)
 Resize a pipeline component buffer within a preferred-to-minimum range.
 
static struct comp_buffer * comp_buffer_get_from_source (struct sof_source *source)
 Retrieve enclosing comp_buffer from an audio source interface pointer.
 
static struct comp_buffer * comp_buffer_get_from_sink (struct sof_sink *sink)
 Retrieve enclosing comp_buffer from an audio sink interface pointer.
 
static void buffer_free (struct comp_buffer *buffer)
 Free an interconnect component buffer and its underlying memory.
 
void buffer_zero (struct comp_buffer *buffer)
 Zero-fill the entire payload of an interconnect buffer.
 
void comp_update_buffer_produce (struct comp_buffer *buffer, uint32_t bytes)
 Notify buffer that audio data has been produced by a component.
 
void comp_update_buffer_consume (struct comp_buffer *buffer, uint32_t bytes)
 Notify buffer that audio data has been consumed by a component.
 
int buffer_set_params (struct comp_buffer *buffer, struct sof_ipc_stream_params *params, bool force_update)
 Set audio stream parameters on a component buffer.
 
bool buffer_params_match (struct comp_buffer *buffer, struct sof_ipc_stream_params *params, uint32_t flag)
 Test if buffer stream parameters match requested parameters.
 
static void buffer_stream_invalidate (struct comp_buffer *buffer, uint32_t bytes)
 Invalidate cache for a shared buffer stream if incoherent.
 
static void buffer_stream_writeback (struct comp_buffer *buffer, uint32_t bytes)
 Write back cache for a shared buffer stream if incoherent.
 
int buffer_attach (struct comp_buffer *buffer, struct list_item *head, int dir)
 Attach a new buffer at the beginning of a component buffer list.
 
void buffer_detach (struct comp_buffer *buffer, struct list_item *head, int dir)
 Detach a buffer from anywhere in a component buffer list.
 
static struct comp_dev * buffer_get_comp (struct comp_buffer *buffer, int dir)
 Get component connected to buffer in specified traversal direction.
 
static uint32_t buffer_pipeline_id (const struct comp_buffer *buffer)
 Retrieve pipeline ID associated with a component buffer.
 
static void buffer_init_stream (struct comp_buffer *buffer, size_t size)
 Initialize circular stream buffer descriptor for a component buffer.
 

Trace macros

#define buf_get_id(buf_ptr)   ((buf_ptr)->stream.runtime_stream_params.id)
 Retrieves subid (comp id) from the buffer.
 
#define trace_buf_get_tr_ctx(buf_ptr)   (&(buf_ptr)->tctx)
 Retrieves trace context from the buffer.
 
#define buf_err(buf_ptr, __e, ...)
 Trace error message from buffer.
 
#define buf_warn(buf_ptr, __e, ...)
 Trace warning message from buffer.
 
#define buf_info(buf_ptr, __e, ...)
 Trace info message from buffer.
 
#define buf_dbg(buf_ptr, __e, ...)
 Trace debug message from buffer.
 
struct tr_ctx buffer_tr
 

Detailed Description

Component interconnect buffer allocation and stream handling.