hwdrv_apci1564.h revision c995fe9475e062bab6f5a45ed28cd2d3d955ef43
1/**
2@verbatim
3
4Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
5
6        ADDI-DATA GmbH
7        Dieselstrasse 3
8        D-77833 Ottersweier
9        Tel: +19(0)7223/9493-0
10        Fax: +49(0)7223/9493-92
11        http://www.addi-data-com
12        info@addi-data.com
13
14This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20You shoud also find the complete GPL in the COPYING file accompanying this source code.
21
22@endverbatim
23*/
24
25/*********      Definitions for APCI-1564 card  *****/
26
27#define APCI1564_BOARD_VENDOR_ID                0x15B8
28#define APCI1564_ADDRESS_RANGE                  128
29
30//DIGITAL INPUT-OUTPUT DEFINE
31// Input defines
32#define APCI1564_DIGITAL_IP                     0x04
33#define APCI1564_DIGITAL_IP_INTERRUPT_MODE1     4
34#define APCI1564_DIGITAL_IP_INTERRUPT_MODE2     8
35#define APCI1564_DIGITAL_IP_IRQ                 16
36
37// Output defines
38#define APCI1564_DIGITAL_OP                 	0x18
39#define APCI1564_DIGITAL_OP_RW               	0
40#define APCI1564_DIGITAL_OP_INTERRUPT           4
41#define APCI1564_DIGITAL_OP_IRQ                 12
42
43//Digital Input IRQ Function Selection
44#define ADDIDATA_OR                             0
45#define ADDIDATA_AND                            1
46
47//Digital Input Interrupt Status
48#define APCI1564_DIGITAL_IP_INTERRUPT_STATUS    12
49
50//Digital Output Interrupt Status
51#define APCI1564_DIGITAL_OP_INTERRUPT_STATUS    8
52
53//Digital Input Interrupt Enable Disable.
54#define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE    0x4
55#define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
56
57//Digital Output Interrupt Enable Disable.
58#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
59#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
60#define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
61#define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
62
63//ADDIDATA Enable Disable
64
65#define ADDIDATA_ENABLE                            1
66#define ADDIDATA_DISABLE                           0
67
68// TIMER COUNTER WATCHDOG DEFINES
69
70#define ADDIDATA_TIMER                             0
71#define ADDIDATA_COUNTER                           1
72#define ADDIDATA_WATCHDOG                          2
73#define APCI1564_DIGITAL_OP_WATCHDOG               0x28
74#define APCI1564_TIMER                             0x48
75#define APCI1564_COUNTER1                          0x0
76#define APCI1564_COUNTER2                          0x20
77#define APCI1564_COUNTER3                          0x40
78#define APCI1564_COUNTER4                          0x60
79#define APCI1564_TCW_SYNC_ENABLEDISABLE            0
80#define APCI1564_TCW_RELOAD_VALUE                  4
81#define APCI1564_TCW_TIMEBASE                      8
82#define APCI1564_TCW_PROG                          12
83#define APCI1564_TCW_TRIG_STATUS                   16
84#define APCI1564_TCW_IRQ                           20
85#define APCI1564_TCW_WARN_TIMEVAL                  24
86#define APCI1564_TCW_WARN_TIMEBASE                 28
87
88// Hardware Layer  functions for Apci1564
89
90//DI
91// for di read
92INT i_APCI1564_ConfigDigitalInput(comedi_device * dev, comedi_subdevice * s,
93	comedi_insn * insn, lsampl_t * data);
94INT i_APCI1564_Read1DigitalInput(comedi_device * dev, comedi_subdevice * s,
95	comedi_insn * insn, lsampl_t * data);
96INT i_APCI1564_ReadMoreDigitalInput(comedi_device * dev, comedi_subdevice * s,
97	comedi_insn * insn, lsampl_t * data);
98
99//DO
100int i_APCI1564_ConfigDigitalOutput(comedi_device * dev, comedi_subdevice * s,
101	comedi_insn * insn, lsampl_t * data);
102INT i_APCI1564_WriteDigitalOutput(comedi_device * dev, comedi_subdevice * s,
103	comedi_insn * insn, lsampl_t * data);
104INT i_APCI1564_ReadDigitalOutput(comedi_device * dev, comedi_subdevice * s,
105	comedi_insn * insn, lsampl_t * data);
106int i_APCI1564_ReadInterruptStatus(comedi_device * dev, comedi_subdevice * s,
107	comedi_insn * insn, lsampl_t * data);
108
109// TIMER
110// timer value is passed as u seconds
111INT i_APCI1564_ConfigTimerCounterWatchdog(comedi_device * dev,
112	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
113int i_APCI1564_StartStopWriteTimerCounterWatchdog(comedi_device * dev,
114	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
115int i_APCI1564_ReadTimerCounterWatchdog(comedi_device * dev,
116	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
117
118// INTERRUPT
119static VOID v_APCI1564_Interrupt(int irq, void *d);
120
121// RESET
122INT i_APCI1564_Reset(comedi_device * dev);
123