RANGE( -0.5, 0.5 ),
RANGE( -0.2, 0.2 ),
}};
-static comedi_lrange range_ni_E_ai_622x={ 8, {
+static comedi_lrange range_ni_M_ai_622x={ 8, {
RANGE(-10, 10),
RANGE(-5, 5),
RANGE(-1, 1),
&range_ni_E_ai_limited14,
&range_ni_E_ai_bipolar4,
&range_ni_E_ai_611x,
- &range_ni_E_ai_622x
+ &range_ni_M_ai_622x
};
range = CR_RANGE(chanspec[i]);
if(boardtype.reg_type == ni_reg_m_series)
{
+ comedi_krange *krange = s->range_table->range + range;
+ invert = 0;
conf = 0;
- if((range&1) == 0){
- conf |= MSeries_AO_Bipolar_Bit;
- invert = (1<<(boardtype.aobits-1));
- }else{
- invert = 0;
- }
- if(range&2)
- {
- //FIXME: don't know external ao reference bit for m series
- /*conf |= AO_Ext_Ref;*/
- }else
+ switch(krange->max - krange->min)
{
- conf |= MSeries_AO_DAC_Reference_Internal_Bits;
+ case 20000000:
+ conf |= MSeries_AO_DAC_Reference_10V_Internal_Bits;
+ ni_writeb(0, M_Offset_AO_Reference_Attenuation(chan));
+ break;
+ case 10000000:
+ conf |= MSeries_AO_DAC_Reference_5V_Internal_Bits;
+ ni_writeb(0, M_Offset_AO_Reference_Attenuation(chan));
+ break;
+ case 4000000:
+ conf |= MSeries_AO_DAC_Reference_10V_Internal_Bits;
+ ni_writeb(MSeries_Attenuate_x5_Bit, M_Offset_AO_Reference_Attenuation(chan));
+ break;
+ case 2000000:
+ conf |= MSeries_AO_DAC_Reference_5V_Internal_Bits;
+ ni_writeb(MSeries_Attenuate_x5_Bit, M_Offset_AO_Reference_Attenuation(chan));
+ break;
+ default:
+ rt_printk("%s: bug! unhandled ao reference voltage\n", __FUNCTION__);
+ break;
}
- if(CR_AREF(chanspec[i])==AREF_OTHER)
- {
- //FIXME: don't know code for unusual ao offset configurations
- }else
+ switch(krange->max + krange->min)
{
- conf |= MSeries_AO_DAC_Offset_AO_Ground_Bits;
+ case 0:
+ conf |= MSeries_AO_DAC_Offset_0V_Bits;
+ break;
+ case 10000000:
+ conf |= MSeries_AO_DAC_Offset_5V_Bits;
+ break;
+ default:
+ rt_printk("%s: bug! unhandled ao offset voltage\n", __FUNCTION__);
+ break;
}
ni_writeb(conf, M_Offset_AO_Config_Bank(chan));
}else
s->subdev_flags=SDF_WRITABLE|SDF_DEGLITCH|SDF_GROUND;
s->n_chan=boardtype.n_aochan;
s->maxdata=(1<<boardtype.aobits)-1;
- if(boardtype.ao_unipolar){
- s->range_table=&range_ni_E_ao_ext; /* XXX wrong for some boards */
- }else{
- s->range_table=&range_bipolar10;
- }
+ s->range_table = boardtype.ao_range_table;
s->insn_read=ni_ao_insn_read;
if(boardtype.reg_type & ni_reg_6xxx_mask){
s->insn_write=ni_ao_insn_write_671x;
};
MODULE_DEVICE_TABLE(pci, ni_pci_table);
+/* These are not all the possible ao ranges for 628x boards.
+ They can do OFFSET +- REFERENCE where OFFSET can be
+ 0V, 5V, APFI<0,1>, or AO<0...3> and RANGE can
+ be 10V, 5V, 2V, 1V, APFI<0,1>, AO<0...3>. That's
+ 63 different possibilities. An AO channel
+ can not act as it's own OFFSET or REFERENCE.
+*/
+static comedi_lrange range_ni_M_628x_ao = { 8, {
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE(-2, 2),
+ RANGE(-1, 1),
+ RANGE(-5, 15),
+ RANGE(0, 10),
+ RANGE(3, 7),
+ RANGE(4, 6),
+ RANGE_ext(-1, 1)
+}};
+static comedi_lrange range_ni_M_625x_ao = { 3, {
+ RANGE(-10, 10),
+ RANGE(-5, 5),
+ RANGE_ext(-1, 1)
+}};
+static comedi_lrange range_ni_M_622x_ao = { 1, {
+ RANGE(-10, 10),
+}};
+
static ni_board ni_boards[]={
{ device_id: 0x0162, // NI also says 0x1620. typo?
name: "pci-mio-16xe-50",
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 0,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
caldac: {dac8800,dac8043},
has_8255: 0,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {dac8800,dac8043,ad8522},
has_8255: 0,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 0,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
caldac: {ad8804_debug},
has_8255: 0,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {dac8800,dac8043,ad8522},
has_8255: 0,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {mb88341},
has_8255: 0,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 512,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {ad8804_debug}, // doc says mb88341
has_8255: 0,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 512,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {mb88341},
has_8255: 0,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {dac8800,dac8043,ad8522},
has_8255: 0,
n_aochan: 0,
aobits: 0,
ao_fifo_depth: 0,
- ao_unipolar: 1,
+ ao_unipolar: 0,
caldac: {dac8800,dac8043,ad8522},
has_8255: 0,
},
n_aochan: 0,
aobits: 0,
ao_fifo_depth: 0,
- ao_unipolar: 1,
+ ao_unipolar: 0,
caldac: {dac8800,dac8043,ad8522},
has_8255: 0,
},
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {ad8804_debug},
has_8255: 0,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 0,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
caldac: {ad8804}, /* manual is wrong */
has_8255: 0,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 0,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
caldac: {ad8804}, /* manual is wrong */
has_8255: 1,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 0,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {ad8804}, /* manual is wrong */
has_8255: 1,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 0,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
caldac: {ad8804_debug},
has_8255: 0,
aobits: 16,
ao_unipolar: 1,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
caldac: {ad8804_debug,ad8804_debug,ad8522}, /* manual is wrong */
},
#if 0
aobits: 16,
ao_unipolar: 1,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
caldac: {ad8804,mb88341,ad8522}, /* manual is wrong */
},
#endif
n_aochan: 2,
aobits: 16,
reg_type: ni_reg_611x,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
ao_fifo_depth: 2048,
caldac: {ad8804,ad8804},
n_aochan: 2,
aobits: 16,
reg_type: ni_reg_611x,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
ao_fifo_depth: 2048,
caldac: {ad8804,ad8804},
aobits: 12,
ao_unipolar: 0,
ao_fifo_depth: 16384, /* data sheet says 8192, but fifo really holds 16384 samples */
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6711,
caldac: {ad8804_debug},
},
aobits: 12,
ao_unipolar: 0,
ao_fifo_depth: 16384,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6711,
caldac: {ad8804_debug},
},
aobits: 12,
ao_unipolar: 0,
ao_fifo_depth: 16384,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6713,
caldac: {ad8804_debug,ad8804_debug},
},
aobits: 12,
ao_unipolar: 0,
ao_fifo_depth: 16384,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6713,
caldac: {ad8804_debug,ad8804_debug},
},
aobits: 16,
ao_unipolar: 0,
ao_fifo_depth: 8192,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6711,
caldac: {ad8804_debug},
},
aobits: 16,
ao_unipolar: 0,
ao_fifo_depth: 8192,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6711,
caldac: {ad8804_debug},
},
aobits: 16,
ao_unipolar: 0,
ao_fifo_depth: 16384,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6713,
caldac: {ad8804_debug,ad8804_debug},
},
aobits: 16,
ao_unipolar: 0,
ao_fifo_depth: 16384,
+ .ao_range_table = &range_bipolar10,
reg_type: ni_reg_6713,
caldac: {ad8804_debug,ad8804_debug},
},
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {ad8804_debug},
has_8255: 0,
n_aochan: 2,
aobits: 12,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {mb88341},
has_8255: 0,
aobits: 16,
ao_unipolar: 1,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
caldac: {mb88341,mb88341,ad8522},
},
{ device_id: 0x1580,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 2048,
+ .ao_range_table = &range_ni_E_ao_ext,
ao_unipolar: 1,
caldac: {dac8800,dac8043,ad8522},
},
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 0,
+ .ao_range_table = &range_bipolar10,
ao_unipolar: 0,
caldac: {ad8804_debug},
has_8255: 0,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_622x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 0,
// ao_speed: 1200,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_622x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 0,
// ao_speed: 1200,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_622x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 0,
// ao_speed: 1200,
n_aochan: 4,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_622x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 0,
// ao_speed: 1200,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_625x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 0,
// ao_speed: 357,
n_aochan: 4,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_625x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 0,
// ao_speed: 357,
n_aochan: 2,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_628x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 1,
// ao_speed: 357,
n_aochan: 4,
aobits: 16,
ao_fifo_depth: 8191,
+ .ao_range_table = &range_ni_M_628x_ao,
reg_type: ni_reg_m_series,
ao_unipolar: 1,
// ao_speed: 357,