summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2014-04-15 16:53:51 +0000
committer Ivan Vangelista <mesgnet@yahoo.it>2014-04-15 16:53:51 +0000
commitb244eb857002271d3d9a1ad871c7b530cd351e86 (patch)
treee3a5705c4c9332bbc1a0ba3ab9c027019e8dbb42 /src
parentbbad592d0cdc05d2b163456a13a578cd431cb857 (diff)
aakart_device: converted to devcb2 (nw)
Diffstat (limited to 'src')
-rw-r--r--src/emu/machine/aakart.c47
-rw-r--r--src/emu/machine/aakart.h26
-rw-r--r--src/mame/drivers/aristmk5.c12
-rw-r--r--src/mess/drivers/a310.c10
4 files changed, 32 insertions, 63 deletions
diff --git a/src/emu/machine/aakart.c b/src/emu/machine/aakart.c
index e6884107f05..7e7503af318 100644
--- a/src/emu/machine/aakart.c
+++ b/src/emu/machine/aakart.c
@@ -38,7 +38,9 @@ const device_type AAKART = &device_creator<aakart_device>;
//-------------------------------------------------
aakart_device::aakart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, AAKART, "AAKART", tag, owner, clock, "aakart", __FILE__)
+ : device_t(mconfig, AAKART, "AAKART", tag, owner, clock, "aakart", __FILE__),
+ m_out_tx_cb(*this),
+ m_out_rx_cb(*this)
{
}
@@ -59,8 +61,8 @@ void aakart_device::device_validity_check(validity_checker &valid) const
void aakart_device::device_start()
{
- m_out_tx_func.resolve(m_out_tx_cb, *this);
- m_out_rx_func.resolve(m_out_rx_cb, *this);
+ m_out_tx_cb.resolve_safe();
+ m_out_rx_cb.resolve_safe();
m_rxtimer = timer_alloc(RX_TIMER);
m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
m_txtimer = timer_alloc(TX_TIMER);
@@ -72,27 +74,6 @@ void aakart_device::device_start()
}
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void aakart_device::device_config_complete()
-{
- // inherit a copy of the static data
- const aakart_interface *intf = reinterpret_cast<const aakart_interface *>(static_config());
- if (intf != NULL)
- *static_cast<aakart_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_tx_cb, 0, sizeof(m_out_tx_cb));
- memset(&m_out_rx_cb, 0, sizeof(m_out_rx_cb));
- }
-}
-
-//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
@@ -124,7 +105,7 @@ void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param
break;
case 0x20:
m_rx = 0x81;
- m_out_tx_func(ASSERT_LINE);
+ m_out_tx_cb(ASSERT_LINE);
break;
case 0x30:
case 0x31:
@@ -136,7 +117,7 @@ void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param
{
//printf("Got row\n");
m_rx = m_keyb_row;
- m_out_tx_func(ASSERT_LINE);
+ m_out_tx_cb(ASSERT_LINE);
}
break;
@@ -145,22 +126,22 @@ void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param
{
//printf("Got col\n");
m_rx = m_keyb_col;
- m_out_tx_func(ASSERT_LINE);
+ m_out_tx_cb(ASSERT_LINE);
m_keyb_state = 0;
}
break;
case 0xfd:
m_rx = 0xfd;
- m_out_tx_func(ASSERT_LINE);
+ m_out_tx_cb(ASSERT_LINE);
break;
case 0xfe:
m_rx = 0xfe;
- m_out_tx_func(ASSERT_LINE);
+ m_out_tx_cb(ASSERT_LINE);
break;
case 0xff:
m_rx = 0xff;
- m_out_tx_func(ASSERT_LINE);
+ m_out_tx_cb(ASSERT_LINE);
break;
default:
printf("%02x %02x %02x\n",m_tx_latch,m_rx_latch,m_keyb_enable);
@@ -168,7 +149,7 @@ void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param
}
//m_new_command &= ~1;
- m_out_rx_func(ASSERT_LINE);
+ m_out_rx_cb(ASSERT_LINE);
}
}
@@ -181,7 +162,7 @@ void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param
READ8_MEMBER( aakart_device::read )
{
- m_out_tx_func(CLEAR_LINE);
+ m_out_tx_cb(CLEAR_LINE);
//debugger_break(machine());
return m_rx;
}
@@ -191,7 +172,7 @@ WRITE8_MEMBER( aakart_device::write )
// if(m_new_command) printf("skip cmd %02x\n",data);
m_tx_latch = data;
- m_out_rx_func(CLEAR_LINE);
+ m_out_rx_cb(CLEAR_LINE);
m_new_command |= 1;
}
diff --git a/src/emu/machine/aakart.h b/src/emu/machine/aakart.h
index ef4ee16ece0..40555900a1d 100644
--- a/src/emu/machine/aakart.h
+++ b/src/emu/machine/aakart.h
@@ -15,17 +15,12 @@ Acorn Archimedes KART interface
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_AAKART_ADD(_tag, _freq, _config) \
- MCFG_DEVICE_ADD(_tag, AAKART, _freq) \
- MCFG_DEVICE_CONFIG(_config)
-#define AAKART_INTERFACE(name) \
- const aakart_interface (name) =
+#define MCFG_AAKART_OUT_TX_CB(_devcb) \
+ devcb = &aakart_device::set_out_tx_callback(*device, DEVCB2_##_devcb);
-struct aakart_interface
-{
- devcb_write_line m_out_tx_cb;
- devcb_write_line m_out_rx_cb;
-};
+#define MCFG_AAKART_OUT_RX_CB(_devcb) \
+ devcb = &aakart_device::set_out_rx_callback(*device, DEVCB2_##_devcb);
+
enum{
STATUS_NORMAL = 0,
@@ -42,12 +37,14 @@ enum{
// ======================> aakart_device
-class aakart_device : public device_t,
- public aakart_interface
+class aakart_device : public device_t
{
public:
// construction/destruction
aakart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ template<class _Object> static devcb2_base &set_out_tx_callback(device_t &device, _Object object) { return downcast<aakart_device &>(device).m_out_tx_cb.set_callback(object); }
+ template<class _Object> static devcb2_base &set_out_rx_callback(device_t &device, _Object object) { return downcast<aakart_device &>(device).m_out_rx_cb.set_callback(object); }
// I/O operations
DECLARE_WRITE8_MEMBER( write );
@@ -60,7 +57,6 @@ protected:
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
- virtual void device_config_complete();
private:
static const device_timer_id RX_TIMER = 1;
@@ -72,8 +68,8 @@ private:
emu_timer * m_mousetimer;
emu_timer * m_keybtimer;
- devcb_resolved_write_line m_out_tx_func;
- devcb_resolved_write_line m_out_rx_func;
+ devcb2_write_line m_out_tx_cb;
+ devcb2_write_line m_out_rx_cb;
UINT8 m_tx_latch, m_rx_latch;
UINT8 m_rx;
UINT8 m_new_command;
diff --git a/src/mame/drivers/aristmk5.c b/src/mame/drivers/aristmk5.c
index 0103f615365..80207b26d8a 100644
--- a/src/mame/drivers/aristmk5.c
+++ b/src/mame/drivers/aristmk5.c
@@ -414,12 +414,6 @@ void aristmk5_state::machine_reset()
#define NVRAM_PAGE_SIZE 0 /* max size of one write request */
#endif
-/* TODO: this isn't supposed to access a keyboard ... */
-static AAKART_INTERFACE( kart_interface )
-{
- DEVCB_NULL,
- DEVCB_NULL
-};
static MACHINE_CONFIG_START( aristmk5, aristmk5_state )
MCFG_CPU_ADD("maincpu", ARM, 12000000)
@@ -429,7 +423,8 @@ static MACHINE_CONFIG_START( aristmk5, aristmk5_state )
// MCFG_I2CMEM_ADD("i2cmem")
// MCFG_I2CMEM_PAGE_SIZE(NVRAM_PAGE_SIZE)
// MCFG_I2CMEM_DATA_SIZE(NVRAM_SIZE)
- MCFG_AAKART_ADD("kart", 12000000/128, kart_interface) // TODO: frequency
+ /* TODO: this isn't supposed to access a keyboard ... */
+ MCFG_DEVICE_ADD("kart", AAKART, 12000000/128) // TODO: frequency
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -474,7 +469,8 @@ static MACHINE_CONFIG_START( aristmk5_usa, aristmk5_state )
// MCFG_I2CMEM_ADD("i2cmem")
// MCFG_I2CMEM_PAGE_SIZE(NVRAM_PAGE_SIZE)
// MCFG_I2CMEM_DATA_SIZE(NVRAM_SIZE)
- MCFG_AAKART_ADD("kart", 12000000/128, kart_interface) // TODO: frequency
+ /* TODO: this isn't supposed to access a keyboard ... */
+ MCFG_DEVICE_ADD("kart", AAKART, 12000000/128) // TODO: frequency
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mess/drivers/a310.c b/src/mess/drivers/a310.c
index a3fb724afdb..ff63c9c02d8 100644
--- a/src/mess/drivers/a310.c
+++ b/src/mess/drivers/a310.c
@@ -349,12 +349,6 @@ WRITE_LINE_MEMBER( archimedes_state::a310_kart_rx_w )
archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY);
}
-static AAKART_INTERFACE( kart_interface )
-{
- DEVCB_DRIVER_LINE_MEMBER(archimedes_state, a310_kart_tx_w),
- DEVCB_DRIVER_LINE_MEMBER(archimedes_state, a310_kart_rx_w)
-};
-
static ARM_INTERFACE( a310_config )
{
ARM_COPRO_TYPE_VL86C020
@@ -367,7 +361,9 @@ static MACHINE_CONFIG_START( a310, a310_state )
MCFG_CPU_PROGRAM_MAP(a310_mem)
MCFG_CPU_CONFIG(a310_config)
- MCFG_AAKART_ADD("kart", 8000000/256, kart_interface)
+ MCFG_DEVICE_ADD("kart", AAKART, 8000000/256)
+ MCFG_AAKART_OUT_TX_CB(WRITELINE(archimedes_state, a310_kart_tx_w))
+ MCFG_AAKART_OUT_RX_CB(WRITELINE(archimedes_state, a310_kart_rx_w))
MCFG_I2CMEM_ADD("i2cmem")
MCFG_I2CMEM_DATA_SIZE(0x100)