mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
use DEVCB2 for hooking up irq controller to cpu core (nw)
This commit is contained in:
parent
28885d0061
commit
489ee80f93
@ -27,8 +27,9 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level,
|
||||
|
||||
const device_type PSX_IRQ = &device_creator<psxirq_device>;
|
||||
|
||||
psxirq_device::psxirq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, PSX_IRQ, "PSX IRQ", tag, owner, clock)
|
||||
psxirq_device::psxirq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, PSX_IRQ, "PSX IRQ", tag, owner, clock),
|
||||
m_irq_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -47,6 +48,8 @@ void psxirq_device::device_post_load()
|
||||
|
||||
void psxirq_device::device_start()
|
||||
{
|
||||
m_irq_handler.resolve_safe();
|
||||
|
||||
save_item( NAME( n_irqdata ) );
|
||||
save_item( NAME( n_irqmask ) );
|
||||
}
|
||||
@ -63,12 +66,12 @@ void psxirq_device::psx_irq_update( void )
|
||||
if( ( n_irqdata & n_irqmask ) != 0 )
|
||||
{
|
||||
verboselog( machine(), 2, "psx irq assert\n" );
|
||||
machine().device("maincpu")->execute().set_input_line(PSXCPU_IRQ0, ASSERT_LINE );
|
||||
m_irq_handler( ASSERT_LINE );
|
||||
}
|
||||
else
|
||||
{
|
||||
verboselog( machine(), 2, "psx irq clear\n" );
|
||||
machine().device("maincpu")->execute().set_input_line(PSXCPU_IRQ0, CLEAR_LINE );
|
||||
m_irq_handler( CLEAR_LINE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,17 @@
|
||||
|
||||
extern const device_type PSX_IRQ;
|
||||
|
||||
#define MCFG_PSX_IRQ_HANDLER(_devcb) \
|
||||
devcb = &psxirq_device::set_irq_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class psxirq_device : public device_t
|
||||
{
|
||||
public:
|
||||
psxirq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// static configuration helpers
|
||||
template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<psxirq_device &>(device).m_irq_handler.set_callback(object); }
|
||||
|
||||
DECLARE_READ32_MEMBER( read );
|
||||
DECLARE_WRITE32_MEMBER( write );
|
||||
|
||||
@ -45,6 +51,8 @@ private:
|
||||
|
||||
UINT32 n_irqdata;
|
||||
UINT32 n_irqmask;
|
||||
|
||||
devcb2_write_line m_irq_handler;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3189,6 +3189,8 @@ WRITE32_HANDLER( psxcpu_device::gpu_w )
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( psx )
|
||||
MCFG_DEVICE_ADD("irq", PSX_IRQ, 0)
|
||||
MCFG_PSX_IRQ_HANDLER(INPUTLINE(DEVICE_SELF, PSXCPU_IRQ0))
|
||||
|
||||
MCFG_DEVICE_ADD("dma", PSX_DMA, 0)
|
||||
MCFG_PSX_DMA_IRQ_HANDLER(DEVWRITELINE("irq", psxirq_device, intin3))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user