added some more support for Audigy 2, untested

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23253 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2008-01-05 14:18:10 +00:00
parent bcdcff768b
commit e470a074e1
4 changed files with 65 additions and 13 deletions

View File

@ -473,6 +473,11 @@ emuxki_channel_commit_fx(emuxki_channel *chan)
uint8 chano = chan->num;
if(IS_AUDIGY(&card->config)) {
emuxki_chan_write(&card->config, chano, 0x4c, 0);
emuxki_chan_write(&card->config, chano, 0x4d, 0);
emuxki_chan_write(&card->config, chano, 0x4e, 0);
emuxki_chan_write(&card->config, chano, 0x4f, 0);
emuxki_chan_write(&card->config, chano, EMU_A_CHAN_FXRT1,
(chan->fxsend.d.dest << 24) |
(chan->fxsend.c.dest << 16) |
@ -1970,6 +1975,20 @@ emuxki_int(void *arg)
emuxki_reg_write_32(&card->config, EMU_IPR, ipr);
}
if(IS_AUDIGY2(&card->config)) {
while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR2))) {
emuxki_reg_write_32(&card->config, EMU_A2_IPR2, ipr);
break; // avoid loop
}
if (card->info.revision == 4) {
while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR3))) {
emuxki_reg_write_32(&card->config, EMU_A2_IPR3, ipr);
break; // avoid loop
}
}
}
if(gotone)
return B_INVOKE_SCHEDULER;
@ -2155,6 +2174,12 @@ emuxki_setup(emuxki_dev * card)
}
emuxki_reg_write_32(&card->config, EMU_INTE, EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE);
if(IS_AUDIGY2(&card->config)) {
emuxki_reg_write_32(&card->config, EMU_A2_INTE2, 0);
if (card->info.revision == 4) {
emuxki_reg_write_32(&card->config, EMU_A2_INTE3, 0);
}
}
PRINT(("installing interrupt : %lx\n", card->config.irq));
install_io_interrupt_handler(card->config.irq, emuxki_int, card, 0);
@ -2654,16 +2679,17 @@ emuxki_init(emuxki_dev * card)
if(IS_AUDIGY2(&card->config)) {
emuxki_chan_write(&card->config, 0, EMU_A2_SPDIF_SAMPLERATE, EMU_A2_SPDIF_UNKNOWN);
emuxki_reg_write_32(&card->config, EMU_A2_PTR, EMU_A2_SRCSEL);
emuxki_reg_write_32(&card->config, EMU_A2_DATA,
emuxki_p16v_write(&card->config, 0, EMU_A2_SRCSEL,
EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI);
if (card->info.revision == 4) {
emuxki_reg_write_32(&card->config, EMU_A2_PTR, EMU_A2_SRCMULTI);
emuxki_reg_write_32(&card->config, EMU_A2_DATA, EMU_A2_SRCMULTI_ENABLE_INPUT);
emuxki_p16v_write(&card->config, 0, EMU_A2_SRCMULTI, EMU_A2_SRCMULTI_ENABLE_INPUT);
} else {
emuxki_reg_write_32(&card->config, EMU_A2_PTR, EMU_A2_SRCMULTI2);
emuxki_reg_write_32(&card->config, EMU_A2_DATA, EMU_A2_SRCMULTI2_ENABLE_INPUT);
emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_I2S, EMU_A2_P17V_I2S_ENABLE);
emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_SPDIF, EMU_A2_P17V_SPDIF_ENABLE);
emuxki_reg_write_32(&card->config, EMU_A_IOCFG,
emuxki_reg_read_32(&card->config, EMU_A_IOCFG) & ~0x8);
}
}

View File

@ -189,14 +189,21 @@
#define EMU_A2_PTR 0x20
#define EMU_A2_DATA 0x24
#define EMU_A2_IPR2 0x28
#define EMU_A2_INTE2 0x2c
#define EMU_A2_HCFG2 0x34
#define EMU_A2_IPR3 0x38
#define EMU_A2_INTE3 0x3c
#define EMU_A2_SRCSEL 0x600000
#define EMU_A2_SRCSEL 0x60
#define EMU_A2_SRCSEL_ENABLE_SPDIF 0x00000004
#define EMU_A2_SRCSEL_ENABLE_SRCMULTI 0x00000010
#define EMU_A2_SRCMULTI 0x6e0000
#define EMU_A2_SRCMULTI 0x6e
#define EMU_A2_SRCMULTI_ENABLE_INPUT 0xff00ff00
#define EMU_A2_SRCMULTI2 0x7b0000
#define EMU_A2_SRCMULTI2_ENABLE_INPUT 0xff000000
#define EMU_A2_P17V_SPDIF 0x7a
#define EMU_A2_P17V_SPDIF_ENABLE 0xff000000
#define EMU_A2_P17V_I2S 0x7b
#define EMU_A2_P17V_I2S_ENABLE 0xff000000
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

View File

@ -226,3 +226,19 @@ emuxki_inte_disable(device_config *config, uint32 value)
emuxki_reg_write_32(config, EMU_INTE,
emuxki_reg_read_32(config, EMU_INTE) & ~value);
}
/* p16v */
uint32
emuxki_p16v_read(device_config *config, uint16 chano, uint16 reg)
{
emuxki_reg_write_32(config, EMU_A2_PTR, reg << 16 | chano);
return emuxki_reg_read_32(config, EMU_A2_DATA);
}
void
emuxki_p16v_write(device_config *config, uint16 chano, uint16 reg, uint32 data)
{
emuxki_reg_write_32(config, EMU_A2_PTR, reg << 16 | chano);
emuxki_reg_write_32(config, EMU_A2_DATA, data);
}

View File

@ -58,4 +58,7 @@ void emuxki_codec_write(device_config *config, int regno, uint16 value);
void emuxki_inte_enable(device_config *config, uint32 value);
void emuxki_inte_disable(device_config *config, uint32 value);
uint32 emuxki_p16v_read(device_config *config, uint16 chano, uint16 reg);
void emuxki_p16v_write(device_config *config, uint16 chano, uint16 reg, uint32 data);
#endif