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
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/***************************************************************************
AMD AM9517A/8237A Multimode DMA Controller emulation
Copyright the MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
****************************************************************************
_____ _____
_IOR 1 |* \_/ | 40 A7
_IOW 2 | | 39 A6
_MEMR 3 | | 38 A5
_MEMW 4 | | 37 A4
* 5 | | 36 _EOP
READY 6 | | 35 A3
HACK 7 | | 34 A2
ADSTB 8 | | 33 A1
AEN 9 | | 32 A0
HREQ 10 | AM9517A | 31 Vcc
_CS 11 | 8237A | 30 DB0
CLK 12 | | 29 DB1
RESET 13 | | 28 DB2
DACK2 14 | | 27 DB3
DACK3 15 | | 26 DB4
DREQ3 16 | | 25 DACK0
DREQ2 17 | | 24 DACK1
DREQ1 18 | | 23 DB5
DREQ0 19 | | 22 DB6
Vss 20 |_____________| 21 DB7
***************************************************************************/
#pragma once
#ifndef __AM9517A__
#define __AM9517A__
#include "emu.h"
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_AM9517A_ADD(_tag, _clock, _config) \
MCFG_DEVICE_ADD(_tag, AM9517A, _clock) \
MCFG_DEVICE_CONFIG(_config)
#define MCFG_I8237_ADD(_tag, _clock, _config) \
MCFG_DEVICE_ADD(_tag, AM9517A, _clock) \
MCFG_DEVICE_CONFIG(_config)
#define AM9517A_INTERFACE(_name) \
const am9517a_interface (_name) =
#define I8237_INTERFACE(_name) \
const am9517a_interface (_name) =
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> am9517a_interface
struct am9517a_interface
{
devcb_write_line m_out_hreq_cb;
devcb_write_line m_out_eop_cb;
devcb_read8 m_in_memr_cb;
devcb_write8 m_out_memw_cb;
devcb_read8 m_in_ior_cb[4];
devcb_write8 m_out_iow_cb[4];
devcb_write_line m_out_dack_cb[4];
};
// ======================> am9517a_device
class am9517a_device : public device_t,
public device_execute_interface,
public am9517a_interface
{
public:
// construction/destruction
am9517a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( hack_w );
DECLARE_WRITE_LINE_MEMBER( ready_w );
DECLARE_WRITE_LINE_MEMBER( eop_w );
DECLARE_WRITE_LINE_MEMBER( dreq0_w );
DECLARE_WRITE_LINE_MEMBER( dreq1_w );
DECLARE_WRITE_LINE_MEMBER( dreq2_w );
DECLARE_WRITE_LINE_MEMBER( dreq3_w );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void execute_run();
int m_icount;
private:
inline void dma_request(int channel, int state);
inline bool is_request_active(int channel);
inline bool is_software_request_active(int channel);
inline void set_hreq(int state);
inline void set_dack();
inline void set_eop(int state);
inline int get_state1(bool msb_changed);
inline void dma_read();
inline void dma_write();
inline void dma_advance();
inline void end_of_process();
devcb_resolved_write_line m_out_hreq_func;
devcb_resolved_write_line m_out_eop_func;
devcb_resolved_read8 m_in_memr_func;
devcb_resolved_write8 m_out_memw_func;
struct
{
devcb_resolved_read8 m_in_ior_func;
devcb_resolved_write8 m_out_iow_func;
devcb_resolved_write_line m_out_dack_func;
UINT16 m_address;
UINT16 m_count;
UINT16 m_base_address;
UINT16 m_base_count;
UINT8 m_mode;
} m_channel[4];
int m_msb;
int m_hreq;
int m_hack;
int m_ready;
int m_eop;
int m_state;
int m_current_channel;
int m_last_channel;
UINT8 m_command;
UINT8 m_mask;
UINT8 m_status;
UINT8 m_temp;
UINT8 m_request;
};
// device type definition
extern const device_type AM9517A;
#endif
|