summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/z80/z80daisy.h
blob: f3e41b54b2d044947c5cbf4db8ec0beb545d3f74 (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
93
94
95
96
97
98
99
100
101
102
103
/***************************************************************************

    z80daisy.h

    Z80/180 daisy chaining support functions.

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

#pragma once

#ifndef __Z80DAISY_H__
#define __Z80DAISY_H__



//**************************************************************************
//  CONSTANTS
//**************************************************************************

// these constants are returned from the irq_state function
const UINT8 Z80_DAISY_INT = 0x01;		// interrupt request mask
const UINT8 Z80_DAISY_IEO =	0x02;		// interrupt disable mask (IEO)



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


// ======================> z80_daisy_config

struct z80_daisy_config
{
	const char *	devname;					// name of the device
};



// ======================> device_config_z80daisy_interface

// device_config_z80daisy_interface represents configuration information for a z80daisy device
class device_config_z80daisy_interface : public device_config_interface
{
public:
	// construction/destruction
	device_config_z80daisy_interface(const machine_config &mconfig, device_config &devconfig);
	virtual ~device_config_z80daisy_interface();
};



// ======================> device_z80daisy_interface

class device_z80daisy_interface : public device_interface
{
public:
	// construction/destruction
	device_z80daisy_interface(running_machine &machine, const device_config &config, device_t &device);
	virtual ~device_z80daisy_interface();

	// required operation overrides
	virtual int z80daisy_irq_state() = 0;
	virtual int z80daisy_irq_ack() = 0;
	virtual void z80daisy_irq_reti() = 0;

protected:
	const device_config_z80daisy_interface &m_z80daisy_config;
};



// ======================> z80_daisy_chain

class z80_daisy_chain
{
public:
	z80_daisy_chain();
	void init(device_t *cpudevice, const z80_daisy_config *daisy);

	bool present() const { return (m_daisy_list != NULL); }

	void reset();
	int update_irq_state();
	int call_ack_device();
	void call_reti_device();

protected:
	class daisy_entry
	{
	public:
		daisy_entry(device_t *device);

		daisy_entry *				m_next;			// next device
		device_t *					m_device;		// associated device
		device_z80daisy_interface *	m_interface;	// associated device's daisy interface
	};

	daisy_entry *			m_daisy_list;	// head of the daisy chain
};


#endif