Convert emu_timers to objects. Move implementation and management of

timers into the scheduler. Retain TIMER devices as a separate wrapper
in timer.c/.h. Inline wrappers are currently provided for all timer
operations; a future update will bulk clean these up.

Rather than using macros which hide generation of a string-ified name
for callback functions, the new methods require passing both a function
pointer plus a name string. A new macro FUNC() can be used to output
both, and another macro MFUNC() can be used to output a stub-wrapped
class member as a callback.

Also added a time() method on the machine, so that machine->time() gives
the current emulated time. A wrapper for timer_get_time is currently
provided but will be bulk replaced in the future.

For this update, convert all classic timer_alloc, timer_set, 
timer_pulse, and timer_call_after_resynch calls into method calls on 
the scheduler. 

For new device timers, added methods to the device_t class that make 
creating and managing these much simpler. Modern devices were updated
to use these.

Here are the regexes used; some manual cleanup (compiler-caught) will
be needed since regex doesn't handle nested parentheses cleanly

1. Convert timer_call_after_resynch calls
timer_call_after_resynch( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().synchronize\1\(\2FUNC(\6), \5, \4\)

2. Clean up trailing 0, NULL parameters
(synchronize[^;]+), 0, NULL\)
\1)

3. Clean up trailing NULL parameters
(synchronize[^;]+), NULL\)
\1)

4. Clean up completely empty parameter lists
synchronize\(FUNC\(NULL\)\)
synchronize()

5. Convert timer_set calls
timer_set( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_set\1\(\2\4, FUNC(\7), \6, \5\)

6. Clean up trailing 0, NULL parameters
(timer_set[^;]+), 0, NULL\)
\1)

7. Clean up trailing NULL parameters
(timer_set[^;]+), NULL\)
\1)

8. Convert timer_set calls
timer_pulse( *)\(( *)([^,;]+), *([^,;]+), *([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_pulse\1\(\2\4, FUNC(\7), \6, \5\)

9. Clean up trailing 0, NULL parameters
(timer_pulse[^;]+), 0, NULL\)
\1)

10. Clean up trailing NULL parameters
(timer_pulse[^;]+), NULL\)
\1)

11. Convert timer_alloc calls
timer_alloc( *)\(( *)([^,;]+), *([^,;]+), *([^);]+)\)
\3->scheduler().timer_alloc\1\(\2FUNC(\4), \5\)

12. Clean up trailing NULL parameters
(timer_alloc[^;]+), NULL\)
\1)

13. Clean up trailing 0 parameters
(timer_alloc[^;]+), 0\)
\1)

14. Fix oddities introduced
\&m_machine->scheduler()
m_machine.scheduler()
This commit is contained in:
Aaron Giles 2011-02-06 07:15:01 +00:00
parent f38d3384b6
commit 0e627f1a54
448 changed files with 2016 additions and 2287 deletions

View File

@ -87,7 +87,7 @@ static TIMER_CALLBACK( latch_callback )
INLINE void latch_w(address_space *space, int which, UINT16 value)
{
timer_call_after_resynch(space->machine, NULL, which | (value << 8), latch_callback);
space->machine->scheduler().synchronize(FUNC(latch_callback), which | (value << 8));
}

View File

@ -886,14 +886,14 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U
/* allocate serial timer */
cpustate->serial_timer = timer_alloc(device->machine, serial_tick, cpustate);
cpustate->serial_timer = device->machine->scheduler().timer_alloc(FUNC(serial_tick), cpustate);
timer_adjust_periodic(cpustate->serial_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
/* allocate counter timer */
if (has_counter)
{
cpustate->counter_timer = timer_alloc(device->machine, counter_tick, cpustate);
cpustate->counter_timer = device->machine->scheduler().timer_alloc(FUNC(counter_tick), cpustate);
timer_adjust_periodic(cpustate->counter_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16 / 4));
}
@ -901,7 +901,7 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U
if (has_inil)
{
cpustate->inil_timer = timer_alloc(device->machine, inil_tick, cpustate);
cpustate->inil_timer = device->machine->scheduler().timer_alloc(FUNC(inil_tick), cpustate);
timer_adjust_periodic(cpustate->inil_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
}
@ -909,7 +909,7 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U
if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED)
{
cpustate->microbus_timer = timer_alloc(device->machine, microbus_tick, cpustate);
cpustate->microbus_timer = device->machine->scheduler().timer_alloc(FUNC(microbus_tick), cpustate);
timer_adjust_periodic(cpustate->microbus_timer, attotime::zero, 0, attotime::from_hz(device->clock() / 16));
}

View File

@ -1546,7 +1546,7 @@ static void hyperstone_init(legacy_cpu_device *device, device_irq_callback irqca
cpustate->program = device->space(AS_PROGRAM);
cpustate->direct = &cpustate->program->direct();
cpustate->io = device->space(AS_IO);
cpustate->timer = timer_alloc(device->machine, e132xs_timer_callback, (void *)device);
cpustate->timer = device->machine->scheduler().timer_alloc(FUNC(e132xs_timer_callback), (void *)device);
cpustate->clock_scale_mask = scale_mask;
}

View File

@ -241,10 +241,10 @@ static CPU_INIT(h8bit)
h8->direct = &h8->program->direct();
h8->io = device->space(AS_IO);
h8->timer[0] = timer_alloc(h8->device->machine, h8_timer_0_cb, h8);
h8->timer[1] = timer_alloc(h8->device->machine, h8_timer_1_cb, h8);
h8->timer[2] = timer_alloc(h8->device->machine, h8_timer_2_cb, h8);
h8->timer[3] = timer_alloc(h8->device->machine, h8_timer_3_cb, h8);
h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_0_cb), h8);
h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_1_cb), h8);
h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_2_cb), h8);
h8->timer[3] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_3_cb), h8);
state_save_register_device_item(device, 0, h8->h8err);
state_save_register_device_item_array(device, 0, h8->regs);

View File

@ -766,20 +766,20 @@ void h8_3007_register1_write8(h83xx_state *h8, UINT32 address, UINT8 val)
void h8_3007_itu_init(h83xx_state *h8)
{
h8->timer[0] = timer_alloc(h8->device->machine, h8itu_3007_timer_0_cb, h8);
h8->timer[1] = timer_alloc(h8->device->machine, h8itu_3007_timer_1_cb, h8);
h8->timer[2] = timer_alloc(h8->device->machine, h8itu_3007_timer_2_cb, h8);
h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_0_cb), h8);
h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_1_cb), h8);
h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_2_cb), h8);
h8_itu_reset(h8);
}
void h8_itu_init(h83xx_state *h8)
{
h8->timer[0] = timer_alloc(h8->device->machine, h8itu_timer_0_cb, h8);
h8->timer[1] = timer_alloc(h8->device->machine, h8itu_timer_1_cb, h8);
h8->timer[2] = timer_alloc(h8->device->machine, h8itu_timer_2_cb, h8);
h8->timer[3] = timer_alloc(h8->device->machine, h8itu_timer_3_cb, h8);
h8->timer[4] = timer_alloc(h8->device->machine, h8itu_timer_4_cb, h8);
h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_0_cb), h8);
h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_1_cb), h8);
h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_2_cb), h8);
h8->timer[3] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_3_cb), h8);
h8->timer[4] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_4_cb), h8);
h8_itu_reset(h8);
}

View File

@ -168,7 +168,7 @@ void hd61700_cpu_device::device_start()
{
m_program = this->space(AS_PROGRAM);
m_sec_timer = device_timer_alloc(*this, SEC_TIMER);
m_sec_timer = timer_alloc(SEC_TIMER);
timer_adjust_periodic(m_sec_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
// save state

View File

@ -47,8 +47,8 @@
#define FLAG_C 0x10
#define CYCLES_PASSED(X) cpustate->w.icount -= ((X) / (cpustate->w.gb_speed)); \
if ( cpustate->w.timer_fired_func ) { \
cpustate->w.timer_fired_func( cpustate->w.device, X ); \
if ( cpustate->w.timer_expired_func ) { \
cpustate->w.timer_expired_func( cpustate->w.device, X ); \
}
typedef struct {
@ -69,7 +69,7 @@ typedef struct {
address_space *program;
int icount;
/* Timer stuff */
lr35902_timer_fired_func timer_fired_func;
lr35902_timer_fired_func timer_expired_func;
/* Fetch & execute related */
int execution_state;
UINT8 op;
@ -210,7 +210,7 @@ static CPU_RESET( lr35902 )
cpustate->w.HL = 0x0000;
cpustate->w.SP = 0x0000;
cpustate->w.PC = 0x0000;
cpustate->w.timer_fired_func = NULL;
cpustate->w.timer_expired_func = NULL;
cpustate->w.features = LR35902_FEATURE_HALT_BUG;
if (cpustate->w.config)
{
@ -222,7 +222,7 @@ static CPU_RESET( lr35902 )
cpustate->w.SP = cpustate->w.config->regs[4];
cpustate->w.PC = cpustate->w.config->regs[5];
}
cpustate->w.timer_fired_func = cpustate->w.config->timer_fired_func;
cpustate->w.timer_expired_func = cpustate->w.config->timer_expired_func;
cpustate->w.features = cpustate->w.config->features;
}
cpustate->w.enable = 0;

View File

@ -11,7 +11,7 @@ struct _lr35902_cpu_core
{
const UINT16 *regs;
UINT8 features;
lr35902_timer_fired_func timer_fired_func;
lr35902_timer_fired_func timer_expired_func;
};
enum

View File

@ -906,7 +906,7 @@ static CPU_INIT( m37710 )
cpustate->destination = 0;
for (i = 0; i < 8; i++)
cpustate->timers[i] = timer_alloc(device->machine, m37710_timer_cb, cpustate);
cpustate->timers[i] = device->machine->scheduler().timer_alloc(FUNC(m37710_timer_cb), cpustate);
state_save_register_device_item(device, 0, cpustate->a);
state_save_register_device_item(device, 0, cpustate->b);

View File

@ -1201,7 +1201,7 @@ static CPU_INIT( m6801 )
cpustate->io = device->space(AS_IO);
cpustate->clock = device->clock() / 4;
cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate);
state_register(cpustate, "m6801");
@ -1251,7 +1251,7 @@ static CPU_INIT( m6803 )
cpustate->io = device->space(AS_IO);
cpustate->clock = device->clock() / 4;
cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate);
state_register(cpustate, "m6803");
@ -1309,7 +1309,7 @@ static CPU_INIT( hd63701 )
cpustate->io = device->space(AS_IO);
cpustate->clock = device->clock() / 4;
cpustate->sci_timer = timer_alloc(device->machine, sci_tick, cpustate);
cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate);
state_register(cpustate, "hd63701");
}

View File

@ -149,7 +149,7 @@ static CPU_INIT( mb88 )
cpustate->data = device->space(AS_DATA);
cpustate->io = device->space(AS_IO);
cpustate->serial = timer_alloc(device->machine, serial_timer, (void *)device);
cpustate->serial = device->machine->scheduler().timer_alloc(FUNC(serial_timer), (void *)device);
state_save_register_device_item(device, 0, cpustate->PC);
state_save_register_device_item(device, 0, cpustate->PA);

View File

@ -1215,7 +1215,7 @@ static TIMER_CALLBACK( master_callback )
void upi41_master_w(device_t *_device, UINT8 a0, UINT8 data)
{
legacy_cpu_device *device = downcast<legacy_cpu_device *>(_device);
timer_call_after_resynch(device->machine, (void *)device, (a0 << 8) | data, master_callback);
device->machine->scheduler().synchronize(FUNC(master_callback), (a0 << 8) | data, (void *)device);
}

View File

@ -105,7 +105,7 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy
mips->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, 2 * mips->tlbentries + 2, 0);
/* allocate a timer for the compare interrupt */
mips->compare_int_timer = timer_alloc(device->machine, compare_int_callback, (void *)device);
mips->compare_int_timer = device->machine->scheduler().timer_alloc(FUNC(compare_int_callback), (void *)device);
/* reset the state */
mips3com_reset(mips);

View File

@ -295,7 +295,7 @@ static CPU_INIT(mn10200)
for (tmr = 0; tmr < NUM_TIMERS_8BIT; tmr++)
{
cpustate->timer_timers[tmr] = timer_alloc(device->machine, simple_timer_cb, cpustate);
cpustate->timer_timers[tmr] = device->machine->scheduler().timer_alloc(FUNC(simple_timer_cb), cpustate);
timer_adjust_oneshot(cpustate->timer_timers[tmr], attotime::never, tmr);
}
}

View File

@ -430,7 +430,7 @@ static void v25_init(legacy_cpu_device *device, device_irq_callback irqcallback,
nec_state->config = config;
for (int i = 0; i < 4; i++)
nec_state->timers[i] = timer_alloc(device->machine, v25_timer_callback, nec_state);
nec_state->timers[i] = device->machine->scheduler().timer_alloc(FUNC(v25_timer_callback), nec_state);
state_save_register_device_item_array(device, 0, nec_state->ram.w);
state_save_register_device_item_array(device, 0, nec_state->intp_state);

View File

@ -947,8 +947,8 @@ static CPU_INIT( ppc403 )
// !!! why is rfci here !!!
ppc.optable19[51] = ppc_rfci;
ppc.spu.rx_timer = timer_alloc(device->machine, ppc403_spu_rx_callback, NULL);
ppc.spu.tx_timer = timer_alloc(device->machine, ppc403_spu_tx_callback, NULL);
ppc.spu.rx_timer = device->machine->scheduler().timer_alloc(FUNC(ppc403_spu_rx_callback));
ppc.spu.tx_timer = device->machine->scheduler().timer_alloc(FUNC(ppc403_spu_tx_callback));
ppc.read8 = ppc403_read8;
ppc.read16 = ppc403_read16;

View File

@ -328,14 +328,14 @@ void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_di
/* allocate a timer for the compare interrupt */
if ((cap & PPCCAP_OEA) && (ppc->tb_divisor))
ppc->decrementer_int_timer = timer_alloc(device->machine, decrementer_int_callback, ppc);
ppc->decrementer_int_timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_int_callback), ppc);
/* and for the 4XX interrupts if needed */
if (cap & PPCCAP_4XX)
{
ppc->fit_timer = timer_alloc(device->machine, ppc4xx_fit_callback, ppc);
ppc->pit_timer = timer_alloc(device->machine, ppc4xx_pit_callback, ppc);
ppc->spu.timer = timer_alloc(device->machine, ppc4xx_spu_callback, ppc);
ppc->fit_timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_fit_callback), ppc);
ppc->pit_timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_pit_callback), ppc);
ppc->spu.timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_spu_callback), ppc);
}
/* register for save states */

