From 10f7d87f23c726bf445fb92db179714c842ae2d1 Mon Sep 17 00:00:00 2001 From: davidhay Date: Thu, 2 Apr 2009 20:48:28 +0000 Subject: Eeprom and i2c implemeted as devices [Samuele Zannoli] The eepromdev.* files are the device impementation for the serial eeproms The i2cmemdev.* files are the device impementation for the i2c memory These aren't currently hooked up I'm committing this so that the Naomi changes don't accidentally get applied. The idea seems good, but they conflict with the current driver and I'd rather not have them accidentally slipping in and breaking things just yet. --- src/emu/machine/i2cmemdev.h | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/emu/machine/i2cmemdev.h (limited to 'src/emu/machine/i2cmemdev.h') diff --git a/src/emu/machine/i2cmemdev.h b/src/emu/machine/i2cmemdev.h new file mode 100644 index 00000000000..bf8939f883a --- /dev/null +++ b/src/emu/machine/i2cmemdev.h @@ -0,0 +1,46 @@ +/* + * I2C Memory + * + */ + +#if !defined( I2CMEMDEV_H ) +#define I2CMEMDEV_H ( 1 ) + +#define I2CMEM_E0 ( 1 ) +#define I2CMEM_E1 ( 2 ) +#define I2CMEM_E2 ( 3 ) +#define I2CMEM_SDA ( 5 ) +#define I2CMEM_SCL ( 6 ) +#define I2CMEM_WC ( 7 ) + +#define I2CMEM_SLAVE_ADDRESS ( 0xa0 ) +#define I2CMEM_SLAVE_ADDRESS_ALT ( 0xb0 ) + +typedef struct _i2cmem_config i2cmem_config; +struct _i2cmem_config +{ + const int slave_address; + const int page_size; + const int data_size; + const char *data; +}; + +#define I2CMEM DEVICE_GET_INFO_NAME(i2cmem) +DEVICE_GET_INFO(i2cmem); + +#define MDRV_I2CMEM_ADD(_tag, _slave_address, _page_size, _data_size, _data) \ + MDRV_DEVICE_ADD(_tag, I2CMEM, 0) \ + MDRV_DEVICE_CONFIG_DATA32(i2cmem_config, slave_address, _slave_address) \ + MDRV_DEVICE_CONFIG_DATA32(i2cmem_config, page_size, _page_size) \ + MDRV_DEVICE_CONFIG_DATA32(i2cmem_config, data_size, _data_size) \ + MDRV_DEVICE_CONFIG_DATAPTR(i2cmem_config, data, _data) + +#define MDRV_I2CMEM_REMOVE(_tag) \ + MDRV_DEVICE_REMOVE(_tag, I2CMEM) + + +void i2cmemdev_write( const device_config *device, int line, int data ); +int i2cmemdev_read( const device_config *device, int line ); +void i2cmemdev_set_read_mode( const device_config *device, int mode ); + +#endif -- cgit v1.2.3-70-g09d2