Skip to content

Commit be878db

Browse files
committed
lmdk: add dummy loadable smart amp support
It will be built will __MODULE_BUILD__ enabled Signed-off-by: Rander Wang <rander.wang@intel.com>
1 parent 9b5abe6 commit be878db

File tree

7 files changed

+208
-63
lines changed

7 files changed

+208
-63
lines changed

lmdk/cmake/ldscripts/data_linker_script.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SECTIONS {
1515
_data_end = ABSOLUTE(.);
1616
} >HPSRAM_seg : data_phdr
1717

18-
.rodata : {
18+
.rodata : ALIGN(4096) {
1919
_rodata_start = ABSOLUTE(.);
2020
*(.gnu.linkonce.r.*)
2121
*(.rodata)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../../cmake/xtensa-toolchain.cmake")
3+
4+
project(smart_amp_test)
5+
6+
macro(is_zephyr ret)
7+
if(CONFIG_ZEPHYR_SOF_MODULE)
8+
set(${ret} TRUE)
9+
else()
10+
set(${ret} FALSE)
11+
endif()
12+
endmacro()
13+
14+
# list of modules to be built and included into this loadable library
15+
set(MODULES_LIST smart_amp_test)
16+
17+
# toml file for rimage to generate manifets
18+
set(TOML "${CMAKE_CURRENT_LIST_DIR}/smart_amp_test.toml")
19+
20+
# TODO: Move it somewhere???
21+
add_definitions(-DMAJOR_IADSP_API_VERSION=5)
22+
add_definitions(-DMIDDLE_IADSP_API_VERSION=0)
23+
add_definitions(-DMINOR_IADSP_API_VERSION=0)
24+
25+
include(../../cmake/build.cmake)
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+
[[signed_pkg.module]]
48+
name = "ADSP.met"
49+
50+
[adsp_file]
51+
[[adsp_file.comp]]
52+
base_offset = "0x2000"
53+
54+
[fw_desc.header]
55+
name = "ADSPFW"
56+
load_offset = "0x40000"
57+
58+
[module]
59+
count = 1
60+
61+
[[module.entry]]
62+
name = "SMATEST"
63+
uuid = "167A961E-8AE4-11EA-89F1-000C29CE1635"
64+
affinity_mask = "0x1"
65+
instance_count = "1"
66+
domain_types = "0"
67+
load_type = "0"
68+
init_config = "1"
69+
module_type = "0xD"
70+
auto_start = "0"
71+
sched_caps = [1, 0x00008000]
72+
73+
# pin = [dir, type, sample rate, size, container, channel-cfg]
74+
pin = [0, 0, 0xfeef, 0xf, 0xa, 0x45ff,
75+
0, 0, 0xfeef, 0xf, 0xa, 0x45ff,
76+
1, 0, 0xfeef, 0xf, 0xa, 0x45ff]
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, 128, 128, 0, 0, 0]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
target_sources(smart_amp_test PRIVATE ${SOF_BASE}/src/samples/audio/smart_amp_test_ipc4.c)
2+
3+
set_target_properties(smart_amp_test PROPERTIES
4+
HPSRAM_ADDR "0xa06c1000"
5+
)
6+
7+
target_compile_definitions(smart_amp_test PRIVATE
8+
__MODULE_BUILD__=1
9+
CONFIG_XTENSA=1
10+
CONFIG_IPC_MAJOR_4=1
11+
)
12+
13+
target_include_directories(smart_amp_test PRIVATE "${SOF_BASE}/src/include")

src/include/ipc4/base-config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323

2424
#ifndef __SOF_IPC4_BASE_CONFIG_H__
2525
#define __SOF_IPC4_BASE_CONFIG_H__
26-
26+
#ifndef __MODULE_BUILD__
2727
#include <sof/compiler_attributes.h>
28+
#endif
2829
#include <module/ipc4/base-config.h>
2930

3031
struct sof_ipc_stream_params;

src/include/sof/samples/audio/smart_amp_test.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
#ifndef __SOF_AUDIO_SMART_AMP_H__
99
#define __SOF_AUDIO_SMART_AMP_H__
1010

11+
#ifndef __MODULE_BUILD__
1112
#include <sof/audio/component.h>
1213
#include <sof/audio/data_blob.h>
14+
#endif
1315

1416
#if CONFIG_IPC_MAJOR_4
1517
#include <ipc4/base-config.h>
@@ -19,10 +21,20 @@
1921

2022
#define SMART_AMP_MAX_STREAM_CHAN 8
2123

24+
/* Max channels for all intel platforms are 8 */
25+
#define MAX_CHANNELS 8
26+
2227
/** IPC blob types */
2328
#define SOF_SMART_AMP_CONFIG 0
2429
#define SOF_SMART_AMP_MODEL 1
2530

31+
#ifdef __MODULE_BUILD__
32+
#define LOG_ERR(...)
33+
#define LOG_WRN(...)
34+
#define LOG_DBG(...)
35+
#define LOG_INF(...)
36+
#endif
37+
2638
struct smart_amp_model_data {
2739
uint32_t data_size;
2840
void *data;
@@ -83,8 +95,8 @@ struct smart_amp_model_data {
8395
struct sof_smart_amp_config {
8496
uint32_t size;
8597
uint32_t feedback_channels;
86-
int8_t source_ch_map[PLATFORM_MAX_CHANNELS];
87-
int8_t feedback_ch_map[PLATFORM_MAX_CHANNELS];
98+
int8_t source_ch_map[MAX_CHANNELS];
99+
int8_t feedback_ch_map[MAX_CHANNELS];
88100
};
89101

90102
#if CONFIG_IPC_MAJOR_4

0 commit comments

Comments
 (0)