aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-11-13 19:36:22 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:16 -0500
commite0dcef71f6ea63f80631d2e87d06a9ae05624eef (patch)
tree2e4ae57567f823557435c4473e8bdebf29efd8b2 /drivers
parented9eccbe8970f6eedc1b978c157caf1251a896d4 (diff)
Staging: comedi: fix up a lot of checkpatch.pl warnings
Only clean up some of the easier ones in the .h files Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Cc: David Schleef <ds@schleef.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/comedi.h1128
-rw-r--r--drivers/staging/comedi/comedi_compat32.h8
-rw-r--r--drivers/staging/comedi/comedi_fops.h2
-rw-r--r--drivers/staging/comedi/comedi_rt.h34
-rw-r--r--drivers/staging/comedi/comedidev.h158
-rw-r--r--drivers/staging/comedi/comedilib.h104
-rw-r--r--drivers/staging/comedi/wrapper.h6
7 files changed, 736 insertions, 704 deletions
diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index b80ddb2330e..36d2e1b01e7 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -50,9 +50,9 @@ extern "C" {
50#define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26 50#define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26
51#define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27 51#define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27
52#define COMEDI_DEVCONF_AUX_DATA0_LENGTH 28 52#define COMEDI_DEVCONF_AUX_DATA0_LENGTH 28
53#define COMEDI_DEVCONF_AUX_DATA_HI 29 /*most significant 32 bits of pointer address (if needed) */ 53#define COMEDI_DEVCONF_AUX_DATA_HI 29 /* most significant 32 bits of pointer address (if needed) */
54#define COMEDI_DEVCONF_AUX_DATA_LO 30 /*least significant 32 bits of pointer address */ 54#define COMEDI_DEVCONF_AUX_DATA_LO 30 /* least significant 32 bits of pointer address */
55#define COMEDI_DEVCONF_AUX_DATA_LENGTH 31 /* total data length */ 55#define COMEDI_DEVCONF_AUX_DATA_LENGTH 31 /* total data length */
56 56
57/* max length of device and driver names */ 57/* max length of device and driver names */
58#define COMEDI_NAMELEN 20 58#define COMEDI_NAMELEN 20
@@ -62,7 +62,7 @@ extern "C" {
62 62
63/* packs and unpacks a channel/range number */ 63/* packs and unpacks a channel/range number */
64 64
65#define CR_PACK(chan,rng,aref) ( (((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan) ) 65#define CR_PACK(chan, rng, aref) ((((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan))
66#define CR_PACK_FLAGS(chan, range, aref, flags) (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK)) 66#define CR_PACK_FLAGS(chan, range, aref, flags) (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK))
67 67
68#define CR_CHAN(a) ((a)&0xffff) 68#define CR_CHAN(a) ((a)&0xffff)
@@ -71,10 +71,10 @@ extern "C" {
71 71
72#define CR_FLAGS_MASK 0xfc000000 72#define CR_FLAGS_MASK 0xfc000000
73#define CR_ALT_FILTER (1<<26) 73#define CR_ALT_FILTER (1<<26)
74#define CR_DITHER CR_ALT_FILTER 74#define CR_DITHER CR_ALT_FILTER
75#define CR_DEGLITCH CR_ALT_FILTER 75#define CR_DEGLITCH CR_ALT_FILTER
76#define CR_ALT_SOURCE (1<<27) 76#define CR_ALT_SOURCE (1<<27)
77#define CR_EDGE (1<<30) 77#define CR_EDGE (1<<30)
78#define CR_INVERT (1<<31) 78#define CR_INVERT (1<<31)
79 79
80#define AREF_GROUND 0x00 /* analog ref = analog ground */ 80#define AREF_GROUND 0x00 /* analog ref = analog ground */
@@ -110,13 +110,13 @@ extern "C" {
110#define INSN_MASK_READ 0x4000000 110#define INSN_MASK_READ 0x4000000
111#define INSN_MASK_SPECIAL 0x2000000 111#define INSN_MASK_SPECIAL 0x2000000
112 112
113#define INSN_READ ( 0 | INSN_MASK_READ) 113#define INSN_READ (0 | INSN_MASK_READ)
114#define INSN_WRITE ( 1 | INSN_MASK_WRITE) 114#define INSN_WRITE (1 | INSN_MASK_WRITE)
115#define INSN_BITS ( 2 | INSN_MASK_READ|INSN_MASK_WRITE) 115#define INSN_BITS (2 | INSN_MASK_READ|INSN_MASK_WRITE)
116#define INSN_CONFIG ( 3 | INSN_MASK_READ|INSN_MASK_WRITE) 116#define INSN_CONFIG (3 | INSN_MASK_READ|INSN_MASK_WRITE)
117#define INSN_GTOD ( 4 | INSN_MASK_READ|INSN_MASK_SPECIAL) 117#define INSN_GTOD (4 | INSN_MASK_READ|INSN_MASK_SPECIAL)
118#define INSN_WAIT ( 5 | INSN_MASK_WRITE|INSN_MASK_SPECIAL) 118#define INSN_WAIT (5 | INSN_MASK_WRITE|INSN_MASK_SPECIAL)
119#define INSN_INTTRIG ( 6 | INSN_MASK_WRITE|INSN_MASK_SPECIAL) 119#define INSN_INTTRIG (6 | INSN_MASK_WRITE|INSN_MASK_SPECIAL)
120 120
121/* trigger flags */ 121/* trigger flags */
122/* These flags are used in comedi_trig structures */ 122/* These flags are used in comedi_trig structures */
@@ -124,10 +124,10 @@ extern "C" {
124#define TRIG_BOGUS 0x0001 /* do the motions */ 124#define TRIG_BOGUS 0x0001 /* do the motions */
125#define TRIG_DITHER 0x0002 /* enable dithering */ 125#define TRIG_DITHER 0x0002 /* enable dithering */
126#define TRIG_DEGLITCH 0x0004 /* enable deglitching */ 126#define TRIG_DEGLITCH 0x0004 /* enable deglitching */
127//#define TRIG_RT 0x0008 /* perform op in real time */ 127/*#define TRIG_RT 0x0008 */ /* perform op in real time */
128#define TRIG_CONFIG 0x0010 /* perform configuration, not triggering */ 128#define TRIG_CONFIG 0x0010 /* perform configuration, not triggering */
129#define TRIG_WAKE_EOS 0x0020 /* wake up on end-of-scan events */ 129#define TRIG_WAKE_EOS 0x0020 /* wake up on end-of-scan events */
130//#define TRIG_WRITE 0x0040 /* write to bidirectional devices */ 130/*#define TRIG_WRITE 0x0040*/ /* write to bidirectional devices */
131 131
132/* command flags */ 132/* command flags */
133/* These flags are used in comedi_cmd structures */ 133/* These flags are used in comedi_cmd structures */
@@ -210,250 +210,252 @@ extern "C" {
210 210
211/* subdevice types */ 211/* subdevice types */
212 212
213 enum comedi_subdevice_type { 213enum comedi_subdevice_type {
214 COMEDI_SUBD_UNUSED, /* unused by driver */ 214 COMEDI_SUBD_UNUSED, /* unused by driver */
215 COMEDI_SUBD_AI, /* analog input */ 215 COMEDI_SUBD_AI, /* analog input */
216 COMEDI_SUBD_AO, /* analog output */ 216 COMEDI_SUBD_AO, /* analog output */
217 COMEDI_SUBD_DI, /* digital input */ 217 COMEDI_SUBD_DI, /* digital input */
218 COMEDI_SUBD_DO, /* digital output */ 218 COMEDI_SUBD_DO, /* digital output */
219 COMEDI_SUBD_DIO, /* digital input/output */ 219 COMEDI_SUBD_DIO, /* digital input/output */
220 COMEDI_SUBD_COUNTER, /* counter */ 220 COMEDI_SUBD_COUNTER, /* counter */
221 COMEDI_SUBD_TIMER, /* timer */ 221 COMEDI_SUBD_TIMER, /* timer */
222 COMEDI_SUBD_MEMORY, /* memory, EEPROM, DPRAM */ 222 COMEDI_SUBD_MEMORY, /* memory, EEPROM, DPRAM */
223 COMEDI_SUBD_CALIB, /* calibration DACs */ 223 COMEDI_SUBD_CALIB, /* calibration DACs */
224 COMEDI_SUBD_PROC, /* processor, DSP */ 224 COMEDI_SUBD_PROC, /* processor, DSP */
225 COMEDI_SUBD_SERIAL, /* serial IO */ 225 COMEDI_SUBD_SERIAL, /* serial IO */
226 COMEDI_SUBD_PWM /* PWM */ 226 COMEDI_SUBD_PWM /* PWM */
227 }; 227};
228 228
229/* configuration instructions */ 229/* configuration instructions */
230 230
231 enum configuration_ids { 231enum configuration_ids {
232 INSN_CONFIG_DIO_INPUT = 0, 232 INSN_CONFIG_DIO_INPUT = 0,
233 INSN_CONFIG_DIO_OUTPUT = 1, 233 INSN_CONFIG_DIO_OUTPUT = 1,
234 INSN_CONFIG_DIO_OPENDRAIN = 2, 234 INSN_CONFIG_DIO_OPENDRAIN = 2,
235 INSN_CONFIG_ANALOG_TRIG = 16, 235 INSN_CONFIG_ANALOG_TRIG = 16,
236// INSN_CONFIG_WAVEFORM = 17, 236/* INSN_CONFIG_WAVEFORM = 17, */
237// INSN_CONFIG_TRIG = 18, 237/* INSN_CONFIG_TRIG = 18, */
238// INSN_CONFIG_COUNTER = 19, 238/* INSN_CONFIG_COUNTER = 19, */
239 INSN_CONFIG_ALT_SOURCE = 20, 239 INSN_CONFIG_ALT_SOURCE = 20,
240 INSN_CONFIG_DIGITAL_TRIG = 21, 240 INSN_CONFIG_DIGITAL_TRIG = 21,
241 INSN_CONFIG_BLOCK_SIZE = 22, 241 INSN_CONFIG_BLOCK_SIZE = 22,
242 INSN_CONFIG_TIMER_1 = 23, 242 INSN_CONFIG_TIMER_1 = 23,
243 INSN_CONFIG_FILTER = 24, 243 INSN_CONFIG_FILTER = 24,
244 INSN_CONFIG_CHANGE_NOTIFY = 25, 244 INSN_CONFIG_CHANGE_NOTIFY = 25,
245 245
246 /*ALPHA*/ INSN_CONFIG_SERIAL_CLOCK = 26, 246 /*ALPHA*/ INSN_CONFIG_SERIAL_CLOCK = 26,
247 INSN_CONFIG_BIDIRECTIONAL_DATA = 27, 247 INSN_CONFIG_BIDIRECTIONAL_DATA = 27,
248 INSN_CONFIG_DIO_QUERY = 28, 248 INSN_CONFIG_DIO_QUERY = 28,
249 INSN_CONFIG_PWM_OUTPUT = 29, 249 INSN_CONFIG_PWM_OUTPUT = 29,
250 INSN_CONFIG_GET_PWM_OUTPUT = 30, 250 INSN_CONFIG_GET_PWM_OUTPUT = 30,
251 INSN_CONFIG_ARM = 31, 251 INSN_CONFIG_ARM = 31,
252 INSN_CONFIG_DISARM = 32, 252 INSN_CONFIG_DISARM = 32,
253 INSN_CONFIG_GET_COUNTER_STATUS = 33, 253 INSN_CONFIG_GET_COUNTER_STATUS = 33,
254 INSN_CONFIG_RESET = 34, 254 INSN_CONFIG_RESET = 34,
255 INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, // Use CTR as single pulsegenerator 255 INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, /* Use CTR as single pulsegenerator */
256 INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, // Use CTR as pulsetraingenerator 256 INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, /* Use CTR as pulsetraingenerator */
257 INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, // Use the counter as encoder 257 INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, /* Use the counter as encoder */
258 INSN_CONFIG_SET_GATE_SRC = 2001, // Set gate source 258 INSN_CONFIG_SET_GATE_SRC = 2001, /* Set gate source */
259 INSN_CONFIG_GET_GATE_SRC = 2002, // Get gate source 259 INSN_CONFIG_GET_GATE_SRC = 2002, /* Get gate source */
260 INSN_CONFIG_SET_CLOCK_SRC = 2003, // Set master clock source 260 INSN_CONFIG_SET_CLOCK_SRC = 2003, /* Set master clock source */
261 INSN_CONFIG_GET_CLOCK_SRC = 2004, // Get master clock source 261 INSN_CONFIG_GET_CLOCK_SRC = 2004, /* Get master clock source */
262 INSN_CONFIG_SET_OTHER_SRC = 2005, // Set other source 262 INSN_CONFIG_SET_OTHER_SRC = 2005, /* Set other source */
263// INSN_CONFIG_GET_OTHER_SRC = 2006, // Get other source 263/* INSN_CONFIG_GET_OTHER_SRC = 2006,*/ /* Get other source */
264 INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE, // Get size in bytes of subdevice's on-board fifos used during streaming input/output 264 INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE, /* Get size in bytes of
265 INSN_CONFIG_SET_COUNTER_MODE = 4097, 265 subdevice's on-board fifos
266 INSN_CONFIG_8254_SET_MODE = INSN_CONFIG_SET_COUNTER_MODE, /* deprecated */ 266 used during streaming
267 INSN_CONFIG_8254_READ_STATUS = 4098, 267 input/output */
268 INSN_CONFIG_SET_ROUTING = 4099, 268 INSN_CONFIG_SET_COUNTER_MODE = 4097,
269 INSN_CONFIG_GET_ROUTING = 4109, 269 INSN_CONFIG_8254_SET_MODE = INSN_CONFIG_SET_COUNTER_MODE, /* deprecated */
270 INSN_CONFIG_8254_READ_STATUS = 4098,
271 INSN_CONFIG_SET_ROUTING = 4099,
272 INSN_CONFIG_GET_ROUTING = 4109,
270/* PWM */ 273/* PWM */
271 INSN_CONFIG_PWM_SET_PERIOD = 5000, /* sets frequency */ 274 INSN_CONFIG_PWM_SET_PERIOD = 5000, /* sets frequency */
272 INSN_CONFIG_PWM_GET_PERIOD = 5001, /* gets frequency */ 275 INSN_CONFIG_PWM_GET_PERIOD = 5001, /* gets frequency */
273 INSN_CONFIG_GET_PWM_STATUS = 5002, /* is it running? */ 276 INSN_CONFIG_GET_PWM_STATUS = 5002, /* is it running? */
274 INSN_CONFIG_PWM_SET_H_BRIDGE = 5003, /* sets H bridge: duty cycle and sign bit for a relay at the same time*/ 277 INSN_CONFIG_PWM_SET_H_BRIDGE = 5003, /* sets H bridge: duty cycle and sign bit for a relay at the same time*/
275 INSN_CONFIG_PWM_GET_H_BRIDGE = 5004 /* gets H bridge data: duty cycle and the sign bit */ 278 INSN_CONFIG_PWM_GET_H_BRIDGE = 5004 /* gets H bridge data: duty cycle and the sign bit */
276 }; 279};
277 280
278 enum comedi_io_direction { 281enum comedi_io_direction {
279 COMEDI_INPUT = 0, 282 COMEDI_INPUT = 0,
280 COMEDI_OUTPUT = 1, 283 COMEDI_OUTPUT = 1,
281 COMEDI_OPENDRAIN = 2 284 COMEDI_OPENDRAIN = 2
282 }; 285};
283 286
284 enum comedi_support_level 287enum comedi_support_level {
285 { 288 COMEDI_UNKNOWN_SUPPORT = 0,
286 COMEDI_UNKNOWN_SUPPORT = 0, 289 COMEDI_SUPPORTED,
287 COMEDI_SUPPORTED, 290 COMEDI_UNSUPPORTED
288 COMEDI_UNSUPPORTED 291};
289 };
290 292
291/* ioctls */ 293/* ioctls */
292 294
293#define CIO 'd' 295#define CIO 'd'
294#define COMEDI_DEVCONFIG _IOW(CIO,0,comedi_devconfig) 296#define COMEDI_DEVCONFIG _IOW(CIO, 0, comedi_devconfig)
295#define COMEDI_DEVINFO _IOR(CIO,1,comedi_devinfo) 297#define COMEDI_DEVINFO _IOR(CIO, 1, comedi_devinfo)
296#define COMEDI_SUBDINFO _IOR(CIO,2,comedi_subdinfo) 298#define COMEDI_SUBDINFO _IOR(CIO, 2, comedi_subdinfo)
297#define COMEDI_CHANINFO _IOR(CIO,3,comedi_chaninfo) 299#define COMEDI_CHANINFO _IOR(CIO, 3, comedi_chaninfo)
298#define COMEDI_TRIG _IOWR(CIO,4,comedi_trig) 300#define COMEDI_TRIG _IOWR(CIO, 4, comedi_trig)
299#define COMEDI_LOCK _IO(CIO,5) 301#define COMEDI_LOCK _IO(CIO, 5)
300#define COMEDI_UNLOCK _IO(CIO,6) 302#define COMEDI_UNLOCK _IO(CIO, 6)
301#define COMEDI_CANCEL _IO(CIO,7) 303#define COMEDI_CANCEL _IO(CIO, 7)
302#define COMEDI_RANGEINFO _IOR(CIO,8,comedi_rangeinfo) 304#define COMEDI_RANGEINFO _IOR(CIO, 8, comedi_rangeinfo)
303#define COMEDI_CMD _IOR(CIO,9,comedi_cmd) 305#define COMEDI_CMD _IOR(CIO, 9, comedi_cmd)
304#define COMEDI_CMDTEST _IOR(CIO,10,comedi_cmd) 306#define COMEDI_CMDTEST _IOR(CIO, 10, comedi_cmd)
305#define COMEDI_INSNLIST _IOR(CIO,11,comedi_insnlist) 307#define COMEDI_INSNLIST _IOR(CIO, 11, comedi_insnlist)
306#define COMEDI_INSN _IOR(CIO,12,comedi_insn) 308#define COMEDI_INSN _IOR(CIO, 12, comedi_insn)
307#define COMEDI_BUFCONFIG _IOR(CIO,13,comedi_bufconfig) 309#define COMEDI_BUFCONFIG _IOR(CIO, 13, comedi_bufconfig)
308#define COMEDI_BUFINFO _IOWR(CIO,14,comedi_bufinfo) 310#define COMEDI_BUFINFO _IOWR(CIO, 14, comedi_bufinfo)
309#define COMEDI_POLL _IO(CIO,15) 311#define COMEDI_POLL _IO(CIO, 15)
310 312
311/* structures */ 313/* structures */
312 314
313 typedef struct comedi_trig_struct comedi_trig; 315typedef struct comedi_trig_struct comedi_trig;
314 typedef struct comedi_cmd_struct comedi_cmd; 316typedef struct comedi_cmd_struct comedi_cmd;
315 typedef struct comedi_insn_struct comedi_insn; 317typedef struct comedi_insn_struct comedi_insn;
316 typedef struct comedi_insnlist_struct comedi_insnlist; 318typedef struct comedi_insnlist_struct comedi_insnlist;
317 typedef struct comedi_chaninfo_struct comedi_chaninfo; 319typedef struct comedi_chaninfo_struct comedi_chaninfo;
318 typedef struct comedi_subdinfo_struct comedi_subdinfo; 320typedef struct comedi_subdinfo_struct comedi_subdinfo;
319 typedef struct comedi_devinfo_struct comedi_devinfo; 321typedef struct comedi_devinfo_struct comedi_devinfo;
320 typedef struct comedi_devconfig_struct comedi_devconfig; 322typedef struct comedi_devconfig_struct comedi_devconfig;
321 typedef struct comedi_rangeinfo_struct comedi_rangeinfo; 323typedef struct comedi_rangeinfo_struct comedi_rangeinfo;
322 typedef struct comedi_krange_struct comedi_krange; 324typedef struct comedi_krange_struct comedi_krange;
323 typedef struct comedi_bufconfig_struct comedi_bufconfig; 325typedef struct comedi_bufconfig_struct comedi_bufconfig;
324 typedef struct comedi_bufinfo_struct comedi_bufinfo; 326typedef struct comedi_bufinfo_struct comedi_bufinfo;
325 327
326 struct comedi_trig_struct { 328struct comedi_trig_struct {
327 unsigned int subdev; /* subdevice */ 329 unsigned int subdev; /* subdevice */
328 unsigned int mode; /* mode */ 330 unsigned int mode; /* mode */
329 unsigned int flags; 331 unsigned int flags;
330 unsigned int n_chan; /* number of channels */ 332 unsigned int n_chan; /* number of channels */
331 unsigned int *chanlist; /* channel/range list */ 333 unsigned int *chanlist; /* channel/range list */
332 sampl_t *data; /* data list, size depends on subd flags */ 334 sampl_t *data; /* data list, size depends on subd flags */
333 unsigned int n; /* number of scans */ 335 unsigned int n; /* number of scans */
334 unsigned int trigsrc; 336 unsigned int trigsrc;
335 unsigned int trigvar; 337 unsigned int trigvar;
336 unsigned int trigvar1; 338 unsigned int trigvar1;
337 unsigned int data_len; 339 unsigned int data_len;
338 unsigned int unused[3]; 340 unsigned int unused[3];
339 }; 341};
340 342
341 struct comedi_insn_struct { 343struct comedi_insn_struct {
342 unsigned int insn; 344 unsigned int insn;
343 unsigned int n; 345 unsigned int n;
344 lsampl_t *data; 346 lsampl_t *data;
345 unsigned int subdev; 347 unsigned int subdev;
346 unsigned int chanspec; 348 unsigned int chanspec;
347 unsigned int unused[3]; 349 unsigned int unused[3];
348 }; 350};
349 351
350 struct comedi_insnlist_struct { 352struct comedi_insnlist_struct {
351 unsigned int n_insns; 353 unsigned int n_insns;
352 comedi_insn *insns; 354 comedi_insn *insns;
353 }; 355};
354 356
355 struct comedi_cmd_struct { 357struct comedi_cmd_struct {
356 unsigned int subdev; 358 unsigned int subdev;
357 unsigned int flags; 359 unsigned int flags;
358 360
359 unsigned int start_src; 361 unsigned int start_src;
360 unsigned int start_arg; 362 unsigned int start_arg;
361 363
362 unsigned int scan_begin_src; 364 unsigned int scan_begin_src;
363 unsigned int scan_begin_arg; 365 unsigned int scan_begin_arg;
364 366
365 unsigned int convert_src; 367 unsigned int convert_src;
366 unsigned int convert_arg; 368 unsigned int convert_arg;
367 369
368 unsigned int scan_end_src; 370 unsigned int scan_end_src;
369 unsigned int scan_end_arg; 371 unsigned int scan_end_arg;
370 372
371 unsigned int stop_src; 373 unsigned int stop_src;
372 unsigned int stop_arg; 374 unsigned int stop_arg;
373 375
374 unsigned int *chanlist; /* channel/range list */ 376 unsigned int *chanlist; /* channel/range list */
375 unsigned int chanlist_len; 377 unsigned int chanlist_len;
376 378
377 sampl_t *data; /* data list, size depends on subd flags */ 379 sampl_t *data; /* data list, size depends on subd flags */
378 unsigned int data_len; 380 unsigned int data_len;
379 }; 381};
380 382
381 struct comedi_chaninfo_struct { 383struct comedi_chaninfo_struct {
382 unsigned int subdev; 384 unsigned int subdev;
383 lsampl_t *maxdata_list; 385 lsampl_t *maxdata_list;
384 unsigned int *flaglist; 386 unsigned int *flaglist;
385 unsigned int *rangelist; 387 unsigned int *rangelist;
386 unsigned int unused[4]; 388 unsigned int unused[4];
387 }; 389};
388 390
389 struct comedi_rangeinfo_struct { 391struct comedi_rangeinfo_struct {
390 unsigned int range_type; 392 unsigned int range_type;
391 void *range_ptr; 393 void *range_ptr;
392 }; 394};
393 395
394 struct comedi_krange_struct { 396struct comedi_krange_struct {
395 int min; /* fixed point, multiply by 1e-6 */ 397 int min; /* fixed point, multiply by 1e-6 */
396 int max; /* fixed point, multiply by 1e-6 */ 398 int max; /* fixed point, multiply by 1e-6 */
397 unsigned int flags; 399 unsigned int flags;
398 }; 400};
399 401
400 402
401 struct comedi_subdinfo_struct { 403struct comedi_subdinfo_struct {
402 unsigned int type; 404 unsigned int type;
403 unsigned int n_chan; 405 unsigned int n_chan;
404 unsigned int subd_flags; 406 unsigned int subd_flags;
405 unsigned int timer_type; 407 unsigned int timer_type;
406 unsigned int len_chanlist; 408 unsigned int len_chanlist;
407 lsampl_t maxdata; 409 lsampl_t maxdata;
408 unsigned int flags; /* channel flags */ 410 unsigned int flags; /* channel flags */
409 unsigned int range_type; /* lookup in kernel */ 411 unsigned int range_type; /* lookup in kernel */
410 unsigned int settling_time_0; 412 unsigned int settling_time_0;
411 unsigned insn_bits_support; /* see support_level enum for values*/ 413 unsigned insn_bits_support; /* see support_level enum for values*/
412 unsigned int unused[8]; 414 unsigned int unused[8];
413 }; 415};
414 416
415 struct comedi_devinfo_struct { 417struct comedi_devinfo_struct {
416 unsigned int version_code; 418 unsigned int version_code;
417 unsigned int n_subdevs; 419 unsigned int n_subdevs;
418 char driver_name[COMEDI_NAMELEN]; 420 char driver_name[COMEDI_NAMELEN];
419 char board_name[COMEDI_NAMELEN]; 421 char board_name[COMEDI_NAMELEN];
420 int read_subdevice; 422 int read_subdevice;
421 int write_subdevice; 423 int write_subdevice;
422 int unused[30]; 424 int unused[30];
423 }; 425};
424 426
425 struct comedi_devconfig_struct { 427struct comedi_devconfig_struct {
426 char board_name[COMEDI_NAMELEN]; 428 char board_name[COMEDI_NAMELEN];
427 int options[COMEDI_NDEVCONFOPTS]; 429 int options[COMEDI_NDEVCONFOPTS];
428 }; 430};
429 431
430 struct comedi_bufconfig_struct { 432struct comedi_bufconfig_struct {
431 unsigned int subdevice; 433 unsigned int subdevice;
432 unsigned int flags; 434 unsigned int flags;
433 435
434 unsigned int maximum_size; 436 unsigned int maximum_size;
435 unsigned int size; 437 unsigned int size;
436 438
437 unsigned int unused[4]; 439 unsigned int unused[4];
438 }; 440};
439 441
440 struct comedi_bufinfo_struct { 442struct comedi_bufinfo_struct {
441 unsigned int subdevice; 443 unsigned int subdevice;
442 unsigned int bytes_read; 444 unsigned int bytes_read;
443 445
444 unsigned int buf_write_ptr; 446 unsigned int buf_write_ptr;
445 unsigned int buf_read_ptr; 447 unsigned int buf_read_ptr;
446 unsigned int buf_write_count; 448 unsigned int buf_write_count;
447 unsigned int buf_read_count; 449 unsigned int buf_read_count;
448 450
449 unsigned int bytes_written; 451 unsigned int bytes_written;
450 452
451 unsigned int unused[4]; 453 unsigned int unused[4];
452 }; 454};
453 455
454/* range stuff */ 456/* range stuff */
455 457
456#define __RANGE(a,b) ((((a)&0xffff)<<16)|((b)&0xffff)) 458#define __RANGE(a, b) ((((a)&0xffff)<<16)|((b)&0xffff))
457 459
458#define RANGE_OFFSET(a) (((a)>>16)&0xffff) 460#define RANGE_OFFSET(a) (((a)>>16)&0xffff)
459#define RANGE_LENGTH(b) ((b)&0xffff) 461#define RANGE_LENGTH(b) ((b)&0xffff)
@@ -494,282 +496,304 @@ extern "C" {
494 496
495 0 ID: INSN_CONFIG_8254_READ_STATUS 497 0 ID: INSN_CONFIG_8254_READ_STATUS
496 1 <-- Status byte returned here. 498 1 <-- Status byte returned here.
497 B7=Output 499 B7 = Output
498 B6=NULL Count 500 B6 = NULL Count
499 B5-B0 Current mode. 501 B5 - B0 Current mode.
500 502
501*/ 503*/
502 504
503 enum i8254_mode { 505enum i8254_mode {
504 I8254_MODE0 = (0 << 1), /* Interrupt on terminal count */ 506 I8254_MODE0 = (0 << 1), /* Interrupt on terminal count */
505 I8254_MODE1 = (1 << 1), /* Hardware retriggerable one-shot */ 507 I8254_MODE1 = (1 << 1), /* Hardware retriggerable one-shot */
506 I8254_MODE2 = (2 << 1), /* Rate generator */ 508 I8254_MODE2 = (2 << 1), /* Rate generator */
507 I8254_MODE3 = (3 << 1), /* Square wave mode */ 509 I8254_MODE3 = (3 << 1), /* Square wave mode */
508 I8254_MODE4 = (4 << 1), /* Software triggered strobe */ 510 I8254_MODE4 = (4 << 1), /* Software triggered strobe */
509 I8254_MODE5 = (5 << 1), /* Hardware triggered strobe (retriggerable) */ 511 I8254_MODE5 = (5 << 1), /* Hardware triggered strobe (retriggerable) */
510 I8254_BCD = 1, /* use binary-coded decimal instead of binary (pretty useless) */ 512 I8254_BCD = 1, /* use binary-coded decimal instead of binary (pretty useless) */
511 I8254_BINARY = 0 513 I8254_BINARY = 0
512 }; 514};
513 515
514 static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel) { 516static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel)
515 if (pfi_channel < 10) 517{
516 return 0x1 + pfi_channel; 518 if (pfi_channel < 10)
517 else 519 return 0x1 + pfi_channel;
518 return 0xb + pfi_channel; 520 else
519 } static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel) { 521 return 0xb + pfi_channel;
520 if (rtsi_channel < 7) 522}
521 return 0xb + rtsi_channel; 523static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel)
522 else 524{
523 return 0x1b; 525 if (rtsi_channel < 7)
524 } 526 return 0xb + rtsi_channel;
525/* mode bits for NI general-purpose counters, set with INSN_CONFIG_SET_COUNTER_MODE */ 527 else
528 return 0x1b;
529}
530/* mode bits for NI general-purpose counters, set with
531 * INSN_CONFIG_SET_COUNTER_MODE */
526#define NI_GPCT_COUNTING_MODE_SHIFT 16 532#define NI_GPCT_COUNTING_MODE_SHIFT 16
527#define NI_GPCT_INDEX_PHASE_BITSHIFT 20 533#define NI_GPCT_INDEX_PHASE_BITSHIFT 20
528#define NI_GPCT_COUNTING_DIRECTION_SHIFT 24 534#define NI_GPCT_COUNTING_DIRECTION_SHIFT 24
529 enum ni_gpct_mode_bits { 535enum ni_gpct_mode_bits {
530 NI_GPCT_GATE_ON_BOTH_EDGES_BIT = 0x4, 536 NI_GPCT_GATE_ON_BOTH_EDGES_BIT = 0x4,
531 NI_GPCT_EDGE_GATE_MODE_MASK = 0x18, 537 NI_GPCT_EDGE_GATE_MODE_MASK = 0x18,
532 NI_GPCT_EDGE_GATE_STARTS_STOPS_BITS = 0x0, 538 NI_GPCT_EDGE_GATE_STARTS_STOPS_BITS = 0x0,
533 NI_GPCT_EDGE_GATE_STOPS_STARTS_BITS = 0x8, 539 NI_GPCT_EDGE_GATE_STOPS_STARTS_BITS = 0x8,
534 NI_GPCT_EDGE_GATE_STARTS_BITS = 0x10, 540 NI_GPCT_EDGE_GATE_STARTS_BITS = 0x10,
535 NI_GPCT_EDGE_GATE_NO_STARTS_NO_STOPS_BITS = 0x18, 541 NI_GPCT_EDGE_GATE_NO_STARTS_NO_STOPS_BITS = 0x18,
536 NI_GPCT_STOP_MODE_MASK = 0x60, 542 NI_GPCT_STOP_MODE_MASK = 0x60,
537 NI_GPCT_STOP_ON_GATE_BITS = 0x00, 543 NI_GPCT_STOP_ON_GATE_BITS = 0x00,
538 NI_GPCT_STOP_ON_GATE_OR_TC_BITS = 0x20, 544 NI_GPCT_STOP_ON_GATE_OR_TC_BITS = 0x20,
539 NI_GPCT_STOP_ON_GATE_OR_SECOND_TC_BITS = 0x40, 545 NI_GPCT_STOP_ON_GATE_OR_SECOND_TC_BITS = 0x40,
540 NI_GPCT_LOAD_B_SELECT_BIT = 0x80, 546 NI_GPCT_LOAD_B_SELECT_BIT = 0x80,
541 NI_GPCT_OUTPUT_MODE_MASK = 0x300, 547 NI_GPCT_OUTPUT_MODE_MASK = 0x300,
542 NI_GPCT_OUTPUT_TC_PULSE_BITS = 0x100, 548 NI_GPCT_OUTPUT_TC_PULSE_BITS = 0x100,
543 NI_GPCT_OUTPUT_TC_TOGGLE_BITS = 0x200, 549 NI_GPCT_OUTPUT_TC_TOGGLE_BITS = 0x200,
544 NI_GPCT_OUTPUT_TC_OR_GATE_TOGGLE_BITS = 0x300, 550 NI_GPCT_OUTPUT_TC_OR_GATE_TOGGLE_BITS = 0x300,
545 NI_GPCT_HARDWARE_DISARM_MASK = 0xc00, 551 NI_GPCT_HARDWARE_DISARM_MASK = 0xc00,
546 NI_GPCT_NO_HARDWARE_DISARM_BITS = 0x000, 552 NI_GPCT_NO_HARDWARE_DISARM_BITS = 0x000,
547 NI_GPCT_DISARM_AT_TC_BITS = 0x400, 553 NI_GPCT_DISARM_AT_TC_BITS = 0x400,
548 NI_GPCT_DISARM_AT_GATE_BITS = 0x800, 554 NI_GPCT_DISARM_AT_GATE_BITS = 0x800,
549 NI_GPCT_DISARM_AT_TC_OR_GATE_BITS = 0xc00, 555 NI_GPCT_DISARM_AT_TC_OR_GATE_BITS = 0xc00,
550 NI_GPCT_LOADING_ON_TC_BIT = 0x1000, 556 NI_GPCT_LOADING_ON_TC_BIT = 0x1000,
551 NI_GPCT_LOADING_ON_GATE_BIT = 0x4000, 557 NI_GPCT_LOADING_ON_GATE_BIT = 0x4000,
552 NI_GPCT_COUNTING_MODE_MASK = 0x7 << NI_GPCT_COUNTING_MODE_SHIFT, 558 NI_GPCT_COUNTING_MODE_MASK = 0x7 << NI_GPCT_COUNTING_MODE_SHIFT,
553 NI_GPCT_COUNTING_MODE_NORMAL_BITS = 559 NI_GPCT_COUNTING_MODE_NORMAL_BITS =
554 0x0 << NI_GPCT_COUNTING_MODE_SHIFT, 560 0x0 << NI_GPCT_COUNTING_MODE_SHIFT,
555 NI_GPCT_COUNTING_MODE_QUADRATURE_X1_BITS = 561 NI_GPCT_COUNTING_MODE_QUADRATURE_X1_BITS =
556 0x1 << NI_GPCT_COUNTING_MODE_SHIFT, 562 0x1 << NI_GPCT_COUNTING_MODE_SHIFT,
557 NI_GPCT_COUNTING_MODE_QUADRATURE_X2_BITS = 563 NI_GPCT_COUNTING_MODE_QUADRATURE_X2_BITS =
558 0x2 << NI_GPCT_COUNTING_MODE_SHIFT, 564 0x2 << NI_GPCT_COUNTING_MODE_SHIFT,
559 NI_GPCT_COUNTING_MODE_QUADRATURE_X4_BITS = 565 NI_GPCT_COUNTING_MODE_QUADRATURE_X4_BITS =
560 0x3 << NI_GPCT_COUNTING_MODE_SHIFT, 566 0x3 << NI_GPCT_COUNTING_MODE_SHIFT,
561 NI_GPCT_COUNTING_MODE_TWO_PULSE_BITS = 567 NI_GPCT_COUNTING_MODE_TWO_PULSE_BITS =
562 0x4 << NI_GPCT_COUNTING_MODE_SHIFT, 568 0x4 << NI_GPCT_COUNTING_MODE_SHIFT,
563 NI_GPCT_COUNTING_MODE_SYNC_SOURCE_BITS = 569 NI_GPCT_COUNTING_MODE_SYNC_SOURCE_BITS =
564 0x6 << NI_GPCT_COUNTING_MODE_SHIFT, 570 0x6 << NI_GPCT_COUNTING_MODE_SHIFT,
565 NI_GPCT_INDEX_PHASE_MASK = 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT, 571 NI_GPCT_INDEX_PHASE_MASK = 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT,
566 NI_GPCT_INDEX_PHASE_LOW_A_LOW_B_BITS = 572 NI_GPCT_INDEX_PHASE_LOW_A_LOW_B_BITS =
567 0x0 << NI_GPCT_INDEX_PHASE_BITSHIFT, 573 0x0 << NI_GPCT_INDEX_PHASE_BITSHIFT,
568 NI_GPCT_INDEX_PHASE_LOW_A_HIGH_B_BITS = 574 NI_GPCT_INDEX_PHASE_LOW_A_HIGH_B_BITS =
569 0x1 << NI_GPCT_INDEX_PHASE_BITSHIFT, 575 0x1 << NI_GPCT_INDEX_PHASE_BITSHIFT,
570 NI_GPCT_INDEX_PHASE_HIGH_A_LOW_B_BITS = 576 NI_GPCT_INDEX_PHASE_HIGH_A_LOW_B_BITS =
571 0x2 << NI_GPCT_INDEX_PHASE_BITSHIFT, 577 0x2 << NI_GPCT_INDEX_PHASE_BITSHIFT,
572 NI_GPCT_INDEX_PHASE_HIGH_A_HIGH_B_BITS = 578 NI_GPCT_INDEX_PHASE_HIGH_A_HIGH_B_BITS =
573 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT, 579 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT,
574 NI_GPCT_INDEX_ENABLE_BIT = 0x400000, 580 NI_GPCT_INDEX_ENABLE_BIT = 0x400000,
575 NI_GPCT_COUNTING_DIRECTION_MASK = 581 NI_GPCT_COUNTING_DIRECTION_MASK =
576 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT, 582 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT,
577 NI_GPCT_COUNTING_DIRECTION_DOWN_BITS = 583 NI_GPCT_COUNTING_DIRECTION_DOWN_BITS =
578 0x00 << NI_GPCT_COUNTING_DIRECTION_SHIFT, 584 0x00 << NI_GPCT_COUNTING_DIRECTION_SHIFT,
579 NI_GPCT_COUNTING_DIRECTION_UP_BITS = 585 NI_GPCT_COUNTING_DIRECTION_UP_BITS =
580 0x1 << NI_GPCT_COUNTING_DIRECTION_SHIFT, 586 0x1 << NI_GPCT_COUNTING_DIRECTION_SHIFT,
581 NI_GPCT_COUNTING_DIRECTION_HW_UP_DOWN_BITS = 587 NI_GPCT_COUNTING_DIRECTION_HW_UP_DOWN_BITS =
582 0x2 << NI_GPCT_COUNTING_DIRECTION_SHIFT, 588 0x2 << NI_GPCT_COUNTING_DIRECTION_SHIFT,
583 NI_GPCT_COUNTING_DIRECTION_HW_GATE_BITS = 589 NI_GPCT_COUNTING_DIRECTION_HW_GATE_BITS =
584 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT, 590 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT,
585 NI_GPCT_RELOAD_SOURCE_MASK = 0xc000000, 591 NI_GPCT_RELOAD_SOURCE_MASK = 0xc000000,
586 NI_GPCT_RELOAD_SOURCE_FIXED_BITS = 0x0, 592 NI_GPCT_RELOAD_SOURCE_FIXED_BITS = 0x0,
587 NI_GPCT_RELOAD_SOURCE_SWITCHING_BITS = 0x4000000, 593 NI_GPCT_RELOAD_SOURCE_SWITCHING_BITS = 0x4000000,
588 NI_GPCT_RELOAD_SOURCE_GATE_SELECT_BITS = 0x8000000, 594 NI_GPCT_RELOAD_SOURCE_GATE_SELECT_BITS = 0x8000000,
589 NI_GPCT_OR_GATE_BIT = 0x10000000, 595 NI_GPCT_OR_GATE_BIT = 0x10000000,
590 NI_GPCT_INVERT_OUTPUT_BIT = 0x20000000 596 NI_GPCT_INVERT_OUTPUT_BIT = 0x20000000
591 }; 597};
592 598
593/* Bits for setting a clock source with 599/* Bits for setting a clock source with
594 * INSN_CONFIG_SET_CLOCK_SRC when using NI general-purpose counters. */ 600 * INSN_CONFIG_SET_CLOCK_SRC when using NI general-purpose counters. */
595 enum ni_gpct_clock_source_bits { 601enum ni_gpct_clock_source_bits {
596 NI_GPCT_CLOCK_SRC_SELECT_MASK = 0x3f, 602 NI_GPCT_CLOCK_SRC_SELECT_MASK = 0x3f,
597 NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS = 0x0, 603 NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS = 0x0,
598 NI_GPCT_TIMEBASE_2_CLOCK_SRC_BITS = 0x1, 604 NI_GPCT_TIMEBASE_2_CLOCK_SRC_BITS = 0x1,
599 NI_GPCT_TIMEBASE_3_CLOCK_SRC_BITS = 0x2, 605 NI_GPCT_TIMEBASE_3_CLOCK_SRC_BITS = 0x2,
600 NI_GPCT_LOGIC_LOW_CLOCK_SRC_BITS = 0x3, 606 NI_GPCT_LOGIC_LOW_CLOCK_SRC_BITS = 0x3,
601 NI_GPCT_NEXT_GATE_CLOCK_SRC_BITS = 0x4, 607 NI_GPCT_NEXT_GATE_CLOCK_SRC_BITS = 0x4,
602 NI_GPCT_NEXT_TC_CLOCK_SRC_BITS = 0x5, 608 NI_GPCT_NEXT_TC_CLOCK_SRC_BITS = 0x5,
603 NI_GPCT_SOURCE_PIN_i_CLOCK_SRC_BITS = 0x6, /* NI 660x-specific */ 609 NI_GPCT_SOURCE_PIN_i_CLOCK_SRC_BITS = 0x6, /* NI 660x-specific */
604 NI_GPCT_PXI10_CLOCK_SRC_BITS = 0x7, 610 NI_GPCT_PXI10_CLOCK_SRC_BITS = 0x7,
605 NI_GPCT_PXI_STAR_TRIGGER_CLOCK_SRC_BITS = 0x8, 611 NI_GPCT_PXI_STAR_TRIGGER_CLOCK_SRC_BITS = 0x8,
606 NI_GPCT_ANALOG_TRIGGER_OUT_CLOCK_SRC_BITS = 0x9, 612 NI_GPCT_ANALOG_TRIGGER_OUT_CLOCK_SRC_BITS = 0x9,
607 NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK = 0x30000000, 613 NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK = 0x30000000,
608 NI_GPCT_NO_PRESCALE_CLOCK_SRC_BITS = 0x0, 614 NI_GPCT_NO_PRESCALE_CLOCK_SRC_BITS = 0x0,
609 NI_GPCT_PRESCALE_X2_CLOCK_SRC_BITS = 0x10000000, /* divide source by 2 */ 615 NI_GPCT_PRESCALE_X2_CLOCK_SRC_BITS = 0x10000000, /* divide source by 2 */
610 NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS = 0x20000000, /* divide source by 8 */ 616 NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS = 0x20000000, /* divide source by 8 */
611 NI_GPCT_INVERT_CLOCK_SRC_BIT = 0x80000000 617 NI_GPCT_INVERT_CLOCK_SRC_BIT = 0x80000000
612 }; 618};
613 static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(unsigned n) { /* NI 660x-specific */ 619static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(unsigned n)
614 return 0x10 + n; 620{
615 } 621 /* NI 660x-specific */
616 static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(unsigned n) { 622 return 0x10 + n;
617 return 0x18 + n; 623}
618 } 624static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(unsigned n)
619 static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(unsigned n) { /* no pfi on NI 660x */ 625{
620 return 0x20 + n; 626 return 0x18 + n;
621 } 627}
628static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(unsigned n)
629{
630 /* no pfi on NI 660x */
631 return 0x20 + n;
632}
622 633
623/* Possibilities for setting a gate source with 634/* Possibilities for setting a gate source with
624INSN_CONFIG_SET_GATE_SRC when using NI general-purpose counters. 635INSN_CONFIG_SET_GATE_SRC when using NI general-purpose counters.
625May be bitwise-or'd with CR_EDGE or CR_INVERT. */ 636May be bitwise-or'd with CR_EDGE or CR_INVERT. */
626 enum ni_gpct_gate_select { 637enum ni_gpct_gate_select {
627 /* m-series gates */ 638 /* m-series gates */
628 NI_GPCT_TIMESTAMP_MUX_GATE_SELECT = 0x0, 639 NI_GPCT_TIMESTAMP_MUX_GATE_SELECT = 0x0,
629 NI_GPCT_AI_START2_GATE_SELECT = 0x12, 640 NI_GPCT_AI_START2_GATE_SELECT = 0x12,
630 NI_GPCT_PXI_STAR_TRIGGER_GATE_SELECT = 0x13, 641 NI_GPCT_PXI_STAR_TRIGGER_GATE_SELECT = 0x13,
631 NI_GPCT_NEXT_OUT_GATE_SELECT = 0x14, 642 NI_GPCT_NEXT_OUT_GATE_SELECT = 0x14,
632 NI_GPCT_AI_START1_GATE_SELECT = 0x1c, 643 NI_GPCT_AI_START1_GATE_SELECT = 0x1c,
633 NI_GPCT_NEXT_SOURCE_GATE_SELECT = 0x1d, 644 NI_GPCT_NEXT_SOURCE_GATE_SELECT = 0x1d,
634 NI_GPCT_ANALOG_TRIGGER_OUT_GATE_SELECT = 0x1e, 645 NI_GPCT_ANALOG_TRIGGER_OUT_GATE_SELECT = 0x1e,
635 NI_GPCT_LOGIC_LOW_GATE_SELECT = 0x1f, 646 NI_GPCT_LOGIC_LOW_GATE_SELECT = 0x1f,
636 /* more gates for 660x */ 647 /* more gates for 660x */
637 NI_GPCT_SOURCE_PIN_i_GATE_SELECT = 0x100, 648 NI_GPCT_SOURCE_PIN_i_GATE_SELECT = 0x100,
638 NI_GPCT_GATE_PIN_i_GATE_SELECT = 0x101, 649 NI_GPCT_GATE_PIN_i_GATE_SELECT = 0x101,
639 /* more gates for 660x "second gate" */ 650 /* more gates for 660x "second gate" */
640 NI_GPCT_UP_DOWN_PIN_i_GATE_SELECT = 0x201, 651 NI_GPCT_UP_DOWN_PIN_i_GATE_SELECT = 0x201,
641 NI_GPCT_SELECTED_GATE_GATE_SELECT = 0x21e, 652 NI_GPCT_SELECTED_GATE_GATE_SELECT = 0x21e,
642 /* m-series "second gate" sources are unknown, 653 /* m-series "second gate" sources are unknown,
643 we should add them here with an offset of 0x300 when known. */ 654 we should add them here with an offset of 0x300 when known. */
644 NI_GPCT_DISABLED_GATE_SELECT = 0x8000, 655 NI_GPCT_DISABLED_GATE_SELECT = 0x8000,
645 }; 656};
646 static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(unsigned n) { 657static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(unsigned n)
647 return 0x102 + n; 658{
648 } 659 return 0x102 + n;
649 static inline unsigned NI_GPCT_RTSI_GATE_SELECT(unsigned n) { 660}
650 return NI_USUAL_RTSI_SELECT(n); 661static inline unsigned NI_GPCT_RTSI_GATE_SELECT(unsigned n)
651 } 662{
652 static inline unsigned NI_GPCT_PFI_GATE_SELECT(unsigned n) { 663 return NI_USUAL_RTSI_SELECT(n);
653 return NI_USUAL_PFI_SELECT(n); 664}
654 } 665static inline unsigned NI_GPCT_PFI_GATE_SELECT(unsigned n)
655 static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(unsigned n) { 666{
656 return 0x202 + n; 667 return NI_USUAL_PFI_SELECT(n);
657 } 668}
669static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(unsigned n)
670{
671 return 0x202 + n;
672}
658 673
659/* Possibilities for setting a source with 674/* Possibilities for setting a source with
660INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */ 675INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */
661 enum ni_gpct_other_index { 676enum ni_gpct_other_index {
662 NI_GPCT_SOURCE_ENCODER_A, 677 NI_GPCT_SOURCE_ENCODER_A,
663 NI_GPCT_SOURCE_ENCODER_B, 678 NI_GPCT_SOURCE_ENCODER_B,
664 NI_GPCT_SOURCE_ENCODER_Z 679 NI_GPCT_SOURCE_ENCODER_Z
665 }; 680};
666 enum ni_gpct_other_select { 681enum ni_gpct_other_select {
667 /* m-series gates */ 682 /* m-series gates */
668 // Still unknown, probably only need NI_GPCT_PFI_OTHER_SELECT 683 /* Still unknown, probably only need NI_GPCT_PFI_OTHER_SELECT */
669 NI_GPCT_DISABLED_OTHER_SELECT = 0x8000, 684 NI_GPCT_DISABLED_OTHER_SELECT = 0x8000,
670 }; 685};
671 static inline unsigned NI_GPCT_PFI_OTHER_SELECT(unsigned n) { 686static inline unsigned NI_GPCT_PFI_OTHER_SELECT(unsigned n)
672 return NI_USUAL_PFI_SELECT(n); 687{
673 } 688 return NI_USUAL_PFI_SELECT(n);
689}
674 690
675/* start sources for ni general-purpose counters for use with 691/* start sources for ni general-purpose counters for use with
676INSN_CONFIG_ARM */ 692INSN_CONFIG_ARM */
677 enum ni_gpct_arm_source { 693enum ni_gpct_arm_source {
678 NI_GPCT_ARM_IMMEDIATE = 0x0, 694 NI_GPCT_ARM_IMMEDIATE = 0x0,
679 NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter and the adjacent paired counter simultaneously */ 695 NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter and
680 /* NI doesn't document bits for selecting hardware arm triggers. If 696 the adjacent paired counter
681 the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least significant 697 simultaneously */
682 bits (3 bits for 660x or 5 bits for m-series) through to the hardware. 698 /* NI doesn't document bits for selecting hardware arm triggers. If
683 This will at least allow someone to figure out what the bits do later. */ 699 * the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least
684 NI_GPCT_ARM_UNKNOWN = 0x1000, 700 * significant bits (3 bits for 660x or 5 bits for m-series) through to
685 }; 701 * the hardware. This will at least allow someone to figure out what
702 * the bits do later. */
703 NI_GPCT_ARM_UNKNOWN = 0x1000,
704};
686 705
687/* digital filtering options for ni 660x for use with INSN_CONFIG_FILTER. */ 706/* digital filtering options for ni 660x for use with INSN_CONFIG_FILTER. */
688 enum ni_gpct_filter_select { 707enum ni_gpct_filter_select {
689 NI_GPCT_FILTER_OFF = 0x0, 708 NI_GPCT_FILTER_OFF = 0x0,
690 NI_GPCT_FILTER_TIMEBASE_3_SYNC = 0x1, 709 NI_GPCT_FILTER_TIMEBASE_3_SYNC = 0x1,
691 NI_GPCT_FILTER_100x_TIMEBASE_1 = 0x2, 710 NI_GPCT_FILTER_100x_TIMEBASE_1 = 0x2,
692 NI_GPCT_FILTER_20x_TIMEBASE_1 = 0x3, 711 NI_GPCT_FILTER_20x_TIMEBASE_1 = 0x3,
693 NI_GPCT_FILTER_10x_TIMEBASE_1 = 0x4, 712 NI_GPCT_FILTER_10x_TIMEBASE_1 = 0x4,
694 NI_GPCT_FILTER_2x_TIMEBASE_1 = 0x5, 713 NI_GPCT_FILTER_2x_TIMEBASE_1 = 0x5,
695 NI_GPCT_FILTER_2x_TIMEBASE_3 = 0x6 714 NI_GPCT_FILTER_2x_TIMEBASE_3 = 0x6
696 }; 715};
697 716
698/* PFI digital filtering options for ni m-series for use with INSN_CONFIG_FILTER. */ 717/* PFI digital filtering options for ni m-series for use with
699 enum ni_pfi_filter_select { 718 * INSN_CONFIG_FILTER. */
700 NI_PFI_FILTER_OFF = 0x0, 719enum ni_pfi_filter_select {
701 NI_PFI_FILTER_125ns = 0x1, 720 NI_PFI_FILTER_OFF = 0x0,
702 NI_PFI_FILTER_6425ns = 0x2, 721 NI_PFI_FILTER_125ns = 0x1,
703 NI_PFI_FILTER_2550us = 0x3 722 NI_PFI_FILTER_6425ns = 0x2,
704 }; 723 NI_PFI_FILTER_2550us = 0x3
724};
705 725
706/* master clock sources for ni mio boards and INSN_CONFIG_SET_CLOCK_SRC */ 726/* master clock sources for ni mio boards and INSN_CONFIG_SET_CLOCK_SRC */
707 enum ni_mio_clock_source { 727enum ni_mio_clock_source {
708 NI_MIO_INTERNAL_CLOCK = 0, 728 NI_MIO_INTERNAL_CLOCK = 0,
709 NI_MIO_RTSI_CLOCK = 1, /* doesn't work for m-series, use NI_MIO_PLL_RTSI_CLOCK() */ 729 NI_MIO_RTSI_CLOCK = 1, /* doesn't work for m-series, use
710 /* the NI_MIO_PLL_* sources are m-series only */ 730 NI_MIO_PLL_RTSI_CLOCK() */
711 NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK = 2, 731 /* the NI_MIO_PLL_* sources are m-series only */
712 NI_MIO_PLL_PXI10_CLOCK = 3, 732 NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK = 2,
713 NI_MIO_PLL_RTSI0_CLOCK = 4 733 NI_MIO_PLL_PXI10_CLOCK = 3,
714 }; 734 NI_MIO_PLL_RTSI0_CLOCK = 4
715 static inline unsigned NI_MIO_PLL_RTSI_CLOCK(unsigned rtsi_channel) { 735};
716 return NI_MIO_PLL_RTSI0_CLOCK + rtsi_channel; 736static inline unsigned NI_MIO_PLL_RTSI_CLOCK(unsigned rtsi_channel)
717 } 737{
738 return NI_MIO_PLL_RTSI0_CLOCK + rtsi_channel;
739}
718 740
719/* Signals which can be routed to an NI RTSI pin with INSN_CONFIG_SET_ROUTING. 741/* Signals which can be routed to an NI RTSI pin with INSN_CONFIG_SET_ROUTING.
720 The numbers assigned are not arbitrary, they correspond to the bits required 742 The numbers assigned are not arbitrary, they correspond to the bits required
721 to program the board. */ 743 to program the board. */
722 enum ni_rtsi_routing { 744enum ni_rtsi_routing {
723 NI_RTSI_OUTPUT_ADR_START1 = 0, 745 NI_RTSI_OUTPUT_ADR_START1 = 0,
724 NI_RTSI_OUTPUT_ADR_START2 = 1, 746 NI_RTSI_OUTPUT_ADR_START2 = 1,
725 NI_RTSI_OUTPUT_SCLKG = 2, 747 NI_RTSI_OUTPUT_SCLKG = 2,
726 NI_RTSI_OUTPUT_DACUPDN = 3, 748 NI_RTSI_OUTPUT_DACUPDN = 3,
727 NI_RTSI_OUTPUT_DA_START1 = 4, 749 NI_RTSI_OUTPUT_DA_START1 = 4,
728 NI_RTSI_OUTPUT_G_SRC0 = 5, 750 NI_RTSI_OUTPUT_G_SRC0 = 5,
729 NI_RTSI_OUTPUT_G_GATE0 = 6, 751 NI_RTSI_OUTPUT_G_GATE0 = 6,
730 NI_RTSI_OUTPUT_RGOUT0 = 7, 752 NI_RTSI_OUTPUT_RGOUT0 = 7,
731 NI_RTSI_OUTPUT_RTSI_BRD_0 = 8, 753 NI_RTSI_OUTPUT_RTSI_BRD_0 = 8,
732 NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI clock on line 7 */ 754 NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI clock
733 }; 755 on line 7 */
734 static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(unsigned n) { 756};
735 return NI_RTSI_OUTPUT_RTSI_BRD_0 + n; 757static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(unsigned n)
736 } 758{
737 759 return NI_RTSI_OUTPUT_RTSI_BRD_0 + n;
738/* Signals which can be routed to an NI PFI pin on an m-series board 760}
739 with INSN_CONFIG_SET_ROUTING. These numbers are also returned 761
740 by INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though 762/* Signals which can be routed to an NI PFI pin on an m-series board with
741 their routing cannot be changed. The numbers assigned are 763 * INSN_CONFIG_SET_ROUTING. These numbers are also returned by
742 not arbitrary, they correspond to the bits required 764 * INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though their routing
743 to program the board. */ 765 * cannot be changed. The numbers assigned are not arbitrary, they correspond
744 enum ni_pfi_routing { 766 * to the bits required to program the board. */
745 NI_PFI_OUTPUT_PFI_DEFAULT = 0, 767enum ni_pfi_routing {
746 NI_PFI_OUTPUT_AI_START1 = 1, 768 NI_PFI_OUTPUT_PFI_DEFAULT = 0,
747 NI_PFI_OUTPUT_AI_START2 = 2, 769 NI_PFI_OUTPUT_AI_START1 = 1,
748 NI_PFI_OUTPUT_AI_CONVERT = 3, 770 NI_PFI_OUTPUT_AI_START2 = 2,
749 NI_PFI_OUTPUT_G_SRC1 = 4, 771 NI_PFI_OUTPUT_AI_CONVERT = 3,
750 NI_PFI_OUTPUT_G_GATE1 = 5, 772 NI_PFI_OUTPUT_G_SRC1 = 4,
751 NI_PFI_OUTPUT_AO_UPDATE_N = 6, 773 NI_PFI_OUTPUT_G_GATE1 = 5,
752 NI_PFI_OUTPUT_AO_START1 = 7, 774 NI_PFI_OUTPUT_AO_UPDATE_N = 6,
753 NI_PFI_OUTPUT_AI_START_PULSE = 8, 775 NI_PFI_OUTPUT_AO_START1 = 7,
754 NI_PFI_OUTPUT_G_SRC0 = 9, 776 NI_PFI_OUTPUT_AI_START_PULSE = 8,
755 NI_PFI_OUTPUT_G_GATE0 = 10, 777 NI_PFI_OUTPUT_G_SRC0 = 9,
756 NI_PFI_OUTPUT_EXT_STROBE = 11, 778 NI_PFI_OUTPUT_G_GATE0 = 10,
757 NI_PFI_OUTPUT_AI_EXT_MUX_CLK = 12, 779 NI_PFI_OUTPUT_EXT_STROBE = 11,
758 NI_PFI_OUTPUT_GOUT0 = 13, 780 NI_PFI_OUTPUT_AI_EXT_MUX_CLK = 12,
759 NI_PFI_OUTPUT_GOUT1 = 14, 781 NI_PFI_OUTPUT_GOUT0 = 13,
760 NI_PFI_OUTPUT_FREQ_OUT = 15, 782 NI_PFI_OUTPUT_GOUT1 = 14,
761 NI_PFI_OUTPUT_PFI_DO = 16, 783 NI_PFI_OUTPUT_FREQ_OUT = 15,
762 NI_PFI_OUTPUT_I_ATRIG = 17, 784 NI_PFI_OUTPUT_PFI_DO = 16,
763 NI_PFI_OUTPUT_RTSI0 = 18, 785 NI_PFI_OUTPUT_I_ATRIG = 17,
764 NI_PFI_OUTPUT_PXI_STAR_TRIGGER_IN = 26, 786 NI_PFI_OUTPUT_RTSI0 = 18,
765 NI_PFI_OUTPUT_SCXI_TRIG1 = 27, 787 NI_PFI_OUTPUT_PXI_STAR_TRIGGER_IN = 26,
766 NI_PFI_OUTPUT_DIO_CHANGE_DETECT_RTSI = 28, 788 NI_PFI_OUTPUT_SCXI_TRIG1 = 27,
767 NI_PFI_OUTPUT_CDI_SAMPLE = 29, 789 NI_PFI_OUTPUT_DIO_CHANGE_DETECT_RTSI = 28,
768 NI_PFI_OUTPUT_CDO_UPDATE = 30 790 NI_PFI_OUTPUT_CDI_SAMPLE = 29,
769 }; 791 NI_PFI_OUTPUT_CDO_UPDATE = 30
770 static inline unsigned NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel) { 792};
771 return NI_PFI_OUTPUT_RTSI0 + rtsi_channel; 793static inline unsigned NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel)
772 } 794{
795 return NI_PFI_OUTPUT_RTSI0 + rtsi_channel;
796}
773 797
774/* Signals which can be routed to output on a NI PFI pin on a 660x board 798/* Signals which can be routed to output on a NI PFI pin on a 660x board
775 with INSN_CONFIG_SET_ROUTING. The numbers assigned are 799 with INSN_CONFIG_SET_ROUTING. The numbers assigned are
@@ -777,66 +801,72 @@ INSN_CONFIG_ARM */
777 to program the board. Lines 0 to 7 can only be set to 801 to program the board. Lines 0 to 7 can only be set to
778 NI_660X_PFI_OUTPUT_DIO. Lines 32 to 39 can only be set to 802 NI_660X_PFI_OUTPUT_DIO. Lines 32 to 39 can only be set to
779 NI_660X_PFI_OUTPUT_COUNTER. */ 803 NI_660X_PFI_OUTPUT_COUNTER. */
780 enum ni_660x_pfi_routing { 804enum ni_660x_pfi_routing {
781 NI_660X_PFI_OUTPUT_COUNTER = 1, // counter 805 NI_660X_PFI_OUTPUT_COUNTER = 1, /* counter */
782 NI_660X_PFI_OUTPUT_DIO = 2, // static digital output 806 NI_660X_PFI_OUTPUT_DIO = 2, /* static digital output */
783 }; 807};
784 808
785/* NI External Trigger lines. These values are not arbitrary, but are related to 809/* NI External Trigger lines. These values are not arbitrary, but are related
786 the bits required to program the board (offset by 1 for historical reasons). */ 810 * to the bits required to program the board (offset by 1 for historical
787 static inline unsigned NI_EXT_PFI(unsigned pfi_channel) { 811 * reasons). */
788 return NI_USUAL_PFI_SELECT(pfi_channel) - 1; 812static inline unsigned NI_EXT_PFI(unsigned pfi_channel)
789 } 813{
790 static inline unsigned NI_EXT_RTSI(unsigned rtsi_channel) { 814 return NI_USUAL_PFI_SELECT(pfi_channel) - 1;
791 return NI_USUAL_RTSI_SELECT(rtsi_channel) - 1; 815}
792 } 816static inline unsigned NI_EXT_RTSI(unsigned rtsi_channel)
817{
818 return NI_USUAL_RTSI_SELECT(rtsi_channel) - 1;
819}
793 820
794/* status bits for INSN_CONFIG_GET_COUNTER_STATUS */ 821/* status bits for INSN_CONFIG_GET_COUNTER_STATUS */
795 enum comedi_counter_status_flags { 822enum comedi_counter_status_flags {
796 COMEDI_COUNTER_ARMED = 0x1, 823 COMEDI_COUNTER_ARMED = 0x1,
797 COMEDI_COUNTER_COUNTING = 0x2, 824 COMEDI_COUNTER_COUNTING = 0x2,
798 COMEDI_COUNTER_TERMINAL_COUNT = 0x4, 825 COMEDI_COUNTER_TERMINAL_COUNT = 0x4,
799 }; 826};
827
828/* Clock sources for CDIO subdevice on NI m-series boards. Used as the
829 * scan_begin_arg for a comedi_command. These sources may also be bitwise-or'd
830 * with CR_INVERT to change polarity. */
831enum ni_m_series_cdio_scan_begin_src {
832 NI_CDIO_SCAN_BEGIN_SRC_GROUND = 0,
833 NI_CDIO_SCAN_BEGIN_SRC_AI_START = 18,
834 NI_CDIO_SCAN_BEGIN_SRC_AI_CONVERT = 19,
835 NI_CDIO_SCAN_BEGIN_SRC_PXI_STAR_TRIGGER = 20,
836 NI_CDIO_SCAN_BEGIN_SRC_G0_OUT = 28,
837 NI_CDIO_SCAN_BEGIN_SRC_G1_OUT = 29,
838 NI_CDIO_SCAN_BEGIN_SRC_ANALOG_TRIGGER = 30,
839 NI_CDIO_SCAN_BEGIN_SRC_AO_UPDATE = 31,
840 NI_CDIO_SCAN_BEGIN_SRC_FREQ_OUT = 32,
841 NI_CDIO_SCAN_BEGIN_SRC_DIO_CHANGE_DETECT_IRQ = 33
842};
843static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel)
844{
845 return NI_USUAL_PFI_SELECT(pfi_channel);
846}
847static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel)
848{
849 return NI_USUAL_RTSI_SELECT(rtsi_channel);
850}
800 851
801/* Clock sources for CDIO subdevice on NI m-series boards. 852/* scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command on NI
802Used as the scan_begin_arg for a comedi_command. These 853 * boards. These scan begin sources can also be bitwise-or'd with CR_INVERT to
803sources may also be bitwise-or'd with CR_INVERT to change polarity. */ 854 * change polarity. */
804 enum ni_m_series_cdio_scan_begin_src { 855static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel)
805 NI_CDIO_SCAN_BEGIN_SRC_GROUND = 0, 856{
806 NI_CDIO_SCAN_BEGIN_SRC_AI_START = 18, 857 return NI_USUAL_PFI_SELECT(pfi_channel);
807 NI_CDIO_SCAN_BEGIN_SRC_AI_CONVERT = 19, 858}
808 NI_CDIO_SCAN_BEGIN_SRC_PXI_STAR_TRIGGER = 20, 859static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel)
809 NI_CDIO_SCAN_BEGIN_SRC_G0_OUT = 28, 860{
810 NI_CDIO_SCAN_BEGIN_SRC_G1_OUT = 29, 861 return NI_USUAL_RTSI_SELECT(rtsi_channel);
811 NI_CDIO_SCAN_BEGIN_SRC_ANALOG_TRIGGER = 30, 862}
812 NI_CDIO_SCAN_BEGIN_SRC_AO_UPDATE = 31,
813 NI_CDIO_SCAN_BEGIN_SRC_FREQ_OUT = 32,
814 NI_CDIO_SCAN_BEGIN_SRC_DIO_CHANGE_DETECT_IRQ = 33
815 };
816 static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) {
817 return NI_USUAL_PFI_SELECT(pfi_channel);
818 }
819 static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_RTSI(unsigned
820 rtsi_channel) {
821 return NI_USUAL_RTSI_SELECT(rtsi_channel);
822 }
823
824/* scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command
825on NI boards. These scan begin sources can also be bitwise-or'd with
826CR_INVERT to change polarity. */
827 static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) {
828 return NI_USUAL_PFI_SELECT(pfi_channel);
829 }
830 static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel) {
831 return NI_USUAL_RTSI_SELECT(rtsi_channel);
832 }
833 863
834/* Bits for setting a clock source with 864/* Bits for setting a clock source with
835 * INSN_CONFIG_SET_CLOCK_SRC when using NI frequency output subdevice. */ 865 * INSN_CONFIG_SET_CLOCK_SRC when using NI frequency output subdevice. */
836 enum ni_freq_out_clock_source_bits { 866enum ni_freq_out_clock_source_bits {
837 NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC, // 10 MHz 867 NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC, /* 10 MHz */
838 NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC // 100 KHz 868 NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC /* 100 KHz */
839 }; 869};
840 870
841/* Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for 871/* Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for
842 * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). */ 872 * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). */
diff --git a/drivers/staging/comedi/comedi_compat32.h b/drivers/staging/comedi/comedi_compat32.h
index 198aea5476f..0ca01642c16 100644
--- a/drivers/staging/comedi/comedi_compat32.h
+++ b/drivers/staging/comedi/comedi_compat32.h
@@ -36,8 +36,8 @@
36 36
37extern long comedi_compat_ioctl(struct file *file, unsigned int cmd, 37extern long comedi_compat_ioctl(struct file *file, unsigned int cmd,
38 unsigned long arg); 38 unsigned long arg);
39#define comedi_register_ioctl32() do{}while(0) 39#define comedi_register_ioctl32() do {} while (0)
40#define comedi_unregister_ioctl32() do{}while(0) 40#define comedi_unregister_ioctl32() do {} while (0)
41 41
42#else /* HAVE_COMPAT_IOCTL */ 42#else /* HAVE_COMPAT_IOCTL */
43 43
@@ -50,8 +50,8 @@ extern void comedi_unregister_ioctl32(void);
50#else /* CONFIG_COMPAT */ 50#else /* CONFIG_COMPAT */
51 51
52#define comedi_compat_ioctl 0 /* NULL */ 52#define comedi_compat_ioctl 0 /* NULL */
53#define comedi_register_ioctl32() do{}while(0) 53#define comedi_register_ioctl32() do {} while (0)
54#define comedi_unregister_ioctl32() do{}while(0) 54#define comedi_unregister_ioctl32() do {} while (0)
55 55
56#endif /* CONFIG_COMPAT */ 56#endif /* CONFIG_COMPAT */
57 57
diff --git a/drivers/staging/comedi/comedi_fops.h b/drivers/staging/comedi/comedi_fops.h
index 08a57128d09..63f8df558e8 100644
--- a/drivers/staging/comedi/comedi_fops.h
+++ b/drivers/staging/comedi/comedi_fops.h
@@ -5,4 +5,4 @@
5extern struct class *comedi_class; 5extern struct class *comedi_class;
6extern const struct file_operations comedi_fops; 6extern const struct file_operations comedi_fops;
7 7
8#endif //_COMEDI_FOPS_H 8#endif /* _COMEDI_FOPS_H */
diff --git a/drivers/staging/comedi/comedi_rt.h b/drivers/staging/comedi/comedi_rt.h
index e7fd57f92ee..61852bf5adc 100644
--- a/drivers/staging/comedi/comedi_rt.h
+++ b/drivers/staging/comedi/comedi_rt.h
@@ -45,13 +45,13 @@
45#ifdef CONFIG_COMEDI_RTL 45#ifdef CONFIG_COMEDI_RTL
46#include <rtl_core.h> 46#include <rtl_core.h>
47#include <rtl_time.h> 47#include <rtl_time.h>
48//#ifdef RTLINUX_VERSION_CODE 48/* #ifdef RTLINUX_VERSION_CODE */
49#include <rtl_sync.h> 49#include <rtl_sync.h>
50//#endif 50/* #endif */
51#define rt_printk rtl_printf 51#define rt_printk rtl_printf
52#endif 52#endif
53#ifdef CONFIG_COMEDI_FUSION 53#ifdef CONFIG_COMEDI_FUSION
54#define rt_printk(format, args...) printk(format , ## args ) 54#define rt_printk(format, args...) printk(format , ## args)
55#endif /* CONFIG_COMEDI_FUSION */ 55#endif /* CONFIG_COMEDI_FUSION */
56#ifdef CONFIG_PRIORITY_IRQ 56#ifdef CONFIG_PRIORITY_IRQ
57#define rt_printk printk 57#define rt_printk printk
@@ -59,27 +59,27 @@
59 59
60int comedi_request_irq(unsigned int irq, irqreturn_t(*handler) (int, 60int comedi_request_irq(unsigned int irq, irqreturn_t(*handler) (int,
61 void *PT_REGS_ARG), unsigned long flags, const char *device, 61 void *PT_REGS_ARG), unsigned long flags, const char *device,
62 comedi_device * dev_id); 62 comedi_device *dev_id);
63void comedi_free_irq(unsigned int irq, comedi_device * dev_id); 63void comedi_free_irq(unsigned int irq, comedi_device *dev_id);
64void comedi_rt_init(void); 64void comedi_rt_init(void);
65void comedi_rt_cleanup(void); 65void comedi_rt_cleanup(void);
66int comedi_switch_to_rt(comedi_device * dev); 66int comedi_switch_to_rt(comedi_device *dev);
67void comedi_switch_to_non_rt(comedi_device * dev); 67void comedi_switch_to_non_rt(comedi_device *dev);
68void comedi_rt_pend_wakeup(wait_queue_head_t * q); 68void comedi_rt_pend_wakeup(wait_queue_head_t *q);
69extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1, 69extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1,
70 void *arg2); 70 void *arg2);
71 71
72#else 72#else
73 73
74#define comedi_request_irq(a,b,c,d,e) request_irq(a,b,c,d,e) 74#define comedi_request_irq(a, b, c, d, e) request_irq(a, b, c, d, e)
75#define comedi_free_irq(a,b) free_irq(a,b) 75#define comedi_free_irq(a, b) free_irq(a, b)
76#define comedi_rt_init() do{}while(0) 76#define comedi_rt_init() do {} while (0)
77#define comedi_rt_cleanup() do{}while(0) 77#define comedi_rt_cleanup() do {} while (0)
78#define comedi_switch_to_rt(a) (-1) 78#define comedi_switch_to_rt(a) (-1)
79#define comedi_switch_to_non_rt(a) do{}while(0) 79#define comedi_switch_to_non_rt(a) do {} while (0)
80#define comedi_rt_pend_wakeup(a) do{}while(0) 80#define comedi_rt_pend_wakeup(a) do {} while (0)
81 81
82#define rt_printk(format,args...) printk(format,##args) 82#define rt_printk(format, args...) printk(format, ##args)
83 83
84#endif 84#endif
85 85
@@ -89,7 +89,7 @@ extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1,
89#define comedi_spin_lock_irqsave(lock_ptr, flags) \ 89#define comedi_spin_lock_irqsave(lock_ptr, flags) \
90 (flags = __comedi_spin_lock_irqsave(lock_ptr)) 90 (flags = __comedi_spin_lock_irqsave(lock_ptr))
91 91
92static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t * lock_ptr) 92static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t *lock_ptr)
93{ 93{
94 unsigned long flags; 94 unsigned long flags;
95 95
@@ -112,7 +112,7 @@ static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t * lock_ptr)
112 return flags; 112 return flags;
113} 113}
114 114
115static inline void comedi_spin_unlock_irqrestore(spinlock_t * lock_ptr, 115static inline void comedi_spin_unlock_irqrestore(spinlock_t *lock_ptr,
116 unsigned long flags) 116 unsigned long flags)
117{ 117{
118 118
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index 157e57899ad..76eedd547f5 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -39,17 +39,18 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/interrupt.h> 40#include <linux/interrupt.h>
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <asm/uaccess.h> 42#include <linux/uaccess.h>
43#include <asm/io.h> 43#include <linux/io.h>
44 44
45#include "comedi.h" 45#include "comedi.h"
46 46
47#define DPRINTK(format, args...) do{ \ 47#define DPRINTK(format, args...) do { \
48 if(comedi_debug)printk("comedi: " format , ## args ); \ 48 if (comedi_debug) \
49} while(0) 49 printk(KERN_DEBUG "comedi: " format , ## args); \
50} while (0)
50 51
51#define COMEDI_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 52#define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
52#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION,COMEDI_MINORVERSION,COMEDI_MICROVERSION) 53#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, COMEDI_MINORVERSION, COMEDI_MICROVERSION)
53#define COMEDI_RELEASE VERSION 54#define COMEDI_RELEASE VERSION
54 55
55#define COMEDI_INITCLEANUP_NOMODULE(x) \ 56#define COMEDI_INITCLEANUP_NOMODULE(x) \
@@ -82,21 +83,22 @@
82 static struct pci_driver comedi_driver ## _pci_driver = \ 83 static struct pci_driver comedi_driver ## _pci_driver = \
83 { \ 84 { \
84 .id_table = pci_id_table, \ 85 .id_table = pci_id_table, \
85 .probe = & comedi_driver ## _pci_probe, \ 86 .probe = &comedi_driver ## _pci_probe, \
86 .remove = __devexit_p(& comedi_driver ## _pci_remove) \ 87 .remove = __devexit_p(&comedi_driver ## _pci_remove) \
87 }; \ 88 }; \
88 static int __init comedi_driver ## _init_module(void) \ 89 static int __init comedi_driver ## _init_module(void) \
89 { \ 90 { \
90 int retval; \ 91 int retval; \
91 retval = comedi_driver_register(& comedi_driver); \ 92 retval = comedi_driver_register(&comedi_driver); \
92 if(retval < 0) return retval; \ 93 if (retval < 0) \
93 comedi_driver ## _pci_driver.name = (char*)comedi_driver.driver_name; \ 94 return retval; \
94 return pci_register_driver(& comedi_driver ## _pci_driver); \ 95 comedi_driver ## _pci_driver.name = (char *)comedi_driver.driver_name; \
96 return pci_register_driver(&comedi_driver ## _pci_driver); \
95 } \ 97 } \
96 static void __exit comedi_driver ## _cleanup_module(void) \ 98 static void __exit comedi_driver ## _cleanup_module(void) \
97 { \ 99 { \
98 pci_unregister_driver(& comedi_driver ## _pci_driver); \ 100 pci_unregister_driver(&comedi_driver ## _pci_driver); \
99 comedi_driver_unregister(& comedi_driver); \ 101 comedi_driver_unregister(&comedi_driver); \
100 } \ 102 } \
101 module_init(comedi_driver ## _init_module); \ 103 module_init(comedi_driver ## _init_module); \
102 module_exit(comedi_driver ## _cleanup_module); 104 module_exit(comedi_driver ## _cleanup_module);
@@ -177,14 +179,14 @@ struct comedi_subdevice_struct {
177 int (*do_cmdtest) (comedi_device *, comedi_subdevice *, comedi_cmd *); 179 int (*do_cmdtest) (comedi_device *, comedi_subdevice *, comedi_cmd *);
178 int (*poll) (comedi_device *, comedi_subdevice *); 180 int (*poll) (comedi_device *, comedi_subdevice *);
179 int (*cancel) (comedi_device *, comedi_subdevice *); 181 int (*cancel) (comedi_device *, comedi_subdevice *);
180 //int (*do_lock)(comedi_device *,comedi_subdevice *); 182 /* int (*do_lock)(comedi_device *,comedi_subdevice *); */
181 //int (*do_unlock)(comedi_device *,comedi_subdevice *); 183 /* int (*do_unlock)(comedi_device *,comedi_subdevice *); */
182 184
183 /* called when the buffer changes */ 185 /* called when the buffer changes */
184 int (*buf_change) (comedi_device * dev, comedi_subdevice * s, 186 int (*buf_change) (comedi_device *dev, comedi_subdevice *s,
185 unsigned long new_size); 187 unsigned long new_size);
186 188
187 void (*munge) (comedi_device * dev, comedi_subdevice * s, void *data, 189 void (*munge) (comedi_device *dev, comedi_subdevice *s, void *data,
188 unsigned int num_bytes, unsigned int start_chan_index); 190 unsigned int num_bytes, unsigned int start_chan_index);
189 enum dma_data_direction async_dma_dir; 191 enum dma_data_direction async_dma_dir;
190 192
@@ -234,13 +236,13 @@ struct comedi_async_struct {
234 236
235 wait_queue_head_t wait_head; 237 wait_queue_head_t wait_head;
236 238
237 // callback stuff 239 /* callback stuff */
238 unsigned int cb_mask; 240 unsigned int cb_mask;
239 int (*cb_func) (unsigned int flags, void *); 241 int (*cb_func) (unsigned int flags, void *);
240 void *cb_arg; 242 void *cb_arg;
241 243
242 int (*inttrig) (comedi_device * dev, comedi_subdevice * s, 244 int (*inttrig) (comedi_device *dev, comedi_subdevice *s,
243 unsigned int x); 245 unsigned int x);
244}; 246};
245 247
246struct comedi_driver_struct { 248struct comedi_driver_struct {
@@ -265,8 +267,9 @@ struct comedi_device_struct {
265 267
266 device_create_result_type *class_dev; 268 device_create_result_type *class_dev;
267 int minor; 269 int minor;
268 /* hw_dev is passed to dma_alloc_coherent when allocating async buffers for subdevices 270 /* hw_dev is passed to dma_alloc_coherent when allocating async buffers
269 that have async_dma_dir set to something other than DMA_NONE */ 271 * for subdevices that have async_dma_dir set to something other than
272 * DMA_NONE */
270 struct device *hw_dev; 273 struct device *hw_dev;
271 274
272 const char *board_name; 275 const char *board_name;
@@ -289,8 +292,8 @@ struct comedi_device_struct {
289 292
290 struct fasync_struct *async_queue; 293 struct fasync_struct *async_queue;
291 294
292 void (*open) (comedi_device * dev); 295 void (*open) (comedi_device *dev);
293 void (*close) (comedi_device * dev); 296 void (*close) (comedi_device *dev);
294}; 297};
295 298
296struct comedi_device_file_info { 299struct comedi_device_file_info {
@@ -302,15 +305,15 @@ struct comedi_device_file_info {
302#ifdef CONFIG_COMEDI_DEBUG 305#ifdef CONFIG_COMEDI_DEBUG
303extern int comedi_debug; 306extern int comedi_debug;
304#else 307#else
305static const int comedi_debug = 0; 308static const int comedi_debug;
306#endif 309#endif
307 310
308/* 311/*
309 * function prototypes 312 * function prototypes
310 */ 313 */
311 314
312void comedi_event(comedi_device * dev, comedi_subdevice * s); 315void comedi_event(comedi_device *dev, comedi_subdevice *s);
313void comedi_error(const comedi_device * dev, const char *s); 316void comedi_error(const comedi_device *dev, const char *s);
314 317
315/* we can expand the number of bits used to encode devices/subdevices into 318/* we can expand the number of bits used to encode devices/subdevices into
316 the minor number soon, after more distros support > 8 bit minor numbers 319 the minor number soon, after more distros support > 8 bit minor numbers
@@ -322,24 +325,30 @@ enum comedi_minor_bits {
322static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4; 325static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
323static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; 326static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
324 327
325struct comedi_device_file_info* comedi_get_device_file_info(unsigned minor); 328struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor);
326 329
327static inline comedi_subdevice* comedi_get_read_subdevice(const struct comedi_device_file_info *info) 330static inline comedi_subdevice *comedi_get_read_subdevice(
331 const struct comedi_device_file_info *info)
328{ 332{
329 if(info->read_subdevice) return info->read_subdevice; 333 if (info->read_subdevice)
330 if(info->device == NULL) return NULL; 334 return info->read_subdevice;
335 if (info->device == NULL)
336 return NULL;
331 return info->device->read_subdev; 337 return info->device->read_subdev;
332} 338}
333 339
334static inline comedi_subdevice* comedi_get_write_subdevice(const struct comedi_device_file_info *info) 340static inline comedi_subdevice *comedi_get_write_subdevice(
341 const struct comedi_device_file_info *info)
335{ 342{
336 if(info->write_subdevice) return info->write_subdevice; 343 if (info->write_subdevice)
337 if(info->device == NULL) return NULL; 344 return info->write_subdevice;
345 if (info->device == NULL)
346 return NULL;
338 return info->device->write_subdev; 347 return info->device->write_subdev;
339} 348}
340 349
341void comedi_device_detach(comedi_device * dev); 350void comedi_device_detach(comedi_device *dev);
342int comedi_device_attach(comedi_device * dev, comedi_devconfig * it); 351int comedi_device_attach(comedi_device *dev, comedi_devconfig *it);
343int comedi_driver_register(comedi_driver *); 352int comedi_driver_register(comedi_driver *);
344int comedi_driver_unregister(comedi_driver *); 353int comedi_driver_unregister(comedi_driver *);
345 354
@@ -348,7 +357,7 @@ void cleanup_polling(void);
348void start_polling(comedi_device *); 357void start_polling(comedi_device *);
349void stop_polling(comedi_device *); 358void stop_polling(comedi_device *);
350 359
351int comedi_buf_alloc(comedi_device * dev, comedi_subdevice * s, unsigned long 360int comedi_buf_alloc(comedi_device *dev, comedi_subdevice *s, unsigned long
352 new_size); 361 new_size);
353 362
354#ifdef CONFIG_PROC_FS 363#ifdef CONFIG_PROC_FS
@@ -367,7 +376,8 @@ static inline void comedi_proc_cleanup(void)
367enum subdevice_runflags { 376enum subdevice_runflags {
368 SRF_USER = 0x00000001, 377 SRF_USER = 0x00000001,
369 SRF_RT = 0x00000002, 378 SRF_RT = 0x00000002,
370 /* indicates an COMEDI_CB_ERROR event has occurred since the last command was started */ 379 /* indicates an COMEDI_CB_ERROR event has occurred since the last
380 * command was started */
371 SRF_ERROR = 0x00000004, 381 SRF_ERROR = 0x00000004,
372 SRF_RUNNING = 0x08000000 382 SRF_RUNNING = 0x08000000
373}; 383};
@@ -376,22 +386,22 @@ enum subdevice_runflags {
376 various internal comedi functions 386 various internal comedi functions
377 */ 387 */
378 388
379int do_rangeinfo_ioctl(comedi_device * dev, comedi_rangeinfo * arg); 389int do_rangeinfo_ioctl(comedi_device *dev, comedi_rangeinfo *arg);
380int check_chanlist(comedi_subdevice * s, int n, unsigned int *chanlist); 390int check_chanlist(comedi_subdevice *s, int n, unsigned int *chanlist);
381void comedi_set_subdevice_runflags(comedi_subdevice * s, unsigned mask, 391void comedi_set_subdevice_runflags(comedi_subdevice *s, unsigned mask,
382 unsigned bits); 392 unsigned bits);
383unsigned comedi_get_subdevice_runflags(comedi_subdevice * s); 393unsigned comedi_get_subdevice_runflags(comedi_subdevice *s);
384int insn_inval(comedi_device * dev, comedi_subdevice * s, 394int insn_inval(comedi_device *dev, comedi_subdevice *s,
385 comedi_insn * insn, lsampl_t * data); 395 comedi_insn *insn, lsampl_t *data);
386 396
387/* range stuff */ 397/* range stuff */
388 398
389#define RANGE(a,b) {(a)*1e6,(b)*1e6,0} 399#define RANGE(a, b) {(a)*1e6, (b)*1e6, 0}
390#define RANGE_ext(a,b) {(a)*1e6,(b)*1e6,RF_EXTERNAL} 400#define RANGE_ext(a, b) {(a)*1e6, (b)*1e6, RF_EXTERNAL}
391#define RANGE_mA(a,b) {(a)*1e6,(b)*1e6,UNIT_mA} 401#define RANGE_mA(a, b) {(a)*1e6, (b)*1e6, UNIT_mA}
392#define RANGE_unitless(a,b) {(a)*1e6,(b)*1e6,0} /* XXX */ 402#define RANGE_unitless(a, b) {(a)*1e6, (b)*1e6, 0} /* XXX */
393#define BIP_RANGE(a) {-(a)*1e6,(a)*1e6,0} 403#define BIP_RANGE(a) {-(a)*1e6, (a)*1e6, 0}
394#define UNI_RANGE(a) {0,(a)*1e6,0} 404#define UNI_RANGE(a) {0, (a)*1e6, 0}
395 405
396extern const comedi_lrange range_bipolar10; 406extern const comedi_lrange range_bipolar10;
397extern const comedi_lrange range_bipolar5; 407extern const comedi_lrange range_bipolar5;
@@ -415,8 +425,8 @@ struct comedi_lrange_struct {
415 425
416/* some silly little inline functions */ 426/* some silly little inline functions */
417 427
418static inline int alloc_subdevices(comedi_device * dev, 428static inline int alloc_subdevices(comedi_device *dev,
419 unsigned int num_subdevices) 429 unsigned int num_subdevices)
420{ 430{
421 unsigned i; 431 unsigned i;
422 432
@@ -434,7 +444,7 @@ static inline int alloc_subdevices(comedi_device * dev,
434 return 0; 444 return 0;
435} 445}
436 446
437static inline int alloc_private(comedi_device * dev, int size) 447static inline int alloc_private(comedi_device *dev, int size)
438{ 448{
439 dev->private = kzalloc(size, GFP_KERNEL); 449 dev->private = kzalloc(size, GFP_KERNEL);
440 if (!dev->private) 450 if (!dev->private)
@@ -442,7 +452,7 @@ static inline int alloc_private(comedi_device * dev, int size)
442 return 0; 452 return 0;
443} 453}
444 454
445static inline unsigned int bytes_per_sample(const comedi_subdevice * subd) 455static inline unsigned int bytes_per_sample(const comedi_subdevice *subd)
446{ 456{
447 if (subd->subdev_flags & SDF_LSAMPL) 457 if (subd->subdev_flags & SDF_LSAMPL)
448 return sizeof(lsampl_t); 458 return sizeof(lsampl_t);
@@ -452,11 +462,11 @@ static inline unsigned int bytes_per_sample(const comedi_subdevice * subd)
452 462
453/* must be used in attach to set dev->hw_dev if you wish to dma directly 463/* must be used in attach to set dev->hw_dev if you wish to dma directly
454into comedi's buffer */ 464into comedi's buffer */
455static inline void comedi_set_hw_dev(comedi_device * dev, struct device *hw_dev) 465static inline void comedi_set_hw_dev(comedi_device *dev, struct device *hw_dev)
456{ 466{
457 if (dev->hw_dev) { 467 if (dev->hw_dev)
458 put_device(dev->hw_dev); 468 put_device(dev->hw_dev);
459 } 469
460 dev->hw_dev = hw_dev; 470 dev->hw_dev = hw_dev;
461 if (dev->hw_dev) { 471 if (dev->hw_dev) {
462 dev->hw_dev = get_device(dev->hw_dev); 472 dev->hw_dev = get_device(dev->hw_dev);
@@ -464,31 +474,31 @@ static inline void comedi_set_hw_dev(comedi_device * dev, struct device *hw_dev)
464 } 474 }
465} 475}
466 476
467int comedi_buf_put(comedi_async * async, sampl_t x); 477int comedi_buf_put(comedi_async *async, sampl_t x);
468int comedi_buf_get(comedi_async * async, sampl_t * x); 478int comedi_buf_get(comedi_async *async, sampl_t *x);
469 479
470unsigned int comedi_buf_write_n_available(comedi_async * async); 480unsigned int comedi_buf_write_n_available(comedi_async *async);
471unsigned int comedi_buf_write_alloc(comedi_async * async, unsigned int nbytes); 481unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes);
472unsigned int comedi_buf_write_alloc_strict(comedi_async * async, 482unsigned int comedi_buf_write_alloc_strict(comedi_async *async,
473 unsigned int nbytes); 483 unsigned int nbytes);
474unsigned comedi_buf_write_free(comedi_async * async, unsigned int nbytes); 484unsigned comedi_buf_write_free(comedi_async *async, unsigned int nbytes);
475unsigned comedi_buf_read_alloc(comedi_async * async, unsigned nbytes); 485unsigned comedi_buf_read_alloc(comedi_async *async, unsigned nbytes);
476unsigned comedi_buf_read_free(comedi_async * async, unsigned int nbytes); 486unsigned comedi_buf_read_free(comedi_async *async, unsigned int nbytes);
477unsigned int comedi_buf_read_n_available(comedi_async * async); 487unsigned int comedi_buf_read_n_available(comedi_async *async);
478void comedi_buf_memcpy_to(comedi_async * async, unsigned int offset, 488void comedi_buf_memcpy_to(comedi_async *async, unsigned int offset,
479 const void *source, unsigned int num_bytes); 489 const void *source, unsigned int num_bytes);
480void comedi_buf_memcpy_from(comedi_async * async, unsigned int offset, 490void comedi_buf_memcpy_from(comedi_async *async, unsigned int offset,
481 void *destination, unsigned int num_bytes); 491 void *destination, unsigned int num_bytes);
482static inline unsigned comedi_buf_write_n_allocated(comedi_async * async) 492static inline unsigned comedi_buf_write_n_allocated(comedi_async *async)
483{ 493{
484 return async->buf_write_alloc_count - async->buf_write_count; 494 return async->buf_write_alloc_count - async->buf_write_count;
485} 495}
486static inline unsigned comedi_buf_read_n_allocated(comedi_async * async) 496static inline unsigned comedi_buf_read_n_allocated(comedi_async *async)
487{ 497{
488 return async->buf_read_alloc_count - async->buf_read_count; 498 return async->buf_read_alloc_count - async->buf_read_count;
489} 499}
490 500
491void comedi_reset_async_buf(comedi_async * async); 501void comedi_reset_async_buf(comedi_async *async);
492 502
493static inline void *comedi_aux_data(int options[], int n) 503static inline void *comedi_aux_data(int options[], int n)
494{ 504{
@@ -522,8 +532,6 @@ void comedi_free_subdevice_minor(comedi_subdevice *s);
522int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name); 532int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name);
523void comedi_pci_auto_unconfig(struct pci_dev *pcidev); 533void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
524 534
525//#ifdef CONFIG_COMEDI_RT
526#include "comedi_rt.h" 535#include "comedi_rt.h"
527//#endif
528 536
529#endif /* _COMEDIDEV_H */ 537#endif /* _COMEDIDEV_H */
diff --git a/drivers/staging/comedi/comedilib.h b/drivers/staging/comedi/comedilib.h
index e381389524d..d6a2e378f1a 100644
--- a/drivers/staging/comedi/comedilib.h
+++ b/drivers/staging/comedi/comedilib.h
@@ -41,13 +41,13 @@ typedef void comedi_t;
41/* these functions may not be called at real-time priority */ 41/* these functions may not be called at real-time priority */
42 42
43comedi_t *comedi_open(const char *path); 43comedi_t *comedi_open(const char *path);
44int comedi_close(comedi_t * dev); 44int comedi_close(comedi_t *dev);
45 45
46/* these functions may be called at any priority, but may fail at 46/* these functions may be called at any priority, but may fail at
47 real-time priority */ 47 real-time priority */
48 48
49int comedi_lock(comedi_t * dev, unsigned int subdev); 49int comedi_lock(comedi_t *dev, unsigned int subdev);
50int comedi_unlock(comedi_t * dev, unsigned int subdev); 50int comedi_unlock(comedi_t *dev, unsigned int subdev);
51 51
52/* these functions may be called at any priority, but you must hold 52/* these functions may be called at any priority, but you must hold
53 the lock for the subdevice */ 53 the lock for the subdevice */
@@ -56,68 +56,68 @@ int comedi_loglevel(int loglevel);
56void comedi_perror(const char *s); 56void comedi_perror(const char *s);
57char *comedi_strerror(int errnum); 57char *comedi_strerror(int errnum);
58int comedi_errno(void); 58int comedi_errno(void);
59int comedi_fileno(comedi_t * dev); 59int comedi_fileno(comedi_t *dev);
60 60
61int comedi_cancel(comedi_t * dev, unsigned int subdev); 61int comedi_cancel(comedi_t *dev, unsigned int subdev);
62int comedi_register_callback(comedi_t * dev, unsigned int subdev, 62int comedi_register_callback(comedi_t *dev, unsigned int subdev,
63 unsigned int mask, int (*cb) (unsigned int, void *), void *arg); 63 unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
64 64
65int comedi_command(comedi_t * dev, comedi_cmd * cmd); 65int comedi_command(comedi_t *dev, comedi_cmd *cmd);
66int comedi_command_test(comedi_t * dev, comedi_cmd * cmd); 66int comedi_command_test(comedi_t *dev, comedi_cmd *cmd);
67int comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it); 67int comedi_trigger(comedi_t *dev, unsigned int subdev, comedi_trig *it);
68int __comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it); 68int __comedi_trigger(comedi_t *dev, unsigned int subdev, comedi_trig *it);
69int comedi_data_write(comedi_t * dev, unsigned int subdev, unsigned int chan, 69int comedi_data_write(comedi_t *dev, unsigned int subdev, unsigned int chan,
70 unsigned int range, unsigned int aref, lsampl_t data); 70 unsigned int range, unsigned int aref, lsampl_t data);
71int comedi_data_read(comedi_t * dev, unsigned int subdev, unsigned int chan, 71int comedi_data_read(comedi_t *dev, unsigned int subdev, unsigned int chan,
72 unsigned int range, unsigned int aref, lsampl_t * data); 72 unsigned int range, unsigned int aref, lsampl_t *data);
73int comedi_data_read_hint(comedi_t * dev, unsigned int subdev, 73int comedi_data_read_hint(comedi_t *dev, unsigned int subdev,
74 unsigned int chan, unsigned int range, unsigned int aref); 74 unsigned int chan, unsigned int range, unsigned int aref);
75int comedi_data_read_delayed(comedi_t * dev, unsigned int subdev, 75int comedi_data_read_delayed(comedi_t *dev, unsigned int subdev,
76 unsigned int chan, unsigned int range, unsigned int aref, 76 unsigned int chan, unsigned int range, unsigned int aref,
77 lsampl_t * data, unsigned int nano_sec); 77 lsampl_t *data, unsigned int nano_sec);
78int comedi_dio_config(comedi_t * dev, unsigned int subdev, unsigned int chan, 78int comedi_dio_config(comedi_t *dev, unsigned int subdev, unsigned int chan,
79 unsigned int io); 79 unsigned int io);
80int comedi_dio_read(comedi_t * dev, unsigned int subdev, unsigned int chan, 80int comedi_dio_read(comedi_t *dev, unsigned int subdev, unsigned int chan,
81 unsigned int *val); 81 unsigned int *val);
82int comedi_dio_write(comedi_t * dev, unsigned int subdev, unsigned int chan, 82int comedi_dio_write(comedi_t *dev, unsigned int subdev, unsigned int chan,
83 unsigned int val); 83 unsigned int val);
84int comedi_dio_bitfield(comedi_t * dev, unsigned int subdev, unsigned int mask, 84int comedi_dio_bitfield(comedi_t *dev, unsigned int subdev, unsigned int mask,
85 unsigned int *bits); 85 unsigned int *bits);
86int comedi_get_n_subdevices(comedi_t * dev); 86int comedi_get_n_subdevices(comedi_t *dev);
87int comedi_get_version_code(comedi_t * dev); 87int comedi_get_version_code(comedi_t *dev);
88const char *comedi_get_driver_name(comedi_t * dev); 88const char *comedi_get_driver_name(comedi_t *dev);
89const char *comedi_get_board_name(comedi_t * dev); 89const char *comedi_get_board_name(comedi_t *dev);
90int comedi_get_subdevice_type(comedi_t * dev, unsigned int subdevice); 90int comedi_get_subdevice_type(comedi_t *dev, unsigned int subdevice);
91int comedi_find_subdevice_by_type(comedi_t * dev, int type, unsigned int subd); 91int comedi_find_subdevice_by_type(comedi_t *dev, int type, unsigned int subd);
92int comedi_get_n_channels(comedi_t * dev, unsigned int subdevice); 92int comedi_get_n_channels(comedi_t *dev, unsigned int subdevice);
93lsampl_t comedi_get_maxdata(comedi_t * dev, unsigned int subdevice, unsigned 93lsampl_t comedi_get_maxdata(comedi_t *dev, unsigned int subdevice, unsigned
94 int chan); 94 int chan);
95int comedi_get_n_ranges(comedi_t * dev, unsigned int subdevice, unsigned int 95int comedi_get_n_ranges(comedi_t *dev, unsigned int subdevice, unsigned int
96 chan); 96 chan);
97int comedi_do_insn(comedi_t * dev, comedi_insn * insn); 97int comedi_do_insn(comedi_t *dev, comedi_insn *insn);
98int comedi_poll(comedi_t * dev, unsigned int subdev); 98int comedi_poll(comedi_t *dev, unsigned int subdev);
99 99
100/* DEPRECATED functions */ 100/* DEPRECATED functions */
101int comedi_get_rangetype(comedi_t * dev, unsigned int subdevice, 101int comedi_get_rangetype(comedi_t *dev, unsigned int subdevice,
102 unsigned int chan); 102 unsigned int chan);
103 103
104/* ALPHA functions */ 104/* ALPHA functions */
105unsigned int comedi_get_subdevice_flags(comedi_t * dev, unsigned int subdevice); 105unsigned int comedi_get_subdevice_flags(comedi_t *dev, unsigned int subdevice);
106int comedi_get_len_chanlist(comedi_t * dev, unsigned int subdevice); 106int comedi_get_len_chanlist(comedi_t *dev, unsigned int subdevice);
107int comedi_get_krange(comedi_t * dev, unsigned int subdevice, unsigned int 107int comedi_get_krange(comedi_t *dev, unsigned int subdevice, unsigned int
108 chan, unsigned int range, comedi_krange * krange); 108 chan, unsigned int range, comedi_krange *krange);
109unsigned int comedi_get_buf_head_pos(comedi_t * dev, unsigned int subdevice); 109unsigned int comedi_get_buf_head_pos(comedi_t *dev, unsigned int subdevice);
110int comedi_set_user_int_count(comedi_t * dev, unsigned int subdevice, 110int comedi_set_user_int_count(comedi_t *dev, unsigned int subdevice,
111 unsigned int buf_user_count); 111 unsigned int buf_user_count);
112int comedi_map(comedi_t * dev, unsigned int subdev, void *ptr); 112int comedi_map(comedi_t *dev, unsigned int subdev, void *ptr);
113int comedi_unmap(comedi_t * dev, unsigned int subdev); 113int comedi_unmap(comedi_t *dev, unsigned int subdev);
114int comedi_get_buffer_size(comedi_t * dev, unsigned int subdev); 114int comedi_get_buffer_size(comedi_t *dev, unsigned int subdev);
115int comedi_mark_buffer_read(comedi_t * dev, unsigned int subdevice, 115int comedi_mark_buffer_read(comedi_t *dev, unsigned int subdevice,
116 unsigned int num_bytes); 116 unsigned int num_bytes);
117int comedi_mark_buffer_written(comedi_t * d, unsigned int subdevice, 117int comedi_mark_buffer_written(comedi_t *d, unsigned int subdevice,
118 unsigned int num_bytes); 118 unsigned int num_bytes);
119int comedi_get_buffer_contents(comedi_t * dev, unsigned int subdevice); 119int comedi_get_buffer_contents(comedi_t *dev, unsigned int subdevice);
120int comedi_get_buffer_offset(comedi_t * dev, unsigned int subdevice); 120int comedi_get_buffer_offset(comedi_t *dev, unsigned int subdevice);
121 121
122#else 122#else
123 123
@@ -139,14 +139,14 @@ int comedi_cancel(unsigned int minor, unsigned int subdev);
139int comedi_register_callback(unsigned int minor, unsigned int subdev, 139int comedi_register_callback(unsigned int minor, unsigned int subdev,
140 unsigned int mask, int (*cb) (unsigned int, void *), void *arg); 140 unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
141 141
142int comedi_command(unsigned int minor, comedi_cmd * cmd); 142int comedi_command(unsigned int minor, comedi_cmd *cmd);
143int comedi_command_test(unsigned int minor, comedi_cmd * cmd); 143int comedi_command_test(unsigned int minor, comedi_cmd *cmd);
144int comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig * it); 144int comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig *it);
145int __comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig * it); 145int __comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig *it);
146int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan, 146int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan,
147 unsigned int range, unsigned int aref, lsampl_t data); 147 unsigned int range, unsigned int aref, lsampl_t data);
148int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan, 148int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan,
149 unsigned int range, unsigned int aref, lsampl_t * data); 149 unsigned int range, unsigned int aref, lsampl_t *data);
150int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan, 150int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan,
151 unsigned int io); 151 unsigned int io);
152int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan, 152int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan,
@@ -167,7 +167,7 @@ lsampl_t comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned
167 int chan); 167 int chan);
168int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int 168int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int
169 chan); 169 chan);
170int comedi_do_insn(unsigned int minor, comedi_insn * insn); 170int comedi_do_insn(unsigned int minor, comedi_insn *insn);
171int comedi_poll(unsigned int minor, unsigned int subdev); 171int comedi_poll(unsigned int minor, unsigned int subdev);
172 172
173/* DEPRECATED functions */ 173/* DEPRECATED functions */
@@ -179,7 +179,7 @@ unsigned int comedi_get_subdevice_flags(unsigned int minor, unsigned int
179 subdevice); 179 subdevice);
180int comedi_get_len_chanlist(unsigned int minor, unsigned int subdevice); 180int comedi_get_len_chanlist(unsigned int minor, unsigned int subdevice);
181int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int 181int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int
182 chan, unsigned int range, comedi_krange * krange); 182 chan, unsigned int range, comedi_krange *krange);
183unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int 183unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int
184 subdevice); 184 subdevice);
185int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice, 185int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice,
diff --git a/drivers/staging/comedi/wrapper.h b/drivers/staging/comedi/wrapper.h
index 81f8adb768d..77fc673900e 100644
--- a/drivers/staging/comedi/wrapper.h
+++ b/drivers/staging/comedi/wrapper.h
@@ -19,13 +19,7 @@
19#ifndef __COMPAT_LINUX_WRAPPER_H_ 19#ifndef __COMPAT_LINUX_WRAPPER_H_
20#define __COMPAT_LINUX_WRAPPER_H_ 20#define __COMPAT_LINUX_WRAPPER_H_
21 21
22#include <linux/version.h>
23
24#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
25#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags)) 22#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags))
26#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags)) 23#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags))
27#else
28#include_next <linux/wrapper.h>
29#endif
30 24
31#endif /* __COMPAT_LINUX_WRAPPER_H_ */ 25#endif /* __COMPAT_LINUX_WRAPPER_H_ */