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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Acorn Computers Econet local area network emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#pragma once
#ifndef __ECONET__
#define __ECONET__
#include "emu.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define ECONET_TAG "econet"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_ECONET_ADD(_config) \
MCFG_DEVICE_ADD(ECONET_TAG, ECONET, 0) \
MCFG_DEVICE_CONFIG(_config)
#define ECONET_INTERFACE(_name) \
const econet_interface (_name) =
#define MCFG_ECONET_SLOT_ADD(_tag, _num, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, ECONET_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
econet_slot_device::static_set_slot(*device, _num);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> econet_interface
struct econet_interface
{
devcb_write_line m_out_clk_cb;
devcb_write_line m_out_data_cb;
};
// ======================> econet_device
class device_econet_interface;
class econet_device : public device_t,
public econet_interface
{
public:
// construction/destruction
econet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void add_device(device_t *target, int address);
// reads for both host and peripherals
DECLARE_READ_LINE_MEMBER( clk_r );
DECLARE_READ_LINE_MEMBER( data_r );
// writes for host (driver_device)
DECLARE_WRITE_LINE_MEMBER( clk_w );
DECLARE_WRITE_LINE_MEMBER( data_w );
// writes for peripherals (device_t)
void clk_w(device_t *device, int state);
void data_w(device_t *device, int state);
protected:
enum
{
CLK = 0,
DATA,
SIGNAL_COUNT
};
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_stop();
class daisy_entry
{
public:
daisy_entry(device_t *device);
daisy_entry *next() const { return m_next; }
daisy_entry * m_next; // next device
device_t * m_device; // associated device
device_econet_interface * m_interface; // associated device's daisy interface
int m_line[SIGNAL_COUNT];
};
simple_list<daisy_entry> m_device_list;
private:
devcb_resolved_write_line m_out_clk_func;
devcb_resolved_write_line m_out_data_func;
inline void set_signal(device_t *device, int signal, int state);
inline int get_signal(int signal);
int m_line[SIGNAL_COUNT];
};
// ======================> econet_slot_device
class econet_slot_device : public device_t,
public device_slot_interface
{
public:
// construction/destruction
econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual void device_start();
// inline configuration
static void static_set_slot(device_t &device, int address);
private:
// configuration
UINT8 m_address;
econet_device *m_econet;
};
// ======================> device_econet_interface
class device_econet_interface : public device_slot_card_interface
{
friend class econet_device;
public:
// construction/destruction
device_econet_interface(const machine_config &mconfig, device_t &device);
virtual ~device_econet_interface();
device_econet_interface *next() const { return m_next; }
device_econet_interface *m_next;
// optional operation overrides
virtual void econet_clk(int state) = 0;
virtual void econet_data(int state) { };
econet_device *m_econet;
UINT8 m_address;
};
// device type definition
extern const device_type ECONET;
extern const device_type ECONET_SLOT;
// slot devices
#include "e01.h"
SLOT_INTERFACE_EXTERN( econet_devices );
#endif
|