summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2020-05-06 10:51:16 +0100
committer smf- <smf-@users.noreply.github.com>2020-05-06 10:54:06 +0100
commitd3196bd99159f077316cf71e8536f41f75769ab0 (patch)
tree0c076ca632c161b863cb4e8128b960800567374d
parent505e8a4310736f28fff5bff41702d9780c69a4cc (diff)
Fixed regression in peps0615 introduced in 635f469c7dd0b5166455bafeddb0e898b1081165, the game writes to the page buffer then sends a spurious start condition before the stop condition that writes the buffer. [smf]
Created i2cmem sub classes for all used device types, fixed the buffer sizes that were wrong, removed the methods for modifying the data & buffer sizes and changed the drivers to use the correct types. [smf] Switched aa310 & ertictac over to use device/machine/pcf8583.cpp, which is not currently based on i2cmem.cpp but might be worth merging in the future. [smf]
-rw-r--r--src/devices/bus/bbc/1mhzbus/datacentre.cpp3
-rw-r--r--src/devices/bus/ekara/rom.cpp8
-rw-r--r--src/devices/bus/jakks_gamekey/rom.cpp2
-rw-r--r--src/devices/bus/megadrive/jcart.cpp2
-rw-r--r--src/devices/machine/i2cmem.cpp85
-rw-r--r--src/devices/machine/i2cmem.h31
-rw-r--r--src/mame/drivers/4enlinea.cpp4
-rw-r--r--src/mame/drivers/aa310.cpp3
-rw-r--r--src/mame/drivers/amiga.cpp2
-rw-r--r--src/mame/drivers/bbc.cpp3
-rw-r--r--src/mame/drivers/cubo.cpp2
-rw-r--r--src/mame/drivers/cxhumax.cpp2
-rw-r--r--src/mame/drivers/ertictac.cpp7
-rw-r--r--src/mame/drivers/funworld.cpp4
-rw-r--r--src/mame/drivers/ghosteo.cpp4
-rw-r--r--src/mame/drivers/hotblock.cpp2
-rw-r--r--src/mame/drivers/microdar.cpp2
-rw-r--r--src/mame/drivers/pokemini.cpp2
-rw-r--r--src/mame/drivers/spg2xx_jakks.cpp2
-rw-r--r--src/mame/drivers/spg2xx_jakks_gkr.cpp2
-rw-r--r--src/mame/drivers/twinkle.cpp2
-rw-r--r--src/mame/drivers/xavix.cpp29
-rw-r--r--src/mame/includes/archimds.h4
-rw-r--r--src/mame/includes/xavix.h1
-rw-r--r--src/mame/machine/archimds.cpp6
25 files changed, 101 insertions, 113 deletions
diff --git a/src/devices/bus/bbc/1mhzbus/datacentre.cpp b/src/devices/bus/bbc/1mhzbus/datacentre.cpp
index 8cac8ab9a55..71ea5c50767 100644
--- a/src/devices/bus/bbc/1mhzbus/datacentre.cpp
+++ b/src/devices/bus/bbc/1mhzbus/datacentre.cpp
@@ -82,8 +82,7 @@ void bbc_datacentre_device::device_add_mconfig(machine_config &config)
ATA_INTERFACE(config, m_ide).options(ata_devices, "hdd", "hdd", false);
m_ide->irq_handler().set(FUNC(bbc_datacentre_device::irq_w));
- /* 24LC512 - 512Kb I2C Serial EEPROM */
- I2CMEM(config, m_nvram).set_page_size(128).set_data_size(0x10000);
+ I2C_24C512(config, m_nvram); // 24LC512
/* import floppy images - delayed to allow RAMFS to initialise before import */
QUICKLOAD(config, "import0", "ssd,dsd,img", attotime::from_seconds(1)).set_load_callback(FUNC(bbc_datacentre_device::quickload_cb<0>));
diff --git a/src/devices/bus/ekara/rom.cpp b/src/devices/bus/ekara/rom.cpp
index f55fd325d2a..de65f3abeb2 100644
--- a/src/devices/bus/ekara/rom.cpp
+++ b/src/devices/bus/ekara/rom.cpp
@@ -148,21 +148,21 @@ bool ekara_rom_i2c_24c08_epitch_device::is_write_access_not_rom(void)
void ekara_rom_i2c_24c08_epitch_device::device_add_mconfig(machine_config &config)
{
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x400); // 24C08
+ I2C_24C08(config, "i2cmem", 0);
}
// i2c 24lc04
void ekara_rom_i2c_24lc04_device::device_add_mconfig(machine_config &config)
{
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24LC04
+ I2C_24C04(config, "i2cmem", 0); // 24LC04
}
// i2c 24lc02
void ekara_rom_i2c_24lc02_device::device_add_mconfig(machine_config &config)
{
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24LC02
+ I2C_24C02(config, "i2cmem", 0); // 24LC02
}
// i2c 24lc02 with direct IO port access
@@ -206,7 +206,7 @@ READ_LINE_MEMBER(ekara_rom_i2c_24lc02_gc0010_device::read_sda )
void ekara_rom_i2c_24lc02_gc0010_device::device_add_mconfig(machine_config &config)
{
- I2CMEM(config, "i2cmem", 0)/*.set_page_size(16)*/.set_data_size(0x100); // 24LC02
+ I2C_24C02(config, "i2cmem", 0); // 24LC02
}
diff --git a/src/devices/bus/jakks_gamekey/rom.cpp b/src/devices/bus/jakks_gamekey/rom.cpp
index 0ca9b7024d9..c18d24d06ba 100644
--- a/src/devices/bus/jakks_gamekey/rom.cpp
+++ b/src/devices/bus/jakks_gamekey/rom.cpp
@@ -96,7 +96,7 @@ WRITE16_MEMBER(jakks_gamekey_rom_i2c_base_device::write_cart_seeprom)
void jakks_gamekey_rom_i2c_24lc04_device::device_add_mconfig(machine_config &config)
{
- I2CMEM(config, "i2cmem", 0)/*.set_page_size(16)*/.set_data_size(0x200); // 24LC04
+ I2C_24C04(config, "i2cmem", 0); // 24LC04
}
diff --git a/src/devices/bus/megadrive/jcart.cpp b/src/devices/bus/megadrive/jcart.cpp
index 76f38ff0dd3..80ade82bd86 100644
--- a/src/devices/bus/megadrive/jcart.cpp
+++ b/src/devices/bus/megadrive/jcart.cpp
@@ -88,7 +88,7 @@ void md_seprom_codemast_device::device_add_mconfig(machine_config &config)
void md_seprom_mm96_device::device_add_mconfig(machine_config &config)
{
- I2C_24C16A(config, m_i2cmem);
+ I2C_24C16(config, m_i2cmem); // 24C16A
}
diff --git a/src/devices/machine/i2cmem.cpp b/src/devices/machine/i2cmem.cpp
index 140e60dc145..94c08716f97 100644
--- a/src/devices/machine/i2cmem.cpp
+++ b/src/devices/machine/i2cmem.cpp
@@ -4,8 +4,7 @@
I2C Memory
-Generic ram/rom/eeprom/flash on an i2c bus. Supports specifying the slave address,
-the data size & the page size for writing.
+ram/rom/eeprom/flash on an i2c bus.
inputs:
e0,e1,e2 lower 3 bits of the slave address
@@ -16,9 +15,11 @@ inputs:
outputs:
sda serial data
-The memory address is only 8 bits, devices larger than this have multiple slave addresses.
-The top five address bits are set at manufacture time, two values are standard.
+The memory address is only 8 bits for devices up to 2048 bytes,
+devices from 512 to 2048 bytes occupy multiple slave addresses.
+The top five address bits are set at manufacture time,
+there are two standard values.
***************************************************************************/
#include "emu.h"
@@ -59,15 +60,16 @@ static inline void ATTR_PRINTF( 3, 4 ) verboselog( device_t *device, int n_level
//**************************************************************************
// device type definition
-DEFINE_DEVICE_TYPE(I2CMEM, i2cmem_device, "i2cmem", "I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_X2404P, i2c_x2404p_device, "x2404p", "X2404P I2C Memory")
DEFINE_DEVICE_TYPE(I2C_24C01, i2c_24c01_device, "24c01", "24C01 I2C Memory")
+DEFINE_DEVICE_TYPE(I2C_PCD8572, i2c_pcd8572_device, "pcd8572", "PCD8572 I2C Memory")
DEFINE_DEVICE_TYPE(I2C_24C02, i2c_24c02_device, "24c02", "24C02 I2C Memory")
+DEFINE_DEVICE_TYPE(I2C_M24C02, i2c_m24c02_device, "m24c02", "M24C02 I2C Memory")
DEFINE_DEVICE_TYPE(I2C_24C04, i2c_24c04_device, "24c04", "24C04 I2C Memory")
+DEFINE_DEVICE_TYPE(I2C_X2404P, i2c_x2404p_device, "x2404p", "X2404P I2C Memory")
DEFINE_DEVICE_TYPE(I2C_24C08, i2c_24c08_device, "24c08", "24C08 I2C Memory")
DEFINE_DEVICE_TYPE(I2C_24C16, i2c_24c16_device, "24c16", "24C16 I2C Memory")
-DEFINE_DEVICE_TYPE(I2C_24C16A, i2c_24c16a_device, "24c16a", "24C16A I2C Memory")
DEFINE_DEVICE_TYPE(I2C_24C64, i2c_24c64_device, "24c64", "24C64 I2C Memory")
+DEFINE_DEVICE_TYPE(I2C_24C512, i2c_24c512_device, "24c512", "24C512 I2C Memory")
//**************************************************************************
// LIVE DEVICE
@@ -83,13 +85,15 @@ i2cmem_device::i2cmem_device(
const char *tag,
device_t *owner,
uint32_t clock,
- int page_size,
+ int read_page_size,
+ int write_page_size,
int data_size) :
device_t(mconfig, type, tag, owner, clock),
device_nvram_interface(mconfig, *this),
m_region(*this, DEVICE_SELF),
m_slave_address(I2CMEM_SLAVE_ADDRESS),
- m_page_size(page_size),
+ m_read_page_size(read_page_size),
+ m_write_page_size(write_page_size),
m_data_size(data_size),
m_scl(0),
m_sdaw(0),
@@ -110,48 +114,53 @@ i2cmem_device::i2cmem_device(
assert(!clock);
}
-i2cmem_device::i2cmem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2CMEM, tag, owner, clock, 0, 0)
+i2c_24c01_device::i2c_24c01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_24C01, tag, owner, clock, 0, 8, 0x80)
{
}
-i2c_x2404p_device::i2c_x2404p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_X2404P, tag, owner, clock, 8, 0x200)
+i2c_pcd8572_device::i2c_pcd8572_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_PCD8572, tag, owner, clock, 0, 0, 0x80)
{
}
-i2c_24c01_device::i2c_24c01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C01, tag, owner, clock, 4, 0x80)
+i2c_24c02_device::i2c_24c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_24C02, tag, owner, clock, 0, 8, 0x100)
{
}
-i2c_24c02_device::i2c_24c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C02, tag, owner, clock, 4, 0x100)
+i2c_m24c02_device::i2c_m24c02_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_M24C02, tag, owner, clock, 0, 16, 0x100)
{
}
i2c_24c04_device::i2c_24c04_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C04, tag, owner, clock, 8, 0x200)
+ i2cmem_device(mconfig, I2C_24C04, tag, owner, clock, 0, 16, 0x200)
+{
+}
+
+i2c_x2404p_device::i2c_x2404p_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_X2404P, tag, owner, clock, 0x100, 8, 0x200)
{
}
i2c_24c08_device::i2c_24c08_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C08, tag, owner, clock, 0, 0x400)
+ i2cmem_device(mconfig, I2C_24C08, tag, owner, clock, 0, 16, 0x400)
{
}
i2c_24c16_device::i2c_24c16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C16, tag, owner, clock, 8, 0x800)
+ i2cmem_device(mconfig, I2C_24C16, tag, owner, clock, 0, 16, 0x800)
{
}
-i2c_24c16a_device::i2c_24c16a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C16A, tag, owner, clock, 0, 0x800)
+i2c_24c64_device::i2c_24c64_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_24C64, tag, owner, clock, 0, 32, 0x2000)
{
}
-i2c_24c64_device::i2c_24c64_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- i2cmem_device(mconfig, I2C_24C64, tag, owner, clock, 8, 0x2000)
+i2c_24c512_device::i2c_24c512_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
+ i2cmem_device(mconfig, I2C_24C512, tag, owner, clock, 0, 128, 0x10000)
{
}
@@ -162,7 +171,7 @@ i2c_24c64_device::i2c_24c64_device(const machine_config &mconfig, const char *ta
void i2cmem_device::device_start()
{
m_data = std::make_unique<uint8_t []>(m_data_size);
- m_page.resize( m_page_size );
+ m_page.resize( m_write_page_size );
save_item( NAME(m_scl) );
save_item( NAME(m_sdaw) );
@@ -181,7 +190,7 @@ void i2cmem_device::device_start()
save_item( NAME(m_page_offset) );
save_item( NAME(m_page_written_size) );
save_pointer( &m_data[0], "m_data", m_data_size );
- if ( m_page_size > 0 )
+ if ( m_write_page_size > 0 )
{
save_item( NAME(m_page) );
}
@@ -286,13 +295,15 @@ WRITE_LINE_MEMBER( i2cmem_device::write_sda )
{
if( m_sdaw )
{
- if( m_state == STATE_DATAIN && m_page_size > 0 )
+ if( m_page_written_size > 0 )
{
int base = data_offset();
- int root = base & ~( m_page_size - 1);
- for( int i=0; i < m_page_written_size; i++)
- m_data[root | ((base + i) & (m_page_size - 1))] = m_page[i];
- verboselog( this, 1, "data[ %04x to %04x ] = %x bytes\n", base, root | ((base + m_page_written_size - 1) & (m_page_size - 1)), m_page_written_size );
+ int root = base & ~( m_write_page_size - 1 );
+ for( int i = 0; i < m_page_written_size; i++ )
+ m_data[root | ((base + i) & (m_write_page_size - 1))] = m_page[i];
+ verboselog( this, 1, "data[ %04x to %04x ] = %x bytes\n", base, root | ((base + m_page_written_size - 1) & (m_write_page_size - 1)), m_page_written_size );
+
+ m_page_written_size = 0;
}
verboselog( this, 1, "stop\n" );
m_state = STATE_IDLE;
@@ -373,7 +384,7 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
break;
case STATE_ADDRESSLOW:
- m_byteaddr = m_shift | (skip_addresshigh() ? (m_devsel & DEVSEL_ADDRESS) << 7 : m_addresshigh << 8);
+ m_byteaddr = m_shift | (skip_addresshigh() ? ((m_devsel & DEVSEL_ADDRESS) << 7) & address_mask() : m_addresshigh << 8);
m_page_offset = 0;
m_page_written_size = 0;
@@ -388,17 +399,17 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
verboselog( this, 0, "write not enabled\n" );
m_state = STATE_IDLE;
}
- else if( m_page_size > 0 )
+ else if( m_write_page_size > 0 )
{
m_page[ m_page_offset ] = m_shift;
verboselog( this, 1, "page[ %04x ] <- %02x\n", m_page_offset, m_page[ m_page_offset ] );
m_page_offset++;
- if( m_page_offset == m_page_size )
+ if( m_page_offset == m_write_page_size )
m_page_offset = 0;
m_page_written_size++;
- if( m_page_written_size > m_page_size)
- m_page_written_size = m_page_size;
+ if( m_page_written_size > m_write_page_size)
+ m_page_written_size = m_write_page_size;
}
else
{
@@ -440,7 +451,7 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
m_shift = m_data[offset];
verboselog( this, 1, "data[ %04x ] -> %02x\n", offset, m_shift );
- m_byteaddr++;
+ m_byteaddr = (m_byteaddr & ~(m_read_page_size - 1)) | ((m_byteaddr + 1) & (m_read_page_size - 1));
}
m_sdar = ( m_shift >> 7 ) & 1;
diff --git a/src/devices/machine/i2cmem.h b/src/devices/machine/i2cmem.h
index 5e67fda009a..3a7916a838a 100644
--- a/src/devices/machine/i2cmem.h
+++ b/src/devices/machine/i2cmem.h
@@ -33,12 +33,7 @@ class i2cmem_device :
public device_nvram_interface
{
public:
- // construction/destruction
- i2cmem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
i2cmem_device & set_address(int address) { m_slave_address = address; return *this; }
- i2cmem_device & set_page_size(int page_size) { m_page_size = page_size; return *this; }
- i2cmem_device & set_data_size(int data_size) { m_data_size = data_size; return *this; }
i2cmem_device & set_e0(int e0) { m_e0 = e0; return *this; }
i2cmem_device & set_e1(int e1) { m_e1 = e1; return *this; }
i2cmem_device & set_e2(int e2) { m_e2 = e2; return *this; }
@@ -55,7 +50,7 @@ public:
protected:
// construction/destruction
- i2cmem_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int page_size, int data_size);
+ i2cmem_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int read_page_size, int write_page_size, int data_size);
// device-level overrides
virtual void device_start() override;
@@ -76,7 +71,8 @@ protected:
// internal state
std::unique_ptr<uint8_t[]> m_data;
int m_slave_address;
- int m_page_size;
+ int m_read_page_size;
+ int m_write_page_size;
int m_data_size;
int m_scl;
int m_sdaw;
@@ -103,24 +99,27 @@ protected:
i2c_##name##_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); \
};
-DECLARE_I2C_DEVICE(x2404p)
-DECLARE_I2C_DEVICE(24c01)
-DECLARE_I2C_DEVICE(24c02)
-DECLARE_I2C_DEVICE(24c04)
-DECLARE_I2C_DEVICE(24c08)
+DECLARE_I2C_DEVICE(24c01);
+DECLARE_I2C_DEVICE(pcd8572);
+DECLARE_I2C_DEVICE(24c02);
+DECLARE_I2C_DEVICE(m24c02);
+DECLARE_I2C_DEVICE(24c04);
+DECLARE_I2C_DEVICE(x2404p);
+DECLARE_I2C_DEVICE(24c08);
DECLARE_I2C_DEVICE(24c16);
-DECLARE_I2C_DEVICE(24c16a);
DECLARE_I2C_DEVICE(24c64);
+DECLARE_I2C_DEVICE(24c512);
// device type definition
-DECLARE_DEVICE_TYPE(I2CMEM, i2cmem_device)
-DECLARE_DEVICE_TYPE(I2C_X2404P, i2c_x2404p_device)
DECLARE_DEVICE_TYPE(I2C_24C01, i2c_24c01_device)
+DECLARE_DEVICE_TYPE(I2C_PCD8572, i2c_pcd8572_device)
DECLARE_DEVICE_TYPE(I2C_24C02, i2c_24c02_device)
+DECLARE_DEVICE_TYPE(I2C_M24C02, i2c_m24c02_device)
DECLARE_DEVICE_TYPE(I2C_24C04, i2c_24c04_device)
+DECLARE_DEVICE_TYPE(I2C_X2404P, i2c_x2404p_device)
DECLARE_DEVICE_TYPE(I2C_24C08, i2c_24c08_device)
DECLARE_DEVICE_TYPE(I2C_24C16, i2c_24c16_device)
-DECLARE_DEVICE_TYPE(I2C_24C16A, i2c_24c16a_device)
DECLARE_DEVICE_TYPE(I2C_24C64, i2c_24c64_device)
+DECLARE_DEVICE_TYPE(I2C_24C512, i2c_24c512_device)
#endif // MAME_MACHINE_I2CMEM_H
diff --git a/src/mame/drivers/4enlinea.cpp b/src/mame/drivers/4enlinea.cpp
index 9247d314ba8..cc49fd44f50 100644
--- a/src/mame/drivers/4enlinea.cpp
+++ b/src/mame/drivers/4enlinea.cpp
@@ -614,7 +614,7 @@ void _4enlinea_state::_4enlinea(machine_config &config)
audiocpu.set_addrmap(AS_PROGRAM, &_4enlinea_state::audio_map);
audiocpu.set_periodic_int(FUNC(_4enlinea_state::_4enlinea_audio_irq), attotime::from_hz(60)); //TODO
- I2CMEM(config, m_eeprom).set_page_size(16).set_data_size(0x800); // X24C16P
+ I2C_24C16(config, m_eeprom); // X24C16P
// FIXME: determine ISA bus clock
isa8_device &isa(ISA8(config, "isa", 0));
@@ -650,7 +650,7 @@ void _4enlinea_state::k7_olym(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // D4464C-15L (6264) + battery
- I2CMEM(config, m_eeprom).set_page_size(16).set_data_size(0x800); // X24C16P
+ I2C_24C16(config, m_eeprom); // X24C16P
isa8_device &isa(ISA8(config, "isa", 0));
isa.set_memspace("maincpu", AS_PROGRAM);
diff --git a/src/mame/drivers/aa310.cpp b/src/mame/drivers/aa310.cpp
index c78f23f31c5..74930e3ac62 100644
--- a/src/mame/drivers/aa310.cpp
+++ b/src/mame/drivers/aa310.cpp
@@ -91,7 +91,6 @@
#include "formats/apd_dsk.h"
#include "formats/jfd_dsk.h"
#include "formats/pc_dsk.h"
-#include "machine/i2cmem.h"
#include "machine/ram.h"
#include "machine/wd_fdc.h"
#include "sound/volt_reg.h"
@@ -427,7 +426,7 @@ void aa310_state::aa310(machine_config &config)
m_kart->out_tx_callback().set(FUNC(archimedes_state::a310_kart_tx_w));
m_kart->out_rx_callback().set(FUNC(archimedes_state::a310_kart_rx_w));
- I2CMEM(config, "i2cmem", 0).set_data_size(0x100);
+ PCF8583(config, "i2cmem", 0);
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp
index 7f8550dd95b..f63b98a889c 100644
--- a/src/mame/drivers/amiga.cpp
+++ b/src/mame/drivers/amiga.cpp
@@ -2123,7 +2123,7 @@ void cd32_state::cd32(machine_config &config)
ADDRESS_MAP_BANK(config, "overlay").set_map(&amiga_state::overlay_2mb_map32).set_options(ENDIANNESS_BIG, 32, 22, 0x200000);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(1024);
+ I2C_24C08(config, "i2cmem", 0); // AT24C08N
akiko_device &akiko(AKIKO(config, "akiko", 0));
akiko.mem_r_callback().set(FUNC(amiga_state::chip_ram_r));
diff --git a/src/mame/drivers/bbc.cpp b/src/mame/drivers/bbc.cpp
index a43af0061d6..d8966c27c60 100644
--- a/src/mame/drivers/bbc.cpp
+++ b/src/mame/drivers/bbc.cpp
@@ -1786,8 +1786,7 @@ void bbcm_state::bbcmc(machine_config &config)
FLOPPY_CONNECTOR(config, "wd1772:0", bbc_floppies, "35dd", bbc_state::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "wd1772:1", bbc_floppies, "35dd", bbc_state::floppy_formats).enable_sound(true);
- /* eeprom pcd8572 */
- I2CMEM(config, "i2cmem", 0).set_data_size(0x80);
+ I2C_PCD8572(config, "i2cmem", 0);
config.device_remove("rtc");
/* user via */
diff --git a/src/mame/drivers/cubo.cpp b/src/mame/drivers/cubo.cpp
index 75572b5c596..a8c5713533a 100644
--- a/src/mame/drivers/cubo.cpp
+++ b/src/mame/drivers/cubo.cpp
@@ -1042,7 +1042,7 @@ void cubo_state::cubo(machine_config &config)
ADDRESS_MAP_BANK(config, "overlay").set_map(&amiga_state::overlay_2mb_map32).set_options(ENDIANNESS_BIG, 32, 22, 0x200000);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(1024);
+ I2C_24C08(config, "i2cmem", 0); // AT24C08N
akiko_device &akiko(AKIKO(config, "akiko", 0));
akiko.mem_r_callback().set(FUNC(amiga_state::chip_ram_r));
diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp
index 3f990dd8a32..15fdc62b66a 100644
--- a/src/mame/drivers/cxhumax.cpp
+++ b/src/mame/drivers/cxhumax.cpp
@@ -1062,7 +1062,7 @@ void cxhumax_state::cxhumax(machine_config &config)
INTEL_28F320J3D(config, "flash");
- I2CMEM(config, "eeprom", 0).set_data_size(0x2000);
+ I2C_24C64(config, "eeprom", 0); // 24LC64
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/ertictac.cpp b/src/mame/drivers/ertictac.cpp
index 6b2ec938466..3d9b17570eb 100644
--- a/src/mame/drivers/ertictac.cpp
+++ b/src/mame/drivers/ertictac.cpp
@@ -26,7 +26,6 @@ PCB has a single OSC at 24MHz
#include "includes/archimds.h"
#include "cpu/arm/arm.h"
#include "machine/aakart.h"
-#include "machine/i2cmem.h"
#include "screen.h"
@@ -219,17 +218,13 @@ INTERRUPT_GEN_MEMBER(ertictac_state::ertictac_podule_irq)
archimedes_request_irq_b(ARCHIMEDES_IRQB_PODULE_IRQ);
}
-/* TODO: Are we sure that this HW have I2C device? */
-#define NVRAM_SIZE 256
-#define NVRAM_PAGE_SIZE 0 /* max size of one write request */
-
void ertictac_state::ertictac(machine_config &config)
{
ARM(config, m_maincpu, 24_MHz_XTAL/3); /* guess, 12MHz 8MHz or 6MHz, what's the correct divider 2, 3 or 4? */
m_maincpu->set_addrmap(AS_PROGRAM, &ertictac_state::ertictac_map);
m_maincpu->set_periodic_int(FUNC(ertictac_state::ertictac_podule_irq), attotime::from_hz(60)); // FIXME: timing of this
- I2CMEM(config, "i2cmem", 0).set_page_size(NVRAM_PAGE_SIZE).set_data_size(NVRAM_SIZE);
+ PCF8583(config, "i2cmem", 0); // TODO: Are we sure that this HW have I2C device?
// AAKART(config, m_kart, 24_MHz_XTAL/3); // TODO: frequency
diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp
index 2f92f3b8054..e31ae730960 100644
--- a/src/mame/drivers/funworld.cpp
+++ b/src/mame/drivers/funworld.cpp
@@ -3123,9 +3123,7 @@ void funworld_state::saloon(machine_config &config)
config.device_remove("pia1");
/* Serial Memory */
- i2cmem_device &m_i2cmem(I2CMEM(config, "i2cmem", 0));
- m_i2cmem.set_data_size(256);
- m_i2cmem.set_e0(1);
+ I2C_24C02(config, "i2cmem", 0).set_e0(1); // ? or maybe 2nd half of 24C04?
}
diff --git a/src/mame/drivers/ghosteo.cpp b/src/mame/drivers/ghosteo.cpp
index 97485bbdee4..61c4e0dbf31 100644
--- a/src/mame/drivers/ghosteo.cpp
+++ b/src/mame/drivers/ghosteo.cpp
@@ -635,7 +635,7 @@ void ghosteo_state::ghosteo(machine_config &config)
// nand.set_nand_type(nand_device::chip::K9F5608U0D); // or another variant with ID 0xEC 0x75 ?
// nand.rnb_wr_callback().set(m_s3c2410, FUNC(s3c2410_device::s3c24xx_pin_frnb_w));
-// I2CMEM(config, "i2cmem", 0, 0xA0, 0, 0x100, nullptr);
+ I2C_24C16(config, "i2cmem", 0); // M24CL16-S
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -659,14 +659,12 @@ void ghosteo_state::bballoon(machine_config &config)
{
ghosteo(config);
m_maincpu->set_addrmap(AS_PROGRAM, &ghosteo_state::bballoon_map);
- I2CMEM(config, "i2cmem", 0).set_data_size(256);
}
void ghosteo_state::touryuu(machine_config &config)
{
ghosteo(config);
m_maincpu->set_addrmap(AS_PROGRAM, &ghosteo_state::touryuu_map);
- I2CMEM(config, "i2cmem", 0).set_data_size(1024);
}
diff --git a/src/mame/drivers/hotblock.cpp b/src/mame/drivers/hotblock.cpp
index 5a1ed17a897..56cab2e41fa 100644
--- a/src/mame/drivers/hotblock.cpp
+++ b/src/mame/drivers/hotblock.cpp
@@ -184,7 +184,7 @@ void hotblock_state::hotblock(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &hotblock_state::hotblock_map);
m_maincpu->set_addrmap(AS_IO, &hotblock_state::hotblock_io);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24C04A
+ I2C_24C04(config, "i2cmem", 0); // 24C04A
ADDRESS_MAP_BANK(config, m_video_bank).set_map(&hotblock_state::banked_video_map).set_options(ENDIANNESS_LITTLE, 8, 24, 0x10000);
diff --git a/src/mame/drivers/microdar.cpp b/src/mame/drivers/microdar.cpp
index e4bda73c915..21bf927a6bb 100644
--- a/src/mame/drivers/microdar.cpp
+++ b/src/mame/drivers/microdar.cpp
@@ -120,7 +120,7 @@ void microdar_state::microdar(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // GM76C88ALK-15 + battery
- I2CMEM(config, m_eeprom).set_page_size(16).set_data_size(0x800);
+ I2C_24C16(config, m_eeprom); // 24LC16B
// Code also references some sort of serial RTC?
}
diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp
index 39ed4cf2eda..90c37a17415 100644
--- a/src/mame/drivers/pokemini.cpp
+++ b/src/mame/drivers/pokemini.cpp
@@ -1770,7 +1770,7 @@ void pokemini_state::pokemini(machine_config &config)
config.set_maximum_quantum(attotime::from_hz(60));
- I2CMEM(config, m_i2cmem, 0).set_data_size(0x2000);
+ I2C_24C64(config, m_i2cmem, 0); // ?
/* This still needs to be improved to actually match the hardware */
SCREEN(config, m_screen, SCREEN_TYPE_LCD);
diff --git a/src/mame/drivers/spg2xx_jakks.cpp b/src/mame/drivers/spg2xx_jakks.cpp
index 705a580c288..70e0c3feeb5 100644
--- a/src/mame/drivers/spg2xx_jakks.cpp
+++ b/src/mame/drivers/spg2xx_jakks.cpp
@@ -124,7 +124,7 @@ void jakks_state::base_config(machine_config& config)
m_maincpu->portc_in().set_ioport("P3");
m_maincpu->portc_out().set(FUNC(jakks_state::portc_w));
- I2CMEM(config, m_i2cmem, 0).set_data_size(0x200);
+ I2C_24C04(config, m_i2cmem, 0); // ?
}
void jakks_state::batman(machine_config &config)
diff --git a/src/mame/drivers/spg2xx_jakks_gkr.cpp b/src/mame/drivers/spg2xx_jakks_gkr.cpp
index f9f6b8258d7..b637ee8ddc6 100644
--- a/src/mame/drivers/spg2xx_jakks_gkr.cpp
+++ b/src/mame/drivers/spg2xx_jakks_gkr.cpp
@@ -447,7 +447,7 @@ void jakks_gkr_state::jakks_gkr(machine_config &config)
void jakks_gkr_state::jakks_gkr_i2c(machine_config &config)
{
jakks_gkr(config);
- I2CMEM(config, m_i2cmem, 0).set_data_size(0x200);
+ I2C_24C04(config, m_i2cmem, 0); // ?
}
diff --git a/src/mame/drivers/twinkle.cpp b/src/mame/drivers/twinkle.cpp
index 41e1d251004..30f917b65cf 100644
--- a/src/mame/drivers/twinkle.cpp
+++ b/src/mame/drivers/twinkle.cpp
@@ -1115,7 +1115,7 @@ void twinkle_state::twinklex(machine_config &config)
void twinkle_state::twinklei(machine_config &config)
{
twinkle(config);
- I2CMEM(config, "security", 0).set_data_size(0x100);
+ I2C_M24C02(config, "security", 0); // M24C02-W
}
static INPUT_PORTS_START( twinkle )
diff --git a/src/mame/drivers/xavix.cpp b/src/mame/drivers/xavix.cpp
index 50ce2923ff8..7e611c8d655 100644
--- a/src/mame/drivers/xavix.cpp
+++ b/src/mame/drivers/xavix.cpp
@@ -1562,25 +1562,18 @@ void xavix_guru_state::xavix_guru(machine_config &config)
}
-void xavix_i2c_state::xavix_i2c_24lc02(machine_config &config)
-{
- xavix(config);
-
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24LC02 (taiko)
-}
-
void xavix_i2c_state::xavix_i2c_24c02(machine_config &config)
{
xavix(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24C02
+ I2C_24C02(config, "i2cmem", 0);
}
void xavix_i2c_state::xavix_i2c_24lc04(machine_config &config)
{
xavix(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24LC04 on Nostalgia games, 24C04 on others
+ I2C_24C04(config, "i2cmem", 0); // 24LC04 on Nostalgia games, 24C04 on others
}
void xavix_i2c_ltv_tam_state::xavix_i2c_24lc04_tam(machine_config &config)
@@ -1597,7 +1590,7 @@ void xavix_i2c_state::xavix_i2c_24c08(machine_config &config)
{
xavix(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x400); // 24C08 (Excite Fishing DX)
+ I2C_24C08(config, "i2cmem", 0);
}
void xavix_state::xavixp(machine_config &config)
@@ -1654,9 +1647,7 @@ void xavix_state::xavix2002(machine_config &config)
void xavix_i2c_jmat_state::xavix2002_i2c_jmat(machine_config &config)
{
- xavix2002(config);
-
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // ?
+ xavix2002_i2c_24c04(config);
m_xavix2002io->read_0_callback().set(FUNC(xavix_i2c_jmat_state::read_extended_io0));
m_xavix2002io->write_0_callback().set(FUNC(xavix_i2c_jmat_state::write_extended_io0));
@@ -1688,14 +1679,14 @@ void xavix_i2c_state::xavix2000_i2c_24c04(machine_config &config)
{
xavix2000(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24C04
+ I2C_24C04(config, "i2cmem", 0);
}
void xavix_i2c_state::xavix2000_i2c_24c02(machine_config &config)
{
xavix2000(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24C02
+ I2C_24C02(config, "i2cmem", 0);
}
void xavix_mtrk_state::xavix_mtrk(machine_config &config)
@@ -1733,7 +1724,7 @@ void xavix_i2c_cart_state::xavix_i2c_taiko(machine_config &config)
{
xavix_cart(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24LC02
+ I2C_24C02(config, "i2cmem", 0); // 24LC02
SOFTWARE_LIST(config, "cart_list_japan_d").set_original("ekara_japan_d");
SOFTWARE_LIST(config, "cart_list_japan_sp").set_original("ekara_japan_sp");
@@ -1745,7 +1736,7 @@ void xavix_i2c_cart_state::xavix_i2c_jpopira(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24LC02
+ I2C_24C02(config, "i2cmem", 0); // 24LC02
SOFTWARE_LIST(config, "cart_list_jpopira_jp").set_original("jpopira_jp"); // NOTE, these are for Jumping Popira only, they don't work with the karaoke or regular popira units
SOFTWARE_LIST(config, "cart_list_japan_sp").set_original("ekara_japan_sp");
@@ -1856,14 +1847,14 @@ void xavix_i2c_state::xavix2002_i2c_24c04(machine_config &config)
{
xavix2002(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24C04
+ I2C_24C04(config, "i2cmem", 0);
}
void xavix_i2c_state::xavix2002_i2c_mrangbat(machine_config &config)
{
xavix2002(config);
- I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x100); // 24C02?
+ I2C_24C02(config, "i2cmem", 0); // 24C02?
m_xavix2002io->read_0_callback().set_ioport("EX0");
//m_xavix2002io->write_0_callback().set(FUNC(xavix_i2c_jmat_state::write_extended_io0));
diff --git a/src/mame/includes/archimds.h b/src/mame/includes/archimds.h
index e545d01f476..2d280d2f3fa 100644
--- a/src/mame/includes/archimds.h
+++ b/src/mame/includes/archimds.h
@@ -12,7 +12,7 @@
#include "cpu/arm/arm.h"
#include "imagedev/floppy.h"
#include "machine/aakart.h"
-#include "machine/i2cmem.h"
+#include "machine/pcf8583.h"
#include "machine/wd_fdc.h"
#include "machine/acorn_vidc.h"
@@ -90,7 +90,7 @@ public:
protected:
required_device<arm_cpu_device> m_maincpu;
- optional_device<i2cmem_device> m_i2cmem;
+ optional_device<pcf8583_device> m_i2cmem;
required_device<acorn_vidc10_device> m_vidc;
optional_device<wd1772_device> m_fdc;
optional_device<floppy_connector> m_floppy0;
diff --git a/src/mame/includes/xavix.h b/src/mame/includes/xavix.h
index e5ebcb0f865..d1ef57f5899 100644
--- a/src/mame/includes/xavix.h
+++ b/src/mame/includes/xavix.h
@@ -626,7 +626,6 @@ public:
hackaddress2(-1)
{ }
- void xavix_i2c_24lc02(machine_config &config);
void xavix_i2c_24lc04(machine_config &config);
void xavix_i2c_24c02(machine_config &config);
void xavix_i2c_24c08(machine_config &config);
diff --git a/src/mame/machine/archimds.cpp b/src/mame/machine/archimds.cpp
index 86f8cc67ac3..5d3d31763a1 100644
--- a/src/mame/machine/archimds.cpp
+++ b/src/mame/machine/archimds.cpp
@@ -462,7 +462,7 @@ READ32_MEMBER( archimedes_state::ioc_ctrl_r )
if ( m_i2cmem )
{
- i2c_data = (m_i2cmem->read_sda() & 1);
+ i2c_data = (m_i2cmem->sda_r() & 1);
}
floppy_ready_state = check_floppy_ready();
@@ -532,8 +532,8 @@ WRITE32_MEMBER( archimedes_state::ioc_ctrl_w )
//logerror("IOC I2C: CLK %d DAT %d\n", (data>>1)&1, data&1);
if ( m_i2cmem )
{
- m_i2cmem->write_sda(data & 0x01);
- m_i2cmem->write_scl((data & 0x02) >> 1);
+ m_i2cmem->sda_w(data & 0x01);
+ m_i2cmem->scl_w((data & 0x02) >> 1);
}
m_i2c_clk = (data & 2) >> 1;
//TODO: does writing bit 2 here causes a fdc force ready?