Skip to content

Commit

Permalink
tdfb: enable building as an llext module
Browse files Browse the repository at this point in the history
Add support for LLEXT building to tdfb.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh committed Sep 9, 2024
1 parent de1de11 commit 4f652b6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/audio/tdfb/Kconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause

config COMP_TDFB
bool "TDFB component"
tristate "TDFB component"
depends on COMP_MODULE_ADAPTER
select MATH_FIR
select MATH_IIR_DF1
select SQRT_FIXED
select CORDIC_FIXED
select COMP_BLOB
default m if LIBRARY_DEFAULT_MODULAR
default y
help
Select for time domain fixed beamformer (TDFB) component. The
Expand Down
11 changes: 11 additions & 0 deletions src/audio/tdfb/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("tdfb"
SOURCES ../tdfb.c
../tdfb_direction.c
../tdfb_generic.c
../tdfb_hifiep.c
../tdfb_hifi3.c
../tdfb_ipc4.c
)
6 changes: 6 additions & 0 deletions src/audio/tdfb/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../tdfb.toml"

[module]
count = __COUNTER__
23 changes: 21 additions & 2 deletions src/audio/tdfb/tdfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static int tdfb_free(struct processing_module *mod)
{
struct tdfb_comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "tdfb_free()");
comp_dbg(mod->dev, "tdfb_free()");

ipc_msg_free(cd->msg);
tdfb_free_delaylines(cd);
Expand Down Expand Up @@ -797,7 +797,7 @@ static int tdfb_reset(struct processing_module *mod)
struct tdfb_comp_data *cd = module_get_private_data(mod);
int i;

comp_info(mod->dev, "tdfb_reset()");
comp_dbg(mod->dev, "tdfb_reset()");

tdfb_free_delaylines(cd);

Expand All @@ -824,3 +824,22 @@ static const struct module_interface tdfb_interface = {

DECLARE_MODULE_ADAPTER(tdfb_interface, tdfb_uuid, tdfb_tr);
SOF_MODULE_INIT(tdfb, sys_comp_module_tdfb_interface_init);

#if CONFIG_COMP_TDFB_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_TDFB 0x49, 0x17, 0x51, 0xdd, 0xfa, 0xd9, 0x5c, 0x45, 0xb3, 0xa7, \
0x13, 0x58, 0x56, 0x93, 0xf1, 0xaf

SOF_LLEXT_MOD_ENTRY(tdfb, &tdfb_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("TDFB", tdfb_llext_entry, 1, UUID_TDFB, 40);

SOF_LLEXT_BUILDINFO;

#endif
8 changes: 6 additions & 2 deletions src/audio/tdfb/tdfb.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # TDFB module config
[[module.entry]]
name = "TDFB"
uuid = "DD511749-D9FA-455C-B3A7-13585693F1AF"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = "0"
init_config = "1"
load_type = LOAD_TYPE
init_config = "1"
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
22 changes: 14 additions & 8 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -938,14 +938,20 @@ elseif(CONFIG_SAMPLE_SMART_AMP)
)
endif()

zephyr_library_sources_ifdef(CONFIG_COMP_TDFB
${SOF_AUDIO_PATH}/tdfb/tdfb.c
${SOF_AUDIO_PATH}/tdfb/tdfb_direction.c
${SOF_AUDIO_PATH}/tdfb/tdfb_generic.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifiep.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifi3.c
${SOF_AUDIO_PATH}/tdfb/tdfb_${ipc_suffix}.c
)
if(CONFIG_COMP_TDFB STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/tdfb/llext
${PROJECT_BINARY_DIR}/tdfb_llext)
add_dependencies(app tdfb)
elseif(CONFIG_COMP_TDFB)
zephyr_library_sources(
${SOF_AUDIO_PATH}/tdfb/tdfb.c
${SOF_AUDIO_PATH}/tdfb/tdfb_direction.c
${SOF_AUDIO_PATH}/tdfb/tdfb_generic.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifiep.c
${SOF_AUDIO_PATH}/tdfb/tdfb_hifi3.c
${SOF_AUDIO_PATH}/tdfb/tdfb_${ipc_suffix}.c
)
endif()

zephyr_library_sources_ifdef(CONFIG_SQRT_FIXED
${SOF_MATH_PATH}/sqrt_int16.c
Expand Down

0 comments on commit 4f652b6

Please sign in to comment.