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

Test: Cmocka: Set component type to SOF_COMP_MODULE_ADAPTER #9529

Merged
merged 2 commits into from
Oct 1, 2024
Merged
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
9 changes: 5 additions & 4 deletions src/audio/mux/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool mux_mix_check(struct sof_mux_config *cfg)
return false;
}

static int mux_demux_common_init(struct processing_module *mod)
static int mux_demux_common_init(struct processing_module *mod, enum sof_comp_type type)
{
struct module_data *module_data = &mod->priv;
struct comp_dev *dev = mod->dev;
Expand Down Expand Up @@ -116,6 +116,7 @@ static int mux_demux_common_init(struct processing_module *mod)

mod->verify_params_flags = BUFF_PARAMS_CHANNELS;
mod->no_pause = true;
cd->comp_type = type;
return 0;

err_init:
Expand All @@ -130,14 +131,14 @@ static int mux_init(struct processing_module *mod)
{
mod->max_sources = MUX_MAX_STREAMS;

return mux_demux_common_init(mod);
return mux_demux_common_init(mod, SOF_COMP_MUX);
}

static int demux_init(struct processing_module *mod)
{
mod->max_sinks = MUX_MAX_STREAMS;

return mux_demux_common_init(mod);
return mux_demux_common_init(mod, SOF_COMP_DEMUX);
}

static int mux_free(struct processing_module *mod)
Expand Down Expand Up @@ -386,7 +387,7 @@ static int mux_prepare(struct processing_module *mod,
if (ret < 0)
return ret;

if (dev->ipc_config.type == SOF_COMP_MUX)
if (cd->comp_type == SOF_COMP_MUX)
cd->mux = mux_get_processing_function(mod);
else
cd->demux = demux_get_processing_function(mod);
Expand Down
1 change: 1 addition & 0 deletions src/audio/mux/mux.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ struct comp_data {
struct mux_look_up lookup[MUX_MAX_STREAMS];
struct mux_look_up active_lookup;
struct comp_data_blob_handler *model_handler;
enum sof_comp_type comp_type;
struct sof_mux_config config; /* Keep last due to flexible array member in end */
};

Expand Down
6 changes: 3 additions & 3 deletions src/audio/mux/mux_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int mux_set_values(struct processing_module *mod)
}
}

if (dev->ipc_config.type == SOF_COMP_MUX) {
if (cd->comp_type == SOF_COMP_MUX) {
if (mux_mix_check(cfg))
comp_err(dev, "mux_set_values(): mux component is not able to mix channels");
}
Expand All @@ -81,13 +81,13 @@ static int mux_set_values(struct processing_module *mod)

cd->config.num_streams = cfg->num_streams;

if (dev->ipc_config.type == SOF_COMP_MUX)
if (cd->comp_type == SOF_COMP_MUX)
mux_prepare_look_up_table(mod);
else
demux_prepare_look_up_table(mod);

if (dev->state > COMP_STATE_INIT) {
if (dev->ipc_config.type == SOF_COMP_MUX)
if (cd->comp_type == SOF_COMP_MUX)
cd->mux = mux_get_processing_function(mod);
else
cd->demux = demux_get_processing_function(mod);
Expand Down
1 change: 0 additions & 1 deletion src/audio/mux/mux_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static int build_config(struct processing_module *mod)
int mask = 1;
int i;

dev->ipc_config.type = SOF_COMP_MUX;
cd->config.num_streams = MUX_MAX_STREAMS;

/* clear masks */
Expand Down
2 changes: 1 addition & 1 deletion test/cmocka/src/audio/eq_fir/eq_fir_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static struct sof_ipc_comp_process *create_eq_fir_comp_ipc(struct test_data *td)
memcpy_s(ipc + 1, SOF_UUID_SIZE, &uuid, SOF_UUID_SIZE);
eq = (struct sof_eq_fir_config *)((char *)(ipc + 1) + SOF_UUID_SIZE);
ipc->comp.hdr.size = ipc_size + SOF_UUID_SIZE;
ipc->comp.type = SOF_COMP_EQ_FIR;
ipc->comp.type = SOF_COMP_MODULE_ADAPTER;
ipc->config.hdr.size = sizeof(struct sof_ipc_comp_config);
ipc->size = blob->size;
ipc->comp.ext_data_length = SOF_UUID_SIZE;
Expand Down
2 changes: 1 addition & 1 deletion test/cmocka/src/audio/eq_iir/eq_iir_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static struct sof_ipc_comp_process *create_eq_iir_comp_ipc(struct test_data *td)
memcpy_s(ipc + 1, SOF_UUID_SIZE, &uuid, SOF_UUID_SIZE);
eq = (struct sof_eq_iir_config *)((char *)(ipc + 1) + SOF_UUID_SIZE);
ipc->comp.hdr.size = ipc_size + SOF_UUID_SIZE;
ipc->comp.type = SOF_COMP_EQ_IIR;
ipc->comp.type = SOF_COMP_MODULE_ADAPTER;
ipc->config.hdr.size = sizeof(struct sof_ipc_comp_config);
ipc->size = blob->size;
ipc->comp.ext_data_length = SOF_UUID_SIZE;
Expand Down
2 changes: 1 addition & 1 deletion test/cmocka/src/audio/mux/demux_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static struct sof_ipc_comp_process *create_demux_comp_ipc(struct test_data *td)
memcpy_s(ipc + 1, SOF_UUID_SIZE, &uuid, SOF_UUID_SIZE);
mux = (struct sof_mux_config *)((char *)(ipc + 1) + SOF_UUID_SIZE);
ipc->comp.hdr.size = ipc_size + SOF_UUID_SIZE;
ipc->comp.type = SOF_COMP_DEMUX;
ipc->comp.type = SOF_COMP_MODULE_ADAPTER;
ipc->config.hdr.size = sizeof(struct sof_ipc_comp_config);
ipc->size = mux_size;
ipc->comp.ext_data_length = SOF_UUID_SIZE;
Expand Down
2 changes: 1 addition & 1 deletion test/cmocka/src/audio/mux/mux_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static struct sof_ipc_comp_process *create_mux_comp_ipc(struct test_data *td)
memcpy_s(ipc + 1, SOF_UUID_SIZE, &uuid, SOF_UUID_SIZE);
mux = (struct sof_mux_config *)((char *)(ipc + 1) + SOF_UUID_SIZE);
ipc->comp.hdr.size = ipc_size + SOF_UUID_SIZE;
ipc->comp.type = SOF_COMP_MUX;
ipc->comp.type = SOF_COMP_MODULE_ADAPTER;
ipc->config.hdr.size = sizeof(struct sof_ipc_comp_config);
ipc->size = mux_size;
ipc->comp.ext_data_length = SOF_UUID_SIZE;
Expand Down
2 changes: 1 addition & 1 deletion test/cmocka/src/audio/mux/mux_get_processing_function.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static struct sof_ipc_comp_process *create_mux_comp_ipc(struct test_data *td)
memcpy_s(ipc + 1, SOF_UUID_SIZE, &uuid, SOF_UUID_SIZE);
mux = (struct sof_mux_config *)((char *)(ipc + 1) + SOF_UUID_SIZE);
ipc->comp.hdr.size = ipc_size + SOF_UUID_SIZE;
ipc->comp.type = SOF_COMP_MUX;
ipc->comp.type = SOF_COMP_MODULE_ADAPTER;
ipc->config.hdr.size = sizeof(struct sof_ipc_comp_config);
ipc->size = mux_size;
ipc->comp.ext_data_length = SOF_UUID_SIZE;
Expand Down
Loading