trunk/src/emu/cpu/psx/irq.c
| r18801 | r18802 | |
| 27 | 27 | |
| 28 | 28 | const device_type PSX_IRQ = &device_creator<psxirq_device>; |
| 29 | 29 | |
| 30 | | psxirq_device::psxirq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 31 | | : device_t(mconfig, PSX_IRQ, "PSX IRQ", tag, owner, clock) |
| 30 | psxirq_device::psxirq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 31 | device_t(mconfig, PSX_IRQ, "PSX IRQ", tag, owner, clock), |
| 32 | m_irq_handler(*this) |
| 32 | 33 | { |
| 33 | 34 | } |
| 34 | 35 | |
| r18801 | r18802 | |
| 47 | 48 | |
| 48 | 49 | void psxirq_device::device_start() |
| 49 | 50 | { |
| 51 | m_irq_handler.resolve_safe(); |
| 52 | |
| 50 | 53 | save_item( NAME( n_irqdata ) ); |
| 51 | 54 | save_item( NAME( n_irqmask ) ); |
| 52 | 55 | } |
| r18801 | r18802 | |
| 63 | 66 | if( ( n_irqdata & n_irqmask ) != 0 ) |
| 64 | 67 | { |
| 65 | 68 | verboselog( machine(), 2, "psx irq assert\n" ); |
| 66 | | machine().device("maincpu")->execute().set_input_line(PSXCPU_IRQ0, ASSERT_LINE ); |
| 69 | m_irq_handler( ASSERT_LINE ); |
| 67 | 70 | } |
| 68 | 71 | else |
| 69 | 72 | { |
| 70 | 73 | verboselog( machine(), 2, "psx irq clear\n" ); |
| 71 | | machine().device("maincpu")->execute().set_input_line(PSXCPU_IRQ0, CLEAR_LINE ); |
| 74 | m_irq_handler( CLEAR_LINE ); |
| 72 | 75 | } |
| 73 | 76 | } |
| 74 | 77 | |
trunk/src/emu/cpu/psx/irq.h
| r18801 | r18802 | |
| 14 | 14 | |
| 15 | 15 | extern const device_type PSX_IRQ; |
| 16 | 16 | |
| 17 | #define MCFG_PSX_IRQ_HANDLER(_devcb) \ |
| 18 | devcb = &psxirq_device::set_irq_handler(*device, DEVCB2_##_devcb); |
| 19 | |
| 17 | 20 | class psxirq_device : public device_t |
| 18 | 21 | { |
| 19 | 22 | public: |
| 20 | 23 | psxirq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 21 | 24 | |
| 25 | // static configuration helpers |
| 26 | 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); } |
| 27 | |
| 22 | 28 | DECLARE_READ32_MEMBER( read ); |
| 23 | 29 | DECLARE_WRITE32_MEMBER( write ); |
| 24 | 30 | |
| r18801 | r18802 | |
| 45 | 51 | |
| 46 | 52 | UINT32 n_irqdata; |
| 47 | 53 | UINT32 n_irqmask; |
| 54 | |
| 55 | devcb2_write_line m_irq_handler; |
| 48 | 56 | }; |
| 49 | 57 | |
| 50 | 58 | #endif |