diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-15 19:40:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch) | |
tree | 98ec96946eeb2ae709cb0528cc6998e21bb9b290 /firmware/drivers/audio | |
parent | 17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff) | |
download | rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip |
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets
Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'firmware/drivers/audio')
-rw-r--r-- | firmware/drivers/audio/mas35xx.c | 285 | ||||
-rw-r--r-- | firmware/drivers/audio/sdl.c | 22 |
2 files changed, 0 insertions, 307 deletions
diff --git a/firmware/drivers/audio/mas35xx.c b/firmware/drivers/audio/mas35xx.c deleted file mode 100644 index 65c582c79c..0000000000 --- a/firmware/drivers/audio/mas35xx.c +++ /dev/null | |||
@@ -1,285 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Driver for MAS35xx audio codec | ||
11 | * | ||
12 | * | ||
13 | * Copyright (c) 2007 by Christian Gmeiner | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | |||
25 | #include "config.h" | ||
26 | #include "system.h" /* MAX MIN macros */ | ||
27 | #include "sound.h" | ||
28 | |||
29 | int channel_configuration = SOUND_CHAN_STEREO; | ||
30 | int stereo_width = 100; | ||
31 | |||
32 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
33 | unsigned long mdb_shape_shadow = 0; | ||
34 | unsigned long loudness_shadow = 0; | ||
35 | unsigned long shadow_io_control_main; | ||
36 | #endif | ||
37 | |||
38 | static void set_channel_config(void) | ||
39 | { | ||
40 | /* default values: stereo */ | ||
41 | unsigned long val_ll = 0x80000; | ||
42 | unsigned long val_lr = 0; | ||
43 | unsigned long val_rl = 0; | ||
44 | unsigned long val_rr = 0x80000; | ||
45 | int bank; | ||
46 | |||
47 | switch(channel_configuration) | ||
48 | { | ||
49 | /* case SOUND_CHAN_STEREO unnecessary */ | ||
50 | |||
51 | case SOUND_CHAN_MONO: | ||
52 | val_ll = 0xc0000; | ||
53 | val_lr = 0xc0000; | ||
54 | val_rl = 0xc0000; | ||
55 | val_rr = 0xc0000; | ||
56 | break; | ||
57 | |||
58 | case SOUND_CHAN_CUSTOM: | ||
59 | { | ||
60 | /* fixed point variables (matching MAS internal format) | ||
61 | integer part: upper 13 bits (inlcuding sign) | ||
62 | fractional part: lower 19 bits */ | ||
63 | long fp_width, fp_straight, fp_cross; | ||
64 | |||
65 | fp_width = (stereo_width << 19) / 100; | ||
66 | if (stereo_width <= 100) | ||
67 | { | ||
68 | fp_straight = - ((1<<19) + fp_width) / 2; | ||
69 | fp_cross = fp_straight + fp_width; | ||
70 | } | ||
71 | else | ||
72 | { | ||
73 | /* straight = - (1 + width) / (2 * width) */ | ||
74 | fp_straight = - ((((1<<19) + fp_width) / (fp_width >> 9)) << 9); | ||
75 | fp_cross = (1<<19) + fp_straight; | ||
76 | } | ||
77 | val_ll = val_rr = fp_straight & 0xfffff; | ||
78 | val_lr = val_rl = fp_cross & 0xfffff; | ||
79 | } | ||
80 | break; | ||
81 | |||
82 | case SOUND_CHAN_MONO_LEFT: | ||
83 | val_ll = 0x80000; | ||
84 | val_lr = 0x80000; | ||
85 | val_rl = 0; | ||
86 | val_rr = 0; | ||
87 | break; | ||
88 | |||
89 | case SOUND_CHAN_MONO_RIGHT: | ||
90 | val_ll = 0; | ||
91 | val_lr = 0; | ||
92 | val_rl = 0x80000; | ||
93 | val_rr = 0x80000; | ||
94 | break; | ||
95 | |||
96 | case SOUND_CHAN_KARAOKE: | ||
97 | val_ll = 0xc0000; | ||
98 | val_lr = 0x40000; | ||
99 | val_rl = 0x40000; | ||
100 | val_rr = 0xc0000; | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
105 | bank = MAS_BANK_D0; | ||
106 | #elif CONFIG_CODEC == MAS3507D | ||
107 | bank = MAS_BANK_D1; | ||
108 | #endif | ||
109 | |||
110 | mas_writemem(bank, MAS_D0_OUT_LL, &val_ll, 1); /* LL */ | ||
111 | mas_writemem(bank, MAS_D0_OUT_LR, &val_lr, 1); /* LR */ | ||
112 | mas_writemem(bank, MAS_D0_OUT_RL, &val_rl, 1); /* RL */ | ||
113 | mas_writemem(bank, MAS_D0_OUT_RR, &val_rr, 1); /* RR */ | ||
114 | } | ||
115 | |||
116 | void audiohw_set_channel(int val) | ||
117 | { | ||
118 | channel_configuration = val; | ||
119 | set_channel_config(); | ||
120 | } | ||
121 | |||
122 | void audiohw_set_stereo_width(int val) | ||
123 | { | ||
124 | stereo_width = val; | ||
125 | if (channel_configuration == SOUND_CHAN_CUSTOM) { | ||
126 | set_channel_config(); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | void audiohw_set_bass(int val) | ||
131 | { | ||
132 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
133 | unsigned tmp = ((unsigned)(val * 8) & 0xff) << 8; | ||
134 | mas_codec_writereg(MAS_REG_KBASS, tmp); | ||
135 | #elif CONFIG_CODEC == MAS3507D | ||
136 | mas_writereg(MAS_REG_KBASS, bass_table[val+15]); | ||
137 | #endif | ||
138 | } | ||
139 | |||
140 | #if CONFIG_CODEC == MAS3507D | ||
141 | void audiohw_set_prescaler(int val) | ||
142 | { | ||
143 | mas_writereg(MAS_REG_KPRESCALE, prescale_table[val/10]); | ||
144 | } | ||
145 | #endif | ||
146 | |||
147 | void audiohw_set_treble(int val) | ||
148 | { | ||
149 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
150 | unsigned tmp = ((unsigned)(val * 8) & 0xff) << 8; | ||
151 | mas_codec_writereg(MAS_REG_KTREBLE, tmp); | ||
152 | #elif CONFIG_CODEC == MAS3507D | ||
153 | mas_writereg(MAS_REG_KTREBLE, treble_table[val+15]); | ||
154 | #endif | ||
155 | } | ||
156 | |||
157 | #if (CONFIG_CODEC == MAS3507D) | ||
158 | /* convert tenth of dB volume (-780..+180) to dac3550 register value */ | ||
159 | static unsigned int tenthdb2reg(int db) | ||
160 | { | ||
161 | if (db < -540) /* 3 dB steps */ | ||
162 | return (db + 780) / 30; | ||
163 | else /* 1.5 dB steps */ | ||
164 | return (db + 660) / 15; | ||
165 | } | ||
166 | |||
167 | void audiohw_set_volume(int vol_l, int vol_r) | ||
168 | { | ||
169 | dac_volume(tenthdb2reg(vol_l), tenthdb2reg(vol_r), false); | ||
170 | } | ||
171 | #endif /* CONFIG_CODEC == MAS3507D */ | ||
172 | |||
173 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
174 | void audiohw_set_volume(int val) | ||
175 | { | ||
176 | unsigned tmp = ((unsigned)(val + 115) & 0xff) << 8; | ||
177 | mas_codec_writereg(MAS_REG_VOLUME_CONTROL, tmp); | ||
178 | } | ||
179 | |||
180 | void audiohw_set_loudness(int value) | ||
181 | { | ||
182 | loudness_shadow = (loudness_shadow & 0x04) | | ||
183 | (MAX(MIN(value * 4, 0x44), 0) << 8); | ||
184 | mas_codec_writereg(MAS_REG_KLOUDNESS, loudness_shadow); | ||
185 | } | ||
186 | |||
187 | void audiohw_set_avc(int value) | ||
188 | { | ||
189 | int tmp; | ||
190 | |||
191 | static const uint16_t avc_vals[] = | ||
192 | { | ||
193 | (0x1 << 8) | (0x8 << 12), /* 20ms */ | ||
194 | (0x2 << 8) | (0x8 << 12), /* 2s */ | ||
195 | (0x4 << 8) | (0x8 << 12), /* 4s */ | ||
196 | (0x8 << 8) | (0x8 << 12), /* 8s */ | ||
197 | }; | ||
198 | switch (value) { | ||
199 | case 1: | ||
200 | case 2: | ||
201 | case 3: | ||
202 | case 4: | ||
203 | tmp = avc_vals[value -1]; | ||
204 | break; | ||
205 | case -1: /* turn off and then turn on again to decay quickly */ | ||
206 | tmp = mas_codec_readreg(MAS_REG_KAVC); | ||
207 | mas_codec_writereg(MAS_REG_KAVC, 0); | ||
208 | break; | ||
209 | default: /* off */ | ||
210 | tmp = 0; | ||
211 | break; | ||
212 | } | ||
213 | mas_codec_writereg(MAS_REG_KAVC, tmp); | ||
214 | } | ||
215 | |||
216 | void audiohw_set_mdb_strength(int value) | ||
217 | { | ||
218 | mas_codec_writereg(MAS_REG_KMDB_STR, (value & 0x7f) << 8); | ||
219 | } | ||
220 | |||
221 | void audiohw_set_mdb_harmonics(int value) | ||
222 | { | ||
223 | int tmp = value * 127 / 100; | ||
224 | mas_codec_writereg(MAS_REG_KMDB_HAR, (tmp & 0x7f) << 8); | ||
225 | } | ||
226 | |||
227 | void audiohw_set_mdb_center(int value) | ||
228 | { | ||
229 | mas_codec_writereg(MAS_REG_KMDB_FC, (value/10) << 8); | ||
230 | } | ||
231 | |||
232 | void audiohw_set_mdb_shape(int value) | ||
233 | { | ||
234 | mdb_shape_shadow = (mdb_shape_shadow & 0x02) | ((value/10) << 8); | ||
235 | mas_codec_writereg(MAS_REG_KMDB_SWITCH, mdb_shape_shadow); | ||
236 | } | ||
237 | |||
238 | void audiohw_set_mdb_enable(int value) | ||
239 | { | ||
240 | mdb_shape_shadow = (mdb_shape_shadow & ~0x02) | (value?2:0); | ||
241 | mas_codec_writereg(MAS_REG_KMDB_SWITCH, mdb_shape_shadow); | ||
242 | } | ||
243 | |||
244 | void audiohw_set_superbass(int value) | ||
245 | { | ||
246 | loudness_shadow = (loudness_shadow & ~0x04) | (value?4:0); | ||
247 | mas_codec_writereg(MAS_REG_KLOUDNESS, loudness_shadow); | ||
248 | } | ||
249 | |||
250 | void audiohw_set_balance(int val) | ||
251 | { | ||
252 | unsigned tmp = ((unsigned)(val * 127 / 100) & 0xff) << 8; | ||
253 | mas_codec_writereg(MAS_REG_BALANCE, tmp); | ||
254 | } | ||
255 | |||
256 | /* This functionality works by telling the decoder that we have another | ||
257 | crystal frequency than we actually have. It will adjust its internal | ||
258 | parameters and the result is that the audio is played at another pitch. | ||
259 | */ | ||
260 | static int32_t last_pitch = PITCH_SPEED_100; | ||
261 | |||
262 | void audiohw_set_pitch(int32_t val) | ||
263 | { | ||
264 | if (val == last_pitch) | ||
265 | return; | ||
266 | |||
267 | /* Calculate the new (bogus) frequency */ | ||
268 | unsigned long reg = 18432 * PITCH_SPEED_100 / val; | ||
269 | mas_writemem(MAS_BANK_D0, MAS_D0_OFREQ_CONTROL, ®, 1); | ||
270 | |||
271 | /* We must tell the MAS that the frequency has changed. | ||
272 | * This will unfortunately cause a short silence. */ | ||
273 | mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, | ||
274 | &shadow_io_control_main, 1); | ||
275 | |||
276 | last_pitch = val; | ||
277 | } | ||
278 | |||
279 | int32_t audiohw_get_pitch(void) | ||
280 | { | ||
281 | return last_pitch; | ||
282 | } | ||
283 | |||
284 | #endif /* CONFIG_CODEC == MAS3587F || CONFIG_CODEC == MAS3539F */ | ||
285 | |||
diff --git a/firmware/drivers/audio/sdl.c b/firmware/drivers/audio/sdl.c index a8fd2ffa07..d701665889 100644 --- a/firmware/drivers/audio/sdl.c +++ b/firmware/drivers/audio/sdl.c | |||
@@ -134,25 +134,3 @@ unsigned int pcm_sampr_to_hw_sampr(unsigned int samplerate, | |||
134 | unsigned int type) | 134 | unsigned int type) |
135 | { return samplerate; (void)type; } | 135 | { return samplerate; (void)type; } |
136 | #endif /* CONFIG_SAMPR_TYPES */ | 136 | #endif /* CONFIG_SAMPR_TYPES */ |
137 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
138 | int mas_codec_readreg(int reg) | ||
139 | { | ||
140 | (void)reg; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | int mas_codec_writereg(int reg, unsigned int val) | ||
145 | { | ||
146 | (void)reg; | ||
147 | (void)val; | ||
148 | return 0; | ||
149 | } | ||
150 | int mas_writemem(int bank, int addr, const unsigned long* src, int len) | ||
151 | { | ||
152 | (void)bank; | ||
153 | (void)addr; | ||
154 | (void)src; | ||
155 | (void)len; | ||
156 | return 0; | ||
157 | } | ||
158 | #endif | ||