hwdrv_apci1500.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-1500 card  *****/
26
27// Card Specific information
28#define APCI1500_BOARD_VENDOR_ID           0x10e8
29#define APCI1500_ADDRESS_RANGE              4
30
31//DIGITAL INPUT-OUTPUT DEFINE
32
33#define  APCI1500_DIGITAL_OP                 	2
34#define  APCI1500_DIGITAL_IP                    0
35#define  APCI1500_AND               		    2
36#define  APCI1500_OR                		    4
37#define  APCI1500_OR_PRIORITY       		    6
38#define  APCI1500_CLK_SELECT                    0
39#define  COUNTER1                               0
40#define  COUNTER2                               1
41#define  COUNTER3                               2
42#define  APCI1500_COUNTER                		0x20
43#define  APCI1500_TIMER                  		0
44#define  APCI1500_WATCHDOG          		    0
45#define  APCI1500_SINGLE            		    0
46#define  APCI1500_CONTINUOUS        		    0x80
47#define  APCI1500_DISABLE                		0
48#define  APCI1500_ENABLE                		1
49#define  APCI1500_SOFTWARE_TRIGGER  		    0x4
50#define  APCI1500_HARDWARE_TRIGGER  		    0x10
51#define  APCI1500_SOFTWARE_GATE     		    0
52#define  APCI1500_HARDWARE_GATE     		    0x8
53#define  START                       		    0
54#define  STOP                       		    1
55#define  TRIGGER                       		    2
56   /**************************/
57   /* Zillog I/O enumeration */
58   /**************************/
59enum {
60	APCI1500_Z8536_PORT_C,
61	APCI1500_Z8536_PORT_B,
62	APCI1500_Z8536_PORT_A,
63	APCI1500_Z8536_CONTROL_REGISTER
64};
65
66      /******************************/
67      /* Z8536 CIO Internal Address */
68      /******************************/
69
70enum {
71	APCI1500_RW_MASTER_INTERRUPT_CONTROL,
72	APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
73	APCI1500_RW_PORT_A_INTERRUPT_CONTROL,
74	APCI1500_RW_PORT_B_INTERRUPT_CONTROL,
75	APCI1500_RW_TIMER_COUNTER_INTERRUPT_VECTOR,
76	APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY,
77	APCI1500_RW_PORT_C_DATA_DIRECTION,
78	APCI1500_RW_PORT_C_SPECIAL_IO_CONTROL,
79
80	APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
81	APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
82	APCI1500_RW_CPT_TMR1_CMD_STATUS,
83	APCI1500_RW_CPT_TMR2_CMD_STATUS,
84	APCI1500_RW_CPT_TMR3_CMD_STATUS,
85	APCI1500_RW_PORT_A_DATA,
86	APCI1500_RW_PORT_B_DATA,
87	APCI1500_RW_PORT_C_DATA,
88
89	APCI1500_R_CPT_TMR1_VALUE_HIGH,
90	APCI1500_R_CPT_TMR1_VALUE_LOW,
91	APCI1500_R_CPT_TMR2_VALUE_HIGH,
92	APCI1500_R_CPT_TMR2_VALUE_LOW,
93	APCI1500_R_CPT_TMR3_VALUE_HIGH,
94	APCI1500_R_CPT_TMR3_VALUE_LOW,
95	APCI1500_RW_CPT_TMR1_TIME_CST_HIGH,
96	APCI1500_RW_CPT_TMR1_TIME_CST_LOW,
97	APCI1500_RW_CPT_TMR2_TIME_CST_HIGH,
98	APCI1500_RW_CPT_TMR2_TIME_CST_LOW,
99	APCI1500_RW_CPT_TMR3_TIME_CST_HIGH,
100	APCI1500_RW_CPT_TMR3_TIME_CST_LOW,
101	APCI1500_RW_CPT_TMR1_MODE_SPECIFICATION,
102	APCI1500_RW_CPT_TMR2_MODE_SPECIFICATION,
103	APCI1500_RW_CPT_TMR3_MODE_SPECIFICATION,
104	APCI1500_R_CURRENT_VECTOR,
105
106	APCI1500_RW_PORT_A_SPECIFICATION,
107	APCI1500_RW_PORT_A_HANDSHAKE_SPECIFICATION,
108	APCI1500_RW_PORT_A_DATA_PCITCH_POLARITY,
109	APCI1500_RW_PORT_A_DATA_DIRECTION,
110	APCI1500_RW_PORT_A_SPECIAL_IO_CONTROL,
111	APCI1500_RW_PORT_A_PATTERN_POLARITY,
112	APCI1500_RW_PORT_A_PATTERN_TRANSITION,
113	APCI1500_RW_PORT_A_PATTERN_MASK,
114
115	APCI1500_RW_PORT_B_SPECIFICATION,
116	APCI1500_RW_PORT_B_HANDSHAKE_SPECIFICATION,
117	APCI1500_RW_PORT_B_DATA_PCITCH_POLARITY,
118	APCI1500_RW_PORT_B_DATA_DIRECTION,
119	APCI1500_RW_PORT_B_SPECIAL_IO_CONTROL,
120	APCI1500_RW_PORT_B_PATTERN_POLARITY,
121	APCI1500_RW_PORT_B_PATTERN_TRANSITION,
122	APCI1500_RW_PORT_B_PATTERN_MASK
123};
124
125 /*----------DIGITAL INPUT----------------*/
126static int i_APCI1500_Initialisation(comedi_device * dev, comedi_subdevice * s,
127	comedi_insn * insn, lsampl_t * data);
128static int i_APCI1500_ConfigDigitalInputEvent(comedi_device * dev,
129	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
130
131static int i_APCI1500_StartStopInputEvent(comedi_device * dev,
132	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
133static int i_APCI1500_ReadMoreDigitalInput(comedi_device * dev,
134	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
135
136/*----------	DIGITAL OUTPUT------------*/
137static int i_APCI1500_ConfigDigitalOutputErrorInterrupt(comedi_device * dev,
138	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
139static int i_APCI1500_WriteDigitalOutput(comedi_device * dev,
140	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
141
142/*----------TIMER----------------*/
143static int i_APCI1500_ConfigCounterTimerWatchdog(comedi_device * dev,
144	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
145static int i_APCI1500_StartStopTriggerTimerCounterWatchdog(comedi_device * dev,
146	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
147static int i_APCI1500_ReadCounterTimerWatchdog(comedi_device * dev,
148	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
149static int i_APCI1500_ReadInterruptMask(comedi_device * dev,
150	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
151
152/*----------INTERRUPT HANDLER------*/
153static void v_APCI1500_Interrupt(int irq, void *d);
154static int i_APCI1500_ConfigureInterrupt(comedi_device * dev,
155	comedi_subdevice * s, comedi_insn * insn, lsampl_t * data);
156/*----------RESET---------------*/
157static int i_APCI1500_Reset(comedi_device * dev);
158