Skip to content

Commit bab3fa4

Browse files
committed
Tools: Testbench: Convert file component to module adapter
This is done as preparation for testbench IPC4 support. The update to IPC4 is simpler for a module adapter component. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent ff9343a commit bab3fa4

9 files changed

Lines changed: 263 additions & 388 deletions

File tree

src/include/ipc/topology.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,16 @@ struct sof_ipc_comp_process {
240240

241241
/* IPC file component used by testbench only */
242242
struct sof_ipc_comp_file {
243+
/* These need to be the same as in above sof_ipc_comp_process */
243244
struct sof_ipc_comp comp;
244245
struct sof_ipc_comp_config config;
246+
uint32_t size; /**< size of bespoke data section in bytes */
247+
uint32_t type; /**< sof_ipc_process_type */
248+
249+
/* reserved for future use */
250+
uint32_t reserved[7];
251+
252+
/* These are additional parameters for file */
245253
uint32_t rate;
246254
uint32_t channels;
247255
char *fn;

src/include/sof/audio/ipc-config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ struct ipc_config_process {
142142

143143
/* file IO ipc comp */
144144
struct ipc_comp_file {
145+
struct ipc_config_process module_header; /* Needed for module_adapter_init_data() */
145146
uint32_t rate;
146147
uint32_t channels;
147148
char *fn;

src/ipc/ipc3/helper.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,9 @@ static int comp_specific_builder(struct sof_ipc_comp *comp,
196196
{
197197
#if CONFIG_LIBRARY
198198
struct sof_ipc_comp_file *file = (struct sof_ipc_comp_file *)comp;
199-
#else
199+
#endif
200200
struct sof_ipc_comp_host *host = (struct sof_ipc_comp_host *)comp;
201201
struct sof_ipc_comp_dai *dai = (struct sof_ipc_comp_dai *)comp;
202-
#endif
203202
struct sof_ipc_comp_volume *vol = (struct sof_ipc_comp_volume *)comp;
204203
struct sof_ipc_comp_process *proc = (struct sof_ipc_comp_process *)comp;
205204
struct sof_ipc_comp_src *src = (struct sof_ipc_comp_src *)comp;
@@ -211,18 +210,22 @@ static int comp_specific_builder(struct sof_ipc_comp *comp,
211210
switch (comp->type) {
212211
#if CONFIG_LIBRARY
213212
/* test bench maps host and DAIs to a file */
214-
case SOF_COMP_HOST:
215-
case SOF_COMP_SG_HOST:
216-
case SOF_COMP_DAI:
217-
case SOF_COMP_SG_DAI:
213+
case SOF_COMP_FILEREAD:
214+
case SOF_COMP_FILEWRITE:
218215
config->file.channels = file->channels;
219216
config->file.fn = file->fn;
220217
config->file.frame_fmt = file->frame_fmt;
221218
config->file.mode = file->mode;
222219
config->file.rate = file->rate;
223220
config->file.direction = file->direction;
221+
222+
/* For module_adapter_init_data() ipc_module_adapter compatibility */
223+
config->file.module_header.type = proc->type;
224+
config->file.module_header.size = proc->size;
225+
config->file.module_header.data = (uint8_t *)proc->data -
226+
sizeof(struct ipc_config_process);
224227
break;
225-
#else
228+
#endif
226229
case SOF_COMP_HOST:
227230
case SOF_COMP_SG_HOST:
228231
config->host.direction = host->direction;
@@ -235,7 +238,6 @@ static int comp_specific_builder(struct sof_ipc_comp *comp,
235238
config->dai.direction = dai->direction;
236239
config->dai.type = dai->type;
237240
break;
238-
#endif
239241
case SOF_COMP_VOLUME:
240242
config->volume.channels = vol->channels;
241243
config->volume.initial_ramp = vol->initial_ramp;

tools/testbench/common_test.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
// SPDX-License-Identifier: BSD-3-Clause
22
//
3-
// Copyright(c) 2018 Intel Corporation. All rights reserved.
3+
// Copyright(c) 2018-2024 Intel Corporation. All rights reserved.
44

5-
#include <stdint.h>
6-
#include <stddef.h>
7-
#include <time.h>
8-
#include <stdio.h>
9-
#include <stdlib.h>
10-
#include <rtos/string.h>
11-
#include <math.h>
12-
#include <rtos/sof.h>
13-
#include <rtos/task.h>
14-
#include <rtos/alloc.h>
15-
#include <sof/lib/notifier.h>
5+
#include <sof/audio/component_ext.h>
6+
#include <sof/audio/pipeline.h>
167
#include <sof/ipc/driver.h>
178
#include <sof/ipc/topology.h>
189
#include <sof/lib/agent.h>
1910
#include <sof/lib/dai.h>
2011
#include <sof/lib/dma.h>
12+
#include <sof/lib/notifier.h>
2113
#include <sof/schedule/edf_schedule.h>
2214
#include <sof/schedule/ll_schedule.h>
2315
#include <sof/schedule/ll_schedule_domain.h>
2416
#include <sof/schedule/schedule.h>
17+
#include <rtos/alloc.h>
18+
#include <rtos/sof.h>
19+
#include <rtos/string.h>
20+
#include <rtos/task.h>
2521
#include <rtos/wait.h>
26-
#include <sof/audio/pipeline.h>
27-
#include <sof/audio/component_ext.h>
22+
#include <tplg_parser/topology.h>
23+
#include <math.h>
24+
#include <stddef.h>
25+
#include <stdint.h>
26+
#include <stdio.h>
27+
#include <stdlib.h>
28+
#include <time.h>
29+
2830
#include "testbench/common_test.h"
2931
#include "testbench/trace.h"
30-
#include <tplg_parser/topology.h>
32+
#include "testbench/file.h"
3133

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

4446
/* init components */
4547
sys_comp_init(sof);
46-
sys_comp_file_init();
4748
sys_comp_selector_init();
4849

4950
/* Module adapter components */
@@ -53,6 +54,7 @@ int tb_setup(struct sof *sof, struct testbench_prm *tp)
5354
sys_comp_module_drc_interface_init();
5455
sys_comp_module_eq_fir_interface_init();
5556
sys_comp_module_eq_iir_interface_init();
57+
sys_comp_module_file_interface_init();
5658
sys_comp_module_google_rtc_audio_processing_interface_init();
5759
sys_comp_module_igo_nr_interface_init();
5860
sys_comp_module_multiband_drc_interface_init();

0 commit comments

Comments
 (0)