1 // license:BSD-3-Clause
2 // copyright-holders:Melissa Goad
3 
4 // ARM PrimeCell PL192 VIC emulation
5 
6 #ifndef MAME_MACHINE_VIC_PL192_H
7 #define MAME_MACHINE_VIC_PL192_H
8 
9 class vic_pl192_device : public device_t, public device_memory_interface
10 {
11 public:
12 	vic_pl192_device(const machine_config &mconfig, const char* tag, device_t *owner, uint32_t clock = 0);
13 
out_irq_cb()14 	auto out_irq_cb() { return m_out_irq_func.bind(); }
out_fiq_cb()15 	auto out_fiq_cb() { return m_out_fiq_func.bind(); }
16 
17 	template<unsigned IRQ>
DECLARE_WRITE_LINE_MEMBER(irq_w)18 	DECLARE_WRITE_LINE_MEMBER( irq_w ) { set_irq_line(IRQ, state); }
19 
20 	void map(address_map &map);
21 
22 protected:
23 	vic_pl192_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
24 
25 	// device-level overrides
26 	virtual void device_resolve_objects() override;
27 	virtual void device_start() override;
28 	virtual void device_reset() override;
29 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
30 
31 	virtual space_config_vector memory_space_config() const override;
32 
33 private:
34 	static constexpr device_timer_id TIMER_CHECK_IRQ = 0;
35 
36 	void set_irq_line(int irq, int state);
37 
38 	address_space_config m_mmio_config;
39 
40 	devcb_write_line m_out_irq_func;
41 	devcb_write_line m_out_fiq_func;
42 	u32 raw_intr, intr_select, intr_en, soft_intr, vectaddr[32], vicaddress;
43 	int protection;
44 	u16 sw_priority_mask;
45 	u8 daisy_priority, vectprio[32];
46 	u8 periph_id[4], pcell_id[4];
47 };
48 
49 DECLARE_DEVICE_TYPE(PL192_VIC, vic_pl192_device)
50 
51 #endif // MAME_MACHINE_VIC_PL192_H
52