summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/hp_ipc_io/hp_ipc_io.h
blob: f0fcc4f620ad8bcccdec9cc43af515a067e2783b (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
// license:BSD-3-Clause
// copyright-holders: F. Ulivi
/*********************************************************************

    hp_ipc_io.h

    I/O bus of HP IPC system

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

#ifndef MAME_BUS_HP_IPC_IO_HP_IPC_IO_H
#define MAME_BUS_HP_IPC_IO_HP_IPC_IO_H

#pragma once

void hp_ipc_io_slot_devices(device_slot_interface &device);

class device_hp_ipc_io_interface;

class hp_ipc_io_slot_device : public device_t,
							  public device_single_card_slot_interface<device_hp_ipc_io_interface>
{
public:
	// construction/destruction
	hp_ipc_io_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock = XTAL());
	virtual ~hp_ipc_io_slot_device();

	// Set A/B slot
	void set_slot_idx(unsigned idx) { m_slot_idx = idx; }

	// Callback setups
	auto irq3_cb() { return m_irq_cb_func[ 0 ].bind(); }
	auto irq4_cb() { return m_irq_cb_func[ 1 ].bind(); }
	auto irq5_cb() { return m_irq_cb_func[ 2 ].bind(); }
	auto irq6_cb() { return m_irq_cb_func[ 3 ].bind(); }

	uint32_t get_slot_base_addr() const;

	void install_read_write_handlers(address_space& space);

	void irq_w(unsigned idx , bool state);

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

private:
	devcb_write_line::array<4> m_irq_cb_func;
	// 0: slot A
	// 1: slot B
	unsigned m_slot_idx;
};

class device_hp_ipc_io_interface : public device_interface
{
public:
	virtual ~device_hp_ipc_io_interface();

	virtual void install_read_write_handlers(address_space& space , uint32_t base_addr) = 0;

	static constexpr offs_t USER_SPACE_OFFSET = 0x1800000;

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

	// card device handling
	void irq_w(unsigned idx , bool state);
};

// device type definition
DECLARE_DEVICE_TYPE(HP_IPC_IO_SLOT, hp_ipc_io_slot_device)

#endif // MAME_BUS_HP_IPC_IO_HP_IPC_IO_H