diff options
Diffstat (limited to 'src/devices/cpu/psx/dma.h')
-rw-r--r-- | src/devices/cpu/psx/dma.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/devices/cpu/psx/dma.h b/src/devices/cpu/psx/dma.h index eeb68ac0161..ba10e80903c 100644 --- a/src/devices/cpu/psx/dma.h +++ b/src/devices/cpu/psx/dma.h @@ -7,42 +7,30 @@ * */ -#pragma once +#ifndef MAME_CPU_PSX_DMA_H +#define MAME_CPU_PSX_DMA_H -#ifndef __PSXDMA_H__ -#define __PSXDMA_H__ +#pragma once -extern const device_type PSX_DMA; +DECLARE_DEVICE_TYPE(PSX_DMA, psxdma_device) #define MCFG_PSX_DMA_IRQ_HANDLER(_devcb) \ devcb = &psxdma_device::set_irq_handler(*device, DEVCB_##_devcb); -typedef delegate<void (uint32_t *, uint32_t, int32_t)> psx_dma_read_delegate; -typedef delegate<void (uint32_t *, uint32_t, int32_t)> psx_dma_write_delegate; - -struct psx_dma_channel -{ - uint32_t n_base; - uint32_t n_blockcontrol; - uint32_t n_channelcontrol; - emu_timer *timer; - psx_dma_read_delegate fn_read; - psx_dma_write_delegate fn_write; - uint32_t n_ticks; - uint32_t b_running; -}; - class psxdma_device : public device_t { public: + typedef delegate<void (uint32_t *, uint32_t, int32_t)> read_delegate; + typedef delegate<void (uint32_t *, uint32_t, int32_t)> write_delegate; + psxdma_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // static configuration helpers template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<psxdma_device &>(device).m_irq_handler.set_callback(object); } - void install_read_handler( int n_channel, psx_dma_read_delegate p_fn_dma_read ); - void install_write_handler( int n_channel, psx_dma_read_delegate p_fn_dma_write ); + void install_read_handler( int n_channel, read_delegate p_fn_dma_read ); + void install_write_handler( int n_channel, write_delegate p_fn_dma_write ); DECLARE_WRITE32_MEMBER( write ); DECLARE_READ32_MEMBER( read ); @@ -57,6 +45,18 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: + struct psx_dma_channel + { + uint32_t n_base; + uint32_t n_blockcontrol; + uint32_t n_channelcontrol; + emu_timer *timer; + read_delegate fn_read; + write_delegate fn_write; + uint32_t n_ticks; + uint32_t b_running; + }; + void dma_start_timer( int n_channel, uint32_t n_ticks ); void dma_stop_timer( int n_channel ); void dma_timer_adjust( int n_channel ); |