summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-10-01 05:25:20 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-10-01 05:25:20 +0000
commit4221a7f22f4cf75f229fa47b6ec43c99c98044d5 (patch)
tree2ae480a8d0ab5c176706d4a6ca552849f28b0f27 /firmware
parent1c36835b807c50587e660568327e73e3067a4356 (diff)
downloadrockbox-4221a7f22f4cf75f229fa47b6ec43c99c98044d5.tar.gz
rockbox-4221a7f22f4cf75f229fa47b6ec43c99c98044d5.tar.bz2
rockbox-4221a7f22f4cf75f229fa47b6ec43c99c98044d5.zip
FS#9157 - Tidy up some MAS35XX constants
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22865 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/audio/mas35xx.c26
-rw-r--r--firmware/export/mas.h25
2 files changed, 32 insertions, 19 deletions
diff --git a/firmware/drivers/audio/mas35xx.c b/firmware/drivers/audio/mas35xx.c
index ae94cbacf0..342d8a3c2e 100644
--- a/firmware/drivers/audio/mas35xx.c
+++ b/firmware/drivers/audio/mas35xx.c
@@ -31,7 +31,7 @@ const struct sound_settings_info audiohw_settings[] = {
[SOUND_VOLUME] = {"dB", 0, 1,-100, 12, -25},
[SOUND_BASS] = {"dB", 0, 1, -12, 12, 6},
[SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 6},
-#else /* MAS3507D */
+#elif CONFIG_CODEC == MAS3507D
[SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18},
[SOUND_BASS] = {"dB", 0, 1, -15, 15, 7},
[SOUND_TREBLE] = {"dB", 0, 1, -15, 15, 7},
@@ -68,6 +68,7 @@ static void set_channel_config(void)
unsigned long val_lr = 0;
unsigned long val_rl = 0;
unsigned long val_rr = 0x80000;
+ int bank;
switch(channel_configuration)
{
@@ -127,16 +128,15 @@ static void set_channel_config(void)
}
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
- mas_writemem(MAS_BANK_D0, MAS_D0_OUT_LL, &val_ll, 1); /* LL */
- mas_writemem(MAS_BANK_D0, MAS_D0_OUT_LR, &val_lr, 1); /* LR */
- mas_writemem(MAS_BANK_D0, MAS_D0_OUT_RL, &val_rl, 1); /* RL */
- mas_writemem(MAS_BANK_D0, MAS_D0_OUT_RR, &val_rr, 1); /* RR */
+ bank = MAS_BANK_D0;
#elif CONFIG_CODEC == MAS3507D
- mas_writemem(MAS_BANK_D1, 0x7f8, &val_ll, 1); /* LL */
- mas_writemem(MAS_BANK_D1, 0x7f9, &val_lr, 1); /* LR */
- mas_writemem(MAS_BANK_D1, 0x7fa, &val_rl, 1); /* RL */
- mas_writemem(MAS_BANK_D1, 0x7fb, &val_rr, 1); /* RR */
+ bank = MAS_BANK_D1;
#endif
+
+ mas_writemem(bank, MAS_D0_OUT_LL, &val_ll, 1); /* LL */
+ mas_writemem(bank, MAS_D0_OUT_LR, &val_lr, 1); /* LR */
+ mas_writemem(bank, MAS_D0_OUT_RL, &val_rl, 1); /* RL */
+ mas_writemem(bank, MAS_D0_OUT_RR, &val_rr, 1); /* RR */
}
void audiohw_set_channel(int val)
@@ -157,7 +157,7 @@ void audiohw_set_bass(int val)
{
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
unsigned tmp = ((unsigned)(val * 8) & 0xff) << 8;
- mas_codec_writereg(0x14, tmp);
+ mas_codec_writereg(MAS_REG_KBASS, tmp);
#elif CONFIG_CODEC == MAS3507D
mas_writereg(MAS_REG_KBASS, bass_table[val+15]);
#endif
@@ -174,7 +174,7 @@ void audiohw_set_treble(int val)
{
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
unsigned tmp = ((unsigned)(val * 8) & 0xff) << 8;
- mas_codec_writereg(0x15, tmp);
+ mas_codec_writereg(MAS_REG_KTREBLE, tmp);
#elif CONFIG_CODEC == MAS3507D
mas_writereg(MAS_REG_KTREBLE, treble_table[val+15]);
#endif
@@ -183,11 +183,11 @@ void audiohw_set_treble(int val)
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
void audiohw_set_volume(int val) {
unsigned tmp = ((unsigned)(val + 115) & 0xff) << 8;
- mas_codec_writereg(0x10, tmp);
+ mas_codec_writereg(MAS_REG_VOLUME_CONTROL, tmp);
}
void audiohw_set_balance(int val) {
unsigned tmp = ((unsigned)(val * 127 / 100) & 0xff) << 8;
- mas_codec_writereg(0x11, tmp);
+ mas_codec_writereg(MAS_REG_BALANCE, tmp);
}
#endif
diff --git a/firmware/export/mas.h b/firmware/export/mas.h
index 493ed6a63c..3cc9d3a34c 100644
--- a/firmware/export/mas.h
+++ b/firmware/export/mas.h
@@ -33,7 +33,8 @@
#define MAS_ADR 0x3c
#define MAS_DEV_WRITE (MAS_ADR | 0x00)
#define MAS_DEV_READ (MAS_ADR | 0x01)
-#else
+
+#elif CONFIG_CODEC == MAS3507D
#define MAS_ADR 0x3a
#define MAS_DEV_WRITE (MAS_ADR | 0x00)
#define MAS_DEV_READ (MAS_ADR | 0x01)
@@ -48,7 +49,8 @@
#define MAS_CONTROL 0x6a
#define MAS_DCCF 0x76
#define MAS_DCFR 0x77
-#else
+
+#elif CONFIG_CODEC == MAS3507D
#define MAS_DATA_WRITE 0x68
#define MAS_DATA_READ 0x69
#define MAS_CONTROL 0x6a
@@ -62,8 +64,6 @@
#define MAS_REG_PIODATA 0xc8
#define MAS_REG_StartUpConfig 0xe6
#define MAS_REG_KPRESCALE 0xe7
-#define MAS_REG_KBASS 0x6b
-#define MAS_REG_KTREBLE 0x6f
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
#define MAS_REG_KMDB_SWITCH 0x21
#define MAS_REG_KMDB_STR 0x22
@@ -74,7 +74,15 @@
#define MAS_REG_QPEAK_R 0x0b
#define MAS_REG_DQPEAK_L 0x0c
#define MAS_REG_DQPEAK_R 0x0d
+#define MAS_REG_VOLUME_CONTROL 0x10
+#define MAS_REG_BALANCE 0x11
#define MAS_REG_KAVC 0x12
+#define MAS_REG_KBASS 0x14
+#define MAS_REG_KTREBLE 0x15
+
+#elif CONFIG_CODEC == MAS3507D
+#define MAS_REG_KBASS 0x6b
+#define MAS_REG_KTREBLE 0x6f
#endif
/*
@@ -90,7 +98,8 @@
#define MAS_CMD_READ_D1_MEM 0xd0
#define MAS_CMD_WRITE_D0_MEM 0xe0
#define MAS_CMD_WRITE_D1_MEM 0xf0
-#else
+
+#elif CONFIG_CODEC == MAS3507D
#define MAS_CMD_READ_ANCILLARY 0x30
#define MAS_CMD_WRITE_REG 0x90
#define MAS_CMD_WRITE_D0_MEM 0xa0
@@ -141,11 +150,15 @@
#define MAS_D0_MPEG_STATUS_2 0xfd2
#define MAS_D0_CRC_ERROR_COUNT 0xfd3
-#else /* MAS3507D */
+#elif CONFIG_CODEC == MAS3507D
#define MAS_D0_MPEG_FRAME_COUNT 0x300
#define MAS_D0_MPEG_STATUS_1 0x301
#define MAS_D0_MPEG_STATUS_2 0x302
#define MAS_D0_CRC_ERROR_COUNT 0x303
+#define MAS_D0_OUT_LL 0x7f8
+#define MAS_D0_OUT_LR 0x7f9
+#define MAS_D0_OUT_RL 0x7fa
+#define MAS_D0_OUT_RR 0x7fb
#endif