From 1fca0275ede77d20c2331c6a932e5434dd75f62e Mon Sep 17 00:00:00 2001 From: Rander Wang Date: Tue, 31 Jan 2023 16:34:53 +0800 Subject: [PATCH] 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 --- developer_guides/rimage/index.rst | 2 +- .../rimage/ipc4_extended_module_config.rst | 247 ++++++++++++++++++ 2 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 developer_guides/rimage/ipc4_extended_module_config.rst diff --git a/developer_guides/rimage/index.rst b/developer_guides/rimage/index.rst index 2ac94ec7..a736ba8a 100644 --- a/developer_guides/rimage/index.rst +++ b/developer_guides/rimage/index.rst @@ -19,7 +19,7 @@ For more details see: :maxdepth: 1 extended_manifest - + ipc4_extended_module_config Build flow diff --git a/developer_guides/rimage/ipc4_extended_module_config.rst b/developer_guides/rimage/ipc4_extended_module_config.rst new file mode 100644 index 00000000..10fe5bf9 --- /dev/null +++ b/developer_guides/rimage/ipc4_extended_module_config.rst @@ -0,0 +1,247 @@ +.. _ipc4_extended_module_config: + +Ipc4_extended_module_config +########################### + +The ipc4 extended module config is a place to store build-time known module metadata +such as the module name, uuid or capabilities. This config is part of the output +binary is located in extended manifest structure in the binary file and it is used +by driver when setting up ipc message to dsp. + +Rimage builds extended module config based on module setting in config/xxx.toml. +The following setting is for gain module. + +.. code-block:: bash + + [[module.entry]] + name = "GAIN" + uuid = "61BCA9A8-18D0-4A18-8E7B-2639219804B7" + affinity_mask = "0x1" + instance_count = "40" + domain_types = "0" + load_type = "0" + module_type = "5" + 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, 416, 914000, 48, 64, 0, 0, 0, + 1, 0, 0, 0, 416, 1321600, 192, 256, 0, 0, 0, + 2, 0, 0, 0, 416, 1786000, 192, 256, 0, 0, 0, + 3, 0, 0, 0, 416, 2333000, 48, 64, 0, 0, 0, + 4, 0, 0, 0, 416, 2910000, 192, 256, 0, 0, 0, + 5, 0, 0, 0, 416, 3441000, 192, 256, 0, 0, 0, + 6, 0, 0, 0, 416, 4265000, 192, 256, 0, 0, 0] + +Module entry definition +*********************** +| **name**: name of the module +| **uuid**: uuid of the module +| **affinity_mask**: usable dsp core mask, bit N is for core N, 0x3 means core 0 and 1 can be used +| **instance_count**: max module instance count can be active in fw +| **domain_types**: two schedule domains: domain ll (0), and dp (1) +| **load_type**: build-in module (0) or loadable (1) +| **module_type**: defined in the following enum module_type + +.. code-block:: bash + + enum module_type { + ebasefw = 0, + emixin, + emixout, + ecopier, + epeakvol, + eupdwmix, + emux, + esrc, + ewov, + efx, + eaec, + ekpb, + emicselect, + efxf, /*i.e.SmartAmp */ + eaudclass, + efakecopier, + eiodriver, + ewhm, + egdbstub, + esensing, + emax, + einvalid = emax + }; + +| **auto_start**: Indicates whether a module instance of the module should be created at the base fw startup +| **sched_caps**: It is a deprecated data used by driver to calculate schedule info for module. Please use the +| default frame_length 1 and all multiple supported. + +.. code-block:: bash + + struct SchedulingCapabilities { + uint16_t frame_length; // Input frame length in sample groups + Multiples multiples_supported; + }; + + struct Multiples { + uint16_t x1 : 1; // (base * 1) + uint16_t x2 : 1; // (base * 2) + uint16_t x3 : 1; // (base * 3) + uint16_t x4 : 1; // (base * 4) + uint16_t x5 : 1; // (base * 5) + uint16_t x6 : 1; // (base * 6) + uint16_t x7 : 1; // (base * 7) + uint16_t x8 : 1; // (base * 8) + uint16_t x9 : 1; // (base * 9) + uint16_t x10 : 1; // (base * 10) + uint16_t x11 : 1; // (base * 11) + uint16_t x12 : 1; // (base * 12) + uint16_t x13 : 1; // (base * 13) + uint16_t x14 : 1; // (base * 14) + uint16_t x15 : 1; // (base * 15) + uint16_t all : 1; // (base * X) + }; + +| **pin**: is array of data used to define the capability of input & output + +.. code-block:: bash + + pin = [dir, type, sample rates, sample size, sample container size, channel config] + For example, gain module pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff], it supports input pcm + supported sample rate [0xxfeef]: 8000, 11500, 16000, 1200, 22050, 24000, 32000, 44100, + 48000, 64000, 88200, 96000, 176400, 19200, + supported sample size [0xf]: 8bits, 16bits, 24bits, 32bits. + supported sample container size [0xa]: 16bits and 32bits + supported channel config [0x45ff]: mono, dual mono, stereo, 2_1, 3_0, quad, surround, 3_1, + 5_0_surround, 7_1 + + enum dir { + input = 0, + output, + } + + enum type { + pcm = 0, + mp3, + aac, + }; + + struct sample_rates { + uint32_t freq_8000 : 1; + uint32_t freq_11500 : 1; + uint32_t freq_12000 : 1; + uint32_t freq_16000 : 1; + uint32_t freq_18900 : 1; + uint32_t freq_22050 : 1; + uint32_t freq_24000 : 1; + uint32_t freq_32000 : 1; + uint32_t freq_37800 : 1; + uint32_t freq_44100 : 1; + uint32_t freq_48000 : 1; + uint32_t freq_64000 : 1; + uint32_t freq_88200 : 1; + uint32_t freq_96000 : 1; + uint32_t freq_176400 : 1; + uint32_t freq_192000 : 1; + uint32_t reserved_ : 16; + }; + + struct sample_sizes { + uint16_t bits_8 : 1; + uint16_t bits_16 : 1; + uint16_t bits_24 : 1; + uint16_t bits_32 : 1; + uint16_t bits_64 : 1; + uint16_t reserved_ : 11; + }; + + struct sample_containers { + uint16_t bits_8 : 1; + uint16_t bits_16 : 1; + uint16_t bits_32 : 1; + uint16_t bits_64 : 1; + uint16_t reserved_ : 12; + }; + + struct channel_configurations { + // FRONT_CENTER + uint32_t channel_mono : 1; + + // FRONT_LEFT | BACK_LEFT + uint32_t channel_dual_mono : 1; + + // FRONT_LEFT | FRONT_RIGHT + uint32_t channel_stereo : 1; + + // FRONT_LEFT | FRONT_RIGHT | LOW_FREQUENCY + uint32_t channel_2_1 : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER + uint32_t channel_3_0 : 1; + + // FRONT_LEFT | FRONT_RIGHT | BACK_LEFT | BACK_RIGHT + uint32_t channel_quad : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_CENTER + uint32_t channel_surround : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY + uint32_t channel_3_1 : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_LEFT | BACK_RIGHT + uint32_t channel_5_0 : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SIDE_LEFT | SIDE_RIGHT + uint32_t channel_5_0_surround : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT + uint32_t channel_5_1 : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SIDE_LEFT | SIDE_RIGHT + uint32_t channel_5_1_surround : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_LEFT | BACK_RIGHT | FRONT_LEFT_OF_CENTER | FRONT_RIGHT_OF_CENTER + uint32_t channel_7_0 : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_LEFT | BACK_RIGHT | SIDE_LEFT | SIDE_RIGHT + uint32_t channel_7_0_surround : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT | FRONT_LEFT_OF_CENTER | FRONT_RIGHT_OF_CENTER + uint32_t channel_7_1 : 1; + + // FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT | SIDE_LEFT | SIDE_RIGHT + uint32_t channel_7_1_surround : 1; + + uint32_t reserved_ : 16; + }; + +| **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: + +.. code-block:: bash + + struct ModuleConfig { + uint32_t par[4]; + uint32_t is_bytes; + uint32_t cps; + uint32_t ibs; + uint32_t obs; + uint32_t module_flags; + uint32_t cpc; + uint32_t obls; + }; + + par: Configuration lookup parameters used by the host driver + is_byte: Number of bytes required by the module instance + cps: Number of DSP cycles consumed by the module instance to process one second of data + ibs: input buffer size + obs: input buffer size + module_flags: Reserved for future use + cpc: Number of DSP cycles required to process one frame of data + obls: Output block size (reserved for future use) + +Build new module entry +********************** + +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.