|
Sound Open Firmware
|
Directed Acyclic Graph (DAG) pipeline creation, scheduling binding, traversal, and lifecycle management. More...
Files | |
| file | pipeline.h |
| Audio pipeline management, graph scheduling, and execution control. | |
Data Structures | |
| struct | pipeline |
| Audio pipeline structure representing a stream graph and execution context. More... | |
| struct | pipeline_walk_context |
| Pipeline traversal walk context for graph exploration and operations. More... | |
| struct | pipeline_data |
| Generic pipeline data used by pipeline_comp_* functions. More... | |
| struct | pipeline_task |
| Task type registered by pipelines. More... | |
| struct | create_pipeline_params |
| For storing IPC payload data during pipeline creation. More... | |
Macros | |
| #define | PPL_STATUS_PATH_STOP 1 |
| Pipeline status to stop execution of current path, but to keep the pipeline alive, when processing COMP_TRIGGER_STOP or COMP_TRIGGER_PAUSE. | |
| #define | PPL_STATUS_PATH_TERMINATE 2 |
| Pipeline status to stop execution of current path, and to terminate the pipeline, when processing COMP_TRIGGER_STOP or COMP_TRIGGER_PAUSE. | |
| #define | PPL_STATUS_SCHEDULED 2 |
| Pipeline scheduled in another thread other than IPC thread. | |
| #define | pipeline_task_get(t) container_of(t, struct pipeline_task, task) |
| Retrieves the enclosing pipeline_task structure from a task pointer. | |
Functions | |
| struct pipeline * | pipeline_new (struct k_heap *heap, uint32_t pipeline_id, uint32_t priority, uint32_t comp_id, struct create_pipeline_params *pparams) |
| Creates a new pipeline. | |
| int | pipeline_free (struct pipeline *p) |
| Frees a pipeline and its associated resources. | |
| int | pipeline_connect (struct comp_dev *comp, struct comp_buffer *buffer, int dir) |
| Connect components in a pipeline. | |
| void | pipeline_disconnect (struct comp_dev *comp, struct comp_buffer *buffer, int dir) |
| Disconnect components and buffers in a pipeline. | |
| int | pipeline_complete (struct pipeline *p, struct comp_dev *source, struct comp_dev *sink) |
| Completes a pipeline setup by verifying connectivity between source and sink. | |
| void | pipeline_posn_init (struct sof *sof) |
| Initializes pipeline position structure. | |
| int | pipeline_reset (struct pipeline *p, struct comp_dev *host_cd) |
| Resets the pipeline and frees runtime resources. | |
| void | pipeline_set_eos (struct pipeline *p, bool eos) |
| Sets End Of Stream state for all devices in the pipeline. | |
| int | pipeline_for_each_comp (struct comp_dev *current, struct pipeline_walk_context *ctx, int dir) |
| Walks the pipeline graph for each component. | |
| struct comp_dev * | pipeline_get_dai_comp (uint32_t pipeline_id, int dir) |
| Walks pipeline graph to find DAI component. | |
| struct comp_dev * | pipeline_get_dai_comp_latency (uint32_t pipeline_id, uint32_t *latency) |
| Walks pipeline graph to find DAI component and latency. | |
| static uint32_t | pipeline_id (struct pipeline *p) |
| Retrieves pipeline ID from pipeline structure. | |
| int | pipeline_params (struct pipeline *p, struct comp_dev *cd, struct sof_ipc_pcm_params *params) |
| Sets pipeline runtime audio stream parameters. | |
| int | pipeline_prepare (struct pipeline *p, struct comp_dev *cd) |
| Prepares pipeline for audio processing. | |
| int | pipeline_trigger (struct pipeline *p, struct comp_dev *host, int cmd) |
| Trigger pipeline in IPC context. | |
| int | pipeline_trigger_run (struct pipeline *p, struct comp_dev *host, int cmd) |
| Trigger pipeline in either IPC or pipeline task context. | |
| int | pipeline_copy (struct pipeline *p) |
| Copy and process stream data along a pipeline. | |
| void | pipeline_get_timestamp (struct pipeline *p, struct comp_dev *host_dev, struct sof_ipc_stream_posn *posn) |
| Get pipeline timestamps from host to DAI. | |
| static bool | pipeline_is_same_sched_comp (struct pipeline *current, struct pipeline *previous) |
| Checks if two pipelines share the same scheduling component. | |
| static bool | pipeline_is_timer_driven (struct pipeline *p) |
| Checks if pipeline is scheduled with timer. | |
| static bool | pipeline_is_this_cpu (struct pipeline *p) |
| Checks if pipeline is scheduled on the current core. | |
| int | pipeline_comp_ll_task_init (struct pipeline *p) |
| Initializes a low-latency (LL) task for a pipeline. | |
| void | pipeline_comp_ll_task_free (struct pipeline *p) |
| Frees the low-latency (LL) tasks owned by a pipeline. | |
| int | pipeline_comp_dp_task_init (struct comp_dev *comp) |
| Initializes a data processing (DP) task for a component. | |
| void | pipeline_schedule_copy (struct pipeline *p, uint64_t start) |
| Schedules a pipeline copy operation to run after a delay. | |
| void | pipeline_comp_trigger_sched_comp (struct pipeline *p, struct comp_dev *comp, struct pipeline_walk_context *ctx) |
| Triggers pipeline's scheduling component. | |
| void | pipeline_schedule_triggered (struct pipeline_walk_context *ctx, int cmd) |
| Schedules all triggered pipelines collected during traversal. | |
| void | pipeline_schedule_config (struct pipeline *p, uint32_t sched_id, uint32_t core, uint32_t period, uint32_t period_mips, uint32_t frames_per_sched, uint32_t time_domain) |
| Configures pipeline scheduling parameters. | |
| int | pipeline_xrun_recover (struct pipeline *p) |
| Recovers the pipeline from an XRUN condition. | |
| int | pipeline_xrun_handle_trigger (struct pipeline *p, int cmd) |
| Performs XRUN recovery trigger handling. | |
| void | pipeline_xrun (struct pipeline *p, struct comp_dev *dev, int32_t bytes) |
| Notifies host and pipeline that an XRUN condition occurred. | |
| int | pipeline_xrun_set_limit (struct pipeline *p, uint32_t xrun_limit_usecs) |
| Sets tolerance limit for pipeline XRUN handling. | |
| void | pipeline_comp_copy_error_notify (const struct comp_dev *component, int error_code) |
| Sends an IPC notification that an error occurred in a module's processing function. | |
Pipeline connection directions | |
| #define | PPL_CONN_DIR_COMP_TO_BUFFER 0 |
| Connection from component to buffer. | |
| #define | PPL_CONN_DIR_BUFFER_TO_COMP 1 |
| Connection from buffer to component. | |
Pipeline processing directions | |
| #define | PPL_DIR_DOWNSTREAM 0 |
| Downstream playback/processing direction. | |
| #define | PPL_DIR_UPSTREAM 1 |
| Upstream capture/processing direction. | |
Directed Acyclic Graph (DAG) pipeline creation, scheduling binding, traversal, and lifecycle management.
| #define pipeline_task_get | ( | t | ) | container_of(t, struct pipeline_task, task) |
Retrieves the enclosing pipeline_task structure from a task pointer.
| #define PPL_CONN_DIR_BUFFER_TO_COMP 1 |
Connection from buffer to component.
| #define PPL_CONN_DIR_COMP_TO_BUFFER 0 |
Connection from component to buffer.
| #define PPL_DIR_DOWNSTREAM 0 |
Downstream playback/processing direction.
| #define PPL_DIR_UPSTREAM 1 |
Upstream capture/processing direction.
| #define PPL_STATUS_PATH_STOP 1 |
Pipeline status to stop execution of current path, but to keep the pipeline alive, when processing COMP_TRIGGER_STOP or COMP_TRIGGER_PAUSE.
| #define PPL_STATUS_PATH_TERMINATE 2 |
Pipeline status to stop execution of current path, and to terminate the pipeline, when processing COMP_TRIGGER_STOP or COMP_TRIGGER_PAUSE.
| #define PPL_STATUS_SCHEDULED 2 |
Pipeline scheduled in another thread other than IPC thread.
| void pipeline_comp_copy_error_notify | ( | const struct comp_dev * | component, |
| int | error_code | ||
| ) |
Sends an IPC notification that an error occurred in a module's processing function.
| [in] | component | Component device in which the error occurred. |
| [in] | error_code | Error code to report. |
| int pipeline_comp_dp_task_init | ( | struct comp_dev * | comp | ) |
Initializes a data processing (DP) task for a component.
| [in,out] | comp | Component device for which the task is created. |
| void pipeline_comp_ll_task_free | ( | struct pipeline * | p | ) |
Frees the low-latency (LL) tasks owned by a pipeline.
| [in,out] | p | Target pipeline. |
| int pipeline_comp_ll_task_init | ( | struct pipeline * | p | ) |
Initializes a low-latency (LL) task for a pipeline.
| [in,out] | p | Target pipeline. |
| void pipeline_comp_trigger_sched_comp | ( | struct pipeline * | p, |
| struct comp_dev * | comp, | ||
| struct pipeline_walk_context * | ctx | ||
| ) |
Triggers pipeline's scheduling component.
| [in,out] | p | Target pipeline. |
| [in,out] | comp | Pipeline component device. |
| [in,out] | ctx | Pipeline graph walk context. |
Completes a pipeline setup by verifying connectivity between source and sink.
| [in,out] | p | Pipeline to complete. |
| [in,out] | source | Pipeline source component device. |
| [in,out] | sink | Pipeline sink component device. |
| int pipeline_connect | ( | struct comp_dev * | comp, |
| struct comp_buffer * | buffer, | ||
| int | dir | ||
| ) |
Connect components in a pipeline.
| [in,out] | comp | Connecting component device. |
| [in,out] | buffer | Connecting buffer. |
| [in] | dir | Connection direction (PPL_CONN_DIR_*). |
| int pipeline_copy | ( | struct pipeline * | p | ) |
Copy and process stream data along a pipeline.
| [in,out] | p | Target pipeline. |
| void pipeline_disconnect | ( | struct comp_dev * | comp, |
| struct comp_buffer * | buffer, | ||
| int | dir | ||
| ) |
Disconnect components and buffers in a pipeline.
| [in,out] | comp | Connecting component device. |
| [in,out] | buffer | Connecting buffer. |
| [in] | dir | Connection direction (PPL_CONN_DIR_*). |
| int pipeline_for_each_comp | ( | struct comp_dev * | current, |
| struct pipeline_walk_context * | ctx, | ||
| int | dir | ||
| ) |
Walks the pipeline graph for each component.
| [in,out] | current | Current pipeline component to start traversal from. |
| [in,out] | ctx | Pipeline graph walk context. |
| [in] | dir | Walk direction (PPL_DIR_*). |
| int pipeline_free | ( | struct pipeline * | p | ) |
Frees a pipeline and its associated resources.
| [in,out] | p | Pipeline to free. |
| struct comp_dev * pipeline_get_dai_comp | ( | uint32_t | pipeline_id, |
| int | dir | ||
| ) |
Walks pipeline graph to find DAI component.
| [in] | pipeline_id | Start pipeline ID. |
| [in] | dir | Direction of traversal (PPL_DIR_*). |
| struct comp_dev * pipeline_get_dai_comp_latency | ( | uint32_t | pipeline_id, |
| uint32_t * | latency | ||
| ) |
Walks pipeline graph to find DAI component and latency.
| [in] | pipeline_id | Start pipeline ID. |
| [out] | latency | Receives latency to DAI as a count of buffered processing blocks (input_data/ibs - output_data/obs). |
| void pipeline_get_timestamp | ( | struct pipeline * | p, |
| struct comp_dev * | host_dev, | ||
| struct sof_ipc_stream_posn * | posn | ||
| ) |
Get pipeline timestamps from host to DAI.
| [in] | p | Target pipeline. |
| [in] | host_dev | Host DMA component device. |
| [in,out] | posn | Pipeline stream position structure to populate. |
|
inlinestatic |
Retrieves pipeline ID from pipeline structure.
| [in] | p | Target pipeline. |
|
inlinestatic |
Checks if two pipelines share the same scheduling component.
| [in] | current | First pipeline. |
| [in] | previous | Second pipeline. |
|
inlinestatic |
Checks if pipeline is scheduled on the current core.
| [in] | p | Target pipeline. |
|
inlinestatic |
Checks if pipeline is scheduled with timer.
| [in] | p | Target pipeline. |
| struct pipeline * pipeline_new | ( | struct k_heap * | heap, |
| uint32_t | pipeline_id, | ||
| uint32_t | priority, | ||
| uint32_t | comp_id, | ||
| struct create_pipeline_params * | pparams | ||
| ) |
Creates a new pipeline.
| [in,out] | heap | Heap to allocate the pipeline on, or NULL for default. |
| [in] | pipeline_id | Pipeline ID number. |
| [in] | priority | Pipeline scheduling priority. |
| [in] | comp_id | Pipeline component ID number. |
| [in] | pparams | Pipeline parameters from IPC payload, may be NULL. |
| int pipeline_params | ( | struct pipeline * | p, |
| struct comp_dev * | cd, | ||
| struct sof_ipc_pcm_params * | params | ||
| ) |
Sets pipeline runtime audio stream parameters.
| [in,out] | p | Pipeline to configure. |
| [in,out] | cd | Pipeline component device. |
| [in] | params | Stream PCM parameters. |
| void pipeline_posn_init | ( | struct sof * | sof | ) |
Initializes pipeline position structure.
| [in,out] | sof | Pointer to global SOF system context. |
Prepares pipeline for audio processing.
| [in,out] | p | Pipeline to prepare. |
| [in,out] | cd | Pipeline component device. |
Resets the pipeline and frees runtime resources.
| [in,out] | p | Pipeline to reset. |
| [in,out] | host_cd | Host DMA component device. |
| void pipeline_schedule_config | ( | struct pipeline * | p, |
| uint32_t | sched_id, | ||
| uint32_t | core, | ||
| uint32_t | period, | ||
| uint32_t | period_mips, | ||
| uint32_t | frames_per_sched, | ||
| uint32_t | time_domain | ||
| ) |
Configures pipeline scheduling parameters.
| [in,out] | p | Target pipeline. |
| [in] | sched_id | Scheduling component ID. |
| [in] | core | DSP core the pipeline runs on. |
| [in] | period | Pipeline scheduling period in microseconds. |
| [in] | period_mips | Pipeline worst-case MCPS per period. |
| [in] | frames_per_sched | Pipeline frames processed per schedule. |
| [in] | time_domain | Pipeline scheduling time domain. |
| void pipeline_schedule_copy | ( | struct pipeline * | p, |
| uint64_t | start | ||
| ) |
Schedules a pipeline copy operation to run after a delay.
| [in,out] | p | Target pipeline. |
| [in] | start | Pipeline start time in microseconds. |
| void pipeline_schedule_triggered | ( | struct pipeline_walk_context * | ctx, |
| int | cmd | ||
| ) |
Schedules all triggered pipelines collected during traversal.
| [in,out] | ctx | Pipeline graph walk context. |
| [in] | cmd | Trigger command (COMP_TRIGGER_*). |
| void pipeline_set_eos | ( | struct pipeline * | p, |
| bool | eos | ||
| ) |
Sets End Of Stream state for all devices in the pipeline.
| [in,out] | p | Target pipeline. |
| [in] | eos | End Of Stream flag state. |
Trigger pipeline in IPC context.
| [in,out] | p | Target pipeline. |
| [in,out] | host | Host DMA component device. |
| [in] | cmd | Pipeline trigger command (COMP_TRIGGER_*). |
Trigger pipeline in either IPC or pipeline task context.
| [in,out] | p | Target pipeline. |
| [in,out] | host | Host DMA component device. |
| [in] | cmd | Pipeline trigger command (COMP_TRIGGER_*). |
Notifies host and pipeline that an XRUN condition occurred.
| [in,out] | p | Target pipeline. |
| [in,out] | dev | Pipeline component device where XRUN occurred. |
| [in] | bytes | Number of overrun or underrun bytes. |
| int pipeline_xrun_handle_trigger | ( | struct pipeline * | p, |
| int | cmd | ||
| ) |
Performs XRUN recovery trigger handling.
| [in,out] | p | Target pipeline. |
| [in] | cmd | Trigger command (COMP_TRIGGER_*). |
| int pipeline_xrun_recover | ( | struct pipeline * | p | ) |
Recovers the pipeline from an XRUN condition.
| [in,out] | p | Target pipeline. |
| int pipeline_xrun_set_limit | ( | struct pipeline * | p, |
| uint32_t | xrun_limit_usecs | ||
| ) |
Sets tolerance limit for pipeline XRUN handling.
| [in,out] | p | Target pipeline. |
| [in] | xrun_limit_usecs | Limit in microseconds that pipeline will tolerate before reporting. |