Take into account different number of dio channels on various
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 11 Jun 2007 19:38:26 +0000 (19:38 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 11 Jun 2007 19:38:26 +0000 (19:38 +0000)
m-series boards.

comedi/drivers/ni_atmio.c
comedi/drivers/ni_mio_common.c
comedi/drivers/ni_mio_cs.c
comedi/drivers/ni_pcimio.c
comedi/drivers/ni_stc.h

index 73e82fc0fd2674ecb1dc705723917a1bfb9569bd..8cdffcf9f114156f43c5059601806e22d535fc0c 100644 (file)
@@ -132,6 +132,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    1,
                ao_speed:       1000,
                has_8255:       0,
+               .num_p0_dio_channels = 8,
                caldac:         {mb88341},
        },
        {       device_id:      25,
@@ -150,6 +151,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    1,
                ao_speed:       1000,
                has_8255:       0,
+               .num_p0_dio_channels = 8,
                caldac:         {mb88341},
        },
        {       device_id:      36,
@@ -167,6 +169,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       10000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -185,6 +188,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       10000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       1,
        },
@@ -204,6 +208,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    1,
                ao_speed:       1000,
                has_8255:       0,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
        },
        {       device_id:      39,
@@ -221,6 +226,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       50000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043},
                has_8255:       0,
        },
@@ -239,6 +245,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        },
@@ -255,6 +262,7 @@ static ni_board ni_boards[]={
                aobits:         0,
                ao_fifo_depth:  0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        }
index 2ad051555ceeb48d09ab879656de13825c19064b..56f2cd2a07d7102bba17e09ec2584bdbc2354769 100644 (file)
@@ -3461,15 +3461,14 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it)
        s->maxdata=1;
        s->io_bits=0;           /* all bits input */
        s->range_table=&range_digital;
+       s->n_chan = boardtype.num_p0_dio_channels;
        if(boardtype.reg_type & ni_reg_m_series_mask)
        {
-               s->n_chan = 32;
                s->insn_bits = ni_m_series_dio_insn_bits;
                s->insn_config=ni_m_series_dio_insn_config;
                ni_writel(s->io_bits, M_Offset_DIO_Direction);
        }else
        {
-               s->n_chan=8;
                s->insn_bits=ni_dio_insn_bits;
                s->insn_config=ni_dio_insn_config;
                devpriv->dio_control = DIO_Pins_Dir(s->io_bits);
index 7403c73eef4fdb46e5b00f5144eed1c15a547700..fcce23a8508a4b41870f37f3efb04ed68bd0aa50 100644 (file)
@@ -80,6 +80,7 @@ static ni_board ni_boards[]={
                aobits:         0,
                ao_fifo_depth:  0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                has_8255:       0,
                caldac:         {dac8800,dac8043},
        },
@@ -95,6 +96,7 @@ static ni_board ni_boards[]={
                aobits:         0,
                ao_fifo_depth:  0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                has_8255:       0,
                caldac:         {mb88341}, /* verified */
        },
@@ -112,6 +114,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       1176,
+               .num_p0_dio_channels = 8,
                has_8255:       0,
                caldac:         {ad8804_debug}, /* verified */
        },
@@ -129,6 +132,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       1000000,
+               .num_p0_dio_channels = 8,
                has_8255:       0,
                caldac:         {ad8804_debug},
        },
@@ -146,6 +150,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       1000000,
+               .num_p0_dio_channels = 8,
                has_8255:       0,
                caldac:         {ad8804_debug},
        },
@@ -156,6 +161,7 @@ static ni_board ni_boards[]={
                n_aochan:       8,
                aobits:         12,
                ao_671x:        8192,
+               .num_p0_dio_channels = 8,
                caldac:         {mb88341,mb88341},
        },
 #endif
index d2ffef636d1d8d37a69005cd216680828854cc7e..465f17a44e040a9989ceb23a5fa9a58cb7bf7c15 100644 (file)
@@ -225,6 +225,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       50000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043},
                has_8255:       0,
        },
