Skip to content

Commit bb8eec6

Browse files
committed
ipc4: notification: Separate resource_notif_header_init function
Separate common resource event notification initialization code to a new resource_notif_header_init function. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 00b4039 commit bb8eec6

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/ipc/ipc4/notification.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,31 @@
66
*/
77

88
#include <sof/common.h>
9+
#include <sof/ipc/msg.h>
910
#include <stdbool.h>
1011
#include <ipc4/notification.h>
1112

12-
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
13-
void xrun_notif_msg_init(struct ipc_msg *msg_xrun, uint32_t resource_id, uint32_t event_type)
13+
static void resource_notif_header_init(struct ipc_msg *msg)
1414
{
15-
struct ipc4_resource_event_data_notification *notif_data = msg_xrun->tx_data;
15+
struct ipc4_resource_event_data_notification *notif_data = msg->tx_data;
1616
union ipc4_notification_header header;
1717

1818
header.r.notif_type = SOF_IPC4_NOTIFY_RESOURCE_EVENT;
1919
header.r.type = SOF_IPC4_GLB_NOTIFICATION;
2020
header.r.rsp = SOF_IPC4_MESSAGE_DIR_MSG_REQUEST;
2121
header.r.msg_tgt = SOF_IPC4_MESSAGE_TARGET_FW_GEN_MSG;
22-
msg_xrun->header = header.dat;
22+
msg->header = header.dat;
23+
memset(&notif_data->event_data, 0, sizeof(notif_data->event_data));
24+
}
25+
26+
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
27+
void xrun_notif_msg_init(struct ipc_msg *msg_xrun, uint32_t resource_id, uint32_t event_type)
28+
{
29+
struct ipc4_resource_event_data_notification *notif_data = msg_xrun->tx_data;
30+
resource_notif_header_init(msg_xrun);
2331

2432
notif_data->resource_id = resource_id;
2533
notif_data->event_type = event_type;
2634
notif_data->resource_type = SOF_IPC4_GATEWAY;
27-
memset(&notif_data->event_data, 0, sizeof(notif_data->event_data));
2835
}
2936
#endif

0 commit comments

Comments
 (0)