Cleaned up turbo handling.
This commit is contained in:
parent
4f0fe705c5
commit
b530bdafea
9 changed files with 54 additions and 32 deletions
37
src/cpu.c
37
src/cpu.c
|
|
@ -7,6 +7,9 @@
|
|||
#include "pci.h"
|
||||
#include "codegen.h"
|
||||
|
||||
static int cpu_turbo_speed, cpu_nonturbo_speed;
|
||||
static int cpu_turbo = 1;
|
||||
|
||||
int isa_cycles;
|
||||
int has_vlb;
|
||||
static uint8_t ccr0, ccr1, ccr2, ccr3, ccr4, ccr5, ccr6;
|
||||
|
|
@ -505,6 +508,14 @@ void cpu_set()
|
|||
ccr0 = ccr1 = ccr2 = ccr3 = ccr4 = ccr5 = ccr6 = 0;
|
||||
has_vlb = (cpu_s->cpu_type >= CPU_i486SX) && (cpu_s->cpu_type <= CPU_Cx5x86);
|
||||
|
||||
cpu_turbo_speed = cpu_s->rspeed;
|
||||
if (cpu_s->cpu_type < CPU_286)
|
||||
cpu_nonturbo_speed = 4772728;
|
||||
else if (cpu_s->rspeed < 8000000)
|
||||
cpu_nonturbo_speed = cpu_s->rspeed;
|
||||
else
|
||||
cpu_nonturbo_speed = 8000000;
|
||||
|
||||
cpu_update_waitstates();
|
||||
|
||||
isa_cycles = cpu_s->atclk_div;
|
||||
|
|
@ -1670,3 +1681,29 @@ void cpu_update_waitstates()
|
|||
cpu_prefetch_cycles *= 4;
|
||||
cpu_mem_prefetch_cycles = cpu_prefetch_cycles;
|
||||
}
|
||||
|
||||
void cpu_set_turbo(int turbo)
|
||||
{
|
||||
if (cpu_turbo != turbo)
|
||||
{
|
||||
cpu_turbo = turbo;
|
||||
|
||||
cpu_s = &models[model].cpu[cpu_manufacturer].cpus[cpu];
|
||||
if (cpu_s->cpu_type >= CPU_286)
|
||||
{
|
||||
if (cpu_turbo)
|
||||
setpitclock(cpu_turbo_speed);
|
||||
else
|
||||
setpitclock(cpu_nonturbo_speed);
|
||||
}
|
||||
else
|
||||
setpitclock(14318184.0);
|
||||
}
|
||||
}
|
||||
|
||||
int cpu_get_speed()
|
||||
{
|
||||
if (cpu_turbo)
|
||||
return cpu_turbo_speed;
|
||||
return cpu_nonturbo_speed;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue