16#ifndef __SOF_AUDIO_COMPONENT_INT_H__
17#define __SOF_AUDIO_COMPONENT_INT_H__
20#include <ipc/topology.h>
32#define comp_buffer_list(comp, dir) \
33 ((dir) == PPL_DIR_DOWNSTREAM ? &(comp)->bsink_list : \
34 &(comp)->bsource_list)
39#elif CONFIG_IPC_MAJOR_4
92 comp_err(dev,
"pcm params verification failed");
111#if CONFIG_IPC_MAJOR_3
113static inline int comp_cmd(
struct comp_dev *dev,
int cmd,
void *
data,
123 comp_err(dev,
"comp_cmd(): invalid version, data->magic = %u, data->abi = %u",
208#if CONFIG_IPC_MAJOR_4
209struct get_attribute_remote_payload {
214static inline int comp_ipc4_get_attribute_remote(
struct comp_dev *dev, uint32_t
type,
217 struct ipc4_base_module_cfg *base_cfg;
218 struct get_attribute_remote_payload payload = {};
239 base_cfg,
sizeof(
struct ipc4_base_module_cfg));
250#if CONFIG_IPC_MAJOR_4
254 comp_ipc4_get_attribute_remote(dev,
type,
value);
298#if CONFIG_IPC_MAJOR_3
301 const void *spec_config)
310#elif CONFIG_IPC_MAJOR_4
317#error Unknown IPC major version
431#ifdef CONFIG_SOF_USERSPACE_LL
440#if CONFIG_IPC_MAJOR_4
441static inline int comp_ipc4_bind_remote(
struct comp_dev *dev,
const struct bind_info *bind_data)
445 sizeof(*bind_data), bind_data};
453#if CONFIG_IPC_MAJOR_4
456 dev->
drv->
ops.
bind(dev, bind_data) : comp_ipc4_bind_remote(dev, bind_data);
469#if CONFIG_IPC_MAJOR_4
470static inline int comp_ipc4_unbind_remote(
struct comp_dev *dev,
const struct bind_info *unbind_data)
474 sizeof(*unbind_data), unbind_data};
482#if CONFIG_IPC_MAJOR_4
486 comp_ipc4_unbind_remote(dev, unbind_data);
#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:244
Component API definition.
static bool cpu_is_me(int id)
Definition cpu.h:103
uint32_t data[]
Definition debug_stream_slot.h:2
int module_init(struct processing_module *mod)
void * rzalloc(uint32_t flags, size_t bytes)
Similar to rmalloc(), guarantees that returned block is zeroed.
#define SOF_MEM_FLAG_USER
Allocate user memory address.
Definition alloc.h:45
void rfree(void *ptr)
Frees the memory block.
#define SOF_MEM_FLAG_COHERENT
Allocate uncached address.
Definition alloc.h:37
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:341
static int comp_trigger(struct comp_dev *dev, int cmd)
See comp_ops::trigger.
Definition component_ext.h:174
static int comp_params(struct comp_dev *dev, struct sof_ipc_stream_params *params)
See comp_ops::params.
Definition component_ext.h:73
static int comp_prepare_remote(struct comp_dev *dev)
Runs comp_ops::prepare on the target component's core.
Definition component_ext.h:188
static int comp_get_endpoint_type(struct comp_dev *dev)
Returns endpoint type of given component.
Definition component_ext.h:396
static int comp_trigger_remote(struct comp_dev *dev, int cmd)
Runs comp_ops::trigger on the core the target component is assigned to.
Definition component_ext.h:138
static int comp_dai_get_hw_params(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)
See comp_ops::dai_get_hw_params.
Definition component_ext.h:101
static int comp_reset_remote(struct comp_dev *dev)
Runs comp_ops::reset on the target component's core.
Definition component_ext.h:276
static void comp_make_shared(struct comp_dev *dev)
Called to mark component as shared between cores.
Definition component_ext.h:422
static int comp_is_active(struct comp_dev *current)
Checks if component device is active.
Definition component_ext.h:352
static int comp_prepare(struct comp_dev *dev)
See comp_ops::prepare.
Definition component_ext.h:197
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:511
static int comp_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
See comp_ops::position.
Definition component_ext.h:320
static bool comp_is_scheduling_source(struct comp_dev *dev)
Called to check whether component schedules its pipeline.
Definition component_ext.h:413
int comp_copy(struct comp_dev *dev)
static void comp_free(struct comp_dev *dev)
See comp_ops::new.
Definition component_ext.h:44
static struct comp_driver_list * comp_drivers_get(void)
Get the global component driver list.
Definition component_ext.h:434
static int comp_unbind(struct comp_dev *dev, const struct bind_info *unbind_data)
Definition component_ext.h:480
static int comp_params_remote(struct comp_dev *dev, struct sof_ipc_stream_params *params)
Parameter init for component on other core.
Definition component_ext.h:63
static uint64_t comp_get_total_data_processed(struct comp_dev *dev, uint32_t stream_no, bool input)
Definition component_ext.h:499
void sys_comp_init(struct sof *sof)
Allocates and initializes audio component list.
static int comp_set_attribute(struct comp_dev *dev, uint32_t type, void *value)
See comp_ops::set_attribute.
Definition component_ext.h:266
static int comp_get_requested_state(int cmd)
Returns component state based on requested command.
Definition component_ext.h:362
static int comp_bind(struct comp_dev *dev, const struct bind_info *bind_data)
Definition component_ext.h:451
static int comp_get_attribute(struct comp_dev *dev, uint32_t type, void *value)
See comp_ops::get_attribute.
Definition component_ext.h:247
static int comp_reset(struct comp_dev *dev)
Component reset and free runtime resources.
Definition component_ext.h:289
static int comp_trigger_local(struct comp_dev *dev, int cmd)
Definition component_ext.h:147
#define COMP_STATE_ACTIVE
Component active.
Definition component.h:58
#define comp_err(comp_p, __e,...)
Trace error message from component device.
Definition component.h:218
#define COMP_STATE_READY
Component inactive, but ready.
Definition component.h:54
#define COMP_STATE_PREPARE
Component prepared.
Definition component.h:56
#define COMP_CMD_SET_DATA
Set data to component.
Definition component.h:98
#define COMP_ATTR_BASE_CONFIG
Component base config.
Definition component.h:124
#define COMP_STATE_INIT
Component being initialised.
Definition component.h:53
#define COMP_STATE_PRE_ACTIVE
Component after early initialisation.
Definition component.h:59
#define COMP_STATE_PAUSED
Component paused.
Definition component.h:57
@ COMP_TRIGGER_STOP
Stop component stream.
Definition component.h:74
@ COMP_TRIGGER_XRUN
XRUN component.
Definition component.h:80
@ COMP_TRIGGER_PAUSE
Pause the component stream.
Definition component.h:76
@ COMP_TRIGGER_RESET
Reset component.
Definition component.h:78
@ COMP_TRIGGER_PREPARE
Prepare component.
Definition component.h:79
@ COMP_TRIGGER_START
Start component stream.
Definition component.h:75
@ COMP_TRIGGER_PRE_START
Prepare to start component stream.
Definition component.h:81
@ COMP_TRIGGER_RELEASE
Release paused component stream.
Definition component.h:77
@ COMP_TRIGGER_PRE_RELEASE
Prepare to release paused component stream.
Definition component.h:82
@ COMP_ENDPOINT_HOST
Connected to host dma.
Definition component.h:256
@ COMP_ENDPOINT_DAI
Connected to dai dma.
Definition component.h:257
@ COMP_ENDPOINT_NODE
No dma connection.
Definition component.h:258
static enum sof_comp_type dev_comp_type(const struct comp_dev *dev)
Retrieves component type from device.
Definition component.h:850
int comp_verify_params(struct comp_dev *dev, uint32_t flag, struct sof_ipc_stream_params *params)
Warning: duplicate declaration in topology.h.
static uint32_t dev_comp_pipe_id(const struct comp_dev *dev)
Retrieves Component pipeline id from device.
Definition component.h:840
#define comp_get_drvdata(c)
Retrieves driver private data from component device.
Definition component.h:935
static int schedule_task(struct task *task, uint64_t start, uint64_t period)
See scheduler_ops::schedule_task.
Definition schedule.h:241
int dai_config(struct dai_data *dd, struct comp_dev *dev, struct ipc_config_dai *common_cfg, const void *spec_cfg)
Configure DAI physical interface.
#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 list_item(item, type, member)
Definition list.h:80
#define assert(x)
Definition panic.h:19
struct sof * sof_get(void)
#define LOG_MODULE_DECLARE(ctx, level)
Definition trace.h:163
static int memcpy_s(void *dest, size_t dest_size, const void *src, size_t count)
Definition string.h:38
Definition component.h:284
Audio component base device "class".
Definition component.h:645
struct comp_ipc_config ipc_config
Component IPC configuration.
Definition component.h:668
bool is_shared
indicates whether component is shared across cores
Definition component.h:665
uint16_t state
COMP_STATE_.
Definition component.h:648
struct task * task
component's processing task used 1) for components running on different core than the rest of the pip...
Definition component.h:652
const struct comp_driver * drv
driver
Definition component.h:675
struct pipeline * pipeline
pipeline we belong to
Definition component.h:650
uint32_t period
component's processing period for LL modules is set to LL pipeline's period for DP module its meaning...
Definition component.h:658
Holds list of registered components' drivers.
Definition component_ext.h:27
struct list_item list
list of component drivers
Definition component_ext.h:28
Audio component base driver "class".
Definition component.h:587
struct comp_ops ops
component operations
Definition component.h:591
uint32_t id
component id
Definition component.h:615
uint32_t core
core we run on
Definition component.h:614
int(* set_attribute)(struct comp_dev *dev, uint32_t type, void *value)
Sets attribute in component.
Definition component.h:467
int(* get_attribute)(struct comp_dev *dev, uint32_t type, void *value)
Gets attribute in component.
Definition component.h:455
int(* prepare)(struct comp_dev *dev)
Prepares component after params are set.
Definition component.h:415
int(* reset)(struct comp_dev *dev)
Resets component.
Definition component.h:425
int(* params)(struct comp_dev *dev, struct sof_ipc_stream_params *params)
Sets component audio stream parameters.
Definition component.h:358
int(* bind)(struct comp_dev *dev, const struct bind_info *bind_data)
Bind, atomic - used to notify component of bind event.
Definition component.h:519
int(* dai_get_hw_params)(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)
Fetches hardware stream parameters.
Definition component.h:371
int(* position)(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
Retrieves component rendering position.
Definition component.h:443
uint64_t(* get_total_data_processed)(struct comp_dev *dev, uint32_t stream_no, bool input)
Returns total data processed in number bytes.
Definition component.h:580
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:382
int(* trigger)(struct comp_dev *dev, int cmd)
Trigger, atomic - used to start/stop/pause stream operations.
Definition component.h:405
int(* unbind)(struct comp_dev *dev, const struct bind_info *unbind_data)
Unbind, atomic - used to notify component of unbind event.
Definition component.h:528
void(* free)(struct comp_dev *dev)
Called to delete the specified component device.
Definition component.h:346
DAI runtime data.
Definition dai-zephyr.h:119
struct dma_sg_config config
Definition dai-zephyr.h:123
IDC message.
Definition idc.h:158
const void * payload
pointer to payload data
Definition idc.h:163
Definition ipc-config.h:65
struct comp_dev * sched_comp
Definition pipeline.h:84
struct comp_dev * sink_comp
Definition pipeline.h:88
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:44
struct comp_driver_list * comp_drivers
Definition sof.h:98
char value[]
Definition tlv.h:2
uint32_t type
Definition tlv.h:0