Skip to content

Commit e9b0a88

Browse files
softwareckilgirdwood
authored andcommitted
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 3a2868b commit e9b0a88

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/include/ipc4/notification.h

Lines changed: 20 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,18 @@ 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+
/* Error code returned by data processing function */
242+
uint32_t error_code;
243+
};
244+
232245
/**
233246
* \brief Input data payload is reserved field in parent technical spec which can be easily
234247
* extendable if needed by specific resource event types in the future. For backward compatibility
@@ -237,6 +250,8 @@ static inline void ipc4_notification_watchdog_init(struct ipc4_watchdog_timeout_
237250
union ipc4_resource_event_data {
238251
/* Raw data */
239252
uint32_t dws[6];
253+
/* Process Data Error Data (res type = MODULE_INSTANCE) */
254+
struct ipc4_process_data_error_event_data process_data_error;
240255
};
241256

242257
struct ipc4_resource_event_data_notification {
@@ -254,4 +269,9 @@ struct ipc4_resource_event_data_notification {
254269
union ipc4_resource_event_data event_data;
255270
} __packed __aligned(8);
256271

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

src/ipc/ipc4/notification.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <stdbool.h>
1212
#include <ipc4/notification.h>
1313

14-
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
1514
static void resource_notif_header_init(struct ipc_msg *msg)
1615
{
1716
struct ipc4_resource_event_data_notification *notif_data = msg->tx_data;
@@ -25,6 +24,7 @@ static void resource_notif_header_init(struct ipc_msg *msg)
2524
memset(&notif_data->event_data, 0, sizeof(notif_data->event_data));
2625
}
2726

27+
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
2828
void xrun_notif_msg_init(struct ipc_msg *msg_xrun, uint32_t resource_id, uint32_t event_type)
2929
{
3030
struct ipc4_resource_event_data_notification *notif_data = msg_xrun->tx_data;
@@ -35,3 +35,15 @@ void xrun_notif_msg_init(struct ipc_msg *msg_xrun, uint32_t resource_id, uint32_
3535
notif_data->resource_type = SOF_IPC4_GATEWAY;
3636
}
3737
#endif
38+
39+
void process_data_error_notif_msg_init(struct ipc_msg *msg, uint32_t resource_id,
40+
uint32_t error_code)
41+
{
42+
struct ipc4_resource_event_data_notification *notif_data = msg->tx_data;
43+
44+
resource_notif_header_init(msg);
45+
notif_data->resource_id = resource_id;
46+
notif_data->event_type = SOF_IPC4_PROCESS_DATA_ERROR;
47+
notif_data->resource_type = SOF_IPC4_MODULE_INSTANCE;
48+
notif_data->event_data.process_data_error.error_code = error_code;
49+
}

0 commit comments

Comments
 (0)