1 // license:BSD-3-Clause
2 // copyright-holders:Sandro Ronco
3 /**********************************************************************
4 
5     LH5810/LH5811 Input/Output Port Controller
6 
7 **********************************************************************/
8 
9 #ifndef MAME_MACHINE_LH5810_H
10 #define MAME_MACHINE_LH5810_H
11 
12 #pragma once
13 
14 class lh5810_device : public device_t
15 {
16 public:
17 	// construction/destruction
18 	lh5810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
19 
porta_r()20 	auto porta_r() { return m_porta_r_cb.bind(); }
porta_w()21 	auto porta_w() { return m_porta_w_cb.bind(); }
portb_r()22 	auto portb_r() { return m_portb_r_cb.bind(); }
portb_w()23 	auto portb_w() { return m_portb_w_cb.bind(); }
portc_w()24 	auto portc_w() { return m_portc_w_cb.bind(); }
out_int()25 	auto out_int() { return m_out_int_cb.bind(); }
26 
27 	uint8_t data_r(offs_t offset);
28 	void data_w(offs_t offset, uint8_t data);
29 
30 protected:
31 	// device-level overrides
32 	virtual void device_start() override;
33 	virtual void device_reset() override;
34 
35 private:
36 
37 	devcb_read8         m_porta_r_cb;       //port A read
38 	devcb_write8        m_porta_w_cb;       //port A write
39 	devcb_read8         m_portb_r_cb;       //port B read
40 	devcb_write8        m_portb_w_cb;       //port B write
41 	devcb_write8        m_portc_w_cb;       //port C write
42 
43 	devcb_write_line    m_out_int_cb;       //IRQ callback
44 
45 	uint8_t m_reg[0x10];
46 	uint8_t m_irq;
47 };
48 
49 DECLARE_DEVICE_TYPE(LH5810, lh5810_device)
50 
51 #endif // MAME_MACHINE_LH5810_H
52