summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/at28.h
blob: ebb11c37f090323948b34590c7d5faf89317c20b (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
// license:BSD-3-Clause
// copyright-holders:Christian Brunschen
/***************************************************************************

  Atmel 28-series Parallel EEPROMs

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

#ifndef MAME_MACHINE_AT28_H
#define MAME_MACHINE_AT28_H

#pragma once

#include "eeprom28.h"

// Concrete devices

#define DECLARE_AT28_DEVICES_AND_TYPES(Type, Class, AddrBits, PageBytes, TBLC, TWC, ...)                        \
/* Device Type - includes a forward declaration of the Class */                                                 \
DECLARE_DEVICE_TYPE(Type, Class##_device)                                                                       \
/* The Class, which can now refer to the Device Type when calling the superclass's constructor */               \
class Class##_device                                                                                            \
: public eeprom28_device<AddrBits, PageBytes, TBLC, TWC, false, true, true, true __VA_OPT__(,) __VA_ARGS__>     \
{                                                                                                               \
public:                                                                                                      \
	Class##_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0)        \
	: eeprom28_device(mconfig, Type, tag, owner, clock) { }                                                    \
};                                                                                                           \
/* Device Type - includes a forward declaration of the Class */                                              \
DECLARE_DEVICE_TYPE(Type##_NVRAM, Class##_nvram_device)                                                      \
/* The Class, which can now refer to the Device Type when calling the superclass's constructor */            \
class Class##_nvram_device : public eeprom28_nvram_device<AddrBits, PageBytes, TBLC, TWC, false, true, true, true __VA_OPT__(,) __VA_ARGS__>                                       \
{                                                                                                            \
public:                                                                                                      \
	Class##_nvram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0)  \
	: eeprom28_nvram_device(mconfig, Type##_NVRAM, tag, owner, clock) { }                                      \
};

// AT28C64B: 64kbit == 8k bytes, 64 bytes per page
DECLARE_AT28_DEVICES_AND_TYPES(AT28C64B, at28c64b, 13, 64, 100, 5000)

// AT28C256: 256kbit == 32k bytes, 64 bytes per page
DECLARE_AT28_DEVICES_AND_TYPES(AT28C256, at28c256, 15, 64, 100, 5000)

// AT28C010: 1Mbit = 128k bytes, 128 bytes per page
DECLARE_AT28_DEVICES_AND_TYPES(AT28C010, at28c010, 17, 128, 100, 10000)

// AT28C040: 4Mbit = 512 kbytes, 256 bytes per page
DECLARE_AT28_DEVICES_AND_TYPES(AT28C040, at28c040, 19, 256, 150, 10000)

#undef DECLARE_AT28_DEVICES_AND_TYPES

#endif // MAME_MACHINE_AT28_H