IDE fixes and finished the SiS 5511.

This commit is contained in:
OBattler
2023-10-20 02:57:50 +02:00
parent 5c4429e4ec
commit 88934ab0ca
24 changed files with 844 additions and 480 deletions

View File

@@ -637,6 +637,41 @@ pit_write(uint16_t addr, uint8_t val, void *priv)
extern uint8_t *ram;
uint8_t
pit_read_reg(void *priv, uint8_t reg)
{
pit_t *dev = (pit_t *) priv;
uint8_t ret = 0xff;
switch (reg) {
case 0x00:
case 0x02:
case 0x04:
ret = dev->counters[reg >> 1].l & 0xff;
break;
case 0x01:
case 0x03:
case 0x05:
ret = (dev->counters[reg >> 1].l >> 8) & 0xff;
break;
case 0x06:
ret = dev->ctrl;
break;
case 0x07:
/* The SiS 551x datasheet is unclear about how exactly
this register is structured. */
ret = (dev->counters[0].rm & 0x80) ? 0x01 : 0x00;
ret = (dev->counters[0].wm & 0x80) ? 0x02 : 0x00;
ret = (dev->counters[1].rm & 0x80) ? 0x04 : 0x00;
ret = (dev->counters[1].wm & 0x80) ? 0x08 : 0x00;
ret = (dev->counters[2].rm & 0x80) ? 0x10 : 0x00;
ret = (dev->counters[2].wm & 0x80) ? 0x20 : 0x00;
break;
}
return ret;
}
static uint8_t
pit_read(uint16_t addr, void *priv)
{
@@ -852,7 +887,7 @@ pit_init(const device_t *info)
const device_t i8253_device = {
.name = "Intel 8253/8253-5 Programmable Interval Timer",
.internal_name = "i8253",
.flags = DEVICE_ISA,
.flags = DEVICE_ISA | DEVICE_PIT,
.local = PIT_8253,
.init = pit_init,
.close = pit_close,
@@ -866,7 +901,7 @@ const device_t i8253_device = {
const device_t i8254_device = {
.name = "Intel 8254 Programmable Interval Timer",
.internal_name = "i8254",
.flags = DEVICE_ISA,
.flags = DEVICE_ISA | DEVICE_PIT,
.local = PIT_8254,
.init = pit_init,
.close = pit_close,
@@ -1126,4 +1161,4 @@ const pit_intf_t pit_classic_intf = {
&pit_ctr_set_load_func,
&ctr_clock,
NULL,
};
};