Merge branch 'for-linus' of git://repo.or.cz/cris-mirror
[sfrench/cifs-2.6.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 //DI
84 // for di read
85 INT i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
86                                   struct comedi_insn *insn, unsigned int *data);
87 INT i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
88                                  struct comedi_insn *insn, unsigned int *data);
89 INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
90                                     struct comedi_insn *insn, unsigned int *data);
91
92 //DO
93 int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
94                                    struct comedi_insn *insn, unsigned int *data);
95 INT i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
96                                   struct comedi_insn *insn, unsigned int *data);
97 INT i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
98                                  struct comedi_insn *insn, unsigned int *data);
99 int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
100                                    struct comedi_insn *insn, unsigned int *data);
101
102 // TIMER
103 // timer value is passed as u seconds
104 INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
105                                           struct comedi_subdevice *s,
106                                           struct comedi_insn *insn, unsigned int *data);
107 int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
108                                                   struct comedi_subdevice *s,
109                                                   struct comedi_insn *insn,
110                                                   unsigned int *data);
111 int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev,
112                                         struct comedi_subdevice *s,
113                                         struct comedi_insn *insn, unsigned int *data);
114
115 // INTERRUPT
116 static void v_APCI1564_Interrupt(int irq, void *d);
117
118 // RESET
119 INT i_APCI1564_Reset(struct comedi_device *dev);