src/emu/cpu/sh2/sh2comn.h
| r9224 | r9225 | |
| 14 | 14 | |
| 15 | 15 | #define USE_SH2DRC |
| 16 | 16 | |
| 17 | // do we use a timer for the DMA, or have it in CPU_EXECUTE |
| 18 | //#define USE_TIMER_FOR_DMA |
| 19 | |
| 17 | 20 | #ifdef USE_SH2DRC |
| 18 | 21 | #include "cpu/drcfe.h" |
| 19 | 22 | #include "cpu/drcuml.h" |
| r9224 | r9225 | |
| 184 | 187 | void sh2_recalc_irq(sh2_state *sh2); |
| 185 | 188 | void sh2_set_irq_line(sh2_state *sh2, int irqline, int state); |
| 186 | 189 | void sh2_exception(sh2_state *sh2, const char *message, int irqline); |
| 190 | void sh2_do_dma(sh2_state *sh2, int dma); |
| 187 | 191 | |
| 188 | 192 | #endif /* __SH2COMN_H__ */ |
src/emu/cpu/sh2/sh2comn.c
| r9224 | r9225 | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| 137 | | |
| 138 | 137 | /* |
| 139 | 138 | We have to do DMA on a timer (or at least, in chunks) due to the way some systems use it. |
| 140 | 139 | The 32x is a difficult case, they set the SOURCE of the DMA to a FIFO buffer, which at most |
| r9224 | r9225 | |
| 142 | 141 | because the game is expecting the 68k of the system to feed data into the FIFO at the same |
| 143 | 142 | time as the SH2 is transfering it out via DMA |
| 144 | 143 | |
| 145 | | It might be possible to avoid the timer (which causes a performance hit) by calling this |
| 146 | | from the CPU_EXECUTE loop instead when there is active DMA |
| 144 | There are two ways we can do this |
| 145 | |
| 146 | a) with a high frequency timer (more accurate, but a large performance hit) |
| 147 | |
| 148 | or |
| 149 | |
| 150 | b) in the CPU_EXECUTE loop |
| 151 | |
| 152 | |
| 153 | we're currently doing b) |
| 154 | |
| 147 | 155 | */ |
| 148 | 156 | |
| 149 | | static void sh2_do_dma(sh2_state *sh2, int dma) |
| 157 | |
| 158 | void sh2_do_dma(sh2_state *sh2, int dma) |
| 150 | 159 | { |
| 151 | 160 | UINT32 dmadata; |
| 152 | 161 | |
| r9224 | r9225 | |
| 154 | 163 | |
| 155 | 164 | if (sh2->active_dma_count[dma] > 0) |
| 156 | 165 | { |
| 157 | | // schedule next DMA callback |
| 166 | #ifdef USE_TIMER_FOR_DMA |
| 167 | //schedule next DMA callback |
| 158 | 168 | timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma); |
| 169 | #endif |
| 159 | 170 | |
| 160 | 171 | // process current DMA |
| 161 | 172 | switch(sh2->active_dma_size[dma]) |
| r9224 | r9225 | |
| 393 | 404 | sh2->active_dma_count[dma] &= ~3; |
| 394 | 405 | break; |
| 395 | 406 | } |
| 396 | | |
| 407 | #ifdef USE_TIMER_FOR_DMA |
| 397 | 408 | // start DMA timer |
| 398 | 409 | timer_adjust_oneshot(sh2->dma_current_active_timer[dma], sh2->device->cycles_to_attotime(2), dma); |
| 410 | #endif |
| 399 | 411 | |
| 400 | | |
| 401 | 412 | } |
| 402 | 413 | } |
| 403 | 414 | else |