qlge: Remove spinlock from asic init path.
[linux-2.6] / drivers / staging / meilhaus / medriver.h
1 /*
2  * Copyright (C) 2005 Meilhaus Electronic GmbH (support@meilhaus.de)
3  *
4  * Source File : medriver.h
5  * Author      : GG (Guenter Gebhardt)  <g.gebhardt@meilhaus.de>
6  *  Author:     Krzysztof Gantzke       <k.gantzke@meilhaus.de>
7  */
8
9 #ifndef _MEDRIVER_H_
10 #define _MEDRIVER_H_
11
12 #include "metypes.h"
13 #include "meerror.h"
14 #include "medefines.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20         /*===========================================================================
21           Functions to access the driver system
22           =========================================================================*/
23
24         int meOpen(int iFlags);
25         int meClose(int iFlags);
26
27         int meLockDriver(int iLock, int iFlags);
28         int meLockDevice(int iDevice, int iLock, int iFlags);
29         int meLockSubdevice(int iDevice, int iSubdevice, int iLock, int iFlags);
30
31         /*===========================================================================
32           Error handling functions
33           =========================================================================*/
34
35         int meErrorGetLastMessage(char *pcErrorMsg, int iCount);
36         int meErrorGetMessage(int iErrorCode, char *pcErrorMsg, int iCount);
37         int meErrorSetDefaultProc(int iSwitch);
38         int meErrorSetUserProc(meErrorCB_t pErrorProc);
39
40
41         /*===========================================================================
42           Functions to perform I/O on a device
43           =========================================================================*/
44
45         int meIOIrqSetCallback(
46                         int iDevice,
47                         int iSubdevice,
48                         meIOIrqCB_t pCallback,
49                         void *pCallbackContext,
50                         int iFlags);
51         int meIOIrqStart(
52                         int iDevice,
53                         int iSubdevice,
54                         int iChannel,
55                         int iIrqSource,
56                         int iIrqEdge,
57                         int iIrqArg,
58                         int iFlags);
59         int meIOIrqStop(
60                         int iDevice,
61                         int iSubdevice,
62                         int iChannel,
63                         int iFlags);
64         int meIOIrqWait(
65                         int iDevice,
66                         int iSubdevice,
67                         int iChannel,
68                         int *piIrqCount,
69                         int *piValue,
70                         int iTimeOut,
71                         int iFlags);
72
73         int meIOResetDevice(int iDevice, int iFlags);
74         int meIOResetSubdevice(int iDevice, int iSubdevice, int iFlags);
75
76         int meIOStreamFrequencyToTicks(
77                         int iDevice,
78                         int iSubdevice,
79                         int iTimer,
80                         double *pdFrequency,
81                         int *piTicksLow,
82                         int *piTicksHigh,
83                         int iFlags);
84
85         int meIOSingleConfig(
86                         int iDevice,
87                         int iSubdevice,
88                         int iChannel,
89                         int iSingleConfig,
90                         int iRef,
91                         int iTrigChan,
92                         int iTrigType,
93                         int iTrigEdge,
94                         int iFlags);
95         int meIOSingle(meIOSingle_t *pSingleList, int iCount, int iFlags);
96
97         int meIOStreamConfig(
98                         int iDevice,
99                         int iSubdevice,
100                         meIOStreamConfig_t *pConfigList,
101                         int iCount,
102                         meIOStreamTrigger_t *pTrigger,
103                         int iFifoIrqThreshold,
104                         int iFlags);
105         int meIOStreamNewValues(
106                         int iDevice,
107                         int iSubdevice,
108                         int iTimeOut,
109                         int *piCount,
110                         int iFlags);
111         int meIOStreamRead(
112                         int iDevice,
113                         int iSubdevice,
114                         int iReadMode,
115                         int *piValues,
116                         int *piCount,
117                         int iFlags);
118         int meIOStreamWrite(
119                         int iDevice,
120                         int iSubdevice,
121                         int iWriteMode,
122                         int *piValues,
123                         int *piCount,
124                         int iFlags);
125         int meIOStreamStart(meIOStreamStart_t *pStartList, int iCount, int iFlags);
126         int meIOStreamStop(meIOStreamStop_t *pStopList, int iCount, int iFlags);
127         int meIOStreamStatus(
128                         int iDevice,
129                         int iSubdevice,
130                         int iWait,
131                         int *piStatus,
132                         int *piCount,
133                         int iFlags);
134         int meIOStreamSetCallbacks(
135                         int iDevice,
136                         int iSubdevice,
137                         meIOStreamCB_t pStartCB,
138                         void *pStartCBContext,
139                         meIOStreamCB_t pNewValuesCB,
140                         void *pNewValuesCBContext,
141                         meIOStreamCB_t pEndCB,
142                         void *pEndCBContext,
143                         int iFlags);
144         int meIOStreamTimeToTicks(
145                         int iDevice,
146                         int iSubdevice,
147                         int iTimer,
148                         double *pdTime,
149                         int *piTicksLow,
150                         int *piTicksHigh,
151                         int iFlags);
152
153
154         /*===========================================================================
155           Functions to query the driver system
156           =========================================================================*/
157
158         int meQueryDescriptionDevice(int iDevice, char *pcDescription, int iCount);
159
160         int meQueryInfoDevice(
161                         int iDevice,
162                         int *piVendorId,
163                         int *piDeviceId,
164                         int *piSerialNo,
165                         int *piBusType,
166                         int *piBusNo,
167                         int *piDevNo,
168                         int *piFuncNo,
169                         int *piPlugged);
170
171         int meQueryNameDevice(int iDevice, char *pcName, int iCount);
172         int meQueryNameDeviceDriver(int iDevice, char *pcName, int iCount);
173
174         int meQueryNumberDevices(int *piNumber);
175         int meQueryNumberSubdevices(int iDevice, int *piNumber);
176         int meQueryNumberChannels(int iDevice, int iSubdevice, int *piNumber);
177         int meQueryNumberRanges(
178                         int iDevice,
179                         int iSubdevice,
180                         int iUnit,
181                         int *piNumber);
182
183         int meQueryRangeByMinMax(
184                         int iDevice,
185                         int iSubdevice,
186                         int iUnit,
187                         double *pdMin,
188                         double *pdMax,
189                         int *piMaxData,
190                         int *piRange);
191         int meQueryRangeInfo(
192                         int iDevice,
193                         int iSubdevice,
194                         int iRange,
195                         int *piUnit,
196                         double *pdMin,
197                         double *pdMax,
198                         int *piMaxData);
199
200         int meQuerySubdeviceByType(
201                         int iDevice,
202                         int iStartSubdevice,
203                         int iType,
204                         int iSubtype,
205                         int *piSubdevice);
206         int meQuerySubdeviceType(
207                         int iDevice,
208                         int iSubdevice,
209                         int *piType,
210                         int *piSubtype);
211         int meQuerySubdeviceCaps(
212                         int iDevice,
213                         int iSubdevice,
214                         int *piCaps);
215         int meQuerySubdeviceCapsArgs(
216                         int iDevice,
217                         int iSubdevice,
218                         int iCap,
219                         int *piArgs,
220                         int iCount);
221
222         int meQueryVersionLibrary(int *piVersion);
223         int meQueryVersionMainDriver(int *piVersion);
224         int meQueryVersionDeviceDriver(int iDevice, int *piVersion);
225
226
227         /*===========================================================================
228           Common utility functions
229           =========================================================================*/
230
231         int meUtilityExtractValues(
232                         int iChannel,
233                         int *piAIBuffer,
234                         int iAIBufferCount,
235                         meIOStreamConfig_t *pConfigList,
236                         int iConfigListCount,
237                         int *piChanBuffer,
238                         int *piChanBufferCount);
239         int meUtilityDigitalToPhysical(
240                         double dMin,
241                         double dMax,
242                         int iMaxData,
243                         int iData,
244                         int iModuleType,
245                         double dRefValue,
246                         double *pdPhysical);
247         int meUtilityDigitalToPhysicalV(
248                         double dMin,
249                         double dMax,
250                         int iMaxData,
251                         int *piDataBuffer,
252                         int iCount,
253                         int iModuleType,
254                         double dRefValue,
255                         double *pdPhysicalBuffer);
256         int meUtilityPhysicalToDigital(
257                         double dMin,
258                         double dMax,
259                         int iMaxData,
260                         double dPhysical,
261                         int *piData);
262         int meUtilityPWMStart(
263                         int iDevice,
264                         int iSubdevice1,
265                         int iSubdevice2,
266                         int iSubdevice3,
267                         int iRef,
268                         int iPrescaler,
269                         int iDutyCycle,
270                         int iFlag);
271         int meUtilityPWMStop(int iDevice,
272                         int iSubdevice1);
273         int meUtilityPWMRestart(
274                         int iDevice,
275                         int iSubdevice1,
276                         int iRef,
277                         int iPrescaler);
278
279
280         /*===========================================================================
281           Load configuration from file into driver system
282           =========================================================================*/
283
284         int meConfigLoad(char *pcConfigFile);
285
286
287         /*===========================================================================
288           Functions to query a remote driver system
289           =========================================================================*/
290
291         int meRQueryDescriptionDevice(
292                         char *location,
293                         int iDevice,
294                         char *pcDescription,
295                         int iCount);
296
297         int meRQueryInfoDevice(
298                         char *location,
299                         int iDevice,
300                         int *piVendorId,
301                         int *piDeviceId,
302                         int *piSerialNo,
303                         int *piBusType,
304                         int *piBusNo,
305                         int *piDevNo,
306                         int *piFuncNo,
307                         int *piPlugged);
308
309         int meRQueryNameDevice(
310                         char *location,
311                         int iDevice,
312                         char *pcName,
313                         int iCount);
314
315         int meRQueryNumberDevices(char *location, int *piNumber);
316         int meRQueryNumberSubdevices(char *location, int iDevice, int *piNumber);
317         int meRQueryNumberChannels(
318                         char *location,
319                         int iDevice,
320                         int iSubdevice,
321                         int *piNumber);
322         int meRQueryNumberRanges(
323                         char *location,
324                         int iDevice,
325                         int iSubdevice,
326                         int iUnit,
327                         int *piNumber);
328
329         int meRQueryRangeInfo(
330                         char *location,
331                         int iDevice,
332                         int iSubdevice,
333                         int iRange,
334                         int *piUnit,
335                         double *pdMin,
336                         double *pdMax,
337                         int *piMaxData);
338
339         int meRQuerySubdeviceType(
340                         char *location,
341                         int iDevice,
342                         int iSubdevice,
343                         int *piType,
344                         int *piSubtype);
345
346 #ifdef __cplusplus
347 }
348 #endif
349
350 #endif