|
Sound Open Firmware
|
Interconnect buffers, circular stream buffers, abstract audio buffers, and lockless ring buffers. More...
Files | |
| file | audio_buffer.h |
| Audio buffer operations, descriptors, and unified audio buffer interfaces. | |
| file | buffer.h |
| Component interconnect buffer allocation and stream handling. | |
| file | ring_buffer.h |
| Lockless async circular ring buffer for cross-core audio processing. | |
Data Structures | |
| struct | audio_buffer_ops |
| Audio buffer virtual operations table. More... | |
| struct | sof_audio_buffer |
| Base class for all audio buffers. More... | |
| struct | audio_stream |
| Audio stream is a circular buffer aware of audio format of the data in the buffer so provides API for reading and writing not only bytes, but also samples and frames. More... | |
| struct | cir_buf_ptr |
| struct | comp_buffer |
| Audio component interconnect buffer connecting two pipeline components. More... | |
| struct | buffer_cb_transact |
| Transaction descriptor passed to buffer probe callbacks. More... | |
| struct | ring_buffer |
| Lockless asynchronous circular ring buffer structure. More... | |
Macros | |
| #define | audio_stream_read_frag(buffer, idx, size) audio_stream_get_frag(buffer, (buffer)->r_ptr, idx, size) |
| Retrieves readable address of a sample at specified index (see versions of this macro specialized for various sample types). | |
| #define | audio_stream_read_frag_s16(buffer, idx) audio_stream_get_frag(buffer, (buffer)->r_ptr, idx, sizeof(int16_t)) |
| Retrieves readable address of a signed 16-bit sample at specified index. | |
| #define | audio_stream_read_frag_s32(buffer, idx) audio_stream_get_frag(buffer, (buffer)->r_ptr, idx, sizeof(int32_t)) |
| Retrieves readable address of a signed 32-bit sample at specified index. | |
| #define | audio_stream_write_frag(buffer, idx, size) audio_stream_get_frag(buffer, (buffer)->w_ptr, idx, size) |
| Retrieves writeable address of a sample at specified index (see versions of this macro specialized for various sample types). | |
| #define | audio_stream_write_frag_s16(buffer, idx) audio_stream_get_frag(buffer, (buffer)->w_ptr, idx, sizeof(int16_t)) |
| Retrieves writeable address of a signed 16-bit sample at specified index. | |
| #define | audio_stream_write_frag_s32(buffer, idx) audio_stream_get_frag(buffer, (buffer)->w_ptr, idx, sizeof(int32_t)) |
| Retrieves writeable address of a signed 32-bit sample at specified index. | |
| #define | audio_stream_get_frag(buffer, ptr, idx, sample_size) audio_stream_wrap(buffer, (char *)(ptr) + ((idx) * (sample_size))) |
| Retrieves address of sample (space for sample) at specified index within the buffer. | |
| #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. | |
Functions | |
| static struct sof_sink * | audio_buffer_get_sink (struct sof_audio_buffer *buffer) |
| Return pointer to sink interface of audio buffer. | |
| static struct sof_source * | audio_buffer_get_source (struct sof_audio_buffer *buffer) |
| Return pointer to source interface of audio buffer. | |
| static bool | audio_buffer_is_shared (struct sof_audio_buffer *buffer) |
| Check if audio buffer is shared across cores. | |
| static bool | audio_buffer_hw_params_configured (struct sof_audio_buffer *buffer) |
| Check if buffer hardware parameters are configured. | |
| static void | audio_buffer_set_hw_params_configured (struct sof_audio_buffer *buffer) |
| Mark buffer hardware parameters as configured (state set to READY). | |
| static void | audio_buffer_reset_params (struct sof_audio_buffer *buffer) |
| Reset buffer parameters state to initial. | |
| static enum sof_audio_buffer_state | audio_buffer_get_state (const struct sof_audio_buffer *buffer) |
| Retrieve current buffer state. | |
| static void | audio_buffer_set_state (struct sof_audio_buffer *buffer, enum sof_audio_buffer_state state) |
| Set buffer state. | |
| static void | audio_buffer_set_eos (struct sof_audio_buffer *buffer) |
| Mark buffer state as end-of-stream (EOS). | |
| static uint16_t | audio_buffer_get_chmap (struct sof_audio_buffer *buffer, size_t index) |
| Retrieve channel map value for a given channel index. | |
| static void | audio_buffer_set_chmap (struct sof_audio_buffer *buffer, size_t index, uint16_t value) |
| Set channel map value for a given channel index. | |
| static struct sof_audio_stream_params * | audio_buffer_get_stream_params (struct sof_audio_buffer *buffer) |
| Retrieve pointer to runtime stream parameters. | |
| static struct sof_audio_buffer * | sof_audio_buffer_from_sink (struct sof_sink *sink) |
| Retrieve enclosing sof_audio_buffer from sink interface pointer. | |
| static struct sof_audio_buffer * | sof_audio_buffer_from_source (struct sof_source *source) |
| Retrieve enclosing sof_audio_buffer from source interface pointer. | |
| void | audio_buffer_init (struct sof_audio_buffer *buffer, uint32_t buffer_type, bool is_shared, const struct source_ops *source_ops, const struct sink_ops *sink_ops, const struct audio_buffer_ops *audio_buffer_ops, struct sof_audio_stream_params *audio_stream_params) |
| Initialize audio buffer structure and virtual operation tables. | |
| void | audio_buffer_free (struct sof_audio_buffer *buffer) |
| Free audio buffer and all allocated resources. | |
| static void | audio_buffer_reset (struct sof_audio_buffer *buffer) |
| Reset all buffer data and positions leaving configuration intact. | |
| int | audio_buffer_source_set_ipc_params (struct sof_source *source, struct sof_ipc_stream_params *params, bool force_update) |
| Set IPC stream parameters via source interface wrapper. | |
| int | audio_buffer_source_on_audio_format_set (struct sof_source *source) |
| Audio format set callback via source interface wrapper. | |
| int | audio_buffer_source_set_alignment_constants (struct sof_source *source, const uint32_t byte_align, const uint32_t frame_align_req) |
| Set alignment constraints via source interface wrapper. | |
| int | audio_buffer_sink_set_ipc_params (struct sof_sink *sink, struct sof_ipc_stream_params *params, bool force_update) |
| Set IPC stream parameters via sink interface wrapper. | |
| int | audio_buffer_sink_on_audio_format_set (struct sof_sink *sink) |
| Audio format set callback via sink interface wrapper. | |
| int | audio_buffer_sink_set_alignment_constants (struct sof_sink *sink, const uint32_t byte_align, const uint32_t frame_align_req) |
| Set alignment constraints via sink interface wrapper. | |
| uint32_t | audio_buffer_sink_get_lft (struct sof_sink *sink) |
| Get linear free time (LFT) duration in microseconds from sink interface wrapper. | |
| void | audio_stream_recalc_align (struct audio_stream *stream) |
| static void * | audio_stream_get_rptr (const struct audio_stream *buf) |
| static void * | audio_stream_get_wptr (const struct audio_stream *buf) |
| static void * | audio_stream_get_end_addr (const struct audio_stream *buf) |
| static void * | audio_stream_get_addr (const struct audio_stream *buf) |
| static uint32_t | audio_stream_get_size (const struct audio_stream *buf) |
| static uint32_t | audio_stream_get_avail (const struct audio_stream *buf) |
| static uint32_t | audio_stream_get_free (const struct audio_stream *buf) |
| static enum sof_ipc_frame | audio_stream_get_frm_fmt (const struct audio_stream *buf) |
| static enum sof_ipc_frame | audio_stream_get_valid_fmt (const struct audio_stream *buf) |
| static uint32_t | audio_stream_get_rate (const struct audio_stream *buf) |
| static uint32_t | audio_stream_get_channels (const struct audio_stream *buf) |
| static bool | audio_stream_get_underrun (const struct audio_stream *buf) |
| static uint32_t | audio_stream_get_buffer_fmt (const struct audio_stream *buf) |
| static bool | audio_stream_get_overrun (const struct audio_stream *buf) |
| static void | audio_stream_set_rptr (struct audio_stream *buf, void *val) |
| static void | audio_stream_set_wptr (struct audio_stream *buf, void *val) |
| static void | audio_stream_set_end_addr (struct audio_stream *buf, void *val) |
| static void | audio_stream_set_addr (struct audio_stream *buf, void *val) |
| static void | audio_stream_set_size (struct audio_stream *buf, uint32_t val) |
| static void | audio_stream_set_avail (struct audio_stream *buf, uint32_t val) |
| static void | audio_stream_set_free (struct audio_stream *buf, uint32_t val) |
| static void | audio_stream_set_frm_fmt (struct audio_stream *buf, enum sof_ipc_frame val) |
| static void | audio_stream_set_valid_fmt (struct audio_stream *buf, enum sof_ipc_frame val) |
| static void | audio_stream_set_rate (struct audio_stream *buf, uint32_t val) |
| static void | audio_stream_set_channels (struct audio_stream *buf, uint16_t val) |
| static void | audio_stream_set_underrun (struct audio_stream *buf, bool underrun_permitted) |
| static void | audio_stream_set_overrun (struct audio_stream *buf, bool overrun_permitted) |
| static void | audio_stream_set_buffer_fmt (struct audio_stream *buf, uint32_t buffer_fmt) |
| static uint32_t | audio_stream_frame_bytes (const struct audio_stream *buf) |
| Calculates period size in bytes based on component stream's parameters. | |
| static uint32_t | audio_stream_sample_bytes (const struct audio_stream *buf) |
| Calculates sample size in bytes based on component stream's parameters. | |
| void | audio_stream_set_align (const uint32_t byte_align, const uint32_t frame_align_req, struct audio_stream *stream) |
| Set processing alignment requirements. | |
| static int | audio_stream_set_params (struct audio_stream *buffer, struct sof_ipc_stream_params *params) |
| Applies parameters to the buffer. | |
| static uint32_t | audio_stream_period_bytes (const struct audio_stream *buf, uint32_t frames) |
| Calculates period size in bytes based on component stream's parameters. | |
| static void * | audio_stream_wrap (const struct audio_stream *buffer, void *ptr) |
| Verifies the pointer and performs rollover when reached the end of the buffer. | |
| static void * | audio_stream_rewind_wrap (const struct audio_stream *buffer, void *ptr) |
| Verifies the pointer and performs rollover when reached the end of the buffer. | |
| static uint32_t | audio_stream_get_avail_bytes (const struct audio_stream *stream) |
| Calculates available data in bytes, handling underrun_permitted behaviour. | |
| static uint32_t | audio_stream_get_avail_samples (const struct audio_stream *stream) |
| Calculates available data in samples, handling underrun_permitted behaviour. | |
| static uint32_t | audio_stream_get_avail_frames (const struct audio_stream *stream) |
| Calculates available data in frames, handling underrun_permitted behaviour. | |
| static uint32_t | audio_stream_get_free_bytes (const struct audio_stream *stream) |
| Calculates free space in bytes, handling overrun_permitted behaviour. | |
| static uint32_t | audio_stream_get_free_samples (const struct audio_stream *stream) |
| Calculates free space in samples, handling overrun_permitted behaviour. | |
| static uint32_t | audio_stream_get_free_frames (const struct audio_stream *stream) |
| Calculates free space in frames, handling overrun_permitted behaviour. | |
| static int | audio_stream_can_copy_bytes (const struct audio_stream *source, const struct audio_stream *sink, uint32_t bytes) |
| Verifies whether specified number of bytes can be copied from source buffer to sink buffer. | |
| static uint32_t | audio_stream_get_copy_bytes (const struct audio_stream *source, const struct audio_stream *sink) |
| Computes maximum number of bytes that can be copied from source buffer to sink buffer, verifying number of bytes available in source vs. | |
| static uint32_t | audio_stream_avail_frames (const struct audio_stream *source, const struct audio_stream *sink) |
| Computes maximum number of frames that can be copied from source buffer to sink buffer, verifying number of available source frames vs. | |
| static uint32_t | audio_stream_align_frames_round_down (const struct audio_stream *stream, uint32_t frames) |
| Rounds down a frame count to meet the alignment constraint of the stream. | |
| static uint32_t | audio_stream_align_frames_round_up (const struct audio_stream *stream, uint32_t frames) |
| Rounds up a frame count to meet the alignment constraint of the stream. | |
| static uint32_t | audio_stream_align_frames_round_nearest (const struct audio_stream *stream, uint32_t frames) |
| Rounds to nearest a frame count to meet the alignment constraint of the stream. | |
| static uint32_t | audio_stream_avail_frames_aligned (const struct audio_stream *source, const struct audio_stream *sink) |
| Computes maximum number of frames aligned with source align criteria that can be copied from source buffer to sink buffer, verifying number of available source frames vs. | |
| static void | audio_stream_produce (struct audio_stream *buffer, uint32_t bytes) |
| Updates the buffer state after writing to the buffer. | |
| static void | audio_stream_consume (struct audio_stream *buffer, uint32_t bytes) |
| Updates the buffer state after reading from the buffer. | |
| static void | audio_stream_reset (struct audio_stream *buffer) |
| Resets the buffer. | |
| void | audio_stream_init (struct audio_stream *audio_stream, void *buff_addr, uint32_t size) |
| Initializes the buffer with specified memory block and size. | |
| static void | audio_stream_invalidate (struct audio_stream *buffer, uint32_t bytes) |
| Invalidates (in DSP d-cache) the buffer in range [r_ptr, r_ptr+bytes], with rollover if necessary. | |
| static void | audio_stream_writeback (struct audio_stream *buffer, uint32_t bytes) |
| Writes back (from DSP d-cache) the buffer in range [w_ptr, w_ptr+bytes], with rollover if necessary. | |
| static int | audio_stream_bytes_without_wrap (const struct audio_stream *source, const void *ptr) |
| Calculates numbers of bytes to buffer wrap. | |
| static int | audio_stream_rewind_bytes_without_wrap (const struct audio_stream *source, const void *ptr) |
| Calculates numbers of bytes to buffer wrap when reading stream backwards from current sample pointed by ptr towards begin. | |
| static uint32_t * | audio_stream_rewind_wptr_by_bytes (const struct audio_stream *source, const uint32_t bytes) |
| Calculate position of write pointer to the position before the data was copied to source buffer. | |
| static int | audio_stream_samples_without_wrap_s16 (const struct audio_stream *source, const void *ptr) |
| Calculates numbers of s16 samples to buffer wrap when buffer is read forward towards end address. | |
| static int | audio_stream_samples_without_wrap_s24 (const struct audio_stream *source, const void *ptr) |
| Calculates numbers of s24 samples to buffer wrap when buffer is read forward towards end address. | |
| static int | audio_stream_samples_without_wrap_s32 (const struct audio_stream *source, const void *ptr) |
| Calculates numbers of s32 samples to buffer wrap when buffer is read forward towards end address. | |
| static uint32_t | audio_stream_frames_without_wrap (const struct audio_stream *source, const void *ptr) |
| Calculates numbers of frames to buffer wrap and return minimum of calculated value. | |
| int | audio_stream_copy (const struct audio_stream *source, uint32_t ioffset, struct audio_stream *sink, uint32_t ooffset, uint32_t samples) |
| Copies data from source buffer to sink buffer. | |
| void | cir_buf_copy (const void *src, const void *src_addr, const void *src_end, void *dst, void *dst_addr, void *dst_end, size_t byte_size) |
| Copies data from one circular buffer to another circular buffer. | |
| void | audio_stream_copy_from_linear (const void *linear_source, int ioffset, struct audio_stream *sink, int ooffset, unsigned int samples) |
| Copies data from linear source buffer to circular sink buffer. | |
| void | audio_stream_copy_to_linear (const struct audio_stream *source, int ioffset, void *linear_sink, int ooffset, unsigned int samples) |
| Copies data from circular source buffer to linear sink buffer. | |
| static int | audio_stream_set_zero (struct audio_stream *buffer, uint32_t bytes) |
| Writes zeros in range [w_ptr, w_ptr+bytes], with rollover if necessary. | |
| static void | cir_buf_set_zero (void *ptr, void *buf_addr, void *buf_end, uint32_t bytes) |
| Writes zeros to circular buffer in range [ptr, ptr+bytes] with rollover if necessary. | |
| static int | audio_stream_fmt_conversion (enum ipc4_bit_depth depth, enum ipc4_bit_depth valid, enum sof_ipc_frame *frame_fmt, enum sof_ipc_frame *valid_fmt, enum ipc4_sample_type type) |
| 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. | |
| struct ring_buffer * | ring_buffer_create (struct comp_dev *dev, size_t min_available, size_t min_free_space, bool is_shared, uint32_t id) |
| Create and allocate a lockless async circular ring buffer. | |
Trace macros | |
| struct tr_ctx | buffer_tr |
| #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. | |
Buffer type identifiers | |
| #define | BUFFER_TYPE_LEGACY_BUFFER 1 |
| Legacy comp_buffer type (pipeline 1.0) | |
| #define | BUFFER_TYPE_RING_BUFFER 2 |
| Lockless async circular ring buffer type (cross-core) | |
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. | |
Interconnect buffers, circular stream buffers, abstract audio buffers, and lockless ring buffers.
| #define audio_stream_get_frag | ( | buffer, | |
| ptr, | |||
| idx, | |||
| sample_size | |||
| ) | audio_stream_wrap(buffer, (char *)(ptr) + ((idx) * (sample_size))) |
Retrieves address of sample (space for sample) at specified index within the buffer.
Index is interpreted as an offset relative to the specified pointer, rollover is ensured.
| buffer | Circular buffer. |
| ptr | Pointer to start from, it may be either read or write pointer. |
| idx | Index of the sample. |
| sample_size | Size of the sample in bytes. |
| #define audio_stream_read_frag | ( | buffer, | |
| idx, | |||
| size | |||
| ) | audio_stream_get_frag(buffer, (buffer)->r_ptr, idx, size) |
Retrieves readable address of a sample at specified index (see versions of this macro specialized for various sample types).
| buffer | Buffer. |
| idx | Index of sample. |
| size | Size of sample in bytes. |
Once the consumer finishes reading samples from the buffer, it should "commit" the operation and update the buffer state by calling audio_stream_consume().
| #define audio_stream_read_frag_s16 | ( | buffer, | |
| idx | |||
| ) | audio_stream_get_frag(buffer, (buffer)->r_ptr, idx, sizeof(int16_t)) |
Retrieves readable address of a signed 16-bit sample at specified index.
| buffer | Buffer. |
| idx | Index of sample. |
| #define audio_stream_read_frag_s32 | ( | buffer, | |
| idx | |||
| ) | audio_stream_get_frag(buffer, (buffer)->r_ptr, idx, sizeof(int32_t)) |
Retrieves readable address of a signed 32-bit sample at specified index.
| buffer | Buffer. |
| idx | Index of sample. |
| #define audio_stream_write_frag | ( | buffer, | |
| idx, | |||
| size | |||
| ) | audio_stream_get_frag(buffer, (buffer)->w_ptr, idx, size) |
Retrieves writeable address of a sample at specified index (see versions of this macro specialized for various sample types).
| buffer | Buffer. |
| idx | Index of sample. |
| size | Size of sample in bytes. |
Once the producer finishes writing samples to the buffer, it should "commit" the operation and update the buffer state by calling audio_stream_produce().
| #define audio_stream_write_frag_s16 | ( | buffer, | |
| idx | |||
| ) | audio_stream_get_frag(buffer, (buffer)->w_ptr, idx, sizeof(int16_t)) |
Retrieves writeable address of a signed 16-bit sample at specified index.
| buffer | Buffer. |
| idx | Index of sample. |
| #define audio_stream_write_frag_s32 | ( | buffer, | |
| idx | |||
| ) | audio_stream_get_frag(buffer, (buffer)->w_ptr, idx, sizeof(int32_t)) |
Retrieves writeable address of a signed 32-bit sample at specified index.
| buffer | Buffer. |
| idx | Index of sample. |
| #define buf_dbg | ( | buf_ptr, | |
| __e, | |||
| ... | |||
| ) |
Trace debug message from buffer.
| #define buf_err | ( | buf_ptr, | |
| __e, | |||
| ... | |||
| ) |
Trace error message from buffer.
| #define buf_get_id | ( | buf_ptr | ) | ((buf_ptr)->stream.runtime_stream_params.id) |
Retrieves subid (comp id) from the buffer.
| #define buf_info | ( | buf_ptr, | |
| __e, | |||
| ... | |||
| ) |
Trace info message from buffer.
| #define buf_warn | ( | buf_ptr, | |
| __e, | |||
| ... | |||
| ) |
Trace warning message from buffer.
| #define BUFF_CB_TYPE_CONSUME BIT(1) |
Callback triggered on buffer consume.
| #define BUFF_CB_TYPE_PRODUCE BIT(0) |
Callback triggered on buffer produce.
| #define BUFF_PARAMS_BUFFER_FMT BIT(1) |
Buffer parameter bitmask: buffer format.
| #define BUFF_PARAMS_CHANNELS BIT(3) |
Buffer parameter bitmask: channels count.
| #define BUFF_PARAMS_FRAME_FMT BIT(0) |
Buffer parameter bitmask: frame format.
| #define BUFF_PARAMS_RATE BIT(2) |
Buffer parameter bitmask: sample rate.
| #define buffer_from_list | ( | ptr, | |
| dir | |||
| ) |
Retrieve enclosing comp_buffer from a list node depending on traversal direction.
| [in] | ptr | List item pointer. |
| [in] | dir | Pipeline traversal direction (PPL_DIR_DOWNSTREAM or PPL_DIR_UPSTREAM). |
Set transaction callback on a component buffer.
| [in,out] | buffer | Target component buffer. |
| [in] | func | Callback function pointer. |
| [in] | data | Callback user data. |
| [in] | type | Callback trigger type (BUFF_CB_TYPE_*). |
| #define BUFFER_TYPE_LEGACY_BUFFER 1 |
Legacy comp_buffer type (pipeline 1.0)
| #define BUFFER_TYPE_RING_BUFFER 2 |
Lockless async circular ring buffer type (cross-core)
| #define BUFFER_UPDATE_FORCE 1 |
Force update buffer parameters regardless of current state.
| #define BUFFER_UPDATE_IF_UNSET 0 |
Update buffer parameters only if currently unset.
| #define BUFFER_USAGE_NOT_SHARED false |
Buffer only used by one HW block.
| #define BUFFER_USAGE_SHARED true |
Buffer used by multiple DSP cores and/or HW blocks.
| #define trace_buf_get_tr_ctx | ( | buf_ptr | ) | (&(buf_ptr)->tctx) |
Retrieves trace context from the buffer.
| void audio_buffer_free | ( | struct sof_audio_buffer * | buffer | ) |
Free audio buffer and all allocated resources.
| [in,out] | buffer | Pointer to audio buffer to free. |
|
inlinestatic |
Retrieve channel map value for a given channel index.
| [in] | buffer | Pointer to audio buffer. |
| [in] | index | Channel index. |
|
inlinestatic |
Return pointer to sink interface of audio buffer.
| [in] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Return pointer to source interface of audio buffer.
| [in] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Retrieve current buffer state.
| [in] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Retrieve pointer to runtime stream parameters.
| [in] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Check if buffer hardware parameters are configured.
| [in] | buffer | Pointer to audio buffer. |
| void audio_buffer_init | ( | struct sof_audio_buffer * | buffer, |
| uint32_t | buffer_type, | ||
| bool | is_shared, | ||
| const struct source_ops * | source_ops, | ||
| const struct sink_ops * | sink_ops, | ||
| const struct audio_buffer_ops * | audio_buffer_ops, | ||
| struct sof_audio_stream_params * | audio_stream_params | ||
| ) |
Initialize audio buffer structure and virtual operation tables.
| [in,out] | buffer | Pointer to audio buffer. |
| [in] | buffer_type | Buffer type identifier (BUFFER_TYPE_*). |
| [in] | is_shared | True if buffer is shared between cores. |
| [in] | source_ops | Pointer to source operations table. |
| [in] | sink_ops | Pointer to sink operations table. |
| [in] | audio_buffer_ops | Pointer to audio buffer operations table. |
| [in,out] | audio_stream_params | Pointer to audio stream parameters. |
|
inlinestatic |
Check if audio buffer is shared across cores.
| [in] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Reset all buffer data and positions leaving configuration intact.
| [in,out] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Reset buffer parameters state to initial.
| [in,out] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Set channel map value for a given channel index.
| [in,out] | buffer | Pointer to audio buffer. |
| [in] | index | Channel index. |
| [in] | value | Channel map value to set. |
|
inlinestatic |
Mark buffer state as end-of-stream (EOS).
| [in,out] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Mark buffer hardware parameters as configured (state set to READY).
| [in,out] | buffer | Pointer to audio buffer. |
|
inlinestatic |
Set buffer state.
| [in,out] | buffer | Pointer to audio buffer. |
| [in] | state | New state to assign. |
| uint32_t audio_buffer_sink_get_lft | ( | struct sof_sink * | sink | ) |
Get linear free time (LFT) duration in microseconds from sink interface wrapper.
| [in] | sink | Pointer to sink interface. |
| int audio_buffer_sink_on_audio_format_set | ( | struct sof_sink * | sink | ) |
Audio format set callback via sink interface wrapper.
| [in,out] | sink | Pointer to sink interface. |
| int audio_buffer_sink_set_alignment_constants | ( | struct sof_sink * | sink, |
| const uint32_t | byte_align, | ||
| const uint32_t | frame_align_req | ||
| ) |
Set alignment constraints via sink interface wrapper.
| [in,out] | sink | Pointer to sink interface. |
| [in] | byte_align | Byte alignment requirement in bytes. |
| [in] | frame_align_req | Frame alignment requirement in frames. |
| int audio_buffer_sink_set_ipc_params | ( | struct sof_sink * | sink, |
| struct sof_ipc_stream_params * | params, | ||
| bool | force_update | ||
| ) |
Set IPC stream parameters via sink interface wrapper.
| [in,out] | sink | Pointer to sink interface. |
| [in] | params | Stream parameters to apply. |
| [in] | force_update | If true, overwrite parameters unconditionally. |
| int audio_buffer_source_on_audio_format_set | ( | struct sof_source * | source | ) |
Audio format set callback via source interface wrapper.
| [in,out] | source | Pointer to source interface. |
| int audio_buffer_source_set_alignment_constants | ( | struct sof_source * | source, |
| const uint32_t | byte_align, | ||
| const uint32_t | frame_align_req | ||
| ) |
Set alignment constraints via source interface wrapper.
| [in,out] | source | Pointer to source interface. |
| [in] | byte_align | Byte alignment requirement in bytes. |
| [in] | frame_align_req | Frame alignment requirement in frames. |
| int audio_buffer_source_set_ipc_params | ( | struct sof_source * | source, |
| struct sof_ipc_stream_params * | params, | ||
| bool | force_update | ||
| ) |
Set IPC stream parameters via source interface wrapper.
| [in,out] | source | Pointer to source interface. |
| [in] | params | Stream parameters to apply. |
| [in] | force_update | If true, overwrite parameters unconditionally. |
|
inlinestatic |
Rounds down a frame count to meet the alignment constraint of the stream.
| stream | Audio stream with alignment requirements set. |
| frames | Frame count to round down. |
|
inlinestatic |
Rounds to nearest a frame count to meet the alignment constraint of the stream.
| stream | Audio stream with alignment requirements set. |
| frames | Frame count to round to nearest. |
|
inlinestatic |
Rounds up a frame count to meet the alignment constraint of the stream.
| stream | Audio stream with alignment requirements set. |
| frames | Frame count to round up. |
|
inlinestatic |
Computes maximum number of frames that can be copied from source buffer to sink buffer, verifying number of available source frames vs.
free space available in sink.
| source | Source buffer. |
| sink | Sink buffer. |
|
inlinestatic |
Computes maximum number of frames aligned with source align criteria that can be copied from source buffer to sink buffer, verifying number of available source frames vs.
free space available in sink.
| source | Buffer of source. |
| sink | Buffer of sink. |
|
inlinestatic |
Calculates numbers of bytes to buffer wrap.
| source | Stream to get information from. |
| ptr | Read or write pointer from source |
|
inlinestatic |
Verifies whether specified number of bytes can be copied from source buffer to sink buffer.
| source | Source buffer. |
| sink | Sink buffer. |
| bytes | Number of bytes to copy. |
|
inlinestatic |
Updates the buffer state after reading from the buffer.
| buffer | Buffer to update. |
| bytes | Number of read bytes. |
| int audio_stream_copy | ( | const struct audio_stream * | source, |
| uint32_t | ioffset, | ||
| struct audio_stream * | sink, | ||
| uint32_t | ooffset, | ||
| uint32_t | samples | ||
| ) |
Copies data from source buffer to sink buffer.
| source | Source buffer. |
| ioffset | Offset (in samples) in source buffer to start reading from. |
| sink | Sink buffer. |
| ooffset | Offset (in samples) in sink buffer to start writing to. |
| samples | Number of samples to copy. |
| void audio_stream_copy_from_linear | ( | const void * | linear_source, |
| int | ioffset, | ||
| struct audio_stream * | sink, | ||
| int | ooffset, | ||
| unsigned int | samples | ||
| ) |
Copies data from linear source buffer to circular sink buffer.
| linear_source | Source buffer. |
| ioffset | Offset (in samples) in source buffer to start reading from. |
| sink | Sink buffer. |
| ooffset | Offset (in samples) in sink buffer to start writing to. |
| samples | Number of samples to copy. |
| void audio_stream_copy_to_linear | ( | const struct audio_stream * | source, |
| int | ioffset, | ||
| void * | linear_sink, | ||
| int | ooffset, | ||
| unsigned int | samples | ||
| ) |
Copies data from circular source buffer to linear sink buffer.
| source | Source buffer. |
| ioffset | Offset (in samples) in source buffer to start reading from. |
| linear_sink | Sink buffer. |
| ooffset | Offset (in samples) in sink buffer to start writing to. |
| samples | Number of samples to copy. |
|
inlinestatic |
|
inlinestatic |
Calculates period size in bytes based on component stream's parameters.
| buf | Component buffer. |
|
inlinestatic |
Calculates numbers of frames to buffer wrap and return minimum of calculated value.
| source | Stream to get information from. |
| ptr | Read or write pointer from source |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Calculates available data in bytes, handling underrun_permitted behaviour.
| stream | Stream pointer |
|
inlinestatic |
Calculates available data in frames, handling underrun_permitted behaviour.
| stream | Stream pointer |
|
inlinestatic |
Calculates available data in samples, handling underrun_permitted behaviour.
| stream | Stream pointer |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Computes maximum number of bytes that can be copied from source buffer to sink buffer, verifying number of bytes available in source vs.
free space available in sink.
| source | Source buffer. |
| sink | Sink buffer. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Calculates free space in bytes, handling overrun_permitted behaviour.
| stream | Stream pointer |
|
inlinestatic |
Calculates free space in frames, handling overrun_permitted behaviour.
| stream | Stream pointer |
|
inlinestatic |
Calculates free space in samples, handling overrun_permitted behaviour.
| stream | Stream pointer |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| void audio_stream_init | ( | struct audio_stream * | audio_stream, |
| void * | buff_addr, | ||
| uint32_t | size | ||
| ) |
Initializes the buffer with specified memory block and size.
| audio_stream | the audio_stream a to initialize. |
| buff_addr | Address of the memory block to assign. |
| size | Size of the memory block in bytes. |
|
inlinestatic |
Invalidates (in DSP d-cache) the buffer in range [r_ptr, r_ptr+bytes], with rollover if necessary.
| buffer | Buffer. |
| bytes | Size of the fragment to invalidate. |
|
inlinestatic |
Calculates period size in bytes based on component stream's parameters.
| buf | Component buffer. |
| frames | Number of processing frames. |
|
inlinestatic |
Updates the buffer state after writing to the buffer.
| buffer | Buffer to update. |
| bytes | Number of written bytes. |
| void audio_stream_recalc_align | ( | struct audio_stream * | stream | ) |
|
inlinestatic |
Resets the buffer.
| buffer | Buffer to reset. |
|
inlinestatic |
Calculates numbers of bytes to buffer wrap when reading stream backwards from current sample pointed by ptr towards begin.
| source | Stream to get information from. |
| ptr | Read or write pointer from source |
|
inlinestatic |
Calculate position of write pointer to the position before the data was copied to source buffer.
| source | Stream to get information from. |
| bytes | Number of bytes copied to source buffer. |
|
inlinestatic |
Verifies the pointer and performs rollover when reached the end of the buffer.
| buffer | Buffer accessed by the pointer. |
| ptr | Pointer |
|
inlinestatic |
Calculates sample size in bytes based on component stream's parameters.
| buf | Component buffer. |
|
inlinestatic |
Calculates numbers of s16 samples to buffer wrap when buffer is read forward towards end address.
| source | Stream to get information from. |
| ptr | Read or write pointer from source |
|
inlinestatic |
Calculates numbers of s24 samples to buffer wrap when buffer is read forward towards end address.
| source | Stream to get information from. |
| ptr | Read or write pointer from source |
|
inlinestatic |
Calculates numbers of s32 samples to buffer wrap when buffer is read forward towards end address.
| source | Stream to get information from. |
| ptr | Read or write pointer from source |
|
inlinestatic |
| void audio_stream_set_align | ( | const uint32_t | byte_align, |
| const uint32_t | frame_align_req, | ||
| struct audio_stream * | stream | ||
| ) |
Set processing alignment requirements.
Sets the sample byte alignment and aligned frame count required for processing done on this stream. This function may be called at any time, the internal constants are recalculated if the frame/sample size changes.
| byte_align | Processing byte alignment requirement. |
| frame_align_req | Processing frames alignment requirement. |
| stream | Sink or source stream structure which to be set. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Applies parameters to the buffer.
| buffer | Audio stream buffer. |
| params | Parameters (frame format, rate, number of channels). |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Writes zeros in range [w_ptr, w_ptr+bytes], with rollover if necessary.
| buffer | Buffer. |
| bytes | Size of the fragment to write zero. |
|
inlinestatic |
Verifies the pointer and performs rollover when reached the end of the buffer.
| buffer | Buffer accessed by the pointer. |
| ptr | Pointer |
|
inlinestatic |
Writes back (from DSP d-cache) the buffer in range [w_ptr, w_ptr+bytes], with rollover if necessary.
| buffer | Buffer. |
| bytes | Size of the fragment to write back. |
| 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.
| [in,out] | alloc | Allocation context (heap and optional vregion). |
| [in] | size | Required buffer capacity in bytes. |
| [in] | flags | Memory allocation flags (SOF_MEM_FLAG_...). |
| [in] | align | Memory alignment requirement in bytes. |
| [in] | is_shared | True if the buffer memory is shared across processing domains. |
| 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.
| [in,out] | alloc | Allocation context. |
| [in] | preferred_size | Desired optimal buffer capacity in bytes. |
| [in] | minimum_size | Minimum acceptable buffer capacity in bytes. |
| [in] | flags | Memory allocation flags (SOF_MEM_FLAG_...). |
| [in] | align | Memory alignment requirement in bytes. |
| [in] | is_shared | True if the buffer memory is shared across processing domains. |
| 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.
Locking: Must be called with interrupts disabled (or userspace LL system mutex held). The caller takes care to protect list heads. "head" must really be the head of the list, not a list node within another buffer, as its cache is not synchronized and must not be embedded in an object using the coherent API.
| [in,out] | buffer | Component buffer to attach. |
| [in,out] | head | List head to prepend buffer to. |
| [in] | dir | Traversal direction (PPL_DIR_DOWNSTREAM or PPL_DIR_UPSTREAM). |
| void buffer_detach | ( | struct comp_buffer * | buffer, |
| struct list_item * | head, | ||
| int | dir | ||
| ) |
Detach a buffer from anywhere in a component buffer list.
Locking: Must be called with interrupts disabled (or userspace LL system mutex held). "head" is the head of the list, assumed not to require cache synchronization. The caller takes care to protect list heads.
| [in,out] | buffer | Component buffer to detach. |
| [in,out] | head | List head buffer is attached to. |
| [in] | dir | Traversal direction (PPL_DIR_DOWNSTREAM or PPL_DIR_UPSTREAM). |
|
inlinestatic |
Free an interconnect component buffer and its underlying memory.
| [in,out] | buffer | Component buffer to free. |
|
inlinestatic |
Get component connected to buffer in specified traversal direction.
| [in] | buffer | Component buffer. |
| [in] | dir | Traversal direction (PPL_DIR_DOWNSTREAM or PPL_DIR_UPSTREAM). |
|
inlinestatic |
Initialize circular stream buffer descriptor for a component buffer.
| [in,out] | buffer | Component buffer to initialize stream for. |
| [in] | size | Capacity of the circular stream in bytes. |
| 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.
| [in,out] | alloc | Allocation context. |
| [in] | desc | IPC buffer descriptor containing size, flags, and configuration. |
| [in] | is_shared | True if the buffer memory is shared across processing domains. |
| 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.
| [in] | buffer | Component buffer to check. |
| [in] | params | Stream parameters to compare. |
| [in] | flag | Bitmask specifying which parameters to check (BUFF_PARAMS_*). |
|
inlinestatic |
Retrieve pipeline ID associated with a component buffer.
| [in] | buffer | Component buffer. |
| 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.
| [in,out] | buffer | Component buffer to configure. |
| [in] | params | Stream parameters to apply. |
| [in] | force_update | If true, overwrite existing parameters unconditionally. |
| int buffer_set_size | ( | struct comp_buffer * | buffer, |
| uint32_t | size, | ||
| uint32_t | alignment | ||
| ) |
Resize an existing pipeline component buffer.
| [in,out] | buffer | Pointer to comp_buffer to resize. |
| [in] | size | New buffer capacity in bytes. |
| [in] | alignment | Required memory alignment in bytes. |
| 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.
| [in,out] | buffer | Pointer to comp_buffer to resize. |
| [in] | preferred_size | Desired optimal buffer capacity in bytes. |
| [in] | minimum_size | Minimum acceptable buffer capacity in bytes. |
| [in] | alignment | Required memory alignment in bytes. |
|
inlinestatic |
Invalidate cache for a shared buffer stream if incoherent.
| [in,out] | buffer | Component buffer. |
| [in] | bytes | Number of bytes to invalidate. |
|
inlinestatic |
Write back cache for a shared buffer stream if incoherent.
| [in] | buffer | Component buffer. |
| [in] | bytes | Number of bytes to write back. |
| void buffer_zero | ( | struct comp_buffer * | buffer | ) |
Zero-fill the entire payload of an interconnect buffer.
| [in,out] | buffer | Component buffer to zero. |
| void cir_buf_copy | ( | const void * | src, |
| const void * | src_addr, | ||
| const void * | src_end, | ||
| void * | dst, | ||
| void * | dst_addr, | ||
| void * | dst_end, | ||
| size_t | byte_size | ||
| ) |
Copies data from one circular buffer to another circular buffer.
| src | Source pointer of source circular buffer. |
| src_addr | Start address of source circular buffer. |
| src_end | End address of source circular buffer. |
| dst | Sink pointer of source circular buffer. |
| dst_addr | Start address of sink circular buffer |
| dst_end | End address of sink circular buffer. |
| byte_size | Number of bytes to copy. |
|
inlinestatic |
Writes zeros to circular buffer in range [ptr, ptr+bytes] with rollover if necessary.
| ptr | Pointer inside circular biffer to start writing from. |
| buf_addr | Start of the circular buffer. |
| buf_end | End of the circular buffer. |
| bytes | Size of the fragment to write zeros. |
|
inlinestatic |
Retrieve enclosing comp_buffer from an audio sink interface pointer.
| [in] | sink | Pointer to audio sink interface. |
|
inlinestatic |
Retrieve enclosing comp_buffer from an audio source interface pointer.
| [in] | source | Pointer to audio source interface. |
|
inlinestatic |
Get component consuming data from the buffer.
| [in] | buffer | Interconnect buffer. |
|
inlinestatic |
Get component providing data to the buffer.
| [in] | buffer | Interconnect buffer. |
|
inlinestatic |
Reset buffer sink list node.
| [in,out] | buffer | Interconnect buffer. |
|
inlinestatic |
Reset buffer source list node.
| [in,out] | buffer | Interconnect buffer. |
|
inlinestatic |
Set component consuming data from the buffer.
| [in,out] | buffer | Interconnect buffer. |
| [in] | comp | Sink component device. |
|
inlinestatic |
Set component providing data to the buffer.
| [in,out] | buffer | Interconnect buffer. |
| [in] | comp | Source component device. |
| void comp_update_buffer_consume | ( | struct comp_buffer * | buffer, |
| uint32_t | bytes | ||
| ) |
Notify buffer that audio data has been consumed by a component.
| [in,out] | buffer | Component buffer read from. |
| [in] | bytes | Number of bytes consumed. |
| void comp_update_buffer_produce | ( | struct comp_buffer * | buffer, |
| uint32_t | bytes | ||
| ) |
Notify buffer that audio data has been produced by a component.
| [in,out] | buffer | Component buffer written to. |
| [in] | bytes | Number of bytes produced. |
| struct ring_buffer * ring_buffer_create | ( | struct comp_dev * | dev, |
| size_t | min_available, | ||
| size_t | min_free_space, | ||
| bool | is_shared, | ||
| uint32_t | id | ||
| ) |
Create and allocate a lockless async circular ring buffer.
| [in,out] | dev | Pointer to component device creating this buffer. |
| [in] | min_available | Minimum data available required by source API consumer. |
| [in] | min_free_space | Minimum buffer space required by sink API producer. |
| [in] | is_shared | True if buffer memory is shared across processing cores. |
| [in] | id | Stream identifier accessible via sink/source interface. |
|
inlinestatic |
Retrieve enclosing sof_audio_buffer from sink interface pointer.
NOTE: Ensure that sink is really embedded within a sof_audio_buffer; otherwise an invalid derived pointer will be returned.
| [in] | sink | Pointer to sink interface. |
|
inlinestatic |
Retrieve enclosing sof_audio_buffer from source interface pointer.
NOTE: Ensure that source is really embedded within a sof_audio_buffer; otherwise an invalid derived pointer will be returned.
| [in] | source | Pointer to source interface. |
|
extern |