Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / drivers / staging / comedi / drivers / addi-data / hwdrv_apci1564.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 /*********      Definitions for APCI-1564 card  *****/
19
20 #define APCI1564_BOARD_VENDOR_ID                0x15B8
21 #define APCI1564_ADDRESS_RANGE                  128
22
23 /* DIGITAL INPUT-OUTPUT DEFINE */
24 /* Input defines */
25 #define APCI1564_DIGITAL_IP                     0x04
26 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE1     4
27 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE2     8
28 #define APCI1564_DIGITAL_IP_IRQ                 16
29
30 /* Output defines */
31 #define APCI1564_DIGITAL_OP                     0x18
32 #define APCI1564_DIGITAL_OP_RW                  0
33 #define APCI1564_DIGITAL_OP_INTERRUPT           4
34 #define APCI1564_DIGITAL_OP_IRQ                 12
35
36 /* Digital Input IRQ Function Selection */
37 #define ADDIDATA_OR                             0
38 #define ADDIDATA_AND                            1
39
40 /* Digital Input Interrupt Status */
41 #define APCI1564_DIGITAL_IP_INTERRUPT_STATUS    12
42
43 /* Digital Output Interrupt Status */
44 #define APCI1564_DIGITAL_OP_INTERRUPT_STATUS    8
45
46 /* Digital Input Interrupt Enable Disable. */
47 #define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE    0x4
48 #define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
49
50 /* Digital Output Interrupt Enable Disable. */
51 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
52 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
53 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
54 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
55
56 /* ADDIDATA Enable Disable */
57
58 #define ADDIDATA_ENABLE                            1
59 #define ADDIDATA_DISABLE                           0
60
61 /* TIMER COUNTER WATCHDOG DEFINES */
62
63 #define ADDIDATA_TIMER                             0
64 #define ADDIDATA_COUNTER                           1
65 #define ADDIDATA_WATCHDOG                          2
66 #define APCI1564_DIGITAL_OP_WATCHDOG               0x28
67 #define APCI1564_TIMER                             0x48
68 #define APCI1564_COUNTER1                          0x0
69 #define APCI1564_COUNTER2                          0x20
70 #define APCI1564_COUNTER3                          0x40
71 #define APCI1564_COUNTER4                          0x60
72 #define APCI1564_TCW_SYNC_ENABLEDISABLE            0
73 #define APCI1564_TCW_RELOAD_VALUE                  4
74 #define APCI1564_TCW_TIMEBASE                      8
75 #define APCI1564_TCW_PROG                          12
76 #define APCI1564_TCW_TRIG_STATUS                   16
77 #define APCI1564_TCW_IRQ                           20
78 #define APCI1564_TCW_WARN_TIMEVAL                  24
79 #define APCI1564_TCW_WARN_TIMEBASE                 28
80
81 /* Hardware Layer  functions for Apci1564 */
82
83 /*
84 * DI for di read
85 */
86 int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
87                                   struct comedi_insn *insn, unsigned int *data);
88 int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
89                                  struct comedi_insn *insn, unsigned int *data);
90 int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
91                                     struct comedi_insn *insn, unsigned int *data);
92
93 /* DO */
94 int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
95                                    struct comedi_insn *insn, unsigned int *data);
96 int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
97                                   struct comedi_insn *insn, unsigned int *data);
98 int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
99                                  struct comedi_insn *insn, unsigned int *data);
100 int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
101                                    struct comedi_insn *insn, unsigned int *data);
102
103 /*
104 * TIMER timer value is passed as u seconds
105 */
106 int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
107                                           struct comedi_subdevice *s,
108                                           struct comedi_insn *insn, unsigned int *data);
109 int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
110                                                   struct comedi_subdevice *s,
111                                                   struct comedi_insn *insn,
112                                                   unsigned int *data);
113 int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev,
114                                         struct comedi_subdevice *s,
115                                         struct comedi_insn *insn, unsigned int *data);
116
117 /* intERRUPT */
118 static void v_APCI1564_Interrupt(int irq, void *d);
119
120 /* RESET */
121 int i_APCI1564_Reset(struct comedi_device *dev);