|
|
| version 1.9, 2004/03/06 18:25:36 | version 1.13, 2007/11/03 00:00:20 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "cpucore.h" | |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "sound.h" | #include "sound.h" |
| Line 32 static const DMAPROC dmaproc[] = { | Line 33 static const DMAPROC dmaproc[] = { |
| {dma_dummyout, dma_dummyin, dma_dummyproc}, // SASI | {dma_dummyout, dma_dummyin, dma_dummyproc}, // SASI |
| #endif | #endif |
| {dma_dummyout, dma_dummyin, dma_dummyproc}, // SCSI | {dma_dummyout, dma_dummyin, dma_dummyproc}, // SCSI |
| #if !defined(DISABLE_SOUND) | |
| {dma_dummyout, dma_dummyin, cs4231dmafunc}, // CS4231 | {dma_dummyout, dma_dummyin, cs4231dmafunc}, // CS4231 |
| #else | |
| {dma_dummyout, dma_dummyin, dma_dummyproc}, // SASI | |
| #endif | |
| }; | }; |
| Line 52 void dmac_check(void) { | Line 57 void dmac_check(void) { |
| if (!(dmac.work & bit)) { | if (!(dmac.work & bit)) { |
| dmac.work |= bit; | dmac.work |= bit; |
| if (ch->proc.extproc(DMAEXT_START)) { | if (ch->proc.extproc(DMAEXT_START)) { |
| dmac.stat &= ~bit; // ver0.27 | dmac.stat &= ~bit; |
| dmac.working |= bit; | dmac.working |= bit; |
| workchg = TRUE; | workchg = TRUE; |
| } | } |
| Line 74 void dmac_check(void) { | Line 79 void dmac_check(void) { |
| } | } |
| } | } |
| UINT dmac_getdatas(DMACH dmach, UINT8 *buf, UINT size) { | |
| UINT leng; | |
| UINT32 addr; | |
| UINT i; | |
| leng = min(dmach->leng.w, size); | |
| if (leng) { | |
| addr = dmach->adrs.d; // + mask | |
| if (!(dmach->mode & 0x20)) { // dir + | |
| for (i=0; i<leng; i++) { | |
| buf[i] = MEMP_READ8(addr + i); | |
| } | |
| dmach->adrs.d += leng; | |
| } | |
| else { // dir - | |
| for (i=0; i<leng; i++) { | |
| buf[i] = MEMP_READ8(addr - i); | |
| } | |
| dmach->adrs.d -= leng; | |
| } | |
| dmach->leng.w -= leng; | |
| if (dmach->leng.w == 0) { | |
| dmach->proc.extproc(DMAEXT_END); | |
| } | |
| } | |
| return(leng); | |
| } | |
| // ---- I/O | // ---- I/O |
| Line 218 static const IOOUT dmaco21[8] = { | Line 252 static const IOOUT dmaco21[8] = { |
| dmac_o21, dmac_o21, dmac_o21, dmac_o21, | dmac_o21, dmac_o21, dmac_o21, dmac_o21, |
| dmac_o29, NULL, NULL, NULL}; | dmac_o29, NULL, NULL, NULL}; |
| void dmac_reset(void) { | void dmac_reset(const NP2CFG *pConfig) { |
| ZeroMemory(&dmac, sizeof(dmac)); | ZeroMemory(&dmac, sizeof(dmac)); |
| dmac.lh = DMA16_LOW; | dmac.lh = DMA16_LOW; |
| dmac.mask = 0xf; | dmac.mask = 0xf; |
| dmac_procset(); | dmac_procset(); |
| // TRACEOUT(("sizeof(_DMACH) = %d", sizeof(_DMACH))); | // TRACEOUT(("sizeof(_DMACH) = %d", sizeof(_DMACH))); |
| (void)pConfig; | |
| } | } |
| void dmac_bind(void) { | void dmac_bind(void) { |
| Line 252 static void dmacset(REG8 channel) { | Line 288 static void dmacset(REG8 channel) { |
| } | } |
| dev++; | dev++; |
| } | } |
| if (dmadev >= sizeof(dmaproc) / sizeof(DMAPROC)) { | if (dmadev >= NELEMENTS(dmaproc)) { |
| dmadev = 0; | dmadev = 0; |
| } | } |
| // TRACEOUT(("dmac set %d - %d", channel, dmadev)); | // TRACEOUT(("dmac set %d - %d", channel, dmadev)); |
| Line 272 void dmac_attach(REG8 device, REG8 chann | Line 308 void dmac_attach(REG8 device, REG8 chann |
| dmac_detach(device); | dmac_detach(device); |
| if (dmac.devices < (sizeof(dmac.device) / sizeof(DMADEV))) { | if (dmac.devices < NELEMENTS(dmac.device)) { |
| dmac.device[dmac.devices].device = device; | dmac.device[dmac.devices].device = device; |
| dmac.device[dmac.devices].channel = channel; | dmac.device[dmac.devices].channel = channel; |
| dmac.devices++; | dmac.devices++; |