summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/i2cmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/i2cmem.h')
-rw-r--r--src/devices/machine/i2cmem.h83
1 files changed, 49 insertions, 34 deletions
diff --git a/src/devices/machine/i2cmem.h b/src/devices/machine/i2cmem.h
index c912709871d..dc4bb5f7f4f 100644
--- a/src/devices/machine/i2cmem.h
+++ b/src/devices/machine/i2cmem.h
@@ -33,50 +33,49 @@ 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; }
i2cmem_device & set_wc(int wc) { m_wc = wc; return *this; }
// I/O operations
- DECLARE_WRITE_LINE_MEMBER( write_e0 );
- DECLARE_WRITE_LINE_MEMBER( write_e1 );
- DECLARE_WRITE_LINE_MEMBER( write_e2 );
- DECLARE_WRITE_LINE_MEMBER( write_sda );
- DECLARE_WRITE_LINE_MEMBER( write_scl );
- DECLARE_WRITE_LINE_MEMBER( write_wc );
- DECLARE_READ_LINE_MEMBER( read_sda );
+ void write_e0(int state);
+ void write_e1(int state);
+ void write_e2(int state);
+ void write_sda(int state);
+ void write_scl(int state);
+ void write_wc(int state);
+ int read_sda();
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;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
// device_nvram_interface overrides
virtual void nvram_default() override;
- virtual void nvram_read( emu_file &file ) override;
- virtual void nvram_write( emu_file &file ) override;
+ virtual bool nvram_read( util::read_stream &file ) override;
+ virtual bool nvram_write( util::write_stream &file ) override;
+
+ // configuration helpers
+ void set_devsel_address_low(bool devsel_address_low) { m_devsel_address_low = devsel_address_low; }
// internal helpers
int address_mask();
int select_device();
int data_offset();
+ bool skip_addresshigh() const { return m_data_size <= 0x800; }
optional_memory_region m_region;
// 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;
@@ -89,11 +88,12 @@ protected:
int m_bits;
int m_shift;
int m_devsel;
+ int m_addresshigh;
int m_byteaddr;
std::vector<uint8_t> m_page;
int m_page_offset;
int m_page_written_size;
- bool m_in_write;
+ bool m_devsel_address_low;
};
#define DECLARE_I2C_DEVICE(name) \
@@ -103,22 +103,37 @@ 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(24c08)
+DECLARE_I2C_DEVICE(x24c01);
+DECLARE_I2C_DEVICE(24c01);
+DECLARE_I2C_DEVICE(pcf8570);
+DECLARE_I2C_DEVICE(pcd8572);
+DECLARE_I2C_DEVICE(pcf8582);
+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);
-
-// 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_24C02, i2c_24c02_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_I2C_DEVICE(24c128);
+DECLARE_I2C_DEVICE(24c256);
+DECLARE_I2C_DEVICE(24c512);
+
+// device type declaration
+DECLARE_DEVICE_TYPE(I2C_X24C01, i2c_x24c01_device)
+DECLARE_DEVICE_TYPE(I2C_24C01, i2c_24c01_device)
+DECLARE_DEVICE_TYPE(I2C_PCF8570, i2c_pcf8570_device)
+DECLARE_DEVICE_TYPE(I2C_PCD8572, i2c_pcd8572_device)
+DECLARE_DEVICE_TYPE(I2C_PCF8582, i2c_pcf8582_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_24C64, i2c_24c64_device)
+DECLARE_DEVICE_TYPE(I2C_24C128, i2c_24c128_device)
+DECLARE_DEVICE_TYPE(I2C_24C256, i2c_24c256_device)
+DECLARE_DEVICE_TYPE(I2C_24C512, i2c_24c512_device)
#endif // MAME_MACHINE_I2CMEM_H