LPT ECP/EPP support

Co-Authored-By: Miran Grča <oubattler@gmail.com>
This commit is contained in:
Jasmine Iwanek
2025-06-24 01:23:32 -04:00
parent 6a8eaf507c
commit 58aa261273
13 changed files with 1161 additions and 392 deletions

View File

@@ -319,6 +319,35 @@ 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)
{
ps_t *dev = (ps_t *) priv;
if (dev == NULL)
return;
if (!(val & 0x01) && (old & 0x01)) {
process_data(dev);
dev->ack = true;
timer_set_delay_u64(&dev->pulse_timer, ISACONST);
timer_set_delay_u64(&dev->timeout_timer, 5000000 * TIMER_USEC);
}
}
static void
ps_write_ctrl(uint8_t val, void *priv)
{
@@ -479,27 +508,33 @@ ps_close(void *priv)
}
const lpt_device_t lpt_prt_ps_device = {
.name = "Generic PostScript Printer",
.internal_name = "postscript",
.init = ps_init,
.close = ps_close,
.write_data = ps_write_data,
.write_ctrl = ps_write_ctrl,
.read_data = NULL,
.read_status = ps_read_status,
.read_ctrl = NULL
.name = "Generic PostScript Printer",
.internal_name = "postscript",
.init = ps_init,
.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,
.epp_write_data = NULL,
.epp_request_read = NULL
};
#ifdef USE_PCL
const lpt_device_t lpt_prt_pcl_device = {
.name = "Generic PCL5e Printer",
.internal_name = "pcl",
.init = pcl_init,
.close = ps_close,
.write_data = ps_write_data,
.write_ctrl = ps_write_ctrl,
.read_data = NULL,
.read_status = ps_read_status,
.read_ctrl = NULL
.name = "Generic PCL5e Printer",
.internal_name = "pcl",
.init = pcl_init,
.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,
.epp_write_data = NULL,
.epp_request_read = NULL
};
#endif