@@ -313,23 +313,31 @@ static void thread_info_get(int core, struct record_buf *bufd)
313
313
debug_stream_slot_send_record (& hdr -> hdr );
314
314
}
315
315
316
+ static void hack_notification_init (void );
317
+ static void hack_notification_send (uint32_t val );
318
+
316
319
static void thread_info_run (void * cnum , void * a , void * b )
317
320
{
318
321
int core = (int ) cnum ;
319
322
struct record_buf bufd = {
320
323
.size = THREAD_INFO_INITIAL_RECORD_BUFFER_SIZE ,
321
324
.w_ptr = 0 ,
322
325
};
326
+ uint32_t val = 0 ;
323
327
324
328
bufd .buf = rmalloc (SOF_MEM_ZONE_RUNTIME , 0 , SOF_MEM_CAPS_RAM , bufd .size );
325
329
if (!bufd .buf ) {
326
330
LOG_ERR ("malloc failed" );
327
331
return ;
328
332
}
329
333
334
+ hack_notification_init ();
335
+
330
336
for (;;) {
331
337
thread_info_get (core , & bufd );
332
338
k_sleep (K_SECONDS (CONFIG_SOF_DEBUG_STREAM_THREAD_INFO_INTERVAL ));
339
+ val = !val ;
340
+ hack_notification_send (val );
333
341
}
334
342
}
335
343
@@ -375,3 +383,76 @@ static int thread_info_start(void)
375
383
}
376
384
377
385
SYS_INIT (thread_info_start , APPLICATION , CONFIG_KERNEL_INIT_PRIORITY_DEFAULT );
386
+
387
+ /* HACK notification test */
388
+ #include <sof/ipc/msg.h>
389
+ #include <ipc4/notification.h>
390
+ #include <ipc4/module.h>
391
+ #include <ipc4/header.h>
392
+ #include <ipc4/base-config.h>
393
+
394
+ #define SOF_IPC4_MOD_INIT_BASEFW_MOD_ID 0
395
+ #define SOF_IPC4_MOD_INIT_BASEFW_INSTANCE_ID 0
396
+
397
+ static struct ipc_msg * notification_template ;
398
+
399
+ static void hack_notification_init (void )
400
+ {
401
+ struct ipc_msg msg_proto ;
402
+ union ipc4_notification_header * primary =
403
+ (union ipc4_notification_header * )& msg_proto .header ;
404
+ struct sof_ipc4_notify_module_data * msg_module_data ;
405
+ struct sof_ipc4_control_msg_payload * msg_payload ;
406
+ struct ipc_msg * msg ;
407
+
408
+ /* Clear header, extension, and other ipc_msg members */
409
+ memset_s (& msg_proto , sizeof (msg_proto ), 0 , sizeof (msg_proto ));
410
+ primary -> r .notif_type = SOF_IPC4_MODULE_NOTIFICATION ;
411
+ primary -> r .type = SOF_IPC4_GLB_NOTIFICATION ;
412
+ primary -> r .rsp = SOF_IPC4_MESSAGE_DIR_MSG_REQUEST ;
413
+ primary -> r .msg_tgt = SOF_IPC4_MESSAGE_TARGET_FW_GEN_MSG ;
414
+ msg = ipc_msg_w_ext_init (msg_proto .header , msg_proto .extension ,
415
+ sizeof (struct sof_ipc4_notify_module_data ) +
416
+ sizeof (struct sof_ipc4_control_msg_payload ) +
417
+ sizeof (struct sof_ipc4_ctrl_value_chan ));
418
+ if (!msg ) {
419
+ LOG_ERR ("ipc_msg_w_ext_init() failed!" );
420
+ return ;
421
+ }
422
+
423
+ msg_module_data = (struct sof_ipc4_notify_module_data * )msg -> tx_data ;
424
+ msg_module_data -> instance_id = IPC4_INST_ID (SOF_IPC4_MOD_INIT_BASEFW_INSTANCE_ID );
425
+ msg_module_data -> module_id = IPC4_MOD_ID (SOF_IPC4_MOD_INIT_BASEFW_MOD_ID );
426
+ msg_module_data -> event_id = SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_MAGIC_VAL |
427
+ SOF_IPC4_SWITCH_CONTROL_PARAM_ID ;
428
+ msg_module_data -> event_data_size = sizeof (struct sof_ipc4_control_msg_payload ) +
429
+ sizeof (struct sof_ipc4_ctrl_value_chan );
430
+
431
+ msg_payload = (struct sof_ipc4_control_msg_payload * )msg_module_data -> event_data ;
432
+ msg_payload -> id = SOF_IPC4_KCONTROL_GLOBAL_CAPTURE_HW_MUTE ;
433
+ msg_payload -> num_elems = 1 ;
434
+ msg_payload -> chanv [0 ].channel = 0 ;
435
+
436
+ LOG_INF ("msg initialized" );
437
+ notification_template = msg ;
438
+ }
439
+
440
+ static void hack_notification_send (uint32_t val )
441
+ {
442
+ struct ipc_msg * msg = notification_template ;
443
+ struct sof_ipc4_notify_module_data * msg_module_data ;
444
+ struct sof_ipc4_control_msg_payload * msg_payload ;
445
+
446
+ if (!msg ) {
447
+ LOG_ERR ("msg not initialized" );
448
+ return ;
449
+ }
450
+
451
+ msg_module_data = (struct sof_ipc4_notify_module_data * )msg -> tx_data ;
452
+ msg_payload = (struct sof_ipc4_control_msg_payload * )msg_module_data -> event_data ;
453
+ msg_payload -> chanv [0 ].value = val ;
454
+
455
+ LOG_INF ("SENDING msg %p %u" , msg -> tx_data , (msg -> tx_size ));
456
+
457
+ ipc_msg_send (msg , msg -> tx_data , false);
458
+ }
0 commit comments