void mdec0Interrupt()
{
- HW_DMA0_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(0);
+ if (HW_DMA0_CHCR & SWAP32(0x01000000))
+ {
+ HW_DMA0_CHCR &= SWAP32(~0x01000000);
+ DMA_INTERRUPT(0);
+ }
}
#define SIZE_OF_24B_BLOCK (16*16*3)
*
*/
- /* this else if avoid to read outside memory */
- if(mdec.rl >= mdec.rl_end) {
- mdec.reg1 &= ~MDEC1_STP;
- HW_DMA0_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(0);
- mdec.reg1 &= ~MDEC1_BUSY;
- } else if (SWAP16(*(mdec.rl)) == MDEC_END_OF_DATA) {
- mdec.reg1 &= ~MDEC1_STP;
- HW_DMA0_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(0);
- mdec.reg1 &= ~MDEC1_BUSY;
+ /* MDEC_END_OF_DATA avoids read outside memory */
+ if (mdec.rl >= mdec.rl_end || SWAP16(*(mdec.rl)) == MDEC_END_OF_DATA) {
+ mdec.reg1 &= ~(MDEC1_STP|MDEC1_BUSY);
+ if (HW_DMA0_CHCR & SWAP32(0x01000000))
+ {
+ HW_DMA0_CHCR &= SWAP32(~0x01000000);
+ DMA_INTERRUPT(0);
+ }
}
- HW_DMA1_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(1);
- return;
+ if (HW_DMA1_CHCR & SWAP32(0x01000000))
+ {
+ HW_DMA1_CHCR &= SWAP32(~0x01000000);
+ DMA_INTERRUPT(1);
+ }
}
int mdecFreeze(gzFile f, int Mode) {
// Dma3 in CdRom.c
void spuInterrupt() {
- HW_DMA4_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(4);
+ if (HW_DMA4_CHCR & SWAP32(0x01000000))
+ {
+ HW_DMA4_CHCR &= SWAP32(~0x01000000);
+ DMA_INTERRUPT(4);
+ }
}
void psxDma4(u32 madr, u32 bcr, u32 chcr) { // SPU
}
void gpuInterrupt() {
- HW_DMA2_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(2);
+ if (HW_DMA2_CHCR & SWAP32(0x01000000))
+ {
+ HW_DMA2_CHCR &= SWAP32(~0x01000000);
+ DMA_INTERRUPT(2);
+ }
}
void psxDma6(u32 madr, u32 bcr, u32 chcr) {
void gpuotcInterrupt()
{
- HW_DMA6_CHCR &= SWAP32(~0x01000000);
- DMA_INTERRUPT(6);
+ if (HW_DMA6_CHCR & SWAP32(0x01000000))
+ {
+ HW_DMA6_CHCR &= SWAP32(~0x01000000);
+ DMA_INTERRUPT(6);
+ }
}