ipc: move IPC message builder helpers to helper file

IPC builders are IPC ABI specific so move to ABI helper file.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2021-04-13 15:50:35 +01:00 committed by Liam Girdwood
parent 86a94912f7
commit df2f931171
3 changed files with 49 additions and 41 deletions

View File

@ -96,47 +96,6 @@ static inline struct ipc *ipc_get(void)
return sof_get()->ipc;
}
/**
* \brief Build stream position IPC message.
* @param[in,out] posn Stream position message
* @param[in] type Stream message type
* @param[in] id Stream ID.
*/
static inline void ipc_build_stream_posn(struct sof_ipc_stream_posn *posn,
uint32_t type, uint32_t id)
{
posn->rhdr.hdr.cmd = SOF_IPC_GLB_STREAM_MSG | type | id;
posn->rhdr.hdr.size = sizeof(*posn);
posn->comp_id = id;
}
/**
* \brief Build component event IPC message.
* @param[in,out] event Component event message
* @param[in] type Component event type
* @param[in] id Component ID.
*/
static inline void ipc_build_comp_event(struct sof_ipc_comp_event *event,
uint32_t type, uint32_t id)
{
event->rhdr.hdr.cmd = SOF_IPC_GLB_COMP_MSG | SOF_IPC_COMP_NOTIFICATION |
id;
event->rhdr.hdr.size = sizeof(*event);
event->src_comp_type = type;
event->src_comp_id = id;
}
/**
* \brief Build trace position IPC message.
* @param[in,out] posn Trace position message
*/
static inline void ipc_build_trace_posn(struct sof_ipc_dma_trace_posn *posn)
{
posn->rhdr.hdr.cmd = SOF_IPC_GLB_TRACE_MSG |
SOF_IPC_TRACE_DMA_POSITION;
posn->rhdr.hdr.size = sizeof(*posn);
}
/**
* \brief Initialise global IPC context.
* @param[in,out] sof Global SOF context.

View File

@ -96,4 +96,28 @@ void ipc_send_queued_msg(void);
*/
void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority);
/**
* \brief Build stream position IPC message.
* @param[in,out] posn Stream position message
* @param[in] type Stream message type
* @param[in] id Stream ID.
*/
void ipc_build_stream_posn(struct sof_ipc_stream_posn *posn, uint32_t type,
uint32_t id);
/**
* \brief Build component event IPC message.
* @param[in,out] event Component event message
* @param[in] type Component event type
* @param[in] id Component ID.
*/
void ipc_build_comp_event(struct sof_ipc_comp_event *event, uint32_t type,
uint32_t id);
/**
* \brief Build trace position IPC message.
* @param[in,out] posn Trace position message
*/
void ipc_build_trace_posn(struct sof_ipc_dma_trace_posn *posn);
#endif

View File

@ -32,6 +32,31 @@
#include <stddef.h>
#include <stdint.h>
void ipc_build_stream_posn(struct sof_ipc_stream_posn *posn, uint32_t type,
uint32_t id)
{
posn->rhdr.hdr.cmd = SOF_IPC_GLB_STREAM_MSG | type | id;
posn->rhdr.hdr.size = sizeof(*posn);
posn->comp_id = id;
}
void ipc_build_comp_event(struct sof_ipc_comp_event *event, uint32_t type,
uint32_t id)
{
event->rhdr.hdr.cmd = SOF_IPC_GLB_COMP_MSG | SOF_IPC_COMP_NOTIFICATION |
id;
event->rhdr.hdr.size = sizeof(*event);
event->src_comp_type = type;
event->src_comp_id = id;
}
void ipc_build_trace_posn(struct sof_ipc_dma_trace_posn *posn)
{
posn->rhdr.hdr.cmd = SOF_IPC_GLB_TRACE_MSG |
SOF_IPC_TRACE_DMA_POSITION;
posn->rhdr.hdr.size = sizeof(*posn);
}
int ipc_pipeline_new(struct ipc *ipc,
struct sof_ipc_pipe_new *pipe_desc)
{