1 // license:BSD-3-Clause
2 // copyright-holders:Ryan Holtz
3 /******************************************************************************
4 *
5 *   Sony PlayStation 2 IOP interrupt controller device skeleton
6 *
7 *   To Do:
8 *     Everything
9 *
10 */
11 
12 #ifndef MAME_MACHINE_IOPINTC_H
13 #define MAME_MACHINE_IOPINTC_H
14 
15 #pragma once
16 
17 #include "cpu/mips/mips1.h"
18 
19 class iop_intc_device : public device_t
20 {
21 public:
22 	template <typename T>
iop_intc_device(const machine_config & mconfig,const char * tag,device_t * owner,T && iop_tag)23 	iop_intc_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&iop_tag)
24 		: iop_intc_device(mconfig, tag, owner, (uint32_t)0)
25 	{
26 		m_iop.set_tag(std::forward<T>(iop_tag));
27 	}
28 
29 	iop_intc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
30 	virtual ~iop_intc_device() override;
31 
32 	uint32_t read(offs_t offset, uint32_t mem_mask = ~0);
33 	void write(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
34 
35 	void raise_interrupt(uint32_t line);
36 
37 	enum
38 	{
39 		INT_VB_ON = 0,
40 		INT_DMA = 3,
41 		INT_SPU = 9,
42 		INT_VB_OFF = 11,
43 		INT_TIMER = 16,
44 		INT_SIO2 = 17
45 	};
46 
47 protected:
48 	virtual void device_start() override;
49 	virtual void device_reset() override;
50 
51 	void update_interrupts();
52 
53 	required_device<iop_device> m_iop;
54 	uint32_t m_status;
55 	uint32_t m_mask;
56 	bool m_enabled;
57 };
58 
59 DECLARE_DEVICE_TYPE(SONYIOP_INTC, iop_intc_device)
60 
61 #endif // MAME_MACHINE_IOPINTC_H
62