summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-28 11:46:27 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-28 11:46:27 +0000
commitfce2a2898244a10f8155fd3cae52e8ac2be1c8a6 (patch)
tree577c878ce9aefc5abfcd96c423d709bb7079e856 /firmware/mpeg.c
parent5c682fb0cd23be43613961fedef59c9184b07cc2 (diff)
downloadrockbox-fce2a2898244a10f8155fd3cae52e8ac2be1c8a6.tar.gz
rockbox-fce2a2898244a10f8155fd3cae52e8ac2be1c8a6.zip
Hopefully fixed distortion and pitch problems on Player versions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1478 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 893ffe5dcb..6eaa6d5cfc 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1239,14 +1239,16 @@ int mpeg_val2phys(int setting, int value)
1239 return result; 1239 return result;
1240} 1240}
1241 1241
1242static unsigned long mas_version_code;
1243
1242void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, int avc) 1244void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, int avc)
1243{ 1245{
1244#ifdef SIMULATOR 1246#ifdef SIMULATOR
1245 volume = bass = treble = loudness = bass_boost = avc; 1247 volume = bass = treble = loudness = bass_boost = avc;
1246#else 1248#else
1249 unsigned long val;
1247#ifdef ARCHOS_RECORDER 1250#ifdef ARCHOS_RECORDER
1248 int rc; 1251 int rc;
1249 unsigned long val;
1250#else 1252#else
1251 loudness = bass_boost = avc; 1253 loudness = bass_boost = avc;
1252#endif 1254#endif
@@ -1292,7 +1294,35 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i
1292#ifndef ARCHOS_RECORDER 1294#ifndef ARCHOS_RECORDER
1293 mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */ 1295 mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */
1294 mas_run(1); 1296 mas_run(1);
1295 sleep(HZ/10); 1297 sleep(HZ);
1298
1299 mas_readmem(MAS_BANK_D1, 0xff7, &mas_version_code, 1);
1300
1301 /* Clear the upper 12 bits of the 32-bit samples */
1302 mas_writereg(0xc5, 0);
1303 mas_writereg(0xc6, 0);
1304
1305 /* We need to set the PLL for a 14.1318MHz crystal */
1306 if(mas_version_code == 0x0601) /* Version F10? */
1307 {
1308 val = 0x5d9e8;
1309 mas_writemem(MAS_BANK_D0, 0x32d, &val, 1);
1310 val = 0xfffceb8d;
1311 mas_writemem(MAS_BANK_D0, 0x32e, &val, 1);
1312 val = 0x0;
1313 mas_writemem(MAS_BANK_D0, 0x32f, &val, 1);
1314 mas_run(0x475);
1315 }
1316 else
1317 {
1318 val = 0x5d9e8;
1319 mas_writemem(MAS_BANK_D0, 0x36d, &val, 1);
1320 val = 0xfffceb8d;
1321 mas_writemem(MAS_BANK_D0, 0x36e, &val, 1);
1322 val = 0x0;
1323 mas_writemem(MAS_BANK_D0, 0x36f, &val, 1);
1324 mas_run(0xfcb);
1325 }
1296#endif 1326#endif
1297 1327
1298 mp3buflen = mp3end - mp3buf; 1328 mp3buflen = mp3end - mp3buf;
@@ -1307,6 +1337,10 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i
1307#ifndef ARCHOS_RECORDER 1337#ifndef ARCHOS_RECORDER
1308 mas_writereg(MAS_REG_KPRESCALE, 0xe9400); 1338 mas_writereg(MAS_REG_KPRESCALE, 0xe9400);
1309 dac_config(0x04); /* DAC on, all else off */ 1339 dac_config(0x04); /* DAC on, all else off */
1340
1341 val = 0x80000;
1342 mas_writemem(MAS_BANK_D1, 0x7f8, &val, 1);
1343 mas_writemem(MAS_BANK_D1, 0x7fb, &val, 1);
1310#endif 1344#endif
1311 1345
1312 mpeg_sound_set(SOUND_BASS, bass); 1346 mpeg_sound_set(SOUND_BASS, bass);