Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Do no review] Tools: Testbech: Add IPC4 support #9025

Closed
wants to merge 10 commits into from
8 changes: 8 additions & 0 deletions src/include/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,16 @@ struct sof_ipc_comp_process {

/* IPC file component used by testbench only */
struct sof_ipc_comp_file {
/* These need to be the same as in above sof_ipc_comp_process */
struct sof_ipc_comp comp;
struct sof_ipc_comp_config config;
uint32_t size; /**< size of bespoke data section in bytes */
uint32_t type; /**< sof_ipc_process_type */

/* reserved for future use */
uint32_t reserved[7];

/* These are additional parameters for file */
uint32_t rate;
uint32_t channels;
char *fn;
Expand Down
1 change: 1 addition & 0 deletions src/include/sof/audio/ipc-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ struct ipc_config_process {

/* file IO ipc comp */
struct ipc_comp_file {
struct ipc_config_process module_header; /* Needed for module_adapter_init_data() */
uint32_t rate;
uint32_t channels;
char *fn;
Expand Down
20 changes: 10 additions & 10 deletions src/ipc/ipc3/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ static int comp_specific_builder(struct sof_ipc_comp *comp,
{
#if CONFIG_LIBRARY
struct sof_ipc_comp_file *file = (struct sof_ipc_comp_file *)comp;
#else
#endif
struct sof_ipc_comp_host *host = (struct sof_ipc_comp_host *)comp;
struct sof_ipc_comp_dai *dai = (struct sof_ipc_comp_dai *)comp;
#endif
struct sof_ipc_comp_volume *vol = (struct sof_ipc_comp_volume *)comp;
struct sof_ipc_comp_process *proc = (struct sof_ipc_comp_process *)comp;
struct sof_ipc_comp_src *src = (struct sof_ipc_comp_src *)comp;
Expand All @@ -211,20 +210,22 @@ static int comp_specific_builder(struct sof_ipc_comp *comp,
switch (comp->type) {
#if CONFIG_LIBRARY
/* test bench maps host and DAIs to a file */
case SOF_COMP_HOST:
case SOF_COMP_SG_HOST:
case SOF_COMP_DAI:
case SOF_COMP_SG_DAI:
if (IPC_TAIL_IS_SIZE_INVALID(*file))
return -EBADMSG;
case SOF_COMP_FILEREAD:
case SOF_COMP_FILEWRITE:
config->file.channels = file->channels;
config->file.fn = file->fn;
config->file.frame_fmt = file->frame_fmt;
config->file.mode = file->mode;
config->file.rate = file->rate;
config->file.direction = file->direction;

/* For module_adapter_init_data() ipc_module_adapter compatibility */
config->file.module_header.type = proc->type;
config->file.module_header.size = proc->size;
config->file.module_header.data = (uint8_t *)proc->data -
sizeof(struct ipc_config_process);
break;
#else
#endif
case SOF_COMP_HOST:
case SOF_COMP_SG_HOST:
if (IPC_TAIL_IS_SIZE_INVALID(*host))
Expand All @@ -241,7 +242,6 @@ static int comp_specific_builder(struct sof_ipc_comp *comp,
config->dai.direction = dai->direction;
config->dai.type = dai->type;
break;
#endif
case SOF_COMP_VOLUME:
if (IPC_TAIL_IS_SIZE_INVALID(*vol))
return -EBADMSG;
Expand Down
34 changes: 18 additions & 16 deletions tools/testbench/common_test.c
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2018 Intel Corporation. All rights reserved.
// Copyright(c) 2018-2024 Intel Corporation. All rights reserved.

#include <stdint.h>
#include <stddef.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <rtos/string.h>
#include <math.h>
#include <rtos/sof.h>
#include <rtos/task.h>
#include <rtos/alloc.h>
#include <sof/lib/notifier.h>
#include <sof/audio/component_ext.h>
#include <sof/audio/pipeline.h>
#include <sof/ipc/driver.h>
#include <sof/ipc/topology.h>
#include <sof/lib/agent.h>
#include <sof/lib/dai.h>
#include <sof/lib/dma.h>
#include <sof/lib/notifier.h>
#include <sof/schedule/edf_schedule.h>
#include <sof/schedule/ll_schedule.h>
#include <sof/schedule/ll_schedule_domain.h>
#include <sof/schedule/schedule.h>
#include <rtos/alloc.h>
#include <rtos/sof.h>
#include <rtos/string.h>
#include <rtos/task.h>
#include <rtos/wait.h>
#include <sof/audio/pipeline.h>
#include <sof/audio/component_ext.h>
#include <tplg_parser/topology.h>
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include "testbench/common_test.h"
#include "testbench/trace.h"
#include <tplg_parser/topology.h>
#include "testbench/file.h"

#if defined __XCC__
#include <xtensa/tie/xt_timer.h>
Expand All @@ -43,7 +45,6 @@ int tb_setup(struct sof *sof, struct testbench_prm *tp)

/* init components */
sys_comp_init(sof);
sys_comp_file_init();
sys_comp_selector_init();

/* Module adapter components */
Expand All @@ -53,6 +54,7 @@ int tb_setup(struct sof *sof, struct testbench_prm *tp)
sys_comp_module_drc_interface_init();
sys_comp_module_eq_fir_interface_init();
sys_comp_module_eq_iir_interface_init();
sys_comp_module_file_interface_init();
sys_comp_module_google_rtc_audio_processing_interface_init();
sys_comp_module_igo_nr_interface_init();
sys_comp_module_mfcc_interface_init();
Expand Down
Loading