Skip to content

Commit

Permalink
modules: lib_manager: Move declare_dynamic_module_adapter to lib_manager
Browse files Browse the repository at this point in the history
The declare_dynamic_module_adapter function has been moved from
module_adapter/module/modules.h to lib_manager and renamed to
lib_manager_prepare_module_adapter. It was and still is only used in
lib_manager.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
  • Loading branch information
softwarecki committed Mar 11, 2024
1 parent e41a069 commit 237f6a9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
1 change: 1 addition & 0 deletions src/audio/module_adapter/module/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <sof/audio/module_adapter/module/generic.h>
#include <sof/audio/module_adapter/module/modules.h>
#include <utilities/array.h>
#include <iadk_module_adapter.h>
#include <system_agent.h>
#include <native_system_agent.h>
#include <api_version.h>
Expand Down
34 changes: 0 additions & 34 deletions src/include/sof/audio/module_adapter/module/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define __SOF_AUDIO_MODULES__

#include <sof/audio/module_adapter/module/generic.h>
#include <iadk_module_adapter.h>

/* Intel module adapter is an extension to SOF module adapter component that allows to integrate
* modules developed under IADK (Intel Audio Development Kit)
Expand Down Expand Up @@ -43,37 +42,4 @@
/* Processing Module Adapter API */
extern const struct module_interface processing_module_adapter_interface;

static inline void declare_dynamic_module_adapter(struct comp_driver *drv,
enum sof_comp_type mtype,
const struct sof_uuid *uuid,
struct tr_ctx *tr)
{
drv->type = mtype;
drv->uid = uuid;
drv->tctx = tr;
drv->ops.create = module_adapter_new;
drv->ops.prepare = module_adapter_prepare;
drv->ops.params = module_adapter_params;
drv->ops.copy = module_adapter_copy;
#if CONFIG_IPC_MAJOR_3
drv->ops.cmd = module_adapter_cmd;
#endif
drv->ops.trigger = module_adapter_trigger;
drv->ops.reset = module_adapter_reset;
drv->ops.free = module_adapter_free;
drv->ops.set_large_config = module_set_large_config;
drv->ops.get_large_config = module_get_large_config;
drv->ops.get_attribute = module_adapter_get_attribute;
drv->ops.bind = module_adapter_bind;
drv->ops.unbind = module_adapter_unbind;
drv->ops.get_total_data_processed = module_adapter_get_total_data_processed;
drv->ops.dai_get_hw_params = module_adapter_get_hw_params;
drv->ops.position = module_adapter_position;
drv->ops.dai_ts_config = module_adapter_ts_config_op;
drv->ops.dai_ts_start = module_adapter_ts_start_op;
drv->ops.dai_ts_stop = module_adapter_ts_stop_op;
drv->ops.dai_ts_get = module_adapter_ts_get_op;
drv->adapter_ops = &processing_module_adapter_interface;
}

#endif /* __SOF_AUDIO_MODULES__ */
32 changes: 31 additions & 1 deletion src/library_manager/lib_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,36 @@ static void lib_manager_update_sof_ctx(void *base_addr, uint32_t lib_id)
}

#if CONFIG_INTEL_MODULES
static void lib_manager_prepare_module_adapter(struct comp_driver *drv, const struct sof_uuid *uuid)
{
drv->type = SOF_COMP_MODULE_ADAPTER;
drv->uid = uuid;
drv->tctx = &lib_manager_tr;
drv->ops.create = module_adapter_new;
drv->ops.prepare = module_adapter_prepare;
drv->ops.params = module_adapter_params;
drv->ops.copy = module_adapter_copy;
#if CONFIG_IPC_MAJOR_3
drv->ops.cmd = module_adapter_cmd;
#endif
drv->ops.trigger = module_adapter_trigger;
drv->ops.reset = module_adapter_reset;
drv->ops.free = module_adapter_free;
drv->ops.set_large_config = module_set_large_config;
drv->ops.get_large_config = module_get_large_config;
drv->ops.get_attribute = module_adapter_get_attribute;
drv->ops.bind = module_adapter_bind;
drv->ops.unbind = module_adapter_unbind;
drv->ops.get_total_data_processed = module_adapter_get_total_data_processed;
drv->ops.dai_get_hw_params = module_adapter_get_hw_params;
drv->ops.position = module_adapter_position;
drv->ops.dai_ts_config = module_adapter_ts_config_op;
drv->ops.dai_ts_start = module_adapter_ts_start_op;
drv->ops.dai_ts_stop = module_adapter_ts_stop_op;
drv->ops.dai_ts_get = module_adapter_ts_get_op;
drv->adapter_ops = &processing_module_adapter_interface;
}

int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
{
uint32_t entry_index = LIB_MANAGER_GET_MODULE_INDEX(module_id);
Expand Down Expand Up @@ -522,7 +552,7 @@ int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
mod = (struct sof_man_module *)((uint8_t *)desc + SOF_MAN_MODULE_OFFSET(entry_index));
struct sof_uuid *uid = (struct sof_uuid *)&mod->uuid[0];

declare_dynamic_module_adapter(drv, SOF_COMP_MODULE_ADAPTER, uid, &lib_manager_tr);
lib_manager_prepare_module_adapter(drv, uid);

new_drv_info->drv = drv;

Expand Down

0 comments on commit 237f6a9

Please sign in to comment.