summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-07-07 21:01:36 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-07-07 21:01:36 +0000
commit20fe094c0e9cacc0ceeaa2f15b0348ed81751fab (patch)
treee44d35618aad60fa43ac4675033b4e47eaf5765c
parent65f8a15555ffecb57a65e447e428a4212ec33e4c (diff)
Remove the global clock accessors and cpu_* aliases:
cpu_get_clock -> device_get_clock cpu_set_clock -> device_set_clock cpu_get_clockscale -> device_get_clock_scale cpu_set_clockscale -> device_set_clock_scale Search: device_get_clock([ \t]*)\(([ \t]*)([^)]+) Replace: \3->unscaled_clock\1\(\2 Search: device_set_clock([ \t]*)\(([ \t]*)([^,]+),[ \t]* Replace: \3->set_unscaled_clock\1\(\2 Search: device_get_clock_scale([ \t]*)\(([ \t]*)([^)]+) Replace: \3->clock_scale\1\(\2 Search: device_set_clock_scale([ \t]*)\(([ \t]*)([^,]+),[ \t]* Replace: \3->set_clock_scale\1\(\2
-rw-r--r--src/emu/cpu/h83002/h8_8.c4
-rw-r--r--src/emu/cpu/h83002/h8periph.c6
-rw-r--r--src/emu/cpu/m37710/m37710.c4
-rw-r--r--src/emu/cpu/mn10200/mn10200.c2
-rw-r--r--src/emu/cpu/tlcs90/tlcs90.c2
-rw-r--r--src/emu/devcpu.h8
-rw-r--r--src/emu/devintrf.h28
-rw-r--r--src/emu/machine/tmp68301.c2
-rw-r--r--src/emu/sound/cdp1864.c2
-rw-r--r--src/emu/ui.c6
-rw-r--r--src/mame/audio/dcs.c2
-rw-r--r--src/mame/drivers/aristmk4.c4
-rw-r--r--src/mame/drivers/backfire.c2
-rw-r--r--src/mame/drivers/cps2.c2
-rw-r--r--src/mame/drivers/deco_mlc.c2
-rw-r--r--src/mame/drivers/jackal.c2
-rw-r--r--src/mame/drivers/megadriv.c4
-rw-r--r--src/mame/drivers/namcos2.c2
-rw-r--r--src/mame/drivers/stv.c2
-rw-r--r--src/mame/machine/micro3d.c2
-rw-r--r--src/mame/machine/snes.c2
-rw-r--r--src/mame/video/jaguar.c4
22 files changed, 33 insertions, 61 deletions
diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c
index 0dd5d6ef9f0..2eded59d614 100644
--- a/src/emu/cpu/h83002/h8_8.c
+++ b/src/emu/cpu/h83002/h8_8.c
@@ -416,13 +416,13 @@ static void recalc_8bit_timer(h83xx_state *h8, int t)
if (h8->TCORA[t])
{
- time = (cpu_get_clock(h8->device) / dividers[div]) / (h8->TCORA[t] - h8->TCNT[t]);
+ time = (h8->device->unscaled_clock() / dividers[div]) / (h8->TCORA[t] - h8->TCNT[t]);
timer_adjust_oneshot(h8->timer[(t*2)], ATTOTIME_IN_HZ(time), 0);
}
if (h8->TCORB[t])
{
- time = (cpu_get_clock(h8->device) / dividers[div]) / (h8->TCORB[t] - h8->TCNT[t]);
+ time = (h8->device->unscaled_clock() / dividers[div]) / (h8->TCORB[t] - h8->TCNT[t]);
timer_adjust_oneshot(h8->timer[(t*2)+1], ATTOTIME_IN_HZ(time), 0);
}
}
diff --git a/src/emu/cpu/h83002/h8periph.c b/src/emu/cpu/h83002/h8periph.c
index 455b9cde0ac..e770d268224 100644
--- a/src/emu/cpu/h83002/h8periph.c
+++ b/src/emu/cpu/h83002/h8periph.c
@@ -96,7 +96,7 @@ static void h8_itu_refresh_timer(h83xx_state *h8, int tnum)
ourTCR = h8->per_regs[tcr[tnum]];
ourTVAL = h8->h8TCNT[tnum];
- period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device)), tscales[ourTCR & 3] * (65536 - ourTVAL));
+ period = attotime_mul(ATTOTIME_IN_HZ(h8->device->unscaled_clock()), tscales[ourTCR & 3] * (65536 - ourTVAL));
if (ourTCR & 4)
{
@@ -115,7 +115,7 @@ static void h8_itu_sync_timers(h83xx_state *h8, int tnum)
ourTCR = h8->per_regs[tcr[tnum]];
// get the time per unit
- cycle_time = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device)), tscales[ourTCR & 3]);
+ cycle_time = attotime_mul(ATTOTIME_IN_HZ(h8->device->unscaled_clock()), tscales[ourTCR & 3]);
cur = timer_timeelapsed(h8->timer[tnum]);
ratio = attotime_to_double(cur) / attotime_to_double(cycle_time);
@@ -457,7 +457,7 @@ static void h8_3007_itu_refresh_timer(h83xx_state *h8, int tnum)
attotime period;
int ourTCR = h8->per_regs[0x68+(tnum*8)];
- period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device)), tscales[ourTCR & 3]);
+ period = attotime_mul(ATTOTIME_IN_HZ(h8->device->unscaled_clock()), tscales[ourTCR & 3]);
if (ourTCR & 4)
{
diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c
index 580f8563ddd..c2ddd370c12 100644
--- a/src/emu/cpu/m37710/m37710.c
+++ b/src/emu/cpu/m37710/m37710.c
@@ -327,7 +327,7 @@ static void m37710_recalc_timer(m37710i_cpu_struct *cpustate, int timer)
switch (cpustate->m37710_regs[0x56+timer] & 0x3)
{
case 0: // timer mode
- time = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(cpustate->device)), tscales[cpustate->m37710_regs[tcr[timer]]>>6]);
+ time = attotime_mul(ATTOTIME_IN_HZ(cpustate->device->unscaled_clock()), tscales[cpustate->m37710_regs[tcr[timer]]>>6]);
time = attotime_mul(time, tval + 1);
#if M37710_DEBUG
@@ -362,7 +362,7 @@ static void m37710_recalc_timer(m37710i_cpu_struct *cpustate, int timer)
switch (cpustate->m37710_regs[0x56+timer] & 0x3)
{
case 0: // timer mode
- time = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(cpustate->device)), tscales[cpustate->m37710_regs[tcr[timer]]>>6]);
+ time = attotime_mul(ATTOTIME_IN_HZ(cpustate->device->unscaled_clock()), tscales[cpustate->m37710_regs[tcr[timer]]>>6]);
time = attotime_mul(time, tval + 1);
#if M37710_DEBUG
diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c
index f0f856fd3ee..35f49b7caf2 100644
--- a/src/emu/cpu/mn10200/mn10200.c
+++ b/src/emu/cpu/mn10200/mn10200.c
@@ -188,7 +188,7 @@ static void refresh_timer(mn102_info *cpustate, int tmr)
if (cpustate->prescaler[source-2].mode & 0x80)
{
// rate = (sysclock / prescaler) / our count
- rate = cpu_get_clock(cpustate->device) / cpustate->prescaler[source-2].cycles;
+ rate = cpustate->device->unscaled_clock() / cpustate->prescaler[source-2].cycles;
rate /= cpustate->simple_timer[tmr].base;
if (tmr != 8) // HACK: timer 8 is run at 500 kHz by the Taito program for no obvious reason, which kills performance
diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c
index 2f2a7c4f279..90546814cfa 100644
--- a/src/emu/cpu/tlcs90/tlcs90.c
+++ b/src/emu/cpu/tlcs90/tlcs90.c
@@ -2715,7 +2715,7 @@ static CPU_INIT( t90 )
cpustate->program = device->space(AS_PROGRAM);
cpustate->io = device->space(AS_IO);
- cpustate->timer_period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(device)), 8);
+ cpustate->timer_period = attotime_mul(ATTOTIME_IN_HZ(device->unscaled_clock()), 8);
// Reset registers to their initial values
diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h
index d6eb1203742..b294a5eb627 100644
--- a/src/emu/devcpu.h
+++ b/src/emu/devcpu.h
@@ -296,10 +296,10 @@ const device_type name = basename##_device_config::static_alloc_device_config
#define cpu_spinuntil_int device_spin_until_interrupt
// CPU clock management
-#define cpu_get_clock device_get_clock
-#define cpu_set_clock device_set_clock
-#define cpu_get_clockscale device_get_clock_scale
-#define cpu_set_clockscale device_set_clock_scale
+#define device_get_clock device_get_clock
+#define device_set_clock device_set_clock
+#define device_get_clock_scale device_get_clock_scale
+#define device_set_clock_scale device_set_clock_scale
// CPU timing
#define cpu_eat_cycles device_eat_cycles
diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h
index 62989994c9e..bd5dc450708 100644
--- a/src/emu/devintrf.h
+++ b/src/emu/devintrf.h
@@ -551,32 +551,4 @@ inline device_t *device_t::typenext() const
}
-
-// ======================> device clock management
-
-// returns the current device's unscaled running clock speed
-inline int device_get_clock(device_t *device)
-{
- return device->unscaled_clock();
-}
-
-// sets the current device's clock speed and then adjusts for scaling
-inline void device_set_clock(device_t *device, int clock)
-{
- device->set_unscaled_clock(clock);
-}
-
-// returns the current scaling factor for a device's clock speed
-inline double device_get_clock_scale(device_t *device)
-{
- return device->clock_scale();
-}
-
-// sets the current scaling factor for a device's clock speed
-inline void device_set_clock_scale(device_t *device, double clockscale)
-{
- device->set_clock_scale(clockscale);
-}
-
-
#endif /* __DEVINTRF_H__ */
diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c
index 25a0ea02148..78f7c9554c4 100644
--- a/src/emu/machine/tmp68301.c
+++ b/src/emu/machine/tmp68301.c
@@ -90,7 +90,7 @@ static void tmp68301_update_timer( running_machine *machine, int i )
{
int scale = (TCR & 0x3c00)>>10; // P4..1
if (scale > 8) scale = 8;
- duration = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(machine->firstcpu)), (1 << scale) * max);
+ duration = attotime_mul(ATTOTIME_IN_HZ(machine->firstcpu->unscaled_clock()), (1 << scale) * max);
}
break;
}
diff --git a/src/emu/sound/cdp1864.c b/src/emu/sound/cdp1864.c
index e578959619a..ffaef6dfc37 100644
--- a/src/emu/sound/cdp1864.c
+++ b/src/emu/sound/cdp1864.c
@@ -365,7 +365,7 @@ static STREAM_UPDATE( cdp1864_stream_update )
if (cdp1864->aoe)
{
- double frequency = cpu_get_clock(cdp1864->cpu) / 8 / 4 / (cdp1864->latch + 1) / 2;
+ double frequency = cdp1864->cpu->unscaled_clock() / 8 / 4 / (cdp1864->latch + 1) / 2;
int rate = device->machine->sample_rate / 2;
/* get progress through wave */
diff --git a/src/emu/ui.c b/src/emu/ui.c
index 16074fa44e1..0176af8c468 100644
--- a/src/emu/ui.c
+++ b/src/emu/ui.c
@@ -1817,10 +1817,10 @@ static INT32 slider_overclock(running_machine *machine, void *arg, astring *stri
{
device_t *cpu = (device_t *)arg;
if (newval != SLIDER_NOCHANGE)
- cpu_set_clockscale(cpu, (float)newval * 0.001f);
+ cpu->set_clock_scale((float)newval * 0.001f);
if (string != NULL)
- string->printf("%3.0f%%", floor(cpu_get_clockscale(cpu) * 100.0f + 0.5f));
- return floor(cpu_get_clockscale(cpu) * 1000.0f + 0.5f);
+ string->printf("%3.0f%%", floor(cpu->clock_scale() * 100.0f + 0.5f));
+ return floor(cpu->clock_scale() * 1000.0f + 0.5f);
}
diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c
index 603ae9e0eb6..ed4a4e0a2ce 100644
--- a/src/mame/audio/dcs.c
+++ b/src/mame/audio/dcs.c
@@ -1994,7 +1994,7 @@ static void recompute_sample_rate(running_machine *machine)
/* calculate how long until we generate an interrupt */
/* frequency the time per each bit sent */
- attotime sample_period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(dcs.cpu)), 2 * (dcs.control_regs[S1_SCLKDIV_REG] + 1));
+ attotime sample_period = attotime_mul(ATTOTIME_IN_HZ(dcs.cpu->unscaled_clock()), 2 * (dcs.control_regs[S1_SCLKDIV_REG] + 1));
/* now put it down to samples, so we know what the channel frequency has to be */
sample_period = attotime_mul(sample_period, 16 * dcs.channels);
diff --git a/src/mame/drivers/aristmk4.c b/src/mame/drivers/aristmk4.c
index e09c93fa833..5c09122a529 100644
--- a/src/mame/drivers/aristmk4.c
+++ b/src/mame/drivers/aristmk4.c
@@ -1153,10 +1153,10 @@ static MACHINE_RESET( aristmk4 )
switch(input_port_read(machine, "LK13")) // cpu speed cotrol.. 3mhz or 1.5mhz
{
case 0x00:
- cpu_set_clock(machine->device("maincpu"), MAIN_CLOCK/4); // 3 Mhz
+ machine->device("maincpu")->set_unscaled_clock(MAIN_CLOCK/4); // 3 Mhz
break;
case 0x10:
- cpu_set_clock(machine->device("maincpu"), MAIN_CLOCK/8); // 1.5 Mhz
+ machine->device("maincpu")->set_unscaled_clock(MAIN_CLOCK/8); // 1.5 Mhz
break;
}
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c
index bd81424d547..ac5b5c1fee4 100644
--- a/src/mame/drivers/backfire.c
+++ b/src/mame/drivers/backfire.c
@@ -691,7 +691,7 @@ static DRIVER_INIT( backfire )
deco56_decrypt_gfx(machine, "gfx1"); /* 141 */
deco56_decrypt_gfx(machine, "gfx2"); /* 141 */
deco156_decrypt(machine);
- cpu_set_clockscale(machine->device("maincpu"), 4.0f); /* core timings aren't accurate */
+ machine->device("maincpu")->set_clock_scale(4.0f); /* core timings aren't accurate */
descramble_sound(machine);
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0170018, 0x017001b, 0, 0, backfire_speedup_r );
}
diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c
index 3c65d286652..8efe7777d6d 100644
--- a/src/mame/drivers/cps2.c
+++ b/src/mame/drivers/cps2.c
@@ -7831,7 +7831,7 @@ static DRIVER_INIT( cps2 )
state->scancount = 0;
state->cps2networkpresent = 0;
- cpu_set_clockscale(machine->device("maincpu"), 0.7375f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */
+ machine->device("maincpu")->set_clock_scale(0.7375f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */
}
static DRIVER_INIT( ssf2tb )
diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c
index 4e4454b57b1..c63ef04c3bd 100644
--- a/src/mame/drivers/deco_mlc.c
+++ b/src/mame/drivers/deco_mlc.c
@@ -758,7 +758,7 @@ static DRIVER_INIT( mlc )
/* The timing in the ARM core isn't as accurate as it should be, so bump up the
effective clock rate here to compensate otherwise we have slowdowns in
Skull Fung where there probably shouldn't be. */
- cpu_set_clockscale(machine->device("maincpu"), 2.0f);
+ machine->device("maincpu")->set_clock_scale(2.0f);
mainCpuIsArm = 1;
deco156_decrypt(machine);
descramble_sound(machine);
diff --git a/src/mame/drivers/jackal.c b/src/mame/drivers/jackal.c
index c20144d2f7e..33458e06017 100644
--- a/src/mame/drivers/jackal.c
+++ b/src/mame/drivers/jackal.c
@@ -355,7 +355,7 @@ static MACHINE_RESET( jackal )
// HACK: running at the nominal clock rate, music stops working
// at the beginning of the game. This fixes it.
- cpu_set_clockscale(machine->device("slave"), 1.2f);
+ machine->device("slave")->set_clock_scale(1.2f);
state->rambank = rgn;
state->spritebank = rgn;
diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c
index 33e49dddf99..a3a19548d9a 100644
--- a/src/mame/drivers/megadriv.c
+++ b/src/mame/drivers/megadriv.c
@@ -5998,8 +5998,8 @@ MACHINE_RESET( megadriv )
if (genesis_other_hacks)
{
// set_refresh_rate(megadriv_framerate);
- cpu_set_clockscale(machine->device("maincpu"), 0.9950f); /* Fatal Rewind is very fussy... */
- // cpu_set_clockscale(machine->device("maincpu"), 0.3800f); /* Fatal Rewind is very fussy... */
+ machine->device("maincpu")->set_clock_scale(0.9950f); /* Fatal Rewind is very fussy... */
+ // machine->device("maincpu")->set_clock_scale(0.3800f); /* Fatal Rewind is very fussy... */
memset(megadrive_ram,0x00,0x10000);
}
diff --git a/src/mame/drivers/namcos2.c b/src/mame/drivers/namcos2.c
index 90f9a536573..749f3f94c56 100644
--- a/src/mame/drivers/namcos2.c
+++ b/src/mame/drivers/namcos2.c
@@ -4975,7 +4975,7 @@ static DRIVER_INIT( assaultp_hack ){
//
// This is used in conjunction with the interleave increase in the
// MACHINE_DRIVER
- cpu_set_clockscale(machine->device("mcu"), 4.0f);
+ machine->device("mcu")->set_clock_scale(4.0f);
DRIVER_INIT_CALL( assaultp );
}
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index e83bb03cfb3..1f5e3d4c512 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -94,7 +94,7 @@ ToDo / Notes:
-Add the RS232c interface (serial port),needed by fhboxers.
-(PCB owners) check if the clocks documented in the manuals are really right for ST-V.
-SCSP to master irq: see if there is a sound cpu mask bit.
--Does the cpu_set_clock really works?Investigate.
+-Does the device_set_clock really works?Investigate.
-We need to check every game if can be completed or there are any hanging/crash/protection
issues on them.
-Memo: Some tests done on the original & working PCB,to be implemented:
diff --git a/src/mame/machine/micro3d.c b/src/mame/machine/micro3d.c
index 15f3b20771e..fb29d5749b8 100644
--- a/src/mame/machine/micro3d.c
+++ b/src/mame/machine/micro3d.c
@@ -762,7 +762,7 @@ DRIVER_INIT( micro3d )
/* TODO? BOTSS crashes when starting the final stage because the 68000
overwrites memory in use by the Am29000. Slowing down the 68000 slightly
avoids this */
- cpu_set_clockscale(machine->device("maincpu"), 0.945f);
+ machine->device("maincpu")->set_clock_scale(0.945f);
}
DRIVER_INIT( botssa )
diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c
index f29ff6d9616..36ab65e2a61 100644
--- a/src/mame/machine/snes.c
+++ b/src/mame/machine/snes.c
@@ -727,7 +727,7 @@ WRITE8_HANDLER( snes_w_io )
case MEMSEL: /* Access cycle designation in memory (2) area */
/* FIXME: Need to adjust the speed only during access of banks 0x80+
* Currently we are just increasing it no matter what */
-// cpu_set_clockscale(state->maincpu, (data & 0x1) ? 1.335820896 : 1.0 );
+// state->maincpu->set_clock_scale((data & 0x1) ? 1.335820896 : 1.0 );
#ifdef SNES_DBG_REG_W
if ((data & 0x1) != (snes_ram[MEMSEL] & 0x1))
mame_printf_debug( "CPU speed: %f Mhz\n", (data & 0x1) ? 3.58 : 2.68 );
diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c
index ef4645d8e7b..715d8292dc6 100644
--- a/src/mame/video/jaguar.c
+++ b/src/mame/video/jaguar.c
@@ -682,7 +682,7 @@ static TIMER_CALLBACK( jaguar_pit )
if (gpu_regs[PIT0])
{
- sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(machine->device("gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1]));
+ sample_period = ATTOTIME_IN_NSEC(machine->device("gpu")->unscaled_clock() / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1]));
// timer_set(machine, sample_period, NULL, 0, jaguar_pit);
}
}
@@ -712,7 +712,7 @@ WRITE16_HANDLER( jaguar_tom_regs_w )
case PIT1:
if (gpu_regs[PIT0])
{
- sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(space->machine->device("gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1]));
+ sample_period = ATTOTIME_IN_NSEC(space->machine->device("gpu")->unscaled_clock() / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1]));
timer_set(space->machine, sample_period, NULL, 0, jaguar_pit);
}
break;