Skip to content

Commit 69925ce

Browse files
softwareckipjdobrowolski
authored andcommitted
Example of loadable up_down_mixer
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 8663ea4 commit 69925ce

File tree

4 files changed

+138
-10
lines changed

4 files changed

+138
-10
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
version = [3, 0]
2+
3+
[adsp]
4+
name = "mtl"
5+
image_size = "0x2C0000" # (22) bank * 128KB
6+
alias_mask = "0xE0000000"
7+
8+
[[adsp.mem_zone]]
9+
type = "ROM"
10+
base = "0x1FF80000"
11+
size = "0x400"
12+
[[adsp.mem_zone]]
13+
type = "IMR"
14+
base = "0xA104A000"
15+
size = "0x2000"
16+
[[adsp.mem_zone]]
17+
type = "SRAM"
18+
base = "0xa00f0000"
19+
size = "0x100000"
20+
21+
[[adsp.mem_alias]]
22+
type = "uncached"
23+
base = "0x40000000"
24+
[[adsp.mem_alias]]
25+
type = "cached"
26+
base = "0xA0000000"
27+
28+
[cse]
29+
partition_name = "ADSP"
30+
[[cse.entry]]
31+
name = "ADSP.man"
32+
offset = "0x5c"
33+
length = "0x464"
34+
[[cse.entry]]
35+
name = "ADSP.met"
36+
offset = "0x4c0"
37+
length = "0x70"
38+
[[cse.entry]]
39+
name = "ADSP"
40+
offset = "0x540"
41+
length = "0x0" # calculated by rimage
42+
43+
[css]
44+
45+
[signed_pkg]
46+
name = "ADSP"
47+
partition_usage = "0x23"
48+
[[signed_pkg.module]]
49+
name = "ADSP.met"
50+
51+
[adsp_file]
52+
[[adsp_file.comp]]
53+
base_offset = "0x2000"
54+
55+
[fw_desc.header]
56+
name = "ADSPFW"
57+
load_offset = "0x40000"
58+
59+
[module]
60+
count = 1
61+
62+
[[module.entry]]
63+
name = "DWMIX"
64+
uuid = "1234F1F1-1234-1A34-8C08-884BE5D14FAA"
65+
affinity_mask = "0x1"
66+
instance_count = "15"
67+
domain_types = "0"
68+
load_type = "0"
69+
module_type = "9"
70+
auto_start = "0"
71+
sched_caps = [1, 0x00008000]
72+
73+
# pin = [dir, type, sample rate, size, container, channel-cfg]
74+
pin = [0, 0, 0xffff, 0xc, 0xC, 0xffff,
75+
0, 0, 0xffff, 0xc, 0xC, 0xffff,
76+
1, 0, 0xffff, 0xc, 0xC, 0xffff]
77+
78+
# mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
79+
mod_cfg = [0, 0, 0, 0, 4096, 1000000, 512, 256, 0, 0, 0]

src/audio/up_down_mixer/up_down_mixer.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
//
55
// Author: Bartosz Kokoszko <bartoszx.kokoszko@intel.com>
66
// Author: Adrian Bonislawski <adrian.bonislawski@intel.com>
7+
// Author: Adrian Warecki <adrian.warecki@intel.com>
78

89
#include <sof/audio/coefficients/up_down_mixer/up_down_mixer.h>
10+
#include <sof/audio/up_down_mixer/up_down_mixer_manifest.h>
911
#include <sof/audio/up_down_mixer/up_down_mixer.h>
1012
#include <sof/audio/buffer.h>
1113
#include <sof/audio/format.h>
@@ -36,7 +38,7 @@ DECLARE_SOF_RT_UUID("up_down_mixer", up_down_mixer_comp_uuid, 0x42f8060c, 0x832f
3638
0x4dbf, 0xb2, 0x47, 0x51, 0xe9, 0x61, 0x99, 0x7b, 0x34);
3739

3840
DECLARE_TR_CTX(up_down_mixer_comp_tr, SOF_UUID(up_down_mixer_comp_uuid),
39-
LOG_LEVEL_INFO);
41+
LOG_LEVEL_INFO);
4042

4143
int32_t custom_coeffs[UP_DOWN_MIX_COEFFS_LENGTH];
4244

