Commit 5bebf228 authored by Ian Abbott's avatar Ian Abbott Committed by Jiri Slaby

staging: comedi: cb_pcidas64: fix incorrect AI range code handling

commit be8e8908 upstream.

The hardware range code values and list of valid ranges for the AI
subdevice is incorrect for several supported boards.  The hardware range
code values for all boards except PCI-DAS4020/12 is determined by
calling `ai_range_bits_6xxx()` based on the maximum voltage of the range
and whether it is bipolar or unipolar, however it only returns the
correct hardware range code for the PCI-DAS60xx boards.  For
PCI-DAS6402/16 (and /12) it returns the wrong code for the unipolar
ranges.  For PCI-DAS64/Mx/16 it returns the wrong code for all the
ranges and the comedi range table is incorrect.

Change `ai_range_bits_6xxx()` to use a look-up table pointed to by new
member `ai_range_codes` of `struct pcidas64_board` to map the comedi
range table indices to the hardware range codes.  Use a new comedi range
table for the PCI-DAS64/Mx/16 boards (and the commented out variants).
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 52235599
...@@ -451,6 +451,29 @@ static const struct comedi_lrange ai_ranges_64xx = { ...@@ -451,6 +451,29 @@ static const struct comedi_lrange ai_ranges_64xx = {
} }
}; };
static const uint8_t ai_range_code_64xx[8] = {
0x0, 0x1, 0x2, 0x3, /* bipolar 10, 5, 2,5, 1.25 */
0x8, 0x9, 0xa, 0xb /* unipolar 10, 5, 2.5, 1.25 */
};
/* analog input ranges for 64-Mx boards */
static const struct comedi_lrange ai_ranges_64_mx = {
7, {
BIP_RANGE(5),
BIP_RANGE(2.5),
BIP_RANGE(1.25),
BIP_RANGE(0.625),
UNI_RANGE(5),
UNI_RANGE(2.5),
UNI_RANGE(1.25)
}
};
static const uint8_t ai_range_code_64_mx[7] = {
0x0, 0x1, 0x2, 0x3, /* bipolar 5, 2.5, 1.25, 0.625 */
0x9, 0xa, 0xb /* unipolar 5, 2.5, 1.25 */
};
/* analog input ranges for 60xx boards */ /* analog input ranges for 60xx boards */
static const struct comedi_lrange ai_ranges_60xx = { static const struct comedi_lrange ai_ranges_60xx = {
4, 4,
...@@ -462,6 +485,10 @@ static const struct comedi_lrange ai_ranges_60xx = { ...@@ -462,6 +485,10 @@ static const struct comedi_lrange ai_ranges_60xx = {
} }
}; };
static const uint8_t ai_range_code_60xx[4] = {
0x0, 0x1, 0x4, 0x7 /* bipolar 10, 5, 0.5, 0.05 */
};
/* analog input ranges for 6030, etc boards */ /* analog input ranges for 6030, etc boards */
static const struct comedi_lrange ai_ranges_6030 = { static const struct comedi_lrange ai_ranges_6030 = {
14, 14,
...@@ -483,6 +510,11 @@ static const struct comedi_lrange ai_ranges_6030 = { ...@@ -483,6 +510,11 @@ static const struct comedi_lrange ai_ranges_6030 = {
} }
}; };
static const uint8_t ai_range_code_6030[14] = {
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */
0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */
};
/* analog input ranges for 6052, etc boards */ /* analog input ranges for 6052, etc boards */
static const struct comedi_lrange ai_ranges_6052 = { static const struct comedi_lrange ai_ranges_6052 = {
15, 15,
...@@ -505,6 +537,11 @@ static const struct comedi_lrange ai_ranges_6052 = { ...@@ -505,6 +537,11 @@ static const struct comedi_lrange ai_ranges_6052 = {
} }
}; };
static const uint8_t ai_range_code_6052[15] = {
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, /* bipolar 10 ... 0.05 */
0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* unipolar 10 ... 0.1 */
};
/* analog input ranges for 4020 board */ /* analog input ranges for 4020 board */
static const struct comedi_lrange ai_ranges_4020 = { static const struct comedi_lrange ai_ranges_4020 = {
2, 2,
...@@ -612,6 +649,7 @@ struct pcidas64_board { ...@@ -612,6 +649,7 @@ struct pcidas64_board {
int ai_bits; /* analog input resolution */ int ai_bits; /* analog input resolution */
int ai_speed; /* fastest conversion period in ns */ int ai_speed; /* fastest conversion period in ns */
const struct comedi_lrange *ai_range_table; const struct comedi_lrange *ai_range_table;
const uint8_t *ai_range_code;
int ao_nchan; /* number of analog out channels */ int ao_nchan; /* number of analog out channels */
int ao_bits; /* analog output resolution */ int ao_bits; /* analog output resolution */
int ao_scan_speed; /* analog output scan speed */ int ao_scan_speed; /* analog output scan speed */
...@@ -670,6 +708,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -670,6 +708,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64xx,
.ai_range_code = ai_range_code_64xx,
.ao_range_table = &ao_ranges_64xx, .ao_range_table = &ao_ranges_64xx,
.ao_range_code = ao_range_code_64xx, .ao_range_code = ao_range_code_64xx,
.ai_fifo = &ai_fifo_64xx, .ai_fifo = &ai_fifo_64xx,
...@@ -685,6 +724,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -685,6 +724,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64xx,
.ai_range_code = ai_range_code_64xx,
.ao_range_table = &ao_ranges_64xx, .ao_range_table = &ao_ranges_64xx,
.ao_range_code = ao_range_code_64xx, .ao_range_code = ao_range_code_64xx,
.ai_fifo = &ai_fifo_64xx, .ai_fifo = &ai_fifo_64xx,
...@@ -699,7 +739,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -699,7 +739,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_bits = 16, .ao_bits = 16,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ao_range_table = &ao_ranges_64xx, .ao_range_table = &ao_ranges_64xx,
.ao_range_code = ao_range_code_64xx, .ao_range_code = ao_range_code_64xx,
.ai_fifo = &ai_fifo_64xx, .ai_fifo = &ai_fifo_64xx,
...@@ -714,7 +755,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -714,7 +755,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_bits = 16, .ao_bits = 16,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ao_range_table = &ao_ranges_64xx, .ao_range_table = &ao_ranges_64xx,
.ao_range_code = ao_range_code_64xx, .ao_range_code = ao_range_code_64xx,
.ai_fifo = &ai_fifo_64xx, .ai_fifo = &ai_fifo_64xx,
...@@ -729,7 +771,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -729,7 +771,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_bits = 16, .ao_bits = 16,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ao_range_table = &ao_ranges_64xx, .ao_range_table = &ao_ranges_64xx,
.ao_range_code = ao_range_code_64xx, .ao_range_code = ao_range_code_64xx,
.ai_fifo = &ai_fifo_64xx, .ai_fifo = &ai_fifo_64xx,
...@@ -744,6 +787,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -744,6 +787,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_bits = 16, .ao_bits = 16,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ao_range_table = &range_bipolar10, .ao_range_table = &range_bipolar10,
.ao_range_code = ao_range_code_60xx, .ao_range_code = ao_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -759,6 +803,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -759,6 +803,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 100000, .ao_scan_speed = 100000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ao_range_table = &range_bipolar10, .ao_range_table = &range_bipolar10,
.ao_range_code = ao_range_code_60xx, .ao_range_code = ao_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -773,6 +818,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -773,6 +818,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 100000, .ao_scan_speed = 100000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ao_range_table = &range_bipolar10, .ao_range_table = &range_bipolar10,
.ao_range_code = ao_range_code_60xx, .ao_range_code = ao_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -788,6 +834,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -788,6 +834,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 100000, .ao_scan_speed = 100000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ao_range_table = &range_bipolar10, .ao_range_table = &range_bipolar10,
.ao_range_code = ao_range_code_60xx, .ao_range_code = ao_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -803,6 +850,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -803,6 +850,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6030, .ai_range_table = &ai_ranges_6030,
.ai_range_code = ai_range_code_6030,
.ao_range_table = &ao_ranges_6030, .ao_range_table = &ao_ranges_6030,
.ao_range_code = ao_range_code_6030, .ao_range_code = ao_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -818,6 +866,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -818,6 +866,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6030, .ai_range_table = &ai_ranges_6030,
.ai_range_code = ai_range_code_6030,
.ao_range_table = &ao_ranges_6030, .ao_range_table = &ao_ranges_6030,
.ao_range_code = ao_range_code_6030, .ao_range_code = ao_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -831,6 +880,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -831,6 +880,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 0, .ao_nchan = 0,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6030, .ai_range_table = &ai_ranges_6030,
.ai_range_code = ai_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
.has_8255 = 0, .has_8255 = 0,
}, },
...@@ -842,6 +892,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -842,6 +892,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 0, .ao_nchan = 0,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6030, .ai_range_table = &ai_ranges_6030,
.ai_range_code = ai_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
.has_8255 = 0, .has_8255 = 0,
}, },
...@@ -854,6 +905,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -854,6 +905,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 0, .ao_scan_speed = 0,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
.has_8255 = 0, .has_8255 = 0,
}, },
...@@ -867,6 +919,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -867,6 +919,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 100000, .ao_scan_speed = 100000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ao_range_table = &range_bipolar10, .ao_range_table = &range_bipolar10,
.ao_range_code = ao_range_code_60xx, .ao_range_code = ao_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -882,6 +935,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -882,6 +935,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 100000, .ao_scan_speed = 100000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_60xx, .ai_range_table = &ai_ranges_60xx,
.ai_range_code = ai_range_code_60xx,
.ao_range_table = &range_bipolar10, .ao_range_table = &range_bipolar10,
.ao_range_code = ao_range_code_60xx, .ao_range_code = ao_range_code_60xx,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -897,6 +951,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -897,6 +951,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 1000, .ao_scan_speed = 1000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6052, .ai_range_table = &ai_ranges_6052,
.ai_range_code = ai_range_code_6052,
.ao_range_table = &ao_ranges_6030, .ao_range_table = &ao_ranges_6030,
.ao_range_code = ao_range_code_6030, .ao_range_code = ao_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -912,6 +967,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -912,6 +967,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 3333, .ao_scan_speed = 3333,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6052, .ai_range_table = &ai_ranges_6052,
.ai_range_code = ai_range_code_6052,
.ao_range_table = &ao_ranges_6030, .ao_range_table = &ao_ranges_6030,
.ao_range_code = ao_range_code_6030, .ao_range_code = ao_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -927,6 +983,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -927,6 +983,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 1000, .ao_scan_speed = 1000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6052, .ai_range_table = &ai_ranges_6052,
.ai_range_code = ai_range_code_6052,
.ao_range_table = &ao_ranges_6030, .ao_range_table = &ao_ranges_6030,
.ao_range_code = ao_range_code_6030, .ao_range_code = ao_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -942,6 +999,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -942,6 +999,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 1000, .ao_scan_speed = 1000,
.layout = LAYOUT_60XX, .layout = LAYOUT_60XX,
.ai_range_table = &ai_ranges_6052, .ai_range_table = &ai_ranges_6052,
.ai_range_code = ai_range_code_6052,
.ao_range_table = &ao_ranges_6030, .ao_range_table = &ao_ranges_6030,
.ao_range_code = ao_range_code_6030, .ao_range_code = ao_range_code_6030,
.ai_fifo = &ai_fifo_60xx, .ai_fifo = &ai_fifo_60xx,
...@@ -976,6 +1034,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -976,6 +1034,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64xx,
.ai_range_code = ai_range_code_64xx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -987,7 +1046,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -987,7 +1046,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 0, .ao_nchan = 0,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -999,7 +1059,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -999,7 +1059,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 0, .ao_nchan = 0,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -1011,7 +1072,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -1011,7 +1072,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 0, .ao_nchan = 0,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -1023,7 +1085,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -1023,7 +1085,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 2, .ao_nchan = 2,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -1035,7 +1098,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -1035,7 +1098,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 2, .ao_nchan = 2,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -1047,7 +1111,8 @@ static const struct pcidas64_board pcidas64_boards[] = { ...@@ -1047,7 +1111,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
.ao_nchan = 2, .ao_nchan = 2,
.ao_scan_speed = 10000, .ao_scan_speed = 10000,
.layout = LAYOUT_64XX, .layout = LAYOUT_64XX,
.ai_range_table = &ai_ranges_64xx, .ai_range_table = &ai_ranges_64_mx,
.ai_range_code = ai_range_code_64_mx,
.ai_fifo = ai_fifo_64xx, .ai_fifo = ai_fifo_64xx,
.has_8255 = 1, .has_8255 = 1,
}, },
...@@ -1144,45 +1209,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev, ...@@ -1144,45 +1209,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev,
unsigned int range_index) unsigned int range_index)
{ {
const struct pcidas64_board *thisboard = comedi_board(dev); const struct pcidas64_board *thisboard = comedi_board(dev);
const struct comedi_krange *range =
&thisboard->ai_range_table->range[range_index];
unsigned int bits = 0;
switch (range->max) { return thisboard->ai_range_code[range_index] << 8;
case 10000000:
bits = 0x000;
break;
case 5000000:
bits = 0x100;
break;
case 2000000:
case 2500000:
bits = 0x200;
break;
case 1000000:
case 1250000:
bits = 0x300;
break;
case 500000:
bits = 0x400;
break;
case 200000:
case 250000:
bits = 0x500;
break;
case 100000:
bits = 0x600;
break;
case 50000:
bits = 0x700;
break;
default:
comedi_error(dev, "bug! in ai_range_bits_6xxx");
break;
}
if (range->min == 0)
bits += 0x900;
return bits;
} }
static unsigned int hw_revision(const struct comedi_device *dev, static unsigned int hw_revision(const struct comedi_device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment