diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2017-11-12 02:03:10 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2017-11-12 02:03:10 -0500 |
commit | f171f5556807431f3d6388e385fdc4fde073a07c (patch) | |
tree | d0f1ed59b6fad4140f297da053b58b03a5bef2b4 | |
parent | 3169eb94c55e63b8e63e09b0398c17befbd2eddd (diff) |
tti: Add serial EEPROM using new DO write callback (nw)
-rw-r--r-- | src/devices/machine/eepromser.cpp | 31 | ||||
-rw-r--r-- | src/devices/machine/eepromser.h | 7 | ||||
-rw-r--r-- | src/mame/drivers/tti.cpp | 13 |
3 files changed, 34 insertions, 17 deletions
diff --git a/src/devices/machine/eepromser.cpp b/src/devices/machine/eepromser.cpp index 74d51e980f3..0ca2a10a282 100644 --- a/src/devices/machine/eepromser.cpp +++ b/src/devices/machine/eepromser.cpp @@ -148,6 +148,7 @@ eeprom_serial_base_device::eeprom_serial_base_device(const machine_config &mconf m_command_address_bits(0), m_streaming_enabled(false), m_output_on_falling_clock_enabled(false), + m_do_cb(*this), m_state(STATE_IN_RESET), m_cs_state(CLEAR_LINE), m_last_cs_rising_edge_time(attotime::zero), @@ -211,6 +212,9 @@ void eeprom_serial_base_device::device_start() // start the base class eeprom_base_device::device_start(); + // resolve callback + m_do_cb.resolve_safe(); + // save the current state save_item(NAME(m_state)); save_item(NAME(m_cs_state)); @@ -368,6 +372,9 @@ void eeprom_serial_base_device::set_state(eeprom_state newstate) // switch to the new state m_state = newstate; + + // set DO high (actually high impedance; pullup assumed) + m_do_cb(1); } @@ -443,6 +450,9 @@ void eeprom_serial_base_device::handle_event(eeprom_event event) m_shift_register = read((m_address + m_bits_accum / m_data_bits) & ((1 << m_address_bits) - 1)) << (32 - m_data_bits); else m_shift_register = (m_shift_register << 1) | 1; + + // update DO + m_do_cb(BIT(m_shift_register, 31)); } else if (event == EVENT_CS_FALLING_EDGE) { @@ -785,12 +795,8 @@ eeprom_serial_x24c44_device::eeprom_serial_x24c44_device(const machine_config &m void eeprom_serial_x24c44_device::device_start() { - // if no command address bits set, just inherit from the address bits - if (m_command_address_bits == 0) - m_command_address_bits = m_address_bits; - // start the base class - eeprom_base_device::device_start(); + eeprom_serial_base_device::device_start(); int16_t i=0; m_ram_length=0xf; @@ -800,18 +806,8 @@ void eeprom_serial_x24c44_device::device_start() } m_reading=0; m_store_latch=0; + // save the current state - save_item(NAME(m_state)); - save_item(NAME(m_cs_state)); - save_item(NAME(m_oe_state)); - save_item(NAME(m_clk_state)); - save_item(NAME(m_di_state)); - save_item(NAME(m_locked)); - save_item(NAME(m_bits_accum)); - save_item(NAME(m_command_address_accum)); - save_item(NAME(m_command)); - save_item(NAME(m_address)); - save_item(NAME(m_shift_register)); save_item(NAME(m_ram_data)); save_item(NAME(m_reading)); save_item(NAME(m_store_latch)); @@ -1012,6 +1008,9 @@ void eeprom_serial_x24c44_device::handle_event(eeprom_event event) m_shift_register = (m_shift_register << 1) | 1; } + + // update DO + m_do_cb(BIT(m_shift_register, 31)); } else if (event == EVENT_CS_FALLING_EDGE) { diff --git a/src/devices/machine/eepromser.h b/src/devices/machine/eepromser.h index 529fbeb5b04..d0d662948d8 100644 --- a/src/devices/machine/eepromser.h +++ b/src/devices/machine/eepromser.h @@ -91,6 +91,8 @@ #define MCFG_EEPROM_SERIAL_DATA MCFG_EEPROM_DATA #define MCFG_EEPROM_SERIAL_DEFAULT_VALUE MCFG_EEPROM_DEFAULT_VALUE +#define MCFG_EEPROM_SERIAL_DO_CALLBACK(_devcb) \ + devcb = &eeprom_serial_base_device::static_set_do_callback(*device, DEVCB_##_devcb); //************************************************************************** @@ -107,6 +109,10 @@ public: static void static_set_address_bits(device_t &device, int addrbits); static void static_enable_streaming(device_t &device); static void static_enable_output_on_falling_clock(device_t &device); + template<class Object> static devcb_base &static_set_do_callback(device_t &device, Object &&object) + { + return downcast<eeprom_serial_base_device &>(device).m_do_cb.set_callback(std::forward<Object>(object)); + } protected: // construction/destruction @@ -174,6 +180,7 @@ protected: uint8_t m_command_address_bits; // number of address bits in a command bool m_streaming_enabled; // true if streaming is enabled bool m_output_on_falling_clock_enabled; // true if the output pin is updated on the falling edge of the clock + devcb_write_line m_do_cb; // callback to push state of DO line // runtime state eeprom_state m_state; // current internal state diff --git a/src/mame/drivers/tti.cpp b/src/mame/drivers/tti.cpp index 099ae41bf10..9defebdb4f5 100644 --- a/src/mame/drivers/tti.cpp +++ b/src/mame/drivers/tti.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders: +// copyright-holders:AJR /*********************************************************************************************************************************** 2017-11-02 Skeleton @@ -16,6 +16,8 @@ Other: LED, 20MHz crystal. Next to the MC68901P is another chip just as large (4 #include "emu.h" #include "bus/rs232/rs232.h" #include "cpu/m68000/m68000.h" +#include "machine/74259.h" +#include "machine/eepromser.h" #include "machine/mc68901.h" class tti_state : public driver_device @@ -46,6 +48,7 @@ static ADDRESS_MAP_START( prg_map, AS_PROGRAM, 8, tti_state ) AM_RANGE(0x00000, 0x07fff) AM_ROM AM_REGION("maincpu", 0) AM_RANGE(0x78000, 0x7ffff) AM_RAM AM_RANGE(0x80000, 0x80017) AM_DEVREADWRITE("mfp", mc68901_device, read, write) + AM_RANGE(0x80070, 0x80077) AM_DEVWRITE("bitlatch", ls259_device, write_d0) ADDRESS_MAP_END static MACHINE_CONFIG_START( tti ) @@ -62,6 +65,14 @@ static MACHINE_CONFIG_START( tti ) MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(DEVWRITELINE("mfp", mc68901_device, write_rx)) + + MCFG_EEPROM_SERIAL_X24C44_ADD("eeprom") // actual type unknown + MCFG_EEPROM_SERIAL_DO_CALLBACK(DEVWRITELINE("mfp", mc68901_device, i0_w)) + + MCFG_DEVICE_ADD("bitlatch", LS259, 0) // actual type unknown + MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(DEVWRITELINE("eeprom", eeprom_serial_x24c44_device, di_write)) + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(DEVWRITELINE("eeprom", eeprom_serial_x24c44_device, clk_write)) + MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(DEVWRITELINE("eeprom", eeprom_serial_x24c44_device, cs_write)) MACHINE_CONFIG_END ROM_START( tti ) |