Skip to content

Commit 0ad501d

Browse files
committed
ipc4: notification: Add support for data process error notification
Provide a structure and function to initiate notification of an error reported by the module's data processing function. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 13485fe commit 0ad501d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/include/ipc4/notification.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include <stdint.h>
2727
#include <ipc/header.h>
28+
#include <sof/ipc/msg.h>
2829
#include <sof/compiler_attributes.h>
2930

3031
/* ipc4 notification msg */
@@ -229,6 +230,19 @@ static inline void ipc4_notification_watchdog_init(struct ipc4_watchdog_timeout_
229230
notif->primary.r.msg_tgt = SOF_IPC4_MESSAGE_TARGET_FW_GEN_MSG;
230231
}
231232

233+
/**
234+
* \brief This notification is sent by a shim of module instance on error raised by data processing
235+
* function.
236+
*
237+
* In case of 3rd party IP error_code is set to its native error code returned by the 3rd party
238+
* library.
239+
*/
240+
struct ipc4_process_data_error_event_data
241+
{
242+
/* Error code returned by data processing function */
243+
uint32_t error_code;
244+
};
245+
232246
/**
233247
* \brief Input data payload is reserved field in parent technical spec which can be easily
234248
* extendable if needed by specific resource event types in the future. For backward compatibility
@@ -237,6 +251,8 @@ static inline void ipc4_notification_watchdog_init(struct ipc4_watchdog_timeout_
237251
union ipc4_resource_event_data {
238252
/* Raw data */
239253
uint32_t dws[6];
254+
/* Process Data Error Data (res type = MODULE_INSTANCE) */
255+
struct ipc4_process_data_error_event_data process_data_error;
240256
};
241257

242258
struct ipc4_resource_event_data_notification {
@@ -254,4 +270,9 @@ struct ipc4_resource_event_data_notification {
254270
union ipc4_resource_event_data event_data;
255271
} __packed __aligned(8);
256272

273+
#define IPC4_RESOURCE_EVENT_SIZE sizeof(struct ipc4_resource_event_data_notification)
274+
275+
void process_data_error_notif_msg_init(struct ipc_msg *msg, uint32_t resource_id,
276+
uint32_t error_code);
277+
257278
#endif /* __IPC4_NOTIFICATION_H__ */

src/ipc/ipc4/notification.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,15 @@ void xrun_notif_msg_init(struct ipc_msg *msg_xrun, uint32_t resource_id, uint32_
3333
notif_data->resource_type = SOF_IPC4_GATEWAY;
3434
}
3535
#endif
36+
37+
void process_data_error_notif_msg_init(struct ipc_msg *msg, uint32_t resource_id,
38+
uint32_t error_code)
39+
{
40+
struct ipc4_resource_event_data_notification *notif_data = msg->tx_data;
41+
resource_notif_header_init(msg);
42+
43+
notif_data->resource_id = resource_id;
44+
notif_data->event_type = SOF_IPC4_PROCESS_DATA_ERROR;
45+
notif_data->resource_type = SOF_IPC4_MODULE_INSTANCE;
46+
notif_data->event_data.process_data_error.error_code = error_code;
47+
}

0 commit comments

Comments
 (0)