Audio: MFCC: Fix build of component for current SOF

It has not been possible to build the component earlier for Zephyr
IPC4 systems. This patch makes the next fixes:

- Add SOF_MODULE_INIT() and include of rtos/init.h
- For unit test fix the init function to
  sys_comp_module_mfcc_interface_init()
- To Zephyr/CMakeLists.txt add the needed math library sources
- Add .toml files for rimage for IPC4 systems

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2024-07-25 14:13:30 +03:00 committed by Liam Girdwood
parent 94e1bd2e6e
commit f7715b814b
6 changed files with 113 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include <ipc/topology.h>
#include <user/mfcc.h>
#include <user/trace.h>
#include <rtos/init.h>
#include <rtos/string.h>
#include <errno.h>
#include <stdbool.h>
@ -257,3 +258,4 @@ static const struct module_interface mfcc_interface = {
};
DECLARE_MODULE_ADAPTER(mfcc_interface, mfcc_uuid, mfcc_tr);
SOF_MODULE_INIT(mfcc, sys_comp_module_mfcc_interface_init);

21
src/audio/mfcc/mfcc.toml Normal file
View File

@ -0,0 +1,21 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif
REM # MFCC module config
[[module.entry]]
name = "MFCC"
uuid = "DB10A773-1AA4-4CEA-A21F-2D57A5C982EB"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
REM # pin = [dir, type, sample rate, size, container, channel-cfg]
pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, 1, 0, 0xfeef, 0xf, 0xf, 0x1ff]
REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]
index = __COUNTER__

View File

@ -50,9 +50,6 @@
#endif
#define MFCC_NORMALIZE_MAX_SHIFT 10
struct audio_stream;
struct comp_dev;
/** \brief Type definition for processing function select return value. */
typedef void (*mfcc_func)(struct processing_module *mod,
struct input_stream_buffer *bsource,
@ -189,7 +186,7 @@ void mfcc_s16_default(struct processing_module *mod, struct input_stream_buffer
#endif
#ifdef UNIT_TEST
void sys_comp_mfcc_init(void);
void sys_comp_module_mfcc_interface_init(void);
#endif
#endif /* __SOF_AUDIO_MFCC_MFCC_COMP_H__ */

View File

@ -60,7 +60,7 @@ name = "ADSPFW"
load_offset = "0x30000"
[module]
count = 24
count = 25
[[module.entry]]
name = "BRNGUP"
uuid = "61EB0CB9-34D8-4F59-A21D-04C54C21D3A4"
@ -546,3 +546,19 @@ count = 24
pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, 1, 0, 0xfeef, 0xf, 0xf, 0x1ff]
# mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]
# MFCC module config
[[module.entry]]
name = "MFCC"
uuid = "DB10A773-1AA4-4CEA-A21F-2D57A5C982EB"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = "0"
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
# pin = [dir, type, sample rate, size, container, channel-cfg]
pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, 1, 0, 0xfeef, 0xf, 0xf, 0x1ff]
# mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]

View File

@ -60,7 +60,7 @@ name = "ADSPFW"
load_offset = "0x30000"
[module]
count = 24
count = 25
[[module.entry]]
name = "BRNGUP"
uuid = "61EB0CB9-34D8-4F59-A21D-04C54C21D3A4"
@ -546,3 +546,19 @@ count = 24
pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, 1, 0, 0xfeef, 0xf, 0xf, 0x1ff]
# mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]
# MFCC module config
[[module.entry]]
name = "MFCC"
uuid = "DB10A773-1AA4-4CEA-A21F-2D57A5C982EB"
affinity_mask = "0x1"
instance_count = "40"
domain_types = "0"
load_type = "0"
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
# pin = [dir, type, sample rate, size, container, channel-cfg]
pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, 1, 0, 0xfeef, 0xf, 0xf, 0x1ff]
# mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0]

View File

@ -447,6 +447,52 @@ zephyr_library_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED
${SOF_MATH_PATH}/lut_trig.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_FFT
${SOF_MATH_PATH}/fft/fft_common.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_16BIT_FFT
${SOF_MATH_PATH}/fft/fft_16.c
${SOF_MATH_PATH}/fft/fft_16_hifi3.c
)
zephyr_library_sources_ifdef(ONFIG_MATH_32BIT_FFT
${SOF_MATH_PATH}/fft/fft_32.c
${SOF_MATH_PATH}/fft/fft_32_hifi3.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_DCT
${SOF_MATH_PATH}/dct.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_WINDOW
${SOF_MATH_PATH}/window.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_MATRIX
${SOF_MATH_PATH}/matrix.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_AUDITORY
${SOF_MATH_PATH}/auditory/auditory.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_16BIT_MEL_FILTERBANK
${SOF_MATH_PATH}/auditory/mel_filterbank_16.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_32BIT_MEL_FILTERBANK
${SOF_MATH_PATH}/auditory/mel_filterbank_32.c
)
zephyr_library_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED
${SOF_MATH_PATH}/log_e.c
)
zephyr_library_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED
${SOF_MATH_PATH}/base2log.c
)
# SOF module interface functions
add_subdirectory(../src/module module_unused_install/)
@ -869,6 +915,15 @@ zephyr_library_sources_ifdef(CONFIG_COMP_MUX
${SOF_AUDIO_PATH}/mux/mux_${ipc_suffix}.c
)
zephyr_library_sources_ifdef(CONFIG_COMP_MFCC
${SOF_AUDIO_PATH}/mfcc/mfcc.c
${SOF_AUDIO_PATH}/mfcc/mfcc_setup.c
${SOF_AUDIO_PATH}/mfcc/mfcc_common.c
${SOF_AUDIO_PATH}/mfcc/mfcc_generic.c
${SOF_AUDIO_PATH}/mfcc/mfcc_hifi3.c
${SOF_AUDIO_PATH}/mfcc/mfcc_hifi4.c
)
zephyr_library_sources_ifdef(CONFIG_COMP_GOOGLE_HOTWORD_DETECT
${SOF_AUDIO_PATH}/google/google_hotword_detect.c
)