|
@@ -121,25 +121,22 @@ static int compute_buffer(int config, int devno, struct comedi_subdevice *s)
|
|
|
{
|
|
|
/* 1 in io_bits indicates output */
|
|
|
if (s->io_bits & 0x0000ff) {
|
|
|
- if (devno == 0) {
|
|
|
+ if (devno == 0)
|
|
|
config |= BUF_A0;
|
|
|
- } else {
|
|
|
+ else
|
|
|
config |= BUF_A1;
|
|
|
- }
|
|
|
}
|
|
|
if (s->io_bits & 0x00ff00) {
|
|
|
- if (devno == 0) {
|
|
|
+ if (devno == 0)
|
|
|
config |= BUF_B0;
|
|
|
- } else {
|
|
|
+ else
|
|
|
config |= BUF_B1;
|
|
|
- }
|
|
|
}
|
|
|
if (s->io_bits & 0xff0000) {
|
|
|
- if (devno == 0) {
|
|
|
+ if (devno == 0)
|
|
|
config |= BUF_C0;
|
|
|
- } else {
|
|
|
+ else
|
|
|
config |= BUF_C1;
|
|
|
- }
|
|
|
}
|
|
|
return config;
|
|
|
}
|
|
@@ -155,26 +152,27 @@ static void do_3724_config(struct comedi_device *dev,
|
|
|
buffer_config = 0;
|
|
|
|
|
|
/* 1 in io_bits indicates output, 1 in config indicates input */
|
|
|
- if (!(s->io_bits & 0x0000ff)) {
|
|
|
+ if (!(s->io_bits & 0x0000ff))
|
|
|
config |= CR_A_IO;
|
|
|
- }
|
|
|
- if (!(s->io_bits & 0x00ff00)) {
|
|
|
+
|
|
|
+ if (!(s->io_bits & 0x00ff00))
|
|
|
config |= CR_B_IO;
|
|
|
- }
|
|
|
- if (!(s->io_bits & 0xff0000)) {
|
|
|
+
|
|
|
+ if (!(s->io_bits & 0xff0000))
|
|
|
config |= CR_C_IO;
|
|
|
- }
|
|
|
|
|
|
buffer_config = compute_buffer(0, 0, dev->subdevices);
|
|
|
buffer_config = compute_buffer(buffer_config, 1, (dev->subdevices) + 1);
|
|
|
|
|
|
- if (s == dev->subdevices) {
|
|
|
+ if (s == dev->subdevices)
|
|
|
port_8255_cfg = dev->iobase + _8255_CR;
|
|
|
- } else {
|
|
|
+ else
|
|
|
port_8255_cfg = dev->iobase + SIZE_8255 + _8255_CR;
|
|
|
- }
|
|
|
+
|
|
|
outb(buffer_config, dev->iobase + 8); /* update buffer register */
|
|
|
- /* printk("pcm3724 buffer_config (%lx) %d, %x\n", dev->iobase + _8255_CR, chanspec, buffer_config); */
|
|
|
+ /* printk("pcm3724 buffer_config (%lx) %d, %x\n",
|
|
|
+ dev->iobase + _8255_CR, chanspec, buffer_config); */
|
|
|
+
|
|
|
outb(config, port_8255_cfg);
|
|
|
}
|
|
|
|
|
@@ -189,29 +187,29 @@ static void enable_chan(struct comedi_device *dev, struct comedi_subdevice *s,
|
|
|
priv = (struct priv_pcm3724 *)(dev->private);
|
|
|
|
|
|
mask = 1 << CR_CHAN(chanspec);
|
|
|
- if (s == dev->subdevices) { /* subdev 0 */
|
|
|
+ if (s == dev->subdevices) /* subdev 0 */
|
|
|
priv->dio_1 |= mask;
|
|
|
- } else { /* subdev 1 */
|
|
|
+ else /* subdev 1 */
|
|
|
priv->dio_2 |= mask;
|
|
|
- }
|
|
|
- if (priv->dio_1 & 0xff0000) {
|
|
|
+
|
|
|
+ if (priv->dio_1 & 0xff0000)
|
|
|
gatecfg |= GATE_C0;
|
|
|
- }
|
|
|
- if (priv->dio_1 & 0xff00) {
|
|
|
+
|
|
|
+ if (priv->dio_1 & 0xff00)
|
|
|
gatecfg |= GATE_B0;
|
|
|
- }
|
|
|
- if (priv->dio_1 & 0xff) {
|
|
|
+
|
|
|
+ if (priv->dio_1 & 0xff)
|
|
|
gatecfg |= GATE_A0;
|
|
|
- }
|
|
|
- if (priv->dio_2 & 0xff0000) {
|
|
|
+
|
|
|
+ if (priv->dio_2 & 0xff0000)
|
|
|
gatecfg |= GATE_C1;
|
|
|
- }
|
|
|
- if (priv->dio_2 & 0xff00) {
|
|
|
+
|
|
|
+ if (priv->dio_2 & 0xff00)
|
|
|
gatecfg |= GATE_B1;
|
|
|
- }
|
|
|
- if (priv->dio_2 & 0xff) {
|
|
|
+
|
|
|
+ if (priv->dio_2 & 0xff)
|
|
|
gatecfg |= GATE_A1;
|
|
|
- }
|
|
|
+
|
|
|
/* printk("gate control %x\n", gatecfg); */
|
|
|
outb(gatecfg, dev->iobase + 9);
|
|
|
}
|
|
@@ -225,15 +223,14 @@ static int subdev_3724_insn_config(struct comedi_device *dev,
|
|
|
unsigned int bits;
|
|
|
|
|
|
mask = 1 << CR_CHAN(insn->chanspec);
|
|
|
- if (mask & 0x0000ff) {
|
|
|
+ if (mask & 0x0000ff)
|
|
|
bits = 0x0000ff;
|
|
|
- } else if (mask & 0x00ff00) {
|
|
|
+ else if (mask & 0x00ff00)
|
|
|
bits = 0x00ff00;
|
|
|
- } else if (mask & 0x0f0000) {
|
|
|
+ else if (mask & 0x0f0000)
|
|
|
bits = 0x0f0000;
|
|
|
- } else {
|
|
|
+ else
|
|
|
bits = 0xf00000;
|
|
|
- }
|
|
|
|
|
|
switch (data[0]) {
|
|
|
case INSN_CONFIG_DIO_INPUT:
|
|
@@ -272,7 +269,7 @@ static int pcm3724_attach(struct comedi_device *dev,
|
|
|
((struct priv_pcm3724 *)(dev->private))->dio_1 = 0;
|
|
|
((struct priv_pcm3724 *)(dev->private))->dio_2 = 0;
|
|
|
|
|
|
- printk("comedi%d: pcm3724: board=%s, 0x%03lx ", dev->minor,
|
|
|
+ printk(KERN_INFO "comedi%d: pcm3724: board=%s, 0x%03lx ", dev->minor,
|
|
|
this_board->name, iobase);
|
|
|
if (!iobase || !request_region(iobase, iorange, "pcm3724")) {
|
|
|
printk("I/O port conflict\n");
|
|
@@ -281,7 +278,7 @@ static int pcm3724_attach(struct comedi_device *dev,
|
|
|
|
|
|
dev->iobase = iobase;
|
|
|
dev->board_name = this_board->name;
|
|
|
- printk("\n");
|
|
|
+ printk(KERN_INFO "\n");
|
|
|
|
|
|
n_subdevices = this_board->numofports;
|
|
|
|
|
@@ -302,13 +299,11 @@ static int pcm3724_detach(struct comedi_device *dev)
|
|
|
int i;
|
|
|
|
|
|
if (dev->subdevices) {
|
|
|
- for (i = 0; i < dev->n_subdevices; i++) {
|
|
|
+ for (i = 0; i < dev->n_subdevices; i++)
|
|
|
subdev_8255_cleanup(dev, dev->subdevices + i);
|
|
|
- }
|
|
|
}
|
|
|
- if (dev->iobase) {
|
|
|
+ if (dev->iobase)
|
|
|
release_region(dev->iobase, this_board->io_range);
|
|
|
- }
|
|
|
|
|
|
return 0;
|
|
|
}
|