From 9cb99858728d7713433affb389c2f03c241ef9c7 Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 8 Nov 2023 12:18:21 +0100 Subject: [PATCH 1/3] module: Extend module error code definitions Ported additional error code definitions from iadk module API. These codes are not unique and their meaning depends on the context / which function returns it. Signed-off-by: Adrian Warecki --- src/include/module/iadk/adsp_error_code.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/include/module/iadk/adsp_error_code.h b/src/include/module/iadk/adsp_error_code.h index e7b820e0e416..ef90b20f8c66 100644 --- a/src/include/module/iadk/adsp_error_code.h +++ b/src/include/module/iadk/adsp_error_code.h @@ -36,4 +36,27 @@ typedef uint32_t AdspErrorCode; /* Service is not supported on target platform. */ #define ADSP_SERVICE_UNAVAILABLE 143 +#define ADSP_MAX_VALUE ADSP_FATAL_FAILURE + +/* SystemAgentInterface */ +#define ADSP_MODULE_CREATION_FAILURE (ADSP_MAX_VALUE + 1) + +/* ProcessingModuleFactoryInterface */ + +/* Reports that the given value of Input Buffer Size is invalid */ +#define ADSP_INVALID_IBS (ADSP_MAX_VALUE + 1) +/* Reports that the given value of Output Buffer Size is invalid */ +#define ADSP_INVALID_OBS (ADSP_MAX_VALUE + 2) +/* Reports that the given value of Cycles Per Chunk processing is invalid */ +#define ADSP_INVALID_CPC (ADSP_MAX_VALUE + 3) +/* Reports that the settings provided for module creation are invalid */ +#define ADSP_INVALID_SETTINGS (ADSP_MAX_VALUE + 4) + +/* ProcessingModuleInterface */ +/* Reports that the message content given for configuration is invalid */ +#define ADSP_INVALID_CONFIGURATION (ADSP_MAX_VALUE + 1) + +/* Reports that the module does not support retrieval of its current configuration information */ +#define ADSP_NO_CONFIGURATION (ADSP_MAX_VALUE + 2) + #endif /* __MODULE_IADK_ADSP_ERROR_CODE_H__ */ From 5b9248fed086c67f0a4cf6eaa6567d0131bea857 Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 8 Nov 2023 12:38:19 +0100 Subject: [PATCH 2/3] lmdk: dwmix: Add example of loadable down mixer module The example of down mixer module ported from iadk. Its build as a native loadable sof module. Signed-off-by: Adrian Warecki --- lmdk/libraries/dwmix/CMakeLists.txt | 13 + lmdk/libraries/dwmix/dwmix_mtl.toml | 78 ++++ lmdk/modules/down_mixer/CMakeLists.txt | 6 + lmdk/modules/down_mixer/downmixer.c | 520 +++++++++++++++++++++ lmdk/modules/down_mixer/downmixer.h | 50 ++ lmdk/modules/down_mixer/downmixer_config.h | 26 ++ 6 files changed, 693 insertions(+) create mode 100644 lmdk/libraries/dwmix/CMakeLists.txt create mode 100644 lmdk/libraries/dwmix/dwmix_mtl.toml create mode 100644 lmdk/modules/down_mixer/CMakeLists.txt create mode 100644 lmdk/modules/down_mixer/downmixer.c create mode 100644 lmdk/modules/down_mixer/downmixer.h create mode 100644 lmdk/modules/down_mixer/downmixer_config.h diff --git a/lmdk/libraries/dwmix/CMakeLists.txt b/lmdk/libraries/dwmix/CMakeLists.txt new file mode 100644 index 000000000000..4f1718c7432c --- /dev/null +++ b/lmdk/libraries/dwmix/CMakeLists.txt @@ -0,0 +1,13 @@ + +cmake_minimum_required(VERSION 3.20) +set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../../cmake/xtensa-toolchain.cmake") + +project(dwmix) + +# list of modules to be built and included into this loadable library +set(MODULES_LIST down_mixer) + +# toml file for rimage to generate manifets +set(TOML "${CMAKE_CURRENT_LIST_DIR}/dwmix_mtl.toml") + +include(../../cmake/build.cmake) diff --git a/lmdk/libraries/dwmix/dwmix_mtl.toml b/lmdk/libraries/dwmix/dwmix_mtl.toml new file mode 100644 index 000000000000..e79c1260a139 --- /dev/null +++ b/lmdk/libraries/dwmix/dwmix_mtl.toml @@ -0,0 +1,78 @@ +version = [3, 0] + +[adsp] +name = "mtl" +image_size = "0x2C0000" # (22) bank * 128KB +alias_mask = "0xE0000000" + +[[adsp.mem_zone]] +type = "ROM" +base = "0x1FF80000" +size = "0x400" +[[adsp.mem_zone]] +type = "IMR" +base = "0xA104A000" +size = "0x2000" +[[adsp.mem_zone]] +type = "SRAM" +base = "0xa00f0000" +size = "0x100000" + +[[adsp.mem_alias]] +type = "uncached" +base = "0x40000000" +[[adsp.mem_alias]] +type = "cached" +base = "0xA0000000" + +[cse] +partition_name = "ADSP" +[[cse.entry]] +name = "ADSP.man" +offset = "0x5c" +length = "0x464" +[[cse.entry]] +name = "ADSP.met" +offset = "0x4c0" +length = "0x70" +[[cse.entry]] +name = "ADSP" +offset = "0x540" +length = "0x0" # calculated by rimage + +[css] + +[signed_pkg] +name = "ADSP" +[[signed_pkg.module]] +name = "ADSP.met" + +[adsp_file] +[[adsp_file.comp]] +base_offset = "0x2000" + +[fw_desc.header] +name = "ADSPFW" +load_offset = "0x40000" + +[module] +count = 1 + + [[module.entry]] + name = "DWMIX" + uuid = "1234F1F1-1234-1A34-8C08-884BE5D14FAA" + affinity_mask = "0x1" + instance_count = "15" + 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, 0xffff, 0xc, 0xC, 0xffff, + 0, 0, 0xffff, 0xc, 0xC, 0xffff, + 1, 0, 0xffff, 0xc, 0xC, 0xffff] + + # 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, 512, 256, 0, 0, 0] diff --git a/lmdk/modules/down_mixer/CMakeLists.txt b/lmdk/modules/down_mixer/CMakeLists.txt new file mode 100644 index 000000000000..d51f04cd13e4 --- /dev/null +++ b/lmdk/modules/down_mixer/CMakeLists.txt @@ -0,0 +1,6 @@ + +target_sources(down_mixer PRIVATE downmixer.c) + +set_target_properties(down_mixer PROPERTIES + HPSRAM_ADDR "0xa0691000" +) diff --git a/lmdk/modules/down_mixer/downmixer.c b/lmdk/modules/down_mixer/downmixer.c new file mode 100644 index 000000000000..2775e1d581f3 --- /dev/null +++ b/lmdk/modules/down_mixer/downmixer.c @@ -0,0 +1,520 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright(c) 2023 Intel Corporation. All rights reserved. + * Author: Adrian Warecki + */ + +#include +#include +#include + +#include +#include +#include +#include +#include