Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186746
b: refs/heads/master
c: 0acc516
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Adolphi authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent 25bc7b6 commit ed886f0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 51 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3c796fd57f33a20b2ca968e0e449382397c8dba
refs/heads/master: 0acc516aee7b1527ad125a53deff328ef29be9e6
89 changes: 39 additions & 50 deletions trunk/drivers/staging/comedi/drivers/dt2815.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ Configuration options:
[0] - I/O port base base address
[1] - IRQ (unused)
[2] - Voltage unipolar/bipolar configuration
0 == unipolar 5V (0V -- +5V)
1 == bipolar 5V (-5V -- +5V)
0 == unipolar 5V (0V -- +5V)
1 == bipolar 5V (-5V -- +5V)
[3] - Current offset configuration
0 == disabled (0mA -- +32mAV)
1 == enabled (+4mA -- +20mAV)
0 == disabled (0mA -- +32mAV)
1 == enabled (+4mA -- +20mAV)
[4] - Firmware program configuration
0 == program 1 (see manual table 5-4)
1 == program 2 (see manual table 5-4)
2 == program 3 (see manual table 5-4)
3 == program 4 (see manual table 5-4)
0 == program 1 (see manual table 5-4)
1 == program 2 (see manual table 5-4)
2 == program 3 (see manual table 5-4)
3 == program 4 (see manual table 5-4)
[5] - Analog output 0 range configuration
0 == voltage
1 == current
0 == voltage
1 == current
[6] - Analog output 1 range configuration (same options)
[7] - Analog output 2 range configuration (same options)
[8] - Analog output 3 range configuration (same options)
Expand All @@ -61,17 +61,11 @@ Configuration options:
#include <linux/ioport.h>
#include <linux/delay.h>

static const struct comedi_lrange range_dt2815_ao_32_current = { 1, {
RANGE_mA(0,
32)
}
};
static const struct comedi_lrange
range_dt2815_ao_32_current = {1, {RANGE_mA(0, 32)} };

static const struct comedi_lrange range_dt2815_ao_20_current = { 1, {
RANGE_mA(4,
20)
}
};
static const struct comedi_lrange
range_dt2815_ao_20_current = {1, {RANGE_mA(4, 20)} };

#define DT2815_SIZE 2

Expand Down Expand Up @@ -118,9 +112,8 @@ static int dt2815_ao_insn_read(struct comedi_device *dev,
int i;
int chan = CR_CHAN(insn->chanspec);

for (i = 0; i < insn->n; i++) {
for (i = 0; i < insn->n; i++)
data[i] = devpriv->ao_readback[chan];
}

return i;
}
Expand All @@ -139,19 +132,17 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,

status = dt2815_wait_for_status(dev, 0x00);
if (status != 0) {
printk
("dt2815: failed to write low byte on %d reason %x\n",
chan, status);
printk(KERN_WARNING "dt2815: failed to write low byte "
"on %d reason %x\n", chan, status);
return -EBUSY;
}

outb(lo, dev->iobase + DT2815_DATA);

status = dt2815_wait_for_status(dev, 0x10);
if (status != 0x10) {
printk
("dt2815: failed to write high byte on %d reason %x\n",
chan, status);
printk(KERN_WARNING "dt2815: failed to write high byte "
"on %d reason %x\n", chan, status);
return -EBUSY;
}
devpriv->ao_readback[chan] = data[i];
Expand All @@ -163,24 +154,24 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
options[0] Board base address
options[1] IRQ (not applicable)
options[2] Voltage unipolar/bipolar configuration
0 == unipolar 5V (0V -- +5V)
1 == bipolar 5V (-5V -- +5V)
0 == unipolar 5V (0V -- +5V)
1 == bipolar 5V (-5V -- +5V)
options[3] Current offset configuration
0 == disabled (0mA -- +32mAV)
1 == enabled (+4mA -- +20mAV)
0 == disabled (0mA -- +32mAV)
1 == enabled (+4mA -- +20mAV)
options[4] Firmware program configuration
0 == program 1 (see manual table 5-4)
1 == program 2 (see manual table 5-4)
2 == program 3 (see manual table 5-4)
3 == program 4 (see manual table 5-4)
0 == program 1 (see manual table 5-4)
1 == program 2 (see manual table 5-4)
2 == program 3 (see manual table 5-4)
3 == program 4 (see manual table 5-4)
options[5] Analog output 0 range configuration
0 == voltage
1 == current
0 == voltage
1 == current
options[6] Analog output 1 range configuration
...
options[12] Analog output 7 range configuration
0 == voltage
1 == current
0 == voltage
1 == current
*/

static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
Expand All @@ -191,9 +182,9 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
unsigned long iobase;

iobase = it->options[0];
printk("comedi%d: dt2815: 0x%04lx ", dev->minor, iobase);
printk(KERN_INFO "comedi%d: dt2815: 0x%04lx ", dev->minor, iobase);
if (!request_region(iobase, DT2815_SIZE, "dt2815")) {
printk("I/O port conflict\n");
printk(KERN_WARNING "I/O port conflict\n");
return -EIO;
}

Expand Down Expand Up @@ -236,19 +227,17 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
unsigned int program;
program = (it->options[4] & 0x3) << 3 | 0x7;
outb(program, dev->iobase + DT2815_DATA);
printk(", program: 0x%x (@t=%d)\n", program, i);
printk(KERN_INFO ", program: 0x%x (@t=%d)\n",
program, i);
break;
} else if (status != 0x00) {
printk("dt2815: unexpected status 0x%x (@t=%d)\n",
status, i);
if (status & 0x60) {
printk(KERN_WARNING "dt2815: unexpected status 0x%x "
"(@t=%d)\n", status, i);
if (status & 0x60)
outb(0x00, dev->iobase + DT2815_STATUS);
}
}
}

printk("\n");

return 0;
}

Expand All @@ -260,7 +249,7 @@ static void dt2815_free_resources(struct comedi_device *dev)

static int dt2815_detach(struct comedi_device *dev)
{
printk("comedi%d: dt2815: remove\n", dev->minor);
printk(KERN_INFO "comedi%d: dt2815: remove\n", dev->minor);

dt2815_free_resources(dev);

Expand Down

0 comments on commit ed886f0

Please sign in to comment.