1function eq_tplg_write(fn, blob8, priv, comment) 2 3% SPDX-License-Identifier: BSD-3-Clause 4% 5% Copyright (c) 2018-2020, Intel Corporation. All rights reserved. 6% 7% Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> 8 9if nargin < 4 10 comment = 'Exported EQ'; 11end 12 13%% Check that blob length is multiple of 32 bits 14n_blob = length(blob8); 15n_test = ceil(n_blob/4)*4; 16if (n_blob ~= n_test) 17 fprintf(1, 'Error: ´Blob length %d is not multiple of 32 bits\n', ... 18 n_blob); 19 error('Failed.'); 20end 21 22%% Write blob 23fh = fopen(fn, 'w'); 24nl = 8; 25fprintf(fh, '# %s %s\n', comment, date()); 26fprintf(fh, 'CONTROLBYTES_PRIV(%s,\n', priv); 27fprintf(fh, '` bytes "'); 28for i = 1:nl:n_blob 29 if i > 1 30 fprintf(fh, '` '); 31 end 32 for j = 0:nl-1 33 n = i + j; 34 if n < n_blob 35 fprintf(fh, '0x%02x,', blob8(n)); 36 end 37 if n == n_blob 38 fprintf(fh, '0x%02x"', blob8(n)); 39 end 40 end 41 fprintf(fh, '''\n'); 42end 43fprintf(fh, ')\n'); 44fclose(fh); 45fprintf('Blob size %d was written to file %s\n', n_blob, fn); 46 47end 48