Fixed LPT ECP operation and UM8669F IRQ and DMA assigning, fixes Windows 95 printing.

This commit is contained in:
OBattler
2025-08-28 14:42:57 +02:00
parent 3d6ec72f77
commit a680f20c33
10 changed files with 8 additions and 70 deletions

View File

@@ -341,7 +341,6 @@ const lpt_device_t lpt_hasp_savquest_device = {
.close = hasp_close,
.write_data = hasp_write_data,
.write_ctrl = NULL,
.autofeed = NULL,
.strobe = NULL,
.read_status = hasp_read_status,
.read_ctrl = NULL,

View File

@@ -222,15 +222,6 @@ lpt_ecp_update_irq(lpt_t *dev)
picintclevel(1 << dev->irq, &dev->irq_state);
}
static void
lpt_autofeed(lpt_t *dev, const uint8_t val)
{
if (dev->dt && dev->dt->autofeed && dev->dt->priv)
dev->dt->autofeed(val, dev->dt->priv);
dev->autofeed = val;
}
static void
lpt_strobe(lpt_t *dev, const uint8_t val)
{
@@ -258,8 +249,6 @@ lpt_fifo_out_callback(void *priv)
else
ret = dma_channel_read(dev->dma);
lpt_log("DMA %02X: %08X\n", dev->dma, ret);
if (ret != DMA_NODATA) {
fifo_write_evt_tagged(0x01, (uint8_t) (ret & 0xff), dev->fifo);
@@ -299,7 +288,6 @@ lpt_fifo_out_callback(void *priv)
dev->dma_stat = 0x04;
dev->state = LPT_STATE_IDLE;
lpt_ecp_update_irq(dev);
lpt_autofeed(dev, 0);
} else {
dev->state = LPT_STATE_READ_DMA;
@@ -312,8 +300,6 @@ lpt_fifo_out_callback(void *priv)
} else if (!fifo_get_empty(dev->fifo))
timer_advance_u64(&dev->fifo_out_timer,
(uint64_t) ((1000000.0 / 2500000.0) * (double) TIMER_USEC));
else
lpt_autofeed(dev, 0);
break;
}
}
@@ -354,13 +340,11 @@ lpt_write(const uint16_t port, const uint8_t val, void *priv)
break;
case 0x0002:
if (dev->dt && dev->dt->write_ctrl && dev->dt->priv) {
if (dev->ecp && ((dev->ecr & 0xe0) >= 0x20))
dev->dt->write_ctrl((val & 0xfc) | dev->autofeed | dev->strobe, dev->dt->priv);
else
dev->dt->write_ctrl(val, dev->dt->priv);
}
if (dev->dt && dev->dt->write_ctrl && dev->dt->priv)
dev->dt->write_ctrl(val, dev->dt->priv);
dev->ctrl = val;
dev->strobe = val & 0x01;
dev->autofeed = val & 0x02;
dev->enable_irq = val & 0x10;
if (!(val & 0x10) && (dev->irq != 0xff))
picintc(1 << dev->irq);
@@ -430,11 +414,6 @@ lpt_write(const uint16_t port, const uint8_t val, void *priv)
break;
case 0x0402: case 0x0406:
if (!(val & 0x0c))
lpt_autofeed(dev, 0x00);
else
lpt_autofeed(dev, 0x02);
if ((dev->ecr & 0x04) && !(val & 0x04)) {
dev->dma_stat = 0x00;
fifo_reset(dev->fifo);

View File

@@ -25,7 +25,6 @@ typedef struct lpt_device_s {
void (*close)(void *priv);
void (*write_data)(uint8_t val, void *priv);
void (*write_ctrl)(uint8_t val, void *priv);
void (*autofeed)(uint8_t val,void *priv);
void (*strobe)(uint8_t old, uint8_t val,void *priv);
uint8_t (*read_status)(void *priv);
uint8_t (*read_ctrl)(void *priv);

View File

@@ -494,7 +494,6 @@ const lpt_device_t lpt_plip_device = {
.close = plip_close,
.write_data = plip_write_data,
.write_ctrl = plip_write_ctrl,
.autofeed = NULL,
.strobe = NULL,
.read_status = plip_read_status,
.read_ctrl = NULL,

View File

@@ -1884,17 +1884,6 @@ write_data(uint8_t val, void *priv)
dev->data = val;
}
static void
autofeed(uint8_t val, void *priv)
{
escp_t *dev = (escp_t *) priv;
if (dev == NULL)
return;
dev->autofeed = ((val & 0x02) > 0);
}
static void
strobe(uint8_t old, uint8_t val, void *priv)
{
@@ -2147,7 +2136,6 @@ const lpt_device_t lpt_prt_escp_device = {
.close = escp_close,
.write_data = write_data,
.write_ctrl = write_ctrl,
.autofeed = autofeed,
.strobe = strobe,
.read_status = read_status,
.read_ctrl = read_ctrl,

View File

@@ -322,17 +322,6 @@ process_data(ps_t *dev)
dev->buffer[dev->buffer_pos] = 0;
}
static void
ps_autofeed(uint8_t val, void *priv)
{
ps_t *dev = (ps_t *) priv;
if (dev == NULL)
return;
dev->autofeed = val & 0x02 ? true : false;
}
static void
ps_strobe(uint8_t old, uint8_t val, void *priv)
{
@@ -533,7 +522,6 @@ const lpt_device_t lpt_prt_ps_device = {
.close = ps_close,
.write_data = ps_write_data,
.write_ctrl = ps_write_ctrl,
.autofeed = ps_autofeed,
.strobe = ps_strobe,
.read_status = ps_read_status,
.read_ctrl = NULL,
@@ -551,7 +539,6 @@ const lpt_device_t lpt_prt_pcl_device = {
.close = ps_close,
.write_data = ps_write_data,
.write_ctrl = ps_write_ctrl,
.autofeed = ps_autofeed,
.strobe = ps_strobe,
.read_status = ps_read_status,
.read_ctrl = NULL,

View File

@@ -369,18 +369,6 @@ write_data(uint8_t val, void *priv)
dev->data = val;
}
static void
autofeed(uint8_t val, void *priv)
{
prnt_t *dev = (prnt_t *) priv;
if (dev == NULL)
return;
/* set autofeed value */
dev->autofeed = val & 0x02 ? 1 : 0;
}
static void
strobe(uint8_t old, uint8_t val, void *priv)
{
@@ -418,7 +406,7 @@ write_ctrl(uint8_t val, void *priv)
return;
/* set autofeed value */
dev->autofeed = val & 0x02 ? 1 : 0;
dev->autofeed = (val & 0x02) ? 1 : 0;
if (val & 0x08) { /* SELECT */
/* select printer */
@@ -562,7 +550,6 @@ const lpt_device_t lpt_prt_text_device = {
.close = prnt_close,
.write_data = write_data,
.write_ctrl = write_ctrl,
.autofeed = autofeed,
.strobe = strobe,
.read_status = read_status,
.read_ctrl = NULL,

View File

@@ -209,6 +209,9 @@ um8669f_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pri
if (config->activate && (config->io[0].base != ISAPNP_IO_DISABLED)) {
um8669f_log("UM8669F: LPT enabled at port %04X IRQ %d\n", config->io[0].base, config->irq[0].irq);
lpt_port_setup(dev->lpt, config->io[0].base);
lpt_port_irq(dev->lpt, config->irq[0].irq);
lpt_port_dma(dev->lpt, (config->dma[0].dma == ISAPNP_DMA_DISABLED) ? -1 : config->dma[0].dma);
} else {
um8669f_log("UM8669F: LPT disabled\n");
}

View File

@@ -124,7 +124,6 @@ const lpt_device_t lpt_dac_device = {
.close = dac_close,
.write_data = dac_write_data,
.write_ctrl = dac_write_ctrl,
.autofeed = NULL,
.strobe = dac_strobe,
.read_status = dac_read_status,
.read_ctrl = NULL,
@@ -141,7 +140,6 @@ const lpt_device_t lpt_dac_stereo_device = {
.close = dac_close,
.write_data = dac_write_data,
.write_ctrl = dac_write_ctrl,
.autofeed = NULL,
.strobe = dac_strobe,
.read_status = dac_read_status,
.read_ctrl = NULL,

View File

@@ -139,7 +139,6 @@ const lpt_device_t dss_device = {
.init = dss_init,
.close = dss_close,
.write_data = dss_write_data,
.autofeed = NULL,
.strobe = NULL,
.write_ctrl = dss_write_ctrl,
.read_status = dss_read_status,