summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/lh5810.h
blob: 75716274c38f7726bb26f7d70e5f6fb44e721598 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// license:BSD-3-Clause
// copyright-holders:Sandro Ronco
/**********************************************************************

    LH5810/LH5811 Input/Output Port Controller

**********************************************************************/

#ifndef MAME_MACHINE_LH5810_H
#define MAME_MACHINE_LH5810_H

#pragma once

class lh5810_device : public device_t
{
public:
	// construction/destruction
	lh5810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);

	auto porta_r() { return m_porta_r_cb.bind(); }
	auto porta_w() { return m_porta_w_cb.bind(); }
	auto portb_r() { return m_portb_r_cb.bind(); }
	auto portb_w() { return m_portb_w_cb.bind(); }
	auto portc_w() { return m_portc_w_cb.bind(); }
	auto out_int() { return m_out_int_cb.bind(); }

	DECLARE_READ8_MEMBER( data_r );
	DECLARE_WRITE8_MEMBER( data_w );

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;

private:

	devcb_read8         m_porta_r_cb;       //port A read
	devcb_write8        m_porta_w_cb;       //port A write
	devcb_read8         m_portb_r_cb;       //port B read
	devcb_write8        m_portb_w_cb;       //port B write
	devcb_write8        m_portc_w_cb;       //port C write

	devcb_write_line    m_out_int_cb;       //IRQ callback

	uint8_t m_reg[0x10];
	uint8_t m_irq;
};

DECLARE_DEVICE_TYPE(LH5810, lh5810_device)

#endif // MAME_MACHINE_LH5810_H