Xenomai API  2.5.6.1
ksrc/drivers/analogy/national_instruments/ni_stc.h
Go to the documentation of this file.
00001 
00026 #ifndef __ANALOGY_NI_STC_H__
00027 #define __ANALOGY_NI_STC_H__
00028 
00029 #include "ni_tio.h"
00030 
00031 #define _bit15          0x8000
00032 #define _bit14          0x4000
00033 #define _bit13          0x2000
00034 #define _bit12          0x1000
00035 #define _bit11          0x0800
00036 #define _bit10          0x0400
00037 #define _bit9           0x0200
00038 #define _bit8           0x0100
00039 #define _bit7           0x0080
00040 #define _bit6           0x0040
00041 #define _bit5           0x0020
00042 #define _bit4           0x0010
00043 #define _bit3           0x0008
00044 #define _bit2           0x0004
00045 #define _bit1           0x0002
00046 #define _bit0           0x0001
00047 
00048 #define NUM_PFI_OUTPUT_SELECT_REGS 6
00049 
00050 /* Registers in the National Instruments DAQ-STC chip */
00051 
00052 #define Interrupt_A_Ack_Register        2
00053 #define G0_Gate_Interrupt_Ack                   _bit15
00054 #define G0_TC_Interrupt_Ack                     _bit14
00055 #define AI_Error_Interrupt_Ack                  _bit13
00056 #define AI_STOP_Interrupt_Ack                   _bit12
00057 #define AI_START_Interrupt_Ack                  _bit11
00058 #define AI_START2_Interrupt_Ack                 _bit10
00059 #define AI_START1_Interrupt_Ack                 _bit9
00060 #define AI_SC_TC_Interrupt_Ack                  _bit8
00061 #define AI_SC_TC_Error_Confirm                  _bit7
00062 #define G0_TC_Error_Confirm                     _bit6
00063 #define G0_Gate_Error_Confirm                   _bit5
00064 
00065 #define AI_Status_1_Register            2
00066 #define Interrupt_A_St                          _bit15
00067 #define AI_FIFO_Full_St                         _bit14
00068 #define AI_FIFO_Half_Full_St                    _bit13
00069 #define AI_FIFO_Empty_St                        _bit12
00070 #define AI_Overrun_St                           _bit11
00071 #define AI_Overflow_St                          _bit10
00072 #define AI_SC_TC_Error_St                       _bit9
00073 #define AI_START2_St                            _bit8
00074 #define AI_START1_St                            _bit7
00075 #define AI_SC_TC_St                             _bit6
00076 #define AI_START_St                             _bit5
00077 #define AI_STOP_St                              _bit4
00078 #define G0_TC_St                                _bit3
00079 #define G0_Gate_Interrupt_St                    _bit2
00080 #define AI_FIFO_Request_St                      _bit1
00081 #define Pass_Thru_0_Interrupt_St                _bit0
00082 
00083 #define AI_Status_2_Register            5
00084 
00085 #define Interrupt_B_Ack_Register        3
00086 #define G1_Gate_Error_Confirm                   _bit1
00087 #define G1_TC_Error_Confirm                     _bit2
00088 #define AO_BC_TC_Trigger_Error_Confirm          _bit3
00089 #define AO_BC_TC_Error_Confirm                  _bit4
00090 #define AO_UI2_TC_Error_Confrim                 _bit5
00091 #define AO_UI2_TC_Interrupt_Ack                 _bit6
00092 #define AO_UC_TC_Interrupt_Ack                  _bit7
00093 #define AO_BC_TC_Interrupt_Ack                  _bit8
00094 #define AO_START1_Interrupt_Ack                 _bit9
00095 #define AO_UPDATE_Interrupt_Ack                 _bit10
00096 #define AO_START_Interrupt_Ack                  _bit11
00097 #define AO_STOP_Interrupt_Ack                   _bit12
00098 #define AO_Error_Interrupt_Ack                  _bit13
00099 #define G1_TC_Interrupt_Ack                     _bit14
00100 #define G1_Gate_Interrupt_Ack                   _bit15
00101 
00102 #define AO_Status_1_Register            3
00103 #define Interrupt_B_St                          _bit15
00104 #define AO_FIFO_Full_St                         _bit14
00105 #define AO_FIFO_Half_Full_St                    _bit13
00106 #define AO_FIFO_Empty_St                        _bit12
00107 #define AO_BC_TC_Error_St                       _bit11
00108 #define AO_START_St                             _bit10
00109 #define AO_Overrun_St                           _bit9
00110 #define AO_START1_St                            _bit8
00111 #define AO_BC_TC_St                             _bit7
00112 #define AO_UC_TC_St                             _bit6
00113 #define AO_UPDATE_St                            _bit5
00114 #define AO_UI2_TC_St                            _bit4
00115 #define G1_TC_St                                _bit3
00116 #define G1_Gate_Interrupt_St                    _bit2
00117 #define AO_FIFO_Request_St                      _bit1
00118 #define Pass_Thru_1_Interrupt_St                _bit0
00119 
00120 
00121 #define AI_Command_2_Register           4
00122 #define AI_End_On_SC_TC                         _bit15
00123 #define AI_End_On_End_Of_Scan                   _bit14
00124 #define AI_START1_Disable                       _bit11
00125 #define AI_SC_Save_Trace                        _bit10
00126 #define AI_SI_Switch_Load_On_SC_TC              _bit9
00127 #define AI_SI_Switch_Load_On_STOP               _bit8
00128 #define AI_SI_Switch_Load_On_TC                 _bit7
00129 #define AI_SC_Switch_Load_On_TC                 _bit4
00130 #define AI_STOP_Pulse                           _bit3
00131 #define AI_START_Pulse                          _bit2
00132 #define AI_START2_Pulse                         _bit1
00133 #define AI_START1_Pulse                         _bit0
00134 
00135 #define AO_Command_2_Register           5
00136 #define AO_End_On_BC_TC(x)                      (((x) & 0x3) << 14)
00137 #define AO_Start_Stop_Gate_Enable               _bit13
00138 #define AO_UC_Save_Trace                        _bit12
00139 #define AO_BC_Gate_Enable                       _bit11
00140 #define AO_BC_Save_Trace                        _bit10
00141 #define AO_UI_Switch_Load_On_BC_TC              _bit9
00142 #define AO_UI_Switch_Load_On_Stop               _bit8
00143 #define AO_UI_Switch_Load_On_TC                 _bit7
00144 #define AO_UC_Switch_Load_On_BC_TC              _bit6
00145 #define AO_UC_Switch_Load_On_TC                 _bit5
00146 #define AO_BC_Switch_Load_On_TC                 _bit4
00147 #define AO_Mute_B                               _bit3
00148 #define AO_Mute_A                               _bit2
00149 #define AO_UPDATE2_Pulse                        _bit1
00150 #define AO_START1_Pulse                         _bit0
00151 
00152 #define AO_Status_2_Register            6
00153 
00154 #define DIO_Parallel_Input_Register     7
00155 
00156 #define AI_Command_1_Register           8
00157 #define AI_Analog_Trigger_Reset                 _bit14
00158 #define AI_Disarm                               _bit13
00159 #define AI_SI2_Arm                              _bit12
00160 #define AI_SI2_Load                             _bit11
00161 #define AI_SI_Arm                               _bit10
00162 #define AI_SI_Load                              _bit9
00163 #define AI_DIV_Arm                              _bit8
00164 #define AI_DIV_Load                             _bit7
00165 #define AI_SC_Arm                               _bit6
00166 #define AI_SC_Load                              _bit5
00167 #define AI_SCAN_IN_PROG_Pulse                   _bit4
00168 #define AI_EXTMUX_CLK_Pulse                     _bit3
00169 #define AI_LOCALMUX_CLK_Pulse                   _bit2
00170 #define AI_SC_TC_Pulse                          _bit1
00171 #define AI_CONVERT_Pulse                        _bit0
00172 
00173 #define AO_Command_1_Register           9
00174 #define AO_Analog_Trigger_Reset                 _bit15
00175 #define AO_START_Pulse                          _bit14
00176 #define AO_Disarm                               _bit13
00177 #define AO_UI2_Arm_Disarm                       _bit12
00178 #define AO_UI2_Load                             _bit11
00179 #define AO_UI_Arm                               _bit10
00180 #define AO_UI_Load                              _bit9
00181 #define AO_UC_Arm                               _bit8
00182 #define AO_UC_Load                              _bit7
00183 #define AO_BC_Arm                               _bit6
00184 #define AO_BC_Load                              _bit5
00185 #define AO_DAC1_Update_Mode                     _bit4
00186 #define AO_LDAC1_Source_Select                  _bit3
00187 #define AO_DAC0_Update_Mode                     _bit2
00188 #define AO_LDAC0_Source_Select                  _bit1
00189 #define AO_UPDATE_Pulse                         _bit0
00190 
00191 
00192 #define DIO_Output_Register             10
00193 #define DIO_Parallel_Data_Out(a)                ((a)&0xff)
00194 #define DIO_Parallel_Data_Mask                  0xff
00195 #define DIO_SDOUT                               _bit0
00196 #define DIO_SDIN                                _bit4
00197 #define DIO_Serial_Data_Out(a)                  (((a)&0xff)<<8)
00198 #define DIO_Serial_Data_Mask                    0xff00
00199 
00200 #define DIO_Control_Register            11
00201 #define DIO_Software_Serial_Control             _bit11
00202 #define DIO_HW_Serial_Timebase                  _bit10
00203 #define DIO_HW_Serial_Enable                    _bit9
00204 #define DIO_HW_Serial_Start                     _bit8
00205 #define DIO_Pins_Dir(a)                         ((a)&0xff)
00206 #define DIO_Pins_Dir_Mask                       0xff
00207 
00208 #define AI_Mode_1_Register              12
00209 #define AI_CONVERT_Source_Select(a)             (((a) & 0x1f) << 11)
00210 #define AI_SI_Source_select(a)                  (((a) & 0x1f) << 6)
00211 #define AI_CONVERT_Source_Polarity              _bit5
00212 #define AI_SI_Source_Polarity           _bit4
00213 #define AI_Start_Stop                           _bit3
00214 #define AI_Mode_1_Reserved                      _bit2
00215 #define AI_Continuous                           _bit1
00216 #define AI_Trigger_Once                         _bit0
00217 
00218 #define AI_Mode_2_Register              13
00219 #define AI_SC_Gate_Enable                       _bit15
00220 #define AI_Start_Stop_Gate_Enable               _bit14
00221 #define AI_Pre_Trigger                          _bit13
00222 #define AI_External_MUX_Present                 _bit12
00223 #define AI_SI2_Initial_Load_Source              _bit9
00224 #define AI_SI2_Reload_Mode                      _bit8
00225 #define AI_SI_Initial_Load_Source               _bit7
00226 #define AI_SI_Reload_Mode(a)                    (((a) & 0x7)<<4)
00227 #define AI_SI_Write_Switch                      _bit3
00228 #define AI_SC_Initial_Load_Source               _bit2
00229 #define AI_SC_Reload_Mode                       _bit1
00230 #define AI_SC_Write_Switch                      _bit0
00231 
00232 #define AI_SI_Load_A_Registers          14
00233 #define AI_SI_Load_B_Registers          16
00234 #define AI_SC_Load_A_Registers          18
00235 #define AI_SC_Load_B_Registers          20
00236 #define AI_SI_Save_Registers            64
00237 #define AI_SC_Save_Registers            66
00238 
00239 #define AI_SI2_Load_A_Register          23
00240 #define AI_SI2_Load_B_Register          25
00241 
00242 #define Joint_Status_1_Register         27
00243 #define DIO_Serial_IO_In_Progress_St            _bit12
00244 
00245 #define DIO_Serial_Input_Register       28
00246 #define Joint_Status_2_Register         29
00247 #define AO_TMRDACWRs_In_Progress_St             _bit5
00248 
00249 #define AO_Mode_1_Register              38
00250 #define AO_UPDATE_Source_Select(x)              (((x)&0x1f)<<11)
00251 #define AO_UI_Source_Select(x)                  (((x)&0x1f)<<6)
00252 #define AO_Multiple_Channels                    _bit5
00253 #define AO_UPDATE_Source_Polarity               _bit4
00254 #define AO_UI_Source_Polarity                   _bit3
00255 #define AO_UC_Switch_Load_Every_TC              _bit2
00256 #define AO_Continuous                           _bit1
00257 #define AO_Trigger_Once                         _bit0
00258 
00259 #define AO_Mode_2_Register              39
00260 #define AO_FIFO_Mode_Mask                       ( 0x3 << 14 )
00261 #define AO_FIFO_Mode_HF_to_F                    (3<<14)
00262 #define AO_FIFO_Mode_F                          (2<<14)
00263 #define AO_FIFO_Mode_HF                         (1<<14)
00264 #define AO_FIFO_Mode_E                          (0<<14)
00265 #define AO_FIFO_Retransmit_Enable               _bit13
00266 #define AO_START1_Disable                       _bit12
00267 #define AO_UC_Initial_Load_Source               _bit11
00268 #define AO_UC_Write_Switch                      _bit10
00269 #define AO_UI2_Initial_Load_Source              _bit9
00270 #define AO_UI2_Reload_Mode                      _bit8
00271 #define AO_UI_Initial_Load_Source               _bit7
00272 #define AO_UI_Reload_Mode(x)                    (((x) & 0x7) << 4)
00273 #define AO_UI_Write_Switch                      _bit3
00274 #define AO_BC_Initial_Load_Source               _bit2
00275 #define AO_BC_Reload_Mode                       _bit1
00276 #define AO_BC_Write_Switch                      _bit0
00277 
00278 #define AO_UI_Load_A_Register           40
00279 #define AO_UI_Load_A_Register_High      40
00280 #define AO_UI_Load_A_Register_Low       41
00281 #define AO_UI_Load_B_Register           42
00282 #define AO_UI_Save_Registers            16
00283 #define AO_BC_Load_A_Register           44
00284 #define AO_BC_Load_A_Register_High      44
00285 #define AO_BC_Load_A_Register_Low       45
00286 #define AO_BC_Load_B_Register           46
00287 #define AO_BC_Load_B_Register_High      46
00288 #define AO_BC_Load_B_Register_Low       47
00289 #define AO_BC_Save_Registers            18
00290 #define AO_UC_Load_A_Register           48
00291 #define AO_UC_Load_A_Register_High      48
00292 #define AO_UC_Load_A_Register_Low       49
00293 #define AO_UC_Load_B_Register           50
00294 #define AO_UC_Save_Registers            20
00295 
00296 #define Clock_and_FOUT_Register         56
00297 #define FOUT_Enable                             _bit15
00298 #define FOUT_Timebase_Select                    _bit14
00299 #define DIO_Serial_Out_Divide_By_2              _bit13
00300 #define Slow_Internal_Time_Divide_By_2          _bit12
00301 #define Slow_Internal_Timebase                  _bit11
00302 #define G_Source_Divide_By_2                    _bit10
00303 #define Clock_To_Board_Divide_By_2              _bit9
00304 #define Clock_To_Board                          _bit8
00305 #define AI_Output_Divide_By_2                   _bit7
00306 #define AI_Source_Divide_By_2                   _bit6
00307 #define AO_Output_Divide_By_2                   _bit5
00308 #define AO_Source_Divide_By_2                   _bit4
00309 #define FOUT_Divider_mask                       0xf
00310 #define FOUT_Divider(x)                         (((x) & 0xf) << 0)
00311 
00312 #define IO_Bidirection_Pin_Register     57
00313 #define RTSI_Trig_Direction_Register    58
00314 #define Drive_RTSI_Clock_Bit                    0x1
00315 #define Use_RTSI_Clock_Bit                      0x2
00316 
00317 static inline unsigned int RTSI_Output_Bit(unsigned channel, int is_mseries)
00318 {
00319         unsigned max_channel;
00320         unsigned base_bit_shift;
00321         if(is_mseries)
00322         {
00323                 base_bit_shift = 8;
00324                 max_channel = 7;
00325         }else
00326         {
00327                 base_bit_shift = 9;
00328                 max_channel = 6;
00329         }
00330         if(channel > max_channel)
00331         {
00332                 rtdm_printk("%s: bug, invalid RTSI_channel=%i\n",
00333                             __FUNCTION__, channel);
00334                 return 0;
00335         }
00336         return 1 << (base_bit_shift + channel);
00337 }
00338 
00339 #define Interrupt_Control_Register      59
00340 #define Interrupt_B_Enable                      _bit15
00341 #define Interrupt_B_Output_Select(x)            ((x)<<12)
00342 #define Interrupt_A_Enable                      _bit11
00343 #define Interrupt_A_Output_Select(x)            ((x)<<8)
00344 #define Pass_Thru_0_Interrupt_Polarity          _bit3
00345 #define Pass_Thru_1_Interrupt_Polarity          _bit2
00346 #define Interrupt_Output_On_3_Pins              _bit1
00347 #define Interrupt_Output_Polarity               _bit0
00348 
00349 #define AI_Output_Control_Register      60
00350 #define AI_START_Output_Select                  _bit10
00351 #define AI_SCAN_IN_PROG_Output_Select(x)        (((x) & 0x3) << 8)
00352 #define AI_EXTMUX_CLK_Output_Select(x)          (((x) & 0x3) << 6)
00353 #define AI_LOCALMUX_CLK_Output_Select(x)        ((x)<<4)
00354 #define AI_SC_TC_Output_Select(x)               ((x)<<2)
00355 #define AI_CONVERT_Output_High_Z                0
00356 #define AI_CONVERT_Output_Ground                1
00357 #define AI_CONVERT_Output_Enable_Low            2
00358 #define AI_CONVERT_Output_Enable_High           3
00359 #define AI_CONVERT_Output_Select(x)             ((x) & 0x3)
00360 
00361 #define AI_START_STOP_Select_Register   62
00362 #define AI_START_Polarity                       _bit15
00363 #define AI_STOP_Polarity                        _bit14
00364 #define AI_STOP_Sync                            _bit13
00365 #define AI_STOP_Edge                            _bit12
00366 #define AI_STOP_Select(a)                       (((a) & 0x1f)<<7)
00367 #define AI_START_Sync                           _bit6
00368 #define AI_START_Edge                           _bit5
00369 #define AI_START_Select(a)                      ((a) & 0x1f)
00370 
00371 #define AI_Trigger_Select_Register      63
00372 #define AI_START1_Polarity                      _bit15
00373 #define AI_START2_Polarity                      _bit14
00374 #define AI_START2_Sync                          _bit13
00375 #define AI_START2_Edge                          _bit12
00376 #define AI_START2_Select(a)                     (((a) & 0x1f) << 7)
00377 #define AI_START1_Sync                          _bit6
00378 #define AI_START1_Edge                          _bit5
00379 #define AI_START1_Select(a)                     ((a) & 0x1f)
00380 
00381 #define AI_DIV_Load_A_Register  64
00382 
00383 #define AO_Start_Select_Register        66
00384 #define AO_UI2_Software_Gate                    _bit15
00385 #define AO_UI2_External_Gate_Polarity           _bit14
00386 #define AO_START_Polarity                       _bit13
00387 #define AO_AOFREQ_Enable                        _bit12
00388 #define AO_UI2_External_Gate_Select(a)          (((a) & 0x1f) << 7)
00389 #define AO_START_Sync                           _bit6
00390 #define AO_START_Edge                           _bit5
00391 #define AO_START_Select(a)                      ((a) & 0x1f)
00392 
00393 #define AO_Trigger_Select_Register      67
00394 #define AO_UI2_External_Gate_Enable             _bit15
00395 #define AO_Delayed_START1                       _bit14
00396 #define AO_START1_Polarity                      _bit13
00397 #define AO_UI2_Source_Polarity                  _bit12
00398 #define AO_UI2_Source_Select(x)                 (((x)&0x1f)<<7)
00399 #define AO_START1_Sync                          _bit6
00400 #define AO_START1_Edge                          _bit5
00401 #define AO_START1_Select(x)                     (((x)&0x1f)<<0)
00402 
00403 #define AO_Mode_3_Register              70
00404 #define AO_UI2_Switch_Load_Next_TC              _bit13
00405 #define AO_UC_Switch_Load_Every_BC_TC           _bit12
00406 #define AO_Trigger_Length                       _bit11
00407 #define AO_Stop_On_Overrun_Error                _bit5
00408 #define AO_Stop_On_BC_TC_Trigger_Error          _bit4
00409 #define AO_Stop_On_BC_TC_Error                  _bit3
00410 #define AO_Not_An_UPDATE                        _bit2
00411 #define AO_Software_Gate                        _bit1
00412 #define AO_Last_Gate_Disable                    _bit0   /* M Series only */
00413 
00414 #define Joint_Reset_Register            72
00415 #define Software_Reset                          _bit11
00416 #define AO_Configuration_End                    _bit9
00417 #define AI_Configuration_End                    _bit8
00418 #define AO_Configuration_Start                  _bit5
00419 #define AI_Configuration_Start                  _bit4
00420 #define G1_Reset                                _bit3
00421 #define G0_Reset                                _bit2
00422 #define AO_Reset                                _bit1
00423 #define AI_Reset                                _bit0
00424 
00425 #define Interrupt_A_Enable_Register     73
00426 #define Pass_Thru_0_Interrupt_Enable            _bit9
00427 #define G0_Gate_Interrupt_Enable                _bit8
00428 #define AI_FIFO_Interrupt_Enable                _bit7
00429 #define G0_TC_Interrupt_Enable                  _bit6
00430 #define AI_Error_Interrupt_Enable               _bit5
00431 #define AI_STOP_Interrupt_Enable                _bit4
00432 #define AI_START_Interrupt_Enable               _bit3
00433 #define AI_START2_Interrupt_Enable              _bit2
00434 #define AI_START1_Interrupt_Enable              _bit1
00435 #define AI_SC_TC_Interrupt_Enable               _bit0
00436 
00437 #define Interrupt_B_Enable_Register     75
00438 #define Pass_Thru_1_Interrupt_Enable            _bit11
00439 #define G1_Gate_Interrupt_Enable                _bit10
00440 #define G1_TC_Interrupt_Enable                  _bit9
00441 #define AO_FIFO_Interrupt_Enable                _bit8
00442 #define AO_UI2_TC_Interrupt_Enable              _bit7
00443 #define AO_UC_TC_Interrupt_Enable               _bit6
00444 #define AO_Error_Interrupt_Enable               _bit5
00445 #define AO_STOP_Interrupt_Enable                _bit4
00446 #define AO_START_Interrupt_Enable               _bit3
00447 #define AO_UPDATE_Interrupt_Enable              _bit2
00448 #define AO_START1_Interrupt_Enable              _bit1
00449 #define AO_BC_TC_Interrupt_Enable               _bit0
00450 
00451 #define Second_IRQ_A_Enable_Register    74
00452 #define AI_SC_TC_Second_Irq_Enable              _bit0
00453 #define AI_START1_Second_Irq_Enable             _bit1
00454 #define AI_START2_Second_Irq_Enable             _bit2
00455 #define AI_START_Second_Irq_Enable              _bit3
00456 #define AI_STOP_Second_Irq_Enable               _bit4
00457 #define AI_Error_Second_Irq_Enable              _bit5
00458 #define G0_TC_Second_Irq_Enable                 _bit6
00459 #define AI_FIFO_Second_Irq_Enable               _bit7
00460 #define G0_Gate_Second_Irq_Enable               _bit8
00461 #define Pass_Thru_0_Second_Irq_Enable           _bit9
00462 
00463 #define Second_IRQ_B_Enable_Register    76
00464 #define AO_BC_TC_Second_Irq_Enable              _bit0
00465 #define AO_START1_Second_Irq_Enable             _bit1
00466 #define AO_UPDATE_Second_Irq_Enable             _bit2
00467 #define AO_START_Second_Irq_Enable              _bit3
00468 #define AO_STOP_Second_Irq_Enable               _bit4
00469 #define AO_Error_Second_Irq_Enable              _bit5
00470 #define AO_UC_TC_Second_Irq_Enable              _bit6
00471 #define AO_UI2_TC_Second_Irq_Enable             _bit7
00472 #define AO_FIFO_Second_Irq_Enable               _bit8
00473 #define G1_TC_Second_Irq_Enable                 _bit9
00474 #define G1_Gate_Second_Irq_Enable               _bit10
00475 #define Pass_Thru_1_Second_Irq_Enable           _bit11
00476 
00477 #define AI_Personal_Register            77
00478 #define AI_SHIFTIN_Pulse_Width                  _bit15
00479 #define AI_EOC_Polarity                         _bit14
00480 #define AI_SOC_Polarity                         _bit13
00481 #define AI_SHIFTIN_Polarity                     _bit12
00482 #define AI_CONVERT_Pulse_Timebase               _bit11
00483 #define AI_CONVERT_Pulse_Width                  _bit10
00484 #define AI_CONVERT_Original_Pulse               _bit9
00485 #define AI_FIFO_Flags_Polarity                  _bit8
00486 #define AI_Overrun_Mode                         _bit7
00487 #define AI_EXTMUX_CLK_Pulse_Width               _bit6
00488 #define AI_LOCALMUX_CLK_Pulse_Width             _bit5
00489 #define AI_AIFREQ_Polarity                      _bit4
00490 
00491 #define AO_Personal_Register            78
00492 #define AO_Interval_Buffer_Mode                 _bit3
00493 #define AO_BC_Source_Select                     _bit4
00494 #define AO_UPDATE_Pulse_Width                   _bit5
00495 #define AO_UPDATE_Pulse_Timebase                _bit6
00496 #define AO_UPDATE_Original_Pulse                _bit7
00497 #define AO_DMA_PIO_Control                      _bit8 /* M Series: reserved */
00498 #define AO_AOFREQ_Polarity                      _bit9 /* M Series: reserved */
00499 #define AO_FIFO_Enable                          _bit10
00500 #define AO_FIFO_Flags_Polarity                  _bit11 /* M Series: reserved */
00501 #define AO_TMRDACWR_Pulse_Width                 _bit12
00502 #define AO_Fast_CPU                             _bit13 /* M Series: reserved */
00503 #define AO_Number_Of_DAC_Packages               _bit14 /* 1 for "single" mode,
00504                                                           0 for "dual" */
00505 #define AO_Multiple_DACS_Per_Package            _bit15 /* M Series only */
00506 
00507 #define RTSI_Trig_A_Output_Register     79
00508 
00509 #define RTSI_Trig_B_Output_Register     80
00510 #define RTSI_Sub_Selection_1_Bit                _bit15 /* not for M Series */
00511 #define RTSI_Trig_Output_Bits(x, y)             ((y & 0xf) << ((x % 4) * 4))
00512 #define RTSI_Trig_Output_Mask(x)                (0xf << ((x % 4) * 4))
00513 #define RTSI_Trig_Output_Source(x, y)           ((y >> ((x % 4) * 4)) & 0xf)
00514 
00515 #define RTSI_Board_Register             81
00516 #define Write_Strobe_0_Register         82
00517 #define Write_Strobe_1_Register         83
00518 #define Write_Strobe_2_Register         84
00519 #define Write_Strobe_3_Register         85
00520 
00521 #define AO_Output_Control_Register      86
00522 #define AO_External_Gate_Enable                 _bit15
00523 #define AO_External_Gate_Select(x)              (((x)&0x1f)<<10)
00524 #define AO_Number_Of_Channels(x)                (((x)&0xf)<<6)
00525 #define AO_UPDATE2_Output_Select(x)             (((x)&0x3)<<4)
00526 #define AO_External_Gate_Polarity               _bit3
00527 #define AO_UPDATE2_Output_Toggle                _bit2
00528 #define AO_Update_Output_High_Z                 0
00529 #define AO_Update_Output_Ground                 1
00530 #define AO_Update_Output_Enable_Low             2
00531 #define AO_Update_Output_Enable_High            3
00532 #define AO_UPDATE_Output_Select(x)              (x&0x3)
00533 
00534 #define AI_Mode_3_Register              87
00535 #define AI_Trigger_Length                       _bit15
00536 #define AI_Delay_START                          _bit14
00537 #define AI_Software_Gate                        _bit13
00538 #define AI_SI_Special_Trigger_Delay             _bit12
00539 #define AI_SI2_Source_Select                    _bit11
00540 #define AI_Delayed_START2                       _bit10
00541 #define AI_Delayed_START1                       _bit9
00542 #define AI_External_Gate_Mode                   _bit8
00543 #define AI_FIFO_Mode_HF_to_E                    (3<<6)
00544 #define AI_FIFO_Mode_F                          (2<<6)
00545 #define AI_FIFO_Mode_HF                         (1<<6)
00546 #define AI_FIFO_Mode_NE                         (0<<6)
00547 #define AI_External_Gate_Polarity               _bit5
00548 #define AI_External_Gate_Select(a)              ((a) & 0x1f)
00549 
00550 #define G_Autoincrement_Register(a)     (68+(a))
00551 #define G_Command_Register(a)           (6+(a))
00552 #define G_HW_Save_Register(a)           (8+(a)*2)
00553 #define G_HW_Save_Register_High(a)      (8+(a)*2)
00554 #define G_HW_Save_Register_Low(a)       (9+(a)*2)
00555 #define G_Input_Select_Register(a)      (36+(a))
00556 #define G_Load_A_Register(a)            (28+(a)*4)
00557 #define G_Load_A_Register_High(a)       (28+(a)*4)
00558 #define G_Load_A_Register_Low(a)        (29+(a)*4)
00559 #define G_Load_B_Register(a)            (30+(a)*4)
00560 #define G_Load_B_Register_High(a)       (30+(a)*4)
00561 #define G_Load_B_Register_Low(a)        (31+(a)*4)
00562 #define G_Mode_Register(a)              (26+(a))
00563 #define G_Save_Register(a)              (12+(a)*2)
00564 #define G_Save_Register_High(a)         (12+(a)*2)
00565 #define G_Save_Register_Low(a)          (13+(a)*2)
00566 #define G_Status_Register               4
00567 #define Analog_Trigger_Etc_Register     61
00568 
00569 /* command register */
00570 #define G_Disarm_Copy                   _bit15          /* strobe */
00571 #define G_Save_Trace_Copy               _bit14
00572 #define G_Arm_Copy                      _bit13          /* strobe */
00573 #define G_Bank_Switch_Start             _bit10          /* strobe */
00574 #define G_Little_Big_Endian             _bit9
00575 #define G_Synchronized_Gate             _bit8
00576 #define G_Write_Switch                  _bit7
00577 #define G_Up_Down(a)                    (((a)&0x03)<<5)
00578 #define G_Disarm                        _bit4           /* strobe */
00579 #define G_Analog_Trigger_Reset          _bit3           /* strobe */
00580 #define G_Save_Trace                    _bit1
00581 #define G_Arm                           _bit0           /* strobe */
00582 
00583 /* channel agnostic names for the command register #defines */
00584 #define G_Bank_Switch_Enable            _bit12
00585 #define G_Bank_Switch_Mode              _bit11
00586 #define G_Load                          _bit2           /* strobe */
00587 
00588 /* input select register */
00589 #define G_Gate_Select(a)                (((a)&0x1f)<<7)
00590 #define G_Source_Select(a)              (((a)&0x1f)<<2)
00591 #define G_Write_Acknowledges_Irq        _bit1
00592 #define G_Read_Acknowledges_Irq         _bit0
00593 
00594 /* same input select register, but with channel agnostic names */
00595 #define G_Source_Polarity               _bit15
00596 #define G_Output_Polarity               _bit14
00597 #define G_OR_Gate                       _bit13
00598 #define G_Gate_Select_Load_Source       _bit12
00599 
00600 /* mode register */
00601 #define G_Loading_On_TC                 _bit12
00602 #define G_Output_Mode(a)                (((a)&0x03)<<8)
00603 #define G_Trigger_Mode_For_Edge_Gate(a) (((a)&0x03)<<3)
00604 #define G_Gating_Mode(a)                (((a)&0x03)<<0)
00605 
00606 /* same input mode register, but with channel agnostic names */
00607 #define G_Load_Source_Select            _bit7
00608 #define G_Reload_Source_Switching       _bit15
00609 #define G_Loading_On_Gate               _bit14
00610 #define G_Gate_Polarity                 _bit13
00611 
00612 #define G_Counting_Once(a)              (((a)&0x03)<<10)
00613 #define G_Stop_Mode(a)                  (((a)&0x03)<<5)
00614 #define G_Gate_On_Both_Edges            _bit2
00615 
00616 /* G_Status_Register */
00617 #define G1_Gate_Error_St                _bit15
00618 #define G0_Gate_Error_St                _bit14
00619 #define G1_TC_Error_St                  _bit13
00620 #define G0_TC_Error_St                  _bit12
00621 #define G1_No_Load_Between_Gates_St     _bit11
00622 #define G0_No_Load_Between_Gates_St     _bit10
00623 #define G1_Armed_St                     _bit9
00624 #define G0_Armed_St                     _bit8
00625 #define G1_Stale_Data_St                _bit7
00626 #define G0_Stale_Data_St                _bit6
00627 #define G1_Next_Load_Source_St          _bit5
00628 #define G0_Next_Load_Source_St          _bit4
00629 #define G1_Counting_St                  _bit3
00630 #define G0_Counting_St                  _bit2
00631 #define G1_Save_St                      _bit1
00632 #define G0_Save_St                      _bit0
00633 
00634 /* general purpose counter timer */
00635 #define G_Autoincrement(a)              ((a)<<0)
00636 
00637 /*Analog_Trigger_Etc_Register*/
00638 #define Analog_Trigger_Mode(x) ((x) & 0x7)
00639 #define Analog_Trigger_Enable _bit3
00640 #define Analog_Trigger_Drive _bit4
00641 #define GPFO_1_Output_Select            _bit7
00642 #define GPFO_0_Output_Select(a)         ((a)<<11)
00643 #define GPFO_0_Output_Enable            _bit14
00644 #define GPFO_1_Output_Enable            _bit15
00645 
00646 /* Additional windowed registers unique to E series */
00647 
00648 /* 16 bit registers shadowed from DAQ-STC */
00649 #define Window_Address                  0x00
00650 #define Window_Data                     0x02
00651 
00652 #define Configuration_Memory_Clear      82
00653 #define ADC_FIFO_Clear                  83
00654 #define DAC_FIFO_Clear                  84
00655 
00656 /* i/o port offsets */
00657 
00658 /* 8 bit registers */
00659 #define XXX_Status                      0x01
00660 #define PROMOUT                                 _bit0
00661 #define AI_FIFO_LOWER_NOT_EMPTY                 _bit3
00662 
00663 #define Serial_Command                  0x0d
00664 #define Misc_Command                    0x0f
00665 #define Port_A                          0x19
00666 #define Port_B                          0x1b
00667 #define Port_C                          0x1d
00668 #define Configuration                   0x1f
00669 #define Strobes                         0x01
00670 #define Channel_A_Mode                  0x03
00671 #define Channel_B_Mode                  0x05
00672 #define Channel_C_Mode                  0x07
00673 #define AI_AO_Select                    0x09
00674 #define AI_DMA_Select_Shift             0
00675 #define AI_DMA_Select_Mask              0xf
00676 #define AO_DMA_Select_Shift             4
00677 #define AO_DMA_Select_Mask              (0xf << AO_DMA_Select_Shift)
00678 
00679 #define G0_G1_Select                    0x0b
00680 
00681 static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
00682 {
00683         if(channel < 4) return 1 << channel;
00684         if(channel == 4) return 0x3;
00685         if(channel == 5) return 0x5;
00686         BUG();
00687         return 0;
00688 }
00689 static inline unsigned GPCT_DMA_Select_Bits(unsigned gpct_index, unsigned mite_channel)
00690 {
00691         BUG_ON(gpct_index > 1);
00692         return ni_stc_dma_channel_select_bitfield(mite_channel) << (4 * gpct_index);
00693 }
00694 static inline unsigned GPCT_DMA_Select_Mask(unsigned gpct_index)
00695 {
00696         BUG_ON(gpct_index > 1);
00697         return 0xf << (4 * gpct_index);
00698 }
00699 
00700 /* 16 bit registers */
00701 
00702 #define Configuration_Memory_Low        0x10
00703 #define AI_DITHER                               _bit9
00704 #define AI_LAST_CHANNEL                         _bit15
00705 
00706 #define Configuration_Memory_High       0x12
00707 #define AI_AC_COUPLE                            _bit11
00708 #define AI_DIFFERENTIAL                         _bit12
00709 #define AI_COMMON                               _bit13
00710 #define AI_GROUND                               (_bit12|_bit13)
00711 #define AI_CONFIG_CHANNEL(x)                    (x&0x3f)
00712 
00713 #define ADC_FIFO_Data_Register          0x1c
00714 
00715 #define AO_Configuration                0x16
00716 #define AO_Bipolar              _bit0
00717 #define AO_Deglitch             _bit1
00718 #define AO_Ext_Ref              _bit2
00719 #define AO_Ground_Ref           _bit3
00720 #define AO_Channel(x)           ((x) << 8)
00721 
00722 #define DAC_FIFO_Data                   0x1e
00723 #define DAC0_Direct_Data                0x18
00724 #define DAC1_Direct_Data                0x1a
00725 
00726 /* 611x registers (these boards differ from the e-series) */
00727 
00728 #define Magic_611x                      0x19 /* w8 (new) */
00729 #define Calibration_Channel_Select_611x 0x1a /* w16 (new) */
00730 #define ADC_FIFO_Data_611x              0x1c /* r32 (incompatible) */
00731 #define AI_FIFO_Offset_Load_611x        0x05 /* r8 (new) */
00732 #define DAC_FIFO_Data_611x              0x14 /* w32 (incompatible) */
00733 #define Cal_Gain_Select_611x            0x05 /* w8 (new) */
00734 
00735 #define AO_Window_Address_611x          0x18
00736 #define AO_Window_Data_611x             0x1e
00737 
00738 /* 6143 registers */
00739 #define Magic_6143                      0x19 /* w8 */
00740 #define G0G1_DMA_Select_6143            0x0B /* w8 */
00741 #define PipelineDelay_6143              0x1f /* w8 */
00742 #define EOC_Set_6143                    0x1D /* w8 */
00743 #define AIDMA_Select_6143               0x09 /* w8 */
00744 #define AIFIFO_Data_6143                0x8C /* w32 */
00745 #define AIFIFO_Flag_6143                0x84 /* w32 */
00746 #define AIFIFO_Control_6143             0x88 /* w32 */
00747 #define AIFIFO_Status_6143              0x88 /* w32 */
00748 #define AIFIFO_DMAThreshold_6143        0x90 /* w32 */
00749 #define AIFIFO_Words_Available_6143     0x94 /* w32 */
00750 
00751 #define Calibration_Channel_6143        0x42 /* w16 */
00752 #define Calibration_LowTime_6143        0x20 /* w16 */
00753 #define Calibration_HighTime_6143       0x22 /* w16 */
00754 #define Relay_Counter_Load_Val__6143    0x4C /* w32 */
00755 #define Signature_6143                  0x50 /* w32 */
00756 #define Release_Date_6143               0x54 /* w32 */
00757 #define Release_Oldest_Date_6143        0x58 /* w32 */
00758 
00759 #define Calibration_Channel_6143_RelayOn        0x8000  /* Calibration relay switch On */
00760 #define Calibration_Channel_6143_RelayOff       0x4000  /* Calibration relay switch Off */
00761 #define Calibration_Channel_Gnd_Gnd     0x00    /* Offset Calibration */
00762 #define Calibration_Channel_2v5_Gnd     0x02    /* 2.5V Reference */
00763 #define Calibration_Channel_Pwm_Gnd     0x05    /* +/- 5V Self Cal */
00764 #define Calibration_Channel_2v5_Pwm     0x0a    /* PWM Calibration */
00765 #define Calibration_Channel_Pwm_Pwm     0x0d    /* CMRR */
00766 #define Calibration_Channel_Gnd_Pwm     0x0e    /* PWM Calibration */
00767 
00768 /* 671x, 611x registers */
00769 
00770 /* 671xi 611x windowed ao registers */
00771 #define AO_Immediate_671x                       0x11 /* W 16 */
00772 #define AO_Timed_611x                           0x10 /* W 16 */
00773 #define AO_FIFO_Offset_Load_611x                0x13 /* W32 */
00774 #define AO_Later_Single_Point_Updates           0x14 /* W 16 */
00775 #define AO_Waveform_Generation_611x             0x15 /* W 16 */
00776 #define AO_Misc_611x                            0x16 /* W 16 */
00777 #define AO_Calibration_Channel_Select_67xx      0x17 /* W 16 */
00778 #define AO_Configuration_2_67xx                 0x18 /* W 16 */
00779 #define CAL_ADC_Command_67xx                    0x19 /* W 8 */
00780 #define CAL_ADC_Status_67xx                     0x1a /* R 8 */
00781 #define CAL_ADC_Data_67xx                       0x1b /* R 16 */
00782 #define CAL_ADC_Config_Data_High_Word_67xx      0x1c /* RW 16 */
00783 #define CAL_ADC_Config_Data_Low_Word_67xx       0x1d /* RW 16 */
00784 
00785 static inline unsigned int DACx_Direct_Data_671x(int channel)
00786 {
00787         return channel;
00788 }
00789 
00790 #define CLEAR_WG                                _bit0
00791 
00792 #define CSCFG_CAL_CONTROL_MASK                  0x7
00793 #define CSCFG_SELF_CAL_OFFSET                   0x1
00794 #define CSCFG_SELF_CAL_GAIN                     0x2
00795 #define CSCFG_SELF_CAL_OFFSET_GAIN              0x3
00796 #define CSCFG_SYSTEM_CAL_OFFSET                 0x5
00797 #define CSCFG_SYSTEM_CAL_GAIN                   0x6
00798 #define CSCFG_DONE                              (1 << 3)
00799 #define CSCFG_POWER_SAVE_SELECT                 (1 << 4)
00800 #define CSCFG_PORT_MODE                         (1 << 5)
00801 #define CSCFG_RESET_VALID                       (1 << 6)
00802 #define CSCFG_RESET                             (1 << 7)
00803 #define CSCFG_UNIPOLAR                          (1 << 12)
00804 #define CSCFG_WORD_RATE_2180_CYCLES             (0x0 << 13)
00805 #define CSCFG_WORD_RATE_1092_CYCLES             (0x1 << 13)
00806 #define CSCFG_WORD_RATE_532_CYCLES              (0x2 << 13)
00807 #define CSCFG_WORD_RATE_388_CYCLES              (0x3 << 13)
00808 #define CSCFG_WORD_RATE_324_CYCLES              (0x4 << 13)
00809 #define CSCFG_WORD_RATE_17444_CYCLES            (0x5 << 13)
00810 #define CSCFG_WORD_RATE_8724_CYCLES             (0x6 << 13)
00811 #define CSCFG_WORD_RATE_4364_CYCLES             (0x7 << 13)
00812 #define CSCFG_WORD_RATE_MASK                    (0x7 << 13)
00813 #define CSCFG_LOW_POWER                         (1 << 16)
00814 
00815 #define CS5529_CONFIG_DOUT(x)                   (1 << (18 + x))
00816 #define CS5529_CONFIG_AOUT(x)                   (1 << (22 + x))
00817 
00818 /* cs5529 command bits */
00819 #define CSCMD_POWER_SAVE                        _bit0
00820 #define CSCMD_REGISTER_SELECT_MASK              0xe
00821 #define CSCMD_OFFSET_REGISTER                   0x0
00822 #define CSCMD_GAIN_REGISTER                     _bit1
00823 #define CSCMD_CONFIG_REGISTER                   _bit2
00824 #define CSCMD_READ                              _bit4
00825 #define CSCMD_CONTINUOUS_CONVERSIONS            _bit5
00826 #define CSCMD_SINGLE_CONVERSION                 _bit6
00827 #define CSCMD_COMMAND                           _bit7
00828 
00829 /* cs5529 status bits */
00830 #define CSS_ADC_BUSY                            _bit0
00831 #define CSS_OSC_DETECT                          _bit1 /* indicates adc error */
00832 #define CSS_OVERRANGE                           _bit3
00833 
00834 #define SerDacLd(x)                     (0x08<<(x))
00835 
00836 /*
00837         This is stuff unique to the NI E series drivers,
00838         but I thought I'd put it here anyway.
00839 */
00840 
00841 enum
00842 {
00843         ai_gain_16 = 0,
00844         ai_gain_8,
00845         ai_gain_14,
00846         ai_gain_4,
00847         ai_gain_611x,
00848         ai_gain_622x,
00849         ai_gain_628x,
00850         ai_gain_6143
00851 };
00852 enum caldac_enum
00853 {
00854         caldac_none=0,
00855         mb88341,
00856         dac8800,
00857         dac8043,
00858         ad8522,
00859         ad8804,
00860         ad8842,
00861         ad8804_debug
00862 };
00863 enum ni_reg_type
00864 {
00865         ni_reg_normal = 0x0,
00866         ni_reg_611x = 0x1,
00867         ni_reg_6711 = 0x2,
00868         ni_reg_6713 = 0x4,
00869         ni_reg_67xx_mask = 0x6,
00870         ni_reg_6xxx_mask = 0x7,
00871         ni_reg_622x = 0x8,
00872         ni_reg_625x = 0x10,
00873         ni_reg_628x = 0x18,
00874         ni_reg_m_series_mask = 0x18,
00875         ni_reg_6143 = 0x20
00876 };
00877 
00878 /* M Series registers offsets */
00879 #define M_Offset_CDIO_DMA_Select                0x7 /* write */
00880 #define M_Offset_SCXI_Status                    0x7 /* read */
00881 #define M_Offset_AI_AO_Select                   0x9 /* write, same offset as e-series */
00882 #define M_Offset_SCXI_Serial_Data_In            0x9 /* read */
00883 #define M_Offset_G0_G1_Select                   0xb /* write, same offset as e-series */
00884 #define M_Offset_Misc_Command                   0xf
00885 #define M_Offset_SCXI_Serial_Data_Out           0x11
00886 #define M_Offset_SCXI_Control                   0x13
00887 #define M_Offset_SCXI_Output_Enable             0x15
00888 #define M_Offset_AI_FIFO_Data                   0x1c
00889 #define M_Offset_Static_Digital_Output          0x24 /* write */
00890 #define M_Offset_Static_Digital_Input           0x24 /* read */
00891 #define M_Offset_DIO_Direction                  0x28
00892 #define M_Offset_Cal_PWM                        0x40
00893 #define M_Offset_AI_Config_FIFO_Data            0x5e
00894 #define M_Offset_Interrupt_C_Enable             0x88 /* write */
00895 #define M_Offset_Interrupt_C_Status             0x88 /* read */
00896 #define M_Offset_Analog_Trigger_Control         0x8c
00897 #define M_Offset_AO_Serial_Interrupt_Enable     0xa0
00898 #define M_Offset_AO_Serial_Interrupt_Ack        0xa1 /* write */
00899 #define M_Offset_AO_Serial_Interrupt_Status     0xa1 /* read */
00900 #define M_Offset_AO_Calibration                 0xa3
00901 #define M_Offset_AO_FIFO_Data                   0xa4
00902 #define M_Offset_PFI_Filter                     0xb0
00903 #define M_Offset_RTSI_Filter                    0xb4
00904 #define M_Offset_SCXI_Legacy_Compatibility      0xbc
00905 #define M_Offset_Interrupt_A_Ack                0x104 /* write */
00906 #define M_Offset_AI_Status_1                    0x104 /* read */
00907 #define M_Offset_Interrupt_B_Ack                0x106 /* write */
00908 #define M_Offset_AO_Status_1                    0x106 /* read */
00909 #define M_Offset_AI_Command_2                   0x108 /* write */
00910 #define M_Offset_G01_Status                     0x108 /* read */
00911 #define M_Offset_AO_Command_2                   0x10a
00912 #define M_Offset_AO_Status_2                    0x10c /* read */
00913 #define M_Offset_G0_Command                     0x10c /* write */
00914 #define M_Offset_G1_Command                     0x10e /* write */
00915 #define M_Offset_G0_HW_Save                     0x110
00916 #define M_Offset_G0_HW_Save_High                0x110
00917 #define M_Offset_AI_Command_1                   0x110
00918 #define M_Offset_G0_HW_Save_Low                 0x112
00919 #define M_Offset_AO_Command_1                   0x112
00920 #define M_Offset_G1_HW_Save                     0x114
00921 #define M_Offset_G1_HW_Save_High                0x114
00922 #define M_Offset_G1_HW_Save_Low                 0x116
00923 #define M_Offset_AI_Mode_1                      0x118
00924 #define M_Offset_G0_Save                        0x118
00925 #define M_Offset_G0_Save_High                   0x118
00926 #define M_Offset_AI_Mode_2                      0x11a
00927 #define M_Offset_G0_Save_Low                    0x11a
00928 #define M_Offset_AI_SI_Load_A                   0x11c
00929 #define M_Offset_G1_Save                        0x11c
00930 #define M_Offset_G1_Save_High                   0x11c
00931 #define M_Offset_G1_Save_Low                    0x11e
00932 #define M_Offset_AI_SI_Load_B                   0x120 /* write */
00933 #define M_Offset_AO_UI_Save                     0x120 /* read */
00934 #define M_Offset_AI_SC_Load_A                   0x124 /* write */
00935 #define M_Offset_AO_BC_Save                     0x124 /* read */
00936 #define M_Offset_AI_SC_Load_B                   0x128 /* write */
00937 #define M_Offset_AO_UC_Save                     0x128 /* read */
00938 #define M_Offset_AI_SI2_Load_A                  0x12c
00939 #define M_Offset_AI_SI2_Load_B                  0x130
00940 #define M_Offset_G0_Mode                        0x134
00941 #define M_Offset_G1_Mode                        0x136 /* write */
00942 #define M_Offset_Joint_Status_1                 0x136 /* read */
00943 #define M_Offset_G0_Load_A                      0x138
00944 #define M_Offset_Joint_Status_2                 0x13a
00945 #define M_Offset_G0_Load_B                      0x13c
00946 #define M_Offset_G1_Load_A                      0x140
00947 #define M_Offset_G1_Load_B                      0x144
00948 #define M_Offset_G0_Input_Select                0x148
00949 #define M_Offset_G1_Input_Select                0x14a
00950 #define M_Offset_AO_Mode_1                      0x14c
00951 #define M_Offset_AO_Mode_2                      0x14e
00952 #define M_Offset_AO_UI_Load_A                   0x150
00953 #define M_Offset_AO_UI_Load_B                   0x154
00954 #define M_Offset_AO_BC_Load_A                   0x158
00955 #define M_Offset_AO_BC_Load_B                   0x15c
00956 #define M_Offset_AO_UC_Load_A                   0x160
00957 #define M_Offset_AO_UC_Load_B                   0x164
00958 #define M_Offset_Clock_and_FOUT                 0x170
00959 #define M_Offset_IO_Bidirection_Pin             0x172
00960 #define M_Offset_RTSI_Trig_Direction            0x174
00961 #define M_Offset_Interrupt_Control              0x176
00962 #define M_Offset_AI_Output_Control              0x178
00963 #define M_Offset_Analog_Trigger_Etc             0x17a
00964 #define M_Offset_AI_START_STOP_Select           0x17c
00965 #define M_Offset_AI_Trigger_Select              0x17e
00966 #define M_Offset_AI_SI_Save                     0x180 /* read */
00967 #define M_Offset_AI_DIV_Load_A                  0x180 /* write */
00968 #define M_Offset_AI_SC_Save                     0x184 /* read */
00969 #define M_Offset_AO_Start_Select                0x184 /* write */
00970 #define M_Offset_AO_Trigger_Select              0x186
00971 #define M_Offset_AO_Mode_3                      0x18c
00972 #define M_Offset_G0_Autoincrement               0x188
00973 #define M_Offset_G1_Autoincrement               0x18a
00974 #define M_Offset_Joint_Reset                    0x190
00975 #define M_Offset_Interrupt_A_Enable             0x192
00976 #define M_Offset_Interrupt_B_Enable             0x196
00977 #define M_Offset_AI_Personal                    0x19a
00978 #define M_Offset_AO_Personal                    0x19c
00979 #define M_Offset_RTSI_Trig_A_Output             0x19e
00980 #define M_Offset_RTSI_Trig_B_Output             0x1a0
00981 #define M_Offset_RTSI_Shared_MUX                0x1a2
00982 #define M_Offset_AO_Output_Control              0x1ac
00983 #define M_Offset_AI_Mode_3                      0x1ae
00984 #define M_Offset_Configuration_Memory_Clear     0x1a4
00985 #define M_Offset_AI_FIFO_Clear                  0x1a6
00986 #define M_Offset_AO_FIFO_Clear                  0x1a8
00987 #define M_Offset_G0_Counting_Mode               0x1b0
00988 #define M_Offset_G1_Counting_Mode               0x1b2
00989 #define M_Offset_G0_Second_Gate                 0x1b4
00990 #define M_Offset_G1_Second_Gate                 0x1b6
00991 #define M_Offset_G0_DMA_Config                  0x1b8 /* write */
00992 #define M_Offset_G0_DMA_Status                  0x1b8 /* read */
00993 #define M_Offset_G1_DMA_Config                  0x1ba /* write */
00994 #define M_Offset_G1_DMA_Status                  0x1ba /* read */
00995 #define M_Offset_G0_MSeries_ABZ                 0x1c0
00996 #define M_Offset_G1_MSeries_ABZ                 0x1c2
00997 #define M_Offset_Clock_and_Fout2                0x1c4
00998 #define M_Offset_PLL_Control                    0x1c6
00999 #define M_Offset_PLL_Status                     0x1c8
01000 #define M_Offset_PFI_Output_Select_1            0x1d0
01001 #define M_Offset_PFI_Output_Select_2            0x1d2
01002 #define M_Offset_PFI_Output_Select_3            0x1d4
01003 #define M_Offset_PFI_Output_Select_4            0x1d6
01004 #define M_Offset_PFI_Output_Select_5            0x1d8
01005 #define M_Offset_PFI_Output_Select_6            0x1da
01006 #define M_Offset_PFI_DI                         0x1dc
01007 #define M_Offset_PFI_DO                         0x1de
01008 #define M_Offset_AI_Config_FIFO_Bypass          0x218
01009 #define M_Offset_SCXI_DIO_Enable                0x21c
01010 #define M_Offset_CDI_FIFO_Data                  0x220 /* read */
01011 #define M_Offset_CDO_FIFO_Data                  0x220 /* write */
01012 #define M_Offset_CDIO_Status                    0x224 /* read */
01013 #define M_Offset_CDIO_Command                   0x224 /* write */
01014 #define M_Offset_CDI_Mode                       0x228
01015 #define M_Offset_CDO_Mode                       0x22c
01016 #define M_Offset_CDI_Mask_Enable                0x230
01017 #define M_Offset_CDO_Mask_Enable                0x234
01018 #define M_Offset_AO_Waveform_Order(x)           (0xc2 + 0x4 * x)
01019 #define M_Offset_AO_Config_Bank(x)              (0xc3 + 0x4 * x)
01020 #define M_Offset_DAC_Direct_Data(x)             (0xc0 + 0x4 * x)
01021 #define M_Offset_Gen_PWM(x)                     (0x44 + 0x2 * x)
01022 
01023 static inline int M_Offset_Static_AI_Control(int i)
01024 {
01025         int offset[] =
01026         {
01027                 0x64,
01028                 0x261,
01029                 0x262,
01030                 0x263,
01031         };
01032         if(((unsigned)i) >= sizeof(offset) / sizeof(offset[0]))
01033         {
01034                 rtdm_printk("%s: invalid channel=%i\n", __FUNCTION__, i);
01035                 return offset[0];
01036         }
01037         return offset[i];
01038 };
01039 static inline int M_Offset_AO_Reference_Attenuation(int channel)
01040 {
01041         int offset[] =
01042         {
01043                 0x264,
01044                 0x265,
01045                 0x266,
01046                 0x267
01047         };
01048         if(((unsigned)channel) >= sizeof(offset) / sizeof(offset[0]))
01049         {
01050                 rtdm_printk("%s: invalid channel=%i\n", __FUNCTION__, channel);
01051                 return offset[0];
01052         }
01053         return offset[channel];
01054 };
01055 static inline unsigned M_Offset_PFI_Output_Select(unsigned n)
01056 {
01057         if(n < 1 || n > NUM_PFI_OUTPUT_SELECT_REGS)
01058         {
01059                 rtdm_printk("%s: invalid pfi output select register=%i\n", __FUNCTION__, n);
01060                 return M_Offset_PFI_Output_Select_1;
01061         }
01062         return M_Offset_PFI_Output_Select_1 + (n - 1) * 2;
01063 }
01064 
01065 #define MSeries_AI_Config_Channel_Type_Mask                     (0x7 << 6)
01066 #define MSeries_AI_Config_Channel_Type_Calibration_Bits         0x0
01067 #define MSeries_AI_Config_Channel_Type_Differential_Bits        (0x1 << 6)
01068 #define MSeries_AI_Config_Channel_Type_Common_Ref_Bits          (0x2 << 6)
01069 #define MSeries_AI_Config_Channel_Type_Ground_Ref_Bits          (0x3 << 6)
01070 #define MSeries_AI_Config_Channel_Type_Aux_Bits                 (0x5 << 6)
01071 #define MSeries_AI_Config_Channel_Type_Ghost_Bits               (0x7 << 6)
01072 #define MSeries_AI_Config_Polarity_Bit                          0x1000 /* 0 for 2's complement encoding */
01073 #define MSeries_AI_Config_Dither_Bit                            0x2000
01074 #define MSeries_AI_Config_Last_Channel_Bit                      0x4000
01075 #define MSeries_AI_Config_Channel_Bits(x)                       (x & 0xf)
01076 #define MSeries_AI_Config_Gain_Bits(x)                          ((x & 0x7) << 9)
01077 
01078 static inline
01079 unsigned int MSeries_AI_Config_Bank_Bits(unsigned int reg_type,
01080                                          unsigned int channel)
01081 {
01082         unsigned int bits = channel & 0x30;
01083         if (reg_type == ni_reg_622x) {
01084                 if (channel & 0x40)
01085                         bits |= 0x400;
01086         }
01087         return bits;
01088 }
01089 
01090 #define MSeries_PLL_In_Source_Select_RTSI0_Bits                 0xb
01091 #define MSeries_PLL_In_Source_Select_Star_Trigger_Bits          0x14
01092 #define MSeries_PLL_In_Source_Select_RTSI7_Bits                 0x1b
01093 #define MSeries_PLL_In_Source_Select_PXI_Clock10                0x1d
01094 #define MSeries_PLL_In_Source_Select_Mask                       0x1f
01095 #define MSeries_Timebase1_Select_Bit                            0x20 /* use PLL for timebase 1 */
01096 #define MSeries_Timebase3_Select_Bit                            0x40 /* use PLL for timebase 3 */
01097 /* Use 10MHz instead of 20MHz for RTSI clock frequency.  Appears
01098    to have no effect, at least on pxi-6281, which always uses
01099    20MHz rtsi clock frequency */
01100 #define MSeries_RTSI_10MHz_Bit                                  0x80
01101 
01102 static inline
01103 unsigned int MSeries_PLL_In_Source_Select_RTSI_Bits(unsigned int RTSI_channel)
01104 {
01105         if(RTSI_channel > 7)
01106         {
01107                 rtdm_printk("%s: bug, invalid RTSI_channel=%i\n", __FUNCTION__, RTSI_channel);
01108                 return 0;
01109         }
01110         if(RTSI_channel == 7) return MSeries_PLL_In_Source_Select_RTSI7_Bits;
01111         else return MSeries_PLL_In_Source_Select_RTSI0_Bits + RTSI_channel;
01112 }
01113 
01114 #define MSeries_PLL_Enable_Bit                                  0x1000
01115 #define MSeries_PLL_VCO_Mode_200_325MHz_Bits                    0x0
01116 #define MSeries_PLL_VCO_Mode_175_225MHz_Bits                    0x2000
01117 #define MSeries_PLL_VCO_Mode_100_225MHz_Bits                    0x4000
01118 #define MSeries_PLL_VCO_Mode_75_150MHz_Bits                     0x6000
01119 
01120 static inline
01121 unsigned int MSeries_PLL_Divisor_Bits(unsigned int divisor)
01122 {
01123         static const unsigned int max_divisor = 0x10;
01124         if(divisor < 1 || divisor > max_divisor)
01125         {
01126                 rtdm_printk("%s: bug, invalid divisor=%i\n", __FUNCTION__, divisor);
01127                 return 0;
01128         }
01129         return (divisor & 0xf) << 8;
01130 }
01131 static inline
01132 unsigned int MSeries_PLL_Multiplier_Bits(unsigned int multiplier)
01133 {
01134         static const unsigned int max_multiplier = 0x100;
01135         if(multiplier < 1 || multiplier > max_multiplier)
01136         {
01137                 rtdm_printk("%s: bug, invalid multiplier=%i\n", __FUNCTION__, multiplier);
01138                 return 0;
01139         }
01140         return multiplier & 0xff;
01141 }
01142 
01143 #define MSeries_PLL_Locked_Bit                          0x1
01144 
01145 #define MSeries_AI_Bypass_Channel_Mask                  0x7
01146 #define MSeries_AI_Bypass_Bank_Mask                     0x78
01147 #define MSeries_AI_Bypass_Cal_Sel_Pos_Mask              0x380
01148 #define MSeries_AI_Bypass_Cal_Sel_Neg_Mask              0x1c00
01149 #define MSeries_AI_Bypass_Mode_Mux_Mask                 0x6000
01150 #define MSeries_AO_Bypass_AO_Cal_Sel_Mask               0x38000
01151 #define MSeries_AI_Bypass_Gain_Mask                     0x1c0000
01152 #define MSeries_AI_Bypass_Dither_Bit                    0x200000
01153 #define MSeries_AI_Bypass_Polarity_Bit                  0x400000 /* 0 for 2's complement encoding */
01154 #define MSeries_AI_Bypass_Config_FIFO_Bit               0x80000000
01155 #define MSeries_AI_Bypass_Cal_Sel_Pos_Bits(x)           ((x << 7) & \
01156                                                          MSeries_AI_Bypass_Cal_Sel_Pos_Mask)
01157 #define MSeries_AI_Bypass_Cal_Sel_Neg_Bits(x)           ((x << 10) & \
01158                                                          MSeries_AI_Bypass_Cal_Sel_Pos_Mask)
01159 #define MSeries_AI_Bypass_Gain_Bits(x)                  ((x << 18) & \
01160                                                          MSeries_AI_Bypass_Gain_Mask)
01161 
01162 #define MSeries_AO_DAC_Offset_Select_Mask               0x7
01163 #define MSeries_AO_DAC_Offset_0V_Bits                   0x0
01164 #define MSeries_AO_DAC_Offset_5V_Bits                   0x1
01165 #define MSeries_AO_DAC_Reference_Mask                   0x38
01166 #define MSeries_AO_DAC_Reference_10V_Internal_Bits      0x0
01167 #define MSeries_AO_DAC_Reference_5V_Internal_Bits       0x8
01168 #define MSeries_AO_Update_Timed_Bit                     0x40
01169 #define MSeries_AO_Bipolar_Bit                          0x80 /* turns on 2's complement encoding */
01170 
01171 #define MSeries_Attenuate_x5_Bit                        0x1
01172 
01173 #define MSeries_Cal_PWM_High_Time_Bits(x)               ((x << 16) & 0xffff0000)
01174 #define MSeries_Cal_PWM_Low_Time_Bits(x)                (x & 0xffff)
01175 
01176 #define MSeries_PFI_Output_Select_Mask(x)               (0x1f << (x % 3) * 5)
01177 #define MSeries_PFI_Output_Select_Bits(x, y)            ((y & 0x1f) << ((x % 3) * 5))
01178 // inverse to MSeries_PFI_Output_Select_Bits
01179 #define MSeries_PFI_Output_Select_Source(x, y)          ((y >> ((x % 3) * 5)) & 0x1f)
01180 
01181 #define Gi_DMA_BankSW_Error_Bit                         0x10
01182 #define Gi_DMA_Reset_Bit                                0x8
01183 #define Gi_DMA_Int_Enable_Bit                           0x4
01184 #define Gi_DMA_Write_Bit                                0x2
01185 #define Gi_DMA_Enable_Bit                               0x1
01186 
01187 #define MSeries_PFI_Filter_Select_Mask(x)               (0x3 << (x * 2))
01188 #define MSeries_PFI_Filter_Select_Bits(x, y)            ((y << (x * 2)) & \
01189                                                          MSeries_PFI_Filter_Select_Mask(x))
01190 
01191 /* CDIO DMA select bits */
01192 #define CDI_DMA_Select_Shift    0
01193 #define CDI_DMA_Select_Mask     0xf
01194 #define CDO_DMA_Select_Shift    4
01195 #define CDO_DMA_Select_Mask     0xf << CDO_DMA_Select_Shift
01196 
01197 /* CDIO status bits */
01198 #define CDO_FIFO_Empty_Bit      0x1
01199 #define CDO_FIFO_Full_Bit       0x2
01200 #define CDO_FIFO_Request_Bit    0x4
01201 #define CDO_Overrun_Bit         0x8
01202 #define CDO_Underflow_Bit       0x10
01203 #define CDI_FIFO_Empty_Bit      0x10000
01204 #define CDI_FIFO_Full_Bit       0x20000
01205 #define CDI_FIFO_Request_Bit    0x40000
01206 #define CDI_Overrun_Bit         0x80000
01207 #define CDI_Overflow_Bit        0x100000
01208 
01209 /* CDIO command bits */
01210 #define CDO_Disarm_Bit                                  0x1
01211 #define CDO_Arm_Bit                                     0x2
01212 #define CDI_Disarm_Bit                                  0x4
01213 #define CDI_Arm_Bit                                     0x8
01214 #define CDO_Reset_Bit                                   0x10
01215 #define CDI_Reset_Bit                                   0x20
01216 #define CDO_Error_Interrupt_Enable_Set_Bit              0x40
01217 #define CDO_Error_Interrupt_Enable_Clear_Bit            0x80
01218 #define CDI_Error_Interrupt_Enable_Set_Bit              0x100
01219 #define CDI_Error_Interrupt_Enable_Clear_Bit            0x200
01220 #define CDO_FIFO_Request_Interrupt_Enable_Set_Bit       0x400
01221 #define CDO_FIFO_Request_Interrupt_Enable_Clear_Bit     0x800
01222 #define CDI_FIFO_Request_Interrupt_Enable_Set_Bit       0x1000
01223 #define CDI_FIFO_Request_Interrupt_Enable_Clear_Bit     0x2000
01224 #define CDO_Error_Interrupt_Confirm_Bit                 0x4000
01225 #define CDI_Error_Interrupt_Confirm_Bit                 0x8000
01226 #define CDO_Empty_FIFO_Interrupt_Enable_Set_Bit         0x10000
01227 #define CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit       0x20000
01228 #define CDO_SW_Update_Bit                               0x80000
01229 #define CDI_SW_Update_Bit                               0x100000
01230 
01231 /* CDIO mode bits */
01232 #define CDI_Sample_Source_Select_Mask   0x3f
01233 #define CDI_Halt_On_Error_Bit           0x200
01234 /* sample clock on falling edge */
01235 #define CDI_Polarity_Bit                0x400
01236 /* set for half full mode, clear for not empty mode */
01237 #define CDI_FIFO_Mode_Bit               0x800
01238 /* data lanes specify which dio channels map to byte or word accesses
01239    to the dio fifos */
01240 #define CDI_Data_Lane_Mask              0x3000
01241 #define CDI_Data_Lane_0_15_Bits         0x0
01242 #define CDI_Data_Lane_16_31_Bits        0x1000
01243 #define CDI_Data_Lane_0_7_Bits          0x0
01244 #define CDI_Data_Lane_8_15_Bits         0x1000
01245 #define CDI_Data_Lane_16_23_Bits        0x2000
01246 #define CDI_Data_Lane_24_31_Bits        0x3000
01247 
01248 /* CDO mode bits */
01249 #define CDO_Sample_Source_Select_Mask   0x3f
01250 #define CDO_Retransmit_Bit              0x100
01251 #define CDO_Halt_On_Error_Bit           0x200
01252 /* sample clock on falling edge */
01253 #define CDO_Polarity_Bit                0x400
01254 /* set for half full mode, clear for not full mode */
01255 #define CDO_FIFO_Mode_Bit               0x800
01256 /* data lanes specify which dio channels map to byte or word accesses
01257    to the dio fifos */
01258 #define CDO_Data_Lane_Mask              0x3000
01259 #define CDO_Data_Lane_0_15_Bits         0x0
01260 #define CDO_Data_Lane_16_31_Bits        0x1000
01261 #define CDO_Data_Lane_0_7_Bits          0x0
01262 #define CDO_Data_Lane_8_15_Bits         0x1000
01263 #define CDO_Data_Lane_16_23_Bits        0x2000
01264 #define CDO_Data_Lane_24_31_Bits        0x3000
01265 
01266 /* Interrupt C bits */
01267 #define Interrupt_Group_C_Enable_Bit    0x1
01268 #define Interrupt_Group_C_Status_Bit    0x1
01269 
01270 #define M_SERIES_EEPROM_SIZE 1024
01271 
01272 typedef struct ni_board_struct{
01273         unsigned short device_id;
01274         int isapnp_id;
01275         char *name;
01276 
01277         int n_adchan;
01278         int adbits;
01279 
01280         int ai_fifo_depth;
01281         unsigned int alwaysdither : 1;
01282         int gainlkup;
01283         int ai_speed;
01284 
01285         int n_aochan;
01286         int aobits;
01287         a4l_rngdesc_t *ao_range_table;
01288         int ao_fifo_depth;
01289 
01290         unsigned ao_speed;
01291 
01292         unsigned num_p0_dio_channels;
01293 
01294         int reg_type;
01295         unsigned int ao_unipolar : 1;
01296         unsigned int has_8255 : 1;
01297         unsigned int has_analog_trig : 1;
01298 
01299         enum caldac_enum caldac[3];
01300 } ni_board;
01301 
01302 #define n_ni_boards  (sizeof(ni_boards)/sizeof(ni_board))
01303 
01304 #define MAX_N_CALDACS 34
01305 #define MAX_N_AO_CHAN 8
01306 #define NUM_GPCT 2
01307 
01308 #define NI_PRIVATE_COMMON                                       \
01309         uint16_t (*stc_readw)(a4l_dev_t *dev, int register);    \
01310         uint32_t (*stc_readl)(a4l_dev_t *dev, int register);    \
01311         void (*stc_writew)(a4l_dev_t *dev, uint16_t value, int register);       \
01312         void (*stc_writel)(a4l_dev_t *dev, uint32_t value, int register);       \
01313         \
01314         int dio_state;                                          \
01315         int pfi_state;                                          \
01316         int io_bits;                                            \
01317         unsigned short dio_output;                              \
01318         unsigned short dio_control;                             \
01319         int ao0p,ao1p;                                          \
01320         int lastchan;                                           \
01321         int last_do;                                            \
01322         int rt_irq;                                             \
01323         int irq_polarity;                                       \
01324         int irq_pin;                                            \
01325         int aimode;                                             \
01326         int ai_continuous;                                      \
01327         int blocksize;                                          \
01328         int n_left;                                             \
01329         unsigned int ai_calib_source;                           \
01330         unsigned int ai_calib_source_enabled;                   \
01331         a4l_lock_t window_lock; \
01332         a4l_lock_t soft_reg_copy_lock; \
01333         a4l_lock_t mite_channel_lock; \
01334                                                                 \
01335         int changain_state;                                     \
01336         unsigned int changain_spec;                             \
01337                                                                 \
01338         unsigned int caldac_maxdata_list[MAX_N_CALDACS];        \
01339         unsigned short ao[MAX_N_AO_CHAN];                                       \
01340         unsigned short caldacs[MAX_N_CALDACS];                          \
01341                                                                 \
01342         unsigned short ai_cmd2; \
01343                                                                 \
01344         unsigned short ao_conf[MAX_N_AO_CHAN];                          \
01345         unsigned short ao_mode1;                                \
01346         unsigned short ao_mode2;                                \
01347         unsigned short ao_mode3;                                \
01348         unsigned short ao_cmd1;                                 \
01349         unsigned short ao_cmd2;                                 \
01350         unsigned short ao_cmd3;                                 \
01351         unsigned short ao_trigger_select;                       \
01352                                                                 \
01353         struct ni_gpct_device *counter_dev;     \
01354         unsigned short an_trig_etc_reg;                         \
01355                                                                 \
01356         unsigned ai_offset[512];                                \
01357                                                                 \
01358         unsigned long serial_interval_ns;                       \
01359         unsigned char serial_hw_mode;                           \
01360         unsigned short clock_and_fout;                          \
01361         unsigned short clock_and_fout2;                         \
01362                                                                 \
01363         unsigned short int_a_enable_reg;                        \
01364         unsigned short int_b_enable_reg;                        \
01365         unsigned short io_bidirection_pin_reg;                  \
01366         unsigned short rtsi_trig_direction_reg;                 \
01367         unsigned short rtsi_trig_a_output_reg; \
01368         unsigned short rtsi_trig_b_output_reg; \
01369         unsigned short pfi_output_select_reg[NUM_PFI_OUTPUT_SELECT_REGS]; \
01370         unsigned short ai_ao_select_reg; \
01371         unsigned short g0_g1_select_reg; \
01372         unsigned short cdio_dma_select_reg; \
01373         \
01374         unsigned clock_ns; \
01375         unsigned clock_source; \
01376         \
01377         unsigned short atrig_mode;                              \
01378         unsigned short atrig_high;                              \
01379         unsigned short atrig_low;                               \
01380         \
01381         unsigned short pwm_up_count;    \
01382         unsigned short pwm_down_count;  \
01383         \
01384         sampl_t ai_fifo_buffer[0x2000];                         \
01385         uint8_t eeprom_buffer[M_SERIES_EEPROM_SIZE]; \
01386         \
01387         struct mite_struct *mite; \
01388         struct mite_channel *ai_mite_chan; \
01389         struct mite_channel *ao_mite_chan;\
01390         struct mite_channel *cdo_mite_chan;\
01391         struct mite_dma_descriptor_ring *ai_mite_ring; \
01392         struct mite_dma_descriptor_ring *ao_mite_ring; \
01393         struct mite_dma_descriptor_ring *cdo_mite_ring; \
01394         struct mite_dma_descriptor_ring *gpct_mite_ring[NUM_GPCT]; \
01395         subd_8255_t subd_8255
01396 
01397 
01398 typedef struct {
01399         ni_board *board_ptr;
01400         NI_PRIVATE_COMMON;
01401 } ni_private;
01402 
01403 #define devpriv ((ni_private *)dev->priv)
01404 #define boardtype (*(ni_board *)devpriv->board_ptr)
01405 
01406 /* How we access registers */
01407 
01408 #define ni_writel(a,b)  (writel((a), devpriv->mite->daq_io_addr + (b)))
01409 #define ni_readl(a)     (readl(devpriv->mite->daq_io_addr + (a)))
01410 #define ni_writew(a,b)  (writew((a), devpriv->mite->daq_io_addr + (b)))
01411 #define ni_readw(a)     (readw(devpriv->mite->daq_io_addr + (a)))
01412 #define ni_writeb(a,b)  (writeb((a), devpriv->mite->daq_io_addr + (b)))
01413 #define ni_readb(a)     (readb(devpriv->mite->daq_io_addr + (a)))
01414 
01415 /* INSN_CONFIG_SET_CLOCK_SRC argument for NI cards */
01416 #define NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC  0 /* 10 MHz */
01417 #define NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC        1 /* 100 KHz */
01418 
01419 #endif /* _ANALOGY_NI_STC_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines