16#ifndef __SOF_AUDIO_COMPONENT_INT_H__
17#define __SOF_AUDIO_COMPONENT_INT_H__
20#include <ipc/topology.h>
40#define comp_buffer_list(comp, dir) \
41 ((dir) == PPL_DIR_DOWNSTREAM ? &(comp)->bsink_list : \
42 &(comp)->bsource_list)
51#elif CONFIG_IPC_MAJOR_4
117 comp_err(dev,
"pcm params verification failed");
142#if CONFIG_IPC_MAJOR_3
154 LOG_MODULE_DECLARE(component, CONFIG_SOF_LOG_LEVEL);
161 comp_err(dev,
"comp_cmd(): invalid version, data->magic = %u, data->abi = %u",
273#if CONFIG_IPC_MAJOR_4
331#if CONFIG_IPC_MAJOR_4
389#if CONFIG_IPC_MAJOR_3
398 const void *spec_config)
407#elif CONFIG_IPC_MAJOR_4
422#error Unknown IPC major version
545#ifdef CONFIG_SOF_USERSPACE_LL
554#if CONFIG_IPC_MAJOR_4
565 sizeof(*bind_data), bind_data};
579#if CONFIG_IPC_MAJOR_4
595#if CONFIG_IPC_MAJOR_4
606 sizeof(*unbind_data), unbind_data};
620#if CONFIG_IPC_MAJOR_4
#define SOF_ABI_MAGIC
SOF ABI magic number "SOF\0".
Definition abi.h:63
#define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver)
Definition abi.h:55
#define SOF_ABI_VERSION
Definition abi.h:60
#define ASSUME_ALIGNED(x, a)
Definition common.h:250
Component API definition.
static bool cpu_is_me(int id)
Definition cpu.h:103
int module_init(struct processing_module *mod)
#define COMP_STATE_ACTIVE
Component active.
Definition component.h:57
static int comp_is_single_pipeline(struct comp_dev *current, struct comp_dev *previous)
Checks if two component devices belong to the same parent pipeline.
Definition component_ext.h:455
static int comp_trigger(struct comp_dev *dev, int cmd)
Dispatch trigger command to component (local or remote).
Definition component_ext.h:226
static enum sof_comp_type dev_comp_type(const struct comp_dev *dev)
Retrieves component type from device.
Definition component.h:791
static int comp_params(struct comp_dev *dev, struct sof_ipc_stream_params *params)
Configure audio stream parameters for component device.
Definition component_ext.h:98
static int comp_prepare_remote(struct comp_dev *dev)
Run prepare command on remote core for target component.
Definition component_ext.h:244
#define comp_err(comp_p, __e,...)
Trace error message from component device.
Definition component.h:217
static int comp_get_endpoint_type(struct comp_dev *dev)
Returns endpoint type of given component.
Definition component_ext.h:510
static int comp_trigger_remote(struct comp_dev *dev, int cmd)
Run trigger command on remote core for target component.
Definition component_ext.h:179
#define COMP_STATE_READY
Component inactive, but ready.
Definition component.h:53
static int comp_ipc4_unbind_remote(struct comp_dev *dev, const struct bind_info *unbind_data)
Send unbind message to component on remote core (IPC4).
Definition component_ext.h:602
static int comp_dai_get_hw_params(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)
Retrieve DAI hardware parameters from component device.
Definition component_ext.h:132
#define COMP_STATE_PREPARE
Component prepared.
Definition component.h:55
static int comp_reset_remote(struct comp_dev *dev)
Run reset command on remote core for target component.
Definition component_ext.h:367
#define COMP_CMD_SET_DATA
Set data to component.
Definition component.h:97
int comp_verify_params(struct comp_dev *dev, uint32_t flag, struct sof_ipc_stream_params *params)
Verify and set component audio parameters.
static uint32_t dev_comp_pipe_id(const struct comp_dev *dev)
Retrieves Component pipeline ID from device.
Definition component.h:781
static int comp_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_size)
Dispatch IPC3 command to component device.
Definition component_ext.h:151
static void comp_make_shared(struct comp_dev *dev)
Called to mark component as shared between cores.
Definition component_ext.h:536
static int comp_ipc4_get_attribute_remote(struct comp_dev *dev, uint32_t type, void *value)
Retrieve component attribute from a remote core (IPC4).
Definition component_ext.h:289
static int comp_is_active(struct comp_dev *current)
Checks if component device is active.
Definition component_ext.h:466
static int comp_prepare(struct comp_dev *dev)
Prepare component device for streaming (local or remote).
Definition component_ext.h:257
static 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.
Definition component_ext.h:661
#define comp_get_drvdata(c)
Retrieves driver private data from component device.
Definition component.h:876
static int comp_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
Retrieve stream position from component.
Definition component_ext.h:431
static bool comp_is_scheduling_source(struct comp_dev *dev)
Called to check whether component schedules its pipeline.
Definition component_ext.h:527
int comp_copy(struct comp_dev *dev)
Process and copy audio data through component.
static void comp_free(struct comp_dev *dev)
Free component device via driver ops.
Definition component_ext.h:64
static struct comp_driver_list * comp_drivers_get(void)
Get the global component driver list.
Definition component_ext.h:548
static int comp_unbind(struct comp_dev *dev, const struct bind_info *unbind_data)
Unbind component from downstream/upstream component or buffer.
Definition component_ext.h:618
static int comp_params_remote(struct comp_dev *dev, struct sof_ipc_stream_params *params)
Parameter initialization for component on remote core.
Definition component_ext.h:83
static uint64_t comp_get_total_data_processed(struct comp_dev *dev, uint32_t stream_no, bool input)
Retrieve total data processed by component.
Definition component_ext.h:644
void sys_comp_init(struct sof *sof)
Allocates and initializes audio component list.
#define COMP_ATTR_BASE_CONFIG
Component base config.
Definition component.h:123
static int comp_set_attribute(struct comp_dev *dev, uint32_t type, void *value)
Set component attribute.
Definition component_ext.h:353
static int comp_get_requested_state(int cmd)
Returns component state based on requested command.
Definition component_ext.h:476
struct comp_dev * comp_new(struct sof_ipc_comp *comp)
Instantiate a new component device from IPC3 descriptor.
static int comp_bind(struct comp_dev *dev, const struct bind_info *bind_data)
Bind component to downstream/upstream component or buffer.
Definition component_ext.h:577
static int comp_ipc4_bind_remote(struct comp_dev *dev, const struct bind_info *bind_data)
Send bind message to component on remote core (IPC4).
Definition component_ext.h:561
#define COMP_STATE_INIT
Component being initialised.
Definition component.h:52
static int comp_get_attribute(struct comp_dev *dev, uint32_t type, void *value)
Get component attribute.
Definition component_ext.h:328
static int comp_reset(struct comp_dev *dev)
Reset component and free runtime resources (local or remote).
Definition component_ext.h:380
static int comp_dai_config(struct comp_dev *dev, struct ipc_config_dai *config, const void *spec_config)
Configure DAI component.
Definition component_ext.h:397
static int comp_trigger_local(struct comp_dev *dev, int cmd)
Run trigger command locally on current core for target component.
Definition component_ext.h:194
#define COMP_STATE_PRE_ACTIVE
Component after early initialisation.
Definition component.h:58
#define COMP_STATE_PAUSED
Component paused.
Definition component.h:56
@ COMP_TRIGGER_STOP
Stop component stream.
Definition component.h:73
@ COMP_TRIGGER_XRUN
XRUN component.
Definition component.h:79
@ COMP_TRIGGER_PAUSE
Pause the component stream.
Definition component.h:75
@ COMP_TRIGGER_RESET
Reset component.
Definition component.h:77
@ COMP_TRIGGER_PREPARE
Prepare component.
Definition component.h:78
@ COMP_TRIGGER_START
Start component stream.
Definition component.h:74
@ COMP_TRIGGER_PRE_START
Prepare to start component stream.
Definition component.h:80
@ COMP_TRIGGER_RELEASE
Release paused component stream.
Definition component.h:76
@ COMP_TRIGGER_PRE_RELEASE
Prepare to release paused component stream.
Definition component.h:81
@ COMP_ENDPOINT_HOST
Connected to host dma.
Definition component.h:255
@ COMP_ENDPOINT_DAI
Connected to dai dma.
Definition component.h:256
@ COMP_ENDPOINT_NODE
No dma connection.
Definition component.h:257
void * rzalloc(uint32_t flags, size_t bytes)
Allocate zero-initialized memory block with default natural alignment.
#define SOF_MEM_FLAG_USER
Base allocation flag denoting memory allocated for user-space threads and module execution.
Definition alloc.h:69
void rfree(void *ptr)
Free memory block allocated by SOF RTOS allocators.
#define SOF_MEM_FLAG_COHERENT
Allocate uncached / coherent memory address.
Definition alloc.h:53
static int schedule_task(struct task *task, uint64_t start, uint64_t period)
Schedule a task for execution with start delay and period.
Definition schedule.h:306
#define IDC_MSG_GET_ATTRIBUTE
Definition idc.h:105
#define IDC_MSG_TRIGGER
IDC component trigger message.
Definition idc.h:82
#define IDC_MSG_PARAMS
IDC component params message.
Definition idc.h:74
int idc_send_msg(struct idc_msg *msg, uint32_t mode)
#define IDC_EXTENSION(x)
Definition idc.h:54
#define IDC_MSG_UNBIND
Definition idc.h:104
#define IDC_BLOCKING
IDC send blocking flag.
Definition idc.h:26
#define IDC_MSG_BIND
Definition idc.h:103
#define IDC_MSG_TRIGGER_EXT(x)
Definition idc.h:83
#define IDC_MSG_PREPARE_EXT(x)
Definition idc.h:79
#define IDC_MSG_RESET_EXT(x)
Definition idc.h:87
#define IDC_MSG_RESET
IDC component reset message.
Definition idc.h:86
#define IDC_MSG_PARAMS_EXT(x)
Definition idc.h:75
#define IDC_MSG_PREPARE
IDC component prepare message.
Definition idc.h:78
sof_ipc_stream_direction
Definition stream.h:57
@ SOF_IPC_STREAM_CAPTURE
Definition stream.h:59
@ SOF_IPC_STREAM_PLAYBACK
Definition stream.h:58
@ SOF_COMP_DAI
Definition topology.h:30
@ SOF_COMP_HOST
Definition topology.h:29
#define assert(x)
Definition panic.h:19
Generic scheduler interface, scheduler operations, and task management.
struct sof * sof_get(void)
Get the global Sound Open Firmware runtime instance pointer.
static int memcpy_s(void *dest, size_t dest_size, const void *src, size_t count)
Definition string.h:38
Component module binding metadata and endpoint references.
Definition component.h:287
Audio component base device "class" used by all other component types.
Definition component.h:587
struct comp_ipc_config ipc_config
Component IPC configuration.
Definition component.h:599
bool is_shared
True if component is shared across cores.
Definition component.h:598
uint16_t state
Component state (COMP_STATE_*)
Definition component.h:589
struct task * task
Component processing task (cross-core or DP)
Definition component.h:594
const struct comp_driver * drv
Component driver.
Definition component.h:608
struct pipeline * pipeline
Parent pipeline reference.
Definition component.h:592
uint32_t period
Component processing period in microseconds.
Definition component.h:596
Holds list of registered components' drivers.
Definition component_ext.h:31
struct list_item list
list of component drivers
Definition component_ext.h:32
Audio component base driver "class".
Definition component.h:528
struct comp_ops ops
component operations
Definition component.h:534
uint32_t id
Component ID.
Definition component.h:562
uint32_t core
Core we run on.
Definition component.h:561
int(* set_attribute)(struct comp_dev *dev, uint32_t type, void *value)
Sets attribute in component.
Definition component.h:423
int(* get_attribute)(struct comp_dev *dev, uint32_t type, void *value)
Gets attribute in component.
Definition component.h:413
int(* prepare)(struct comp_dev *dev)
Prepares component after params are set.
Definition component.h:381
int(* reset)(struct comp_dev *dev)
Resets component.
Definition component.h:388
int(* params)(struct comp_dev *dev, struct sof_ipc_stream_params *params)
Sets component audio stream parameters.
Definition component.h:331
int(* bind)(struct comp_dev *dev, const struct bind_info *bind_data)
Bind, atomic - used to notify component of bind event.
Definition component.h:466
int(* dai_get_hw_params)(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)
Fetches hardware stream parameters.
Definition component.h:341
int(* position)(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
Retrieves component rendering position.
Definition component.h:403
uint64_t(* get_total_data_processed)(struct comp_dev *dev, uint32_t stream_no, bool input)
Returns total data processed in number of bytes.
Definition component.h:515
int(* cmd)(struct comp_dev *dev, int cmd, void *data, int max_data_size)
Used to pass standard and bespoke commands (with optional data).
Definition component.h:364
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.
Definition component.h:352
int(* trigger)(struct comp_dev *dev, int cmd)
Trigger, atomic - used to start/stop/pause stream operations.
Definition component.h:374
int(* unbind)(struct comp_dev *dev, const struct bind_info *unbind_data)
Unbind, atomic - used to notify component of unbind event.
Definition component.h:474
void(* free)(struct comp_dev *dev)
Called to delete the specified component device.
Definition component.h:323
DAI runtime data.
Definition dai-zephyr.h:119
struct dma_sg_config config
Definition dai-zephyr.h:123
Remote payload for component get_attribute IPC4 message.
Definition component_ext.h:277
void * value
Pointer to attribute value storage.
Definition component_ext.h:279
uint32_t type
Attribute type (COMP_ATTR_*)
Definition component_ext.h:278
IDC message.
Definition idc.h:158
const void * payload
pointer to payload data
Definition idc.h:163
Base module configuration parameters provided upon module instantiation.
Definition base-config.h:160
Module instance creation command structure (SOF_IPC4_MOD_INIT_INSTANCE).
Definition module.h:162
Definition ipc-config.h:65
struct comp_dev * sched_comp
Component that drives scheduling in this pipe.
Definition pipeline.h:100
struct comp_dev * sink_comp
Sink component for this pipe.
Definition pipeline.h:104
uint32_t magic
Magic number for validation.
Definition header.h:34
uint32_t abi
SOF ABI version.
Definition header.h:41
Generic control data.
Definition control.h:120
struct sof_abi_hdr data[0]
Definition control.h:153
uint32_t cmd
enum sof_ipc_ctrl_cmd
Definition control.h:126
General firmware context.
Definition sof.h:50
struct comp_driver_list * comp_drivers
Definition sof.h:104