Sound Open Firmware
Loading...
Searching...
No Matches
common.h File Reference
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ipc_user
 
struct  ipc
 
struct  ipc_data_host_buffer
 Data provided by the platform which use ipc...page_descriptors(). More...
 

Macros

#define IPC_IS_SIZE_INVALID(object)    ((object).hdr.size != sizeof(object))
 
#define IPC_TAIL_IS_SIZE_INVALID(object)    ((object).comp.hdr.size + (object).comp.ext_data_length < sizeof(object))
 
#define IPC_SIZE_ERROR_TRACE(ctx, object)
 
#define ipc_get_ppl_src_comp(ipc, ppl_id)    ipc_get_ppl_comp(ipc, ppl_id, PPL_DIR_UPSTREAM)
 
#define ipc_get_ppl_sink_comp(ipc, ppl_id)    ipc_get_ppl_comp(ipc, ppl_id, PPL_DIR_DOWNSTREAM)
 
#define IPC_TASK_INLINE   BIT(0)
 
#define IPC_TASK_IN_THREAD   BIT(1)
 
#define IPC_TASK_SECONDARY_CORE   BIT(2)
 
#define IPC_TASK_POWERDOWN   BIT(3)
 
#define IPC_DSP_CORE_COUNT   1
 
#define ipc_set_drvdata(ipc, data)    ((ipc)->private = data)
 
#define ipc_get_drvdata(ipc)    ((ipc)->private)
 

Functions

static struct ipc * ipc_get (void)
 Get the IPC global context.
 
int ipc_init (struct sof *sof)
 Initialise global IPC context.
 
void ipc_free (struct ipc *ipc)
 Free global IPC context.
 
int ipc_process_host_buffer (struct ipc *ipc, struct sof_ipc_host_buffer *ring, uint32_t direction, struct dma_sg_elem_array *elem_array, uint32_t *ring_size)
 Processes page tables for the host buffer.
 
int ipc_dma_trace_send_position (void)
 Send DMA trace host buffer position to host.
 
void ipc_send_buffer_status_notify (void)
 send a IPC buffer status notify message
 
int ipc_dai_data_config (struct dai_data *dd, struct comp_dev *dev)
 Configure DAI.
 
int ipc4_user_process_module_message (struct ipc4_message_request *ipc4, struct ipc_msg *reply)
 Processes IPC4 userspace module message.
 
int ipc4_user_process_glb_message (struct ipc4_message_request *ipc4, struct ipc_msg *reply)
 Processes IPC4 userspace global message.
 
void ipc_compound_msg_done (uint32_t msg_id, int error)
 Complete the IPC compound message.
 
void ipc_boot_complete_msg (struct ipc_cmd_hdr *header, uint32_t data)
 create a IPC boot complete message.
 
void ipc_send_panic_notification (void)
 Send a IPC notification that FW has hit a DSP notification.
 
struct ipc_cmd_hdr * ipc_compact_read_msg (void)
 Read a compact IPC message or return NULL for normal message.
 
int ipc_compact_write_msg (struct ipc_cmd_hdr *hdr)
 Write a compact IPC message.
 
struct ipc_cmd_hdr * ipc_prepare_to_send (const struct ipc_msg *msg)
 Prepare an IPC message for sending.
 
struct ipc_cmd_hdr * mailbox_validate (void)
 Validate mailbox contents for valid IPC header.
 
void ipc_cmd (struct ipc_cmd_hdr *_hdr)
 Generic IPC command handler.
 
int ipc_process_on_core (uint32_t core, bool blocking)
 IPC message to be processed on other core.
 
void ipc_complete_cmd (struct ipc *ipc)
 Call platform-specific IPC completion function.
 
struct k_thread * ipc_thread_user (unsigned int core)
 get pointer to the userspace IPC thread for core
 

Variables

struct tr_ctx ipc_tr
 
struct task_ops ipc_task_ops
 
bool ipc_enter_gdb
 

Macro Definition Documentation

◆ IPC_DSP_CORE_COUNT

#define IPC_DSP_CORE_COUNT   1

◆ ipc_get_drvdata

#define ipc_get_drvdata (   ipc)     ((ipc)->private)

◆ ipc_get_ppl_sink_comp

#define ipc_get_ppl_sink_comp (   ipc,
  ppl_id 
)     ipc_get_ppl_comp(ipc, ppl_id, PPL_DIR_DOWNSTREAM)

◆ ipc_get_ppl_src_comp

#define ipc_get_ppl_src_comp (   ipc,
  ppl_id 
)     ipc_get_ppl_comp(ipc, ppl_id, PPL_DIR_UPSTREAM)

◆ IPC_IS_SIZE_INVALID

#define IPC_IS_SIZE_INVALID (   object)     ((object).hdr.size != sizeof(object))

◆ ipc_set_drvdata

#define ipc_set_drvdata (   ipc,
  data 
)     ((ipc)->private = data)

◆ IPC_SIZE_ERROR_TRACE

#define IPC_SIZE_ERROR_TRACE (   ctx,
  object 
)
Value:
tr_err(ctx, "ipc: size %d expected %zu", \
(object).hdr.size, sizeof(object))
#define tr_err(ctx, fmt,...)
Definition trace-soflogger.h:438

◆ IPC_TAIL_IS_SIZE_INVALID

#define IPC_TAIL_IS_SIZE_INVALID (   object)     ((object).comp.hdr.size + (object).comp.ext_data_length < sizeof(object))

