summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/eeprompar.c
blob: 0d730224df3a2e6735265074007a3dff24f29fe3 (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
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
/***************************************************************************

    eeprompar.c

    Parallel EEPROM devices.

****************************************************************************

    Copyright Aaron Giles
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are
    met:

        * Redistributions of source code must retain the above copyright
          notice, this list of conditions and the following disclaimer.
        * Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in
          the documentation and/or other materials provided with the
          distribution.
        * Neither the name 'MAME' nor the names of its contributors may be
          used to endorse or promote products derived from this software
          without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.

****************************************************************************

    Parallel EEPROMs are generally simpler than serial EEPROMs, though
    they require more pins to provide the full set of address and data
    lines necessary. They also require more pins the larger the EEPROM
    is, whereas serial EEPROMs all share the same pinout regardless of
    size.

    At a basic level, there are 5 sets of signals involved:

        * /CE = chip enable
        * /OE = output enable
        * /WE = write enable
        * D0-Dn = data lines
        * A0-An = address lines

    To access the chip, the various enable states must be asserted or
    cleared. Note that these are generally active-low, so asserted means
    pulled to GND, and cleared means pulled to Vcc:

        /CE     /OE     /WE     Action
       ASSERT  ASSERT  CLEAR    Read (D0-Dn contain output data)
       ASSERT  CLEAR   ASSERT   Write/Erase (D0-Dn are input data)

    Erase is performed by doing a write with D0-Dn all set to 1.

    In general, it is slow to write or erase (9ms is quoted in the 2816A
    datasheet, for example), and the /WE must be held low for the entire
    write/erase duration in order to guarantee the data is written.

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

#include "emu.h"
#include "machine/eeprompar.h"



//**************************************************************************
//  BASE DEVICE IMPLEMENTATION
//**************************************************************************

//-------------------------------------------------
//  eeprom_parallel_base_device - constructor
//-------------------------------------------------

eeprom_parallel_base_device::eeprom_parallel_base_device(const machine_config &mconfig, device_type devtype, const char *name, const char *tag, device_t *owner, const char *shortname, const char *file)
	: eeprom_base_device(mconfig, devtype, name, tag, owner, shortname, file)
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void eeprom_parallel_base_device::device_start()
{
	// start the base class
	eeprom_base_device::device_start();
}


//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void eeprom_parallel_base_device::device_reset()
{
	// reset the base class
	eeprom_base_device::device_reset();
}



//**************************************************************************
//  28XX INTERFACE IMPLEMENTATION
//**************************************************************************

//-------------------------------------------------
//  eeprom_parallel_28xx_device - constructor
//-------------------------------------------------

eeprom_parallel_28xx_device::eeprom_parallel_28xx_device(const machine_config &mconfig, device_type devtype, const char *name, const char *tag, device_t *owner, const char *shortname, const char *file)
	: eeprom_parallel_base_device(mconfig, devtype, name, tag, owner, shortname, file)
{
}


//-------------------------------------------------
//  read/write - read/write handlers
//-------------------------------------------------

WRITE8_MEMBER(eeprom_parallel_28xx_device::write)
{
	eeprom_base_device::write(offset, data);
}

READ8_MEMBER(eeprom_parallel_28xx_device::read)
{
	return eeprom_base_device::read(offset);
}



//**************************************************************************
//  DERIVED TYPES
//**************************************************************************

// macro for defining a new device class
#define DEFINE_PARALLEL_EEPROM_DEVICE(_baseclass, _lowercase, _uppercase, _bits, _cells) \
eeprom_parallel_##_lowercase##_device::eeprom_parallel_##_lowercase##_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) \
	: eeprom_parallel_##_baseclass##_device(mconfig, EEPROM_PARALLEL_##_uppercase, "Parallel EEPROM " #_uppercase " (" #_cells "x" #_bits ")", tag, owner, #_lowercase, __FILE__) \
{ \
	static_set_size(*this, _cells, _bits); \
}; \
const device_type EEPROM_PARALLEL_##_uppercase = &device_creator<eeprom_parallel_##_lowercase##_device>;
// standard 28XX class of 8-bit EEPROMs
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 2804, 2804, 8, 512)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 2816, 2816, 8, 2048)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 2864, 2864, 8, 8192)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 28256, 28256, 8, 32768)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 28512, 28512, 8, 65536)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 28010, 28010, 8, 131072)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 28020, 28020, 8, 262144)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 28040, 28040, 8, 524288)