@@ -242,6 +243,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       10000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        },
@@ -259,6 +261,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       100000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -276,6 +279,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       10000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        },
@@ -294,6 +298,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {mb88341},
                has_8255:       0,
        },
@@ -313,6 +318,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug}, // doc says mb88341
                has_8255:       0,
        },
@@ -330,6 +336,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {mb88341},
                has_8255:       0,
        },
@@ -348,6 +355,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       10000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        },
@@ -363,6 +371,7 @@ static ni_board ni_boards[]={
                aobits:         0,
                ao_fifo_depth:  0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        },
@@ -378,6 +387,7 @@ static ni_board ni_boards[]={
                aobits:         0,
                ao_fifo_depth:  0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
                has_8255:       0,
        },
@@ -395,6 +405,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -409,6 +420,7 @@ static ni_board ni_boards[]={
                n_aochan:       0,
                aobits:         0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug}, /* manual is wrong */
                has_8255:       0,
        },
@@ -426,6 +438,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       100000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug}, /* manual is wrong */
                has_8255:       0,
        },
@@ -443,6 +456,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       100000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug}, /* manual is wrong */
                has_8255:       1,
        },
@@ -460,6 +474,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       100000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug}, /* manual is wrong */
                has_8255:       1,
        },
@@ -476,6 +491,7 @@ static ni_board ni_boards[]={
                aobits:         0,
                ao_fifo_depth:  0,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -493,6 +509,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       100000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -510,6 +527,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  2048,
                .ao_range_table = &range_ni_E_ao_ext,
                ao_speed:       3000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug,ad8804_debug,ad8522}, /* manual is wrong */
        },
        {       device_id:      0x14e0,
@@ -527,6 +545,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    0,
                ao_fifo_depth:  2048,
                ao_speed:       250,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804,ad8804},
        },
        {       device_id:      0x14f0,
@@ -544,6 +563,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    0,
                ao_fifo_depth:  2048,
                ao_speed:       250,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804,ad8804},
        },
 #if 0
@@ -562,6 +582,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    0,
                ao_fifo_depth:  2048,
                ao_speed:       250,
+               .num_p0_dio_channels = 8,
                reg_611x:       1,
                caldac:         {ad8804_debug,ad8804_debug,ad8804_debug},/* XXX */
        },
@@ -582,6 +603,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  2048,
                ao_speed:       250,
                reg_611x:       1,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug,ad8804_debug,ad8804_debug},/* XXX */
        },
 #endif
@@ -594,6 +616,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  16384, /* data sheet says 8192, but fifo really holds 16384 samples */
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6711,
                caldac:         {ad8804_debug},
        },
@@ -606,6 +629,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  16384,
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6711,
                caldac:         {ad8804_debug},
        },
@@ -618,6 +642,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  16384,
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6713,
                caldac:         {ad8804_debug,ad8804_debug},
        },
@@ -630,6 +655,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  16384,
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6713,
                caldac:         {ad8804_debug,ad8804_debug},
        },
@@ -642,6 +668,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  8192,
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6711,
                caldac:         {ad8804_debug},
        },
@@ -654,6 +681,7 @@ static ni_board ni_boards[]={
                ao_unipolar:    0,
                ao_fifo_depth:  8192,
                .ao_range_table = &range_bipolar10,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6711,
                caldac:         {ad8804_debug},
        },
@@ -667,6 +695,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  16384,
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6713,
                caldac:         {ad8804_debug,ad8804_debug},
        },
@@ -679,6 +708,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  16384,
                .ao_range_table = &range_bipolar10,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_6713,
                caldac:         {ad8804_debug,ad8804_debug},
        },
@@ -696,6 +726,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -713,6 +744,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       1000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -730,6 +762,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  2048,
                .ao_range_table = &range_ni_E_ao_ext,
                ao_speed:       3000,
