PIT: add alternative faster PIT
This is enabled by default on 486+ CPUs and can be forced disabled/enabled with pit_mode=0/1
This commit is contained in:
@@ -2059,7 +2059,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
speaker_enable = val & 0x02;
|
||||
if (speaker_enable)
|
||||
was_speaker_enable = 1;
|
||||
pit_ctr_set_gate(&pit->counters[2], val & 0x01);
|
||||
pit_devs[0].set_gate(pit_devs[0].data, 2, val & 0x01);
|
||||
|
||||
if (val & 0x80) {
|
||||
/* Keyboard enabled, so enable PA reading. */
|
||||
|
||||
@@ -66,7 +66,7 @@ machine_at_common_init_ex(const machine_t *model, int type)
|
||||
machine_common_init(model);
|
||||
|
||||
refresh_at_enable = 1;
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_at);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_at);
|
||||
pic2_init();
|
||||
dma16_init();
|
||||
|
||||
|
||||
@@ -718,7 +718,7 @@ machine_europc_init(const machine_t *model)
|
||||
return ret;
|
||||
|
||||
machine_common_init(model);
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
nmi_init();
|
||||
|
||||
|
||||
@@ -627,7 +627,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
speaker_enable = val & 2;
|
||||
if (speaker_enable)
|
||||
was_speaker_enable = 1;
|
||||
pit_ctr_set_gate(&pit->counters[2], val & 1);
|
||||
pit_devs[0].set_gate(pit_devs[0].data, 2, val & 1);
|
||||
sn76489_mute = speaker_mute = 1;
|
||||
switch (val & 0x60) {
|
||||
case 0x00:
|
||||
@@ -642,7 +642,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
|
||||
case 0xa0:
|
||||
nmi_mask = val & 0x80;
|
||||
pit_ctr_set_using_timer(&pit->counters[1], !(val & 0x20));
|
||||
pit_devs[0].set_using_timer(pit_devs[0].data, 1, !(val & 0x20));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -770,6 +770,18 @@ speed_changed(void *priv)
|
||||
recalc_timings(pcjr);
|
||||
}
|
||||
|
||||
void
|
||||
pit_irq0_timer_pcjr(int new_out, int old_out)
|
||||
{
|
||||
if (new_out && !old_out) {
|
||||
picint(1);
|
||||
pit_devs[0].ctr_clock(pit_devs[0].data, 1);
|
||||
}
|
||||
|
||||
if (!new_out)
|
||||
picintc(1);
|
||||
}
|
||||
|
||||
static const device_config_t pcjr_config[] = {
|
||||
{
|
||||
.name = "display_type",
|
||||
|
||||
@@ -327,7 +327,7 @@ ps1_common_init(const machine_t *model)
|
||||
machine_common_init(model);
|
||||
|
||||
refresh_at_enable = 1;
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_at);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_at);
|
||||
|
||||
dma16_init();
|
||||
pic2_init();
|
||||
|
||||
@@ -190,7 +190,7 @@ ps2_isa_common_init(const machine_t *model)
|
||||
machine_common_init(model);
|
||||
|
||||
refresh_at_enable = 1;
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_at);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_at);
|
||||
|
||||
dma16_init();
|
||||
pic2_init();
|
||||
|
||||
@@ -1363,7 +1363,8 @@ machine_ps2_common_init(const machine_t *model)
|
||||
device_add(&ps_no_nmi_nvr_device);
|
||||
pic2_init();
|
||||
|
||||
pit_ps2_init();
|
||||
int pit_type = ((pit_mode == -1 && is486) || pit_mode == 1) ? PIT_8254_FAST : PIT_8254;
|
||||
pit_ps2_init(pit_type);
|
||||
|
||||
nmi_mask = 0x80;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ machine_xt_common_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
if (fdc_type == FDC_INTERNAL)
|
||||
device_add(&fdc_xt_device);
|
||||
|
||||
@@ -50,7 +50,7 @@ machine_xt_compaq_deskpro_init(const machine_t *model)
|
||||
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
device_add(&keyboard_xt_compaq_device);
|
||||
if (fdc_type == FDC_INTERNAL)
|
||||
@@ -78,7 +78,7 @@ machine_xt_compaq_portable_init(const machine_t *model)
|
||||
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
device_add(&keyboard_xt_compaq_device);
|
||||
if (fdc_type == FDC_INTERNAL)
|
||||
|
||||
@@ -167,7 +167,7 @@ machine_xt_lxt3_init(const machine_t *model)
|
||||
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
device_add(&keyboard_xt_lxt3_device);
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ m24_kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
speaker_enable = val & 2;
|
||||
if (speaker_enable)
|
||||
was_speaker_enable = 1;
|
||||
pit_ctr_set_gate(&pit->counters[2], val & 1);
|
||||
pit_devs[0].set_gate(pit_devs[0].data, 2, val & 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -792,7 +792,7 @@ machine_xt_m240_init(const machine_t *model)
|
||||
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
/* Address 66-67 = mainboard dip-switch settings */
|
||||
io_sethandler(0x0066, 2, m24_read, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
@@ -846,7 +846,7 @@ machine_xt_m19_init(const machine_t *model)
|
||||
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
/* On-board FDC cannot be disabled */
|
||||
device_add(&fdc_xt_device);
|
||||
|
||||
@@ -152,7 +152,7 @@ machine_xt_philips_common_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
nmi_init();
|
||||
|
||||
|
||||
@@ -911,7 +911,7 @@ machine_xt_t1000_init(const machine_t *model)
|
||||
|
||||
machine_common_init(model);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
device_add(&keyboard_xt_device);
|
||||
t1000.fdc = device_add(&fdc_xt_device);
|
||||
nmi_init();
|
||||
@@ -979,7 +979,7 @@ machine_xt_t1200_init(const machine_t *model)
|
||||
write_t1200_nvram, NULL, NULL,
|
||||
NULL, MEM_MAPPING_EXTERNAL, &t1000);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
device_add(&keyboard_xt_device);
|
||||
t1000.fdc = device_add(&fdc_xt_t1x00_device);
|
||||
nmi_init();
|
||||
|
||||
@@ -122,7 +122,7 @@ machine_zenith_init(const machine_t *model){
|
||||
|
||||
device_add(&zenith_scratchpad_device);
|
||||
|
||||
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
|
||||
pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt);
|
||||
|
||||
device_add(&keyboard_xt_zenith_device);
|
||||
|
||||
|
||||
@@ -161,6 +161,16 @@ machine_available(int m)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pit_irq0_timer(int new_out, int old_out)
|
||||
{
|
||||
if (new_out && !old_out)
|
||||
picint(1);
|
||||
|
||||
if (!new_out)
|
||||
picintc(1);
|
||||
}
|
||||
|
||||
void
|
||||
machine_common_init(const machine_t *model)
|
||||
{
|
||||
@@ -168,5 +178,10 @@ machine_common_init(const machine_t *model)
|
||||
pic_init();
|
||||
dma_init();
|
||||
|
||||
pit_common_init(!!IS_AT(machine), pit_irq0_timer, NULL);
|
||||
int pit_type = IS_AT(machine) ? PIT_8254 : PIT_8253;
|
||||
/* Select fast PIT if needed */
|
||||
if ((pit_mode == -1 && is486) || pit_mode == 1)
|
||||
pit_type += 2;
|
||||
|
||||
pit_common_init(pit_type, pit_irq0_timer, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user