Skip to content

Commit 20edbb3

Browse files
lrgirdwoclaude
andcommitted
audio: detect_test: include WOV module ID and slot ID in IPC4 notification
- Populate word_id with WOV detector slot_id (0=Male, 1=Female, 2=Child). - Populate extension payload with WOV component module_id and instance_id. - Log module_id, instance_id, and slot_id in notify_host(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 388502f commit 20edbb3

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

src/samples/audio/detect_test.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
/* default number of samples before detection is activated */
6464
#define KEYPHRASE_DEFAULT_PREAMBLE_LENGTH 0
6565

66+
#define NOTIFICATION_DEFAULT_WORD_ID 1
67+
#define NOTIFICATION_DEFAULT_SCORE 0
68+
6669
#define KWD_NN_BUFF_ALIGN 64
6770

6871
static const struct comp_driver comp_keyword;
@@ -164,10 +167,29 @@ static void notify_host(const struct comp_dev *dev)
164167
{
165168
struct comp_data *cd = comp_get_drvdata(dev);
166169

167-
comp_info(dev, "entry");
170+
comp_err(dev, "notify_host: WOV module_id=0x%x instance_id=0x%x slot_id=%u detected",
171+
dev_comp_id(dev) >> 16, dev_comp_id(dev) & 0xffff, cd->wov_slot_id);
168172

169173
#if CONFIG_IPC_MAJOR_4
170-
ipc_msg_send(cd->msg, NULL, true);
174+
struct ipc4_voice_cmd_notification notif;
175+
memset_s(&notif, sizeof(notif), 0, sizeof(notif));
176+
177+
notif.primary.r.word_id = (cd->wov_slot_id != WOV_SLOT_INVALID) ? cd->wov_slot_id : NOTIFICATION_DEFAULT_WORD_ID;
178+
notif.primary.r.notif_type = SOF_IPC4_NOTIFY_PHRASE_DETECTED;
179+
notif.primary.r.type = SOF_IPC4_GLB_NOTIFICATION;
180+
notif.primary.r.rsp = SOF_IPC4_MESSAGE_DIR_MSG_REQUEST;
181+
notif.primary.r.msg_tgt = SOF_IPC4_MESSAGE_TARGET_FW_GEN_MSG;
182+
183+
/* Store WOV component module ID & instance ID in extension payload */
184+
notif.extension.r.sv_score = (uint16_t)(dev_comp_id(dev) & 0xffff);
185+
notif.extension.r.rsvd1 = (uint32_t)(dev_comp_id(dev) >> 16);
186+
187+
if (cd->msg)
188+
ipc_msg_free(cd->msg);
189+
cd->msg = ipc_msg_w_ext_init(notif.primary.dat, notif.extension.dat, 0);
190+
191+
if (cd->msg)
192+
ipc_msg_send(cd->msg, NULL, true);
171193
#else
172194
ipc_msg_send(cd->msg, &cd->event, true);
173195
#endif /* CONFIG_IPC_MAJOR_4 */

0 commit comments

Comments
 (0)