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