Sound Open Firmware
Loading...
Searching...
No Matches
component.h File Reference

Component API definition. More...

Include dependency graph for component.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bind_info
 Component module binding metadata and endpoint references. More...
 
struct  comp_ops
 Audio component operations table. More...
 
struct  comp_driver
 Audio component base driver "class". More...
 
struct  comp_driver_info
 Holds constant pointer to component driver. More...
 
struct  comp_ipc_config
 Audio component base configuration from IPC at creation. More...
 
struct  comp_perf_data
 Component performance measurement tracking data. More...
 
struct  comp_dev
 Audio component base device "class" used by all other component types. More...
 
struct  comp_copy_limits
 Struct for use with comp_get_copy_limits() function. More...
 

Macros

#define SOF_DRV_UID_NAME(drv)   (drv)->tctx->uuid_p
 
#define comp_dev_for_each_producer(_dev, _producer)
 Macro to iterate through component's list of producer buffers.
 
#define comp_dev_for_each_producer_safe(_dev, _producer, _next_producer)
 Safe macro to iterate through component's producer buffers allowing buffer deletion.
 
#define comp_dev_for_each_consumer(_dev, _consumer)
 Macro to iterate through component's list of consumer buffers.
 
#define comp_dev_for_each_consumer_safe(_dev, _consumer, _next_consumer)
 Safe macro to iterate through component's consumer buffers allowing buffer deletion.
 
#define comp_set_drvdata(c, data)    (c->priv_data = data)
 Assigns private data to component device.
 
#define comp_get_drvdata(c)    (c->priv_data)
 Retrieves driver private data from component device.
 
#define DECLARE_MODULE(init)
 
Audio Component States
#define COMP_STATE_NOT_EXIST   0
 Component does not exist.
 
#define COMP_STATE_INIT   1
 Component being initialised.
 
#define COMP_STATE_READY   2
 Component inactive, but ready.
 
#define COMP_STATE_SUSPEND   3
 Component suspended.
 
#define COMP_STATE_PREPARE   4
 Component prepared.
 
#define COMP_STATE_PAUSED   5
 Component paused.
 
#define COMP_STATE_ACTIVE   6
 Component active.
 
#define COMP_STATE_PRE_ACTIVE   7
 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.

#define COMP_CMD_SET_VALUE   100
 Set value to component.
 
#define COMP_CMD_GET_VALUE   101
 Get value from component.
 
#define COMP_CMD_SET_DATA   102
 Set data to component.
 
#define COMP_CMD_GET_DATA   103
 Get data from component.
 
MMAP IPC status
#define COMP_CMD_IPC_MMAP_RPOS   200
 Host read position.
 
#define COMP_CMD_IPC_MMAP_PPOS   201
 DAI presentation position.
 
#define COMP_CMD_IPC_MMAP_VOL(chan)   (216 + chan)
 Volume.
 
Component status
#define COMP_STATUS_STATE_ALREADY_SET   1
 Comp set state status.
 
Component attribute types
#define COMP_ATTR_COPY_TYPE   0
 Comp copy type attribute.
 
#define COMP_ATTR_HOST_BUFFER   1
 Comp host buffer attribute.
 
#define COMP_ATTR_COPY_DIR   2
 Comp copy direction.
 
#define COMP_ATTR_VDMA_INDEX   3
 Comp index of the virtual DMA at the gateway.
 
#define COMP_ATTR_BASE_CONFIG   4
 Component base config.
 
#define COMP_ATTR_IPC4_CONFIG   5
 Component ipc4 set/get config.
 
Trace macros
#define trace_comp_drv_get_id(drv_p)   (-1)
 Retrieves id (-1 = undefined) from the component driver.
 
#define trace_comp_drv_get_subid(drv_p)   (-1)
 Retrieves subid (-1 = undefined) from the component driver.
 
#define trace_comp_get_id(comp_p)   ((comp_p)->ipc_config.pipeline_id)
 Retrieves id (pipe id) from the component device.
 
#define trace_comp_get_subid(comp_p)   ((comp_p)->ipc_config.id)
 Retrieves subid (comp id) from the component device.
 
