forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.c
More file actions
49 lines (42 loc) · 1.59 KB
/
notification.c
File metadata and controls
49 lines (42 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-License-Identifier: BSD-3-Clause
/*
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*
* Author: Piotr Makaruk <[email protected]>
* Adrian Warecki <[email protected]>
*/
#include <sof/common.h>
#include <sof/ipc/msg.h>
#include <stdbool.h>
#include <ipc4/notification.h>
static void resource_notif_header_init(struct ipc_msg *msg)
{
struct ipc4_resource_event_data_notification *notif_data = msg->tx_data;
union ipc4_notification_header header;
header.r.notif_type = SOF_IPC4_NOTIFY_RESOURCE_EVENT;
header.r.type = SOF_IPC4_GLB_NOTIFICATION;
header.r.rsp = SOF_IPC4_MESSAGE_DIR_MSG_REQUEST;
header.r.msg_tgt = SOF_IPC4_MESSAGE_TARGET_FW_GEN_MSG;
msg->header = header.dat;
memset(¬if_data->event_data, 0, sizeof(notif_data->event_data));
}
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
void xrun_notif_msg_init(struct ipc_msg *msg_xrun, uint32_t resource_id, uint32_t event_type)
{
struct ipc4_resource_event_data_notification *notif_data = msg_xrun->tx_data;
resource_notif_header_init(msg_xrun);
notif_data->resource_id = resource_id;
notif_data->event_type = event_type;
notif_data->resource_type = SOF_IPC4_GATEWAY;
}
#endif
void process_data_error_notif_msg_init(struct ipc_msg *msg, uint32_t resource_id,
uint32_t error_code)
{
struct ipc4_resource_event_data_notification *notif_data = msg->tx_data;
resource_notif_header_init(msg);
notif_data->resource_id = resource_id;
notif_data->event_type = SOF_IPC4_PROCESS_DATA_ERROR;
notif_data->resource_type = SOF_IPC4_MODULE_INSTANCE;
notif_data->event_data.process_data_error.error_code = error_code;
}