diff options
author | Aaron Giles <aaron@aarongiles.com> | 2021-03-25 10:20:20 -0700 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2021-03-25 10:20:20 -0700 |
commit | b4ecb17ff49388ae770f53a0a9108c51404af565 (patch) | |
tree | 26291674644611f53374854046646a74baed2597 | |
parent | 7473bee00b4a1ffbc63553ce1f57818841ab6127 (diff) |
Align timer device callback form with regular (old-style) timer form for eventual sharing of function signature flexibility.
-rw-r--r-- | src/devices/machine/timer.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/timer.h | 5 | ||||
-rw-r--r-- | src/devices/machine/z80scc.cpp | 4 | ||||
-rw-r--r-- | src/mame/audio/cage.cpp | 2 | ||||
-rw-r--r-- | src/mame/audio/dcs.cpp | 2 | ||||
-rw-r--r-- | src/mame/audio/rax.cpp | 2 | ||||
-rw-r--r-- | src/mame/drivers/alphatpc16.cpp | 2 | ||||
-rw-r--r-- | src/mame/drivers/foodf.cpp | 2 | ||||
-rw-r--r-- | src/mame/drivers/mediagx.cpp | 7 | ||||
-rw-r--r-- | src/mame/drivers/rtpc.cpp | 2 | ||||
-rw-r--r-- | src/mame/includes/galaxold.h | 2 | ||||
-rw-r--r-- | src/mame/machine/galaxold.cpp | 4 |
12 files changed, 21 insertions, 17 deletions
diff --git a/src/devices/machine/timer.cpp b/src/devices/machine/timer.cpp index 2cc23cf8107..810b89a270c 100644 --- a/src/devices/machine/timer.cpp +++ b/src/devices/machine/timer.cpp @@ -166,7 +166,7 @@ void timer_device::device_timer(emu_timer const &timer, device_timer_id id, int case TIMER_TYPE_GENERIC: case TIMER_TYPE_PERIODIC: if (!m_callback.isnull()) - (m_callback)(*this, m_ptr, param); + (m_callback)(m_ptr, param); break; // scanline timers have to do some additional bookkeeping @@ -181,7 +181,7 @@ void timer_device::device_timer(emu_timer const &timer, device_timer_id id, int // call the real callback int vpos = m_screen->vpos(); if (!m_callback.isnull()) - (m_callback)(*this, m_ptr, vpos); + (m_callback)(m_ptr, vpos); // advance by the increment only if we will still be within the screen bounds if (m_increment != 0 && (vpos + m_increment) < m_screen->height()) diff --git a/src/devices/machine/timer.h b/src/devices/machine/timer.h index 6dc4f0fbf15..d74886002bb 100644 --- a/src/devices/machine/timer.h +++ b/src/devices/machine/timer.h @@ -20,7 +20,8 @@ //************************************************************************** // macros for a timer callback functions -#define TIMER_DEVICE_CALLBACK_MEMBER(name) void name(timer_device &timer, void *ptr, s32 param) +#define TIMER_DEVICE_CALLBACK_MEMBER(name) void name(void *ptr, s32 param) + //************************************************************************** // TYPE DEFINITIONS @@ -32,7 +33,7 @@ class timer_device : public device_t { public: // a timer callbacks look like this - typedef device_delegate<void (timer_device &, void *, s32)> expired_delegate; + typedef device_delegate<void (void *, s32)> expired_delegate; // construction/destruction timer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index 770aa88952a..9a2d8767a2d 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -1199,7 +1199,7 @@ void z80scc_channel::device_timer(emu_timer const &timer, device_timer_id id, in { // int rate = owner()->clock() / brconst; // attotime attorate = attotime::from_hz(rate); - // timer.adjust(attorate, id, attorate); + // baudtimer->adjust(attorate, id, attorate); txc_w(m_brg_counter & 1); rxc_w(m_brg_counter & 1); m_brg_counter++; // Will just keep track of state in timer mode, not hardware counter value. @@ -1207,7 +1207,7 @@ void z80scc_channel::device_timer(emu_timer const &timer, device_timer_id id, in else { LOG(" - turning off Baudrate timer\n"); - timer.adjust(attotime::never, 0, attotime::never); + baudtimer->adjust(attotime::never, 0, attotime::never); } } break; diff --git a/src/mame/audio/cage.cpp b/src/mame/audio/cage.cpp index 1aab88f0956..fbf5d3ee987 100644 --- a/src/mame/audio/cage.cpp +++ b/src/mame/audio/cage.cpp @@ -191,7 +191,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( atari_cage_device::dma_timer_callback ) { if (m_dma_timer_enabled) { - timer.adjust(attotime::never); + m_dma_timer->adjust(attotime::never); m_dma_timer_enabled = 0; } return; diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp index 160e78902c2..dfa298f4c17 100644 --- a/src/mame/audio/dcs.cpp +++ b/src/mame/audio/dcs.cpp @@ -1765,7 +1765,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::internal_timer_callback ) /* set the next timer, but only if it's for a reasonable number */ if (!m_timer_ignore && (m_timer_period > 10 || m_timer_scale > 1)) - timer.adjust(m_cpu->cycles_to_attotime(target_cycles)); + m_internal_timer->adjust(m_cpu->cycles_to_attotime(target_cycles)); /* the IRQ line is edge triggered */ m_cpu->set_input_line(ADSP2105_TIMER, ASSERT_LINE); diff --git a/src/mame/audio/rax.cpp b/src/mame/audio/rax.cpp index 79c7a4bacea..3f9957d3567 100644 --- a/src/mame/audio/rax.cpp +++ b/src/mame/audio/rax.cpp @@ -229,7 +229,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( acclaim_rax_device::dma_timer_callback ) else m_cpu->pulse_input_line(ADSP2181_BDMA, m_cpu->minimum_quantum_time()); - timer.adjust(attotime::never); + m_dma_timer->adjust(attotime::never); } diff --git a/src/mame/drivers/alphatpc16.cpp b/src/mame/drivers/alphatpc16.cpp index 9f492e23df0..ea30b7c7387 100644 --- a/src/mame/drivers/alphatpc16.cpp +++ b/src/mame/drivers/alphatpc16.cpp @@ -528,7 +528,7 @@ void alphatpc16_state::alphatpc16(machine_config &config) EF9345(config, m_ef9345, 0); m_ef9345->set_palette_tag("palette"); - TIMER(config, "scanline").configure_scanline(NAME([this](timer_device &t, void *ptr, s32 p){m_ef9345->update_scanline((uint16_t)p);}), screen, 0, 10); + TIMER(config, "scanline").configure_scanline(NAME([this](void *ptr, s32 p){m_ef9345->update_scanline((uint16_t)p);}), screen, 0, 10); // these are supported by the bios, they may not have been available on real hardware RAM(config, m_ram).set_default_size("64K").set_extra_options("128K,192K,256K,384K,448K,512K"); diff --git a/src/mame/drivers/foodf.cpp b/src/mame/drivers/foodf.cpp index fabdbf84618..ca35cba7908 100644 --- a/src/mame/drivers/foodf.cpp +++ b/src/mame/drivers/foodf.cpp @@ -135,7 +135,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(foodf_state::scanline_update_timer) scanline = 0; /* set a timer for it */ - timer.adjust(m_screen->time_until_pos(scanline), scanline); + m_scan_timer->adjust(m_screen->time_until_pos(scanline), scanline); } diff --git a/src/mame/drivers/mediagx.cpp b/src/mame/drivers/mediagx.cpp index 9c91f7eca59..ecd0a9ccecf 100644 --- a/src/mame/drivers/mediagx.cpp +++ b/src/mame/drivers/mediagx.cpp @@ -99,6 +99,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_sound_timer(*this, "sound_timer"), m_ports(*this, "IN%u", 0U) { } @@ -171,6 +172,7 @@ private: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + required_device<timer_device> m_sound_timer; uint8_t m_pal[768]; optional_ioport_array<9> m_ports; // but parallel_pointer takes values 0 -> 23 @@ -655,7 +657,7 @@ void mediagx_state::parallel_port_w(offs_t offset, uint32_t data, uint32_t mem_m TIMER_DEVICE_CALLBACK_MEMBER(mediagx_state::sound_timer_callback) { m_ad1847_sample_counter = 0; - timer.adjust(attotime::from_msec(10)); + m_sound_timer->adjust(attotime::from_msec(10)); m_dmadac[0]->transfer(1, 0, 1, m_dacl_ptr, m_dacl.get()); m_dmadac[1]->transfer(1, 0, 1, m_dacr_ptr, m_dacr.get()); @@ -858,8 +860,7 @@ void mediagx_state::machine_reset() memcpy(m_bios_ram, rom, 0x40000); m_maincpu->reset(); - timer_device *sound_timer = subdevice<timer_device>("sound_timer"); - sound_timer->adjust(attotime::from_msec(10)); + m_sound_timer->adjust(attotime::from_msec(10)); m_dmadac[0]->enable(1); m_dmadac[1]->enable(1); diff --git a/src/mame/drivers/rtpc.cpp b/src/mame/drivers/rtpc.cpp index 62141eb4e28..577e0c2f860 100644 --- a/src/mame/drivers/rtpc.cpp +++ b/src/mame/drivers/rtpc.cpp @@ -161,7 +161,7 @@ protected: void crrb_w(u8 data); void dia_w(u8 data); - void mcu_timer(timer_device &timer, void *ptr, s32 param) + void mcu_timer(void *ptr, s32 param) { m_mcu_p3 ^= 0x10; m_mcu->set_input_line(MCS51_T0_LINE, BIT(m_mcu_p3, 4)); diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h index f9c70f8c9b2..68bd47e0b37 100644 --- a/src/mame/includes/galaxold.h +++ b/src/mame/includes/galaxold.h @@ -41,6 +41,7 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_palette(*this, "palette") + , m_int_timer(*this, "int_timer") , m_videoram(*this,"videoram") , m_spriteram(*this,"spriteram") , m_spriteram2(*this,"spriteram2") @@ -60,6 +61,7 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + required_device<timer_device> m_int_timer; /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; diff --git a/src/mame/machine/galaxold.cpp b/src/mame/machine/galaxold.cpp index c7a57bd1754..3a4ad578aa0 100644 --- a/src/mame/machine/galaxold.cpp +++ b/src/mame/machine/galaxold.cpp @@ -49,7 +49,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(galaxold_state::galaxold_interrupt_timer) param = (param + 0x10) & 0xff; - timer.adjust(m_screen->time_until_pos(param), param); + m_int_timer->adjust(m_screen->time_until_pos(param), param); } @@ -66,7 +66,7 @@ void galaxold_state::machine_reset_common(int line) m_7474_9m_1->preset_w(0); /* start a timer to generate interrupts */ - subdevice<timer_device>("int_timer")->adjust(m_screen->time_until_pos(0)); + m_int_timer->adjust(m_screen->time_until_pos(0)); } MACHINE_RESET_MEMBER(galaxold_state,galaxold) |