Temporary changes to make merger possible.
This commit is contained in:
@@ -93,27 +93,22 @@ ps2_write(uint8_t val, void *priv)
|
||||
mouse_t *dev = (mouse_t *)priv;
|
||||
uint8_t temp;
|
||||
|
||||
pclog("ps2_write(%02X)\n", val);
|
||||
|
||||
if (dev->flags & FLAG_CTRLDAT) {
|
||||
dev->flags &= ~FLAG_CTRLDAT;
|
||||
|
||||
if (val == 0xff)
|
||||
goto mouse_reset;
|
||||
|
||||
switch (dev->command) {
|
||||
case 0xe8: /* set mouse resolution */
|
||||
dev->resolution = val;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
break;
|
||||
|
||||
case 0xf3: /* set sample rate */
|
||||
dev->sample_rate = val;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa); /* Command response */
|
||||
keyboard_at_adddata_mouse(0xfa); /* Command response */
|
||||
break;
|
||||
|
||||
default:
|
||||
keyboard_at_adddata_mouse_cmd(0xfc);
|
||||
keyboard_at_adddata_mouse(0xfc);
|
||||
}
|
||||
} else {
|
||||
dev->command = val;
|
||||
@@ -121,21 +116,21 @@ ps2_write(uint8_t val, void *priv)
|
||||
switch (dev->command) {
|
||||
case 0xe6: /* set scaling to 1:1 */
|
||||
dev->flags &= ~FLAG_SCALED;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
break;
|
||||
|
||||
case 0xe7: /* set scaling to 2:1 */
|
||||
dev->flags |= FLAG_SCALED;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
break;
|
||||
|
||||
case 0xe8: /* set mouse resolution */
|
||||
dev->flags |= FLAG_CTRLDAT;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
break;
|
||||
|
||||
case 0xe9: /* status request */
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
temp = (dev->flags & 0x30);
|
||||
if (mouse_buttons & 0x01)
|
||||
temp |= 0x01;
|
||||
@@ -143,13 +138,13 @@ ps2_write(uint8_t val, void *priv)
|
||||
temp |= 0x02;
|
||||
if (mouse_buttons & 0x04)
|
||||
temp |= 0x03;
|
||||
keyboard_at_adddata_mouse_cmd(temp);
|
||||
keyboard_at_adddata_mouse_cmd(dev->resolution);
|
||||
keyboard_at_adddata_mouse_cmd(dev->sample_rate);
|
||||
keyboard_at_adddata_mouse(temp);
|
||||
keyboard_at_adddata_mouse(dev->resolution);
|
||||
keyboard_at_adddata_mouse(dev->sample_rate);
|
||||
break;
|
||||
|
||||
case 0xeb: /* Get mouse data */
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
|
||||
temp = 0;
|
||||
if (dev->x < 0)
|
||||
@@ -162,54 +157,53 @@ ps2_write(uint8_t val, void *priv)
|
||||
temp |= 2;
|
||||
if ((mouse_buttons & 4) && (dev->flags & FLAG_INTELLI))
|
||||
temp |= 4;
|
||||
keyboard_at_adddata_mouse_cmd(temp);
|
||||
keyboard_at_adddata_mouse_cmd(dev->x & 0xff);
|
||||
keyboard_at_adddata_mouse_cmd(dev->y & 0xff);
|
||||
keyboard_at_adddata_mouse(temp);
|
||||
keyboard_at_adddata_mouse(dev->x & 0xff);
|
||||
keyboard_at_adddata_mouse(dev->y & 0xff);
|
||||
if (dev->flags & FLAG_INTMODE)
|
||||
keyboard_at_adddata_mouse_cmd(dev->z);
|
||||
keyboard_at_adddata_mouse(dev->z);
|
||||
break;
|
||||
|
||||
case 0xf2: /* read ID */
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
if (dev->flags & FLAG_INTMODE)
|
||||
keyboard_at_adddata_mouse_cmd(0x03);
|
||||
keyboard_at_adddata_mouse(0x03);
|
||||
else
|
||||
keyboard_at_adddata_mouse_cmd(0x00);
|
||||
keyboard_at_adddata_mouse(0x00);
|
||||
break;
|
||||
|
||||
case 0xf3: /* set command mode */
|
||||
dev->flags |= FLAG_CTRLDAT;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa); /* ACK for command byte */
|
||||
keyboard_at_adddata_mouse(0xfa); /* ACK for command byte */
|
||||
break;
|
||||
|
||||
case 0xf4: /* enable */
|
||||
dev->flags |= FLAG_ENABLED;
|
||||
mouse_scan = 1;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
break;
|
||||
|
||||
case 0xf5: /* disable */
|
||||
dev->flags &= ~FLAG_ENABLED;
|
||||
mouse_scan = 0;
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
break;
|
||||
|
||||
case 0xf6: /* set defaults */
|
||||
case 0xff: /* reset */
|
||||
mouse_reset:
|
||||
dev->mode = MODE_STREAM;
|
||||
dev->flags &= 0x88;
|
||||
mouse_scan = 1;
|
||||
mouse_scan = 0;
|
||||
keyboard_at_mouse_reset();
|
||||
keyboard_at_adddata_mouse_cmd(0xfa);
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
if (dev->command == 0xff) {
|
||||
keyboard_at_adddata_mouse_cmd(0xaa);
|
||||
keyboard_at_adddata_mouse_cmd(0x00);
|
||||
keyboard_at_adddata_mouse(0xaa);
|
||||
keyboard_at_adddata_mouse(0x00);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
keyboard_at_adddata_mouse_cmd(0xfe);
|
||||
keyboard_at_adddata_mouse(0xfe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,9 +235,6 @@ ps2_poll(int x, int y, int z, int b, void *priv)
|
||||
return(0xff);
|
||||
#endif
|
||||
|
||||
if ((keyboard_at_fixed_channel() & 0xf00) == 0x200)
|
||||
return(0xff);
|
||||
|
||||
if (!mouse_scan)
|
||||
return(0xff);
|
||||
|
||||
|
@@ -370,49 +370,32 @@ void
|
||||
sff_bus_master_set_irq(int channel, void *priv)
|
||||
{
|
||||
sff8038i_t *dev = (sff8038i_t *) priv;
|
||||
dev->status &= ~0x04;
|
||||
dev->status |= (channel >> 4);
|
||||
if (!(dev->status & 0x04) || (channel & 0x40)) {
|
||||
dev->status &= ~4;
|
||||
dev->status |= (channel >> 4);
|
||||
}
|
||||
|
||||
channel &= 0x01;
|
||||
|
||||
switch (dev->irq_mode[channel]) {
|
||||
case 0:
|
||||
default:
|
||||
/* Legacy IRQ mode. */
|
||||
if (dev->status & 0x04)
|
||||
picint(1 << (14 + channel));
|
||||
else
|
||||
picintc(1 << (14 + channel));
|
||||
break;
|
||||
case 1:
|
||||
/* Native PCI IRQ mode with interrupt pin. */
|
||||
if (dev->status & 0x04)
|
||||
pci_set_irq(dev->slot, dev->irq_pin);
|
||||
else
|
||||
pci_clear_irq(dev->slot, dev->irq_pin);
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
/* MIRQ 0 or 1. */
|
||||
if (dev->status & 0x04)
|
||||
pci_set_mirq(dev->irq_mode[channel] & 1, 0);
|
||||
else
|
||||
pci_clear_mirq(dev->irq_mode[channel] & 1, 0);
|
||||
break;
|
||||
case 3:
|
||||
/* Native PCI IRQ mode with specified interrupt line. */
|
||||
if (dev->status & 0x04)
|
||||
picintlevel(1 << dev->irq_line);
|
||||
else
|
||||
picintc(1 << dev->irq_line);
|
||||
break;
|
||||
case 4:
|
||||
/* ALi Aladdin Native PCI INTAJ mode. */
|
||||
if (dev->status & 0x04)
|
||||
pci_set_mirq(channel + 2, dev->irq_level[channel]);
|
||||
else
|
||||
pci_clear_mirq(channel + 2, dev->irq_level[channel]);
|
||||
break;
|
||||
if (dev->status & 0x04) {
|
||||
sff_log("SFF8038i: Channel %i IRQ raise\n", channel);
|
||||
if (dev->irq_mode[channel] == 3)
|
||||
picintlevel(1 << dev->irq_line);
|
||||
else if ((dev->irq_mode[channel] == 2) && channel && pci_use_mirq(0))
|
||||
pci_set_mirq(0, 0);
|
||||
else if (dev->irq_mode[channel] == 1)
|
||||
pci_set_irq(dev->slot, dev->irq_pin);
|
||||
else
|
||||
picint(1 << (14 + channel));
|
||||
} else {
|
||||
sff_log("SFF8038i: Channel %i IRQ lower\n", channel);
|
||||
if (dev->irq_mode[channel] == 3)
|
||||
picintc(1 << dev->irq_line);
|
||||
else if ((dev->irq_mode[channel] == 2) && channel && pci_use_mirq(0))
|
||||
pci_clear_mirq(0, 0);
|
||||
else if (dev->irq_mode[channel] == 1)
|
||||
pci_clear_irq(dev->slot, dev->irq_pin);
|
||||
else
|
||||
picintc(1 << (14 + channel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,42 +468,10 @@ sff_set_irq_line(sff8038i_t *dev, int irq_line)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sff_set_irq_level(sff8038i_t *dev, int channel, int irq_level)
|
||||
{
|
||||
dev->irq_level[channel] = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sff_set_irq_mode(sff8038i_t *dev, int channel, int irq_mode)
|
||||
{
|
||||
dev->irq_mode[channel] = irq_mode;
|
||||
|
||||
switch (dev->irq_mode[channel]) {
|
||||
case 0:
|
||||
default:
|
||||
/* Legacy IRQ mode. */
|
||||
sff_log("[%08X] Setting channel %i to legacy IRQ %i\n", dev, channel, 14 + channel);
|
||||
break;
|
||||
case 1:
|
||||
/* Native PCI IRQ mode with interrupt pin. */
|
||||
sff_log("[%08X] Setting channel %i to native PCI INT%c\n", dev, channel, '@' + dev->irq_pin);
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
/* MIRQ 0 or 1. */
|
||||
sff_log("[%08X] Setting channel %i to PCI MIRQ%i\n", dev, channel, irq_mode & 1);
|
||||
break;
|
||||
case 3:
|
||||
/* Native PCI IRQ mode with specified interrupt line. */
|
||||
sff_log("[%08X] Setting channel %i to native PCI IRQ %i\n", dev, channel, dev->irq_line);
|
||||
break;
|
||||
case 4:
|
||||
/* ALi Aladdin Native PCI INTAJ mode. */
|
||||
sff_log("[%08X] Setting channel %i to INT%cJ\n", dev, channel, 'A' + channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -557,11 +508,9 @@ static void
|
||||
ide_set_bus_master(next_id, sff_bus_master_dma, sff_bus_master_set_irq, dev);
|
||||
|
||||
dev->slot = 7;
|
||||
dev->irq_mode[0] = 0; /* Channel 0 goes to IRQ 14. */
|
||||
dev->irq_mode[1] = 2; /* Channel 1 goes to MIRQ0. */
|
||||
dev->irq_mode[0] = dev->irq_mode[1] = 2;
|
||||
dev->irq_pin = PCI_INTA;
|
||||
dev->irq_line = 14;
|
||||
dev->irq_level[0] = dev->irq_level[1] = 0;
|
||||
|
||||
next_id++;
|
||||
|
||||
|
Reference in New Issue
Block a user