View File

@ -104,7 +104,7 @@ static CPU_INIT( sc61860 )
{
sc61860_state *cpustate = get_safe_token(device);
cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config();
timer_pulse(device->machine, attotime::from_hz(500), cpustate, 0, sc61860_2ms_tick);
device->machine->scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate);
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);
cpustate->direct = &cpustate->program->direct();

View File

@ -923,13 +923,13 @@ void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callb
const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config();
int i;
sh2->timer = timer_alloc(device->machine, sh2_timer_callback, sh2);
sh2->timer = device->machine->scheduler().timer_alloc(FUNC(sh2_timer_callback), sh2);
timer_adjust_oneshot(sh2->timer, attotime::never, 0);
sh2->dma_current_active_timer[0] = timer_alloc(device->machine, sh2_dma_current_active_callback, sh2);
sh2->dma_current_active_timer[0] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
timer_adjust_oneshot(sh2->dma_current_active_timer[0], attotime::never, 0);
sh2->dma_current_active_timer[1] = timer_alloc(device->machine, sh2_dma_current_active_callback, sh2);
sh2->dma_current_active_timer[1] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
timer_adjust_oneshot(sh2->dma_current_active_timer[1], attotime::never, 0);

View File

@ -1160,21 +1160,21 @@ void sh4_common_init(device_t *device)
for (i=0; i<3; i++)
{
sh4->timer[i] = timer_alloc(device->machine, sh4_timer_callback, sh4);
sh4->timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_timer_callback), sh4);
timer_adjust_oneshot(sh4->timer[i], attotime::never, i);
}
for (i=0; i<4; i++)
{
sh4->dma_timer[i] = timer_alloc(device->machine, sh4_dmac_callback, sh4);
sh4->dma_timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_dmac_callback), sh4);
timer_adjust_oneshot(sh4->dma_timer[i], attotime::never, i);
}
sh4->refresh_timer = timer_alloc(device->machine, sh4_refresh_timer_callback, sh4);
sh4->refresh_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_refresh_timer_callback), sh4);
timer_adjust_oneshot(sh4->refresh_timer, attotime::never, 0);
sh4->refresh_timer_base = 0;
sh4->rtc_timer = timer_alloc(device->machine, sh4_rtc_timer_callback, sh4);
sh4->rtc_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_rtc_timer_callback), sh4);
timer_adjust_oneshot(sh4->rtc_timer, attotime::never, 0);
sh4->m = auto_alloc_array(device->machine, UINT32, 16384);

View File

@ -2725,9 +2725,9 @@ static CPU_INIT( t90 )
// Timers
for (i = 0; i < 4; i++)
cpustate->timer[i] = timer_alloc(device->machine, t90_timer_callback, cpustate);
cpustate->timer[i] = device->machine->scheduler().timer_alloc(FUNC(t90_timer_callback), cpustate);
cpustate->timer[4] = timer_alloc(device->machine, t90_timer4_callback, cpustate);
cpustate->timer[4] = device->machine->scheduler().timer_alloc(FUNC(t90_timer4_callback), cpustate);
}
static ADDRESS_MAP_START(tmp90840_mem, ADDRESS_SPACE_PROGRAM, 8)

View File

@ -652,7 +652,7 @@ static CPU_INIT( tms34010 )
}
/* allocate a scanline timer and set it to go off at the start */
tms->scantimer = timer_alloc(device->machine, scanline_callback, tms);
tms->scantimer = device->machine->scheduler().timer_alloc(FUNC(scanline_callback), tms);
timer_adjust_oneshot(tms->scantimer, attotime::zero, 0);
/* allocate the shiftreg */
@ -1200,7 +1200,7 @@ WRITE16_HANDLER( tms34010_io_register_w )
/* NMI issued? */
if (data & 0x0100)
timer_call_after_resynch(tms->device->machine, tms, 0, internal_interrupt_callback);
tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms);
break;
case REG_HSTCTLL:
@ -1235,7 +1235,7 @@ WRITE16_HANDLER( tms34010_io_register_w )
/* input interrupt? (should really be state-based, but the functions don't exist!) */
if (!(oldreg & 0x0008) && (newreg & 0x0008))
timer_call_after_resynch(tms->device->machine, tms, TMS34010_HI, internal_interrupt_callback);
tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms);
else if ((oldreg & 0x0008) && !(newreg & 0x0008))
IOREG(tms, REG_INTPEND) &= ~TMS34010_HI;
break;
@ -1351,7 +1351,7 @@ WRITE16_HANDLER( tms34020_io_register_w )
/* NMI issued? */
if (data & 0x0100)
timer_call_after_resynch(tms->device->machine, tms, 0, internal_interrupt_callback);
tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms);
break;
case REG020_HSTCTLL:
@ -1386,7 +1386,7 @@ WRITE16_HANDLER( tms34020_io_register_w )
/* input interrupt? (should really be state-based, but the functions don't exist!) */
if (!(oldreg & 0x0008) && (newreg & 0x0008))
timer_call_after_resynch(tms->device->machine, tms, TMS34010_HI, internal_interrupt_callback);
tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms);
else if ((oldreg & 0x0008) && !(newreg & 0x0008))
IOREG(tms, REG020_INTPEND) &= ~TMS34010_HI;
break;

View File

@ -1298,7 +1298,7 @@ static CPU_INIT( tms99xx )
cpustate->io = device->space(AS_IO);
#if (TMS99XX_MODEL == TMS9995_ID)
cpustate->timer = timer_alloc(device->machine, decrementer_callback, cpustate);
cpustate->timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_callback), cpustate);
#endif
cpustate->idle_callback = param ? param->idle_callback : NULL;

View File

@ -669,8 +669,8 @@ static CPU_INIT( z8 )
cpustate->io = device->space(AS_IO);
/* allocate timers */
cpustate->t0_timer = timer_alloc(device->machine, t0_tick, cpustate);
cpustate->t1_timer = timer_alloc(device->machine, t1_tick, cpustate);
cpustate->t0_timer = device->machine->scheduler().timer_alloc(FUNC(t0_tick), cpustate);
cpustate->t1_timer = device->machine->scheduler().timer_alloc(FUNC(t1_tick), cpustate);
/* register for state saving */
state_save_register_device_item(device, 0, cpustate->pc);

View File

@ -46,6 +46,8 @@
#ifndef __DEVCPU_H__
#define __DEVCPU_H__
#include "devlegcy.h"
//**************************************************************************
// CONSTANTS

View File

@ -671,6 +671,28 @@ UINT64 device_t::attotime_to_clocks(attotime duration) const
}
//-------------------------------------------------
// timer_alloc - allocate a timer for our device
// callback
//-------------------------------------------------
emu_timer *device_t::timer_alloc(device_timer_id id, void *ptr)
{
return m_machine.scheduler().timer_alloc(*this, id, ptr);
}
//-------------------------------------------------
// timer_set - set a temporary timer that will
// call our device callback
//-------------------------------------------------
void device_t::timer_set(attotime duration, device_timer_id id, int param, void *ptr)
{
m_machine.scheduler().timer_set(duration, *this, id, param, ptr);
}
//-------------------------------------------------
// find_interfaces - locate fast interfaces
//-------------------------------------------------

View File

@ -430,7 +430,12 @@ public:
void set_clock_scale(double clockscale);
attotime clocks_to_attotime(UINT64 clocks) const;
UINT64 attotime_to_clocks(attotime duration) const;
void timer_fired(emu_timer &timer, device_timer_id id, int param, void *ptr) { device_timer(timer, id, param, ptr); }
// timer interfaces
emu_timer *timer_alloc(device_timer_id id = 0, void *ptr = NULL);
void timer_set(attotime duration, device_timer_id id = 0, int param = 0, void *ptr = NULL);
void synchronize(device_timer_id id = 0, int param = 0, void *ptr = NULL) { timer_set(attotime::zero, id, param, ptr); }
void timer_expired(emu_timer &timer, device_timer_id id, int param, void *ptr) { device_timer(timer, id, param, ptr); }
// debugging
device_debug *debug() const { return m_debug; }

View File

@ -442,7 +442,7 @@ void device_execute_interface::spin_until_time(attotime duration)
suspend_until_trigger(TRIGGER_SUSPENDTIME + timetrig, true);
// then set a timer for it
timer_set(device().machine, duration, this, TRIGGER_SUSPENDTIME + timetrig, static_timed_trigger_callback);
device().machine->scheduler().timer_set(duration, FUNC(static_timed_trigger_callback), TRIGGER_SUSPENDTIME + timetrig, this);
timetrig = (timetrig + 1) % 256;
}
@ -558,9 +558,9 @@ void device_execute_interface::interface_pre_start()
// allocate timers if we need them
if (m_execute_config.m_vblank_interrupts_per_frame > 1)
m_partial_frame_timer = timer_alloc(device().machine, static_trigger_partial_frame_interrupt, (void *)this);
m_partial_frame_timer = device().machine->scheduler().timer_alloc(FUNC(static_trigger_partial_frame_interrupt), (void *)this);
if (m_execute_config.m_timed_interrupt_period != attotime::zero)
m_timedint_timer = timer_alloc(device().machine, static_trigger_periodic_interrupt, (void *)this);
m_timedint_timer = device().machine->scheduler().timer_alloc(FUNC(static_trigger_periodic_interrupt), (void *)this);
// register for save states
state_save_register_device_item(&m_device, 0, m_suspend);
@ -917,7 +917,7 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_device->tag(), m_linenum, state,
// if this is the first one, set the timer
if (event_index == 0)
timer_call_after_resynch(m_execute->device().machine, (void *)this, 0, static_empty_event_queue);
m_execute->device().machine->scheduler().synchronize(FUNC(static_empty_event_queue), 0, (void *)this);
}
}

View File

@ -85,8 +85,8 @@ typedef device_config * (*machine_config_constructor)(machine_config &config, de
#include "disound.h"
#include "dinvram.h"
#include "didisasm.h"
#include "timer.h"
#include "schedule.h"
#include "timer.h"
// I/O
#include "input.h"

View File

@ -428,6 +428,16 @@ public:
m_tail = tail;
m_count += count;
}
T &insert_after(T &object, T *insert_after)
{
if (insert_after == NULL)
return prepend(object);
object.m_next = insert_after->m_next;
insert_after->m_next = &object;
m_count++;
return object;
}
T *detach_head()
{

View File

@ -344,10 +344,10 @@ static DEVICE_START(bitbanger)
/* output config */
bi->build_count = 0;
bi->bitbanger_output_timer = timer_alloc(device->machine, bitbanger_output_timer, (void *) device);
bi->bitbanger_output_timer = device->machine->scheduler().timer_alloc(FUNC(bitbanger_output_timer), (void *) device);
/* input config */
bi->bitbanger_input_timer = timer_alloc(device->machine, bitbanger_input_timer, (void *) device );
bi->bitbanger_input_timer = device->machine->scheduler().timer_alloc(FUNC(bitbanger_input_timer), (void *) device );
bi->idle_delay = attotime::from_seconds(1);
bi->input_buffer_size = 0;
bi->input_buffer_cursor = 0;

View File

@ -214,7 +214,7 @@ static void floppy_drive_init(device_t *img)
pDrive->flags = 0;
pDrive->index_pulse_callback = NULL;
pDrive->ready_state_change_callback = NULL;
pDrive->index_timer = timer_alloc(img->machine, floppy_drive_index_callback, (void *) img);
pDrive->index_timer = img->machine->scheduler().timer_alloc(FUNC(floppy_drive_index_callback), (void *) img);
pDrive->idx = 0;
floppy_drive_set_geometry(img, ((floppy_config*)img->baseconfig().static_config())->floppy_type);
@ -674,7 +674,7 @@ DEVICE_IMAGE_LOAD( floppy )
else
next_wpt = CLEAR_LINE;
timer_set(image.device().machine, attotime::from_msec(250), flopimg, next_wpt, set_wpt);
image.device().machine->scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), next_wpt, flopimg);
return retVal;
}
@ -702,7 +702,7 @@ DEVICE_IMAGE_UNLOAD( floppy )
devcb_call_write_line(&flopimg->out_wpt_func, flopimg->wpt);
/* set timer for disk eject */
timer_set(image.device().machine, attotime::from_msec(250), flopimg, ASSERT_LINE, set_wpt);
image.device().machine->scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), ASSERT_LINE, flopimg);
}
device_t *floppy_get_device(running_machine *machine,int drive)

View File

@ -132,7 +132,7 @@ static DEVICE_START( snapquick )
snapquick_token *token = get_token(device);
/* allocate a timer */
token->timer = timer_alloc(device->machine, process_snapshot_or_quickload, (void *) dynamic_cast<device_image_interface *>(device));
token->timer = device->machine->scheduler().timer_alloc(FUNC(process_snapshot_or_quickload), (void *) dynamic_cast<device_image_interface *>(device));
}

View File

@ -4925,7 +4925,7 @@ static void clear_keybuffer(running_machine &machine)
static void setup_keybuffer(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
portdata->inputx_timer = timer_alloc(machine, inputx_timerproc, NULL);
portdata->inputx_timer = machine->scheduler().timer_alloc(FUNC(inputx_timerproc));
portdata->keybuffer = auto_alloc_clear(machine, key_buffer);
machine->add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer);
}

View File

