eepromser: prevent ambiguity between clock and streaming enable (nw)

This commit is contained in:
Vas Crabb 2018-06-10 23:02:51 +10:00
parent b3e74fd124
commit fa80ebf367
7 changed files with 31 additions and 53 deletions

View File

@ -155,10 +155,10 @@ ALLOW_SAVE_TYPE(eeprom_serial_base_device::eeprom_state);
// eeprom_serial_base_device - constructor // eeprom_serial_base_device - constructor
//------------------------------------------------- //-------------------------------------------------
eeprom_serial_base_device::eeprom_serial_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming) eeprom_serial_base_device::eeprom_serial_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, eeprom_serial_streaming enable_streaming)
: eeprom_base_device(mconfig, devtype, tag, owner), : eeprom_base_device(mconfig, devtype, tag, owner),
m_command_address_bits(0), m_command_address_bits(0),
m_streaming_enabled(enable_streaming), m_streaming_enabled(bool(enable_streaming)),
m_output_on_falling_clock_enabled(false), m_output_on_falling_clock_enabled(false),
m_do_cb(*this), m_do_cb(*this),
m_state(STATE_IN_RESET), m_state(STATE_IN_RESET),
@ -621,16 +621,12 @@ void eeprom_serial_base_device::execute_write_command()
// STANDARD INTERFACE IMPLEMENTATION // STANDARD INTERFACE IMPLEMENTATION
//************************************************************************** //**************************************************************************
//------------------------------------------------- eeprom_serial_s29x90_device::eeprom_serial_s29x90_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, eeprom_serial_streaming ignored);
// eeprom_serial_93cxx_device - constructor : eeprom_serial_93cxx_device(mconfig, devtype, tag, owner, eeprom_serial_streaming::ENABLE)
//-------------------------------------------------
eeprom_serial_93cxx_device::eeprom_serial_93cxx_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming)
: eeprom_serial_base_device(mconfig, devtype, tag, owner, enable_streaming)
{ {
enable_output_on_falling_clock(true);
} }
//------------------------------------------------- //-------------------------------------------------
// parse_command_and_address - extract the // parse_command_and_address - extract the
// command and address from a bitstream // command and address from a bitstream
@ -688,16 +684,6 @@ WRITE_LINE_MEMBER(eeprom_serial_93cxx_device::di_write) { base_di_write(state);
// ER5911 DEVICE IMPLEMENTATION // ER5911 DEVICE IMPLEMENTATION
//************************************************************************** //**************************************************************************
//-------------------------------------------------
// eeprom_serial_er5911_device - constructor
//-------------------------------------------------
eeprom_serial_er5911_device::eeprom_serial_er5911_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming)
: eeprom_serial_base_device(mconfig, devtype, tag, owner, enable_streaming)
{
}
//------------------------------------------------- //-------------------------------------------------
// parse_command_and_address - extract the // parse_command_and_address - extract the
// command and address from a bitstream // command and address from a bitstream
@ -756,17 +742,6 @@ WRITE_LINE_MEMBER(eeprom_serial_er5911_device::di_write) { base_di_write(state);
// X24c44 DEVICE IMPLEMENTATION // X24c44 DEVICE IMPLEMENTATION
//************************************************************************** //**************************************************************************
//-------------------------------------------------
// eeprom_serial_x24c44_device - constructor
//-------------------------------------------------
eeprom_serial_x24c44_device::eeprom_serial_x24c44_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming)
: eeprom_serial_base_device(mconfig, devtype, tag, owner, enable_streaming)
{
}
//------------------------------------------------- //-------------------------------------------------
// device_start - device-specific startup // device_start - device-specific startup
//------------------------------------------------- //-------------------------------------------------
@ -1123,8 +1098,14 @@ WRITE_LINE_MEMBER(eeprom_serial_x24c44_device::di_write) { base_di_write(state);
// macro for defining a new device class // macro for defining a new device class
#define DEFINE_SERIAL_EEPROM_DEVICE(_baseclass, _lowercase, _uppercase, _bits, _cells, _addrbits) \ #define DEFINE_SERIAL_EEPROM_DEVICE(_baseclass, _lowercase, _uppercase, _bits, _cells, _addrbits) \
eeprom_serial_##_lowercase##_##_bits##bit_device::eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, bool enable_streaming) \ eeprom_serial_##_lowercase##_##_bits##bit_device::eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, eeprom_serial_streaming enable_streaming) \
: eeprom_serial_##_baseclass##_device(mconfig, EEPROM_SERIAL_##_uppercase##_##_bits##BIT, tag, owner, (bool)enable_streaming) \ : eeprom_serial_##_baseclass##_device(mconfig, EEPROM_SERIAL_##_uppercase##_##_bits##BIT, tag, owner, enable_streaming) \
{ \
set_size(_cells, _bits); \
set_address_bits(_addrbits); \
} \
eeprom_serial_##_lowercase##_##_bits##bit_device::eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) \
: eeprom_serial_##_baseclass##_device(mconfig, EEPROM_SERIAL_##_uppercase##_##_bits##BIT, tag, owner, eeprom_serial_streaming::DISABLE) \
{ \ { \
set_size(_cells, _bits); \ set_size(_cells, _bits); \
set_address_bits(_addrbits); \ set_address_bits(_addrbits); \

View File

@ -28,10 +28,10 @@
// TYPE DEFINITIONS // TYPE DEFINITIONS
//************************************************************************** //**************************************************************************
enum : bool enum class eeprom_serial_streaming : bool
{ {
EEPROM_SERIAL_NO_STREAMING = false, DISABLE = false,
EEPROM_SERIAL_ENABLE_STREAMING = true ENABLE = true
}; };
// ======================> eeprom_serial_base_device // ======================> eeprom_serial_base_device
@ -40,14 +40,13 @@ class eeprom_serial_base_device : public eeprom_base_device
{ {
public: public:
// inline configuration helpers // inline configuration helpers
void set_address_bits(int addrbits) { m_command_address_bits = addrbits; }
void enable_streaming(bool enable) { m_streaming_enabled = enable; } void enable_streaming(bool enable) { m_streaming_enabled = enable; }
void enable_output_on_falling_clock(bool enable) { m_output_on_falling_clock_enabled = enable; } void enable_output_on_falling_clock(bool enable) { m_output_on_falling_clock_enabled = enable; }
template<class Object> devcb_base &set_do_callback(Object &&cb) { return m_do_cb.set_callback(std::forward<Object>(cb)); } template<class Object> devcb_base &set_do_callback(Object &&cb) { return m_do_cb.set_callback(std::forward<Object>(cb)); }
protected: protected:
// construction/destruction // construction/destruction
eeprom_serial_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming = EEPROM_SERIAL_NO_STREAMING); eeprom_serial_base_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, eeprom_serial_streaming enable_streaming);
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
@ -91,6 +90,7 @@ protected:
}; };
// internal helpers // internal helpers
void set_address_bits(int addrbits) { m_command_address_bits = addrbits; }
void set_state(eeprom_state newstate); void set_state(eeprom_state newstate);
void execute_write_command(); void execute_write_command();
@ -145,7 +145,7 @@ public:
protected: protected:
// construction/destruction // construction/destruction
eeprom_serial_93cxx_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming = EEPROM_SERIAL_NO_STREAMING); using eeprom_serial_base_device::eeprom_serial_base_device;
// subclass overrides // subclass overrides
virtual void parse_command_and_address() override; virtual void parse_command_and_address() override;
@ -158,11 +158,7 @@ class eeprom_serial_s29x90_device : public eeprom_serial_93cxx_device
{ {
protected: protected:
// construction/destruction // construction/destruction
eeprom_serial_s29x90_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool ignored = EEPROM_SERIAL_NO_STREAMING) eeprom_serial_s29x90_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, eeprom_serial_streaming ignored);
: eeprom_serial_93cxx_device(mconfig, devtype, tag, owner, true)
{
enable_output_on_falling_clock(true);
}
}; };
@ -182,7 +178,7 @@ public:
protected: protected:
// construction/destruction // construction/destruction
eeprom_serial_er5911_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming = EEPROM_SERIAL_NO_STREAMING); using eeprom_serial_base_device::eeprom_serial_base_device;
// subclass overrides // subclass overrides
virtual void parse_command_and_address() override; virtual void parse_command_and_address() override;
@ -206,7 +202,7 @@ public:
protected: protected:
// construction/destruction // construction/destruction
eeprom_serial_x24c44_device(const machine_config &mconfig, device_type devtype, const char *tag, device_t *owner, bool enable_streaming = EEPROM_SERIAL_NO_STREAMING); using eeprom_serial_base_device::eeprom_serial_base_device;
// subclass overrides // subclass overrides
virtual void parse_command_and_address() override; virtual void parse_command_and_address() override;
@ -233,7 +229,8 @@ protected:
class eeprom_serial_##_lowercase##_##_bits##bit_device : public eeprom_serial_##_baseclass##_device \ class eeprom_serial_##_lowercase##_##_bits##bit_device : public eeprom_serial_##_baseclass##_device \
{ \ { \
public: \ public: \
eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, bool enable_streaming = EEPROM_SERIAL_NO_STREAMING); \ eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, eeprom_serial_streaming enable_streaming = eeprom_serial_streaming::DISABLE); \
eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); \
}; \ }; \
DECLARE_DEVICE_TYPE(EEPROM_SERIAL_##_uppercase##_##_bits##BIT, eeprom_serial_##_lowercase##_##_bits##bit_device) DECLARE_DEVICE_TYPE(EEPROM_SERIAL_##_uppercase##_##_bits##BIT, eeprom_serial_##_lowercase##_##_bits##bit_device)

View File

@ -2562,7 +2562,7 @@ MACHINE_CONFIG_START(cave_state::pacslot)
MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave)
MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start)
@ -2817,7 +2817,7 @@ MACHINE_CONFIG_START(cave_state::tekkencw)
MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave)
MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start)
@ -2871,7 +2871,7 @@ MACHINE_CONFIG_START(cave_state::tjumpman)
MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave)
MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start)

