all repos — mgba @ 1856b77cbcc9a6c6d5bb24665e79d77a4ebff734

mGBA Game Boy Advance Emulator

GBA Audio: Force audio FIFOs to 32-bit
Jeffrey Pfau jeffrey@endrift.com
Mon, 06 Apr 2015 02:34:21 -0700
commit

1856b77cbcc9a6c6d5bb24665e79d77a4ebff734

parent

cda804656b37925c35f2347be7b057fe2787f076

4 files changed, 4 insertions(+), 36 deletions(-)

jump to
M CHANGESCHANGES

@@ -11,6 +11,7 @@ - Qt: Fix .deb dependencies

- GBA Audio: FIFOs should not poll DMAs that are not scheduled for audio - Qt: Fix "QOpenGLContext::swapBuffers() called with non-exposed window" warning - ARM7: Fix SWI and IRQ timings + - GBA Audio: Force audio FIFOs to 32-bit 0.2.0: (2015-04-03) Features:
M src/gba/audio.csrc/gba/audio.c

@@ -487,30 +487,6 @@ }

} } -void GBAAudioWriteFIFO16(struct GBAAudio* audio, int address, uint16_t value) { - struct CircleBuffer* fifo; - switch (address) { - case REG_FIFO_A_LO: - case REG_FIFO_A_HI: - fifo = &audio->chA.fifo; - break; - case REG_FIFO_B_LO: - case REG_FIFO_B_HI: - fifo = &audio->chB.fifo; - break; - default: - GBALog(audio->p, GBA_LOG_ERROR, "Bad FIFO write to address 0x%03x", address); - return; - } - int i; - for (i = 0; i < 2; ++i) { - while (!CircleBufferWrite8(fifo, value >> (8 * i))) { - int8_t dummy; - CircleBufferRead8(fifo, &dummy); - } - } -} - void GBAAudioSampleFIFO(struct GBAAudio* audio, int fifoId, int32_t cycles) { struct GBAAudioFIFO* channel; if (fifoId == 0) {

@@ -526,6 +502,7 @@ struct GBADMA* dma = &audio->p->memory.dma[channel->dmaSource];

if (GBADMARegisterGetTiming(dma->reg) == DMA_TIMING_CUSTOM) { dma->nextCount = 4; dma->nextEvent = 0; + dma->reg = GBADMARegisterSetWidth(dma->reg, 1); GBAMemoryUpdateDMAs(audio->p, -cycles); } else { channel->dmaSource = 0;
M src/gba/audio.hsrc/gba/audio.h

@@ -272,7 +272,6 @@ void GBAAudioWriteSOUNDCNT_X(struct GBAAudio* audio, uint16_t value);

void GBAAudioWriteSOUNDBIAS(struct GBAAudio* audio, uint16_t value); void GBAAudioWriteWaveRAM(struct GBAAudio* audio, int address, uint32_t value); -void GBAAudioWriteFIFO16(struct GBAAudio* audio, int address, uint16_t value); void GBAAudioWriteFIFO(struct GBAAudio* audio, int address, uint32_t value); void GBAAudioSampleFIFO(struct GBAAudio* audio, int fifoId, int32_t cycles);
M src/gba/io.csrc/gba/io.c

@@ -366,23 +366,14 @@ case REG_WAVE_RAM3_HI:

GBAIOWrite32(gba, address - 2, gba->memory.io[(address >> 1) - 1] | (value << 16)); break; - // TODO: Confirm this behavior on real hardware case REG_FIFO_A_LO: case REG_FIFO_B_LO: - if (gba->performingDMA) { - GBAAudioWriteFIFO16(&gba->audio, address, value); - } else { - GBAIOWrite32(gba, address, (gba->memory.io[(address >> 1) + 1] << 16) | value); - } + GBAIOWrite32(gba, address, (gba->memory.io[(address >> 1) + 1] << 16) | value); break; case REG_FIFO_A_HI: case REG_FIFO_B_HI: - if (gba->performingDMA) { - GBAAudioWriteFIFO16(&gba->audio, address, value); - } else { - GBAIOWrite32(gba, address - 2, gba->memory.io[(address >> 1) - 1] | (value << 16)); - } + GBAIOWrite32(gba, address - 2, gba->memory.io[(address >> 1) - 1] | (value << 16)); break; // DMA