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

Tools: Testbench: Add to IPC4 version UUID based components load, apply initial byte control, etc. #9542

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions src/audio/src/src_common.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2017 Intel Corporation. All rights reserved.
* Copyright(c) 2017-2024 Intel Corporation.
*
* Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
*/

#ifndef __SOF_AUDIO_SRC_SRC_H__
#define __SOF_AUDIO_SRC_SRC_H__
#ifndef __SOF_AUDIO_SRC_SRC_COMMON_H__
#define __SOF_AUDIO_SRC_SRC_COMMON_H__

#include <stddef.h>
#include <stdint.h>
Expand All @@ -15,6 +15,7 @@
#include <sof/audio/audio_stream.h>
#include <sof/audio/component.h>
#include <sof/audio/module_adapter/module/generic.h>
#include "src_ipc.h"

struct src_stage {
const int idm;
Expand Down Expand Up @@ -144,14 +145,6 @@ int32_t src_output_rates(void);

void src_set_alignment(struct sof_source *source, struct sof_sink *sink);

#if CONFIG_IPC_MAJOR_4
/* src component private data */
struct ipc4_config_src {
struct ipc4_base_module_cfg base;
uint32_t sink_rate;
};
#endif

struct comp_data {
#if CONFIG_IPC_MAJOR_4
struct ipc4_config_src ipc_config;
Expand All @@ -176,8 +169,6 @@ struct comp_data {
void (*polyphase_func)(struct src_stage_prm *s);
};

#endif /* __SOF_AUDIO_SRC_SRC_H__ */

#if CONFIG_IPC_MAJOR_4

int src_stream_pcm_source_rate_check(struct ipc4_config_src cfg,
Expand Down Expand Up @@ -265,3 +256,4 @@ extern struct tr_ctx src_tr;
#endif
extern const struct sof_uuid SRC_UUID;

#endif /* __SOF_AUDIO_SRC_SRC_COMMON_H__ */
19 changes: 19 additions & 0 deletions src/audio/src/src_ipc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2017-2024 Intel Corporation
*/

#ifndef __SOF_AUDIO_SRC_SRC_IPC_H__
#define __SOF_AUDIO_SRC_SRC_IPC_H__

#include <sof/audio/ipc-config.h>
#include <ipc4/base-config.h>
#include <stdint.h>

/* src component private data */
struct ipc4_config_src {
struct ipc4_base_module_cfg base;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have size at the start ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the struct for config blobs. I only moved this structure to be separate from large src_common.h that caused a build problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but this is an IPC header, so this should be for host/module configuration.

uint32_t sink_rate;
};

#endif /* __SOF_AUDIO_SRC_SRC_IPC_H__ */
4 changes: 2 additions & 2 deletions tools/testbench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sox --encoding signed-integer /usr/share/sounds/alsa/Front_Left.wav -L -r 48000
tools/testbench/build_testbench/install/bin/testbench -r 48000 -R 48000 -c 2 -n 2 -b S32_LE \
-t tools/build_tools/test/topology/test-playback-ssp5-mclk-0-I2S-dcblock-s32le-s32le-48k-24576k-codec.tplg \
-i in.raw -o out.raw
sox --encoding signed-integer -L -r 48000 -c 2 -b 32 in.raw out.wav
sox --encoding signed-integer -L -r 48000 -c 2 -b 32 out.raw out.wav
aplay out.wav
```

Expand Down Expand Up @@ -138,7 +138,7 @@ sox --encoding signed-integer /usr/share/sounds/alsa/Front_Center.wav -L -r 4800
tools/testbench/build_testbench/install/bin/testbench -r 48000 -R 48000 -c 2 -n 2 -b S32_LE -p 1,2 \
-t tools/build_tools/topology/topology2/development/sof-hda-benchmark-dcblock32.tplg \
-i in.raw -o out.raw
sox --encoding signed-integer -L -r 48000 -c 2 -b 32 in.raw out.wav
sox --encoding signed-integer -L -r 48000 -c 2 -b 32 out.raw out.wav
aplay out.wav
```

Expand Down
19 changes: 18 additions & 1 deletion tools/testbench/include/testbench/topology_ipc4.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@
#include "testbench/utils.h"

#define TB_IPC4_MAX_TPLG_OBJECT_SIZE 4096
#define TB_IPC4_MAX_MSG_SIZE 384

/* See module_set_large_config() where message fragment is
* MAILBOX_DSPBOX_SIZE. The add of header size (8) is because
* testbench and plugin have the set large config header in
* same memory as the payload.
*/
#define TB_IPC4_MAX_MSG_SIZE (MAILBOX_DSPBOX_SIZE + sizeof(struct ipc4_module_large_config))

#define TB_PGA_MODULE_ID 0x6
#define TB_SRC_MODULE_ID 0x7
#define TB_ASRC_MODULE_ID 0x8
#define TB_PROCESS_MODULE_ID 0x95
#define TB_FILE_OUT_AIF_MODULE_ID 0x9a
#define TB_FILE_IN_AIF_MODULE_ID 0x9b
#define TB_FILE_OUT_DAI_MODULE_ID 0x9c
#define TB_FILE_IN_DAI_MODULE_ID 0x9d

int tb_delete_pipeline(struct testbench_prm *tp, struct tplg_pipeline_info *pipe_info);
int tb_free_all_pipelines(struct testbench_prm *tp);
Expand All @@ -24,6 +39,8 @@ int tb_new_dai_in_out(struct testbench_prm *tp, int dir);
int tb_new_pga(struct testbench_prm *tp);
int tb_new_process(struct testbench_prm *tp);
int tb_pipelines_set_state(struct testbench_prm *tp, int state, int dir);
int tb_send_bytes_data(struct tb_mq_desc *ipc_tx, struct tb_mq_desc *ipc_rx,
uint32_t module_id, uint32_t instance_id, struct sof_abi_hdr *abi);
int tb_set_reset_state(struct testbench_prm *tp);
int tb_set_running_state(struct testbench_prm *tp);
int tb_set_up_pipeline(struct testbench_prm *tp, struct tplg_pipeline_info *pipe_info);
Expand Down
25 changes: 25 additions & 0 deletions tools/testbench/include/testbench/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ struct file_comp_lookup {
#define TB_NAME_SIZE 256
#define TB_MAX_CONFIG_COUNT 2
#define TB_MAX_CONFIG_NAME_SIZE 64
#define TB_MAX_VOLUME_SIZE 120
#define TB_MAX_DATA_SIZE 512
#define TB_MAX_CTLS 16

struct tb_mq_desc {
char queue_name[TB_NAME_SIZE];
Expand All @@ -52,6 +55,27 @@ struct tb_config {
int channels;
unsigned long format;
};

struct tb_ctl {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include the ABI header rather than duplicate ? I guess this comes from ALSA asoc.h ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, this struct is a direct copy from SOF plugin. If we change, we should change both to be able to merge the sources later to a common library like tplg_parser. What do you think @ranj063 ?

unsigned int module_id;
unsigned int instance_id;
unsigned int type;
unsigned int volume_table[TB_MAX_VOLUME_SIZE];
unsigned int index;
char data[TB_MAX_DATA_SIZE];
union {
struct snd_soc_tplg_mixer_control mixer_ctl;
struct snd_soc_tplg_enum_control enum_ctl;
struct snd_soc_tplg_bytes_control bytes_ctl;
};
};

struct tb_glb_state {
char magic[8]; /* SOF_MAGIC */
uint32_t num_ctls; /* number of ctls */
size_t size; /* size of this structure in bytes */
struct tb_ctl *ctl;
};
#endif

/*
Expand Down Expand Up @@ -114,6 +138,7 @@ struct testbench_prm {
struct tb_config config[TB_MAX_CONFIG_COUNT];
int num_configs;
size_t period_size;
struct tb_glb_state glb_ctx;
#endif
};

Expand Down
Loading
Loading