|
Sound Open Firmware
|
Component API definition. More...


Go to the source code of this file.
Data Structures | |
| struct | bind_info |
| struct | comp_ops |
| Audio component operations. 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 |
| struct | comp_dev |
| Audio component base device "class". More... | |
| struct | comp_copy_limits |
| Struct for use with comp_get_copy_limits() function. More... | |
Macros | |
| #define | COMP_PROCESSING_DOMAIN_LL 0 |
| #define | COMP_PROCESSING_DOMAIN_DP 1 |
| #define | comp_dev_for_each_producer(_dev, _producer) |
| #define | comp_dev_for_each_producer_safe(_dev, _producer, _next_producer) |
| #define | comp_dev_for_each_consumer(_dev, _consumer) |
| #define | comp_dev_for_each_consumer_safe(_dev, _consumer, _next_consumer) |
| #define | comp_set_drvdata(c, data) |
| Assigns private data to component device. | |
| #define | comp_get_drvdata(c) |
| Retrieves driver private data from component device. | |
| #define | DECLARE_MODULE(init) |
| Usage at the end of an independent module file: DECLARE_MODULE(sys_*_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) |
| 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_tr_ctx(drv_p) |
| Retrieves trace context from the component driver. | |
| #define | trace_comp_drv_get_id(drv_p) |
| Retrieves id (-1 = undefined) from the component driver. | |
| #define | trace_comp_drv_get_subid(drv_p) |
| Retrieves subid (-1 = undefined) from the component driver. | |
| #define | trace_comp_get_tr_ctx(comp_p) |
| Retrieves trace context from the component device. | |
| #define | trace_comp_get_id(comp_p) |
| Retrieves id (pipe id) from the component device. | |
| #define | trace_comp_get_subid(comp_p) |
| Retrieves subid (comp id) 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) |
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 } |
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 The function will return NULL if there's no data provider. | |
| 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 The function will return NULL if there're no more data providers _save version also checks if producer != NULL. | |
| static struct comp_buffer * | comp_dev_get_next_data_producer_safe (struct comp_dev *component, struct comp_buffer *producer) |
| 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 The function will return NULL if there's no data consumers. | |
| 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 The function will return NULL if there're no more data consumers _safe version also checks if consumer is != NULL. | |
| static struct comp_buffer * | comp_dev_get_next_data_consumer_safe (struct comp_dev *component, struct comp_buffer *consumer) |
| 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. | |
| int | comp_set_state (struct comp_dev *dev, int cmd) |
| Component state set. | |
| static void | component_set_nearest_period_frames (struct comp_dev *current, uint32_t rate) |
| 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 (data available in source vs. | |
| 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 (data available in source vs. | |
| 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) |
| helper, 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) |
| helper, 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) |
| Warning: duplicate declaration in topology.h. | |
| 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) |
| If component has assigned slot in performance measurement window, initialize its fields. | |
| bool | comp_update_performance_data (struct comp_dev *dev, uint32_t cycles_used) |
| Update performance data entry for component. | |
| static int | user_get_buffer_memory_region (const struct comp_driver *drv) |
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. | |
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. | |
Component API definition.
| void comp_init_performance_data | ( | struct comp_dev * | dev | ) |
If component has assigned slot in performance measurement window, initialize its fields.
| dev | Component to init. |
| void comp_update_ibs_obs_cpc | ( | struct comp_dev * | dev | ) |
Update ibs, obs, cpc, ll chunk size for component.
| dev | Component to update. |
| bool comp_update_performance_data | ( | struct comp_dev * | dev, |
| uint32_t | cycles_used ) |
Update performance data entry for component.
Also checks for budget violation.
| dev | Component to update. |
| cycles_used | Execution time. |
|
inlinestatic |