summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/einstein/userport/userport.h
blob: f5bd8dcfeb365db298ef748579fc2980516c8ed9 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// license: GPL-2.0+
// copyright-holders: Dirk Best
/***************************************************************************

    Einstein User Port

    16-pin slot

    +5V     1   2  D0
    GND     3   4  D1
    BRDY    5   6  D2
    GND     7   8  D3
    GND     9  10  D4
    /BSTB  11  12  D5
    GND    13  14  D6
    +5V    15  16  D7

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

#ifndef MAME_BUS_EINSTEIN_USERPORT_USERPORT_H
#define MAME_BUS_EINSTEIN_USERPORT_USERPORT_H

#pragma once


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

class device_einstein_userport_interface;

// supported devices
void einstein_userport_cards(device_slot_interface &device);

class einstein_userport_device : public device_t, public device_slot_interface
{
public:
	// construction/destruction
	einstein_userport_device(machine_config const &mconfig, char const *tag, device_t *owner)
		: einstein_userport_device(mconfig, tag, owner, (uint32_t)0)
	{
		option_reset();
		einstein_userport_cards(*this);
		set_default_option(nullptr);
		set_fixed(false);
	}

	einstein_userport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
	virtual ~einstein_userport_device();

	// callbacks
	auto bstb_handler() { return m_bstb_handler.bind(); }

	// called from card device
	DECLARE_WRITE_LINE_MEMBER( bstb_w ) { m_bstb_handler(state); }

	DECLARE_READ8_MEMBER( read );
	DECLARE_WRITE8_MEMBER (write );
	DECLARE_WRITE_LINE_MEMBER( brdy_w );

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

	device_einstein_userport_interface *m_card;

private:
	devcb_write_line m_bstb_handler;
};

// class representing interface-specific live userport device
class device_einstein_userport_interface : public device_slot_card_interface
{
public:
	// construction/destruction
	virtual ~device_einstein_userport_interface();

	virtual uint8_t read() { return 0xff; }
	virtual void write(uint8_t data) { }
	virtual void brdy_w(int state) { }

protected:
	device_einstein_userport_interface(const machine_config &mconfig, device_t &device);

	einstein_userport_device *m_slot;
};

// device type definition
DECLARE_DEVICE_TYPE(EINSTEIN_USERPORT, einstein_userport_device)

#endif // MAME_BUS_EINSTEIN_USERPORT_USERPORT_H