static void gdsp_do_dma() { u32 addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL]; u16 ctl = g_dsp.ifx_regs[DSP_DSCR]; u16 dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2; u16 len = g_dsp.ifx_regs[DSP_DSBL]; if (len > 0x4000) { ERROR_LOG(DSPLLE, "DMA ERROR: PC: %04x, Control: %04x, Address: %08x, DSP Address: %04x, Size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len); exit(0); } #if defined(_DEBUG) || defined(DEBUGFAST) DEBUG_LOG(DSPLLE, "DMA pc: %04x, Control: %04x, Address: %08x, DSP Address: %04x, Size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len); #endif const u8* copied_data_ptr = nullptr; switch (ctl & 0x3) { case (DSP_CR_DMEM | DSP_CR_TO_CPU): copied_data_ptr = gdsp_ddma_out(dsp_addr, addr, len); break; case (DSP_CR_DMEM | DSP_CR_FROM_CPU): copied_data_ptr = gdsp_ddma_in(dsp_addr, addr, len); break; case (DSP_CR_IMEM | DSP_CR_TO_CPU): copied_data_ptr = gdsp_idma_out(dsp_addr, addr, len); break; case (DSP_CR_IMEM | DSP_CR_FROM_CPU): copied_data_ptr = gdsp_idma_in(dsp_addr, addr, len); break; } if (copied_data_ptr) g_dsp_cap->LogDMA(ctl, addr, dsp_addr, len, copied_data_ptr); }
static void gdsp_do_dma() { u16 ctl; u32 addr; u16 dsp_addr; u16 len; addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL]; ctl = g_dsp.ifx_regs[DSP_DSCR]; dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2; len = g_dsp.ifx_regs[DSP_DSBL]; if (len > 0x4000) { ERROR_LOG(DSPLLE, "DMA ERROR pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len); exit(0); } #if defined(_DEBUG) || defined(DEBUGFAST) DEBUG_LOG(DSPLLE, "DMA pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len); #endif switch (ctl & 0x3) { case (DSP_CR_DMEM | DSP_CR_TO_CPU): gdsp_ddma_out(dsp_addr, addr, len); break; case (DSP_CR_DMEM | DSP_CR_FROM_CPU): gdsp_ddma_in(dsp_addr, addr, len); break; case (DSP_CR_IMEM | DSP_CR_TO_CPU): gdsp_idma_out(dsp_addr, addr, len); break; case (DSP_CR_IMEM | DSP_CR_FROM_CPU): gdsp_idma_in(dsp_addr, addr, len); break; } }