@ -274,11 +274,11 @@ void running_machine::start()
m_render = auto_alloc(this, render_manager(*this));
generic_machine_init(this);
generic_sound_init(this);
m_scheduler.register_for_save();
// initialize the timers and allocate a soft_reset timer
// this must be done before cpu_init so that CPU's can allocate timers
timer_init(this);
m_soft_reset_timer = timer_alloc(this, static_soft_reset, NULL);
// allocate a soft_reset timer
m_soft_reset_timer = m_scheduler.timer_alloc(MFUNC(timer_expired, running_machine, soft_reset), this);
// init the osd layer
m_osd.init(*this);
@ -288,7 +288,7 @@ void running_machine::start()
ui_init(this);
// initialize the base time (needed for doing record/playback)
time(&m_base_time);
::time(&m_base_time);
// initialize the input system and input ports for the game
// this must be done before memory_init in order to allow specifying
@ -386,7 +386,7 @@ int running_machine::run(bool firstrun)
ui_display_startup_screens(this, firstrun, !settingsloaded);
// perform a soft reset -- this takes us to the running phase
soft_reset();
soft_reset(*this);
// run the CPUs until a reset or exit
m_hard_reset_pending = false;
@ -783,7 +783,7 @@ void running_machine::handle_saveload()
// if there are anonymous timers, we can't save just yet, and we can't load yet either
// because the timers might overwrite data we have loaded
if (timer_count_anonymous(this) > 0)
if (m_scheduler.can_save())
{
// if more than a second has passed, we're probably screwed
if ((timer_get_time(this) - m_saveload_schedule_time) > attotime::from_seconds(1))
@ -856,9 +856,7 @@ cancel:
// of the system
//-------------------------------------------------
TIMER_CALLBACK( running_machine::static_soft_reset ) { machine->soft_reset(); }
void running_machine::soft_reset()
void running_machine::soft_reset(running_machine &machine, int param)
{
logerror("Soft reset\n");
@ -870,9 +868,6 @@ void running_machine::soft_reset()
// now we're running
m_current_phase = MACHINE_PHASE_RUNNING;
// allow 0-time queued callbacks to run before any CPUs execute
timer_execute_timers(this);
}

View File

@ -187,15 +187,10 @@ class video_manager;
class debug_view_manager;
class osd_interface;
typedef struct _mame_private mame_private;
typedef struct _cpuexec_private cpuexec_private;
typedef struct _timer_private timer_private;
typedef struct _state_private state_private;
typedef struct _memory_private memory_private;
typedef struct _palette_private palette_private;
typedef struct _tilemap_private tilemap_private;
typedef struct _streams_private streams_private;
typedef struct _devices_private devices_private;
typedef struct _romload_private romload_private;
typedef struct _input_private input_private;
typedef struct _input_port_private input_port_private;
@ -364,6 +359,7 @@ public:
device_scheduler &scheduler() { return m_scheduler; }
osd_interface &osd() const { return m_osd; }
screen_device *first_screen() const { return primary_screen; }
attotime time() const { return m_scheduler.time(); }
// immediate operations
int run(bool firstrun);
@ -381,7 +377,7 @@ public:
void schedule_save(const char *filename);
void schedule_load(const char *filename);
// time
// date & time
void base_datetime(system_time &systime);
void current_datetime(system_time &systime);
@ -444,14 +440,10 @@ public:
generic_pointers generic; // generic pointers
// internal core information
mame_private * mame_data; // internal data from mame.c
timer_private * timer_data; // internal data from timer.c
state_private * state_data; // internal data from state.c
memory_private * memory_data; // internal data from memory.c
palette_private * palette_data; // internal data from palette.c
tilemap_private * tilemap_data; // internal data from tilemap.c
streams_private * streams_data; // internal data from streams.c
devices_private * devices_data; // internal data from devices.c
romload_private * romload_data; // internal data from romload.c
input_private * input_data; // internal data from input.c
input_port_private * input_port_data; // internal data from inptport.c
@ -472,9 +464,7 @@ private:
void set_saveload_filename(const char *filename);
void fill_systime(system_time &systime, time_t t);
void handle_saveload();
static TIMER_CALLBACK( static_soft_reset );
void soft_reset();
void soft_reset(running_machine &machine, int param = 0);
static void logfile_callback(running_machine &machine, const char *buffer);

View File

@ -218,9 +218,9 @@ void via6522_device::device_start()
m_t2ll = 0xff; /* taken from vice */
m_t2lh = 0xff;
m_time2 = m_time1 = timer_get_time(&m_machine);
m_t1 = device_timer_alloc(*this, TIMER_T1);
m_t2 = device_timer_alloc(*this, TIMER_T2);
m_shift_timer = device_timer_alloc(*this, TIMER_SHIFT);
m_t1 = timer_alloc(TIMER_T1);
m_t2 = timer_alloc(TIMER_T2);
m_shift_timer = timer_alloc(TIMER_SHIFT);
/* Default clock is from CPU1 */
if (clock() == 0)

View File

@ -200,7 +200,7 @@ void mos6526_device::device_start()
for (int t = 0; t < (sizeof(m_timer) / sizeof(m_timer[0])); t++)
{
cia_timer *timer = &m_timer[t];
timer->m_timer = timer_alloc(&m_machine, timer_proc, (void*)this);
timer->m_timer = m_machine.scheduler().timer_alloc(FUNC(timer_proc), (void*)this);
timer->m_cia = this;
timer->m_irq = 0x01 << t;
}
@ -208,7 +208,7 @@ void mos6526_device::device_start()
/* setup TOD timer, if appropriate */
if (m_config.m_tod_clock != 0)
{
timer_pulse(&m_machine, attotime::from_hz(m_config.m_tod_clock), (void *)this, 0, clock_tod_callback);
m_machine.scheduler().timer_pulse(attotime::from_hz(m_config.m_tod_clock), FUNC(clock_tod_callback), 0, (void *)this);
}
/* state save support */

View File

@ -534,7 +534,7 @@ void riot6532_device::device_start()
devcb_resolve_write_line(&m_irq_func, &m_config.m_irq_func, this);
/* allocate timers */
m_timer = timer_alloc(&m_machine, timer_end_callback, (void *)this);
m_timer = m_machine.scheduler().timer_alloc(FUNC(timer_end_callback), (void *)this);
/* register for save states */
state_save_register_device_item(this, 0, m_port[0].m_in);

View File

@ -132,9 +132,9 @@ void ptm6840_device::device_start()
}
m_timer[0] = timer_alloc(&m_machine, ptm6840_timer1_cb, (void *)this);
m_timer[1] = timer_alloc(&m_machine, ptm6840_timer2_cb, (void *)this);
m_timer[2] = timer_alloc(&m_machine, ptm6840_timer3_cb, (void *)this);
m_timer[0] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer1_cb), (void *)this);
m_timer[1] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer2_cb), (void *)this);
m_timer[2] = m_machine.scheduler().timer_alloc(FUNC(ptm6840_timer3_cb), (void *)this);
for (int i = 0; i < 3; i++)
{

View File

@ -116,8 +116,8 @@ void acia6850_device::device_start()
m_tx_clock = m_config.m_tx_clock;
m_tx_counter = 0;
m_rx_counter = 0;
m_rx_timer = timer_alloc(&m_machine, receive_event_callback, (void *)this);
m_tx_timer = timer_alloc(&m_machine, transmit_event_callback, (void *)this);
m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(receive_event_callback), (void *)this);
m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(transmit_event_callback), (void *)this);
m_first_reset = 1;
m_status_read = 0;
m_brk = 0;

View File

@ -710,9 +710,9 @@ static DEVICE_START(duart68681)
duart68681->duart_config = (const duart68681_config *)device->baseconfig().static_config();
duart68681->device = device;
duart68681->channel[0].tx_timer = timer_alloc(device->machine, tx_timer_callback, (void*)device);
duart68681->channel[1].tx_timer = timer_alloc(device->machine, tx_timer_callback, (void*)device);
duart68681->duart_timer = timer_alloc(device->machine, duart_timer_callback, (void*)device);
duart68681->channel[0].tx_timer = device->machine->scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device);
duart68681->channel[1].tx_timer = device->machine->scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device);
duart68681->duart_timer = device->machine->scheduler().timer_alloc(FUNC(duart_timer_callback), (void*)device);
state_save_register_device_item(device, 0, duart68681->ACR);
state_save_register_device_item(device, 0, duart68681->IMR);

View File

@ -106,7 +106,7 @@ ttl74123_device::ttl74123_device(running_machine &_machine, const ttl74123_devic
void ttl74123_device::device_start()
{
m_timer = timer_alloc(&m_machine, clear_callback, (void *)this);
m_timer = m_machine.scheduler().timer_alloc(FUNC(clear_callback), (void *)this);
/* start with the defaults */
m_a = m_config.m_a;
@ -202,7 +202,7 @@ void ttl74123_device::set_output()
{
int output = timer_running();
timer_set( &m_machine, attotime::zero, (void *)this, output, output_callback );
m_machine.scheduler().timer_set( attotime::zero, FUNC(output_callback ), output, (void *)this);
if (LOG) logerror("74123 %s: Output: %d\n", tag(), output);
}

View File

@ -279,7 +279,7 @@ void kbdc8042_init(running_machine *machine, const struct kbdc8042_interface *in
kbdc8042.inport = 0xa0;
at_8042_set_outport(machine, 0xfe, 1);
timer_pulse(machine, attotime::from_hz(60), NULL, 0, kbdc8042_time);
machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(kbdc8042_time));
}
static void at_8042_receive(running_machine *machine, UINT8 data)

View File

@ -124,7 +124,7 @@ void i8237_device::device_start()
devcb_resolve_write_line(&m_chan[i].m_out_dack_func, &m_config.m_out_dack_func[i], this);
}
m_timer = timer_alloc(&m_machine, i8237_timerproc_callback, (void *)this);
m_timer = m_machine.scheduler().timer_alloc(FUNC(i8237_timerproc_callback), (void *)this);
}

View File

@ -137,8 +137,8 @@ void i8257_device::device_start()
}
/* set initial values */
m_timer = device_timer_alloc(*this, TIMER_OPERATION);
m_msbflip_timer = device_timer_alloc(*this, TIMER_MSBFLIP);
m_timer = timer_alloc(TIMER_OPERATION);
m_msbflip_timer = timer_alloc(TIMER_MSBFLIP);
/* register for state saving */
state_save_register_device_item_array(this, 0, m_address);
@ -449,7 +449,7 @@ void i8257_device::i8257_drq_w(int channel, int state)
{
int param = (channel << 1) | (state ? 1 : 0);
device_timer_call_after_resynch(*this, TIMER_DRQ_SYNC, param);
synchronize(TIMER_DRQ_SYNC, param);
}
WRITE_LINE_DEVICE_HANDLER( i8257_hlda_w ) { }

View File

@ -159,10 +159,10 @@ WRITE32_HANDLER( am53cf96_w )
case 3: // reset SCSI bus
scsi_regs[REG_INTSTATE] = 4; // command sent OK
xfer_state = 0;
timer_set( space->machine, attotime::from_hz( 16384 ), NULL, 0, am53cf96_irq );
space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq ));
break;
case 0x42: // select with ATN steps
timer_set( space->machine, attotime::from_hz( 16384 ), NULL, 0, am53cf96_irq );
space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq ));
if ((fifo[1] == 0) || (fifo[1] == 0x48) || (fifo[1] == 0x4b))
{
scsi_regs[REG_INTSTATE] = 6;
@ -192,7 +192,7 @@ WRITE32_HANDLER( am53cf96_w )
case 0x10: // information transfer (must not change xfer_state)
case 0x11: // second phase of information transfer
case 0x12: // message accepted
timer_set( space->machine, attotime::from_hz( 16384 ), NULL, 0, am53cf96_irq );
space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq ));
scsi_regs[REG_INTSTATE] = 6; // command sent OK
break;
default:

View File

@ -129,7 +129,7 @@ at28c16_device::at28c16_device( running_machine &_machine, const at28c16_device_
void at28c16_device::device_start()
{
m_write_timer = timer_alloc( &m_machine, write_finished, this );
m_write_timer = m_machine.scheduler().timer_alloc( FUNC(write_finished), this );
state_save_register_device_item( this, 0, m_a9_12v );
state_save_register_device_item( this, 0, m_oe_12v );

View File

@ -165,7 +165,7 @@ static DEVICE_START( cdp1852 )
if (device->clock() > 0)
{
/* create the scan timer */
cdp1852->scan_timer = timer_alloc(device->machine, cdp1852_scan_tick, (void *)device);
cdp1852->scan_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1852_scan_tick), (void *)device);
timer_adjust_periodic(cdp1852->scan_timer, attotime::zero, 0, attotime::from_hz(device->clock()));
}

View File

@ -153,8 +153,8 @@ void ds2401_init( running_machine *machine, int which, const UINT8 *data )
state_save_register_item(machine, "ds2401", NULL, which, c->rx );
state_save_register_item(machine, "ds2401", NULL, which, c->tx );
c->timer = timer_alloc(machine, ds2401_tick , NULL);
c->reset_timer = timer_alloc(machine, ds2401_reset , NULL);
c->timer = machine->scheduler().timer_alloc(FUNC(ds2401_tick ));
c->reset_timer = machine->scheduler().timer_alloc(FUNC(ds2401_reset ));
}
void ds2401_write( running_machine *machine, int which, int data )

View File

@ -129,7 +129,7 @@ void ds2404_device::device_start()
m_rtc[3] = (current_time >> 16) & 0xff;
m_rtc[4] = (current_time >> 24) & 0xff;
emu_timer *timer = timer_alloc(&m_machine, ds2404_tick_callback, (void *)this);
emu_timer *timer = m_machine.scheduler().timer_alloc(FUNC(ds2404_tick_callback), (void *)this);
timer_adjust_periodic(timer, attotime::from_hz(256), 0, attotime::from_hz(256));
}

View File

@ -134,7 +134,7 @@ void f3853_device::device_start()
}
}
m_timer = timer_alloc(&m_machine, f3853_timer_callback, (void *)this );
m_timer = m_machine.scheduler().timer_alloc(FUNC(f3853_timer_callback), (void *)this );
state_save_register_device_item(this, 0, m_high );
state_save_register_device_item(this, 0, m_low );

