Skip to content

Commit 20d8a67

Browse files
author
Jyri Sarha
committed
src/audio/selector/selector_generic.c: HACK notitfy test, no payload
1 parent e385f10 commit 20d8a67

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/audio/selector/selector_generic.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,38 @@
1919
#include <stddef.h>
2020
#include <stdint.h>
2121

22+
/* HACK: test ipc_msg_send syscall from LL */
23+
#include <sof/ipc/msg.h>
24+
#include <sof/ipc/ipc_msg_send.h>
25+
#include <ipc4/notification.h>
26+
2227
LOG_MODULE_DECLARE(selector, CONFIG_SOF_LOG_LEVEL);
2328

2429
#define BYTES_TO_S16_SAMPLES 1
2530
#define BYTES_TO_S32_SAMPLES 2
2631

32+
/* HACK: send PHRASE_DETECTED notification every 1000 LL frames (~1 s) */
33+
static void sel_hack_notify(struct processing_module *mod, struct comp_data *cd)
34+
{
35+
if (!cd->hack_msg) {
36+
union ipc4_notification_header nhdr;
37+
38+
nhdr.r.notif_type = SOF_IPC4_NOTIFY_PHRASE_DETECTED;
39+
nhdr.r.type = SOF_IPC4_GLB_NOTIFICATION;
40+
nhdr.r.rsp = SOF_IPC4_MESSAGE_DIR_MSG_REQUEST;
41+
nhdr.r.msg_tgt = SOF_IPC4_MESSAGE_TARGET_FW_GEN_MSG;
42+
43+
cd->hack_msg = mod_ipc_msg_w_ext_init(mod, nhdr.dat, 0, 0);
44+
if (!cd->hack_msg)
45+
return;
46+
}
47+
48+
if (++cd->hack_frame_count >= 1000) {
49+
cd->hack_frame_count = 0;
50+
ipc_msg_send(cd->hack_msg, NULL, true);
51+
}
52+
}
53+
2754
#if CONFIG_IPC_MAJOR_3
2855
#if CONFIG_FORMAT_S16LE
2956
/**
@@ -238,6 +265,7 @@ static void sel_s16le(struct processing_module *mod, struct input_stream_buffer
238265
}
239266

240267
module_update_buffer_position(bsource, bsink, frames);
268+
sel_hack_notify(mod, cd);
241269
}
242270
#endif /* CONFIG_FORMAT_S16LE */
243271

@@ -311,6 +339,7 @@ static void sel_s24le(struct processing_module *mod, struct input_stream_buffer
311339
}
312340

313341
module_update_buffer_position(bsource, bsink, frames);
342+
sel_hack_notify(mod, cd);
314343
}
315344
#endif /* CONFIG_FORMAT_S24LE */
316345

@@ -382,6 +411,7 @@ static void sel_s32le(struct processing_module *mod, struct input_stream_buffer
382411
}
383412

384413
module_update_buffer_position(bsource, bsink, frames);
414+
sel_hack_notify(mod, cd);
385415
}
386416
#endif /* CONFIG_FORMAT_S32LE */
387417
#endif

src/include/sof/audio/selector.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ struct comp_data {
130130
int num_configs; /**< Number of coefficients sets in configuration blob. */
131131
bool passthrough; /**< Use a passthrough copy function when no up/down mix. */
132132
bool new_config; /**< True if new configuration has been received */
133+
134+
/* HACK: test ipc_msg_send syscall from LL context */
135+
struct ipc_msg *hack_msg;
136+
uint32_t hack_frame_count;
133137
};
134138

135139
/** \brief Selector processing functions map. */

0 commit comments

Comments
 (0)