#define trace_comp_drv_get_tr_ctx(drv_p)   ((drv_p)->tctx)
 Retrieves trace context from the component driver.
 
#define trace_comp_get_tr_ctx(comp_p)   (&(comp_p)->tctx)
 Retrieves trace context from the component device.
 
#define comp_cl_err(drv_p, __e, ...)
 Trace error message from component driver (no comp instance)
 
#define comp_cl_warn(drv_p, __e, ...)
 Trace warning message from component driver (no comp instance)
 
#define comp_cl_info(drv_p, __e, ...)
 Trace info message from component driver (no comp instance)
 
#define comp_cl_dbg(drv_p, __e, ...)
 Trace debug message from component driver (no comp instance)
 
#define comp_err(comp_p, __e, ...)
 Trace error message from component device.
 
#define comp_warn(comp_p, __e, ...)
 Trace warning message from component device.
 
#define comp_info(comp_p, __e, ...)
 Trace info message from component device.
 
#define comp_dbg(comp_p, __e, ...)
 Trace debug message from component device.
 
#define comp_perf_info(pcd, comp_p)
 
#define comp_perf_avg_info(pcd, comp_p)
 
Component processing domains
#define COMP_PROCESSING_DOMAIN_LL   0
 Low latency processing domain.
 
#define COMP_PROCESSING_DOMAIN_DP   1
 Data processing / worker thread domain.
 

Enumerations

enum  comp_endpoint_type { COMP_ENDPOINT_HOST , COMP_ENDPOINT_DAI , COMP_ENDPOINT_NODE }
 Type of endpoint this component is connected to in a pipeline. More...
 
enum  comp_copy_type { COMP_COPY_INVALID = -1 , COMP_COPY_NORMAL = 0 , COMP_COPY_BLOCKING , COMP_COPY_ONE_SHOT }
 Type of next dma copy mode, changed on runtime. More...
 
enum  bind_type { COMP_BIND_TYPE_SOURCE , COMP_BIND_TYPE_SINK }
 Component module binding endpoint type. More...
 
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.

enum  {
  COMP_TRIGGER_STOP , COMP_TRIGGER_START , COMP_TRIGGER_PAUSE , COMP_TRIGGER_RELEASE ,
  COMP_TRIGGER_RESET , COMP_TRIGGER_PREPARE , COMP_TRIGGER_XRUN , COMP_TRIGGER_PRE_START ,
  COMP_TRIGGER_PRE_RELEASE , COMP_TRIGGER_POST_STOP , COMP_TRIGGER_POST_PAUSE , COMP_TRIGGER_NO_ACTION
}
 

Functions

static 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.
 
static 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.
 
static struct comp_buffer * comp_dev_get_next_data_producer_safe (struct comp_dev *component, struct comp_buffer *producer)
 Safely get a pointer to the next comp_buffer object providing data to the component.
 
static 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.
 
static 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.
 
static struct comp_buffer * comp_dev_get_next_data_consumer_safe (struct comp_dev *component, struct comp_buffer *consumer)
 Safely get a pointer to the next comp_buffer object receiving data from the component.
 
static uint32_t dev_comp_id (const struct comp_dev *dev)
 Retrieves Component ID from device.
 
static uint32_t dev_comp_pipe_id (const struct comp_dev *dev)
 Retrieves Component pipeline ID from device.
 
static enum sof_comp_type dev_comp_type (const struct comp_dev *dev)
 Retrieves component type from device.
 
static void comp_init (const struct comp_driver *drv, struct comp_dev *dev, size_t bytes)
 Initialize common part of a component device.
 
static struct comp_dev * comp_alloc (const struct comp_driver *drv, size_t bytes)
 Allocates memory for the component device and initializes common part.
 
static void comp_free_device (struct comp_dev *dev)
 Frees memory allocated for component device.
 
static struct processing_module * comp_mod (const struct comp_dev *dev)
 Module adapter associated with a component.
 
void sys_comp_dai_init (void)
 
void sys_comp_host_init (void)
 
void sys_comp_kpb_init (void)
 
void sys_comp_selector_init (void)
 
void sys_comp_module_aria_interface_init (void)
 
void sys_comp_module_asrc_interface_init (void)
 