View File

@ -621,7 +621,7 @@ void generic_pulse_irq_line(device_t *device, int irqline)
cpu_device *cpudevice = downcast<cpu_device *>(device);
attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles());
timer_set(device->machine, target_time - timer_get_time(device->machine), (void *)device, irqline, irq_pulse_clear);
device->machine->scheduler().timer_set(target_time - timer_get_time(device->machine), FUNC(irq_pulse_clear), irqline, (void *)device);
}
@ -638,7 +638,7 @@ void generic_pulse_irq_line_and_vector(device_t *device, int irqline, int vector
cpu_device *cpudevice = downcast<cpu_device *>(device);
attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles());
timer_set(device->machine, target_time - timer_get_time(device->machine), (void *)device, irqline, irq_pulse_clear);
device->machine->scheduler().timer_set(target_time - timer_get_time(device->machine), FUNC(irq_pulse_clear), irqline, (void *)device);
}
@ -664,7 +664,7 @@ void cpu_interrupt_enable(device_t *device, int enabled)
/* make sure there are no queued interrupts */
if (enabled == 0)
timer_call_after_resynch(device->machine, (void *)cpudevice, 0, clear_all_lines);
device->machine->scheduler().synchronize(FUNC(clear_all_lines), 0, (void *)cpudevice);
}

View File

@ -258,9 +258,9 @@ INLINE void signal_delayed_interrupt(ide_state *ide, attotime time, int buffer_r
/* set a timer */
if (buffer_ready)
timer_set(ide->device->machine, time, ide, 0, delayed_interrupt_buffer_ready);
ide->device->machine->scheduler().timer_set(time, FUNC(delayed_interrupt_buffer_ready), 0, ide);
else
timer_set(ide->device->machine, time, ide, 0, delayed_interrupt);
ide->device->machine->scheduler().timer_set(time, FUNC(delayed_interrupt), 0, ide);
}
@ -625,7 +625,7 @@ static void security_error(ide_state *ide)
ide->status &= ~IDE_STATUS_DRIVE_READY;
/* just set a timer and mark ourselves error */
timer_set(ide->device->machine, TIME_SECURITY_ERROR, ide, 0, security_error_done);
ide->device->machine->scheduler().timer_set(TIME_SECURITY_ERROR, FUNC(security_error_done), 0, ide);
}
@ -806,10 +806,10 @@ static void read_first_sector(ide_state *ide)
seek_time = TIME_SEEK_MULTISECTOR;
ide->cur_lba = new_lba;
timer_set(ide->device->machine, seek_time, ide, 0, read_sector_done_callback);
ide->device->machine->scheduler().timer_set(seek_time, FUNC(read_sector_done_callback), 0, ide);
}
else
timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, read_sector_done_callback);
ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide);
}
@ -825,11 +825,11 @@ static void read_next_sector(ide_state *ide)
read_sector_done(ide);
else
/* just set a timer */
timer_set(ide->device->machine, attotime::from_usec(1), ide, 0, read_sector_done_callback);
ide->device->machine->scheduler().timer_set(attotime::from_usec(1), FUNC(read_sector_done_callback), 0, ide);
}
else
/* just set a timer */
timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, read_sector_done_callback);
ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide);
}
@ -862,13 +862,13 @@ static void continue_write(ide_state *ide)
else
{
/* set a timer to do the write */
timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, write_sector_done_callback);
ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide);
}
}
else
{
/* set a timer to do the write */
timer_set(ide->device->machine, TIME_PER_SECTOR, ide, 0, write_sector_done_callback);
ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide);
}
}
@ -1836,8 +1836,8 @@ static DEVICE_START( ide_controller )
}
/* create a timer for timing status */
ide->last_status_timer = timer_alloc(device->machine, NULL, NULL);
ide->reset_timer = timer_alloc(device->machine, reset_callback, (void *)device);
ide->last_status_timer = device->machine->scheduler().timer_alloc(FUNC(NULL));
ide->reset_timer = device->machine->scheduler().timer_alloc(FUNC(reset_callback), (void *)device);
/* register ide states */
state_save_register_device_item(device, 0, ide->adapter_control);

View File

@ -268,7 +268,7 @@ intelfsh16_device::intelfsh16_device(running_machine &_machine, const intelfsh_d
void intelfsh_device::device_start()
{
m_timer = device_timer_alloc(*this);
m_timer = timer_alloc();
state_save_register_device_item( this, 0, m_status );
state_save_register_device_item( this, 0, m_flash_mode );

View File

@ -128,7 +128,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_w)
{
cpu_set_input_line(m_cpu, INPUT_LINE_IRQ2, ASSERT_LINE);
}
timer_set(&m_machine, attotime::from_usec(10), (void*)this, 0, network_irq_clear_callback);
m_machine.scheduler().timer_set(attotime::from_usec(10), FUNC(network_irq_clear_callback), 0, (void*)this);
}
}
// else

View File

@ -105,7 +105,7 @@ WRITE8_DEVICE_HANDLER( latch8_w )
assert(offset == 0);
if (latch8->intf->nosync != 0xff)
timer_call_after_resynch(device->machine, (void *)device, (0xFF << 8) | data, latch8_timerproc);
device->machine->scheduler().synchronize(FUNC(latch8_timerproc), (0xFF << 8) | data, (void *)device);
else
update(device, data, 0xFF);
}
@ -165,7 +165,7 @@ INLINE void latch8_bitx_w(device_t *device, int bit, offs_t offset, UINT8 data)
if (latch8->intf->nosync & mask)
update(device, masked_data, mask);
else
timer_call_after_resynch(device->machine, (void *) device, (mask << 8) | masked_data, latch8_timerproc);
device->machine->scheduler().synchronize(FUNC(latch8_timerproc), (mask << 8) | masked_data, (void *) device);
}
WRITE8_DEVICE_HANDLER( latch8_bit0_w ) { latch8_bitx_w(device, 0, offset, data); }

View File

@ -305,7 +305,7 @@ static void vblank_state_changed(screen_device &screen, void *param, bool vblank
(*ldcore->intf.vsync)(ld, &ldcore->metadata[ldcore->fieldnum], ldcore->fieldnum, curtime);
/* set a timer to begin fetching the next frame just before the VBI data would be fetched */
timer_set(screen.machine, screen.time_until_pos(16*2), ld, 0, perform_player_update);
screen.machine->scheduler().timer_set(screen.time_until_pos(16*2), FUNC(perform_player_update), 0, ld);
}
}

View File

@ -380,10 +380,10 @@ static void pr8210_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int field
/* signal VSYNC and set a timer to turn it off */
player->vsync = TRUE;
timer_set(ld->device->machine, ld->screen->scan_period() * 4, ld, 0, vsync_off);
ld->device->machine->scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld);
/* also set a timer to fetch the VBI data when it is ready */
timer_set(ld->device->machine, ld->screen->time_until_pos(19*2), ld, 0, vbi_data_fetch);
ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld);
}
@ -1119,7 +1119,7 @@ static void simutrek_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fie
if (LOG_SIMUTREK)
printf("%3d:VSYNC IRQ\n", ld->screen->vpos());
cpu_set_input_line(player->simutrek.cpu, MCS48_INPUT_IRQ, ASSERT_LINE);
timer_set(ld->device->machine, ld->screen->scan_period(), ld, 0, irq_off);
ld->device->machine->scheduler().timer_set(ld->screen->scan_period(), FUNC(irq_off), 0, ld);
}
}
@ -1164,7 +1164,7 @@ static UINT8 simutrek_status_r(laserdisc_state *ld)
static void simutrek_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data)
{
timer_call_after_resynch(ld->device->machine, ld, data, simutrek_latched_data_w);
ld->device->machine->scheduler().synchronize(FUNC(simutrek_latched_data_w), data, ld);
if (LOG_SIMUTREK)
printf("%03d:**** Simutrek Command = %02X\n", ld->screen->vpos(), data);
}

View File

@ -257,10 +257,10 @@ static void ldv1000_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fiel
/* signal VSYNC and set a timer to turn it off */
player->vsync = TRUE;
timer_set(ld->device->machine, ld->screen->scan_period() * 4, ld, 0, vsync_off);
ld->device->machine->scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld);
/* also set a timer to fetch the VBI data when it is ready */
timer_set(ld->device->machine, ld->screen->time_until_pos(19*2), ld, 0, vbi_data_fetch);
ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld);
/* boost interleave for the first 1ms to improve communications */
cpuexec_boost_interleave(ld->device->machine, attotime::zero, attotime::from_msec(1));

View File

@ -233,7 +233,7 @@ static void vp931_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fieldn
/* set the ERP signal to 1 to indicate start of frame, and set a timer to turn it off */
ld->player->daticerp = 1;
timer_set(ld->device->machine, ld->screen->time_until_pos(15*2), ld, 0, erp_off);
ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(15*2), FUNC(erp_off), 0, ld);
}
@ -245,7 +245,7 @@ static void vp931_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fieldn
static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime)
{
/* set the first VBI timer to go at the start of line 16 */
timer_set(ld->device->machine, ld->screen->time_until_pos(16*2), ld, LASERDISC_CODE_LINE16 << 2, vbi_data_fetch);
ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(16*2), FUNC(vbi_data_fetch), LASERDISC_CODE_LINE16 << 2, ld);
/* play forward by default */
return fieldnum;
@ -260,7 +260,7 @@ static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fiel
static void vp931_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data)
{
/* set a timer to synchronize execution before sending the data */
timer_call_after_resynch(ld->device->machine, ld, data, deferred_data_w);
ld->device->machine->scheduler().synchronize(FUNC(deferred_data_w), data, ld);
}
@ -335,7 +335,7 @@ static TIMER_CALLBACK( vbi_data_fetch )
if (which == 0)
{
cpu_set_input_line(player->cpu, MCS48_INPUT_IRQ, ASSERT_LINE);
timer_set(machine, attotime::from_nsec(5580), ld, 0, irq_off);
machine->scheduler().timer_set(attotime::from_nsec(5580), FUNC(irq_off), 0, ld);
}
/* clock the data strobe on each subsequent callback */
@ -343,7 +343,7 @@ static TIMER_CALLBACK( vbi_data_fetch )
{
player->daticval = code >> (8 * (3 - which));
player->datastrobe = 1;
timer_set(machine, attotime::from_nsec(5000), ld, 0, datastrobe_off);
machine->scheduler().timer_set(attotime::from_nsec(5000), FUNC(datastrobe_off), 0, ld);
}
/* determine the next bit to fetch and reprime ourself */
@ -353,7 +353,7 @@ static TIMER_CALLBACK( vbi_data_fetch )
line++;
}
if (line <= LASERDISC_CODE_LINE18 + 1)
timer_set(machine, ld->screen->time_until_pos(line*2, which * 2 * ld->screen->width() / 4), ld, (line << 2) | which, vbi_data_fetch);
machine->scheduler().timer_set(ld->screen->time_until_pos(line*2, which * 2 * ld->screen->width() / 4), FUNC(vbi_data_fetch), (line << 2), ld);
}

View File

@ -105,7 +105,7 @@ mb3773_device::mb3773_device( running_machine &_machine, const mb3773_device_con
void mb3773_device::device_start()
{
m_watchdog_timer = timer_alloc( &m_machine, watchdog_timeout, this );
m_watchdog_timer = m_machine.scheduler().timer_alloc( FUNC(watchdog_timeout), this );
reset_timer();
state_save_register_device_item( this, 0, m_ck );

View File

@ -184,7 +184,7 @@ mc146818_device::mc146818_device(running_machine &_machine, const mc146818_devic
void mc146818_device::device_start()
{
m_last_refresh = timer_get_time(&m_machine);
emu_timer *timer = device_timer_alloc(*this);
emu_timer *timer = timer_alloc();
if (m_config.m_type == mc146818_device_config::MC146818_UTC) {
// hack: for apollo we increase the update frequency to stay in sync with real time
timer_adjust_periodic(timer, attotime::from_hz(2), 0, attotime::from_hz(2));

View File

@ -801,20 +801,20 @@ void mc68901_device::device_start()
m_timer_clock = m_config.timer_clock;
/* create the timers */
m_timer[TIMER_A] = device_timer_alloc(*this, TIMER_A);
m_timer[TIMER_B] = device_timer_alloc(*this, TIMER_B);
m_timer[TIMER_C] = device_timer_alloc(*this, TIMER_C);
m_timer[TIMER_D] = device_timer_alloc(*this, TIMER_D);
m_timer[TIMER_A] = timer_alloc(TIMER_A);
m_timer[TIMER_B] = timer_alloc(TIMER_B);
m_timer[TIMER_C] = timer_alloc(TIMER_C);
m_timer[TIMER_D] = timer_alloc(TIMER_D);
if (m_config.rx_clock > 0)
{
m_rx_timer = device_timer_alloc(*this, TIMER_RX);
m_rx_timer = timer_alloc(TIMER_RX);
timer_adjust_periodic(m_rx_timer, attotime::zero, 0, attotime::from_hz(m_config.rx_clock));
}
if (m_config.tx_clock > 0)
{
m_tx_timer = device_timer_alloc(*this, TIMER_TX);
m_tx_timer = timer_alloc(TIMER_TX);
timer_adjust_periodic(m_tx_timer, attotime::zero, 0, attotime::from_hz(m_config.tx_clock));
}

View File

@ -159,7 +159,7 @@ void microtouch_init(running_machine *machine, microtouch_tx_func tx_cb, microto
microtouch.tx_callback = tx_cb;
microtouch.touch_callback = touch_cb;
microtouch.timer = timer_alloc(machine, microtouch_timer_callback, NULL);
microtouch.timer = machine->scheduler().timer_alloc(FUNC(microtouch_timer_callback));
timer_adjust_periodic(microtouch.timer, attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
state_save_register_item(machine, "microtouch", NULL, 0, microtouch.reset_done);

View File

@ -400,10 +400,10 @@ void pc16552d_init(running_machine *machine, int chip, int frequency, void (* ir
duart[chip].ch[1].pending_interrupt = 0;
// allocate transmit timers
duart[chip].ch[0].tx_fifo_timer = timer_alloc(machine, tx_fifo_timer_callback, NULL);
duart[chip].ch[0].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback));
timer_adjust_oneshot(duart[chip].ch[0].tx_fifo_timer, attotime::never, (chip * 2) + 0);
duart[chip].ch[1].tx_fifo_timer = timer_alloc(machine, tx_fifo_timer_callback, NULL);
duart[chip].ch[1].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback));
timer_adjust_oneshot(duart[chip].ch[1].tx_fifo_timer, attotime::never, (chip * 2) + 1);
}

View File

@ -406,7 +406,7 @@ static DEVICE_START( pic8259 )
assert(intf != NULL);
pic8259->timer = timer_alloc( device->machine, pic8259_timerproc, (void *)device );
pic8259->timer = device->machine->scheduler().timer_alloc( FUNC(pic8259_timerproc), (void *)device );
/* resolve callbacks */
devcb_resolve_write_line(&pic8259->out_int_func, &intf->out_int_func, device);

View File

@ -1081,7 +1081,7 @@ static void common_start( device_t *device, int device_type ) {
/* initialize timer */
timer->clockin = pit8253->config->timer[timerno].clockin;
timer->updatetimer = timer_alloc(device->machine, update_timer_cb, (void *)device);
timer->updatetimer = device->machine->scheduler().timer_alloc(FUNC(update_timer_cb), (void *)device);
timer_adjust_oneshot(timer->updatetimer, attotime::never, timerno);
/* resolve callbacks */

View File

@ -522,7 +522,7 @@ static TIMER_CALLBACK( rtc_begin_update_callback )
state->regs[reg_A] |= reg_A_UIP;
/* schedule end of update cycle */
timer_set(device->machine, UPDATE_CYCLE_TIME, (void *)device, 0, rtc_end_update_callback);
device->machine->scheduler().timer_set(UPDATE_CYCLE_TIME, FUNC(rtc_end_update_callback), 0, (void *)device);
}
}
@ -688,9 +688,9 @@ static DEVICE_START( rtc65271 )
rtc65271_config *config = (rtc65271_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
rtc65271_state *state = get_safe_token(device);
state->update_timer = timer_alloc(device->machine, rtc_begin_update_callback, (void *)device);
state->update_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)device);
timer_adjust_periodic(state->update_timer, attotime::from_seconds(1), 0, attotime::from_seconds(1));
state->SQW_timer = timer_alloc(device->machine, rtc_SQW_callback, (void *)device);
state->SQW_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)device);
state->interrupt_callback = config->interrupt_callback;
state_save_register_device_item_array(device, 0, state->regs);

