PCI-DAS6402/12, PCI-DAS64/M1/16, PCI-DAS64/M2/16,
PCI-DAS64/M3/16, PCI-DAS6402/16/JR, PCI-DAS64/M1/16/JR,
PCI-DAS64/M2/16/JR, PCI-DAS64/M3/16/JR, PCI-DAS64/M1/14,
- PCI-DAS64/M2/14, PCI-DAS64/M3/14, PCI-DAS6023E, PCI-DAS6025E, PCI-DAS6034E,
- PCI-DAS6035E, PCI-DAS4020/12
+ PCI-DAS64/M2/14, PCI-DAS64/M3/14, PCI-DAS6023, PCI-DAS6025, PCI-DAS6030,
+ PCI-DAS6031, PCI-DAS6032, PCI-DAS6033, PCI-DAS6034,
+ PCI-DAS6035, PCI-DAS6036, PCI-DAS6040, PCI-DAS6052,
+ PCI-DAS6070, PCI-DAS6071, PCI-DAS4020/12
Configuration options:
[0] - PCI bus of device (optional)
UNI_RANGE(1.25)
}
};
-static int ai_range_bits_64xx[] = {
- 0x000,
- 0x100,
- 0x200,
- 0x300,
- 0x800,
- 0x900,
- 0xa00,
- 0xb00,
-};
-// analog input ranges for 60xx boards
+/* analog input ranges for 60xx boards */
static comedi_lrange ai_ranges_60xx =
{
4,
BIP_RANGE(0.05),
}
};
-static int ai_range_bits_60xx[] = {
- 0x000,
- 0x100,
- 0x400,
- 0x700,
+
+/* analog input ranges for 6030, etc boards */
+static comedi_lrange ai_ranges_6030 =
+{
+ 14,
+ {
+ BIP_RANGE(10),
+ BIP_RANGE(5),
+ BIP_RANGE(2),
+ BIP_RANGE(1),
+ BIP_RANGE(0.5),
+ BIP_RANGE(0.2),
+ BIP_RANGE(0.1),
+ UNI_RANGE(10),
+ UNI_RANGE(5),
+ UNI_RANGE(2),
+ UNI_RANGE(1),
+ UNI_RANGE(0.5),
+ UNI_RANGE(0.2),
+ UNI_RANGE(0.1),
+ }
+};
+
+/* analog input ranges for 6052, etc boards */
+static comedi_lrange ai_ranges_6052 =
+{
+ 15,
+ {
+ BIP_RANGE(10),
+ BIP_RANGE(5),
+ BIP_RANGE(2.5),
+ BIP_RANGE(1),
+ BIP_RANGE(0.5),
+ BIP_RANGE(0.25),
+ BIP_RANGE(0.1),
+ BIP_RANGE(0.05),
+ UNI_RANGE(10),
+ UNI_RANGE(5),
+ UNI_RANGE(2),
+ UNI_RANGE(1),
+ UNI_RANGE(0.5),
+ UNI_RANGE(0.2),
+ UNI_RANGE(0.1),
+ }
};
// analog input ranges for 4020 board
BIP_RANGE(1),
}
};
-static int ai_range_bits_4020[] =
-{
- 0x1,
- 0x0,
-};
// analog output ranges
static comedi_lrange ao_ranges_64xx =
0x0,
};
+static comedi_lrange ao_ranges_6030 =
+{
+ 2,
+ {
+ BIP_RANGE(10),
+ UNI_RANGE(10),
+ }
+};
+static int ao_range_code_6030[] =
+{
+ 0x0,
+ 0x2,
+};
+
static comedi_lrange ao_ranges_4020 =
{
2,
int ai_bits; // analog input resolution
int ai_speed; // fastest conversion period in ns
comedi_lrange *ai_range_table;
- int *ai_range_bits;
int ao_nchan; // number of analog out channels
int ao_scan_speed; // analog output speed (for a scan, not conversion)
comedi_lrange *ao_range_table;
int *ao_range_code;
const hw_fifo_info_t *const ai_fifo;
enum register_layout layout; // different board families have slightly different registers
+ unsigned has_8255 : 1;
} pcidas64_board;
static const hw_fifo_info_t ai_fifo_4020 =
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ao_range_table: &ao_ranges_64xx,
ao_range_code: ao_range_code_64xx,
ai_fifo: &ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das6402/12", // XXX check
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ao_range_table: &ao_ranges_64xx,
ao_range_code: ao_range_code_64xx,
ai_fifo: &ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m1/16",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ao_range_table: &ao_ranges_64xx,
ao_range_code: ao_range_code_64xx,
ai_fifo: &ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m2/16",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ao_range_table: &ao_ranges_64xx,
ao_range_code: ao_range_code_64xx,
ai_fifo: &ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m3/16",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ao_range_table: &ao_ranges_64xx,
ao_range_code: ao_range_code_64xx,
ai_fifo: &ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das6023",
ao_scan_speed: 100000,
layout: LAYOUT_60XX,
ai_range_table: &ai_ranges_60xx,
- ai_range_bits: ai_range_bits_60xx,
ao_range_table: &ao_ranges_60xx,
ao_range_code: ao_range_code_60xx,
ai_fifo: &ai_fifo_60xx,
+ has_8255 : 1,
},
{
name: "pci-das6025",
ao_scan_speed: 100000,
layout: LAYOUT_60XX,
ai_range_table: &ai_ranges_60xx,
- ai_range_bits: ai_range_bits_60xx,
ao_range_table: &ao_ranges_60xx,
ao_range_code: ao_range_code_60xx,
ai_fifo: &ai_fifo_60xx,
+ has_8255 : 1,
+ },
+ {
+ name: "pci-das6030",
+ device_id: 0x5f,
+ ai_se_chans: 16,
+ ai_bits: 16,
+ ai_speed: 10000,
+ ao_nchan: 2,
+ ao_scan_speed: 10000,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6030,
+ ao_range_table: &ao_ranges_6030,
+ ao_range_code: ao_range_code_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6031",
+ device_id: 0x60,
+ ai_se_chans: 64,
+ ai_bits: 16,
+ ai_speed: 10000,
+ ao_nchan: 2,
+ ao_scan_speed: 10000,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6030,
+ ao_range_table: &ao_ranges_6030,
+ ao_range_code: ao_range_code_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6032",
+ device_id: 0x61,
+ ai_se_chans: 16,
+ ai_bits: 16,
+ ai_speed: 10000,
+ ao_nchan: 0,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6033",
+ device_id: 0x62,
+ ai_se_chans: 64,
+ ai_bits: 16,
+ ai_speed: 10000,
+ ao_nchan: 0,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
},
{
name: "pci-das6034",
ao_scan_speed: 0,
layout: LAYOUT_60XX,
ai_range_table: &ai_ranges_60xx,
- ai_range_bits: ai_range_bits_60xx,
ai_fifo: &ai_fifo_60xx,
+ has_8255 : 1,
},
{
name: "pci-das6035",
ao_scan_speed: 100000,
layout: LAYOUT_60XX,
ai_range_table: &ai_ranges_60xx,
- ai_range_bits: ai_range_bits_60xx,
ao_range_table: &ao_ranges_60xx,
ao_range_code: ao_range_code_60xx,
ai_fifo: &ai_fifo_60xx,
+ has_8255 : 1,
+ },
+ {
+ name: "pci-das6036",
+ device_id: 0x6f,
+ ai_se_chans: 16,
+ ai_bits: 16,
+ ai_speed: 5000,
+ ao_nchan: 2,
+ ao_scan_speed: 100000,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_60xx,
+ ao_range_table: &ao_ranges_60xx,
+ ao_range_code: ao_range_code_60xx,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6040",
+ device_id: 0x65,
+ ai_se_chans: 16,
+ ai_bits: 12,
+ ai_speed: 2000,
+ ao_nchan: 2,
+ ao_scan_speed: 1000,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6052,
+ ao_range_table: &ao_ranges_6030,
+ ao_range_code: ao_range_code_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6052",
+ device_id: 0x66,
+ ai_se_chans: 16,
+ ai_bits: 16,
+ ai_speed: 3333,
+ ao_nchan: 2,
+ ao_scan_speed: 3333,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6052,
+ ao_range_table: &ao_ranges_6030,
+ ao_range_code: ao_range_code_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6070",
+ device_id: 0x67,
+ ai_se_chans: 16,
+ ai_bits: 12,
+ ai_speed: 800,
+ ao_nchan: 2,
+ ao_scan_speed: 1000,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6052,
+ ao_range_table: &ao_ranges_6030,
+ ao_range_code: ao_range_code_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
+ },
+ {
+ name: "pci-das6071",
+ device_id: 0x68,
+ ai_se_chans: 64,
+ ai_bits: 12,
+ ai_speed: 800,
+ ao_nchan: 2,
+ ao_scan_speed: 1000,
+ layout: LAYOUT_60XX,
+ ai_range_table: &ai_ranges_6052,
+ ao_range_table: &ao_ranges_6030,
+ ao_range_code: ao_range_code_6030,
+ ai_fifo: &ai_fifo_60xx,
+ has_8255 : 0,
},
{
name: "pci-das4020/12",
ao_scan_speed: 0, // no hardware pacing on ao
layout: LAYOUT_4020,
ai_range_table: &ai_ranges_4020,
- ai_range_bits: NULL,
ao_range_table: &ao_ranges_4020,
ao_range_code: ao_range_code_4020,
ai_fifo: &ai_fifo_4020,
+ has_8255 : 1,
},
#if 0
{
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m1/16/jr",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m2/16/jr",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m3/16/jr",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m1/14",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m2/14",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
{
name: "pci-das64/m3/14",
ao_scan_speed: 10000,
layout: LAYOUT_64XX,
ai_range_table: &ai_ranges_64xx,
- ai_range_bits: ai_range_bits_64xx,
ai_fifo: ai_fifo_64xx,
+ has_8255 : 1,
},
#endif
};
static void disable_ai_interrupts( comedi_device *dev );
static void enable_ai_interrupts( comedi_device *dev, const comedi_cmd *cmd );
-/*
- * A convenient macro that defines init_module() and cleanup_module(),
- * as necessary.
- */
COMEDI_INITCLEANUP(driver_cb_pcidas);
+static unsigned int ai_range_bits_6xxx( const comedi_device *dev, unsigned int range_index )
+{
+ comedi_krange *range = &board( dev )->ai_range_table->range[ range_index ];
+ unsigned int bits = 0;
+
+ switch( range->max )
+ {
+ case 10000000:
+ bits = 0;
+ break;
+ case 5000000:
+ bits = 1;
+ break;
+ case 2000000:
+ case 2500000:
+ bits = 2;
+ break;
+ case 1000000:
+ case 1250000:
+ bits = 3;
+ break;
+ case 500000:
+ bits = 4;
+ break;
+ case 200000:
+ case 250000:
+ bits = 5;
+ break;
+ case 100000:
+ bits = 6;
+ break;
+ case 50000:
+ bits = 7;
+ break;
+ default:
+ comedi_error( dev, "bug! in ai_range_bits_6xxx" );
+ break;
+ }
+ if( range->min == 0 ) bits += 0x900;
+ return bits;
+}
+
static inline uint16_t dac_range_bits( const comedi_device *dev,
unsigned int channel, unsigned int range )
{
/* 8255 */
s = dev->subdevices + 4;
- if(board(dev)->layout == LAYOUT_4020)
- {
- dio_8255_iobase = priv(dev)->main_iobase + I8255_4020_REG;
- subdev_8255_init(dev, s, dio_callback_4020, dio_8255_iobase);
- } else
+ if( board(dev)->has_8255 )
{
- dio_8255_iobase = priv(dev)->dio_counter_iobase + DIO_8255_OFFSET;
- subdev_8255_init(dev, s, dio_callback, dio_8255_iobase);
- }
+ if(board(dev)->layout == LAYOUT_4020)
+ {
+ dio_8255_iobase = priv(dev)->main_iobase + I8255_4020_REG;
+ subdev_8255_init(dev, s, dio_callback_4020, dio_8255_iobase);
+ } else
+ {
+ dio_8255_iobase = priv(dev)->dio_counter_iobase + DIO_8255_OFFSET;
+ subdev_8255_init(dev, s, dio_callback, dio_8255_iobase);
+ }
+ }else
+ s->type = COMEDI_SUBD_UNUSED;
// 8 channel dio for 60xx
s = dev->subdevices + 5;
// load internal queue
bits = 0;
// set gain
- bits |= board(dev)->ai_range_bits[CR_RANGE(insn->chanspec)];
+ bits |= ai_range_bits_6xxx( dev, CR_RANGE(insn->chanspec) );
// set single-ended / differential
if( ( board(dev)->layout == LAYOUT_64XX && aref != AREF_DIFF ) ||
( board(dev)->layout == LAYOUT_60XX && aref == AREF_DIFF ) )
priv(dev)->i2c_cal_range_bits |= adc_src_4020_bits( 4 );
}
// select range
- if(ai_range_bits_4020[range])
+ if( ai_range_bits_6xxx( dev, range ) )
priv(dev)->i2c_cal_range_bits |= attenuate_bit( channel );
else
priv(dev)->i2c_cal_range_bits &= ~attenuate_bit( channel );
// set channel
bits |= adc_chan_bits( CR_CHAN( cmd->chanlist[i] ) );
// set gain
- bits |= board(dev)->ai_range_bits[CR_RANGE(cmd->chanlist[i])];
+ bits |= ai_range_bits_6xxx( dev, CR_RANGE( cmd->chanlist[i] ) );
// set single-ended / differential
if( ( board(dev)->layout == LAYOUT_64XX && CR_AREF(cmd->chanlist[i]) != AREF_DIFF ) ||
( board(dev)->layout == LAYOUT_60XX && CR_AREF(cmd->chanlist[i]) == AREF_DIFF ) )
unsigned int channel = CR_CHAN(cmd->chanlist[i]);
unsigned int range = CR_RANGE(cmd->chanlist[i]);
- if(ai_range_bits_4020[range])
+ if( ai_range_bits_6xxx( dev, range ) )
priv(dev)->i2c_cal_range_bits |= attenuate_bit( channel );
else
priv(dev)->i2c_cal_range_bits &= ~attenuate_bit( channel );