1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#define APCI3200_BOARD_VENDOR_ID 0x15B8
20
21
22int MODULE_NO;
23struct {
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 unsigned int ui_ReloadValue;
31 unsigned int 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
38static 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
50static 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
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
93#define MAX_MODULE 4
94
95
96struct str_ADDIDATA_RTDStruct {
97 unsigned int ul_NumberOfValue;
98 unsigned int *pul_ResistanceValue;
99 unsigned int *pul_TemperatureValue;
100};
101
102
103struct str_Module {
104
105
106 unsigned long ul_CurrentSourceCJC;
107 unsigned long ul_CurrentSource[5];
108
109
110
111 unsigned long ul_GainFactor[8];
112 unsigned int w_GainValue[10];
113
114};
115
116
117
118
119struct str_BoardInfos {
120
121 int i_CJCAvailable;
122 int i_CJCPolarity;
123 int i_CJCGain;
124 int i_InterruptFlag;
125 int i_ADDIDATAPolarity;
126 int i_ADDIDATAGain;
127 int i_AutoCalibration;
128 int i_ADDIDATAConversionTime;
129 int i_ADDIDATAConversionTimeUnit;
130 int i_ADDIDATAType;
131 int i_ChannelNo;
132 int i_ChannelCount;
133 int i_ScanType;
134 int i_FirstChannel;
135 int i_LastChannel;
136 int i_Sum;
137 int i_Offset;
138 unsigned int ui_Channel_num;
139 int i_Count;
140 int i_Initialised;
141
142 unsigned int ui_InterruptChannelValue[144];
143 unsigned char b_StructInitialized;
144
145 unsigned int ui_ScanValueArray[7 + 12];
146
147
148
149 int i_ConnectionType;
150 int i_NbrOfModule;
151 struct str_Module s_Module[MAX_MODULE];
152
153};
154
155
156
157
158
159
160
161int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
162 struct comedi_insn *insn, unsigned int *data);
163int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
164 struct comedi_insn *insn, unsigned int *data);
165int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev,
166 struct comedi_subdevice *s,
167 struct comedi_insn *insn, unsigned int *data);
168int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev,
169 struct comedi_subdevice *s,
170 struct comedi_insn *insn, unsigned int *data);
171int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s);
172int i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
173int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
174 struct comedi_cmd *cmd);
175int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
176int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
177 struct comedi_insn *insn, unsigned int *data);
178
179void v_APCI3200_Interrupt(int irq, void *d);
180int i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
181
182int i_APCI3200_Reset(struct comedi_device *dev);
183
184int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data);
185int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data);
186int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data);
187int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data);
188int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
189 struct comedi_subdevice *s, struct comedi_insn *insn,
190 unsigned int *data);
191int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, unsigned int *data);
192