#include "comedi_fc.h"
-#define PARPORT_SIZE 3
-
-#define PARPORT_A 0
-#define PARPORT_B 1
-#define PARPORT_C 2
+/*
+ * Register map
+ */
+#define PARPORT_DATA_REG 0x00
+#define PARPORT_STATUS_REG 0x01
+#define PARPORT_CTRL_REG 0x02
+#define PARPORT_CTRL_IRQ_ENA (1 << 4)
+#define PARPORT_CTRL_BIDIR_ENA (1 << 5)
struct parport_private {
unsigned int a_data;
devpriv->a_data &= ~data[0];
devpriv->a_data |= (data[0] & data[1]);
- outb(devpriv->a_data, dev->iobase + PARPORT_A);
+ outb(devpriv->a_data, dev->iobase + PARPORT_DATA_REG);
}
- data[1] = inb(dev->iobase + PARPORT_A);
+ data[1] = inb(dev->iobase + PARPORT_DATA_REG);
return insn->n;
}
if (data[0]) {
s->io_bits = 0xff;
- devpriv->c_data &= ~(1 << 5);
+ devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA;
} else {
s->io_bits = 0;
- devpriv->c_data |= (1 << 5);
+ devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA;
}
- outb(devpriv->c_data, dev->iobase + PARPORT_C);
+ outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
return 1;
}
/* anyone??? */
}
- data[1] = (inb(dev->iobase + PARPORT_B) >> 3);
+ data[1] = (inb(dev->iobase + PARPORT_STATUS_REG) >> 3);
return insn->n;
}
devpriv->c_data &= ~data[0];
devpriv->c_data |= (data[0] & data[1]);
- outb(devpriv->c_data, dev->iobase + PARPORT_C);
+ outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
}
data[1] = devpriv->c_data & 0xf;
{
struct parport_private *devpriv = dev->private;
- devpriv->c_data |= 0x10;
- outb(devpriv->c_data, dev->iobase + PARPORT_C);
+ devpriv->c_data |= PARPORT_CTRL_IRQ_ENA;
+ outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
devpriv->enable_irq = 1;
{
struct parport_private *devpriv = dev->private;
- devpriv->c_data &= ~0x10;
- outb(devpriv->c_data, dev->iobase + PARPORT_C);
+ devpriv->c_data &= ~PARPORT_CTRL_IRQ_ENA;
+ outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
devpriv->enable_irq = 0;
unsigned int irq;
int ret;
- ret = comedi_request_region(dev, it->options[0], PARPORT_SIZE);
+ ret = comedi_request_region(dev, it->options[0], 0x03);
if (ret)
return ret;
}
devpriv->a_data = 0;
- outb(devpriv->a_data, dev->iobase + PARPORT_A);
+ outb(devpriv->a_data, dev->iobase + PARPORT_DATA_REG);
devpriv->c_data = 0;
- outb(devpriv->c_data, dev->iobase + PARPORT_C);
+ outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
return 0;
}