@@ -455,13 +457,10 @@ static int up_down_mixer_process(struct processing_module *mod,
455457
return 0;
456458
}
457459

458-
static struct module_interface up_down_mixer_interface = {
460+
struct module_interface up_down_mixer_interface = {
459461
.init = up_down_mixer_init,
460462
.prepare = up_down_mixer_prepare,
461463
.process_audio_stream = up_down_mixer_process,
462464
.reset = up_down_mixer_reset,
463465
.free = up_down_mixer_free
464466
};
465-
466-
DECLARE_MODULE_ADAPTER(up_down_mixer_interface, up_down_mixer_comp_uuid, up_down_mixer_comp_tr);
467-
SOF_MODULE_INIT(up_down_mixer, sys_comp_module_up_down_mixer_interface_init);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause */
2+
/*
3+
* Copyright(c) 2023 Intel Corporation. All rights reserved.
4+
*
5+
* Author: Pawel Dobrowolski <pawelx.dobrowolski@intel.com>
6+
*/
7+
8+
#ifndef __UP_DOWN_MIXER_MANIFEST_H__
9+
#define __UP_DOWN_MIXER_MANIFEST_H__
10+
11+
#include <rimage/sof/user/manifest.h>
12+
#include <sof/audio/module_adapter/library/module_api_ver.h>
13+
14+
#define ADSP_BUILD_INFO_FORMAT 0
15+
16+
struct module_interface up_down_mixer_interface;
17+
18+
void *loadable_udm_entry_point(void *mod_cfg, void *parent_ppl, void **mod_ptr) {
19+
return &up_down_mixer_interface;
20+
}
21+
22+
struct sof_module_api_build_info udm_build_info __attribute__((section(".buildinfo"))) = {
23+
ADSP_BUILD_INFO_FORMAT,
24+
{
25+
((0x3FF & SOF_MODULE_API_MAJOR_VERSION) << 20) |
26+
((0x3FF & SOF_MODULE_API_MIDDLE_VERSION) << 10) |
27+
((0x3FF & SOF_MODULE_API_MINOR_VERSION) << 0)
28+
}
29+
};
30+
31+
extern struct module_interface up_down_mixer_interface;
32+
33+
__attribute__((section(".module")))
34+
const struct sof_man_module_manifest udm_manifest = {
35+
.module = {
36+
.name = "UPDWMIX",
37+
.uuid = {0x0C, 0x06, 0xF8, 0x42, 0x2F, 0x83, 0xBF, 0x4D,
38+
0xB2, 0x47, 0x51, 0xE9, 0x61, 0x99, 0x7B, 0x34},
39+
.entry_point = (uint32_t)loadable_udm_entry_point,
40+
.type = { .load_type = SOF_MAN_MOD_TYPE_MODULE,
41+
.domain_ll = 1 },
42+
.affinity_mask = 1,
43+
}
44+
};
45+
46+
#endif /* __UP_DOWN_MIXER_MANIFEST_H__ */

zephyr/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,6 @@ zephyr_library_sources_ifdef(CONFIG_MATH_EXP
694694
${SOF_MATH_PATH}/exp_fcn_hifi.c
695695
)
696696

697-
zephyr_library_sources_ifdef(CONFIG_COMP_UP_DOWN_MIXER
698-
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer.c
699-
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer_hifi3.c
700-
)
701-
702697
zephyr_library_sources_ifdef(CONFIG_COMP_MUX
703698
${SOF_AUDIO_PATH}/mux/mux.c
704699
${SOF_AUDIO_PATH}/mux/mux_generic.c
@@ -783,6 +778,15 @@ include(../scripts/cmake/version.cmake)
783778
# Create Trace realtive file paths
784779
sof_append_relative_path_definitions(modules_sof)
785780

781+
782+
# Compile up_down_mixer as loadable module
783+
sof_loadable_library(updwmix ${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer.toml)
784+
785+
zephyr_library_sources_ifdef(CONFIG_COMP_UP_DOWN_MIXER
786+
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer.c
787+
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer_hifi3.c
788+
)
789+
786790
sof_loadable_library_finalize()
787791

788792
endif() # CONFIG_SOF

0 commit comments

Comments
 (0)