Skip to content

Commit 1fca027

Browse files
committed
rimage: add ipc4 extended module config introduction
This is a introduction of ipc4 extended module config and how to add these information in config file xxx.toml for ipc4. Signed-off-by: Rander Wang <[email protected]>
1 parent 0960d7c commit 1fca027

File tree

2 files changed

+248
-1
lines changed

2 files changed

+248
-1
lines changed

developer_guides/rimage/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For more details see:
1919
:maxdepth: 1
2020

2121
extended_manifest
22-
22+
ipc4_extended_module_config
2323

2424

2525
Build flow
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
.. _ipc4_extended_module_config:
2+
3+
Ipc4_extended_module_config
4+
###########################
5+
6+
The ipc4 extended module config is a place to store build-time known module metadata
7+
such as the module name, uuid or capabilities. This config is part of the output
8+
binary is located in extended manifest structure in the binary file and it is used
9+
by driver when setting up ipc message to dsp.
10+
11+
Rimage builds extended module config based on module setting in config/xxx.toml.
12+
The following setting is for gain module.
13+
14+
.. code-block:: bash
15+
16+
[[module.entry]]
17+
name = "GAIN"
18+
uuid = "61BCA9A8-18D0-4A18-8E7B-2639219804B7"
19+
affinity_mask = "0x1"
20+
instance_count = "40"
21+
domain_types = "0"
22+
load_type = "0"
23+
module_type = "5"
24+
auto_start = "0"
25+
sched_caps = [1, 0x00008000]
26+
27+
# pin = [dir, type, sample rate, size, container, channel-cfg]
28+
pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff,
29+
1, 0, 0xfeef, 0xf, 0xf, 0x1ff]
30+
31+
# mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS]
32+
mod_cfg = [0, 0, 0, 0, 416, 914000, 48, 64, 0, 0, 0,
33+
1, 0, 0, 0, 416, 1321600, 192, 256, 0, 0, 0,
34+
2, 0, 0, 0, 416, 1786000, 192, 256, 0, 0, 0,
35+
3, 0, 0, 0, 416, 2333000, 48, 64, 0, 0, 0,
36+
4, 0, 0, 0, 416, 2910000, 192, 256, 0, 0, 0,
37+
5, 0, 0, 0, 416, 3441000, 192, 256, 0, 0, 0,
38+
6, 0, 0, 0, 416, 4265000, 192, 256, 0, 0, 0]
39+
40+
Module entry definition
41+
***********************
42+
| **name**: name of the module
43+
| **uuid**: uuid of the module
44+
| **affinity_mask**: usable dsp core mask, bit N is for core N, 0x3 means core 0 and 1 can be used
45+
| **instance_count**: max module instance count can be active in fw
46+
| **domain_types**: two schedule domains: domain ll (0), and dp (1)
47+
| **load_type**: build-in module (0) or loadable (1)
48+
| **module_type**: defined in the following enum module_type
49+
50+
.. code-block:: bash
51+
52+
enum module_type {
53+
ebasefw = 0,
54+
emixin,
55+
emixout,
56+
ecopier,
57+
epeakvol,
58+
eupdwmix,
59+
emux,
60+
esrc,
61+
ewov,
62+
efx,
63+
eaec,
64+
ekpb,
65+
emicselect,
66+
efxf, /*i.e.SmartAmp */
67+
eaudclass,
68+
efakecopier,
69+
eiodriver,
70+
ewhm,
71+
egdbstub,
72+
esensing,
73+
emax,
74+
einvalid = emax
75+
};
76+
77+
| **auto_start**: Indicates whether a module instance of the module should be created at the base fw startup
78+
| **sched_caps**: It is a deprecated data used by driver to calculate schedule info for module. Please use the
79+
| default frame_length 1 and all multiple supported.
80+
81+
.. code-block:: bash
82+
83+
struct SchedulingCapabilities {
84+
uint16_t frame_length; // Input frame length in sample groups
85+
Multiples multiples_supported;
86+
};
87+
88+
struct Multiples {
89+
uint16_t x1 : 1; // (base * 1)
90+
uint16_t x2 : 1; // (base * 2)
91+
uint16_t x3 : 1; // (base * 3)
92+
uint16_t x4 : 1; // (base * 4)
93+
uint16_t x5 : 1; // (base * 5)
94+
uint16_t x6 : 1; // (base * 6)
95+
uint16_t x7 : 1; // (base * 7)
96+
uint16_t x8 : 1; // (base * 8)
97+
uint16_t x9 : 1; // (base * 9)
98+
uint16_t x10 : 1; // (base * 10)
99+
uint16_t x11 : 1; // (base * 11)
100+
uint16_t x12 : 1; // (base * 12)
101+
uint16_t x13 : 1; // (base * 13)
102+
uint16_t x14 : 1; // (base * 14)
103+
uint16_t x15 : 1; // (base * 15)
104+
uint16_t all : 1; // (base * X)
105+
};
106+
107+
| **pin**: is array of data used to define the capability of input & output
108+
109+
.. code-block:: bash
110+
111+
pin = [dir, type, sample rates, sample size, sample container size, channel config]
112+
For example, gain module pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff], it supports input pcm
113+
supported sample rate [0xxfeef]: 8000, 11500, 16000, 1200, 22050, 24000, 32000, 44100,
114+
48000, 64000, 88200, 96000, 176400, 19200,
115+
supported sample size [0xf]: 8bits, 16bits, 24bits, 32bits.
116+
supported sample container size [0xa]: 16bits and 32bits
117+
supported channel config [0x45ff]: mono, dual mono, stereo, 2_1, 3_0, quad, surround, 3_1,
118+
5_0_surround, 7_1
119+
120+
enum dir {
121+
input = 0,
122+
output,
123+
}
124+
125+
enum type {
126+
pcm = 0,
127+
mp3,
128+
aac,
129+
};
130+
131+
struct sample_rates {
132+
uint32_t freq_8000 : 1;
133+
uint32_t freq_11500 : 1;
134+
uint32_t freq_12000 : 1;
135+
uint32_t freq_16000 : 1;
136+
uint32_t freq_18900 : 1;
137+
uint32_t freq_22050 : 1;
138+
uint32_t freq_24000 : 1;
139+
uint32_t freq_32000 : 1;
140+
uint32_t freq_37800 : 1;
141+
uint32_t freq_44100 : 1;
142+
uint32_t freq_48000 : 1;
143+
uint32_t freq_64000 : 1;
144+
uint32_t freq_88200 : 1;
145+
uint32_t freq_96000 : 1;
146+
uint32_t freq_176400 : 1;
147+
uint32_t freq_192000 : 1;
148+
uint32_t reserved_ : 16;
149+
};
150+
151+
struct sample_sizes {
152+
uint16_t bits_8 : 1;
153+
uint16_t bits_16 : 1;
154+
uint16_t bits_24 : 1;
155+
uint16_t bits_32 : 1;
156+
uint16_t bits_64 : 1;
157+
uint16_t reserved_ : 11;
158+
};
159+
160+
struct sample_containers {
161+
uint16_t bits_8 : 1;
162+
uint16_t bits_16 : 1;
163+
uint16_t bits_32 : 1;
164+
uint16_t bits_64 : 1;
165+
uint16_t reserved_ : 12;
166+
};
167+
168+
struct channel_configurations {
169+
// FRONT_CENTER
170+
uint32_t channel_mono : 1;
171+
172+
// FRONT_LEFT | BACK_LEFT
173+
uint32_t channel_dual_mono : 1;
174+
175+
// FRONT_LEFT | FRONT_RIGHT
176+
uint32_t channel_stereo : 1;
177+
178+
// FRONT_LEFT | FRONT_RIGHT | LOW_FREQUENCY
179+
uint32_t channel_2_1 : 1;
180+
181+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER
182+
uint32_t channel_3_0 : 1;
183+
184+
// FRONT_LEFT | FRONT_RIGHT | BACK_LEFT | BACK_RIGHT
185+
uint32_t channel_quad : 1;
186+
187+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_CENTER
188+
uint32_t channel_surround : 1;
189+
190+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY
191+
uint32_t channel_3_1 : 1;
192+
193+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_LEFT | BACK_RIGHT
194+
uint32_t channel_5_0 : 1;
195+
196+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SIDE_LEFT | SIDE_RIGHT
197+
uint32_t channel_5_0_surround : 1;
198+
199+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT
200+
uint32_t channel_5_1 : 1;
201+
202+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SIDE_LEFT | SIDE_RIGHT
203+
uint32_t channel_5_1_surround : 1;
204+
205+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_LEFT | BACK_RIGHT | FRONT_LEFT_OF_CENTER | FRONT_RIGHT_OF_CENTER
206+
uint32_t channel_7_0 : 1;
207+
208+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_LEFT | BACK_RIGHT | SIDE_LEFT | SIDE_RIGHT
209+
uint32_t channel_7_0_surround : 1;
210+
211+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT | FRONT_LEFT_OF_CENTER | FRONT_RIGHT_OF_CENTER
212+
uint32_t channel_7_1 : 1;
213+
214+
// FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT | SIDE_LEFT | SIDE_RIGHT
215+
uint32_t channel_7_1_surround : 1;
216+
217+
uint32_t reserved_ : 16;
218+
};
219+
220+
| **mod_cfg**: it is generated by fw building and copy it to module entry. If there is no mod_cfg built by fw, the mod_cfg can be skipped. The definition is:
221+
222+
.. code-block:: bash
223+
224+
struct ModuleConfig {
225+
uint32_t par[4];
226+
uint32_t is_bytes;
227+
uint32_t cps;
228+
uint32_t ibs;
229+
uint32_t obs;
230+
uint32_t module_flags;
231+
uint32_t cpc;
232+
uint32_t obls;
233+
};
234+
235+
par: Configuration lookup parameters used by the host driver
236+
is_byte: Number of bytes required by the module instance
237+
cps: Number of DSP cycles consumed by the module instance to process one second of data
238+
ibs: input buffer size
239+
obs: input buffer size
240+
module_flags: Reserved for future use
241+
cpc: Number of DSP cycles required to process one frame of data
242+
obls: Output block size (reserved for future use)
243+
244+
Build new module entry
245+
**********************
246+
247+
All these module setting are defined in module_binmaps and mod_cfgs files in FW/portable/platform/platform_name/ if the module is a existing one in in reference fw and just do simple conversion and copy it to module entry. If the module is a totally new one, everything needs to build according to above definitions.

0 commit comments

Comments
 (0)