Audio Pipeline & Buffer API#
Audio pipelines in SOF represent directed processing graphs linking audio stream sources, processing components, interconnect buffers, and audio sinks. This API governs pipeline scheduling domains, thread execution models, circular buffer management, and stream state transitions.
- group Pipeline & Buffer Infrastructure
Audio pipeline execution graphs, stream buffer management, scheduling, and processing threads.
Standard Component Stream Commands
TODO: use IPC versions after 1.1
Most component stream commands match one-to-one IPC stream trigger commands. However we add two PRE_ and two POST_ commands to the set. They are issued internally without matching IPC commands. A single START IPC command is translated into a sequence of PRE_START and START component commands, etc. POST_* commands aren’t used so far.
Values:
-
enumerator COMP_TRIGGER_STOP#
Stop component stream.
-
enumerator COMP_TRIGGER_START#
Start component stream.
-
enumerator COMP_TRIGGER_PAUSE#
Pause the component stream.
-
enumerator COMP_TRIGGER_RELEASE#
Release paused component stream.
-
enumerator COMP_TRIGGER_RESET#
Reset component.
-
enumerator COMP_TRIGGER_PREPARE#
Prepare component.
-
enumerator COMP_TRIGGER_XRUN#
XRUN component.
-
enumerator COMP_TRIGGER_PRE_START#
Prepare to start component stream.
-
enumerator COMP_TRIGGER_PRE_RELEASE#
Prepare to release paused component stream.
-
enumerator COMP_TRIGGER_POST_STOP#
Finalize stop component stream.
-
enumerator COMP_TRIGGER_POST_PAUSE#
Finalize pause component stream.
-
enumerator COMP_TRIGGER_NO_ACTION#
No action required.
-
enumerator COMP_TRIGGER_STOP#
Component registration
-
int comp_register(struct comp_driver_info *drv)#
Registers the component driver on the list of available components.
- Parameters:
drv – Component driver to be registered.
- Returns:
0 if succeeded, error code otherwise.
-
void comp_unregister(struct comp_driver_info *drv)#
Unregisters the component driver from the list of available components.
- Parameters:
drv – Component driver to be unregistered.
-
int comp_set_adapter_ops(const struct comp_driver *drv, const struct module_interface *ops)#
Set adapter ops for a dynamically created driver.
- Parameters:
drv – Component driver to update.
ops – Module interface operations.
- Returns:
0 or a negative error code
XRUN handling.
Audio Component States
-
COMP_STATE_NOT_EXIST#
Component does not exist.
-
COMP_STATE_INIT#
Component being initialised.
-
COMP_STATE_READY#
Component inactive, but ready.
-
COMP_STATE_SUSPEND#
Component suspended.
-
COMP_STATE_PREPARE#
Component prepared.
-
COMP_STATE_PAUSED#
Component paused.
-
COMP_STATE_ACTIVE#
Component active.
-
COMP_STATE_PRE_ACTIVE#
Component after early initialisation.
Standard Component Control Commands
“Value” commands are standard ones, known to the driver while “Data” commands are opaque blobs transferred by the driver.
TODO: see also: ref to ipc data structures for commands.
-
COMP_CMD_SET_VALUE#
Set value to component.
-
COMP_CMD_GET_VALUE#
Get value from component.
-
COMP_CMD_SET_DATA#
Set data to component.
-
COMP_CMD_GET_DATA#
Get data from component.
MMAP IPC status
-
COMP_CMD_IPC_MMAP_RPOS#
Host read position.
-
COMP_CMD_IPC_MMAP_PPOS#
DAI presentation position.
-
COMP_CMD_IPC_MMAP_VOL(chan)#
Volume.
Component status
-
COMP_STATUS_STATE_ALREADY_SET#
Comp set state status.
Component attribute types
-
COMP_ATTR_COPY_TYPE#
Comp copy type attribute.
-
COMP_ATTR_HOST_BUFFER#
Comp host buffer attribute.
-
COMP_ATTR_COPY_DIR#
Comp copy direction.
-
COMP_ATTR_VDMA_INDEX#
Comp index of the virtual DMA at the gateway.
-
COMP_ATTR_BASE_CONFIG#
Component base config.
-
COMP_ATTR_IPC4_CONFIG#
Component ipc4 set/get config.
Trace macros
-
trace_comp_drv_get_id(drv_p)#
Retrieves id (-1 = undefined) from the component driver.
-
trace_comp_drv_get_subid(drv_p)#
Retrieves subid (-1 = undefined) from the component driver.
-
trace_comp_get_id(comp_p)#
Retrieves id (pipe id) from the component device.
-
trace_comp_get_subid(comp_p)#
Retrieves subid (comp id) from the component device.
-
trace_comp_drv_get_tr_ctx(drv_p)#
Retrieves trace context from the component driver.
-
trace_comp_get_tr_ctx(comp_p)#
Retrieves trace context from the component device.
-
comp_cl_err(drv_p, __e, ...)#
Trace error message from component driver (no comp instance)
-
comp_cl_warn(drv_p, __e, ...)#
Trace warning message from component driver (no comp instance)
-
comp_cl_info(drv_p, __e, ...)#
Trace info message from component driver (no comp instance)
-
comp_cl_dbg(drv_p, __e, ...)#
Trace debug message from component driver (no comp instance)
-
comp_err(comp_p, __e, ...)#
Trace error message from component device.
-
comp_warn(comp_p, __e, ...)#
Trace warning message from component device.
-
comp_info(comp_p, __e, ...)#
Trace info message from component device.
-
comp_dbg(comp_p, __e, ...)#
Trace debug message from component device.
-
comp_perf_info(pcd, comp_p)#
-
comp_perf_avg_info(pcd, comp_p)#
Defines
-
audio_stream_read_frag(buffer, idx, size)#
Retrieves readable address of a sample at specified index (see versions of this macro specialized for various sample types).
Once the consumer finishes reading samples from the buffer, it should “commit” the operation and update the buffer state by calling audio_stream_consume().
See also
See also
See also
comp_update_buffer_consume().
Note
Components should call comp_update_buffer_consume().
- Parameters:
buffer – Buffer.
idx – Index of sample.
size – Size of sample in bytes.
- Returns:
Pointer to the sample.
-
audio_stream_read_frag_s16(buffer, idx)#
Retrieves readable address of a signed 16-bit sample at specified index.
See also
- Parameters:
buffer – Buffer.
idx – Index of sample.
- Returns:
Pointer to the sample.
-
audio_stream_read_frag_s32(buffer, idx)#
Retrieves readable address of a signed 32-bit sample at specified index.
See also
- Parameters:
buffer – Buffer.
idx – Index of sample.
- Returns:
Pointer to the sample.
-
audio_stream_write_frag(buffer, idx, size)#
Retrieves writeable address of a sample at specified index (see versions of this macro specialized for various sample types).
Once the producer finishes writing samples to the buffer, it should “commit” the operation and update the buffer state by calling audio_stream_produce().
See also
See also
See also
comp_update_buffer_produce().
Note
Components should call comp_update_buffer_produce().
- Parameters:
buffer – Buffer.
idx – Index of sample.
size – Size of sample in bytes.
- Returns:
Pointer to the space for sample.
-
audio_stream_write_frag_s16(buffer, idx)#
Retrieves writeable address of a signed 16-bit sample at specified index.
See also
- Parameters:
buffer – Buffer.
idx – Index of sample.
- Returns:
Pointer to the space for sample.
-
audio_stream_write_frag_s32(buffer, idx)#
Retrieves writeable address of a signed 32-bit sample at specified index.
See also
- Parameters:
buffer – Buffer.
idx – Index of sample.
- Returns:
Pointer to the space for sample.
-
audio_stream_get_frag(buffer, 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.
- Parameters:
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.
- Returns:
Pointer to the sample.
-
SOF_DRV_UID_NAME(drv)#
-
COMP_PROCESSING_DOMAIN_LL#
-
COMP_PROCESSING_DOMAIN_DP#
-
comp_dev_for_each_producer(_dev, _producer)#
-
comp_dev_for_each_producer_safe(_dev, _producer, _next_producer)#
-
comp_dev_for_each_consumer(_dev, _consumer)#
-
comp_dev_for_each_consumer_safe(_dev, _consumer, _next_consumer)#
-
comp_set_drvdata(c, data)#
Assigns private data to component device.
- Parameters:
c – Component device.
data – Private data.
-
comp_get_drvdata(c)#
Retrieves driver private data from component device.
- Parameters:
c – Component device.
- Returns:
Private data.
-
DECLARE_MODULE(init)#
Usage at the end of an independent module file: DECLARE_MODULE(sys_*_init);.
-
comp_buffer_list(comp, dir)#
Retrieves the component device buffer list.
-
SOF_SCHEDULER_FREE_IRQ_ONLY#
Scheduler free available flags.
Free function disables only interrupts
Enums
-
enum comp_endpoint_type#
Type of endpoint this component is connected to in a pipeline.
Values:
-
enumerator COMP_ENDPOINT_HOST#
Connected to host dma.
-
enumerator COMP_ENDPOINT_DAI#
Connected to dai dma.
-
enumerator COMP_ENDPOINT_NODE#
No dma connection.
-
enumerator COMP_ENDPOINT_HOST#
-
enum comp_copy_type#
Type of next dma copy mode, changed on runtime.
Supported by host as COMP_ATTR_COPY_TYPE parameter to comp_set_attribute().
Values:
-
enumerator COMP_COPY_INVALID#
Invalid.
-
enumerator COMP_COPY_NORMAL#
Normal.
-
enumerator COMP_COPY_BLOCKING#
Blocking.
-
enumerator COMP_COPY_ONE_SHOT#
One-shot.
-
enumerator COMP_COPY_INVALID#
Type of scheduler, comes from topology.
Values:
-
enumerator SOF_SCHEDULE_EDF#
EDF, schedules based on task’s deadline.
-
enumerator SOF_SCHEDULE_LL_TIMER#
Low latency timer, schedules immediately on selected timer’s tick.
-
enumerator SOF_SCHEDULE_LL_DMA#
Low latency DMA, schedules immediately on scheduling component’s DMA interrupt.
-
enumerator SOF_SCHEDULE_DP#
DataProcessing scheduler Scheduler based on Zephyr peemptive threads TODO: DP will become the Zephyr EDF scheduler type and will be unified with SOF_SCHEDULE_EDF for Zephyr builds current implementation of Zephyr based EDF is depreciated now.
-
enumerator SOF_SCHEDULE_TWB#
Tasks With Budget scheduler based on Zephyr peemptive threads for each SOF task that has pre-allocated MCPS budget renewed with every system tick.
-
enumerator SOF_SCHEDULE_COUNT#
indicates number of scheduler types
-
enumerator SOF_SCHEDULE_EDF#
Functions
-
void audio_stream_recalc_align(struct audio_stream *stream)#
-
static inline void *audio_stream_get_rptr(const struct audio_stream *buf)#
-
static inline void *audio_stream_get_wptr(const struct audio_stream *buf)#
-
static inline void *audio_stream_get_end_addr(const struct audio_stream *buf)#
-
static inline void *audio_stream_get_addr(const struct audio_stream *buf)#
-
static inline uint32_t audio_stream_get_size(const struct audio_stream *buf)#
-
static inline uint32_t audio_stream_get_avail(const struct audio_stream *buf)#
-
static inline uint32_t audio_stream_get_free(const struct audio_stream *buf)#
-
static inline enum sof_ipc_frame audio_stream_get_frm_fmt(const struct audio_stream *buf)#
-
static inline enum sof_ipc_frame audio_stream_get_valid_fmt(const struct audio_stream *buf)#
-
static inline uint32_t audio_stream_get_rate(const struct audio_stream *buf)#
-
static inline uint32_t audio_stream_get_channels(const struct audio_stream *buf)#
-
static inline bool audio_stream_get_underrun(const struct audio_stream *buf)#
-
static inline uint32_t audio_stream_get_buffer_fmt(const struct audio_stream *buf)#
-
static inline bool audio_stream_get_overrun(const struct audio_stream *buf)#
-
static inline void audio_stream_set_rptr(struct audio_stream *buf, void *val)#
-
static inline void audio_stream_set_wptr(struct audio_stream *buf, void *val)#
-
static inline void audio_stream_set_end_addr(struct audio_stream *buf, void *val)#
-
static inline void audio_stream_set_addr(struct audio_stream *buf, void *val)#
-
static inline void audio_stream_set_size(struct audio_stream *buf, uint32_t val)#
-
static inline void audio_stream_set_avail(struct audio_stream *buf, uint32_t val)#
-
static inline void audio_stream_set_free(struct audio_stream *buf, uint32_t val)#
-
static inline void audio_stream_set_frm_fmt(struct audio_stream *buf, enum sof_ipc_frame val)#
-
static inline void audio_stream_set_valid_fmt(struct audio_stream *buf, enum sof_ipc_frame val)#
-
static inline void audio_stream_set_rate(struct audio_stream *buf, uint32_t val)#
-
static inline void audio_stream_set_channels(struct audio_stream *buf, uint16_t val)#
-
static inline void audio_stream_set_underrun(struct audio_stream *buf, bool underrun_permitted)#
-
static inline void audio_stream_set_overrun(struct audio_stream *buf, bool overrun_permitted)#
-
static inline void audio_stream_set_buffer_fmt(struct audio_stream *buf, uint32_t buffer_fmt)#
-
static inline uint32_t audio_stream_frame_bytes(const struct audio_stream *buf)#
Calculates period size in bytes based on component stream’s parameters.
- Parameters:
buf – Component buffer.
- Returns:
Period size in bytes.
-
static inline uint32_t audio_stream_sample_bytes(const struct audio_stream *buf)#
Calculates sample size in bytes based on component stream’s parameters.
- Parameters:
buf – Component buffer.
- Returns:
Size of sample in bytes.
-
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.
See also
- Parameters:
byte_align – Processing byte alignment requirement.
frame_align_req – Processing frames alignment requirement.
stream – Sink or source stream structure which to be set.
-
static inline int audio_stream_set_params(struct audio_stream *buffer, struct sof_ipc_stream_params *params)#
Applies parameters to the buffer.
- Parameters:
buffer – Audio stream buffer.
params – Parameters (frame format, rate, number of channels).
- Returns:
0 if succeeded, error code otherwise.
-
static inline 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.
- Parameters:
buf – Component buffer.
frames – Number of processing frames.
- Returns:
Period size in bytes.
-
static inline void *audio_stream_wrap(const struct audio_stream *buffer, void *ptr)#
Verifies the pointer and performs rollover when reached the end of the buffer.
- Parameters:
buffer – Buffer accessed by the pointer.
ptr – Pointer
- Returns:
Pointer, adjusted if necessary.
-
static inline 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.
- Parameters:
buffer – Buffer accessed by the pointer.
ptr – Pointer
- Returns:
Pointer, adjusted if necessary.
-
static inline uint32_t audio_stream_get_avail_bytes(const struct audio_stream *stream)#
Calculates available data in bytes, handling underrun_permitted behaviour.
- Parameters:
stream – Stream pointer
- Returns:
amount of data available for processing in bytes
-
static inline uint32_t audio_stream_get_avail_samples(const struct audio_stream *stream)#
Calculates available data in samples, handling underrun_permitted behaviour.
- Parameters:
stream – Stream pointer
- Returns:
amount of data available for processing in samples
-
static inline uint32_t audio_stream_get_avail_frames(const struct audio_stream *stream)#
Calculates available data in frames, handling underrun_permitted behaviour.
- Parameters:
stream – Stream pointer
- Returns:
amount of data available for processing in frames
-
static inline uint32_t audio_stream_get_free_bytes(const struct audio_stream *stream)#
Calculates free space in bytes, handling overrun_permitted behaviour.
- Parameters:
stream – Stream pointer
- Returns:
amount of space free in bytes
-
static inline uint32_t audio_stream_get_free_samples(const struct audio_stream *stream)#
Calculates free space in samples, handling overrun_permitted behaviour.
- Parameters:
stream – Stream pointer
- Returns:
amount of space free in samples
-
static inline uint32_t audio_stream_get_free_frames(const struct audio_stream *stream)#
Calculates free space in frames, handling overrun_permitted behaviour.
- Parameters:
stream – Stream pointer
- Returns:
amount of space free in frames
-
static inline 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.
- Parameters:
source – Source buffer.
sink – Sink buffer.
bytes – Number of bytes to copy.
- Returns:
0 if there is enough data in source and enough free space in sink.
- Returns:
1 if there is not enough free space in sink.
- Returns:
-1 if there is not enough data in source.
-
static inline 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.
free space available in sink.
- Parameters:
source – Source buffer.
sink – Sink buffer.
- Returns:
Number of bytes.
-
static inline 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.
free space available in sink.
- Parameters:
source – Source buffer.
sink – Sink buffer.
- Returns:
Number of frames.
-
static inline 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.
- Parameters:
stream – Audio stream with alignment requirements set.
frames – Frame count to round down.
- Returns:
Largest aligned frame count less than or equal to frames.
-
static inline 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.
- Parameters:
stream – Audio stream with alignment requirements set.
frames – Frame count to round up.
- Returns:
Smallest aligned frame count greater than or equal to frames.
-
static inline 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.
- Parameters:
stream – Audio stream with alignment requirements set.
frames – Frame count to round to nearest.
- Returns:
Aligned frame count.
-
static inline 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.
free space available in sink.
- Parameters:
source – Buffer of source.
sink – Buffer of sink.
- Returns:
Number of frames.
-
static inline void audio_stream_produce(struct audio_stream *buffer, uint32_t bytes)#
Updates the buffer state after writing to the buffer.
- Parameters:
buffer – Buffer to update.
bytes – Number of written bytes.
-
static inline void audio_stream_consume(struct audio_stream *buffer, uint32_t bytes)#
Updates the buffer state after reading from the buffer.
- Parameters:
buffer – Buffer to update.
bytes – Number of read bytes.
-
static inline void audio_stream_reset(struct audio_stream *buffer)#
Resets the buffer.
- Parameters:
buffer – Buffer to reset.
-
void audio_stream_init(struct audio_stream *audio_stream, void *buff_addr, uint32_t size)#
Initializes the buffer with specified memory block and size.
- Parameters:
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.
-
static inline 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.
- Parameters:
buffer – Buffer.
bytes – Size of the fragment to invalidate.
-
static inline 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.
- Parameters:
buffer – Buffer.
bytes – Size of the fragment to write back.
-
static inline int audio_stream_bytes_without_wrap(const struct audio_stream *source, const void *ptr)#
Calculates numbers of bytes to buffer wrap.
- Parameters:
source – Stream to get information from.
ptr – Read or write pointer from source
- Returns:
Number of data samples to buffer wrap.
-
static inline 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.
- Parameters:
source – Stream to get information from.
ptr – Read or write pointer from source
- Returns:
Number of bytes to buffer wrap. For number of samples calculate need to add size of sample to returned bytes count.
-
static inline 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.
- Parameters:
source – Stream to get information from.
bytes – Number of bytes copied to source buffer.
- Returns:
Previous position of the write pointer.
-
static inline 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.
- Parameters:
source – Stream to get information from.
ptr – Read or write pointer from source
- Returns:
Number of data s16 samples until circular wrap need at end
-
static inline 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.
- Parameters:
source – Stream to get information from.
ptr – Read or write pointer from source
- Returns:
Number of data s24 samples until circular wrap need at end
-
static inline 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.
- Parameters:
source – Stream to get information from.
ptr – Read or write pointer from source
- Returns:
Number of data s32 samples until circular wrap need at end
-
static inline 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.
- Parameters:
source – Stream to get information from.
ptr – Read or write pointer from source
- Returns:
Number of data frames to buffer wrap.
-
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.
- Parameters:
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.
- Returns:
number of processed samples.
-
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.
- Parameters:
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.
-
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.
- Parameters:
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.
- Parameters:
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.
-
static inline 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.
- Parameters:
buffer – Buffer.
bytes – Size of the fragment to write zero.
- Returns:
0 if there is enough free space in buffer.
- Returns:
1 if there is not enough free space in buffer.
-
static inline 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.
- Parameters:
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.
-
static inline 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 inline struct comp_buffer *comp_dev_get_first_data_producer(struct comp_dev *component)#
Get a pointer to the first comp_buffer object providing data to the component The function will return NULL if there’s no data provider.
-
static inline struct comp_buffer *comp_dev_get_next_data_producer(struct comp_dev *component, struct comp_buffer *producer)#
Get a pointer to the next comp_buffer object providing data to the component The function will return NULL if there’re no more data providers _save version also checks if producer != NULL.
-
static inline struct comp_buffer *comp_dev_get_next_data_producer_safe(struct comp_dev *component, struct comp_buffer *producer)#
-
static inline struct comp_buffer *comp_dev_get_first_data_consumer(struct comp_dev *component)#
Get a pointer to the first comp_buffer object receiving data from the component The function will return NULL if there’s no data consumers.
-
static inline struct comp_buffer *comp_dev_get_next_data_consumer(struct comp_dev *component, struct comp_buffer *consumer)#
Get a pointer to the next comp_buffer object receiving data from the component The function will return NULL if there’re no more data consumers _safe version also checks if consumer is != NULL.
-
static inline struct comp_buffer *comp_dev_get_next_data_consumer_safe(struct comp_dev *component, struct comp_buffer *consumer)#
-
static inline uint32_t dev_comp_id(const struct comp_dev *dev)#
Retrieves Component id from device.
- Parameters:
dev – Device.
- Returns:
Component id.
-
static inline uint32_t dev_comp_pipe_id(const struct comp_dev *dev)#
Retrieves Component pipeline id from device.
- Parameters:
dev – Device.
- Returns:
Component pipeline id.
-
static inline enum sof_comp_type dev_comp_type(const struct comp_dev *dev)#
Retrieves component type from device.
- Parameters:
dev – Device.
- Returns:
Component type.
-
static inline void comp_init(const struct comp_driver *drv, struct comp_dev *dev, size_t bytes)#
Initialize common part of a component device.
- Parameters:
drv – Parent component driver.
dev – Device.
bytes – Size of the component device in bytes.
-
static inline struct comp_dev *comp_alloc(const struct comp_driver *drv, size_t bytes)#
Allocates memory for the component device and initializes common part.
- Parameters:
drv – Parent component driver.
bytes – Size of the component device in bytes.
- Returns:
Pointer to the component device.
-
static inline void comp_free_device(struct comp_dev *dev)#
Frees memory allocated for component device.
This is a counterpart to comp_alloc() and not to be confused with comp_free().
- Parameters:
dev – Pointer to the component device.
-
static inline struct processing_module *comp_mod(const struct comp_dev *dev)#
Module adapter associated with a component.
- Parameters:
dev – Component device
-
int comp_set_state(struct comp_dev *dev, int cmd)#
Component state set.
This function should be called by a component implementation at the beginning of its state transition to verify whether the trigger is valid in the current state and abort the transition otherwise.
Typically the COMP_STATE_READY as the initial state is set directly by the component’s implementation of _new().
COMP_TRIGGER_PREPARE is called from the component’s prepare().
COMP_TRIGGER_START/STOP is called from trigger().
COMP_TRIGGER_RESET is called from reset().
- Parameters:
dev – Component device.
cmd – Command, one of COMP_TRIGGER_….
- Returns:
0 if succeeded, error code otherwise.
-
void comp_get_copy_limits(struct comp_buffer *source, struct comp_buffer *sink, struct comp_copy_limits *cl)#
Computes source to sink copy operation boundaries including maximum number of frames that can be transferred (data available in source vs.
free space available in sink).
- Parameters:
source – [in] Source buffer.
sink – [in] Sink buffer.
cl – [out] Current copy limits.
-
void comp_get_copy_limits_frame_aligned(const struct comp_buffer *source, const struct comp_buffer *sink, struct comp_copy_limits *cl)#
Computes source to sink copy operation boundaries including maximum number of frames aligned with requirement that can be transferred (data available in source vs.
free space available in sink).
- Parameters:
source – [in] Buffer of source.
sink – [in] Buffer of sink.
cl – [out] Current copy limits.
-
static inline int comp_get_state(const struct comp_dev *dev)#
Get component state.
- Parameters:
dev – Component from which user wants to read status.
- Return values:
COMP_STATE_NOT_EXIST – if there’s no connected component
- Returns:
state of the component
-
static inline int comp_buffer_get_source_state(const struct comp_buffer *buffer)#
helper, provide state of a component connected to a buffer as a data provider
- Parameters:
buffer – a buffer to be checked
- Return values:
COMP_STATE_NOT_EXIST – if there’s no connected component
- Returns:
state of the component
-
static inline int comp_buffer_get_sink_state(const struct comp_buffer *buffer)#
helper, provide state of a component connected to a buffer as a data consumer
- Parameters:
buffer – a buffer to be checked
- Return values:
COMP_STATE_NOT_EXIST – if there’s no connected component
- Returns:
state of the component
-
int comp_verify_params(struct comp_dev *dev, uint32_t flag, struct sof_ipc_stream_params *params)#
Warning: duplicate declaration in topology.h.
Called by component in params() function in order to set and update some of downstream (playback) or upstream (capture) buffer parameters with pcm parameters. There is a possibility to specify which of parameters won’t be overwritten (e.g. SRC component should not overwrite rate parameter, because it is able to change it).
- Parameters:
dev – Component device
flag – Specifies which parameter should not be updated
params – pcm params
-
static inline void comp_free(struct comp_dev *dev)#
See comp_ops::free.
-
static inline int comp_params_remote(struct comp_dev *dev, struct sof_ipc_stream_params *params)#
Parameter init for component on other core.
- Parameters:
dev – Component device.
params – Parameters to be set.
- Returns:
0 if succeeded, error code otherwise.
-
static inline int comp_params(struct comp_dev *dev, struct sof_ipc_stream_params *params)#
See comp_ops::params.
-
static inline int comp_dai_get_hw_params(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)#
-
static inline int comp_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_size)#
See comp_ops::cmd.
-
static inline int comp_trigger_remote(struct comp_dev *dev, int cmd)#
Runs comp_ops::trigger on the core the target component is assigned to.
-
static inline int comp_trigger(struct comp_dev *dev, int cmd)#
See comp_ops::trigger.
-
static inline int comp_prepare_remote(struct comp_dev *dev)#
Runs comp_ops::prepare on the target component’s core.
-
static inline int comp_prepare(struct comp_dev *dev)#
See comp_ops::prepare.
-
static inline int comp_reset_remote(struct comp_dev *dev)#
Runs comp_ops::reset on the target component’s core.
-
static inline int comp_reset(struct comp_dev *dev)#
Component reset and free runtime resources.
- Parameters:
dev – Component device.
- Returns:
0 if succeeded, error code otherwise.
-
static inline int comp_dai_config(struct comp_dev *dev, struct ipc_config_dai *config, const void *spec_config)#
See comp_ops::dai_config.
-
static inline int comp_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)#
See comp_ops::position.
-
void sys_comp_init(struct sof *sof)#
Allocates and initializes audio component list.
To be called once at boot time.
-
static inline int comp_is_single_pipeline(struct comp_dev *current, struct comp_dev *previous)#
Checks if two component devices belong to the same parent pipeline.
- Parameters:
current – Component device.
previous – Another component device.
- Returns:
1 if children of the same pipeline, 0 otherwise.
-
static inline int comp_is_active(struct comp_dev *current)#
Checks if component device is active.
- Parameters:
current – Component device.
- Returns:
1 if active, 0 otherwise.
-
static inline int comp_get_requested_state(int cmd)#
Returns component state based on requested command.
- Parameters:
cmd – Request command.
- Returns:
Component state.
-
static inline int comp_get_endpoint_type(struct comp_dev *dev)#
Returns endpoint type of given component.
- Parameters:
dev – Component device
- Returns:
Endpoint type, one of comp_endpoint_type.
-
static inline bool comp_is_scheduling_source(struct comp_dev *dev)#
Called to check whether component schedules its pipeline.
- Parameters:
dev – Component device.
- Returns:
True if this is scheduling component, false otherwise.
Called to mark component as shared between cores.
- Parameters:
dev – Component device.
-
static inline struct comp_driver_list *comp_drivers_get(void)#
Get the global component driver list.
- Returns:
Pointer to the component driver list.
-
static inline int comp_ipc4_unbind_remote(struct comp_dev *dev, const struct bind_info *unbind_data)#
-
static inline uint64_t comp_get_total_data_processed(struct comp_dev *dev, uint32_t stream_no, bool input)#
-
static inline bool comp_same_dir(struct comp_dev *comp, enum sof_ipc_stream_direction dir)#
Returns true if the component’s pipeline matches the specified direction.
-
struct schedulers **arch_schedulers_get(void)#
Retrieves registered schedulers.
- Returns:
List of registered schedulers.
-
struct schedulers **arch_user_schedulers_get(void)#
Retrieves registered schedulers for user-space threads on the current core.
- Returns:
Pointer to array of registered scheduler pointers.
-
struct schedulers **arch_user_schedulers_get_for_core(int core)#
Retrieves registered schedulers for user-space threads on a specific core.
- Parameters:
core – Target DSP core ID.
- Returns:
Pointer to array of registered scheduler pointers for the specified core.
-
static inline void *scheduler_list_get_data(struct schedulers *schedulers, uint16_t type)#
Lookup scheduler private context data by scheduler type.
- Parameters:
schedulers – Schedulers list container.
type – Scheduler type identifier (SOF_SCHEDULE_LL, SOF_SCHEDULE_EDF, etc.).
- Returns:
Pointer to scheduler-specific private data, or NULL if not found.
-
static inline void *scheduler_get_data(uint16_t type)#
Retrieves scheduler’s data.
- Parameters:
type – SOF_SCHEDULE_ type.
- Returns:
Pointer to scheduler’s data.
-
static inline void *scheduler_get_user_data(uint16_t type)#
Retrieves userspace scheduler’s data.
- Parameters:
type – SOF_SCHEDULE_ type.
- Returns:
Pointer to scheduler’s data.
-
static inline int schedule_task_before(struct task *task, uint64_t start, uint64_t period, struct task *before)#
-
static inline int schedule_task_after(struct task *task, uint64_t start, uint64_t period, struct task *after)#
-
int schedule_task_init(struct task *task, const struct sof_uuid_entry *uid, uint16_t type, int16_t priority, enum task_state (*run)(void *data), void *data, uint16_t core, uint32_t flags)#
Initializes scheduling task.
- Parameters:
task – Task to be initialized.
uid – Statically assigned task uuid.
type – SOF_SCHEDULE_ type.
priority – Task’s priority.
run – Pointer to task’s execution function.
data – Pointer to task’s execution data.
core – Core on which task should be run.
flags – Special scheduling flags.
- Returns:
0 if succeeded, error code otherwise.
-
void scheduler_init(int type, const struct scheduler_ops *ops, void *data)#
Initializes scheduler.
- Parameters:
type – SOF_SCHEDULE_ type.
ops – Pointer to scheduler’s operations.
data – Scheduler’s private data.
-
void scheduler_get_task_info(struct scheduler_props *scheduler_props, uint32_t *data_off_size, struct list_item *tasks)#
Extract scheduler’s task information from tasks.
- Parameters:
scheduler_props – Structure to be filled
data_off_size – Pointer to the current size of the scheduler_props, to be updated
tasks – Scheduler’s task list
-
struct audio_stream#
- #include <src/include/sof/audio/audio_stream.h>
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.
Audio stream does not perform any memory allocations. A client (a component buffer or dma) must allocate the memory for the underlying data buffer and provide it to the initialization routine.
Once the client is done with reading/writing the data, it must commit the consumption/production and update the buffer state by calling audio_stream_consume()/audio_stream_produce() (just a single call following series of reads/writes).
Public Members
-
uint32_t size#
Runtime buffer size in bytes (period multiple)
-
uint32_t avail#
Available bytes for reading.
-
uint32_t free#
Free bytes for writing.
-
void *w_ptr#
Buffer write pointer.
-
void *r_ptr#
Buffer read position.
-
void *addr#
Buffer base address.
-
void *end_addr#
Buffer end address.
-
uint8_t byte_align_req#
-
uint8_t frame_align_req#
-
struct sof_audio_stream_params runtime_stream_params#
-
uint32_t size#
-
struct cir_buf_ptr#
- #include <src/include/sof/audio/audio_stream.h>
-
struct bind_info#
- #include <src/include/sof/audio/component.h>
-
struct comp_ops#
- #include <src/include/sof/audio/component.h>
Audio component operations.
All component operations must return 0 for success, negative values for errors and 1 to stop the pipeline walk operation unless specified otherwise in the operation documentation.
Public Members
-
struct comp_dev *(*create)(const struct comp_driver *drv, const struct comp_ipc_config *ipc_config, const void *spec)#
Creates a new component device.
Any component-specific private data is allocated separately and pointer is connected to the comp_dev::private by using comp_set_drvdata() and later retrieved by comp_get_drvdata().
All parameters should be initialized to their default values. Usually can be __cold.
- Param drv:
Parent component driver.
- Param ipc_config:
Component parameters.
- Param spec:
Pointer to initialization data
- Return:
Pointer to the new component device.
-
void (*free)(struct comp_dev *dev)#
Called to delete the specified component device.
All data structures previously allocated on the run-time heap must be freed by the implementation of
free(). Usually can be __cold.- Param dev:
Component device to be deleted.
-
int (*params)(struct comp_dev *dev, struct sof_ipc_stream_params *params)#
Sets component audio stream parameters.
Infrastructure calls comp_verify_params() if this handler is not defined, therefore it should be left NULL if no extra steps are required. Usually shouldn’t be __cold.
- Param dev:
Component device.
- Param params:
Audio (PCM) stream parameters to be set.
-
int (*dai_get_hw_params)(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)#
Fetches hardware stream parameters.
Mandatory for components that allocate DAI. Usually can be __cold.
- Param dev:
Component device.
- Param params:
Receives copy of stream parameters retrieved from DAI hw settings.
- Param dir:
Stream direction (see enum sof_ipc_stream_direction).
-
int (*dai_config)(struct dai_data *dd, struct comp_dev *dev, struct ipc_config_dai *dai_config, const void *dai_spec_config)#
Configures attached DAI.
Mandatory for components that allocate DAI. Usually can be __cold.
- Param dev:
Component device.
- Param dai_config:
DAI configuration.
-
int (*cmd)(struct comp_dev *dev, int cmd, void *data, int max_data_size)#
Used to pass standard and bespoke commands (with optional data).
- Param dev:
Component device.
- Param cmd:
Command.
- Param data:
Command data.
- Param max_data_size:
Max size of returned data acceptable by the caller in case of ‘get’ commands.
-
int (*trigger)(struct comp_dev *dev, int cmd)#
Trigger, atomic - used to start/stop/pause stream operations.
Usually shouldn’t be __cold.
- Param dev:
Component device.
- Param cmd:
Command, one of COMP_TRIGGER_…
-
int (*prepare)(struct comp_dev *dev)#
Prepares component after params are set.
Prepare should be used to get the component ready for starting processing after it’s hw_params are known or after an XRUN. Usually shouldn’t be __cold.
- Param dev:
Component device.
-
int (*reset)(struct comp_dev *dev)#
Resets component.
Resets the component state and any hw_params to default component state. Should also free any resources acquired during hw_params. Usually shouldn’t be __cold.
- Param dev:
Component device.
-
int (*copy)(struct comp_dev *dev)#
Copy and process stream data from source to sink buffers.
Usually shouldn’t be __cold.
- Param dev:
Component device.
- Return:
Number of copied frames.
-
int (*position)(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)#
Retrieves component rendering position.
Usually shouldn’t be __cold.
- Param dev:
Component device.
- Param posn:
Receives reported position.
-
int (*get_attribute)(struct comp_dev *dev, uint32_t type, void *value)#
Gets attribute in component.
Usually can be __cold.
- Param dev:
Component device.
- Param type:
Attribute type.
- Param value:
Attribute value.
- Return:
0 if succeeded, error code otherwise.
-
int (*set_attribute)(struct comp_dev *dev, uint32_t type, void *value)#
Sets attribute in component.
Usually can be __cold.
- Param dev:
Component device.
- Param type:
Attribute type.
- Param value:
Attribute value.
- Return:
0 if succeeded, error code otherwise.
-
int (*dai_ts_config)(struct comp_dev *dev)#
Configures timestamping in attached DAI.
Mandatory for components that allocate DAI. Usually can be __cold.
- Param dev:
Component device.
-
int (*dai_ts_start)(struct comp_dev *dev)#
Starts timestamping.
Mandatory for components that allocate DAI. Usually can be __cold.
- Param dev:
Component device.
-
int (*dai_ts_stop)(struct comp_dev *dev)#
Stops timestamping.
Mandatory for components that allocate DAI. Usually can be __cold.
- Param dev:
Component device.
-
int (*dai_ts_get)(struct comp_dev *dev, struct timestamp_data *tsd)#
Gets timestamp.
Mandatory for components that allocate DAI. Usually shouldn’t be __cold.
- Param dev:
Component device.
- Param tsd:
Receives timestamp data.
-
int (*bind)(struct comp_dev *dev, const struct bind_info *bind_data)#
Bind, atomic - used to notify component of bind event.
Usually can be __cold.
- Param dev:
Component device.
- Param data:
Bind info
-
int (*unbind)(struct comp_dev *dev, const struct bind_info *unbind_data)#
Unbind, atomic - used to notify component of unbind event.
Usually can be __cold.
- Param dev:
Component device.
- Param data:
unBind info
-
int (*get_large_config)(struct comp_dev *dev, uint32_t param_id, bool first_block, bool last_block, uint32_t *data_offset, char *data)#
Gets config in component.
Callee fills up *data with config data and save the config size in *data_offset for host to reconstruct the config Usually can be __cold.
- Param dev:
Component device
- Param param_id:
param id for each component
- Param first_block:
first block of large block.
- Param last_block:
last block of large block.
- Param data_offset:
block offset filled by callee.
- Param data:
block data.
- Return:
0 if succeeded, error code otherwise.
-
int (*set_large_config)(struct comp_dev *dev, uint32_t param_id, bool first_block, bool last_block, uint32_t data_offset, const char *data)#
Set config in component.
Host divides large block into small blocks and sends them to fw. The data_offset indicates the offset in the large block data. Usually can be __cold.
- Param dev:
Component device
- Param param_id:
param id for each component
- Param first_block:
first block of large block.
- Param last_block:
last block of large block.
- Param data_offset:
block offset in large block.
- Param data:
block data.
- Return:
0 if succeeded, error code otherwise.
-
uint64_t (*get_total_data_processed)(struct comp_dev *dev, uint32_t stream_no, bool input)#
Returns total data processed in number bytes.
Usually shouldn’t be __cold.
- Param dev:
Component device
- Param stream_no:
Index of input/output stream
- Param input:
Selects between input (true) or output (false) stream direction
- Return:
total data processed if succeeded, 0 otherwise.
-
struct comp_dev *(*create)(const struct comp_driver *drv, const struct comp_ipc_config *ipc_config, const void *spec)#
-
struct comp_driver#
- #include <src/include/sof/audio/component.h>
Audio component base driver “class”.
used by all other component types.
-
struct comp_driver_info#
- #include <src/include/sof/audio/component.h>
Holds constant pointer to component driver.
Public Members
-
const struct comp_driver *drv#
pointer to component driver
-
const struct module_interface **adapter_ops#
pointer for updating ops
-
struct list_item list#
list of component drivers
-
const struct comp_driver *drv#
-
struct comp_ipc_config#
- #include <src/include/sof/audio/component.h>
Audio component base configuration from IPC at creation.
Public Members
-
uint32_t core#
core we run on
-
uint32_t id#
component id
-
uint32_t pipeline_id#
component pipeline id
-
uint32_t proc_domain#
processing domain - LL or DP
-
enum sof_comp_type type#
component type
-
uint32_t periods_sink#
0 means variable
-
uint32_t periods_source#
0 means variable
-
uint32_t frame_fmt#
SOF_IPC_FRAME_.
-
uint32_t xrun_action#
action we should take on XRUN
-
bool ipc_extended_init#
true if extended init is included in ipc payload
-
uint32_t ipc_config_size#
size of a config received by ipc
-
uint32_t core#
-
struct comp_perf_data#
- #include <src/include/sof/audio/component.h>
-
struct comp_dev#
- #include <src/include/sof/audio/component.h>
Audio component base device “class”.
used by other component types.
Public Members
-
uint16_t state#
COMP_STATE_.
-
uint32_t frames#
number of frames we copy to sink
-
bool expect_eos#
end of stream expected
-
struct task *task#
component’s processing task used 1) for components running on different core than the rest of the pipeline 2) for all DP tasks
-
uint32_t size#
component’s allocated size
-
uint32_t period#
component’s processing period for LL modules is set to LL pipeline’s period for DP module its meaning is “the time the module MUST
provide data that allows the following module to perform
without glitches”
-
uint32_t priority#
component’s processing priority
indicates whether component is shared across cores
-
struct comp_ipc_config ipc_config#
Component IPC configuration.
-
struct tr_ctx tctx#
trace settings
-
uint32_t direction#
enum sof_ipc_stream_direction
-
bool direction_set#
flag indicating that the direction has been set
-
const struct comp_driver *drv#
driver
-
struct processing_module *mod#
self->mod->dev == self, NULL if component is not using module adapter
-
struct list_item bsource_list#
list of source buffers
-
struct list_item bsink_list#
list of sink buffers
-
struct comp_perf_data perf_data#
-
size_t ibs#
-
size_t obs#
-
size_t cpc#
-
size_t ll_chunk_size#
-
void *priv_data#
private data
-
struct comp_copy_limits#
- #include <src/include/sof/audio/component.h>
Struct for use with comp_get_copy_limits() function.
-
struct comp_driver_list#
- #include <src/include/sof/audio/component_ext.h>
Holds list of registered components’ drivers.
Public Members
-
struct list_item list#
list of component drivers
-
struct list_item list#
-
struct get_attribute_remote_payload#
- #include <src/include/sof/audio/component_ext.h>
-
struct scheduler_ops#
- #include <src/include/sof/schedule/schedule.h>
Scheduler operations.
Almost all schedule operations must return 0 for success and negative values for errors. Only the scheduler_free operation is allowed to not return any status.
Public Members
-
int (*schedule_task)(void *data, struct task *task, uint64_t start, uint64_t period)#
Schedules task with given scheduling parameters.
This operation is mandatory.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be scheduled.
- Param start:
Start time of given task (in microseconds).
- Param period:
Scheduling period of given task (in microseconds).
- Return:
0 if succeeded, error code otherwise.
-
int (*schedule_task_before)(void *data, struct task *task, uint64_t start, uint64_t period, struct task *before)#
Schedules task with given scheduling parameters.
This operation is optional.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be scheduled.
- Param start:
Start time of given task (in microseconds).
- Param period:
Scheduling period of given task (in microseconds).
- Param before:
Task to be scheduled before
- Return:
0 if succeeded, error code otherwise.
-
int (*schedule_task_after)(void *data, struct task *task, uint64_t start, uint64_t period, struct task *after)#
Schedules task with given scheduling parameters.
This operation is optional.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be scheduled.
- Param start:
Start time of given task (in microseconds).
- Param period:
Scheduling period of given task (in microseconds).
- Param after:
Task to be scheduled after
- Return:
0 if succeeded, error code otherwise.
-
int (*schedule_task_running)(void *data, struct task *task)#
Sets task into running state along with executing additional scheduler specific operations.
This operation is optional.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be set into running state.
- Return:
0 if succeeded, error code otherwise.
-
int (*reschedule_task)(void *data, struct task *task, uint64_t start)#
Reschedules already scheduled task with new start time.
This operation is optional.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be rescheduled.
- Param start:
New start time of given task (in microseconds).
- Return:
0 if succeeded, error code otherwise.
-
int (*schedule_task_cancel)(void *data, struct task *task)#
Cancels previously scheduled task.
This operation is mandatory.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be canceled.
- Return:
0 if succeeded, error code otherwise.
-
int (*schedule_task_free)(void *data, struct task *task)#
Frees task’s resources.
This operation is mandatory.
- Param data:
Private data of selected scheduler.
- Param task:
Task to be freed.
- Return:
0 if succeeded, error code otherwise.
-
struct k_thread *(*scheduler_init_context)(void *data, struct task *task)#
Initializes context.
This operation is optional.
- Param data:
Private data of selected scheduler.
- Param task:
task that needs to be scheduled
- Return:
thread that will be used to run the scheduled task
-
int (*schedule_task)(void *data, struct task *task, uint64_t start, uint64_t period)#