For IPC4 we are re-using the sof_abi_hdr to encapsulate the blob from/to
user space with minor deviation from IPC3:
- ABI magic is different
- the type is used as param_id in IPC4 (it carries the same functionality)
The IPC type can be specified with -i and defaults to 3 (IPC3).
-p is added as a new option for param_id, but -t and -p will do the same
thing.
After reading a blob, print a message for unexpected ABI magic number, but
do not block the execution.
To generate a header for 100 bytes payload:
For IPC3:
sof-ctl -g 100 -t 2
sof-ctl -i 3 -g 100 -t 2
For IPC4:
sof-ctl -i 4 -g 100 -p 2
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
* Use %z specifier for size types to avoid format
specifier warnings on arm32
* in ctl_dump(), size_t n may be used uninitialized
if ctl_data->out_fd > 0 and !ctl_data->binary.
Signed-off-by: Li-Yu Yu <aaronyu@google.com>
sof-ctl assumed the binary control were of size of a
multiple of unsigned integer.
This caused the control byte array to be truncated when the
size of the control was 6 bytes.
This change allow setting any size of control in binary form.
Using CSV will always end up with a number of unsigned integer size.
I tested this change using the Google RTC Audio processing with control
of size:
- 6 bytes,
- 2 bytes
- and 4 bytes.
Signed-off-by: Lionel Koenig <lionelk@google.com>
Most of the errors are unused variables, plus an unused label. Those are
benign.
One of the errors was the following:
/work/repos/sof/tools/ctl/ctl.c: In function ‘ctl_set_get’:
/work/repos/sof/tools/ctl/ctl.c:497:1: error: control reaches end of
non-void function [-Werror=return-type]
497 | }
| ^
This error had caused an undefined-behaviour-driven bug internally (an
error being displayed with a return code of 0, when it shouldn't have
been possible to display that message if the return code was 0). At line
614 of the old code, the message "Error: could not Set control, ret:0"
was displayed.
The errors only show up when you add -Wall -Werror to the compile
options of ctl, which I will do in the next commit.
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
getopt() returns an int, which in our implementation is assigned to a
char type var.
On some platforms char is unsigned thus making getopt() return value
always > 0.
Use int instead of char here to fix the stop condition for parameter
parsing.
This makes sof-ctl work on ARM platforms.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This patch checks for the access type of kcontrol and returns error
only when the access type is not read or write.
Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
This patch adds command line option "-g" to generate and with help
of options "-o <file>" to store the current ABI version header data
into file. Use "-b" to change the default CSV format to binary.
It is used by external tools to create configuration data blobs for
SOF audio processing components.
The parameter for size is the configuration data payload size with
the size of sof_abi_hdr struct excluded. It does not impact the
the length of printed header. It just places the length into the
correct location in the header.
This patch also fixes the permissions of file output. The mode
need to be provided for open() to avoid having no access to
created file and allow overwrite of existing file.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
If no control name is passed to sof-ctl, it currently pops an error,
dumps the usage and then segfaults:
root@gr-mrb:~# sof-ctl -D hw:0
Error: No control was requested.
Usage: ...
Segmentation fault (core dumped)
Fix all that by jumping to the right label.
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Move ctl_elem pointers and buffer initialization out of main(), and
replace calling alloca APIs with malloc ones to make they are shareable
between different functions.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Firmware may use different component specified type in abi header, to
support more than one kcontrols for the same component, here add '-t' to
support specifying this component specified type in the abi header.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Split buffer allocating and freeing part from main(), add separated
functions and call them from main().
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Using '-r' with '-s' means no abi header for the input file, and asks
for not dumping abi header when using '-r' without '-s'.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This will be used on large input file scenario, we need to allocate
buffer according to the input file size.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We might dump kcontrol values in different format, create data_dump()
and csv_data_dump() for that.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add a globle struct which will store params and be shared among
functions in the later commits, to make the code more readable.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Dump the ABI header from source CSV or DSP data. This will make it
obvious if there are any ABI differences.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This tool is generic and can be used with any binary kcontrol to
send data to/from components at runtime.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>