Skip to content

Commit

Permalink
ipc4: add ipc4 message support
Browse files Browse the repository at this point in the history
There are two types of ipc4 message: global message and module message.
Ipc message is first decoded in handler.c and processed with the help
of helper.c to deal with pipeline message and module message.
Pipeline and Module messages are converted to sof pipeline and
component message.

Ipc4 pipeline message <------> ipc3 pipeline message
RUNNING       <------->   TRIGGER START
INIT + PAUSED <------->   PIPELINE COMPLETE
PAUSED        <------->   TRIGER_PAUSE
RESET         <------->   TRIGER_STOP + RESET
EOS           <------->   TRIGER_RELEASE

Ipc4 Module message <------> ipc3 module message
init module             <------->   create component
bind modules            <------->   connect components
module set_large_config <------->   component cmd
delete module           <------->   free component

There is no buffer module in ipc4 design and FW manages buffer for each
module while buffer component is defined by topology and create by ipc
message for ipc3 design. For ipc4 path, FW will create buffer when two
modules are bound since the buffer format can be gathered from source
& sink modules and the buffer can be connected to both modules.

Currently only part of ipc4 messages are processed and others will be done
in future.

Signed-off-by: Rander Wang <rander.wang@intel.com>
  • Loading branch information
RanderWang authored and lgirdwood committed Aug 3, 2021
1 parent 23c0839 commit 1f64172
Show file tree
Hide file tree
Showing 5 changed files with 964 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/include/ipc4/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,10 @@ struct ipc4_module_delete_instance {
} data;
} __attribute__((packed, aligned(4)));

#define IPC4_COMP_ID(x, y) ((x) << 16 | (y))
#define IPC4_MOD_ID(x) ((x) >> 16)
#define IPC4_INST_ID(x) ((x) & 0xffff)
#define IPC4_SRC_QUEUE_ID(x) (((x) >> 16) & 0xffff)
#define IPC4_SINK_QUEUE_ID(x) ((x) & 0xffff)

#endif
13 changes: 13 additions & 0 deletions src/include/sof/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ typedef uint32_t ipc_comp;
#include <ipc4/gateway.h>
#define ipc_from_pipe_new(x) ((struct ipc4_pipeline_create *)x)
#define ipc_from_pipe_connect(x) ((struct ipc4_module_bind_unbind *)x)

const struct comp_driver *ipc4_get_comp_drv(int module_id);
struct comp_dev *ipc4_get_comp_dev(uint32_t comp_id);
int ipc4_add_comp_dev(struct comp_dev *dev);
const struct comp_driver *ipc4_get_drv(uint8_t *uuid);
#else
#error "No or invalid IPC MAJOR version selected."
#endif
Expand Down Expand Up @@ -140,6 +145,14 @@ int ipc_pipeline_complete(struct ipc *ipc, uint32_t comp_id);
*/
int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *connect);

/**
* \brief Disconnect components in a pipeline.
* @param ipc The global IPC context.
* @param connect Components.
* @return 0 on success or negative error.
*/
int ipc_comp_disconnect(struct ipc *ipc, ipc_pipe_comp_connect *connect);

/**
* \brief Get component device from component ID.
* @param ipc The global IPC context.
Expand Down
2 changes: 2 additions & 0 deletions src/ipc/ipc4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

add_local_sources(sof
dai.c
handler.c
helper.c
)
Loading

0 comments on commit 1f64172

Please sign in to comment.