View File

@ -3168,14 +3168,14 @@ static DEVICE_START( s3c24xx )
{
s3c24xx_t *s3c24xx = get_token( device);
s3c24xx->iface = (const s3c24xx_interface *)device->baseconfig().static_config();
for (int i = 0; i < 5; i++) s3c24xx->pwm.timer[i] = timer_alloc( device->machine, s3c24xx_pwm_timer_exp, (void*)device);
for (int i = 0; i < 4; i++) s3c24xx->dma[i].timer = timer_alloc( device->machine, s3c24xx_dma_timer_exp, (void*)device);
s3c24xx->iic.timer = timer_alloc( device->machine, s3c24xx_iic_timer_exp, (void*)device);
s3c24xx->iis.timer = timer_alloc( device->machine, s3c24xx_iis_timer_exp, (void*)device);
s3c24xx->lcd.timer = timer_alloc( device->machine, s3c24xx_lcd_timer_exp, (void*)device);
s3c24xx->rtc.timer_tick_count = timer_alloc( device->machine, s3c24xx_rtc_timer_tick_count_exp, (void*)device);
s3c24xx->rtc.timer_update = timer_alloc( device->machine, s3c24xx_rtc_timer_update_exp, (void*)device);
s3c24xx->wdt.timer = timer_alloc( device->machine, s3c24xx_wdt_timer_exp, (void*)device);
for (int i = 0; i < 5; i++) s3c24xx->pwm.timer[i] = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_pwm_timer_exp), (void*)device);
for (int i = 0; i < 4; i++) s3c24xx->dma[i].timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_dma_timer_exp), (void*)device);
s3c24xx->iic.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_iic_timer_exp), (void*)device);
s3c24xx->iis.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_iis_timer_exp), (void*)device);
s3c24xx->lcd.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_lcd_timer_exp), (void*)device);
s3c24xx->rtc.timer_tick_count = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_tick_count_exp), (void*)device);
s3c24xx->rtc.timer_update = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_update_exp), (void*)device);
s3c24xx->wdt.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_wdt_timer_exp), (void*)device);
timer_adjust_periodic( s3c24xx->rtc.timer_update, attotime::from_msec( 1000), 0, attotime::from_msec( 1000));
s3c24xx_rtc_init( device);
}

View File

@ -227,7 +227,7 @@ void timekeeper_device::device_start()
state_save_register_device_item( this, 0, m_century );
state_save_register_device_item_pointer( this, 0, m_data, m_size );
timer = timer_alloc( &m_machine, timekeeper_tick_callback, (void *)this );
timer = m_machine.scheduler().timer_alloc( FUNC(timekeeper_tick_callback), (void *)this );
duration = attotime::from_seconds(1);
timer_adjust_periodic( timer, duration, 0, duration );
}

View File

@ -110,7 +110,7 @@ MACHINE_START( tmp68301 )
{
int i;
for (i = 0; i < 3; i++)
tmp68301_timer[i] = timer_alloc(machine, tmp68301_timer_callback, NULL);
tmp68301_timer[i] = machine->scheduler().timer_alloc(FUNC(tmp68301_timer_callback));
}
MACHINE_RESET( tmp68301 )

View File

@ -352,7 +352,7 @@ static CMD_HANDLER( wd33c93_select_cmd )
}
/* queue up a service request out in the future */
timer_set( machine, attotime::from_usec(50), NULL, 0, wd33c93_service_request );
machine->scheduler().timer_set( attotime::from_usec(50), FUNC(wd33c93_service_request ));
}
else
{
@ -424,7 +424,7 @@ static CMD_HANDLER( wd33c93_selectxfer_cmd )
scsi_data.busphase = PHS_MESS_IN;
/* queue up a service request out in the future */
timer_set( machine, attotime::from_msec(50), NULL, 0, wd33c93_service_request );
machine->scheduler().timer_set( attotime::from_msec(50), FUNC(wd33c93_service_request ));
}
}
else
@ -454,7 +454,7 @@ static CMD_HANDLER( wd33c93_xferinfo_cmd )
scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
/* the command will be completed once the data is transferred */
timer_set( machine, attotime::from_msec(1), NULL, 0, wd33c93_deassert_cip );
machine->scheduler().timer_set( attotime::from_msec(1), FUNC(wd33c93_deassert_cip ));
}
/* Command handlers */
@ -795,7 +795,7 @@ void wd33c93_init( running_machine *machine, const struct WD33C93interface *inte
}
/* allocate a timer for commands */
scsi_data.cmd_timer = timer_alloc(machine, wd33c93_complete_cb, NULL);
scsi_data.cmd_timer = machine->scheduler().timer_alloc(FUNC(wd33c93_complete_cb));
scsi_data.temp_input = auto_alloc_array( machine, UINT8, TEMP_INPUT_LEN );

View File

@ -336,7 +336,7 @@ void z80ctc_device::ctc_channel::start(z80ctc_device *device, int index, bool no
if (write_line != NULL)
devcb_resolve_write_line(&m_zc, write_line, m_device);
m_notimer = notimer;
m_timer = timer_alloc(&m_device->m_machine, static_timer_callback, this);
m_timer = m_device->machine->scheduler().timer_alloc(FUNC(static_timer_callback), this);
// register for save states
state_save_register_device_item(m_device, m_index, m_mode);

View File

@ -293,28 +293,28 @@ void z80dart_device::device_start()
if (m_config.m_rx_clock_a != 0)
{
// allocate channel A receive timer
m_rxca_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[CHANNEL_A]);
m_rxca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_A]);
timer_adjust_periodic(m_rxca_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_a));
}
if (m_config.m_tx_clock_a != 0)
{
// allocate channel A transmit timer
m_txca_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[CHANNEL_A]);
m_txca_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_A]);
timer_adjust_periodic(m_txca_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_a));
}
if (m_config.m_rx_clock_b != 0)
{
// allocate channel B receive timer
m_rxcb_timer = timer_alloc(&m_machine, dart_channel::static_rxc_tick, (void *)&m_channel[CHANNEL_B]);
m_rxcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_rxc_tick), (void *)&m_channel[CHANNEL_B]);
timer_adjust_periodic(m_rxcb_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock_b));
}
if (m_config.m_tx_clock_b != 0)
{
// allocate channel B transmit timer
m_txcb_timer = timer_alloc(&m_machine, dart_channel::static_txc_tick, (void *)&m_channel[CHANNEL_B]);
m_txcb_timer = m_machine.scheduler().timer_alloc(FUNC(dart_channel::static_txc_tick), (void *)&m_channel[CHANNEL_B]);
timer_adjust_periodic(m_txcb_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock_b));
}

View File

@ -238,7 +238,7 @@ void z80dma_device::device_start()
devcb_resolve_write8(&m_out_iorq_func, &m_config.m_out_iorq_func, this);
// allocate timer
m_timer = timer_alloc(&m_machine, static_timerproc, (void *)this);
m_timer = m_machine.scheduler().timer_alloc(FUNC(static_timerproc), (void *)this);
// register for state saving
state_save_register_device_item_array(this, 0, m_regs);
@ -876,7 +876,7 @@ void z80dma_device::rdy_write_callback(int state)
void z80dma_device::rdy_w(int state)
{
if (LOG) logerror("Z80DMA '%s' RDY: %d Active High: %d\n", tag(), state, READY_ACTIVE_HIGH);
timer_call_after_resynch(&m_machine, (void *)this, state, static_rdy_write_callback);
m_machine.scheduler().synchronize(FUNC(static_rdy_write_callback), state, (void *)this);
}

View File

@ -524,7 +524,7 @@ void z80sio_device::sio_channel::start(z80sio_device *device, int index)
{
m_device = device;
m_index = index;
m_receive_timer = timer_alloc(&m_device->m_machine, static_serial_callback, this);
m_receive_timer = device->machine->scheduler().timer_alloc(FUNC(static_serial_callback), this);
}
@ -713,7 +713,7 @@ int z80sio_device::sio_channel::rts()
void z80sio_device::sio_channel::set_cts(int state)
{
timer_call_after_resynch(&m_device->m_machine, this, (SIO_RR0_CTS << 1) + (state != 0), static_change_input_line);
m_device->machine->scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_CTS << 1) + (state != 0), this);
}
@ -723,7 +723,7 @@ void z80sio_device::sio_channel::set_cts(int state)
void z80sio_device::sio_channel::set_dcd(int state)
{
timer_call_after_resynch(&m_device->m_machine, this, (SIO_RR0_DCD << 1) + (state != 0), static_change_input_line);
m_device->machine->scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_DCD << 1) + (state != 0), this);
}

View File

@ -244,22 +244,22 @@ void z80sti_device::device_start()
devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
// create the counter timers
m_timer[TIMER_A] = timer_alloc(&m_machine, static_timer_count, (void *)this);
m_timer[TIMER_B] = timer_alloc(&m_machine, static_timer_count, (void *)this);
m_timer[TIMER_C] = timer_alloc(&m_machine, static_timer_count, (void *)this);
m_timer[TIMER_D] = timer_alloc(&m_machine, static_timer_count, (void *)this);
m_timer[TIMER_A] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
m_timer[TIMER_B] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
m_timer[TIMER_C] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
m_timer[TIMER_D] = m_machine.scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
// create serial receive clock timer
if (m_config.m_rx_clock > 0)
{
m_rx_timer = timer_alloc(&m_machine, static_rx_tick, (void *)this);
m_rx_timer = m_machine.scheduler().timer_alloc(FUNC(static_rx_tick), (void *)this);
timer_adjust_periodic(m_rx_timer, attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock));
}
// create serial transmit clock timer
if (m_config.m_tx_clock > 0)
{
m_tx_timer = timer_alloc(&m_machine, static_tx_tick, (void *)this);
m_tx_timer = m_machine.scheduler().timer_alloc(FUNC(static_tx_tick), (void *)this);
timer_adjust_periodic(m_tx_timer, attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock));
}

View File

