summaryrefslogtreecommitdiff
path: root/lib/rbcodec/dsp/dsp_sample_io.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-12-03 15:33:15 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-12-23 12:47:10 -0500
commit6e794c9a2d9e91a926f70d0fcc66e255b0bdc221 (patch)
tree3a0d1371a0a259f2ed761e5db871064867b2a7ce /lib/rbcodec/dsp/dsp_sample_io.c
parent34a092a99729dd4de014aa1f76c48660f28a9c97 (diff)
downloadrockbox-6e794c9a2d9e91a926f70d0fcc66e255b0bdc221.tar.gz
rockbox-6e794c9a2d9e91a926f70d0fcc66e255b0bdc221.zip
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
Diffstat (limited to 'lib/rbcodec/dsp/dsp_sample_io.c')
-rw-r--r--lib/rbcodec/dsp/dsp_sample_io.c13
1 files changed, 7 insertions, 6 deletions
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)
36 this->format_dirty = 1; 36 this->format_dirty = 1;
37} 37}
38 38
39void dsp_sample_io_init(struct sample_io_data *this, unsigned int dsp_id)
40{
41 this->output_sampr = DSP_OUT_DEFAULT_HZ;
42 dsp_sample_input_init(this, dsp_id);
43 dsp_sample_output_init(this);
44}
45
39bool dsp_sample_io_configure(struct sample_io_data *this, 46bool dsp_sample_io_configure(struct sample_io_data *this,
40 unsigned int setting, 47 unsigned int setting,
41 intptr_t *value_p) 48 intptr_t *value_p)
@@ -44,12 +51,6 @@ bool dsp_sample_io_configure(struct sample_io_data *this,
44 51
45 switch (setting) 52 switch (setting)
46 { 53 {
47 case DSP_INIT:
48 this->output_sampr = DSP_OUT_DEFAULT_HZ;
49 dsp_sample_input_init(this, value);
50 dsp_sample_output_init(this);
51 break;
52
53 case DSP_RESET: 54 case DSP_RESET:
54 /* Reset all sample descriptions to default */ 55 /* Reset all sample descriptions to default */
55 format_change_set(this); 56 format_change_set(this);