From cdba92821dde5c08a8d47b44381986f90456982d Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 11 Oct 2000 00:50:13 +0000 Subject: [PATCH] bug fixes re failure on comedi_test --- comedi/drivers/ni_mio_common.c | 30 +++++++++++++++++++++++------- comedi/drivers/ni_pcimio.c | 2 +- comedi/drivers/ni_stc.h | 3 +++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index e15f4fc7..a7d0ee83 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -151,7 +151,10 @@ static comedi_lrange *ni_range_lkup[]={ static int ni_dio(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); static int ni_eeprom(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); -static int ni_calib(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); +static int ni_calib_insn_read(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); +static int ni_calib_insn_write(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); static void caldac_setup(comedi_device *dev,comedi_subdevice *s); static int ni_read_eeprom(comedi_device *dev,int addr); @@ -1650,7 +1653,7 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it) s->maxdata=1; s->range_table=&range_digital; s->io_bits=0; /* all bits input */ - s->insn_read=ni_dio_insn_bits; + s->insn_bits=ni_dio_insn_bits; s->trig[0]=ni_dio; /* dio setup */ @@ -1668,17 +1671,20 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it) /* general purpose counter/timer device */ s=dev->subdevices+4; - gpct_setup(dev,s); s->type=COMEDI_SUBD_COUNTER; + s->subdev_flags=SDF_READABLE|SDF_WRITEABLE; s->trig[0]=ni_gpct; - /* XXX */ + s->n_chan=1; /* XXX */ + s->maxdata=1; + gpct_setup(dev,s); /* calibration subdevice -- ai and ao */ s=dev->subdevices+5; s->type=COMEDI_SUBD_CALIB; s->subdev_flags=SDF_WRITEABLE|SDF_INTERNAL; caldac_setup(dev,s); - s->trig[0]=ni_calib; + s->insn_read=ni_calib_insn_read; + s->insn_write=ni_calib_insn_write; /* EEPROM */ s=dev->subdevices+6; @@ -1778,9 +1784,19 @@ static void ni_write_caldac(comedi_device *dev,int addr,int val); /* calibration subdevice */ -static int ni_calib(comedi_device *dev,comedi_subdevice *s,comedi_trig *it) +static int ni_calib_insn_write(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) +{ + ni_write_caldac(dev,CR_CHAN(insn->chanspec),data[0]); + devpriv->caldacs[CR_CHAN(insn->chanspec)] = data[0]; + + return 1; +} + +static int ni_calib_insn_read(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) { - ni_write_caldac(dev,CR_CHAN(it->chanlist[0]),it->data[0]); + data[0] = devpriv->caldacs[CR_CHAN(insn->chanspec)]; return 1; } diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index 67847d7f..f97fb537 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -284,7 +284,7 @@ static ni_board ni_boards[]={ caldac: type3, has_8255: 0, }, - { device_id: 0x0000, /* unknown */ + { device_id: 0x18b0, name: "pci-6052e", n_adchan: 16, adbits: 16, diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index 64a78224..ea21e6dd 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -554,6 +554,9 @@ static ni_board ni_boards[]; int changain_state; \ unsigned int changain_spec; \ \ + unsigned short ao[2]; \ + unsigned short caldacs[12]; \ + \ unsigned short ao_mode1; \ unsigned short ao_mode2; \ unsigned short ao_mode3; \ -- 2.26.2