@ -50,8 +50,6 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#define TEMPLOG 0
//**************************************************************************
@ -69,17 +67,252 @@ enum
//**************************************************************************
// MACROS
// EMU TIMER
//**************************************************************************
// these are macros to ensure inlining in device_scheduler::timeslice
#define ATTOTIME_LT(a,b) ((a).seconds < (b).seconds || ((a).seconds == (b).seconds && (a).attoseconds < (b).attoseconds))
#define ATTOTIME_NORMALIZE(a) do { if ((a).attoseconds >= ATTOSECONDS_PER_SECOND) { (a).seconds++; (a).attoseconds -= ATTOSECONDS_PER_SECOND; } } while (0)
//-------------------------------------------------
// emu_timer - constructor
//-------------------------------------------------
emu_timer::emu_timer()
: m_machine(NULL),
m_next(NULL),
m_prev(NULL),
m_callback(NULL),
m_param(0),
m_ptr(NULL),
m_func(NULL),
m_enabled(false),
m_temporary(false),
m_period(attotime::zero),
m_start(attotime::zero),
m_expire(attotime::never),
m_device(NULL),
m_id(0)
{
}
//-------------------------------------------------
// init - completely initialize the state when
// re-allocated as a non-device timer
//-------------------------------------------------
emu_timer &emu_timer::init(running_machine &machine, timer_expired_func callback, const char *name, void *ptr, bool temporary)
{
// ensure the entire timer state is clean
m_machine = &machine;
m_next = NULL;
m_prev = NULL;
m_callback = callback;
m_param = 0;
m_ptr = ptr;
m_func = (name != NULL) ? name : "?";
m_enabled = false;
m_temporary = temporary;
m_period = attotime::never;
m_start = machine.time();
m_expire = attotime::never;
m_device = NULL;
m_id = 0;
// if we're not temporary, register ourselves with the save state system
if (!m_temporary)
register_save();
// insert into the list
machine.scheduler().timer_list_insert(*this);
return *this;
}
//-------------------------------------------------
// init - completely initialize the state when
// re-allocated as a device timer
//-------------------------------------------------
emu_timer &emu_timer::init(device_t &device, device_timer_id id, void *ptr, bool temporary)
{
// ensure the entire timer state is clean
m_machine = device.machine;
m_next = NULL;
m_prev = NULL;
m_callback = NULL;
m_param = 0;
m_ptr = ptr;
m_func = NULL;
m_enabled = false;
m_temporary = temporary;
m_period = attotime::never;
m_start = machine().time();
m_expire = attotime::never;
m_device = &device;
m_id = id;
// if we're not temporary, register ourselves with the save state system
if (!m_temporary)
register_save();
// insert into the list
machine().scheduler().timer_list_insert(*this);
return *this;
}
//-------------------------------------------------
// release - release us from the global list
// management when deallocating
//-------------------------------------------------
emu_timer &emu_timer::release()
{
// unhook us from the global list
machine().scheduler().timer_list_remove(*this);
return *this;
}
//-------------------------------------------------
// enable - enable/disable a timer
//-------------------------------------------------
bool emu_timer::enable(bool enable)
{
// reschedule only if the state has changed
bool old = m_enabled;
if (old != enable)
{
// set the enable flag
m_enabled = enable;
// remove the timer and insert back into the list
machine().scheduler().timer_list_remove(*this);
machine().scheduler().timer_list_insert(*this);
}
return old;
}
//-------------------------------------------------
// adjust - adjust the time when this timer will
// fire and specify a period for subsequent
// firings
//-------------------------------------------------
void emu_timer::adjust(attotime start_delay, INT32 param, attotime period)
{
// if this is the callback timer, mark it modified
device_scheduler &scheduler = machine().scheduler();
if (scheduler.m_callback_timer == this)
scheduler.m_callback_timer_modified = true;
// compute the time of the next firing and insert into the list
m_param = param;
m_enabled = true;
// clamp negative times to 0
if (start_delay.seconds < 0)
start_delay = attotime::zero;
// set the start and expire times
m_start = scheduler.time();
m_expire = m_start + start_delay;
m_period = period;
// remove and re-insert the timer in its new order
scheduler.timer_list_remove(*this);
scheduler.timer_list_insert(*this);
// if this was inserted as the head, abort the current timeslice and resync
if (this == scheduler.first_timer())
scheduler.abort_timeslice();
}
//-------------------------------------------------
// elapsed - return the amount of time since the
// timer was started
//-------------------------------------------------
attotime emu_timer::elapsed() const
{
return machine().time() - m_start;
}
//-------------------------------------------------
// remaining - return the amount of time
// remaining until the timer expires
//-------------------------------------------------
attotime emu_timer::remaining() const
{
return m_expire - machine().time();
}
//-------------------------------------------------
// timer_register_save - register ourself with
// the save state system
//-------------------------------------------------
void emu_timer::register_save()
{
// determine our instance number and name
int index = 0;
astring name;
// for non-device timers, it is an index based on the callback function name
if (m_device == NULL)
{
name = m_func;
for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != NULL; curtimer = curtimer->next())
if (!curtimer->m_temporary && curtimer->m_device == NULL && strcmp(curtimer->m_func, m_func) == 0)
index++;
}
// for device timers, it is an index based on the device and timer ID
else
{
name.printf("%s/%d", m_device->tag(), m_id);
for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != NULL; curtimer = curtimer->next())
if (!curtimer->m_temporary && curtimer->m_device != NULL && curtimer->m_device == m_device && curtimer->m_id == m_id)
index++;
}
// save the bits
state_save_register_item(m_machine, "timer", name, index, m_param);
state_save_register_item(m_machine, "timer", name, index, m_enabled);
state_save_register_item(m_machine, "timer", name, index, m_period.seconds);
state_save_register_item(m_machine, "timer", name, index, m_period.attoseconds);
state_save_register_item(m_machine, "timer", name, index, m_start.seconds);
state_save_register_item(m_machine, "timer", name, index, m_start.attoseconds);
state_save_register_item(m_machine, "timer", name, index, m_expire.seconds);
state_save_register_item(m_machine, "timer", name, index, m_expire.attoseconds);
}
//-------------------------------------------------
// schedule_next_period - schedule the next
// period
//-------------------------------------------------
void emu_timer::schedule_next_period()
{
// advance by one period
m_start = m_expire;
m_expire += m_period;
// remove and re-insert us
device_scheduler &scheduler = machine().scheduler();
scheduler.timer_list_remove(*this);
scheduler.timer_list_insert(*this);
}
//**************************************************************************
// CORE CPU EXECUTION
// DEVICE SCHEDULER
//**************************************************************************
//-------------------------------------------------
@ -88,10 +321,31 @@ enum
device_scheduler::device_scheduler(running_machine &machine) :
m_machine(machine),
m_quantum_set(false),
m_executing_device(NULL),
m_execute_list(NULL)
m_execute_list(NULL),
m_basetime(attotime::zero),
m_timer_list(NULL),
m_timer_allocator(machine.m_respool),
m_callback_timer(NULL),
m_callback_timer_modified(false),
m_callback_timer_expire_time(attotime::zero),
m_quantum_list(machine.m_respool),
m_quantum_allocator(machine.m_respool),
m_quantum_minimum(ATTOSECONDS_IN_NSEC(1) / 1000)
{
// append a single never-expiring timer so there is always one in the list
m_timer_list = &m_timer_allocator.alloc()->init(m_machine, NULL, NULL, NULL, true);
m_timer_list->adjust(attotime::never);
}
// remove me once save state registration is embedded
void device_scheduler::register_for_save()
{
// register global states
state_save_register_item(&m_machine, "timer", NULL, 0, m_basetime.seconds);
state_save_register_item(&m_machine, "timer", NULL, 0, m_basetime.attoseconds);
state_save_register_postload(&m_machine, &state_postload_stub<device_scheduler, &device_scheduler::postload>, this);
}
@ -101,6 +355,42 @@ device_scheduler::device_scheduler(running_machine &machine) :
device_scheduler::~device_scheduler()
{
// remove all timers
while (m_timer_list != NULL)
m_timer_allocator.reclaim(m_timer_list->release());
}
//-------------------------------------------------
// time - return the current time
//-------------------------------------------------
attotime device_scheduler::time() const
{
// if we're currently in a callback, use the timer's expiration time as a base
if (m_callback_timer != NULL)
return m_callback_timer_expire_time;
// if we're executing as a particular CPU, use its local time as a base
// otherwise, return the global base time
return (m_executing_device != NULL) ? m_executing_device->local_time() : m_basetime;
}
//-------------------------------------------------
// can_save - return true if it's safe to save
// (i.e., no temporary timers outstanding)
//-------------------------------------------------
bool device_scheduler::can_save() const
{
// if any live temporary timers exit, fail
for (emu_timer *timer = m_timer_list; timer != NULL; timer = timer->next())
if (timer->m_temporary)
return false;
// otherwise, we're good
return true;
}
@ -112,34 +402,23 @@ device_scheduler::~device_scheduler()
void device_scheduler::timeslice()
{
bool call_debugger = ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0);
timer_execution_state *timerexec = timer_get_execution_state(&m_machine);
if (TEMPLOG) printf("Timeslice start\n");
// build the execution list if we don't have one yet
if (m_execute_list == NULL)
rebuild_execute_list();
// execute timers
execute_timers();
// loop until we hit the next timer
while (ATTOTIME_LT(timerexec->basetime, timerexec->nextfire))
while (m_basetime < m_timer_list->m_expire)
{
if (TEMPLOG)
{
void timer_print_first_timer(running_machine *machine);
printf("Timeslice loop: basetime=%15.6f\n", timerexec->basetime.as_double());
timer_print_first_timer(&m_machine);
}
// by default, assume our target is the end of the next quantum
attotime target;
target.seconds = timerexec->basetime.seconds;
target.attoseconds = timerexec->basetime.attoseconds + timerexec->curquantum;
ATTOTIME_NORMALIZE(target);
attotime target = m_basetime + attotime(0, m_quantum_list.first()->m_actual);
// however, if the next timer is going to fire before then, override
assert((timerexec->nextfire - target).seconds <= 0);
if (ATTOTIME_LT(timerexec->nextfire, target))
target = timerexec->nextfire;
if (m_timer_list->m_expire < target)
target = m_timer_list->m_expire;
LOG(("------------------\n"));
LOG(("cpu_timeslice: target = %s\n", target.as_string()));
@ -148,7 +427,7 @@ if (TEMPLOG)
UINT32 suspendchanged = 0;
for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
{
suspendchanged |= (exec->m_suspend ^ exec->m_nextsuspend);
suspendchanged |= exec->m_suspend ^ exec->m_nextsuspend;
exec->m_suspend = exec->m_nextsuspend;
exec->m_nextsuspend &= ~SUSPEND_REASON_TIMESLICE;
exec->m_eatcycles = exec->m_nexteatcycles;
@ -185,7 +464,6 @@ if (TEMPLOG)
// note that this global variable cycles_stolen can be modified
// via the call to cpu_execute
exec->m_cycles_stolen = 0;
if (TEMPLOG) printf("Executing %s for %d cycles\n", exec->device().tag(), ran);
m_executing_device = exec;
*exec->m_icountptr = exec->m_cycles_running;
if (!call_debugger)
@ -204,30 +482,19 @@ if (TEMPLOG) printf("Executing %s for %d cycles\n", exec->device().tag(), ran);
ran -= exec->m_cycles_stolen;
g_profiler.stop();
}
else
if (TEMPLOG) printf("Skipping %s for %d cycles\n", exec->device().tag(), ran);
// account for these cycles
exec->m_totalcycles += ran;
// update the local time for this CPU
attoseconds_t actualdelta = exec->m_attoseconds_per_cycle * ran;
exec->m_localtime.attoseconds += actualdelta;
ATTOTIME_NORMALIZE(exec->m_localtime);
exec->m_localtime += attotime(0, exec->m_attoseconds_per_cycle * ran);
LOG((" %d ran, %d total, time = %s\n", ran, (INT32)exec->m_totalcycles, exec->m_localtime.as_string()));
// if the new local CPU time is less than our target, move the target up
if (ATTOTIME_LT(exec->m_localtime, target))
// if the new local CPU time is less than our target, move the target up, but not before the base
if (exec->m_localtime < target)
{
assert(exec->m_localtime < target);
target = exec->m_localtime;
// however, if this puts us before the base, clamp to the base as a minimum
if (ATTOTIME_LT(target, timerexec->basetime))
{
assert(target < timerexec->basetime);
target = timerexec->basetime;
}
target = max(exec->m_localtime, m_basetime);
LOG((" (new target)\n"));
}
}
@ -236,49 +503,14 @@ if (TEMPLOG) printf("Skipping %s for %d cycles\n", exec->device().tag(), ran);
m_executing_device = NULL;
// update the base time
timerexec->basetime = target;
m_basetime = target;
}
if (TEMPLOG) printf("Timeslice end\n");
// execute timers
timer_execute_timers(&m_machine);
}
//-------------------------------------------------
// boost_interleave - temporarily boosts the
// interleave factor
//-------------------------------------------------
void device_scheduler::boost_interleave(attotime timeslice_time, attotime boost_duration)
{
// ignore timeslices > 1 second
if (timeslice_time.seconds > 0)
return;
timer_add_scheduling_quantum(&m_machine, timeslice_time.attoseconds, boost_duration);
}
//-------------------------------------------------
// eat_all_cycles - eat a ton of cycles on all
// CPUs to force a quick exit
//-------------------------------------------------
void device_scheduler::eat_all_cycles()
{
for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
exec->eat_cycles(1000000000);
}
//**************************************************************************
// GLOBAL HELPERS
//**************************************************************************
//-------------------------------------------------
// cpuexec_abort_timeslice - abort execution
// for the current timeslice
// abort_timeslice - abort execution for the
// current timeslice
//-------------------------------------------------
void device_scheduler::abort_timeslice()
@ -299,8 +531,8 @@ void device_scheduler::trigger(int trigid, attotime after)
rebuild_execute_list();
// if we have a non-zero time, schedule a timer
if (after.attoseconds != 0 || after.seconds != 0)
timer_set(&m_machine, after, (void *)this, trigid, static_timed_trigger);
if (after != attotime::zero)
timer_set(after, MFUNC(timer_expired, device_scheduler, timed_trigger), trigid, this);
// send the trigger to everyone who cares
else
@ -310,13 +542,125 @@ void device_scheduler::trigger(int trigid, attotime after)
//-------------------------------------------------
// static_timed_trigger - generate a trigger
// after a given amount of time
// boost_interleave - temporarily boosts the
// interleave factor
//-------------------------------------------------
TIMER_CALLBACK( device_scheduler::static_timed_trigger )
void device_scheduler::boost_interleave(attotime timeslice_time, attotime boost_duration)
{
reinterpret_cast<device_scheduler *>(ptr)->trigger(param);
// ignore timeslices > 1 second
if (timeslice_time.seconds > 0)
return;
add_scheduling_quantum(timeslice_time, boost_duration);
}
//-------------------------------------------------
// timer_alloc - allocate a global non-device
// timer and return a pointer
//-------------------------------------------------
emu_timer *device_scheduler::timer_alloc(timer_expired_func callback, const char *name, void *ptr)
{
return &m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, false);
}
//-------------------------------------------------
// timer_set - allocate an anonymous non-device
// timer and set it to go off after the given
// amount of time
//-------------------------------------------------
void device_scheduler::timer_set(attotime duration, timer_expired_func callback, const char *name, int param, void *ptr)
{
m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, true).adjust(duration, param);
}
//-------------------------------------------------
// timer_pulse - allocate an anonymous non-device
// timer and set it to go off at the given
// frequency
//-------------------------------------------------
void device_scheduler::timer_pulse(attotime period, timer_expired_func callback, const char *name, int param, void *ptr)
{
m_timer_allocator.alloc()->init(m_machine, callback, name, ptr, true).adjust(period, param, period);
}
//-------------------------------------------------
// timer_alloc - allocate a global device timer
// and return a pointer
//-------------------------------------------------
emu_timer *device_scheduler::timer_alloc(device_t &device, device_timer_id id, void *ptr)
{
return &m_timer_allocator.alloc()->init(device, id, ptr, false);
}
//-------------------------------------------------
// timer_set - allocate an anonymous device timer
// and set it to go off after the given amount of
// time
//-------------------------------------------------
void device_scheduler::timer_set(attotime duration, device_t &device, device_timer_id id, int param, void *ptr)
{
m_timer_allocator.alloc()->init(device, id, ptr, true).adjust(duration, param);
}
//-------------------------------------------------
// eat_all_cycles - eat a ton of cycles on all
// CPUs to force a quick exit
//-------------------------------------------------
void device_scheduler::eat_all_cycles()
{
for (device_execute_interface *exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
exec->eat_cycles(1000000000);
}
//-------------------------------------------------
// timed_trigger - generate a trigger after a
// given amount of time
//-------------------------------------------------
void device_scheduler::timed_trigger(running_machine &machine, INT32 param)
{
trigger(param);
}
//-------------------------------------------------
// postload - after loading a save state
//-------------------------------------------------
void device_scheduler::postload()
{
// remove all timers and make a private list of permanent ones
simple_list<emu_timer> private_list;
while (m_timer_list != NULL)
{
emu_timer &timer = *m_timer_list;
// temporary timers go away entirely
if (timer.m_temporary)
m_timer_allocator.reclaim(timer.release());
// permanent ones get added to our private list
else
private_list.append(timer_list_remove(timer));
}
// now re-insert them; this effectively re-sorts them by time
emu_timer *timer;
while ((timer = private_list.detach_head()) != NULL)
timer_list_insert(*timer);
}
@ -335,15 +679,13 @@ void device_scheduler::compute_perfect_interleave()
device_execute_interface *first = m_execute_list;
if (first != NULL)
{
// start with a huge time factor and find the 2nd smallest cycle time
attoseconds_t smallest = first->minimum_quantum();
attoseconds_t perfect = ATTOSECONDS_PER_SECOND - 1;
// start with a huge time factor and find the 2nd smallest cycle time
for (device_execute_interface *exec = first->m_nextexec; exec != NULL; exec = exec->m_nextexec)
{
attoseconds_t curquantum = exec->minimum_quantum();
// find the 2nd smallest cycle interval
attoseconds_t curquantum = exec->minimum_quantum();
if (curquantum < smallest)
{
perfect = smallest;
@ -353,10 +695,14 @@ void device_scheduler::compute_perfect_interleave()
perfect = curquantum;
}
// adjust the final value
timer_set_minimum_quantum(&m_machine, perfect);
LOG(("Perfect interleave = %.9f, smallest = %.9f\n", ATTOSECONDS_TO_DOUBLE(perfect), ATTOSECONDS_TO_DOUBLE(smallest)));
// if this is a new minimum quantum, apply it
if (m_quantum_minimum != perfect)
{
// adjust all the actuals; this doesn't affect the current
m_quantum_minimum = perfect;
for (quantum_slot *quant = m_quantum_list.first(); quant != NULL; quant = quant->next())
quant->m_actual = MAX(quant->m_requested, m_quantum_minimum);
}
}
}
@ -370,7 +716,7 @@ void device_scheduler::compute_perfect_interleave()
void device_scheduler::rebuild_execute_list()
{
// if we haven't yet set a scheduling quantum, do it now
if (!m_quantum_set)
if (m_quantum_list.first() == NULL)
{
// set the core scheduling quantum
attotime min_quantum = m_machine.config->m_minimum_quantum;
@ -393,11 +739,11 @@ void device_scheduler::rebuild_execute_list()
min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum);
}
// make sure it's no higher than 60Hz
min_quantum = min(min_quantum, attotime::from_hz(60));
// inform the timer system of our decision
assert(min_quantum.seconds == 0);
timer_add_scheduling_quantum(&m_machine, min_quantum.attoseconds, attotime::never);
if (TEMPLOG) printf("Setting quantum: %08X%08X\n", (UINT32)(min_quantum.attoseconds >> 32), (UINT32)min_quantum.attoseconds);
m_quantum_set = true;
add_scheduling_quantum(min_quantum, attotime::never);
}
// start with an empty list
@ -428,11 +774,220 @@ if (TEMPLOG) printf("Setting quantum: %08X%08X\n", (UINT32)(min_quantum.attoseco
// append the suspend list to the end of the active list
*active_tailptr = suspend_list;
if (TEMPLOG)
}
//-------------------------------------------------
// timer_list_insert - insert a new timer into
// the list at the appropriate location
//-------------------------------------------------
emu_timer &device_scheduler::timer_list_insert(emu_timer &timer)
{
printf("Execute list:");
for (exec = m_execute_list; exec != NULL; exec = exec->m_nextexec)
printf(" %s", exec->device().tag());
printf("\n");
// disabled timers sort to the end
attotime expire = timer.m_enabled ? timer.m_expire : attotime::never;
// loop over the timer list
emu_timer *prevtimer = NULL;
for (emu_timer *curtimer = m_timer_list; curtimer != NULL; prevtimer = curtimer, curtimer = curtimer->next())
{
// if the current list entry expires after us, we should be inserted before it
if (curtimer->m_expire > expire)
{
// link the new guy in before the current list entry
timer.m_prev = curtimer->m_prev;
timer.m_next = curtimer;
if (curtimer->m_prev != NULL)
curtimer->m_prev->m_next = &timer;
else
m_timer_list = &timer;
curtimer->m_prev = &timer;
return timer;
}
}
// need to insert after the last one
if (prevtimer != NULL)
prevtimer->m_next = &timer;
else
m_timer_list = &timer;
timer.m_prev = prevtimer;
timer.m_next = NULL;
return timer;
}
//-------------------------------------------------
// timer_list_remove - remove a timer from the
// linked list
//-------------------------------------------------
emu_timer &device_scheduler::timer_list_remove(emu_timer &timer)
{
// remove it from the list
if (timer.m_prev != NULL)
timer.m_prev->m_next = timer.m_next;
else
m_timer_list = timer.m_next;
if (timer.m_next != NULL)
timer.m_next->m_prev = timer.m_prev;
return timer;
}
//-------------------------------------------------
// execute_timers - execute timers and update
// scheduling quanta
//-------------------------------------------------
void device_scheduler::execute_timers()
{
// if the current quantum has expired, find a new one
while (m_basetime >= m_quantum_list.first()->m_expire)
m_quantum_allocator.reclaim(m_quantum_list.detach_head());
LOG(("timer_set_global_time: new=%s head->expire=%s\n", m_basetime.as_string(), m_timer_list->m_expire.as_string()));
// now process any timers that are overdue
while (m_timer_list->m_expire <= m_basetime)
{
// if this is a one-shot timer, disable it now
emu_timer &timer = *m_timer_list;
bool was_enabled = timer.m_enabled;
if (timer.m_period == attotime::zero || timer.m_period == attotime::never)
timer.m_enabled = false;
// set the global state of which callback we're in
m_callback_timer_modified = false;
m_callback_timer = &timer;
m_callback_timer_expire_time = timer.m_expire;
// call the callback
if (was_enabled)
{
g_profiler.start(PROFILER_TIMER_CALLBACK);
if (timer.m_device != NULL)
timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr);
else if (timer.m_callback != NULL)
(*timer.m_callback)(&m_machine, timer.m_ptr, timer.m_param);
g_profiler.stop();
}
// clear the callback timer global
m_callback_timer = NULL;
// reset or remove the timer, but only if it wasn't modified during the callback
if (!m_callback_timer_modified)
{
// if the timer is temporary, remove it now
if (timer.m_temporary)
m_timer_allocator.reclaim(timer.release());
// otherwise, reschedule it
else
timer.schedule_next_period();
}
}
}
//-------------------------------------------------
// add_scheduling_quantum - add a scheduling
// quantum; the smallest active one is the one
// that is in use
//-------------------------------------------------
void device_scheduler::add_scheduling_quantum(attotime quantum, attotime duration)
{
assert(quantum.seconds == 0);
attotime curtime = time();
attotime expire = curtime + duration;
// figure out where to insert ourselves, expiring any quanta that are out-of-date
quantum_slot *insert_after = NULL;
quantum_slot *next;
for (quantum_slot *quant = m_quantum_list.first(); quant != NULL; quant = next)
{
// if this quantum is expired, nuke it
next = quant->next();
if (curtime >= quant->m_expire)
m_quantum_allocator.reclaim(m_quantum_list.detach(*quant));
// if this quantum is shorter than us, we need to be inserted afterwards
else if (quant->m_requested <= quantum.attoseconds)
insert_after = quant;
}
// if we found an exact match, just take the maximum expiry time
if (insert_after != NULL && insert_after->m_requested == quantum.attoseconds)
insert_after->m_expire = max(insert_after->m_expire, expire);
// otherwise, allocate a new quantum and insert it after the one we picked
else
{
quantum_slot &quant = *m_quantum_allocator.alloc();
quant.m_requested = quantum.attoseconds;
quant.m_actual = MAX(quantum.attoseconds, m_quantum_minimum);
quant.m_expire = expire;
m_quantum_list.insert_after(quant, insert_after);
}
}
attotime timer_get_time(running_machine *machine) { return machine->time(); }
/***************************************************************************
// DEBUGGING
***************************************************************************/
#if 0
//-------------------------------------------------
// timer_logtimers - log all the timers
//-------------------------------------------------
static void timer_logtimers(running_machine *machine)
{
emu_timer *t;
logerror("===============\n");
logerror("TIMER LOG START\n");
logerror("===============\n");
logerror("Enqueued timers:\n");
for (t = global->activelist; t; t = t->next)
logerror(" Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n",
t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->file, t->line, t->func);
logerror("Free timers:\n");
for (t = global->freelist; t; t = t->next)
logerror(" Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n",
t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->file, t->line, t->func);
logerror("==============\n");
logerror("TIMER LOG STOP\n");
logerror("==============\n");
}
void timer_print_first_timer(running_machine *machine)
{
emu_timer *t = global->activelist;
printf(" Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s)\n",
t->start.as_double(), t->expire.as_double(), t->period.as_double(), t->enabled, t->temporary, t->func);
}
#endif

