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..dde88175 --- /dev/null +++ b/developer_guides/rimage/ipc4_extended_module_config.rst @@ -0,0 +1,219 @@ +.. _ipc4_extended_module_config: + +Ipc4_extended_module_config +########################### + +The ipc4 extended module config is stored in the extended manifest structure of the +output binary file. This config includes many module attributes such as name, uuid +or capabilities. The host driver will rely on the extended module config for IPC +messages to the 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" + + # 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**: restriction on which core a module can run, with the actual determination done on a per-instance basis. +| bit N is for core N, 0x3 means module instance can run on core 0 and 1 +| **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 (BIT(0)), loadable (BIT(1)) or both BIT(0) | BIT(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 +| **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, 12000, 16000, 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 for each different stream format in real case, such as 48khz, 16bit, 4channel. Use should copy +| these config 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 byte size + obs: input buffer byte size + module_flags: Reserved for future use + cpc: Number of DSP cycles required to process one frame of data (1ms 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 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.