diff --git a/src/audio/aria/tune/sof_aria_blobs.m b/src/audio/aria/tune/sof_aria_blobs.m index 212a4d83b480..a3adaa8c668e 100644 --- a/src/audio/aria/tune/sof_aria_blobs.m +++ b/src/audio/aria/tune/sof_aria_blobs.m @@ -20,17 +20,17 @@ function sof_aria_blobs() blob8 = sof_aria_build_blob(0); tplg2_fn = sprintf("%s/passthrough.conf", sof_tplg_aria); - check_create_dir(tplg2_fn); - tplg2_write(tplg2_fn, blob8, "aria_config", ... - "Exported with script sof_aria_blobs.m" , ... - "cd tools/tune/aria; octave sof_aria_blobs.m"); + sof_check_create_dir(tplg2_fn); + sof_tplg2_write(tplg2_fn, blob8, "aria_config", ... + "Exported with script sof_aria_blobs.m" , ... + "cd tools/tune/aria; octave sof_aria_blobs.m"); for param = 1:3 blob8 = sof_aria_build_blob(param); tplg2_fn = sprintf("%s/param_%d.conf", sof_tplg_aria, param); - tplg2_write(tplg2_fn, blob8, "aria_config", ... - "Exported with script sof_aria_blobs.m" , ... - "cd tools/tune/aria; octave sof_aria_blobs.m"); + sof_tplg2_write(tplg2_fn, blob8, "aria_config", ... + "Exported with script sof_aria_blobs.m" , ... + "cd tools/tune/aria; octave sof_aria_blobs.m"); end sof_aria_paths(false); @@ -53,7 +53,7 @@ function sof_aria_paths(enable) data_length = length(param_values); data_size = 4 * data_length; ipc_ver = 4; - [abi_bytes, abi_size] = get_abi(data_size, ipc_ver, blob_type, blob_param_id); + [abi_bytes, abi_size] = sof_get_abi(data_size, ipc_ver, blob_type, blob_param_id); blob_size = data_size + abi_size; blob8 = uint8(zeros(1, blob_size)); blob8(1:abi_size) = abi_bytes; diff --git a/src/audio/crossover/tune/sof_crossover_build_blob.m b/src/audio/crossover/tune/sof_crossover_build_blob.m index e5f48fd61a13..17f1c2c60fc5 100644 --- a/src/audio/crossover/tune/sof_crossover_build_blob.m +++ b/src/audio/crossover/tune/sof_crossover_build_blob.m @@ -1,4 +1,4 @@ -function blob8 = crossover_build_blob(blob_struct, endian, ipc_ver) +function blob8 = sof_crossover_build_blob(blob_struct, endian, ipc_ver) if nargin < 2 endian = 'little'; @@ -21,7 +21,7 @@ %% Build Blob % refer to sof/src/include/user/crossover.h for the config struct. data_size = 4 * (2 + 4 + 4 + numel(blob_struct.all_coef)); -[abi_bytes, abi_size] = get_abi(data_size, ipc_ver); +[abi_bytes, abi_size] = sof_get_abi(data_size, ipc_ver); blob_size = data_size + abi_size; blob8 = uint8(zeros(1, blob_size)); diff --git a/src/audio/crossover/tune/sof_example_crossover.m b/src/audio/crossover/tune/sof_example_crossover.m index 297834ae03bf..6d642122aab6 100644 --- a/src/audio/crossover/tune/sof_example_crossover.m +++ b/src/audio/crossover/tune/sof_example_crossover.m @@ -49,9 +49,9 @@ function export_crossover(cr) tplg1_fn = sprintf('%s/coef_%s_%s_%s.m4', tpath1, str_way, str_freq, str_pid); % Control Bytes File tplg2_fn = sprintf('%s/coef_%s_%s_%s.conf', tpath2, str_way, str_freq, str_pid); % Use those files with sof-ctl to update the component's configuration -blob3_fn = sprintf('%s/coef_%dway.blob', ctlpath3, cr.num_sinks); % Blob binary file +blob3_fn = sprintf('%s/coef_%dway.bin', ctlpath3, cr.num_sinks); % Blob binary file alsa3_fn = sprintf('%s/coef_%dway.txt', ctlpath3, cr.num_sinks); % ALSA CSV format file -blob4_fn = sprintf('%s/coef_%dway.blob', ctlpath4, cr.num_sinks); % Blob binary file +blob4_fn = sprintf('%s/coef_%dway.bin', ctlpath4, cr.num_sinks); % Blob binary file alsa4_fn = sprintf('%s/coef_%dway.txt', ctlpath4, cr.num_sinks); % ALSA CSV format file % This array is an example on how to assign a buffer from pipeline 1 to output 0, @@ -85,16 +85,12 @@ function export_crossover(cr) % Generate output files -mkdir_check(tpath1); -mkdir_check(tpath2); -mkdir_check(ctlpath3); -mkdir_check(ctlpath4); -tplg_write(tplg1_fn, blob8, "CROSSOVER"); -tplg2_write(tplg2_fn, blob8_ipc4, "crossover_config", 'Exported Control Bytes'); +sof_tplg_write(tplg1_fn, blob8, "CROSSOVER"); +sof_tplg2_write(tplg2_fn, blob8_ipc4, "crossover_config", 'Exported Control Bytes'); sof_ucm_blob_write(blob3_fn, blob8); sof_ucm_blob_write(blob4_fn, blob8_ipc4); -alsactl_write(alsa3_fn, blob8); -alsactl_write(alsa4_fn, blob8_ipc4); +sof_alsactl_write(alsa3_fn, blob8); +sof_alsactl_write(alsa4_fn, blob8_ipc4); % Plot Magnitude and Phase Response of each sink sof_crossover_plot_freq(crossover.lp, crossover.hp, cr.fs, cr.num_sinks); @@ -125,12 +121,3 @@ function export_crossover(cr) end end - -% Check if directory exists, avoid warning print for existing -function mkdir_check(new_dir) - - if ~exist(new_dir, 'dir') - mkdir(new_dir); - end - -end diff --git a/src/audio/dcblock/tune/sof_dcblock_build_blob.m b/src/audio/dcblock/tune/sof_dcblock_build_blob.m index df4722cd8f10..41d0c1565ab3 100644 --- a/src/audio/dcblock/tune/sof_dcblock_build_blob.m +++ b/src/audio/dcblock/tune/sof_dcblock_build_blob.m @@ -27,7 +27,7 @@ %% Build Blob data_size = (num_of_coeffs)*4; -[abi_bytes, abi_size] = get_abi(data_size, ipc_ver); +[abi_bytes, abi_size] = sof_get_abi(data_size, ipc_ver); blob_size = data_size + abi_size; blob8 = uint8(zeros(1, blob_size)); diff --git a/src/audio/dcblock/tune/sof_example_dcblock.m b/src/audio/dcblock/tune/sof_example_dcblock.m index 139f812ee869..cf6d856656a3 100644 --- a/src/audio/dcblock/tune/sof_example_dcblock.m +++ b/src/audio/dcblock/tune/sof_example_dcblock.m @@ -37,9 +37,9 @@ function dcblock_blob_calculate(prm) tplg1_fn = sprintf("%s/topology1/m4/dcblock_coef_%s.m4", sof_tplg, prm.id); % Control Bytes File tplg2_fn = sprintf("%s/topology2/include/components/dcblock/%s.conf", sof_tplg, prm.id); % Use those files with sof-ctl to update the component's configuration -blob3_fn = sprintf("%s/ipc3/dcblock/coef_%s.blob", sof_ctl, prm.id); % Blob binary file +blob3_fn = sprintf("%s/ipc3/dcblock/coef_%s.bin", sof_ctl, prm.id); % Blob binary file alsa3_fn = sprintf("%s/ipc3/dcblock/coef_%s.txt", sof_ctl, prm.id); % ALSA CSV format file -blob4_fn = sprintf("%s/ipc4/dcblock/coef_%s.blob", sof_ctl, prm.id); % Blob binary file +blob4_fn = sprintf("%s/ipc4/dcblock/coef_%s.bin", sof_ctl, prm.id); % Blob binary file alsa4_fn = sprintf("%s/ipc4/dcblock/coef_%s.txt", sof_ctl, prm.id); % ALSA CSV format file endian = "little"; @@ -58,17 +58,17 @@ function dcblock_blob_calculate(prm) blob8_ipc4 = sof_dcblock_build_blob(R_coeffs, endian, 4); % Generate output files -tplg_write(tplg1_fn, blob8, "DCBLOCK", ... - "Exported with script sof_example_dcblock.m", ... - "cd tools/tune/dcblock; octave sof_example_dcblock.m"); +sof_tplg_write(tplg1_fn, blob8, "DCBLOCK", ... + "Exported with script sof_example_dcblock.m", ... + "cd tools/tune/dcblock; octave sof_example_dcblock.m"); sof_ucm_blob_write(blob3_fn, blob8); -alsactl_write(alsa3_fn, blob8); +sof_alsactl_write(alsa3_fn, blob8); -tplg2_write(tplg2_fn, blob8_ipc4, "dcblock_config", ... - "Exported with script sof_example_dcblock.m" , ... - "cd tools/tune/dcblock; octave sof_example_dcblock.m"); +sof_tplg2_write(tplg2_fn, blob8_ipc4, "dcblock_config", ... + "Exported with script sof_example_dcblock.m" , ... + "cd tools/tune/dcblock; octave sof_example_dcblock.m"); sof_ucm_blob_write(blob4_fn, blob8_ipc4); -alsactl_write(alsa4_fn, blob8_ipc4); +sof_alsactl_write(alsa4_fn, blob8_ipc4); % Plot Filter's Transfer Function and Step Response % As an example, plot the graphs of the first coefficient diff --git a/src/audio/drc/tune/sof_drc_build_blob.m b/src/audio/drc/tune/sof_drc_build_blob.m index 48ef29b31a65..72bd7288be16 100644 --- a/src/audio/drc/tune/sof_drc_build_blob.m +++ b/src/audio/drc/tune/sof_drc_build_blob.m @@ -22,7 +22,7 @@ % refer to sof/src/include/user/drc.h for the config struct. num_coefs = length(fieldnames(blob_struct)); data_size = 4 * (1 + 4 + num_coefs); -[abi_bytes, abi_size] = get_abi(data_size, ipc_ver); +[abi_bytes, abi_size] = sof_get_abi(data_size, ipc_ver); blob_size = data_size + abi_size; blob8 = uint8(zeros(1, blob_size)); diff --git a/src/audio/drc/tune/sof_example_drc.m b/src/audio/drc/tune/sof_example_drc.m index 896556e74f5b..febf320aad99 100644 --- a/src/audio/drc/tune/sof_example_drc.m +++ b/src/audio/drc/tune/sof_example_drc.m @@ -60,9 +60,9 @@ function drc_coefs_and_config_export(params, id) tplg1_fn = sprintf("%s/topology1/m4/drc_coef_%s.m4", sof_tplg, id); % Control Bytes File tplg2_fn = sprintf("%s/topology2/include/components/drc/%s.conf", sof_tplg, id); % Control Bytes File % Use those files with sof-ctl to update the component's configuration -blob3_fn = sprintf("%s/ipc3/drc_coef_%s.blob", sof_ctl, id); % Blob binary file +blob3_fn = sprintf("%s/ipc3/drc_coef_%s.bin", sof_ctl, id); % Blob binary file alsa3_fn = sprintf("%s/ipc3/drc_coef_%s.txt", sof_ctl, id); % ALSA CSV format file -blob4_fn = sprintf("%s/ipc4/drc/%s.blob", sof_ctl, id); % Blob binary file +blob4_fn = sprintf("%s/ipc4/drc/%s.bin", sof_ctl, id); % Blob binary file alsa4_fn = sprintf("%s/ipc4/drc/%s.txt", sof_ctl, id); % ALSA CSV format file endian = "little"; @@ -82,12 +82,12 @@ function drc_coefs_and_config_export(params, id) my_name = mfilename(); drc_note = sprintf("Exported with script %s.m", my_name); drc_howto = sprintf("cd tools/tune/drc; octave --no-window-system %s.m", my_name); -tplg_write(tplg1_fn, blob8, "DRC", drc_note, drc_howto); -tplg2_write(tplg2_fn, blob8_ipc4, "drc_config", drc_note, drc_howto); +sof_tplg_write(tplg1_fn, blob8, "DRC", drc_note, drc_howto); +sof_tplg2_write(tplg2_fn, blob8_ipc4, "drc_config", drc_note, drc_howto); sof_ucm_blob_write(blob3_fn, blob8); -alsactl_write(alsa3_fn, blob8); +sof_alsactl_write(alsa3_fn, blob8); sof_ucm_blob_write(blob4_fn, blob8_ipc4); -alsactl_write(alsa4_fn, blob8_ipc4); +sof_alsactl_write(alsa4_fn, blob8_ipc4); % Plot x-y response in dB sof_drc_plot_db_curve(coefs); diff --git a/src/audio/eq_iir/tune/sof_cmocka_data_eq_fir.m b/src/audio/eq_iir/tune/sof_cmocka_data_eq_fir.m index 6fc47aee2f14..fd9e4a91f797 100644 --- a/src/audio/eq_iir/tune/sof_cmocka_data_eq_fir.m +++ b/src/audio/eq_iir/tune/sof_cmocka_data_eq_fir.m @@ -9,6 +9,8 @@ function sof_cmocka_data_eq_fir() +sof_eq_paths(true); + % Output files and paths sof_cmocka = '../../../../test/cmocka'; @@ -44,6 +46,8 @@ function sof_cmocka_data_eq_fir() plot(refi / scale) grid on; +sof_eq_paths(false); + end diff --git a/src/audio/eq_iir/tune/sof_cmocka_data_eq_iir.m b/src/audio/eq_iir/tune/sof_cmocka_data_eq_iir.m index 388a14039c48..6c9b3732f283 100644 --- a/src/audio/eq_iir/tune/sof_cmocka_data_eq_iir.m +++ b/src/audio/eq_iir/tune/sof_cmocka_data_eq_iir.m @@ -9,6 +9,8 @@ function sof_cmocka_data_eq_iir() +sof_eq_paths(true); + % Output files and paths sof_cmocka = '../../../../test/cmocka'; chirp_fn = fullfile(sof_cmocka, 'include/cmocka_chirp_2ch.h'); @@ -45,6 +47,8 @@ function sof_cmocka_data_eq_iir() plot(refi / scale) grid on; +sof_eq_paths(false); + end diff --git a/src/audio/eq_iir/tune/sof_eq_alsactl_write.m b/src/audio/eq_iir/tune/sof_eq_alsactl_write.m deleted file mode 100644 index f6c49128dbc6..000000000000 --- a/src/audio/eq_iir/tune/sof_eq_alsactl_write.m +++ /dev/null @@ -1,56 +0,0 @@ -function sof_eq_alsactl_write(fn, blob8) - -%% -% Copyright (c) 2016, Intel Corporation -% All rights reserved. -% -% Redistribution and use in source and binary forms, with or without -% modification, are permitted provided that the following conditions are met: -% * Redistributions of source code must retain the above copyright -% notice, this list of conditions and the following disclaimer. -% * Redistributions in binary form must reproduce the above copyright -% notice, this list of conditions and the following disclaimer in the -% documentation and/or other materials provided with the distribution. -% * Neither the name of the Intel Corporation nor the -% names of its contributors may be used to endorse or promote products -% derived from this software without specific prior written permission. -% -% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGE. -% -% Author: Seppo Ingalsuo -% - -%% Write blob -fh = fopen(fn, 'w'); - -%% Pad blob length to multiple of four bytes -n_orig = length(blob8); -n_new = ceil(n_orig/4); -blob8_new = zeros(1, n_new*4); -blob8_new(1:n_orig) = blob8; - -%% Convert to 32 bit -blob32 = zeros(1, n_new, 'uint32'); -k = 2.^[0 8 16 24]; -for i=1:n_new - j = (i-1)*4; - blob32(i) = blob8_new(j+1)*k(1) + blob8_new(j+2)*k(2) ... - + blob8_new(j+3)*k(3) + blob8_new(j+4)*k(4); -end -for i=1:n_new-1 - fprintf(fh, '%ld,', blob32(i)); -end -fprintf(fh, '%ld,\n', blob32(end)); -fclose(fh); - -end diff --git a/src/audio/eq_iir/tune/sof_eq_fir_blob_decode.m b/src/audio/eq_iir/tune/sof_eq_fir_blob_decode.m index 5efa140b0f08..4d0ecbe52725 100644 --- a/src/audio/eq_iir/tune/sof_eq_fir_blob_decode.m +++ b/src/audio/eq_iir/tune/sof_eq_fir_blob_decode.m @@ -35,7 +35,7 @@ end %% Get ABI information -[abi_bytes, nbytes_abi] = sof_eq_get_abi(0); +[abi_bytes, nbytes_abi] = sof_get_abi(0); %% Defaults eq.b = []; diff --git a/src/audio/eq_iir/tune/sof_eq_fir_blob_pack.m b/src/audio/eq_iir/tune/sof_eq_fir_blob_pack.m index 9fd5f0aec8a5..66bd3142fc55 100644 --- a/src/audio/eq_iir/tune/sof_eq_fir_blob_pack.m +++ b/src/audio/eq_iir/tune/sof_eq_fir_blob_pack.m @@ -89,7 +89,7 @@ nbytes_data = nb16 * 2; %% Get ABI information -[abi_bytes, nbytes_abi] = sof_eq_get_abi(nbytes_data, ipc_ver); +[abi_bytes, nbytes_abi] = sof_get_abi(nbytes_data, ipc_ver); %% Initialize uint8 array with correct size nbytes = nbytes_abi + nbytes_data; diff --git a/src/audio/eq_iir/tune/sof_eq_get_abi.m b/src/audio/eq_iir/tune/sof_eq_get_abi.m deleted file mode 100644 index 6677af48c6ec..000000000000 --- a/src/audio/eq_iir/tune/sof_eq_get_abi.m +++ /dev/null @@ -1,73 +0,0 @@ -function [bytes, nbytes] = sof_eq_get_abi(setsize, ipc_ver, type, param_id) - -%% Return current SOF ABI header -% -% [bytes, nbytes] = sof_eq_get_abi(setsize, ipc_ver, type, param_id) -% Input -% setsize - size of the payload blob -% ipc_ver - 3 or 4, defaults to 3 -% type - for IPC3, normally 0, defaults to 0 -% param_id - for IPC4, 0 - 255, defaults to 0 -% -% Output -% bytes - returned uint8 type array -% nbytes - length of the array - -% SPDX-License-Identifier: BSD-3-Clause -% -% Copyright(c) 2018 Intel Corporation. All rights reserved. -% -% Author: Seppo Ingalsuo - -if nargin < 2 - ipc_ver = 3; -end -if nargin < 3 - type = 0; -end -if nargin < 4 - param_id = 0; -end - -abifn = 'eq_get_abi.bin'; -switch ipc_ver - case 3 - %% Use sof-ctl to write ABI header into a file - cmd = sprintf('sof-ctl -g %d -t %d -b -o %s', setsize, type, abifn); - [bytes, nbytes] = get_abi_with_sofctl(cmd, abifn); - case 4 - cmd = sprintf('sof-ctl -i 4 -g %d -p %d -b -o %s', setsize, param_id, abifn); - [bytes, nbytes] = get_abi_with_sofctl(cmd, abifn); - otherwise - fprintf(1, 'Illegal ipc_ver %d\n', ipc_ver); - error('Failed.'); -end - -end - -function [bytes, nbytes] = get_abi_with_sofctl(cmd, abifn) - -[ret, ~] = system(cmd); -if ret - error('Failed to run sof-ctl. Is it installed?'); -end -fh = fopen(abifn, 'r'); -if fh < 0 - error('Failed to read abi header produced by sof-ctl'); -end -[bytes, nbytes] = fread(fh, inf, 'uint8'); -fclose(fh); -delete(abifn); - -end - -function bytes = w32b(word) - -sh = [0 -8 -16 -24]; -bytes = uint8(zeros(1,4)); -bytes(1) = bitand(bitshift(word, sh(1)), 255); -bytes(2) = bitand(bitshift(word, sh(2)), 255); -bytes(3) = bitand(bitshift(word, sh(3)), 255); -bytes(4) = bitand(bitshift(word, sh(4)), 255); - -end diff --git a/src/audio/eq_iir/tune/sof_eq_iir_blob_decode.m b/src/audio/eq_iir/tune/sof_eq_iir_blob_decode.m index d721d9c34770..f54c88f63eb5 100644 --- a/src/audio/eq_iir/tune/sof_eq_iir_blob_decode.m +++ b/src/audio/eq_iir/tune/sof_eq_iir_blob_decode.m @@ -34,7 +34,7 @@ end %% Get ABI information -[abi_bytes, nbytes_abi] = get_abi(0); +[abi_bytes, nbytes_abi] = sof_get_abi(0); %% Defaults eq.b = []; diff --git a/src/audio/eq_iir/tune/sof_eq_iir_blob_pack.m b/src/audio/eq_iir/tune/sof_eq_iir_blob_pack.m index 35b9fffc0ed7..829a07e81843 100644 --- a/src/audio/eq_iir/tune/sof_eq_iir_blob_pack.m +++ b/src/audio/eq_iir/tune/sof_eq_iir_blob_pack.m @@ -43,7 +43,7 @@ nbytes_data = nbytes_head + nbytes_coef; %% Get ABI information -[abi_bytes, nbytes_abi] = sof_eq_get_abi(nbytes_data, ipc_ver); +[abi_bytes, nbytes_abi] = sof_get_abi(nbytes_data, ipc_ver); %% Initialize correct size uint8 array nbytes = nbytes_abi + nbytes_data; diff --git a/src/audio/eq_iir/tune/sof_eq_tplg2_write.m b/src/audio/eq_iir/tune/sof_eq_tplg2_write.m deleted file mode 100644 index e3f28ddfa9a2..000000000000 --- a/src/audio/eq_iir/tune/sof_eq_tplg2_write.m +++ /dev/null @@ -1,45 +0,0 @@ -function sof_eq_tplg2_write(fn, blob8, component, comment) - -% SPDX-License-Identifier: BSD-3-Clause -% -% Copyright (c) 2023, Intel Corporation. All rights reserved. -% -% Author: Seppo Ingalsuo - -if nargin < 2 - comment = 'Exported EQ'; -end - -%% Check that blob length is multiple of 32 bits -n_blob = length(blob8); -n_test = ceil(n_blob/4)*4; -if (n_blob ~= n_test) - fprintf(1, 'Error: ´Blob length %d is not multiple of 32 bits\n', ... - n_blob); - error('Failed.'); -end - -%% Write blob -fh = fopen(fn, 'w'); -nl = 8; -fprintf(fh, '# %s %s\n', comment, date()); -fprintf(fh, 'Object.Base.data.\"%s\" {\n', component); -fprintf(fh, '\tbytes \"\n'); -for i = 1:nl:n_blob - fprintf(fh, '\t\t'); - for j = 0:nl-1 - n = i + j; - if n < n_blob - fprintf(fh, '0x%02x,', blob8(n)); - end - if n == n_blob - fprintf(fh, '0x%02x"', blob8(n)); - end - end - fprintf(fh, '\n'); -end -fprintf(fh, '}\n'); -fclose(fh); -fprintf('Blob size %d was written to file %s\n', n_blob, fn); - -end diff --git a/src/audio/eq_iir/tune/sof_eq_tplg_write.m b/src/audio/eq_iir/tune/sof_eq_tplg_write.m deleted file mode 100644 index f178be8ba215..000000000000 --- a/src/audio/eq_iir/tune/sof_eq_tplg_write.m +++ /dev/null @@ -1,47 +0,0 @@ -function sof_eq_tplg_write(fn, blob8, priv, comment) - -% SPDX-License-Identifier: BSD-3-Clause -% -% Copyright (c) 2018-2020, Intel Corporation. All rights reserved. -% -% Author: Seppo Ingalsuo - -if nargin < 4 - comment = 'Exported EQ'; -end - -%% Check that blob length is multiple of 32 bits -n_blob = length(blob8); -n_test = ceil(n_blob/4)*4; -if (n_blob ~= n_test) - fprintf(1, 'Error: ´Blob length %d is not multiple of 32 bits\n', ... - n_blob); - error('Failed.'); -end - -%% Write blob -fh = fopen(fn, 'w'); -nl = 8; -fprintf(fh, '# %s %s\n', comment, date()); -fprintf(fh, 'CONTROLBYTES_PRIV(%s,\n', priv); -fprintf(fh, '` bytes "'); -for i = 1:nl:n_blob - if i > 1 - fprintf(fh, '` '); - end - for j = 0:nl-1 - n = i + j; - if n < n_blob - fprintf(fh, '0x%02x,', blob8(n)); - end - if n == n_blob - fprintf(fh, '0x%02x"', blob8(n)); - end - end - fprintf(fh, '''\n'); -end -fprintf(fh, ')\n'); -fclose(fh); -fprintf('Blob size %d was written to file %s\n', n_blob, fn); - -end diff --git a/src/audio/eq_iir/tune/sof_example_fir_eq.m b/src/audio/eq_iir/tune/sof_example_fir_eq.m index a3d5fdbeadd6..a1e47396ce7e 100644 --- a/src/audio/eq_iir/tune/sof_example_fir_eq.m +++ b/src/audio/eq_iir/tune/sof_example_fir_eq.m @@ -24,7 +24,7 @@ function sof_example_fir_eq() %% ------------------- %% Example 1: Loudness %% ------------------- -fn.bin = 'loudness.blob'; +fn.bin = 'loudness.bin'; fn.txt = 'loudness.txt'; fn.tplg1 = 'eq_fir_coef_loudness.m4'; fn.tplg2 = 'loudness.conf'; @@ -55,7 +55,7 @@ function sof_example_fir_eq() %% ------------------- %% Example 2: Mid boost %% ------------------- -fn.bin = 'mid.blob'; +fn.bin = 'mid.bin'; fn.txt = 'mid.txt'; fn.tplg1 = 'eq_fir_coef_mid.m4'; fn.tplg2 = 'midboost.conf'; @@ -82,7 +82,7 @@ function sof_example_fir_eq() %% ------------------- %% Example 3: Flat EQ %% ------------------- -fn.bin = 'flat.blob'; +fn.bin = 'flat.bin'; fn.txt = 'flat.txt'; fn.tplg1 = 'eq_fir_coef_flat.m4'; fn.tplg2 = 'flat.conf'; @@ -109,7 +109,7 @@ function sof_example_fir_eq() %% -------------------------- %% Example 4: Pass-through EQ %% -------------------------- -fn.bin = 'pass.blob'; +fn.bin = 'pass.bin'; fn.txt = 'pass.txt'; fn.tplg1 = 'eq_fir_coef_pass.m4'; fn.tplg2 = 'passthrough.conf'; @@ -226,15 +226,16 @@ function sof_example_fir_eq() % Pack and write file common function for all exports function sof_eq_pack_export(bm, fn, note) +howto = 'cd src/audio/eq_iir/tune; octave --no-window-system sof_example_fir_eq.m'; bp = sof_eq_fir_blob_pack(bm, 3); % IPC3 if ~isempty(fn.bin) sof_ucm_blob_write(fullfile(fn.cpath3, fn.bin), bp); end if ~isempty(fn.txt) - sof_eq_alsactl_write(fullfile(fn.cpath3, fn.txt), bp); + sof_alsactl_write(fullfile(fn.cpath3, fn.txt), bp); end if ~isempty(fn.tplg1) - sof_eq_tplg_write(fullfile(fn.tpath1, fn.tplg1), bp, fn.priv, note); + sof_tplg_write(fullfile(fn.tpath1, fn.tplg1), bp, fn.priv, note, howto); end bp = sof_eq_fir_blob_pack(bm, 4); % IPC4 @@ -242,10 +243,10 @@ function sof_eq_pack_export(bm, fn, note) sof_ucm_blob_write(fullfile(fn.cpath4, fn.bin), bp); end if ~isempty(fn.txt) - sof_eq_alsactl_write(fullfile(fn.cpath4, fn.txt), bp); + sof_alsactl_write(fullfile(fn.cpath4, fn.txt), bp); end if ~isempty(fn.tplg2) - sof_eq_tplg2_write(fullfile(fn.tpath2, fn.tplg2), bp, 'fir_eq', note); + sof_tplg2_write(fullfile(fn.tpath2, fn.tplg2), bp, 'fir_eq', note, howto); end end diff --git a/src/audio/eq_iir/tune/sof_example_iir_bandsplit.m b/src/audio/eq_iir/tune/sof_example_iir_bandsplit.m index 23b96646d5cf..37a34342c678 100644 --- a/src/audio/eq_iir/tune/sof_example_iir_bandsplit.m +++ b/src/audio/eq_iir/tune/sof_example_iir_bandsplit.m @@ -20,7 +20,7 @@ function sof_example_iir_bandsplit() %% -------------------------------------------------- %% Example: Band-split 2ch to 4ch low and high bands %% -------------------------------------------------- -blob_fn = fullfile(cpath, 'bandsplit.blob'); +blob_fn = fullfile(cpath, 'bandsplit.bin'); alsa_fn = fullfile(cpath, 'bandsplit.txt'); tplg_fn = fullfile(tpath, 'eq_iir_bandsplit.m4'); comment = 'Bandsplit, created with example_iir_bandsplit.m'; @@ -133,11 +133,11 @@ function sof_eq_pack_export(bm, bin_fn, ascii_fn, tplg_fn, priv, note) end if ~isempty(ascii_fn) - sof_eq_alsactl_write(ascii_fn, bp); + sof_alsactl_write(ascii_fn, bp); end if ~isempty(tplg_fn) - sof_eq_tplg_write(tplg_fn, bp, priv, note); + sof_tplg_write(tplg_fn, bp, priv, note); end end diff --git a/src/audio/eq_iir/tune/sof_example_iir_eq.m b/src/audio/eq_iir/tune/sof_example_iir_eq.m index 50d966a17c41..69449164394b 100644 --- a/src/audio/eq_iir/tune/sof_example_iir_eq.m +++ b/src/audio/eq_iir/tune/sof_example_iir_eq.m @@ -24,7 +24,7 @@ function sof_example_iir_eq() %% ------------------- %% Example 1: Loudness %% ------------------- -fn.bin = 'loudness.blob'; +fn.bin = 'loudness.bin'; fn.txt = 'loudness.txt'; fn.tplg1 = 'eq_iir_coef_loudness.m4'; fn.tplg2 = 'loudness.conf'; @@ -55,7 +55,7 @@ function sof_example_iir_eq() %% ------------------------------------ %% Example 2: Bass boost %% ------------------------------------ -fn.bin = 'bassboost.blob'; +fn.bin = 'bassboost.bin'; fn.txt = 'bassboost.txt'; fn.tplg1 = 'eq_iir_coef_bassboost.m4'; fn.tplg2 = 'bassboost.conf'; @@ -82,7 +82,7 @@ function sof_example_iir_eq() %% ------------------------------------ %% Example 3: Band-pass %% ------------------------------------ -fn.bin = 'bandpass.blob'; +fn.bin = 'bandpass.bin'; fn.txt = 'bandpass.txt'; fn.tplg1 = 'eq_iir_coef_bandpass.m4'; fn.tplg2 = 'bandpass.conf'; @@ -109,7 +109,7 @@ function sof_example_iir_eq() %% ------------------- %% Example 4: Flat IIR %% ------------------- -fn.bin = 'flat.blob'; +fn.bin = 'flat.bin'; fn.txt = 'flat.txt'; fn.tplg1 = 'eq_iir_coef_flat.m4'; fn.tplg2 = 'flat.conf'; @@ -136,7 +136,7 @@ function sof_example_iir_eq() %% --------------------------- %% Example 5: Pass-through IIR %% --------------------------- -fn.bin = 'pass.blob'; +fn.bin = 'pass.bin'; fn.txt = 'pass.txt'; fn.tplg1 = 'eq_iir_coef_pass.m4'; fn.tplg2 = 'passthrough.conf'; @@ -180,7 +180,7 @@ function sof_example_iir_eq() fn.txt = sprintf('highpass_%dhz_%ddb_%dkhz.txt', fc, g, fsk); comment = sprintf('%d Hz second order high-pass, gain %d dB, created with sof_example_iir_eq.m', ... fc, g); - fn.bin = sprintf('highpass_%dhz_%ddb_%dkhz.blob', fc, g, fsk); + fn.bin = sprintf('highpass_%dhz_%ddb_%dkhz.bin', fc, g, fsk); %% Design IIR high-pass eq_hp = hp_iir_eq(fs, fc, g); @@ -207,7 +207,7 @@ function sof_example_iir_eq() %% Example 7: Merge previous desigs to single blob for use as presets %% ------------------------------------------------------------------ -fn.bin = 'bundle.blob'; +fn.bin = 'bundle.bin'; fn.txt = 'bundle.txt'; fn.tplg1 = 'eq_iir_bundle.m4'; fn.tplg2 = 'bundle.conf'; @@ -354,15 +354,16 @@ function sof_example_iir_eq() % Pack and write file common function for all exports function sof_eq_pack_export(bm, fn, note) +howto = 'cd src/audio/eq_iir/tune; octave --no-window-system sof_example_iir_eq.m'; bp = sof_eq_iir_blob_pack(bm, 3); % IPC3 if ~isempty(fn.bin) sof_ucm_blob_write(fullfile(fn.cpath3, fn.bin), bp); end if ~isempty(fn.txt) - sof_eq_alsactl_write(fullfile(fn.cpath3, fn.txt), bp); + sof_alsactl_write(fullfile(fn.cpath3, fn.txt), bp); end if ~isempty(fn.tplg1) - sof_eq_tplg_write(fullfile(fn.tpath1, fn.tplg1), bp, fn.priv, note); + sof_tplg_write(fullfile(fn.tpath1, fn.tplg1), bp, fn.priv, note, howto); end bp = sof_eq_iir_blob_pack(bm, 4); % IPC4 @@ -370,10 +371,10 @@ function sof_eq_pack_export(bm, fn, note) sof_ucm_blob_write(fullfile(fn.cpath4, fn.bin), bp); end if ~isempty(fn.txt) - sof_eq_alsactl_write(fullfile(fn.cpath4, fn.txt), bp); + sof_alsactl_write(fullfile(fn.cpath4, fn.txt), bp); end if ~isempty(fn.tplg2) - sof_eq_tplg2_write(fullfile(fn.tpath2, fn.tplg2), bp, 'iir_eq', note); + sof_tplg2_write(fullfile(fn.tpath2, fn.tplg2), bp, 'iir_eq', note, howto); end end diff --git a/src/audio/eq_iir/tune/sof_example_spk_eq.m b/src/audio/eq_iir/tune/sof_example_spk_eq.m index e7612796c393..3a91ae04db6a 100644 --- a/src/audio/eq_iir/tune/sof_example_spk_eq.m +++ b/src/audio/eq_iir/tune/sof_example_spk_eq.m @@ -30,14 +30,15 @@ function sof_example_spk_eq() fir.priv = 'DEF_EQFIR_PRIV'; iir.comment = 'Speaker FIR+IIR EQ created with example_spk_eq.m'; fir.comment = 'Speaker FIR+IIR EQ created with example_spk_eq.m'; +howto = 'cd src/audio/eq_iir/tune; octave --no-window-system sof_example_spk_eq.m'; %% File names fir.txt = 'spk.txt'; -fir.bin = 'spk.blob'; +fir.bin = 'spk.bin'; fir.tplg1 = 'eq_fir_coef_spk.m4'; fir.tplg2 = 'example_speaker.conf'; iir.txt = 'spk.txt'; -iir.bin = 'spk.blob'; +iir.bin = 'spk.bin'; iir.tplg1 = 'eq_iir_coef_spk.m4'; iir.tplg2 = 'example_speaker.conf'; @@ -142,13 +143,13 @@ function sof_example_spk_eq() assign_response, ... [ bq_fir ]); bp_fir = sof_eq_fir_blob_pack(bm_fir, 3); % IPC3 - sof_eq_alsactl_write(fullfile(fir.cpath3, fir.txt), bp_fir); + sof_alsactl_write(fullfile(fir.cpath3, fir.txt), bp_fir); sof_ucm_blob_write(fullfile(fir.cpath3, fir.bin), bp_fir); - sof_eq_tplg_write(fullfile(fn.tpath1, fir.tplg1), bp_fir, fir.priv, fir.comment); + sof_tplg_write(fullfile(fn.tpath1, fir.tplg1), bp_fir, fir.priv, fir.comment, howto); bp_fir = sof_eq_fir_blob_pack(bm_fir, 4); % IPC4 - sof_eq_alsactl_write(fullfile(fir.cpath4, fir.txt), bp_fir); + sof_alsactl_write(fullfile(fir.cpath4, fir.txt), bp_fir); sof_ucm_blob_write(fullfile(fir.cpath4, fir.bin), bp_fir); - sof_eq_tplg2_write(fullfile(fir.tpath2, fir.tplg2), bp_fir, 'eq_fir', fir.comment); + sof_tplg2_write(fullfile(fir.tpath2, fir.tplg2), bp_fir, 'eq_fir', fir.comment, howto); end %% Export IIR part @@ -159,13 +160,13 @@ function sof_example_spk_eq() assign_response, ... [ bq_iir ]); bp_iir = sof_eq_iir_blob_pack(bm_iir, 3); % IPC3 - sof_eq_alsactl_write(fullfile(iir.cpath3, iir.txt), bp_iir); + sof_alsactl_write(fullfile(iir.cpath3, iir.txt), bp_iir); sof_ucm_blob_write(fullfile(iir.cpath3, iir.bin), bp_iir); - sof_eq_tplg_write(fullfile(fn.tpath1, iir.tplg1), bp_iir, iir.priv, iir.comment); + sof_tplg_write(fullfile(fn.tpath1, iir.tplg1), bp_iir, iir.priv, iir.comment, howto); bp_iir = sof_eq_iir_blob_pack(bm_iir, 4); % IPC4 - sof_eq_alsactl_write(fullfile(iir.cpath4, iir.txt), bp_iir); + sof_alsactl_write(fullfile(iir.cpath4, iir.txt), bp_iir); sof_ucm_blob_write(fullfile(iir.cpath4, iir.bin), bp_iir); - sof_eq_tplg2_write(fullfile(iir.tpath2, iir.tplg2), bp_iir, 'eq_iir', iir.comment); + sof_tplg2_write(fullfile(iir.tpath2, iir.tplg2), bp_iir, 'eq_iir', iir.comment, howto); end sof_eq_paths(0); diff --git a/src/audio/multiband_drc/tune/sof_example_multiband_drc.m b/src/audio/multiband_drc/tune/sof_example_multiband_drc.m index 2626c1600310..9ebd3ef56b97 100644 --- a/src/audio/multiband_drc/tune/sof_example_multiband_drc.m +++ b/src/audio/multiband_drc/tune/sof_example_multiband_drc.m @@ -39,9 +39,9 @@ function export_multiband_drc(prm) tplg1_fn = sprintf("%s/topology/topology1/m4/multiband_drc_coef_%s.m4", sof_tools, prm.name); % Control Bytes File tplg2_fn = sprintf("%s/topology/topology2/include/components/multiband_drc/%s.conf", sof_tools, prm.name); % Control Bytes File % Use those files with sof-ctl to update the component's configuration -blob3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.blob", sof_tools, prm.name); % Blob binary file +blob3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.bin", sof_tools, prm.name); % Blob binary file alsa3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.txt", sof_tools, prm.name); % ALSA CSV format file -blob4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.blob", sof_tools, prm.name); % Blob binary file +blob4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.bin", sof_tools, prm.name); % Blob binary file alsa4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.txt", sof_tools, prm.name); % ALSA CSV format file endian = "little"; @@ -117,12 +117,12 @@ function export_multiband_drc(prm) deemp_coefs, crossover_coefs, drc_coefs, ... endian, 4); -tplg_write(tplg1_fn, blob8, "MULTIBAND_DRC"); -tplg2_write(tplg2_fn, blob8_ipc4, "multiband_drc_config", "Exported with script sof_example_multiband_drc.m"); +sof_tplg_write(tplg1_fn, blob8, "MULTIBAND_DRC"); +sof_tplg2_write(tplg2_fn, blob8_ipc4, "multiband_drc_config", "Exported with script sof_example_multiband_drc.m"); sof_ucm_blob_write(blob3_fn, blob8); -alsactl_write(alsa3_fn, blob8); +sof_alsactl_write(alsa3_fn, blob8); sof_ucm_blob_write(blob4_fn, blob8_ipc4); -alsactl_write(alsa4_fn, blob8_ipc4); +sof_alsactl_write(alsa4_fn, blob8_ipc4); sof_multiband_drc_paths(false); diff --git a/src/audio/multiband_drc/tune/sof_multiband_drc_build_blob.m b/src/audio/multiband_drc/tune/sof_multiband_drc_build_blob.m index ab3fc063a8ec..520c38e9a2e4 100644 --- a/src/audio/multiband_drc/tune/sof_multiband_drc_build_blob.m +++ b/src/audio/multiband_drc/tune/sof_multiband_drc_build_blob.m @@ -28,7 +28,7 @@ crossover_data_num = numel(crossover_coefs); drc_data_num = numel(fieldnames(drc_coefs(1))) * length(drc_coefs); data_size = 4 * (1 + 1 + 1 + 8 + emp_data_num + deemp_data_num + crossover_data_num + drc_data_num); -[abi_bytes, abi_size] = get_abi(data_size, ipc_ver); +[abi_bytes, abi_size] = sof_get_abi(data_size, ipc_ver); blob_size = data_size + abi_size; blob8 = uint8(zeros(1, blob_size)); diff --git a/src/audio/tdfb/tune/sof_bf_blob_pack.m b/src/audio/tdfb/tune/sof_bf_blob_pack.m index 2717595aa10a..d1e91931f215 100644 --- a/src/audio/tdfb/tune/sof_bf_blob_pack.m +++ b/src/audio/tdfb/tune/sof_bf_blob_pack.m @@ -143,7 +143,7 @@ nbytes_data = nb16 * 2; %% Get ABI information -[abi_bytes, nbytes_abi] = get_abi(nbytes_data, ipc_version); +[abi_bytes, nbytes_abi] = sof_get_abi(nbytes_data, ipc_version); %% Initialize uint8 array with correct size nbytes = nbytes_abi + nbytes_data; diff --git a/src/audio/tdfb/tune/sof_bf_export.m b/src/audio/tdfb/tune/sof_bf_export.m index 874ac6f9f78b..a1856cc2a769 100644 --- a/src/audio/tdfb/tune/sof_bf_export.m +++ b/src/audio/tdfb/tune/sof_bf_export.m @@ -84,16 +84,14 @@ fprintf(1, 'No sof-ctl3 output file specified.\n'); else fprintf(1, 'Exporting to %s\n', bf.sofctl3_fn); - mkdir_check(bf.sofctl3_path); - alsactl_write(bf.sofctl3_fn, bp3); + sof_alsactl_write(bf.sofctl3_fn, bp3); end if isempty(bf.sofctl4_fn) fprintf(1, 'No sof-ctl4 output file specified.\n'); else fprintf(1, 'Exporting to %s\n', bf.sofctl4_fn); - mkdir_check(bf.sofctl4_path); - alsactl_write(bf.sofctl4_fn, bp4); + sof_alsactl_write(bf.sofctl4_fn, bp4); end if isempty(bf.export_note) @@ -106,27 +104,23 @@ fprintf(1, 'No topology1 output file specified.\n'); else fprintf(1, 'Exporting to %s\n', bf.tplg1_fn); - mkdir_check(bf.tplg1_path); - tplg_write(bf.tplg1_fn, bp3, 'DEF_TDFB_PRIV', export_note, bf.export_howto); + sof_tplg_write(bf.tplg1_fn, bp3, 'DEF_TDFB_PRIV', export_note, bf.export_howto); end if isempty(bf.tplg2_fn) fprintf(1, 'No topology2 output file specified.\n'); else fprintf(1, 'Exporting to %s\n', bf.tplg2_fn); - mkdir_check(bf.tplg2_path); - tplg2_write(bf.tplg2_fn, bp4, "tdfb_config", export_note, bf.export_howto); + sof_tplg2_write(bf.tplg2_fn, bp4, "tdfb_config", export_note, bf.export_howto); end if ~isempty(bf.ucmbin3_fn) fprintf(1, 'Exporting to %s\n', bf.ucmbin3_fn); - mkdir_check(bf.sofctl3_path); sof_ucm_blob_write(bf.ucmbin3_fn, bp3); end if ~isempty(bf.ucmbin4_fn) fprintf(1, 'Exporting to %s\n', bf.ucmbin4_fn); - mkdir_check(bf.sofctl4_path); sof_ucm_blob_write(bf.ucmbin4_fn, bp4); end diff --git a/tools/tune/common/alsactl_write.m b/tools/tune/common/sof_alsactl_write.m similarity index 90% rename from tools/tune/common/alsactl_write.m rename to tools/tune/common/sof_alsactl_write.m index 92fa67c3844f..17a3db23f421 100644 --- a/tools/tune/common/alsactl_write.m +++ b/tools/tune/common/sof_alsactl_write.m @@ -1,7 +1,7 @@ -function alsactl_write(fn, blob8) +function sof_alsactl_write(fn, blob8) %% Write blob -check_create_dir(fn); +sof_check_create_dir(fn); fh = fopen(fn, 'w'); if fh < 0 fprintf(1, 'Error: Could not open file %s\n', fn); diff --git a/tools/tune/common/blob_write.m b/tools/tune/common/sof_blob_write.m similarity index 91% rename from tools/tune/common/blob_write.m rename to tools/tune/common/sof_blob_write.m index e13bea505bba..6a71618fb960 100644 --- a/tools/tune/common/blob_write.m +++ b/tools/tune/common/sof_blob_write.m @@ -1,4 +1,4 @@ -function blob_write(fn, blob8) +function sof_blob_write(fn, blob8) %% Write blob diff --git a/tools/tune/common/check_create_dir.m b/tools/tune/common/sof_check_create_dir.m similarity index 90% rename from tools/tune/common/check_create_dir.m rename to tools/tune/common/sof_check_create_dir.m index 9d9ccd7f0e8a..49f4b67c52b0 100644 --- a/tools/tune/common/check_create_dir.m +++ b/tools/tune/common/sof_check_create_dir.m @@ -1,4 +1,4 @@ -function check_create_dir(fn) +function sof_check_create_dir(fn) %% Check path of filename create directory if missing % diff --git a/tools/tune/common/get_abi.m b/tools/tune/common/sof_get_abi.m similarity index 95% rename from tools/tune/common/get_abi.m rename to tools/tune/common/sof_get_abi.m index f00b74d9f141..34ebaa3c8e92 100644 --- a/tools/tune/common/get_abi.m +++ b/tools/tune/common/sof_get_abi.m @@ -1,4 +1,4 @@ -function [bytes, nbytes] = get_abi(setsize, ipc_ver, type, param_id) +function [bytes, nbytes] = sof_get_abi(setsize, ipc_ver, type, param_id) %% Return current SOF ABI header % diff --git a/tools/tune/common/tplg2_write.m b/tools/tune/common/sof_tplg2_write.m similarity index 92% rename from tools/tune/common/tplg2_write.m rename to tools/tune/common/sof_tplg2_write.m index cff82f79f1ca..6322fa136cdd 100644 --- a/tools/tune/common/tplg2_write.m +++ b/tools/tune/common/sof_tplg2_write.m @@ -1,4 +1,4 @@ -function tplg2_write(fn, blob8, component, comment, howto) +function sof_tplg2_write(fn, blob8, component, comment, howto) % SPDX-License-Identifier: BSD-3-Clause % @@ -23,6 +23,7 @@ function tplg2_write(fn, blob8, component, comment, howto) end %% Write blob +sof_check_create_dir(fn); fh = fopen(fn, 'w'); if fh < 0 fprintf(1, 'Error: Could not open file %s\n', fn); diff --git a/tools/tune/common/tplg_write.m b/tools/tune/common/sof_tplg_write.m similarity index 91% rename from tools/tune/common/tplg_write.m rename to tools/tune/common/sof_tplg_write.m index 2834af82a919..358782bd30a7 100644 --- a/tools/tune/common/tplg_write.m +++ b/tools/tune/common/sof_tplg_write.m @@ -1,4 +1,4 @@ -function tplg_write(fn, blob8, name, comment, howto) +function sof_tplg_write(fn, blob8, name, comment, howto) if nargin < 4 comment = 'Exported Control Bytes'; @@ -14,6 +14,7 @@ function tplg_write(fn, blob8, name, comment, howto) blob8_new(1:n_orig) = blob8; %% Write blob +sof_check_create_dir(fn); fh = fopen(fn, 'w'); if fh < 0 fprintf(1, 'Error: Could not open file %s\n', fn); diff --git a/tools/tune/common/sof_ucm_blob_write.m b/tools/tune/common/sof_ucm_blob_write.m index 2a60b0021861..2633c6571013 100644 --- a/tools/tune/common/sof_ucm_blob_write.m +++ b/tools/tune/common/sof_ucm_blob_write.m @@ -23,7 +23,7 @@ function sof_ucm_blob_write(fn, blob8) ublob8(9:end) = blob8; %% Write blob -check_create_dir(fn); +sof_check_create_dir(fn); fh = fopen(fn, 'wb'); if fh < 0 fprintf(1, 'Error: Could not open file %s\n', fn); diff --git a/tools/tune/mfcc/setup_mfcc.m b/tools/tune/mfcc/setup_mfcc.m index 9a1d02335b93..9b27703e98bd 100644 --- a/tools/tune/mfcc/setup_mfcc.m +++ b/tools/tune/mfcc/setup_mfcc.m @@ -70,7 +70,7 @@ function export_mfcc_setup(cfg) sh16 = [0 -8]; %% Get ABI information -[abi_bytes, nbytes_abi] = get_abi(nbytes_data, cfg.ipc_ver); +[abi_bytes, nbytes_abi] = sof_get_abi(nbytes_data, cfg.ipc_ver); %% Initialize correct size uint8 array nbytes = nbytes_abi + nbytes_data; @@ -120,13 +120,13 @@ function export_mfcc_setup(cfg) %% Export switch cfg.tplg_ver case 1 - tplg_write(cfg.tplg_fn, b8, "DEF_MFCC_PRIV", ... - "Exported with script setup_mfcc.m", ... - "cd tools/tune/mfcc; octave setup_mfcc.m"); + sof_tplg_write(cfg.tplg_fn, b8, "DEF_MFCC_PRIV", ... + "Exported with script setup_mfcc.m", ... + "cd tools/tune/mfcc; octave setup_mfcc.m"); case 2 - tplg2_write(cfg.tplg_fn, b8, "mfcc_config", ... - "Exported MFCC configuration", ... - "cd tools/tune/mfcc; octave setup_mfcc.m"); + sof_tplg2_write(cfg.tplg_fn, b8, "mfcc_config", ... + "Exported MFCC configuration", ... + "cd tools/tune/mfcc; octave setup_mfcc.m"); otherwise error("Illegal cfg.tplg_ver, use 1 for topology v1 or 2 topology v2."); end