View File

@ -51,54 +51,218 @@
// MACROS
//**************************************************************************
// this macro wraps a function 'x' and can be used to pass a function followed by its name
#define FUNC(x) x, #x
// this macro wraps a member function 'x' from class 'c' using a templatized stub of type 's'
#define MFUNC(s,c,x) s##_stub<c, &c::x>, #c "::" #x
// these must be macros because we are included before the running_machine
#define cpuexec_describe_context(mach) (mach)->describe_context()
#define cpuexec_boost_interleave(mach, slice, dur) (mach)->scheduler().boost_interleave(slice, dur)
#define cpuexec_trigger(mach, trigid) (mach)->scheduler().trigger(trigid)
#define cpuexec_triggertime(mach, trigid, dur) (mach)->scheduler().trigger(trigid, dur)
// macro for the RC time constant on a 74LS123 with C > 1000pF
// R is in ohms, C is in farads
#define TIME_OF_74LS123(r,c) (0.45 * (double)(r) * (double)(c))
// macros for the RC time constant on a 555 timer IC
// R is in ohms, C is in farads
#define PERIOD_OF_555_MONOSTABLE_NSEC(r,c) ((attoseconds_t)(1100000000 * (double)(r) * (double)(c)))
#define PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c) ((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c)))
#define PERIOD_OF_555_MONOSTABLE(r,c) attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c))
#define PERIOD_OF_555_ASTABLE(r1,r2,c) attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c))
#define TIMER_CALLBACK(name) void name(running_machine *machine, void *ptr, int param)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// timer callbacks look like this
typedef void (*timer_expired_func)(running_machine *machine, void *ptr, INT32 param);
// stub for when the ptr parameter points to a class
template<class T, void (T::*func)(running_machine &machine, INT32 param)>
void timer_expired_stub(running_machine *machine, void *ptr, INT32 param)
{
T *target = reinterpret_cast<T *>(ptr);
(target->*func)(*machine, param);
}
// ======================> emu_timer
class emu_timer
{
friend class device_scheduler;
friend class simple_list<emu_timer>;
friend class fixed_allocator<emu_timer>;
// construction/destruction
emu_timer();
// allocation and re-use
emu_timer &init(running_machine &machine, timer_expired_func callback, const char *name, void *ptr, bool temporary);
emu_timer &init(device_t &device, device_timer_id id, void *ptr, bool temporary);
emu_timer &release();
public:
// getters
emu_timer *next() const { return m_next; }
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
bool enabled() const { return m_enabled; }
int param() const { return m_param; }
void *ptr() const { return m_ptr; }
// setters
bool enable(bool enable = true);
void set_param(int param) { m_param = param; }
void set_ptr(void *ptr) { m_ptr = ptr; }
// control
void reset(attotime duration) { adjust(duration, m_param, m_period); }
void adjust(attotime duration, INT32 param = 0, attotime periodicity = attotime::never);
// timing queries
attotime elapsed() const;
attotime remaining() const;
attotime start() const { return m_start; }
attotime expire() const { return m_expire; }
private:
// internal helpers
void register_save();
void schedule_next_period();
// internal state
running_machine * m_machine; // reference to the owning machine
emu_timer * m_next; // next timer in order in the list
emu_timer * m_prev; // previous timer in order in the list
timer_expired_func m_callback; // callback function
INT32 m_param; // integer parameter
void * m_ptr; // pointer parameter
const char * m_func; // string name of the callback function
bool m_enabled; // is the timer enabled?
bool m_temporary; // is the timer temporary?
attotime m_period; // the repeat frequency of the timer
attotime m_start; // time when the timer was started
attotime m_expire; // time when the timer will expire
device_t * m_device; // for device timers, a pointer to the device
device_timer_id m_id; // for device timers, the ID of the timer
};
// ======================> device_scheduler
class device_scheduler
{
friend class device_execute_interface;
friend class emu_timer;
public:
// construction/destruction
device_scheduler(running_machine &machine);
~device_scheduler();
void register_for_save();
void timeslice();
void trigger(int trigid, attotime after = attotime::zero);
void boost_interleave(attotime timeslice_time, attotime boost_duration);
void abort_timeslice();
// getters
attotime time() const;
emu_timer *first_timer() const { return m_timer_list; }
device_execute_interface *currently_executing() const { return m_executing_device; }
bool can_save() const;
// for timer system only!
attotime override_local_time(attotime default_time);
// execution
void timeslice();
void abort_timeslice();
void trigger(int trigid, attotime after = attotime::zero);
void boost_interleave(attotime timeslice_time, attotime boost_duration);
// timers, specified by callback/name
emu_timer *timer_alloc(timer_expired_func callback, const char *name, void *ptr = NULL);
void timer_set(attotime duration, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL);
void timer_pulse(attotime period, timer_expired_func callback, const char *name, int param = 0, void *ptr = NULL);
void synchronize(timer_expired_func callback = NULL, const char *name = NULL, int param = 0, void *ptr = NULL) { timer_set(attotime::zero, callback, name, param, ptr); }
// timers, specified by device/id; generally devices should use the device_t methods instead
emu_timer *timer_alloc(device_t &device, device_timer_id id = 0, void *ptr = NULL);
void timer_set(attotime duration, device_t &device, device_timer_id id = 0, int param = 0, void *ptr = NULL);
// for emergencies only!
void eat_all_cycles();
private:
// callbacks
void timed_trigger(running_machine &machine, INT32 param);
void postload();
// scheduling helpers
void compute_perfect_interleave();
void rebuild_execute_list();
void add_scheduling_quantum(attotime quantum, attotime duration);
// timer helpers
emu_timer &timer_list_insert(emu_timer &timer);
emu_timer &timer_list_remove(emu_timer &timer);
void execute_timers();
static TIMER_CALLBACK( static_timed_trigger );
// internal state
running_machine & m_machine; // reference to our machine
device_execute_interface * m_executing_device; // pointer to currently executing device
device_execute_interface * m_execute_list; // list of devices to be executed
attotime m_basetime; // global basetime; everything moves forward from here
running_machine & m_machine; // reference to our owner
bool m_quantum_set; // have we set the scheduling quantum yet?
device_execute_interface * m_executing_device; // pointer to currently executing device
device_execute_interface * m_execute_list; // list of devices to be executed
// list of active timers
emu_timer * m_timer_list; // head of the active list
fixed_allocator<emu_timer> m_timer_allocator; // allocator for timers
// other internal states
emu_timer * m_callback_timer; // pointer to the current callback timer
bool m_callback_timer_modified; // true if the current callback timer was modified
attotime m_callback_timer_expire_time; // the original expiration time
// scheduling quanta
class quantum_slot
{
friend class simple_list<quantum_slot>;
public:
quantum_slot *next() const { return m_next; }
quantum_slot * m_next;
attoseconds_t m_actual; // actual duration of the quantum
attoseconds_t m_requested; // duration of the requested quantum
attotime m_expire; // absolute expiration time of this quantum
};
simple_list<quantum_slot> m_quantum_list; // list of active quanta
fixed_allocator<quantum_slot> m_quantum_allocator; // allocator for quanta
attoseconds_t m_quantum_minimum; // duration of minimum quantum
};
#endif /* __SCHEDULE_H__ */
// temporary stuff
attotime timer_get_time(running_machine *machine);
inline void timer_adjust_oneshot(emu_timer *which, attotime duration, INT32 param) { which->adjust(duration, param); }
inline void timer_adjust_periodic(emu_timer *which, attotime start_delay, INT32 param, attotime period) { which->adjust(start_delay, param, period); }
inline void timer_reset(emu_timer *which, attotime duration) { which->reset(duration); }
inline int timer_enable(emu_timer *which, int enable) { return which->enable(enable); }
inline int timer_enabled(emu_timer *which) { return which->enabled(); }
inline int timer_get_param(emu_timer *which) { return which->param(); }
inline void timer_set_param(emu_timer *which, int param) { which->set_param(param); }
inline void *timer_get_ptr(emu_timer *which) { return which->ptr(); }
inline void timer_set_ptr(emu_timer *which, void *ptr) { which->set_ptr(ptr); }
inline attotime timer_timeelapsed(emu_timer *which) { return which->elapsed(); }
inline attotime timer_timeleft(emu_timer *which) { return which->remaining(); }
inline attotime timer_starttime(emu_timer *which) { return which->start(); }
inline attotime timer_firetime(emu_timer *which) { return which->expire(); }
#endif // __SCHEDULE_H__ */

