Merge branch 'audit.b62' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit...
[sfrench/cifs-2.6.git] / drivers / staging / comedi / drivers / addi-data / hwdrv_apci3200.h
1 /*
2  * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
3  *
4  *      ADDI-DATA GmbH
5  *      Dieselstrasse 3
6  *      D-77833 Ottersweier
7  *      Tel: +19(0)7223/9493-0
8  *      Fax: +49(0)7223/9493-92
9  *      http://www.addi-data-com
10  *      info@addi-data.com
11  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the Free
14  * Software Foundation; either version 2 of the License, or (at your option)
15  * any later version.
16  */
17
18 // Card Specific information
19 #define APCI3200_BOARD_VENDOR_ID                 0x15B8
20 //#define APCI3200_ADDRESS_RANGE                   264
21
22 int MODULE_NO;
23 struct {
24         INT i_Gain;
25         INT i_Polarity;
26         INT i_OffsetRange;
27         INT i_Coupling;
28         INT i_SingleDiff;
29         INT i_AutoCalibration;
30         UINT ui_ReloadValue;
31         UINT ui_TimeUnitReloadVal;
32         INT i_Interrupt;
33         INT i_ModuleSelection;
34 } Config_Parameters_Module1, Config_Parameters_Module2,
35     Config_Parameters_Module3, Config_Parameters_Module4;
36
37 //ANALOG INPUT RANGE
38 static const struct comedi_lrange range_apci3200_ai = { 8, {
39                                                      BIP_RANGE(10),
40                                                      BIP_RANGE(5),
41                                                      BIP_RANGE(2),
42                                                      BIP_RANGE(1),
43                                                      UNI_RANGE(10),
44                                                      UNI_RANGE(5),
45                                                      UNI_RANGE(2),
46                                                      UNI_RANGE(1)
47                                                      }
48 };
49
50 static const struct comedi_lrange range_apci3300_ai = { 4, {
51                                                      UNI_RANGE(10),
52                                                      UNI_RANGE(5),
53                                                      UNI_RANGE(2),
54                                                      UNI_RANGE(1)
55                                                      }
56 };
57
58 //Analog Input related Defines
59 #define APCI3200_AI_OFFSET_GAIN                  0
60 #define APCI3200_AI_SC_TEST                      4
61 #define APCI3200_AI_IRQ                          8
62 #define APCI3200_AI_AUTOCAL                      12
63 #define APCI3200_RELOAD_CONV_TIME_VAL            32
64 #define APCI3200_CONV_TIME_TIME_BASE             36
65 #define APCI3200_RELOAD_DELAY_TIME_VAL           40
66 #define APCI3200_DELAY_TIME_TIME_BASE            44
67 #define APCI3200_AI_MODULE1                      0
68 #define APCI3200_AI_MODULE2                      64
69 #define APCI3200_AI_MODULE3                      128
70 #define APCI3200_AI_MODULE4                      192
71 #define TRUE                                     1
72 #define FALSE                                    0
73 #define APCI3200_AI_EOSIRQ                       16
74 #define APCI3200_AI_EOS                          20
75 #define APCI3200_AI_CHAN_ID                      24
76 #define APCI3200_AI_CHAN_VAL                     28
77 #define ANALOG_INPUT                             0
78 #define TEMPERATURE                              1
79 #define RESISTANCE                               2
80
81 #define ENABLE_EXT_TRIG                          1
82 #define ENABLE_EXT_GATE                          2
83 #define ENABLE_EXT_TRIG_GATE                     3
84
85 #define APCI3200_MAXVOLT                         2.5
86 #define ADDIDATA_GREATER_THAN_TEST               0
87 #define ADDIDATA_LESS_THAN_TEST                  1
88
89 #define ADDIDATA_UNIPOLAR                        1
90 #define ADDIDATA_BIPOLAR                         2
91
92 //BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
93 #define MAX_MODULE                              4
94 //END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
95
96 typedef struct {
97         ULONG ul_NumberOfValue;
98         ULONG *pul_ResistanceValue;
99         ULONG *pul_TemperatureValue;
100 } str_ADDIDATA_RTDStruct, *pstr_ADDIDATA_RTDStruct;
101
102 //BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
103 typedef struct {
104         // Begin JK 05/08/2003 change for Linux
105         unsigned long ul_CurrentSourceCJC;
106         unsigned long ul_CurrentSource[5];
107         // End JK 05/08/2003 change for Linux
108
109         // Begin CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1
110         unsigned long ul_GainFactor[8]; // Gain Factor
111         unsigned int w_GainValue[10];
112         // End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1
113 } str_Module;
114 //END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
115
116 //BEGIN JK 06.07.04: Management of sevrals boards
117 typedef struct {
118         INT i_CJCAvailable;
119         INT i_CJCPolarity;
120         INT i_CJCGain;
121         INT i_InterruptFlag;
122         INT i_ADDIDATAPolarity;
123         INT i_ADDIDATAGain;
124         INT i_AutoCalibration;
125         INT i_ADDIDATAConversionTime;
126         INT i_ADDIDATAConversionTimeUnit;
127         INT i_ADDIDATAType;
128         INT i_ChannelNo;
129         INT i_ChannelCount;
130         INT i_ScanType;
131         INT i_FirstChannel;
132         INT i_LastChannel;
133         INT i_Sum;
134         INT i_Offset;
135         UINT ui_Channel_num;
136         INT i_Count;
137         INT i_Initialised;
138         //UINT ui_InterruptChannelValue[96]; //Buffer
139         UINT ui_InterruptChannelValue[144];     //Buffer
140         BYTE b_StructInitialized;
141         //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
142         unsigned int ui_ScanValueArray[7 + 12]; // 7 is the maximal number of channels
143         //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
144
145         //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
146         INT i_ConnectionType;
147         INT i_NbrOfModule;
148         str_Module s_Module[MAX_MODULE];
149         //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
150 } str_BoardInfos;
151 //END JK 06.07.04: Management of sevrals boards
152
153 // Hardware Layer  functions for Apci3200
154
155 //AI
156
157 INT i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
158                                  struct comedi_insn *insn, unsigned int *data);
159 INT i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
160                                struct comedi_insn *insn, unsigned int *data);
161 INT i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev,
162                                            struct comedi_subdevice *s,
163                                            struct comedi_insn *insn, unsigned int *data);
164 INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev,
165                                          struct comedi_subdevice *s,
166                                          struct comedi_insn *insn, unsigned int *data);
167 INT i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s);
168 INT i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
169 INT i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
170                                       struct comedi_cmd *cmd);
171 INT i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
172 INT i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
173                                 struct comedi_insn *insn, unsigned int *data);
174 //Interrupt
175 void v_APCI3200_Interrupt(int irq, void *d);
176 int i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
177 //Reset functions
178 INT i_APCI3200_Reset(struct comedi_device *dev);
179
180 int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data);
181 int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data);
182 int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, UINT *data);
183 int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, UINT *data);
184 int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
185                                        struct comedi_subdevice *s, struct comedi_insn *insn,
186                                        unsigned int *data);
187 int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, unsigned int *data);