/* eek! */
}
-static int timer_ai_mode0(comedi_device *dev,comedi_subdevice *s,comedi_trig *it)
+static int timer_ai_insn_read(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- return comedi_trig_ioctl(devpriv->device,devpriv->subd,it);
+ comedi_insn xinsn = *insn;
+
+ xinsn.data = data;
+ xinsn.subd = depvriv->subd;
+
+ return comedi_insn(devpriv->device,devpriv->subd,insn);
}
static int timer_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd)
s->subdev_flags=SDF_READABLE;
s->n_chan=devpriv->s->n_chan;
s->len_chanlist=1024;
- s->trig[0]=timer_ai_mode0;
- s->trig[2]=timer_ai_mode2;
+ s->insn_read=timer_insn_read;
s->do_cmd=timer_cmd;
s->do_cmdtest=timer_cmdtest;
s->cancel=timer_cancel;
/* native DIO */
static void pci20xxx_dio_config(comedi_device * dev,comedi_subdevice *s);
-static void pci20xxx_do(comedi_device * dev,comedi_subdevice *s);
-static unsigned int pci20xxx_di(comedi_device * dev,comedi_subdevice *s);
-static int pci20xxx_dio(comedi_device *dev,comedi_subdevice *s,comedi_trig *it);
static int pci20xxx_dio_insn_bits(comedi_device *dev,comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data);
+static int pci20xxx_dio_insn_config(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data);
/* initialize pci20xxx_private */
static int pci20xxx_dio_init(comedi_device * dev,comedi_subdevice *s)
s->type = COMEDI_SUBD_DIO;
s->subdev_flags = SDF_READABLE | SDF_WRITEABLE;
s->n_chan = 32;
- s->trig[0] = pci20xxx_dio;
s->insn_bits = pci20xxx_dio_insn_bits;
+ s->insn_config = pci20xxx_dio_insn_config;
s->maxdata = 1;
s->len_chanlist = 32;
s->range_table = &range_digital;
return 0;
}
-static int pci20xxx_dio(comedi_device *dev,comedi_subdevice *s,comedi_trig *it)
+static int pci20xxx_dio_insn_config(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data)
{
- int mask,data_in;
- int i;
-
- if(it->flags & TRIG_CONFIG){
- int bits;
-
- for(i=0;i<it->n_chan;i++){
- mask = 1<<CR_CHAN(it->chanlist[i]);
- if(mask&0x000000ff){
- bits = 0x000000ff;
- }else if(mask & 0x0000ff00){
- bits = 0x0000ff00;
- }else if(mask & 0x00ff0000){
- bits = 0x00ff0000;
- }else {
- bits = 0xff000000;
- }
- if(it->data[i]){
- s->io_bits |= bits;
- }else{
- s->io_bits &= ~bits;
- }
- }
- pci20xxx_dio_config(dev,s);
+ int mask,bits;
+
+ mask = 1<<CR_CHAN(insn->chanspec);
+ if(mask&0x000000ff){
+ bits = 0x000000ff;
+ }else if(mask & 0x0000ff00){
+ bits = 0x0000ff00;
+ }else if(mask & 0x00ff0000){
+ bits = 0x00ff0000;
+ }else {
+ bits = 0xff000000;
+ }
+ if(data[0]){
+ s->io_bits |= bits;
}else{
- if(it->flags&TRIG_WRITE){
- do_pack(&s->state,it);
-
- pci20xxx_do(dev,s);
- }else{
- data_in = pci20xxx_di(dev,s);
-
- di_unpack(data_in,it);
- }
+ s->io_bits &= ~bits;
}
+ pci20xxx_dio_config(dev,s);
- return it->n_chan;
+ return 1;
}
static int pci20xxx_dio_insn_bits(comedi_device *dev,comedi_subdevice *s,
writeb(buffer, dev->iobase + PCI20000_DIO_BUFFER);
}
+#if 0
static void pci20xxx_do(comedi_device * dev, comedi_subdevice * s)
{
/* XXX if the channel is configured for input, does this
return bits;
}
+#endif
COMEDI_INITCLEANUP(driver_pci20xxx);
#ifdef USE_DMA
unsigned int DMAbits;
#endif
-/* void *ai_mode[4];*/
-
} boardtype;
static boardtype boardtypes[] =
//int int13_act_ptr;
int int13_act_scan;
unsigned int chanlist[AI_LEN_CHANLIST];
+ lsampl_t ao_readback[2];
+
} pcl812_private;
#define devpriv ((pcl812_private *)dev->private)
==============================================================================
ANALOG INPUT MODE0, 812pg and 813b card
*/
-static int pcl812_ai_mode0(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
+static int pcl812_ai_insn_read(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- int nmax;
- int i, n, p;
+ int n;
int timeout, hi;
- nmax = devpriv->max_812_ai_mode0_samples; /* block for max cca 1ms (812) */
-
- if ((it->n * it->n_chan) <= nmax)
- nmax = it->n * it->n_chan;
-
- nmax = nmax / it->n_chan;
- if (!nmax)
- nmax++;
-
outb(1, dev->iobase + PCL812_MODE); /* select software trigger */
- p = 0; /* ptr to buff */
-
- for (n = 0; n < nmax; n++) {
- for (i = 0; i < it->n_chan; i++) {
- outb(CR_RANGE(it->chanlist[i]), dev->iobase + PCL812_GAIN); /* select gain */
- udelay(devpriv->max_812_ai_mode0_rangewait);
- outb(CR_CHAN(it->chanlist[i]), dev->iobase + PCL812_MUX); /* select channel */
- udelay(devpriv->max_812_ai_mode0_chanset);
- outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */
- udelay(devpriv->max_812_ai_mode0_convstart);
- timeout = 20; /* wait max 100us, it must finish under 33us */
- while (timeout--) {
- hi = inb(dev->iobase + PCL812_AD_HI);
- if (!(hi & PCL812_DRDY))
- goto conv_finish;
- udelay(5);
- }
- rt_printk("comedi%d: pcl812: (%s at 0x%x) A/D mode0 timeout\n", dev->minor, dev->board_name, dev->iobase);
- it->data[p++] = 0;
- outb(0, dev->iobase + PCL812_MODE);
- return -ETIME;
-
- conv_finish:
- it->data[p++] = ((hi & 0xf) << 8) | inb(dev->iobase + PCL812_AD_LO);;
+ /* select gain */
+ outb(CR_RANGE(insn->chanspec), dev->iobase + PCL812_GAIN);
+ /* select channel */
+ outb(CR_CHAN(insn->chanspec), dev->iobase + PCL812_MUX);
+#define max(a,b) ((a>b)?(a):(b))
+ udelay(max(devpriv->max_812_ai_mode0_rangewait,
+ devpriv->max_812_ai_mode0_chanset));
+ for(n=0;n<insn->n;n++){
+ outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */
+ udelay(devpriv->max_812_ai_mode0_convstart);
+ timeout = 20; /* wait max 100us, it must finish under 33us */
+ while (timeout--) {
+ hi = inb(dev->iobase + PCL812_AD_HI);
+ if (!(hi & PCL812_DRDY))
+ goto conv_finish;
}
- }
+ rt_printk("comedi%d: pcl812: (%s at 0x%x) A/D mode0 timeout\n", dev->minor, dev->board_name, dev->iobase);
+ outb(0, dev->iobase + PCL812_MODE);
+ return -ETIME;
+ conv_finish:
+ data[n] = ((hi & 0xf) << 8) | inb(dev->iobase + PCL812_AD_LO);
+ }
outb(0, dev->iobase + PCL812_MODE);
- return p;
+ return n;
}
/*
ANALOG OUTPUT MODE0, 812pg card
only one sample per call is supported
*/
-static int pcl812_ao_mode0(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
+static int pcl812_ao_insn_write(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- int chan;
- sampl_t data;
+ int chan = CR_CHAN(insn->chanspec);
int i;
- for(i=0;i<it->n_chan;i++){
- chan = CR_CHAN(it->chanlist[i]);
- data = it->data[i];
+ for(i=0;i<insn->n;i++){
+ outb((data[i] & 0xff), dev->iobase + (chan ? PCL812_DA2_LO : PCL812_DA1_LO));
+ outb((data[i] >> 8) & 0x0f, dev->iobase + (chan ? PCL812_DA2_HI : PCL812_DA1_HI));
+ devpriv->ao_readback[chan]=data[i];
+ }
- outb((data & 0xff), dev->iobase + (chan ? PCL812_DA2_LO : PCL812_DA1_LO));
- outb((data >> 8) & 0x0f, dev->iobase + (chan ? PCL812_DA2_HI : PCL812_DA1_HI));
+ return i;
+}
+
+static int pcl812_ao_insn_read(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
+{
+ int chan = CR_CHAN(insn->chanspec);
+ int i;
+
+ for(i=0;i<insn->n;i++){
+ data[i] = devpriv->ao_readback[chan];
}
return i;
only one sample per call is supported
*/
-static int pcl812_di_mode0(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
+static int pcl812_di_insn_bits(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- int data;
+ if(insn->n!=2)return -EINVAL;
- data = inb(dev->iobase + PCL812_DI_LO) | (inb(dev->iobase + PCL812_DI_HI) << 8);
+ data[1] = inb(dev->iobase + PCL812_DI_LO);
+ data[1] |= inb(dev->iobase + PCL812_DI_HI) << 8;
- return di_unpack(data,it);
+ return 2;
}
/*
only one sample per call is supported
*/
-static int pcl812_do_mode0(comedi_device * dev, comedi_subdevice * s, comedi_trig * it)
+static int pcl812_do_insn_bits(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- do_pack(&s->state,it);
- outb(s->state & 0xff, dev->iobase + PCL812_DO_LO);
- outb((s->state >> 8), dev->iobase + PCL812_DO_HI);
+ if(insn->n!=2)return -EINVAL;
+
+ if(data[0]){
+ s->state &= ~data[0];
+ s->state |= data[0]&data[1];
+ outb(s->state & 0xff, dev->iobase + PCL812_DO_LO);
+ outb((s->state >> 8), dev->iobase + PCL812_DO_HI);
+ }
+ data[1]=s->state;
- return it->n_chan;
+ return 2;
}
/*
s->len_chanlist = AI_LEN_CHANLIST;
s->range_table = this_board->ai_range_type;
s->subdev_flags |= SDF_GROUND;
- s->trig[0] = pcl812_ai_mode0;
+ s->insn_read = pcl812_ai_insn_read;
if(this_board->is_812pg){
if (it->options[3] == 1)
s->range_table = &range_pcl812pg2_ai;
s->range_table = this_board->ao_range_type;
if(this_board->is_812pg){
s->subdev_flags |= SDF_GROUND;
- s->trig[0] = pcl812_ao_mode0;
- //s->trig[1] = pcl812_ao_mode1;
+ s->insn_read = pcl812_ao_insn_read;
+ s->insn_write = pcl812_ao_insn_write;
if (it->options[4] == 1)
s->range_table = &range_unipolar5;
if (it->options[4] == 2)
s->maxdata = 1;
s->len_chanlist = this_board->n_dichan;
s->range_table = &range_digital;
- s->trig[0] = pcl812_di_mode0;
+ s->insn_bits = pcl812_di_insn_bits;
}
/* digital output */
s->maxdata = 1;
s->len_chanlist = this_board->n_dochan;
s->range_table = &range_digital;
- s->trig[0] = pcl812_do_mode0;
+ s->insn_bits = pcl812_do_insn_bits;
}
pcl812_reset(dev);
inb(dev->iobase + DAQP_STATUS), inb(dev->iobase + DAQP_AUX));
}
-static int daqp_ai_a(comedi_device *dev,comedi_subdevice *s,comedi_trig *it)
+static int daqp_ai_insn_read(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
local_info_t *local;
int i;
int v;
- int data;
int counter=10000;
#ifdef USE_INTERRUPTS
int threshold;
outb(DAQP_COMMAND_RSTQ,
dev->iobase+DAQP_COMMAND);
- for (i=0; i < it->n_chan; i++) {
+ /* Program one scan list entry */
- /* Program one scan list entry */
+ v = DAQP_SCANLIST_CHANNEL(CR_CHAN(insn->chanspec))
+ | DAQP_SCANLIST_GAIN(CR_RANGE(insn->chanspec));
- v = DAQP_SCANLIST_CHANNEL(CR_CHAN(it->chanlist[i]))
- | DAQP_SCANLIST_GAIN(CR_RANGE(it->chanlist[i]));
-
- if (CR_AREF(it->chanlist[i]) == AREF_DIFF) {
- v |= DAQP_SCANLIST_DIFFERENTIAL;
- }
+ if (CR_AREF(insn->chanspec) == AREF_DIFF) {
+ v |= DAQP_SCANLIST_DIFFERENTIAL;
+ }
- if (i==0) {
- v |= DAQP_SCANLIST_START;
- }
+ v |= DAQP_SCANLIST_START;
- outb(v & 0xff, dev->iobase + DAQP_SCANLIST);
- outb(v >> 8, dev->iobase + DAQP_SCANLIST);
- }
+ outb(v & 0xff, dev->iobase + DAQP_SCANLIST);
+ outb(v >> 8, dev->iobase + DAQP_SCANLIST);
/* Reset data FIFO (see page 28 of DAQP User's Manual) */
outb(DAQP_COMMAND_RSTF,
printk("timeout: %d\n", timeout);
#endif
- for (i=0; i < it->n_chan; i++) {
-
- /* Wait for data in FIFO */
- while (--counter
- && (inb(dev->iobase + DAQP_STATUS)
- & DAQP_STATUS_FIFO_EMPTY));
-
- if (!counter) {
- printk("DAQP FIFO never got data!\n");
- daqp_dump(dev);
- break;
- } else {
- data = inb(dev->iobase + DAQP_FIFO);
- data |= inb(dev->iobase + DAQP_FIFO) << 8;
- data ^= 0x8000;
- it->data[i] = data;
- }
+ i=0;
+
+ /* Wait for data in FIFO */
+ while (--counter
+ && (inb(dev->iobase + DAQP_STATUS)
+ & DAQP_STATUS_FIFO_EMPTY));
+
+ if (!counter) {
+ printk("DAQP FIFO never got data!\n");
+ daqp_dump(dev);
+ return -EIO;
+ } else {
+ data[i] = inb(dev->iobase + DAQP_FIFO);
+ data[i] |= inb(dev->iobase + DAQP_FIFO) << 8;
+ data[i] ^= 0x8000;
}
- return i;
+ /* XXX wrong, but I don't know how to fix it --ds */
+ return 1;
}
static void daqp_interrupt(int irq, void * dev_id, struct pt_regs *regs)
s->n_chan=8;
s->maxdata=0xffff;
s->range_table=&range_daqp_ai;
- s->trig[0]=daqp_ai_a;
+ s->insn_read=daqp_ai_insn_read;
return 1;
}
dac_2comp, dac_straight
} dac0_coding, dac1_coding;
comedi_lrange * ao_range_type_list[2];
+ lsampl_t ao_readback[2];
} rti800_private;
#define devpriv ((rti800_private *)dev->private)
static int gaindelay[]={10,20,40,80};
-static int rti800_ai_mode0(comedi_device * dev, comedi_subdevice *s, comedi_trig * it)
+static int rti800_ai_insn_read(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- int i;
- for(i=0 ; i < it->n_chan ; i++) {
- int t, hi, lo, gain;
- int chan;
- int data;
+ int i,t;
int status;
-
- chan = CR_CHAN(it->chanlist[i]);
- gain = CR_RANGE(it->chanlist[i]);
+ int chan = CR_CHAN(insn->chanspec);
+ int gain = CR_RANGE(insn->chanspec);
inb(dev->iobase + RTI800_ADCHI);
outb(0,dev->iobase+RTI800_CLRFLAGS);
/* contrary to the docs, there needs to be a delay here */
udelay(gaindelay[gain]);
- outb(0, dev->iobase + RTI800_CONVERT);
- for (t = 0; t < RTI800_TIMEOUT; t++) {
- status=inb(dev->iobase+RTI800_CSR);
-#if DEBUG
- rt_printk("status=%x\n",status);
-#endif
- if(status & RTI800_OVERRUN){
- rt_printk("rti800: a/d overflow\n");
- outb(0,dev->iobase+RTI800_CLRFLAGS);
-
+ for(i=0;i<insn->n;i++){
+ outb(0, dev->iobase + RTI800_CONVERT);
+ for (t = RTI800_TIMEOUT; t; t--) {
+ status=inb(dev->iobase+RTI800_CSR);
+ if(status & RTI800_OVERRUN){
+ rt_printk("rti800: a/d overflow\n");
+ outb(0,dev->iobase+RTI800_CLRFLAGS);
+ return -EIO;
+ }
+ if (status & RTI800_DONE)break;
+ }
+ if(t){
+ rt_printk("rti800: timeout\n");
return -ETIME;
}
- if (status & RTI800_DONE)
- break;
- udelay(8);
- }
- if(t==RTI800_TIMEOUT){
- rt_printk("rti800: timeout\n");
-
- return -ETIME;
- }
- lo = inb(dev->iobase + RTI800_ADCLO);
- hi = inb(dev->iobase + RTI800_ADCHI);
+ data[i] = inb(dev->iobase + RTI800_ADCLO);
+ data[i] = (0xf & inb(dev->iobase + RTI800_ADCHI))<<8;
- data = (hi << 8) | lo;
- data &= 0xfff;
- if (devpriv->adc_coding == adc_2comp) {
- data ^= 0x800;
+ if (devpriv->adc_coding == adc_2comp) {
+ data[i] ^= 0x800;
+ }
}
- it->data[i]=data;
- }
- return i;
+ return i;
}
-static int rti800_ai_mode1(comedi_device * dev, comedi_subdevice *s, comedi_trig * it)
+static int rti800_ao_insn_read(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- return -EINVAL;
-}
+ int i;
+ int chan=CR_CHAN(insn->chanspec);
+ for(i=0;i<insn->n;i++)
+ data[i] = devpriv->ao_readback[chan];
-static int rti800_ao(comedi_device * dev, comedi_subdevice *s, comedi_trig * it)
-{
- int i;
- for(i=0 ; i < it->n_chan ; i++) {
- int chan;
- int data;
+ return i;
+}
- chan=CR_CHAN(it->chanlist[i]);
- data=it->data[i];
+static int rti800_ao_insn_write(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
+{
+ int chan=CR_CHAN(insn->chanspec);
+ int d;
+ int i;
- switch(chan){
- case 0:
+ for(i=0;i<insn->n;i++){
+ devpriv->ao_readback[chan] = d = data[i];
if (devpriv->dac0_coding == dac_2comp) {
- data ^= 0x800;
- }
- outb(data & 0xff, dev->iobase + RTI800_DAC0LO);
- outb(data >> 8, dev->iobase + RTI800_DAC0HI);
- break;
- case 1:
- if (devpriv->dac1_coding == dac_2comp) {
- data ^= 0x800;
+ d ^= 0x800;
}
- outb(data & 0xff, dev->iobase + RTI800_DAC1LO);
- outb(data >> 8, dev->iobase + RTI800_DAC1HI);
- break;
- default:
- return -EINVAL;
+ outb(d & 0xff, dev->iobase + chan?RTI800_DAC1LO:RTI800_DAC0LO);
+ outb(d >> 8, dev->iobase + chan?RTI800_DAC1HI:RTI800_DAC0HI);
}
- }
- return i;
+ return i;
}
-static int rti800_di(comedi_device * dev, comedi_subdevice *s, comedi_trig * it)
+static int rti800_di_insn_bits(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- unsigned int bits;
-
- bits = inb(dev->iobase + RTI800_DI);
+ if(insn->n!=2)return -EINVAL;
+ data[1] = inb(dev->iobase + RTI800_DI);
- return di_unpack(bits,it);
+ return 2;
}
-static int rti800_do(comedi_device * dev, comedi_subdevice *s, comedi_trig * it)
+static int rti800_do_insn_bits(comedi_device *dev,comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- do_pack(&s->state,it);
+ if(insn->n!=2)return -EINVAL;
- /* Outputs are inverted... */
- outb(s->state ^ 0xff, dev->iobase + RTI800_DO);
+ if(data[0]){
+ s->state &= ~data[0];
+ s->state &= data[0]&data[1];
+ /* Outputs are inverted... */
+ outb(s->state ^ 0xff, dev->iobase + RTI800_DO);
+ }
- return it->n_chan;
+ return 2;
}
s->type=COMEDI_SUBD_AI;
s->subdev_flags=SDF_READABLE;
s->n_chan=(devpriv->adc_mux? 16 : 8);
- s->trig[0]=rti800_ai_mode0;
- s->trig[1]=rti800_ai_mode1;
+ s->insn_read=rti800_ai_insn_read;
s->maxdata=0xfff;
switch (devpriv->adc_range) {
case adc_bipolar10:
s->type=COMEDI_SUBD_AO;
s->subdev_flags=SDF_WRITEABLE;
s->n_chan=2;
- s->trig[0]=rti800_ao;
+ s->insn_read=rti800_ao_insn_read;
+ s->insn_write=rti800_ao_insn_write;
s->maxdata=0xfff;
s->range_table_list=devpriv->ao_range_type_list;
switch (devpriv->dac0_range) {
s->type=COMEDI_SUBD_DI;
s->subdev_flags=SDF_READABLE;
s->n_chan=8;
- s->trig[0]=rti800_di;
+ s->insn_bits=rti800_di_insn_bits;
s->maxdata=1;
s->range_table=&range_digital;
s->type=COMEDI_SUBD_DO;
s->subdev_flags=SDF_WRITEABLE;
s->n_chan=8;
- s->trig[0]=rti800_do;
+ s->insn_bits=rti800_do_insn_bits;
s->maxdata=1;
s->range_table=&range_digital;
s++;
/* do */
s->type=COMEDI_SUBD_TIMER;
- s->n_chan=0;
- s->trig[0]=NULL;
- s->maxdata=0
#endif
printk("\n");
};
COMEDI_INITCLEANUP(driver_rti802);
-static void rti802_free_resources(comedi_device * dev);
-
typedef struct {
enum {
dac_2comp, dac_straight
} dac_coding[8];
comedi_lrange * range_type_list[8];
+ lsampl_t ao_readback[8];
} rti802_private;
#define devpriv ((rti802_private *)dev->private)
-static int rti802_ao(comedi_device * dev, comedi_subdevice *s, comedi_trig * it)
+static int rti802_ao_insn_read(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
{
- int i;
- for(i=0 ; i < it->n_chan ; i++) {
- int chan = CR_CHAN(it->chanlist[i]);
- int data = it->data[i];
+ int i;
- if (devpriv->dac_coding[chan] == dac_2comp) {
- data ^= 0x800;
+ for(i=0;i<insn->n;i++)
+ data[i]=devpriv->ao_readback[CR_CHAN(insn->chanspec)];
+
+ return i;
+}
+
+static int rti802_ao_insn_write(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn,lsampl_t *data)
+{
+ int i,d;
+ int chan = CR_CHAN(insn->chanspec);
+
+ for(i=0;i<insn->n;i++){
+ d = devpriv->ao_readback[chan] = data[i];
+ if (devpriv->dac_coding[chan] == dac_2comp) d ^= 0x800;
+ outb(chan, dev->iobase + RTI802_SELECT);
+ outb(d & 0xff, dev->iobase + RTI802_DATALOW);
+ outb(d >> 8, dev->iobase + RTI802_DATAHIGH);
}
- outb(chan, dev->iobase + RTI802_SELECT);
- outb(data & 0xff, dev->iobase + RTI802_DATALOW);
- outb(data >> 8, dev->iobase + RTI802_DATAHIGH);
- }
- return i;
+ return i;
}
+
/*
options:
[0] - i/o base
s->subdev_flags=SDF_WRITEABLE;
s->maxdata=0xfff;
s->n_chan=8;
- s->trig[0] = rti802_ao;
+ s->insn_read = rti802_ao_insn_read;
+ s->insn_write = rti802_ao_insn_write;
s->range_table_list=devpriv->range_type_list;
for (i = 0; i < 8; i++) {
return 0;
}
-static void rti802_free_resources(comedi_device * dev)
-{
- if(dev->iobase)
- release_region(dev->iobase, RTI802_SIZE);
-}
-
static int rti802_detach(comedi_device * dev)
{
printk("comedi%d: rti802: remove\n", dev->minor);
- rti802_free_resources(dev);
+ if(dev->iobase)
+ release_region(dev->iobase, RTI802_SIZE);
return 0;
}