27 #define COMEDI_MAJORVERSION 0
28 #define COMEDI_MINORVERSION 7
29 #define COMEDI_MICROVERSION 76
30 #define VERSION "0.7.76"
33 #define COMEDI_MAJOR 98
40 #define COMEDI_NDEVICES 16
43 #define COMEDI_NDEVCONFOPTS 32
45 #define COMEDI_DEVCONF_AUX_DATA3_LENGTH 25
46 #define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26
47 #define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27
48 #define COMEDI_DEVCONF_AUX_DATA0_LENGTH 28
50 #define COMEDI_DEVCONF_AUX_DATA_HI 29
52 #define COMEDI_DEVCONF_AUX_DATA_LO 30
53 #define COMEDI_DEVCONF_AUX_DATA_LENGTH 31
56 #define COMEDI_NAMELEN 20
60 #define CR_PACK(chan, rng, aref) \
61 ((((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan))
62 #define CR_PACK_FLAGS(chan, range, aref, flags) \
63 (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK))
65 #define CR_CHAN(a) ((a)&0xffff)
66 #define CR_RANGE(a) (((a)>>16)&0xff)
67 #define CR_AREF(a) (((a)>>24)&0x03)
69 #define CR_FLAGS_MASK 0xfc000000
70 #define CR_ALT_FILTER (1<<26)
71 #define CR_DITHER CR_ALT_FILTER
72 #define CR_DEGLITCH CR_ALT_FILTER
73 #define CR_ALT_SOURCE (1<<27)
74 #define CR_EDGE (1<<30)
75 #define CR_INVERT (1<<31)
77 #define AREF_GROUND 0x00
78 #define AREF_COMMON 0x01
79 #define AREF_DIFF 0x02
80 #define AREF_OTHER 0x03
83 #define GPCT_RESET 0x0001
84 #define GPCT_SET_SOURCE 0x0002
85 #define GPCT_SET_GATE 0x0004
86 #define GPCT_SET_DIRECTION 0x0008
87 #define GPCT_SET_OPERATION 0x0010
88 #define GPCT_ARM 0x0020
89 #define GPCT_DISARM 0x0040
90 #define GPCT_GET_INT_CLK_FRQ 0x0080
92 #define GPCT_INT_CLOCK 0x0001
93 #define GPCT_EXT_PIN 0x0002
94 #define GPCT_NO_GATE 0x0004
95 #define GPCT_UP 0x0008
96 #define GPCT_DOWN 0x0010
97 #define GPCT_HWUD 0x0020
98 #define GPCT_SIMPLE_EVENT 0x0040
99 #define GPCT_SINGLE_PERIOD 0x0080
100 #define GPCT_SINGLE_PW 0x0100
101 #define GPCT_CONT_PULSE_OUT 0x0200
102 #define GPCT_SINGLE_PULSE_OUT 0x0400
106 #define INSN_MASK_WRITE 0x8000000
107 #define INSN_MASK_READ 0x4000000
108 #define INSN_MASK_SPECIAL 0x2000000
110 #define INSN_READ (0 | INSN_MASK_READ)
111 #define INSN_WRITE (1 | INSN_MASK_WRITE)
112 #define INSN_BITS (2 | INSN_MASK_READ|INSN_MASK_WRITE)
113 #define INSN_CONFIG (3 | INSN_MASK_READ|INSN_MASK_WRITE)
114 #define INSN_GTOD (4 | INSN_MASK_READ|INSN_MASK_SPECIAL)
115 #define INSN_WAIT (5 | INSN_MASK_WRITE|INSN_MASK_SPECIAL)
116 #define INSN_INTTRIG (6 | INSN_MASK_WRITE|INSN_MASK_SPECIAL)
121 #define TRIG_BOGUS 0x0001
122 #define TRIG_DITHER 0x0002
123 #define TRIG_DEGLITCH 0x0004
125 #define TRIG_CONFIG 0x0010
126 #define TRIG_WAKE_EOS 0x0020
133 #define CMDF_PRIORITY 0x00000008
135 #define TRIG_RT CMDF_PRIORITY
137 #define CMDF_WRITE 0x00000040
138 #define TRIG_WRITE CMDF_WRITE
140 #define CMDF_RAWDATA 0x00000080
142 #define COMEDI_EV_START 0x00040000
143 #define COMEDI_EV_SCAN_BEGIN 0x00080000
144 #define COMEDI_EV_CONVERT 0x00100000
145 #define COMEDI_EV_SCAN_END 0x00200000
146 #define COMEDI_EV_STOP 0x00400000
148 #define TRIG_ROUND_MASK 0x00030000
149 #define TRIG_ROUND_NEAREST 0x00000000
150 #define TRIG_ROUND_DOWN 0x00010000
151 #define TRIG_ROUND_UP 0x00020000
152 #define TRIG_ROUND_UP_NEXT 0x00030000
156 #define TRIG_ANY 0xffffffff
157 #define TRIG_INVALID 0x00000000
159 #define TRIG_NONE 0x00000001
160 #define TRIG_NOW 0x00000002
161 #define TRIG_FOLLOW 0x00000004
162 #define TRIG_TIME 0x00000008
163 #define TRIG_TIMER 0x00000010
164 #define TRIG_COUNT 0x00000020
165 #define TRIG_EXT 0x00000040
166 #define TRIG_INT 0x00000080
167 #define TRIG_OTHER 0x00000100
171 #define SDF_BUSY 0x0001
172 #define SDF_BUSY_OWNER 0x0002
173 #define SDF_LOCKED 0x0004
174 #define SDF_LOCK_OWNER 0x0008
175 #define SDF_MAXDATA 0x0010
176 #define SDF_FLAGS 0x0020
177 #define SDF_RANGETYPE 0x0040
178 #define SDF_MODE0 0x0080
179 #define SDF_MODE1 0x0100
180 #define SDF_MODE2 0x0200
181 #define SDF_MODE3 0x0400
182 #define SDF_MODE4 0x0800
183 #define SDF_CMD 0x1000
184 #define SDF_SOFT_CALIBRATED 0x2000
185 #define SDF_CMD_WRITE 0x4000
186 #define SDF_CMD_READ 0x8000
189 #define SDF_READABLE 0x00010000
191 #define SDF_WRITABLE 0x00020000
192 #define SDF_WRITEABLE SDF_WRITABLE
194 #define SDF_INTERNAL 0x00040000
195 #define SDF_GROUND 0x00100000
196 #define SDF_COMMON 0x00200000
197 #define SDF_DIFF 0x00400000
198 #define SDF_OTHER 0x00800000
199 #define SDF_DITHER 0x01000000
200 #define SDF_DEGLITCH 0x02000000
201 #define SDF_MMAP 0x04000000
202 #define SDF_RUNNING 0x08000000
203 #define SDF_LSAMPL 0x10000000
204 #define SDF_PACKED 0x20000000
206 #define SDF_PWM_COUNTER SDF_MODE0
207 #define SDF_PWM_HBRIDGE SDF_MODE1
301 #define COMEDI_DEVCONFIG _IOW(CIO, 0, struct comedi_devconfig)
302 #define COMEDI_DEVINFO _IOR(CIO, 1, struct comedi_devinfo)
303 #define COMEDI_SUBDINFO _IOR(CIO, 2, struct comedi_subdinfo)
304 #define COMEDI_CHANINFO _IOR(CIO, 3, struct comedi_chaninfo)
305 #define COMEDI_TRIG _IOWR(CIO, 4, comedi_trig)
306 #define COMEDI_LOCK _IO(CIO, 5)
307 #define COMEDI_UNLOCK _IO(CIO, 6)
308 #define COMEDI_CANCEL _IO(CIO, 7)
309 #define COMEDI_RANGEINFO _IOR(CIO, 8, struct comedi_rangeinfo)
310 #define COMEDI_CMD _IOR(CIO, 9, struct comedi_cmd)
311 #define COMEDI_CMDTEST _IOR(CIO, 10, struct comedi_cmd)
312 #define COMEDI_INSNLIST _IOR(CIO, 11, struct comedi_insnlist)
313 #define COMEDI_INSN _IOR(CIO, 12, struct comedi_insn)
314 #define COMEDI_BUFCONFIG _IOR(CIO, 13, struct comedi_bufconfig)
315 #define COMEDI_BUFINFO _IOWR(CIO, 14, struct comedi_bufinfo)
316 #define COMEDI_POLL _IO(CIO, 15)
450 #define __RANGE(a, b) ((((a)&0xffff)<<16)|((b)&0xffff))
452 #define RANGE_OFFSET(a) (((a)>>16)&0xffff)
453 #define RANGE_LENGTH(b) ((b)&0xffff)
455 #define RF_UNIT(flags) ((flags)&0xff)
456 #define RF_EXTERNAL (1<<8)
462 #define COMEDI_MIN_SPEED ((unsigned int)0xffffffff)
467 #define COMEDI_CB_EOS 1
468 #define COMEDI_CB_EOA 2
469 #define COMEDI_CB_BLOCK 4
471 #define COMEDI_CB_EOBUF 8
472 #define COMEDI_CB_ERROR 16
473 #define COMEDI_CB_OVERFLOW 32
511 static inline unsigned NI_USUAL_PFI_SELECT(
unsigned pfi_channel)
513 if (pfi_channel < 10)
514 return 0x1 + pfi_channel;
516 return 0xb + pfi_channel;
519 static inline unsigned NI_USUAL_RTSI_SELECT(
unsigned rtsi_channel)
521 if (rtsi_channel < 7)
522 return 0xb + rtsi_channel;
529 #define NI_GPCT_COUNTING_MODE_SHIFT 16
530 #define NI_GPCT_INDEX_PHASE_BITSHIFT 20
531 #define NI_GPCT_COUNTING_DIRECTION_SHIFT 24
619 static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(
unsigned n)
624 static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(
unsigned n)
628 static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(
unsigned n)
658 static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(
unsigned n)
662 static inline unsigned NI_GPCT_RTSI_GATE_SELECT(
unsigned n)
664 return NI_USUAL_RTSI_SELECT(n);
666 static inline unsigned NI_GPCT_PFI_GATE_SELECT(
unsigned n)
668 return NI_USUAL_PFI_SELECT(n);
670 static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(
unsigned n)
687 static inline unsigned NI_GPCT_PFI_OTHER_SELECT(
unsigned n)
689 return NI_USUAL_PFI_SELECT(n);
737 static inline unsigned NI_MIO_PLL_RTSI_CLOCK(
unsigned rtsi_channel)
758 static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(
unsigned n)
794 static inline unsigned NI_PFI_OUTPUT_RTSI(
unsigned rtsi_channel)
813 static inline unsigned NI_EXT_PFI(
unsigned pfi_channel)
815 return NI_USUAL_PFI_SELECT(pfi_channel) - 1;
817 static inline unsigned NI_EXT_RTSI(
unsigned rtsi_channel)
819 return NI_USUAL_RTSI_SELECT(rtsi_channel) - 1;
844 static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(
unsigned pfi_channel)
846 return NI_USUAL_PFI_SELECT(pfi_channel);
848 static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_RTSI(
unsigned rtsi_channel)
850 return NI_USUAL_RTSI_SELECT(rtsi_channel);
856 static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(
unsigned pfi_channel)
858 return NI_USUAL_PFI_SELECT(pfi_channel);
860 static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(
unsigned rtsi_channel)
862 return NI_USUAL_RTSI_SELECT(rtsi_channel);