Sound Open Firmware
Loading...
Searching...
No Matches
comp_ops Struct Reference

Audio component operations. More...

#include <component.h>

Collaboration diagram for comp_ops:

Data Fields

struct comp_dev *(* create )(const struct comp_driver *drv, const struct comp_ipc_config *ipc_config, const void *spec)
 Creates a new component device.
void(* free )(struct comp_dev *dev)
 Called to delete the specified component device.
int(* params )(struct comp_dev *dev, struct sof_ipc_stream_params *params)
 Sets component audio stream parameters.
int(* dai_get_hw_params )(struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)
 Fetches hardware stream parameters.
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.
int(* trigger )(struct comp_dev *dev, int cmd)
 Trigger, atomic - used to start/stop/pause stream operations.
int(* prepare )(struct comp_dev *dev)
 Prepares component after params are set.
int(* reset )(struct comp_dev *dev)
 Resets component.
int(* copy )(struct comp_dev *dev)
 Copy and process stream data from source to sink buffers.
int(* position )(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
 Retrieves component rendering position.
int(* get_attribute )(struct comp_dev *dev, uint32_t type, void *value)
 Gets attribute in component.
int(* set_attribute )(struct comp_dev *dev, uint32_t type, void *value)
 Sets attribute in component.
int(* dai_ts_config )(struct comp_dev *dev)
 Configures timestamping in attached DAI.
int(* dai_ts_start )(struct comp_dev *dev)
 Starts timestamping.
int(* dai_ts_stop )(struct comp_dev *dev)
 Stops timestamping.
int(* dai_ts_get )(struct comp_dev *dev, struct timestamp_data *tsd)
 Gets timestamp.
int(* bind )(struct comp_dev *dev, const struct bind_info *bind_data)
 Bind, atomic - used to notify component of bind event.
int(* unbind )(struct comp_dev *dev, const struct bind_info *unbind_data)
 Unbind, atomic - used to notify component of unbind event.
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.
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.
uint64_t(* get_total_data_processed )(struct comp_dev *dev, uint32_t stream_no, bool input)
 Returns total data processed in number bytes.

Detailed Description

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.

Field Documentation

◆ bind

int(* comp_ops::bind) (struct comp_dev *dev, const struct bind_info *bind_data)

Bind, atomic - used to notify component of bind event.

Parameters
devComponent device.
dataBind info

Usually can be __cold.

◆ copy

int(* comp_ops::copy) (struct comp_dev *dev)

Copy and process stream data from source to sink buffers.

Parameters
devComponent device.
Returns
Number of copied frames.

Usually shouldn't be __cold.

◆ create

struct comp_dev *(* comp_ops::create) (const struct comp_driver *drv, const struct comp_ipc_config *ipc_config, const void *spec)

Creates a new component device.

Parameters
drvParent component driver.
ipc_configComponent parameters.
specPointer to initialization data
Returns
Pointer to the 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.

◆ dai_config

int(* comp_ops::dai_config) (struct dai_data *dd, struct comp_dev *dev, struct ipc_config_dai *dai_config, const void *dai_spec_config)

Configures attached DAI.

Parameters
devComponent device.
dai_configDAI configuration.

Mandatory for components that allocate DAI. Usually can be __cold.

◆ dai_get_hw_params

int(* comp_ops::dai_get_hw_params) (struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir)

Fetches hardware stream parameters.

Parameters
devComponent device.
paramsReceives copy of stream parameters retrieved from DAI hw settings.
dirStream direction (see enum sof_ipc_stream_direction).

Mandatory for components that allocate DAI. Usually can be __cold.

◆ dai_ts_config

int(* comp_ops::dai_ts_config) (struct comp_dev *dev)

Configures timestamping in attached DAI.

Parameters
devComponent device.

Mandatory for components that allocate DAI. Usually can be __cold.

◆ dai_ts_get

int(* comp_ops::dai_ts_get) (struct comp_dev *dev, struct timestamp_data *tsd)

Gets timestamp.

Parameters
devComponent device.
tsdReceives timestamp data.

Mandatory for components that allocate DAI. Usually shouldn't be __cold.

◆ dai_ts_start

int(* comp_ops::dai_ts_start) (struct comp_dev *dev)

Starts timestamping.

Parameters
devComponent device.

Mandatory for components that allocate DAI. Usually can be __cold.

◆ dai_ts_stop

int(* comp_ops::dai_ts_stop) (struct comp_dev *dev)

Stops timestamping.

Parameters
devComponent device.

Mandatory for components that allocate DAI. Usually can be __cold.

◆ free

void(* comp_ops::free) (struct comp_dev *dev)

Called to delete the specified component device.

Parameters
devComponent device to be deleted.

All data structures previously allocated on the run-time heap must be freed by the implementation of free(). Usually can be __cold.

◆ get_attribute

int(* comp_ops::get_attribute) (struct comp_dev *dev, uint32_t type, void *value)

Gets attribute in component.

Parameters
devComponent device.
typeAttribute type.
valueAttribute value.
Returns
0 if succeeded, error code otherwise.

Usually can be __cold.

◆ get_large_config

int(* comp_ops::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.

Parameters
devComponent device
param_idparam id for each component
first_blockfirst block of large block.
last_blocklast block of large block.
data_offsetblock offset filled by callee.
datablock data.
Returns
0 if succeeded, error code otherwise.

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.

◆ get_total_data_processed

uint64_t(* comp_ops::get_total_data_processed) (struct comp_dev *dev, uint32_t stream_no, bool input)

Returns total data processed in number bytes.

Parameters
devComponent device
stream_noIndex of input/output stream
inputSelects between input (true) or output (false) stream direction
Returns
total data processed if succeeded, 0 otherwise.

Usually shouldn't be __cold.

◆ params

int(* comp_ops::params) (struct comp_dev *dev, struct sof_ipc_stream_params *params)

Sets component audio stream parameters.

Parameters
devComponent device.
paramsAudio (PCM) stream parameters to be set.

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.

◆ position

int(* comp_ops::position) (struct comp_dev *dev, struct sof_ipc_stream_posn *posn)

Retrieves component rendering position.

Parameters
devComponent device.
posnReceives reported position.

Usually shouldn't be __cold.

◆ prepare

int(* comp_ops::prepare) (struct comp_dev *dev)

Prepares component after params are set.

Parameters
devComponent device.

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.

◆ reset

int(* comp_ops::reset) (struct comp_dev *dev)

Resets component.

Parameters
devComponent device.

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.

◆ set_attribute

int(* comp_ops::set_attribute) (struct comp_dev *dev, uint32_t type, void *value)

Sets attribute in component.

Parameters
devComponent device.
typeAttribute type.
valueAttribute value.
Returns
0 if succeeded, error code otherwise.

Usually can be __cold.

◆ set_large_config

int(* comp_ops::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.

Parameters
devComponent device
param_idparam id for each component
first_blockfirst block of large block.
last_blocklast block of large block.
data_offsetblock offset in large block.
datablock data.
Returns
0 if succeeded, error code otherwise.

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.

◆ trigger

int(* comp_ops::trigger) (struct comp_dev *dev, int cmd)

Trigger, atomic - used to start/stop/pause stream operations.

Parameters
devComponent device.
cmdCommand, one of COMP_TRIGGER_...

Usually shouldn't be __cold.

◆ unbind

int(* comp_ops::unbind) (struct comp_dev *dev, const struct bind_info *unbind_data)

Unbind, atomic - used to notify component of unbind event.

Parameters
devComponent device.
dataunBind info

Usually can be __cold.


The documentation for this struct was generated from the following file:
  • /home/lrg/work/sof-dox-work/src/include/sof/audio/component.h