+               .num_p0_dio_channels = 8,
                caldac:         {mb88341,mb88341,ad8522},
        },
        {       device_id:      0x1580,
@@ -746,6 +779,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_ni_E_ao_ext,
                ao_unipolar:    1,
                ao_speed:       10000,
+               .num_p0_dio_channels = 8,
                caldac:         {dac8800,dac8043,ad8522},
        },
        {       device_id:      0x2890,
@@ -762,6 +796,7 @@ static ni_board ni_boards[]={
                .ao_range_table = &range_bipolar10,
                ao_unipolar:    0,
                ao_speed:       100000,
+               .num_p0_dio_channels = 8,
                caldac:         {ad8804_debug},
                has_8255:       0,
        },
@@ -775,6 +810,7 @@ static ni_board ni_boards[]={
                n_aochan:       0,
                aobits:         0,
                ao_fifo_depth:  0,
+               .num_p0_dio_channels = 8,
                reg_type:       ni_reg_622x,
                ao_unipolar:    0,
                .caldac = {caldac_none},
@@ -794,6 +830,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_622x,
                ao_unipolar:    0,
                ao_speed:       1200,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -811,6 +848,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_622x,
                ao_unipolar:    0,
                ao_speed:       1200,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -826,6 +864,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  0,
                reg_type:       ni_reg_622x,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -843,6 +882,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_622x,
                ao_unipolar:    0,
                ao_speed:       1200,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -860,6 +900,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_622x,
                ao_unipolar:    0,
                ao_speed:       1200,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -875,6 +916,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  0,
                reg_type:       ni_reg_625x,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -892,6 +934,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_625x,
                ao_unipolar:    0,
                ao_speed:       357,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -909,6 +952,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_625x,
                ao_unipolar:    0,
                ao_speed:       357,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -924,6 +968,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  0,
                reg_type:       ni_reg_625x,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -941,6 +986,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_625x,
                ao_unipolar:    0,
                ao_speed:       357,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -958,6 +1004,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_625x,
                ao_unipolar:    0,
                ao_speed:       357,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -973,6 +1020,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  8191,
                reg_type:       ni_reg_628x,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -990,6 +1038,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_628x,
                ao_unipolar:    1,
                ao_speed:       357,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -1007,6 +1056,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_628x,
                ao_unipolar:    1,
                ao_speed:       357,
+               .num_p0_dio_channels = 8,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -1022,6 +1072,7 @@ static ni_board ni_boards[]={
                ao_fifo_depth:  0,
                reg_type:       ni_reg_628x,
                ao_unipolar:    0,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -1039,6 +1090,7 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_628x,
                ao_unipolar:    1,
                ao_speed:       357,
+               .num_p0_dio_channels = 32,
                .caldac = {caldac_none},
                has_8255:       0,
        },
@@ -1055,7 +1107,8 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_6143,
                ao_unipolar:    0,
                ao_fifo_depth:  0,
-               caldac:         {ad8804_debug,ad8804_debug},
+               .num_p0_dio_channels = 8,
+               .caldac = {ad8804_debug,ad8804_debug},
        },
        {       device_id:      0x710D,
                name:           "pxi-6143",
@@ -1070,7 +1123,8 @@ static ni_board ni_boards[]={
                reg_type:       ni_reg_6143,
                ao_unipolar:    0,
                ao_fifo_depth:  0,
-               caldac:         {ad8804_debug,ad8804_debug},
+               .num_p0_dio_channels = 8,
+               .caldac = {ad8804_debug,ad8804_debug},
        },
 };
 #define n_pcimio_boards ((sizeof(ni_boards)/sizeof(ni_boards[0])))
index bd935a5f700cad0b45cc2023ae217f08eb34859c..d16268689f4f314a05574abd5ecaa5da0224eb82 100644 (file)
@@ -1258,13 +1258,13 @@ typedef struct ni_board_struct{
 
        int n_aochan;
        int aobits;
-
        int ao_fifo_depth;
        comedi_lrange *ao_range_table;
        unsigned ao_speed;
 
-       int reg_type;
+       unsigned num_p0_dio_channels;
 
+       int reg_type;
        unsigned int ao_unipolar : 1;
        unsigned int has_8255 : 1;
        unsigned int has_analog_trig : 1;