|
19 | 19 | #include <stddef.h> |
20 | 20 | #include <stdint.h> |
21 | 21 |
|
| 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 | + |
22 | 27 | LOG_MODULE_DECLARE(selector, CONFIG_SOF_LOG_LEVEL); |
23 | 28 |
|
24 | 29 | #define BYTES_TO_S16_SAMPLES 1 |
25 | 30 | #define BYTES_TO_S32_SAMPLES 2 |
26 | 31 |
|
| 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 | + |
27 | 54 | #if CONFIG_IPC_MAJOR_3 |
28 | 55 | #if CONFIG_FORMAT_S16LE |
29 | 56 | /** |
@@ -238,6 +265,7 @@ static void sel_s16le(struct processing_module *mod, struct input_stream_buffer |
238 | 265 | } |
239 | 266 |
|
240 | 267 | module_update_buffer_position(bsource, bsink, frames); |
| 268 | + sel_hack_notify(mod, cd); |
241 | 269 | } |
242 | 270 | #endif /* CONFIG_FORMAT_S16LE */ |
243 | 271 |
|
@@ -311,6 +339,7 @@ static void sel_s24le(struct processing_module *mod, struct input_stream_buffer |
311 | 339 | } |
312 | 340 |
|
313 | 341 | module_update_buffer_position(bsource, bsink, frames); |
| 342 | + sel_hack_notify(mod, cd); |
314 | 343 | } |
315 | 344 | #endif /* CONFIG_FORMAT_S24LE */ |
316 | 345 |
|
@@ -382,6 +411,7 @@ static void sel_s32le(struct processing_module *mod, struct input_stream_buffer |
382 | 411 | } |
383 | 412 |
|
384 | 413 | module_update_buffer_position(bsource, bsink, frames); |
| 414 | + sel_hack_notify(mod, cd); |
385 | 415 | } |
386 | 416 | #endif /* CONFIG_FORMAT_S32LE */ |
387 | 417 | #endif |
|
0 commit comments