View File

@ -341,15 +341,15 @@ void screen_device::device_start()
m_container->set_user_settings(settings);
// allocate the VBLANK timers
m_vblank_begin_timer = timer_alloc(machine, static_vblank_begin_callback, (void *)this);
m_vblank_end_timer = timer_alloc(machine, static_vblank_end_callback, (void *)this);
m_vblank_begin_timer = machine->scheduler().timer_alloc(FUNC(static_vblank_begin_callback), (void *)this);
m_vblank_end_timer = machine->scheduler().timer_alloc(FUNC(static_vblank_end_callback), (void *)this);
// allocate a timer to reset partial updates
m_scanline0_timer = timer_alloc(machine, static_scanline0_callback, (void *)this);
m_scanline0_timer = machine->scheduler().timer_alloc(FUNC(static_scanline0_callback), (void *)this);
// allocate a timer to generate per-scanline updates
if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
m_scanline_timer = timer_alloc(machine, static_scanline_update_callback, (void *)this);
m_scanline_timer = machine->scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this);
// configure the screen with the default parameters
configure(m_config.m_width, m_config.m_height, m_config.m_visarea, m_config.m_refresh);

View File

@ -766,7 +766,7 @@ sound_stream::stream_output::stream_output()
sound_manager::sound_manager(running_machine &machine)
: m_machine(machine),
m_update_timer(timer_alloc(&machine, update_static, this)),
m_update_timer(machine.scheduler().timer_alloc(FUNC(update_static), this)),
m_finalmix_leftover(0),
m_finalmix(NULL),
m_leftmix(NULL),

View File

@ -134,8 +134,8 @@ static DEVICE_START( ym2203 )
assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip");
/* Timer Handler set */
info->timer[0] = timer_alloc(device->machine, timer_callback_2203_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_2203_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2203_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2203_1), info);
/* stream system initialize */
info->stream = device->machine->sound().stream_alloc(*device,0,1,rate,info,ym2203_stream_update);

View File

@ -152,8 +152,8 @@ static DEVICE_START( ym2608 )
assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip");
/* Timer Handler set */
info->timer[0] = timer_alloc(device->machine, timer_callback_2608_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2608_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2608_1), info);
/* stream system initialize */
info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2608_stream_update);

View File

@ -156,8 +156,8 @@ static DEVICE_START( ym2610 )
assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip");
/* Timer Handler set */
info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
/* stream system initialize */
info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,(type == YM2610) ? ym2610_stream_update : ym2610b_stream_update);

View File

@ -108,8 +108,8 @@ static DEVICE_START( ym2612 )
/* FM init */
/* Timer Handler set */
info->timer[0] = timer_alloc(device->machine, timer_callback_2612_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2612_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2612_1), info);
/* stream system initialize */
info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2612_stream_update);

View File

@ -95,8 +95,8 @@ static DEVICE_START( ymf262 )
ymf262_set_irq_handler (info->chip, IRQHandler_262, info);
ymf262_set_update_handler(info->chip, _stream_update, info);
info->timer[0] = timer_alloc(device->machine, timer_callback_262_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_262_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_262_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_262_1), info);
}
static DEVICE_STOP( ymf262 )

View File

@ -105,8 +105,8 @@ static DEVICE_START( ym3526 )
ym3526_set_irq_handler (info->chip, IRQHandler, info);
ym3526_set_update_handler(info->chip, _stream_update, info);
info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
}
static DEVICE_STOP( ym3526 )

View File

@ -106,8 +106,8 @@ static DEVICE_START( ym3812 )
ym3812_set_irq_handler (info->chip, IRQHandler, info);
ym3812_set_update_handler(info->chip, _stream_update, info);
info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
}
static DEVICE_STOP( ym3812 )

View File

@ -139,8 +139,8 @@ static DEVICE_START( y8950 )
y8950_set_irq_handler (info->chip, IRQHandler, info);
y8950_set_update_handler(info->chip, _stream_update, info);
info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info);
info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info);
}
static DEVICE_STOP( y8950 )

View File

@ -517,9 +517,9 @@ static void AICA_Init(device_t *device, aica_state *AICA, const aica_interface *
}
}
AICA->timerA = timer_alloc(device->machine, timerA_cb, AICA);
AICA->timerB = timer_alloc(device->machine, timerB_cb, AICA);
AICA->timerC = timer_alloc(device->machine, timerC_cb, AICA);
AICA->timerA = device->machine->scheduler().timer_alloc(FUNC(timerA_cb), AICA);
AICA->timerB = device->machine->scheduler().timer_alloc(FUNC(timerB_cb), AICA);
AICA->timerC = device->machine->scheduler().timer_alloc(FUNC(timerC_cb), AICA);
for(i=0;i<0x400;++i)
{

View File

@ -133,7 +133,7 @@ void asc_device::device_start()
memset(m_regs, 0, sizeof(m_regs));
m_sync_timer = timer_alloc(this->machine, sync_timer_cb, this);
m_sync_timer = this->machine->scheduler().timer_alloc(FUNC(sync_timer_cb), this);
state_save_register_device_item(this, 0, m_fifo_a_rdptr);
state_save_register_device_item(this, 0, m_fifo_b_rdptr);

View File

@ -245,7 +245,7 @@ void bsmt2000_device::device_start()
void bsmt2000_device::device_reset()
{
device_timer_call_after_resynch(*this, TIMER_ID_RESET);
synchronize(TIMER_ID_RESET);
}
@ -312,7 +312,7 @@ UINT16 bsmt2000_device::read_status()
void bsmt2000_device::write_reg(UINT16 data)
{
device_timer_call_after_resynch(*this, TIMER_ID_REG_WRITE, data);
synchronize(TIMER_ID_REG_WRITE, data);
}
@ -323,7 +323,7 @@ void bsmt2000_device::write_reg(UINT16 data)
void bsmt2000_device::write_data(UINT16 data)
{
device_timer_call_after_resynch(*this, TIMER_ID_DATA_WRITE, data);
synchronize(TIMER_ID_DATA_WRITE, data);
// boost the interleave on a write so that the caller detects the status more accurately
m_machine.scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(10));

View File

@ -449,9 +449,9 @@ static DEVICE_START( cdp1864 )
cdp1864->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, cdp1864, cdp1864_stream_update);
/* create the timers */
cdp1864->int_timer = timer_alloc(device->machine, cdp1864_int_tick, (void *)device);
cdp1864->efx_timer = timer_alloc(device->machine, cdp1864_efx_tick, (void *)device);
cdp1864->dma_timer = timer_alloc(device->machine, cdp1864_dma_tick, (void *)device);
cdp1864->int_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_int_tick), (void *)device);
cdp1864->efx_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_efx_tick), (void *)device);
cdp1864->dma_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_dma_tick), (void *)device);
/* register for state saving */
state_save_register_device_item(device, 0, cdp1864->disp);

View File

@ -427,7 +427,7 @@ void cdp1869_device::device_start()
m_out_char_ram_func = m_config.out_char_ram_func;
// allocate timers
m_prd_timer = device_timer_alloc(*this);
m_prd_timer = timer_alloc();
update_prd_changed_timer();
// initialize palette

View File

@ -259,7 +259,7 @@ static DEVICE_START( es5503 )
chip->oscillators[osc].irqpend = 0;
chip->oscillators[osc].accumulator = 0;
chip->oscillators[osc].timer = timer_alloc(device->machine, es5503_timer_cb, &chip->oscillators[osc]);
chip->oscillators[osc].timer = device->machine->scheduler().timer_alloc(FUNC(es5503_timer_cb), &chip->oscillators[osc]);
chip->oscillators[osc].chip = (void *)chip;
}

View File

@ -1744,7 +1744,7 @@ static int OPL_LockTable(device_t *device)
{
cymfile = fopen("3812_.cym","wb");
if (cymfile)
timer_pulse ( device->machine, attotime::from_hz(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/
device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/
else
logerror("Could not create file 3812_.cym\n");
}

View File

@ -47,8 +47,8 @@ ics2115_device::ics2115_device(running_machine &machine, const ics2115_device_co
void ics2115_device::device_start()
{
m_rom = *region();
m_timer[0].timer = timer_alloc(machine, timer_cb_0, this);
m_timer[1].timer = timer_alloc(machine, timer_cb_1, this);
m_timer[0].timer = machine->scheduler().timer_alloc(FUNC(timer_cb_0), this);
m_timer[1].timer = machine->scheduler().timer_alloc(FUNC(timer_cb_1), this);
m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 33075);
//Exact formula as per patent 5809466

View File

@ -258,7 +258,7 @@ static DEVICE_START( k053260 )
/* setup SH1 timer if necessary */
if ( ic->intf->irq )
timer_pulse( device->machine, attotime::from_hz(device->clock()) * 32, NULL, 0, ic->intf->irq );
device->machine->scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, FUNC(ic->intf->irq ));
}
INLINE void check_bounds( k053260_state *ic, int channel )

View File

@ -14,7 +14,7 @@
typedef struct _k053260_interface k053260_interface;
struct _k053260_interface {
const char *rgnoverride;
timer_fired_func irq; /* called on SH1 complete cycle ( clock / 32 ) */
timer_expired_func irq; /* called on SH1 complete cycle ( clock / 32 ) */
};

Some files were not shown because too many files have changed in this diff Show More