◆ IPC_TASK_IN_THREAD

#define IPC_TASK_IN_THREAD   BIT(1)

◆ IPC_TASK_INLINE

#define IPC_TASK_INLINE   BIT(0)

◆ IPC_TASK_POWERDOWN

#define IPC_TASK_POWERDOWN   BIT(3)

◆ IPC_TASK_SECONDARY_CORE

#define IPC_TASK_SECONDARY_CORE   BIT(2)

Function Documentation

◆ ipc4_user_process_glb_message()

int ipc4_user_process_glb_message ( struct ipc4_message_request *  ipc4,
struct ipc_msg *  reply 
)

Processes IPC4 userspace global message.

Parameters
[in]ipc4IPC4 message request.
[in]replyIPC message reply structure.
Returns
IPC4_SUCCESS on success, error code otherwise.

◆ ipc4_user_process_module_message()

int ipc4_user_process_module_message ( struct ipc4_message_request *  ipc4,
struct ipc_msg *  reply 
)

Processes IPC4 userspace module message.

Parameters
[in]ipc4IPC4 message request.
[in]replyIPC message reply structure.
Returns
IPC4_SUCCESS on success, error code otherwise.

◆ ipc_boot_complete_msg()

void ipc_boot_complete_msg ( struct ipc_cmd_hdr *  header,
uint32_t  data 
)

create a IPC boot complete message.

Parameters
[in]headerheader.
[in]datadata.

◆ ipc_cmd()

void ipc_cmd ( struct ipc_cmd_hdr *  _hdr)

Generic IPC command handler.

Expects that IPC command (the header plus any optional payload) is deserialized from the IPC HW by the platform specific method.

Parameters
_hdrPoints to the IPC command header.

◆ ipc_compact_read_msg()

struct ipc_cmd_hdr * ipc_compact_read_msg ( void  )

Read a compact IPC message or return NULL for normal message.

Returns
Pointer to the compact message data.

◆ ipc_compact_write_msg()

int ipc_compact_write_msg ( struct ipc_cmd_hdr *  hdr)

Write a compact IPC message.

Parameters
[in]hdrCompact message header data.
Returns
Number of words written.

◆ ipc_complete_cmd()

void ipc_complete_cmd ( struct ipc *  ipc)

Call platform-specific IPC completion function.

◆ ipc_compound_msg_done()

void ipc_compound_msg_done ( uint32_t  msg_id,
int  error 
)

Complete the IPC compound message.

Parameters
[in]msg_idIPC message ID.
[in]errorError code of the IPC command.

◆ ipc_dai_data_config()

int ipc_dai_data_config ( struct dai_data *  dd,
struct comp_dev *  dev 
)

Configure DAI.

Returns
0 on success.

◆ ipc_dma_trace_send_position()

int ipc_dma_trace_send_position ( void  )

Send DMA trace host buffer position to host.

Returns
0 on success.

◆ ipc_free()

void ipc_free ( struct ipc *  ipc)

Free global IPC context.

Parameters
[in]ipcGlobal IPC context.

◆ ipc_get()

static struct ipc * ipc_get ( void  )
inlinestatic

Get the IPC global context.

Returns
The global IPC context.

◆ ipc_init()

int ipc_init ( struct sof *  sof)

Initialise global IPC context.

Parameters
[in,out]sofGlobal SOF context.
Returns
0 on success.

◆ ipc_prepare_to_send()

struct ipc_cmd_hdr * ipc_prepare_to_send ( const struct ipc_msg *  msg)

Prepare an IPC message for sending.

Parameters
[in]msgThe ipc msg.
Returns
pointer to raw header or NULL.

◆ ipc_process_host_buffer()

int ipc_process_host_buffer ( struct ipc *  ipc,
struct sof_ipc_host_buffer *  ring,
uint32_t  direction,
struct dma_sg_elem_array *  elem_array,
uint32_t *  ring_size 
)

Processes page tables for the host buffer.

Parameters
[in]ipcIpc
[in]ringRing description sent via Ipc
[in]directionDirection (playback/capture)
[out]elem_arrayArray of SG elements
[out]ring_sizeSize of the ring
Returns
Status, 0 if successful, error code otherwise.

◆ ipc_process_on_core()

int ipc_process_on_core ( uint32_t  core,
bool  blocking 
)

IPC message to be processed on other core.

Parameters
[in]coreCore id for IPC to be processed on.
[in]blockingProcess in blocking mode: wait for completion.
Returns
1 if successful (reply sent by other core), error code otherwise.

◆ ipc_send_buffer_status_notify()

void ipc_send_buffer_status_notify ( void  )

send a IPC buffer status notify message

◆ ipc_send_panic_notification()

void ipc_send_panic_notification ( void  )

Send a IPC notification that FW has hit a DSP notification.

◆ ipc_thread_user()

struct k_thread * ipc_thread_user ( unsigned int  core)

get pointer to the userspace IPC thread for core

◆ mailbox_validate()

struct ipc_cmd_hdr * mailbox_validate ( void  )

Validate mailbox contents for valid IPC header.

Returns
pointer to header if valid or NULL.

Variable Documentation

◆ ipc_enter_gdb

bool ipc_enter_gdb
extern

◆ ipc_task_ops

struct task_ops ipc_task_ops
extern

◆ ipc_tr

struct tr_ctx ipc_tr
extern