From 1f77c86322bf6567909da192fdbf6c28c0596a13 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 29 Jun 2011 19:55:38 +0300 Subject: dma: more accurate ICR register handling based on tests on ther real thing. --- libpcsxcore/psxhw.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'libpcsxcore/psxhw.h') diff --git a/libpcsxcore/psxhw.h b/libpcsxcore/psxhw.h index cd4e928..1d1822f 100644 --- a/libpcsxcore/psxhw.h +++ b/libpcsxcore/psxhw.h @@ -57,11 +57,21 @@ extern "C" { #define HW_DMA_PCR (psxHu32ref(0x10f0)) #define HW_DMA_ICR (psxHu32ref(0x10f4)) -#define DMA_INTERRUPT(n) \ - if (SWAPu32(HW_DMA_ICR) & (1 << (16 + n))) { \ - HW_DMA_ICR |= SWAP32(1 << (24 + n)); \ - psxHu32ref(0x1070) |= SWAP32(8); \ - } +#define HW_DMA_ICR_BUS_ERROR (1<<15) +#define HW_DMA_ICR_GLOBAL_ENABLE (1<<23) +#define HW_DMA_ICR_IRQ_SENT (1<<31) + +#define DMA_INTERRUPT(n) { \ + u32 icr = SWAPu32(HW_DMA_ICR); \ + if (icr & (1 << (16 + n))) { \ + icr |= 1 << (24 + n); \ + if (icr & HW_DMA_ICR_GLOBAL_ENABLE && !(icr & HW_DMA_ICR_IRQ_SENT)) { \ + psxHu32ref(0x1070) |= SWAP32(8); \ + icr |= HW_DMA_ICR_IRQ_SENT; \ + } \ + HW_DMA_ICR = SWAP32(icr); \ + } \ +} void psxHwReset(); u8 psxHwRead8(u32 add); -- cgit v1.2.3