Merge branch 'for-2.6.31' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / staging / comedi / drivers / addi-data / hwdrv_apci035.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 APCI035_BOARD_VENDOR_ID         0x15B8
20 #define APCI035_ADDRESS_RANGE           255
21
22 int i_TW_Number;
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         unsigned int ui_ReloadValue;
31         unsigned int ui_TimeUnitReloadVal;
32         int i_Interrupt;
33         int i_ModuleSelection;
34 } Config_Parameters_Main;
35
36 /* ANALOG INPUT RANGE */
37 struct comedi_lrange range_apci035_ai = { 8, {
38                                        BIP_RANGE(10),
39                                        BIP_RANGE(5),
40                                        BIP_RANGE(2),
41                                        BIP_RANGE(1),
42                                        UNI_RANGE(10),
43                                        UNI_RANGE(5),
44                                        UNI_RANGE(2),
45                                        UNI_RANGE(1)
46                                        }
47 };
48
49 /* Timer / Watchdog Related Defines */
50 #define APCI035_TCW_SYNC_ENABLEDISABLE  0
51 #define APCI035_TCW_RELOAD_VALUE        4
52 #define APCI035_TCW_TIMEBASE            8
53 #define APCI035_TCW_PROG                12
54 #define APCI035_TCW_TRIG_STATUS         16
55 #define APCI035_TCW_IRQ                 20
56 #define APCI035_TCW_WARN_TIMEVAL        24
57 #define APCI035_TCW_WARN_TIMEBASE       28
58
59 #define ADDIDATA_TIMER                  0
60 /* #define ADDIDATA_WATCHDOG            1 */
61
62 #define APCI035_TW1                               0
63 #define APCI035_TW2                               32
64 #define APCI035_TW3                               64
65 #define APCI035_TW4                               96
66
67 #define APCI035_AI_OFFSET                        0
68 #define APCI035_TEMP                             128
69 #define APCI035_ALR_SEQ                          4
70 #define APCI035_START_STOP_INDEX                 8
71 #define APCI035_ALR_START_STOP                   12
72 #define APCI035_ALR_IRQ                          16
73 #define APCI035_EOS                              20
74 #define APCI035_CHAN_NO                          24
75 #define APCI035_CHAN_VAL                         28
76 #define APCI035_CONV_TIME_TIME_BASE     36
77 #define APCI035_RELOAD_CONV_TIME_VAL    32
78 #define APCI035_DELAY_TIME_TIME_BASE    44
79 #define APCI035_RELOAD_DELAY_TIME_VAL   40
80 #define ENABLE_EXT_TRIG                 1
81 #define ENABLE_EXT_GATE                 2
82 #define ENABLE_EXT_TRIG_GATE            3
83
84 #define ANALOG_INPUT                    0
85 #define TEMPERATURE                     1
86 #define RESISTANCE                      2
87
88 #define ADDIDATA_GREATER_THAN_TEST      0
89 #define ADDIDATA_LESS_THAN_TEST         1
90
91 #define APCI035_MAXVOLT                         2.5
92
93 #define ADDIDATA_UNIPOLAR                        1
94 #define ADDIDATA_BIPOLAR                         2
95
96 /* ADDIDATA Enable Disable */
97 #define ADDIDATA_ENABLE                         1
98 #define ADDIDATA_DISABLE                        0
99
100 /* Hardware Layer functions for Apci035 */
101
102 /* TIMER */
103 /* timer value is passed as u seconds */
104 int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
105                                   struct comedi_insn *insn, unsigned int *data);
106 int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev,
107                                           struct comedi_subdevice *s,
108                                           struct comedi_insn *insn, unsigned int *data);
109 int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
110                                 struct comedi_insn *insn, unsigned int *data);
111
112 /* Temperature Related Defines (Analog Input Subdevice) */
113
114 int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
115                                 struct comedi_insn *insn, unsigned int *data);
116 int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
117                               struct comedi_insn *insn, unsigned int *data);
118
119 /* Interrupt */
120 static void v_APCI035_Interrupt(int irq, void *d);
121
122 /* Reset functions */
123 int i_APCI035_Reset(struct comedi_device *dev);