#16284 - doudou - Wed Feb 11, 2004 7:24 pm
We are 2 developer on a project. We have few weeks of development and so far, i did the graphic stuffs and the other guy did the audio stuff. We tried to merge our code and we have some major issues, like nothing works anymore. The problem seems to come from the dma. If in my code I put the "problematic line" (see below) in comment, we at least have the sound
void DMAFastCopy(const void* source,void* dest,unsigned int REG_DMA3SAD = (unsigned int)source;
REG_DMA3DAD = (unsigned int)dest;
REG_DMA3CNT = count | mode; // problematic line
}
#16286 - doudou - Wed Feb 11, 2004 7:53 pm
we have this code inspired from Jonathan Harbour's book :
void GBASound::enable_interrupt(void)
{
REG_IME = INT_DISABLE;
REG_INTERRUPT = (u32) &sound_handler;
REG_IE = INT_VBLANK;
REG_DISPSTAT = STS_ENABLE_VB;
REG_IME = INT_ENABLE;
}
we don't know what the line REG_DISPSTAT = STS_ENABLE_VB; is doing, but when we remove it, it seems to work.
#define REG_DISPSTAT *(u16*) 0x04000004 // Interrupt status register
#define STS_ENABLE_VB 0x0008 // Enable vertical blank
#16289 - poslundc - Wed Feb 11, 2004 8:23 pm
How does your mixing routine get called? The REG_DISPSTAT line is what enables the VBlank interrupt, so if it works when you turn that line off it means that you must be calling your mix routine from some other spot in the code, because you're not generating an interrupt without it.
It seems like your problem may be rooted in interrupt handling in general. Does the code you're combining with the mixer use interrupts at all? Are you certain you're handling all of your interrupts properly, and setting the acknowledge bits at the end of each ISR?
Dan.