2 * comedi/drivers/mf624.c
3 * Code for a Humusoft MF624 driver
5 * COMEDI - Linux Control and Measurement Device Interface
6 * Copyright (C) 2000 David A. Schleef <ds@schleef.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 Description: A comedi driver for Humusoft MF624 PCI Card
26 Devices: Humusoft MF624 Multifunction I/O Card
27 Author: Jean-Matthieu Bourgeot - François Poulain
28 Updated: Wed, 19 Sep 2007 14:29:43 +0200
31 This driver is a driver for the Humusoft MF624 PCI Card.
34 * 8 channel 14 bits ADC,
35 * 8 channel 14 bits DAC,
38 * 4 quadrature encoder input,
42 A/D Converter : Supported on subdevice 0,
43 D/A Converter : Supported on subdevice 1,
44 Digital Inputs : Supported on subdevice 2,
45 Digital Outputs : Supported on subdevice 3,
46 Quadrature Encoder Inputs : Not yet supported,
47 Counters/Timers : Not yet supported,
48 IRQ : Not yet supported.
51 Simultaneous D/A update not yet supported.
53 Configuration Options:
58 * This file provide useful declaration like some constants
59 * for configuration needed both in user's space and in kernel space
62 /* Subdevice numbers */
63 #define MF624_ENC_SUBDEV 5
64 #define MF624_CTR_SUBDEV 4
65 #define MF624_DO_SUBDEV 3
66 #define MF624_DI_SUBDEV 2
67 #define MF624_AO_SUBDEV 1
68 #define MF624_AI_SUBDEV 0
70 /* Encoders Configuration */
71 #define MF624_ENC 0x0001
73 /* some unnecessary masks */
74 #define MF624_ENC_MODE 0x000100
75 #define MF624_ENC_COUNT 0x000101
76 #define MF624_ENC_RESET 0x000102
77 #define MF624_ENC_FILTER 0x000103
80 #define MF624_ENC_MODE_4EDGE 0x00010000
81 #define MF624_ENC_MODE_RISING 0x00010001
82 #define MF624_ENC_MODE_FALLING 0x00010002
83 #define MF624_ENC_MODE_EITHER 0x00010003
84 #define MF624_ENC_COUNT_ENABLE 0x00010100
85 #define MF624_ENC_COUNT_DISABLE 0x00010101
86 #define MF624_ENC_COUNT_ENABLE_BYINPUT 0x00010102
87 #define MF624_ENC_COUNT_DISABLE_BYINPUT 0x00010103
88 #define MF624_ENC_RESET_DISABLE 0x00010200
89 #define MF624_ENC_RESET_ENABLE 0x00010201
90 #define MF624_ENC_RESET_DISABLE_BYINPUT 0x00010202
91 #define MF624_ENC_RESET_ENABLE_BYINPUT 0x00010203
92 #define MF624_ENC_RESET_ONRAISING_INPUT 0x00010204
93 #define MF624_ENC_RESET_ONFALLING_INPUT 0x00010205
94 #define MF624_ENC_RESET_ONEITHER_INPUT 0x00010206
95 #define MF624_ENC_FILTER_OFF 0x00010300
96 #define MF624_ENC_FILTER_ON 0x00010301
98 /* Counters Configration */
99 #define MF624_CTR 0x0002
101 /* some unnecessary masks */
102 #define MF624_CTR_DIRECTION 0x000200
103 #define MF624_CTR_REPETITION 0x000201
104 #define MF624_CTR_PRELOAD 0x000202
105 #define MF624_CTR_OUTPUT 0x000203
106 #define MF624_CTR_TRIGGER 0x000204
107 #define MF624_CTR_RETRIGGER 0x000205
108 #define MF624_CTR_GATE 0x000206
109 #define MF624_CTR_GATEPOLARITY 0x000207
110 #define MF624_CTR_CKSOURCE 0x000208
111 #define MF624_CTR_ADTRIGSRC 0x000209
112 #define MF624_CTR_CTR4INTSRC 0x00020A
113 #define MF624_CTR_CTRL 0x00020B
116 #define MF624_CTR_DIRECTION_UP 0x00020000
117 #define MF624_CTR_DIRECTION_DOWN 0x00020001
118 #define MF624_CTR_REPETITION_ON 0x00020100
119 #define MF624_CTR_REPETITION_OFF 0x00020101
120 #define MF624_CTR_PRELOAD_A 0x00020200
121 #define MF624_CTR_PRELOAD_AB 0x00020201
122 #define MF624_CTR_OUTPUT_MONOSTABLE 0x00020300
123 #define MF624_CTR_OUTPUT_BISTABLE 0x00020301
124 #define MF624_CTR_OUTPUT_DIRECT 0x00020302
125 #define MF624_CTR_OUTPUT_INVERSE 0x00020304
126 #define MF624_CTR_OUTPUT_OFF 0x00020305
127 #define MF624_CTR_OUTPUT_ON 0x00020306
128 #define MF624_CTR_TRIGGER_DISABLED 0x00020400
129 #define MF624_CTR_TRIGGER_BYINPUT 0x00020401
130 #define MF624_CTR_TRIGGER_BYLOWER 0x00020402
131 #define MF624_CTR_TRIGGER_BYUPPER 0x00020403
132 #define MF624_CTR_TRIGGER_RAISING 0x00020404
133 #define MF624_CTR_TRIGGER_FALLING 0x00020405
134 #define MF624_CTR_TRIGGER_EITHER 0x00020406
135 #define MF624_CTR_TRIGGER_DISABLE 0x00020407
136 #define MF624_CTR_RETRIGGER_ON 0x00020500
137 #define MF624_CTR_RETRIGGER_OFF 0x00020501
138 #define MF624_CTR_GATE_HIGHT 0x00020600
139 #define MF624_CTR_GATE_BYINPUT 0x00020601
140 #define MF624_CTR_GATE_BYLOWER 0x00020602
141 #define MF624_CTR_GATE_BYUPPER 0x00020603
142 #define MF624_CTR_GATEPOLARITY_LOW 0x00020700
143 #define MF624_CTR_GATEPOLARITY_HIGH 0x00020701
144 #define MF624_CTR_CKSOURCE_50M 0x00020800
145 #define MF624_CTR_CKSOURCE_10M 0x00020801
146 #define MF624_CTR_CKSOURCE_1M 0x00020802
147 #define MF624_CTR_CKSOURCE_100K 0x00020803
148 #define MF624_CTR_CKSOURCE_RAISINGINPUT 0x00020804
149 #define MF624_CTR_CKSOURCE_FALLINGINPUT 0x00020805
150 #define MF624_CTR_CKSOURCE_EITHERINPUT 0x00020806
151 #define MF624_CTR_CKSOURCE_RAISINGLOWER 0x00020807
152 #define MF624_CTR_CKSOURCE_FALLINGLOWER 0x00020808
153 #define MF624_CTR_CKSOURCE_EITHERLOWER 0x00020809
154 #define MF624_CTR_CKSOURCE_RAISINGUPPER 0x0002080A
155 #define MF624_CTR_CKSOURCE_FALLINGUPPER 0x0002080B
156 #define MF624_CTR_CKSOURCE_EITHERUPPER 0x0002080C
157 #define MF624_CTR_ADTRIGSRC_EXT 0x00020900
158 #define MF624_CTR_ADTRIGSRC_INT 0x00020901
159 #define MF624_CTR_CTR4INTSRC_EXT 0x00020A00
160 #define MF624_CTR_CTR4INTSRC_INT 0x00020A01
161 #define MF624_CTR_CTRL_START 0x00020B00
162 #define MF624_CTR_CTRL_STOP 0x00020B01
163 #define MF624_CTR_CTRL_LOAD 0x00020B02
164 #define MF624_CTR_CTRL_RESET 0x00020B03
165 #define MF624_CTR_CTRL_TSET 0x00020B04
166 #define MF624_CTR_CTRL_TRESET 0x00020B05