From 019ef6e963a7ea80e45d57af4f332f9bac27cc00 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 21 Apr 2014 09:26:41 +0000 Subject: [PATCH] legacy timer device callback removed (nw) --- src/emu/timer.h | 12 ------------ src/mame/drivers/harddriv.c | 4 ++-- src/mame/drivers/igs011.c | 36 +++++++++++++++++------------------- src/mame/drivers/sliver.c | 9 ++++----- src/mame/includes/harddriv.h | 8 +++++--- src/mame/machine/harddriv.c | 28 ++++++++++++---------------- 6 files changed, 40 insertions(+), 57 deletions(-) diff --git a/src/emu/timer.h b/src/emu/timer.h index 149fdadff0e..5deb159b5be 100644 --- a/src/emu/timer.h +++ b/src/emu/timer.h @@ -24,25 +24,15 @@ //************************************************************************** // macros for a timer callback functions -#define TIMER_DEVICE_CALLBACK(name) void name(device_t *, timer_device &timer, void *ptr, INT32 param) #define TIMER_DEVICE_CALLBACK_MEMBER(name) void name(timer_device &timer, void *ptr, INT32 param) //************************************************************************** // TIMER DEVICE CONFIGURATION MACROS //************************************************************************** -#define MCFG_TIMER_ADD(_tag, _callback) \ - MCFG_DEVICE_ADD(_tag, TIMER, 0) \ - timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_callback, #_callback)); #define MCFG_TIMER_ADD_NONE(_tag) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ timer_device::static_configure_generic(*device, timer_device_expired_delegate()); -#define MCFG_TIMER_ADD_PERIODIC(_tag, _callback, _period) \ - MCFG_DEVICE_ADD(_tag, TIMER, 0) \ - timer_device::static_configure_periodic(*device, timer_device_expired_delegate(&_callback, #_callback), _period); -#define MCFG_TIMER_ADD_SCANLINE(_tag, _callback, _screen, _first_vpos, _increment) \ - MCFG_DEVICE_ADD(_tag, TIMER, 0) \ - timer_device::static_configure_scanline(*device, timer_device_expired_delegate(&_callback, #_callback), _screen, _first_vpos, _increment); #define MCFG_TIMER_DRIVER_ADD(_tag, _class, _callback) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0)); @@ -64,8 +54,6 @@ #define MCFG_TIMER_MODIFY(_tag) \ MCFG_DEVICE_MODIFY(_tag) -#define MCFG_TIMER_CALLBACK(_callback) \ - timer_device::static_set_callback(*device, timer_device_expired_delegate(&_callback, #_callback)); #define MCFG_TIMER_DRIVER_CALLBACK(_class, _callback) \ timer_device::static_set_callback(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0)); #define MCFG_TIMER_START_DELAY(_start_delay) \ diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c index aca4e67d932..99d89ce8096 100644 --- a/src/mame/drivers/harddriv.c +++ b/src/mame/drivers/harddriv.c @@ -1424,13 +1424,13 @@ static MACHINE_CONFIG_FRAGMENT( ds3 ) MCFG_ADSP21XX_CONFIG(ds3sdsp_config) MCFG_CPU_PROGRAM_MAP(ds3sdsp_program_map) MCFG_CPU_DATA_MAP(ds3sdsp_data_map) - MCFG_TIMER_ADD("ds3sdsp_timer", ds3sdsp_internal_timer_callback) + MCFG_TIMER_DRIVER_ADD("ds3sdsp_timer", harddriv_state, ds3sdsp_internal_timer_callback) MCFG_CPU_ADD("ds3xdsp", ADSP2105, XTAL_10MHz) MCFG_ADSP21XX_CONFIG(ds3xdsp_config) MCFG_CPU_PROGRAM_MAP(ds3xdsp_program_map) MCFG_CPU_DATA_MAP(ds3xdsp_data_map) - MCFG_TIMER_ADD("ds3xdsp_timer", ds3xdsp_internal_timer_callback) + MCFG_TIMER_DRIVER_ADD("ds3xdsp_timer", harddriv_state, ds3xdsp_internal_timer_callback) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c index bca4b2f1a08..31056aebd6f 100644 --- a/src/mame/drivers/igs011.c +++ b/src/mame/drivers/igs011.c @@ -205,6 +205,9 @@ public: DECLARE_DRIVER_INIT(vbowl); DECLARE_DRIVER_INIT(vbowlj); DECLARE_DRIVER_INIT(ryukobou); + TIMER_DEVICE_CALLBACK_MEMBER(lev5_timer_irq_cb); + TIMER_DEVICE_CALLBACK_MEMBER(lhb_timer_irq_cb); + TIMER_DEVICE_CALLBACK_MEMBER(lev3_timer_irq_cb); virtual void video_start(); UINT32 screen_update_igs011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_vbowl(screen_device &screen, bool state); @@ -3950,18 +3953,16 @@ static MACHINE_CONFIG_START( igs011_base, igs011_state ) MACHINE_CONFIG_END -static TIMER_DEVICE_CALLBACK ( lev5_timer_irq_cb ) +TIMER_DEVICE_CALLBACK_MEMBER( igs011_state::lev5_timer_irq_cb ) { - igs011_state *state = timer.machine().driver_data(); - - state->m_maincpu->set_input_line(5, HOLD_LINE); + m_maincpu->set_input_line(5, HOLD_LINE); } static MACHINE_CONFIG_DERIVED( drgnwrld, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(drgnwrld) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, irq6_line_hold) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lev5_timer_irq_cb, attotime::from_hz(240)) // lev5 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lev5_timer_irq_cb, attotime::from_hz(240)) // lev5 frequency drives the music tempo MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_3_579545MHz) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) @@ -3982,30 +3983,27 @@ INTERRUPT_GEN_MEMBER(igs011_state::lhb_vblank_irq) m_maincpu->set_input_line(6, HOLD_LINE); } -static TIMER_DEVICE_CALLBACK ( lhb_timer_irq_cb ) +TIMER_DEVICE_CALLBACK_MEMBER( igs011_state::lhb_timer_irq_cb ) { - igs011_state *state = timer.machine().driver_data(); - if (!state->m_lhb_irq_enable) + if (!m_lhb_irq_enable) return; - state->m_maincpu->set_input_line(5, HOLD_LINE); + m_maincpu->set_input_line(5, HOLD_LINE); } static MACHINE_CONFIG_DERIVED( lhb, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(lhb) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, lhb_vblank_irq) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lhb_timer_irq_cb, attotime::from_hz(240)) // lev5 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lhb_timer_irq_cb, attotime::from_hz(240)) // lev5 frequency drives the music tempo // irq 3 points to an apparently unneeded routine MACHINE_CONFIG_END -static TIMER_DEVICE_CALLBACK ( lev3_timer_irq_cb ) +TIMER_DEVICE_CALLBACK_MEMBER( igs011_state::lev3_timer_irq_cb ) { - igs011_state *state = timer.machine().driver_data(); - - state->m_maincpu->set_input_line(3, HOLD_LINE); + m_maincpu->set_input_line(3, HOLD_LINE); } @@ -4013,7 +4011,7 @@ static MACHINE_CONFIG_DERIVED( wlcc, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(wlcc) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, irq6_line_hold) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo MACHINE_CONFIG_END @@ -4022,7 +4020,7 @@ static MACHINE_CONFIG_DERIVED( xymg, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(xymg) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, irq6_line_hold) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo MACHINE_CONFIG_END @@ -4031,7 +4029,7 @@ static MACHINE_CONFIG_DERIVED( lhb2, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(lhb2) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, irq6_line_hold) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lev5_timer_irq_cb, attotime::from_hz(240)) // lev5 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lev5_timer_irq_cb, attotime::from_hz(240)) // lev5 frequency drives the music tempo // MCFG_GFXDECODE_ADD("gfxdecode", "palette", igs011_hi) @@ -4045,7 +4043,7 @@ static MACHINE_CONFIG_DERIVED( nkishusp, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(nkishusp) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, irq6_line_hold) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo // VSync 60.0052Hz, HSync 15.620kHz @@ -4066,7 +4064,7 @@ static MACHINE_CONFIG_DERIVED( vbowl, igs011_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(vbowl) MCFG_CPU_VBLANK_INT_DRIVER("screen", igs011_state, irq6_line_hold) - MCFG_TIMER_ADD_PERIODIC("timer_irq", lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_irq", igs011_state, lev3_timer_irq_cb, attotime::from_hz(240)) // lev3 frequency drives the music tempo // irq 5 points to a debug function (all routines are clearly patched out) // irq 4 points to an apparently unneeded routine diff --git a/src/mame/drivers/sliver.c b/src/mame/drivers/sliver.c index aa47bd3e429..eb91d6626ef 100644 --- a/src/mame/drivers/sliver.c +++ b/src/mame/drivers/sliver.c @@ -114,6 +114,7 @@ public: DECLARE_WRITE16_MEMBER(io_data_w); DECLARE_WRITE16_MEMBER(sound_w); DECLARE_WRITE8_MEMBER(oki_setbank); + TIMER_DEVICE_CALLBACK_MEMBER(obj_irq_cb); virtual void video_start(); UINT32 screen_update_sliver(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void plot_pixel_rgb(int x, int y, UINT32 r, UINT32 g, UINT32 b); @@ -454,18 +455,16 @@ static ADDRESS_MAP_START( ramdac_map, AS_0, 8, sliver_state ) AM_RANGE(0x000, 0x3ff) AM_RAM AM_SHARE("colorram") ADDRESS_MAP_END -static TIMER_DEVICE_CALLBACK ( obj_irq_cb ) +TIMER_DEVICE_CALLBACK_MEMBER ( sliver_state::obj_irq_cb ) { - sliver_state *state = timer.machine().driver_data(); - - state->m_maincpu->set_input_line(3, HOLD_LINE); + m_maincpu->set_input_line(3, HOLD_LINE); } static MACHINE_CONFIG_START( sliver, sliver_state ) MCFG_CPU_ADD("maincpu", M68000, 12000000) MCFG_CPU_PROGRAM_MAP(sliver_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", sliver_state, irq4_line_hold) - MCFG_TIMER_ADD_PERIODIC("obj_actel", obj_irq_cb, attotime::from_hz(60)) /* unknown clock, causes "obj actel ready error" without this */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("obj_actel", sliver_state, obj_irq_cb, attotime::from_hz(60)) /* unknown clock, causes "obj actel ready error" without this */ // irq 2 valid but not used? MCFG_CPU_ADD("audiocpu", I8051, 8000000) diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index 3d13520f5ee..17622898e46 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -450,6 +450,11 @@ public: /* DSK board */ DECLARE_WRITE32_MEMBER(hddsk_update_pif); + + /* DS III/IV board */ + TIMER_DEVICE_CALLBACK_MEMBER( ds3sdsp_internal_timer_callback ); + TIMER_DEVICE_CALLBACK_MEMBER( ds3xdsp_internal_timer_callback ); + }; @@ -459,9 +464,6 @@ public: void hdgsp_irq_gen(device_t *device, int state); void hdmsp_irq_gen(device_t *device, int state); -/* DS III/IV board */ -TIMER_DEVICE_CALLBACK( ds3sdsp_internal_timer_callback ); -TIMER_DEVICE_CALLBACK( ds3xdsp_internal_timer_callback ); /*----------- defined in video/harddriv.c -----------*/ diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 7fe8e5605bc..cd8f433af01 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -1223,18 +1223,16 @@ WRITE16_MEMBER( harddriv_state::hdds3_xdsp_control_w ) } } -TIMER_DEVICE_CALLBACK( ds3sdsp_internal_timer_callback ) +TIMER_DEVICE_CALLBACK_MEMBER( harddriv_state::ds3sdsp_internal_timer_callback ) { - harddriv_state *state = timer.machine().driver_data(); + UINT16 period = m_ds3sdsp_regs[0x1d]; + UINT16 scale = m_ds3sdsp_regs[0x1b] + 1; - UINT16 period = state->m_ds3sdsp_regs[0x1d]; - UINT16 scale = state->m_ds3sdsp_regs[0x1b] + 1; - - state->m_ds3sdsp_internal_timer->adjust(state->m_ds3sdsp->cycles_to_attotime(period * scale)); + m_ds3sdsp_internal_timer->adjust(m_ds3sdsp->cycles_to_attotime(period * scale)); /* the IRQ line is edge triggered */ - state->m_ds3sdsp->set_input_line(ADSP2105_TIMER, ASSERT_LINE); - state->m_ds3sdsp->set_input_line(ADSP2105_TIMER, CLEAR_LINE); + m_ds3sdsp->set_input_line(ADSP2105_TIMER, ASSERT_LINE); + m_ds3sdsp->set_input_line(ADSP2105_TIMER, CLEAR_LINE); } @@ -1260,18 +1258,16 @@ WRITE_LINE_MEMBER(harddriv_state::hdds3sdsp_timer_enable_callback) } -TIMER_DEVICE_CALLBACK( ds3xdsp_internal_timer_callback ) +TIMER_DEVICE_CALLBACK_MEMBER( harddriv_state::ds3xdsp_internal_timer_callback ) { - harddriv_state *state = timer.machine().driver_data(); + UINT16 period = m_ds3xdsp_regs[0x1d]; + UINT16 scale = m_ds3xdsp_regs[0x1b] + 1; - UINT16 period = state->m_ds3xdsp_regs[0x1d]; - UINT16 scale = state->m_ds3xdsp_regs[0x1b] + 1; - - state->m_ds3xdsp_internal_timer->adjust(state->m_ds3xdsp->cycles_to_attotime(period * scale)); + m_ds3xdsp_internal_timer->adjust(m_ds3xdsp->cycles_to_attotime(period * scale)); /* the IRQ line is edge triggered */ - state->m_ds3xdsp->set_input_line(ADSP2105_TIMER, ASSERT_LINE); - state->m_ds3xdsp->set_input_line(ADSP2105_TIMER, CLEAR_LINE); + m_ds3xdsp->set_input_line(ADSP2105_TIMER, ASSERT_LINE); + m_ds3xdsp->set_input_line(ADSP2105_TIMER, CLEAR_LINE); }