Skip to content
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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not clear to me what you are suggesting to do. Should these IPC headers be somewhere else or use some more consistent directory locations and naming?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lgirdwood Ping, can you help me fix this. I don't think this PR has any other opens left.

Copy link
Member

Choose a reason for hiding this comment

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

ok, we can address this later as I see this structure is used as header for module data in other modules.

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
5 changes: 5 additions & 0 deletions tools/testbench/include/testbench/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#define FILE_BYTES_TO_S16_SAMPLES(s) ((s) >> 1)
#define FILE_BYTES_TO_S32_SAMPLES(s) ((s) >> 2)

/* bfc7488c-75aa-4ce8-9dbed8da08a698c2 */
static const struct sof_uuid tb_file_uuid = {
0xbfc7488c, 0x75aa, 0x4ce8, {0x9d, 0xbe, 0xd8, 0xda, 0x08, 0xa6, 0x98, 0xc2}
};

/* file component modes */
enum file_mode {
FILE_READ = 0,
Expand Down
24 changes: 23 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,27 @@
#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

enum tb_pin_type {
TB_PIN_TYPE_INPUT = 0,
TB_PIN_TYPE_OUTPUT,
};

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 +44,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 ?

Copy link
Member

Choose a reason for hiding this comment

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

ok, so we can do this in parallel with plugin when we ship it.

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
5 changes: 0 additions & 5 deletions tools/testbench/topology_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@

#define MAX_TPLG_OBJECT_SIZE 4096

/* bfc7488c-75aa-4ce8-9dbed8da08a698c2 */
static const struct sof_uuid tb_file_uuid = {
0xbfc7488c, 0x75aa, 0x4ce8, {0x9d, 0xbe, 0xd8, 0xda, 0x08, 0xa6, 0x98, 0xc2}
};

/* load asrc dapm widget */
static int tb_register_asrc(struct testbench_prm *tp, struct tplg_context *ctx)
{
Expand Down
Loading