From 6e794c9a2d9e91a926f70d0fcc66e255b0bdc221 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 3 Dec 2022 15:33:15 +0000 Subject: rbcodec dsp: Refactor DSP init routines, restore INIT_ATTR Refactor DSP init routines so there is a dedicated init function for the stages that need it. Remove the DSP_INIT configure message. This allows the init code to be safely marked INIT_ATTR, saving a bit of code size, and allowing the linker to verify that there are no unsafe references to the init routines. Change-Id: I1702f0f579bbb300a6fe7d0e67b13aa2e9dd7f8a --- lib/rbcodec/dsp/dsp_sample_io.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/rbcodec/dsp/dsp_sample_io.c') diff --git a/lib/rbcodec/dsp/dsp_sample_io.c b/lib/rbcodec/dsp/dsp_sample_io.c index af3a424aa0..8a0d5da7cc 100644 --- a/lib/rbcodec/dsp/dsp_sample_io.c +++ b/lib/rbcodec/dsp/dsp_sample_io.c @@ -36,6 +36,13 @@ static void format_change_set(struct sample_io_data *this) this->format_dirty = 1; } +void dsp_sample_io_init(struct sample_io_data *this, unsigned int dsp_id) +{ + this->output_sampr = DSP_OUT_DEFAULT_HZ; + dsp_sample_input_init(this, dsp_id); + dsp_sample_output_init(this); +} + bool dsp_sample_io_configure(struct sample_io_data *this, unsigned int setting, intptr_t *value_p) @@ -44,12 +51,6 @@ bool dsp_sample_io_configure(struct sample_io_data *this, switch (setting) { - case DSP_INIT: - this->output_sampr = DSP_OUT_DEFAULT_HZ; - dsp_sample_input_init(this, value); - dsp_sample_output_init(this); - break; - case DSP_RESET: /* Reset all sample descriptions to default */ format_change_set(this); -- cgit v1.2.3