First attempt at adding sound interrupt logic

This commit is contained in:
dingusdev
2026-01-02 21:15:37 -07:00
parent 10be145179
commit e97da11386
+12 -2
View File
@@ -320,9 +320,9 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
return;
case AMICReg::Snd_In_Ctrl:
LOG_F(WARNING, "Snd In Ctrl - SndIn Enable: 0x%x", value & 0x80);
LOG_F(WARNING, "Snd In Ctrl - Subframe Out: 0x%x", value & 0x3C);
LOG_F(WARNING, "Snd In Ctrl - Subframe In: 0x%x", value & 0x03);
if ((value & 0x80) && !(this->snd_in_ctrl & 0x80)){
LOG_F(WARNING, "Snd In Ctrl - Subframe Out: 0x%x", value & 0x3C);
LOG_F(WARNING, "Snd In Ctrl - Subframe In: 0x%x", value & 0x03);
this->snd_in_dma->init(this->dma_base & ~0x3FFFF, this->snd_buf_size);
this->snd_in_dma->enable();
this->awacs->set_sample_rate((this->snd_out_ctrl >> 1) & 3);
@@ -332,6 +332,15 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
this->snd_in_dma->disable();
this->awacs->dma_in_pause();
}
if (value & 0x40) {
this->via2_ifr |= 0x10;
this->ack_via2_int(VIA2_INT_SOUND, 0);
}
else {
this->via2_ifr |= 0x10;
this->ack_via2_int(VIA2_INT_SOUND, 1);
}
this->snd_in_ctrl = value;
return;
case AMICReg::Snd_Out_DMA:
@@ -355,6 +364,7 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
}
break;
case AMICReg::VIA2_IFR:
case AMICReg::VIA2_IFR_RBV:
// if bit 7 is set, clear the corresponding IRQ bit for each "1" in value
// writing any value to VIA2_IFR with bit 7 cleared has no effect
if (value & 0x80) {