View File

@ -938,7 +938,7 @@ MACHINE_CONFIG_START(gaelco3d_state::gaelco3d)
MCFG_DEVICE_PROGRAM_MAP(adsp_program_map) MCFG_DEVICE_PROGRAM_MAP(adsp_program_map)
MCFG_DEVICE_DATA_MAP(adsp_data_map) MCFG_DEVICE_DATA_MAP(adsp_data_map)
MCFG_DEVICE_ADD(m_eeprom, EEPROM_SERIAL_93C66_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD(m_eeprom, EEPROM_SERIAL_93C66_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) MCFG_QUANTUM_TIME(attotime::from_hz(6000))

View File

@ -1061,7 +1061,7 @@ MACHINE_CONFIG_START(ataxx_state::ataxx)
MCFG_DEVICE_PROGRAM_MAP(slave_map_program) MCFG_DEVICE_PROGRAM_MAP(slave_map_program)
MCFG_DEVICE_IO_MAP(slave_map_io_2) MCFG_DEVICE_IO_MAP(slave_map_io_2)
MCFG_DEVICE_ADD(m_eeprom, EEPROM_SERIAL_93C56_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD(m_eeprom, EEPROM_SERIAL_93C56_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_NVRAM_ADD_0FILL("battery") MCFG_NVRAM_ADD_0FILL("battery")

View File

@ -468,7 +468,7 @@ MACHINE_CONFIG_START(tecmosys_state::tecmosys)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tecmosys) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tecmosys)
MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)

View File

@ -773,7 +773,7 @@ MACHINE_CONFIG_START(tmmjprd_state::tmmjprd)
MCFG_DEVICE_PROGRAM_MAP(tmmjprd_map) MCFG_DEVICE_PROGRAM_MAP(tmmjprd_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmmjprd_state, scanline, "lscreen", 0, 1) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmmjprd_state, scanline, "lscreen", 0, 1)
MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, EEPROM_SERIAL_ENABLE_STREAMING) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT, eeprom_serial_streaming::ENABLE)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tmmjprd) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tmmjprd)