void sys_comp_module_copier_interface_init (void)
 
void sys_comp_module_crossover_interface_init (void)
 
void sys_comp_module_dcblock_interface_init (void)
 
void sys_comp_module_demux_interface_init (void)
 
void sys_comp_module_dolby_dax_audio_processing_interface_init (void)
 
void sys_comp_module_drc_interface_init (void)
 
void sys_comp_module_dts_interface_init (void)
 
void sys_comp_module_eq_fir_interface_init (void)
 
void sys_comp_module_eq_iir_interface_init (void)
 
void sys_comp_module_gain_interface_init (void)
 
void sys_comp_module_google_rtc_audio_processing_interface_init (void)
 
void sys_comp_module_google_ctc_audio_processing_interface_init (void)
 
void sys_comp_module_igo_nr_interface_init (void)
 
void sys_comp_module_level_multiplier_interface_init (void)
 
void sys_comp_module_mfcc_interface_init (void)
 
void sys_comp_module_mixer_interface_init (void)
 
void sys_comp_module_mixin_interface_init (void)
 
void sys_comp_module_mixout_interface_init (void)
 
void sys_comp_module_multiband_drc_interface_init (void)
 
void sys_comp_module_mux_interface_init (void)
 
void sys_comp_module_nxp_eap_interface_init (void)
 
void sys_comp_module_phase_vocoder_interface_init (void)
 
void sys_comp_module_rtnr_interface_init (void)
 
void sys_comp_module_selector_interface_init (void)
 
void sys_comp_module_sound_dose_interface_init (void)
 
void sys_comp_module_src_interface_init (void)
 
void sys_comp_module_src_lite_interface_init (void)
 
void sys_comp_module_stft_process_interface_init (void)
 
void sys_comp_module_tdfb_interface_init (void)
 
void sys_comp_module_tone_interface_init (void)
 
void sys_comp_module_template_interface_init (void)
 
void sys_comp_module_tester_interface_init (void)
 
void sys_comp_module_volume_interface_init (void)
 
int comp_set_state (struct comp_dev *dev, int cmd)
 Component state transition handling.
 
static void component_set_nearest_period_frames (struct comp_dev *current, uint32_t rate)
 Set component period frames based on sample rate and period.
 
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.
 
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.
 
static int comp_get_state (const struct comp_dev *dev)
 Get component state.
 
static int comp_buffer_get_source_state (const struct comp_buffer *buffer)
 Provide state of a component connected to a buffer as a data provider.
 
static int comp_buffer_get_sink_state (const struct comp_buffer *buffer)
 Provide state of a component connected to a buffer as a data consumer.
 
int comp_verify_params (struct comp_dev *dev, uint32_t flag, struct sof_ipc_stream_params *params)
 Verify and set component audio parameters.
 
void comp_update_ibs_obs_cpc (struct comp_dev *dev)
 Update IBS, OBS, CPC, LL chunk size for component.
 
void comp_init_performance_data (struct comp_dev *dev)
 Initialize performance data fields if component has assigned slot in measurement window.
 
bool comp_update_performance_data (struct comp_dev *dev, uint32_t cycles_used)
 Update performance data entry for component and check for budget violation.
 
static int user_get_buffer_memory_region (const struct comp_driver *drv)
 Get memory region flag for component buffer allocations.
 
Component registration
int comp_register (struct comp_driver_info *drv)
 Registers the component driver on the list of available components.
 
void comp_unregister (struct comp_driver_info *drv)
 Unregisters the component driver from the list of available components.
 
int comp_set_adapter_ops (const struct comp_driver *drv, const struct module_interface *ops)
 Set adapter ops for a dynamically created driver.
 
const struct comp_driver * comp_driver_find (const struct sof_uuid *uuid, uint32_t type)
 Look up a registered SOF component driver by UUID or driver type.
 
XRUN handling.
static void comp_underrun (struct comp_dev *dev, struct comp_buffer *source, uint32_t copy_bytes)
 Called by the component device when underrun is detected.
 
static void comp_overrun (struct comp_dev *dev, struct comp_buffer *sink, uint32_t copy_bytes)
 Called by component device when overrun is detected.
 

Detailed Description