/*
* comedi.h
* header file for COMEDI user API
*
* COMEDI - Linux Control and Measurement Device Interface
* Copyright (C) 1998-2001 David A. Schleef <ds@schleef.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _COMEDI_H
#define _COMEDI_H
#define COMEDI_MAJORVERSION 0
#define COMEDI_MINORVERSION 7
#define COMEDI_MICROVERSION 76
#define VERSION "0.7.76"
/* comedi's major device number */
#define COMEDI_MAJOR 98
/*
* maximum number of minor devices. This can be increased, although
* kernel structures are currently statically allocated, thus you
* don't want this to be much more than you actually use.
*/
#define COMEDI_NDEVICES 16
/* number of config options in the config structure */
#define COMEDI_NDEVCONFOPTS 32
/*
* NOTE: 'comedi_config --init-data' is deprecated
*
* The following indexes in the config options were used by
* comedi_config to pass firmware blobs from user space to the
* comedi drivers. The request_firmware() hotplug interface is
* now used by all comedi drivers instead.
*/
/* length of nth chunk of firmware data -*/
#define COMEDI_DEVCONF_AUX_DATA3_LENGTH 25
#define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26
#define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27
#define COMEDI_DEVCONF_AUX_DATA0_LENGTH 28
/* most significant 32 bits of pointer address (if needed) */
#define COMEDI_DEVCONF_AUX_DATA_HI 29
/* least significant 32 bits of pointer address */
#define COMEDI_DEVCONF_AUX_DATA_LO 30
#define COMEDI_DEVCONF_AUX_DATA_LENGTH 31 /* total data length */
/* max length of device and driver names */
#define COMEDI_NAMELEN 20
/* packs and unpacks a channel/range number */
#define CR_PACK(chan, rng, aref) \
((((aref) & 0x3) << 24) | (((rng) & 0xff) << 16) | (chan))
#define CR_PACK_FLAGS(chan, range, aref, flags) \
(CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK))
#define CR_CHAN(a) ((a) & 0xffff)
#define CR_RANGE(a) (((a) >> 16) & 0xff)
#define CR_AREF(a) (((a) >> 24) & 0x03)
#define CR_FLAGS_MASK 0xfc000000
#define CR_ALT_FILTER 0x04000000
#define CR_DITHER CR_ALT_FILTER
#define CR_DEGLITCH CR_ALT_FILTER
#define CR_ALT_SOURCE 0x08000000
#define CR_EDGE 0x40000000
#define CR_INVERT 0x80000000
#define AREF_GROUND 0x00 /* analog ref = analog ground */
#define AREF_COMMON 0x01 /* analog ref = analog common */
#define AREF_DIFF 0x02 /* analog ref = differential */
#define AREF_OTHER 0x03 /* analog ref = other (undefined) */
/* counters -- these are arbitrary values */
#define GPCT_RESET 0x0001
#define GPCT_SET_SOURCE 0x0002
#define GPCT_SET_GATE 0x0004
#define GPCT_SET_DIRECTION 0x0008
#define GPCT_SET_OPERATION 0x0010
#define GPCT_ARM 0x0020
#define GPCT_DISARM 0x0040
#define GPCT_GET_INT_CLK_FRQ 0x0080
#define GPCT_INT_CLOCK 0x0001
#define GPCT_EXT_PIN 0x0002
#define GPCT_NO_GATE 0x0004
#define GPCT_UP 0x0008
#define GPCT_DOWN 0x0010
#define GPCT_HWUD 0x0020
#define GPCT_SIMPLE_EVENT 0x0040
#define GPCT_SINGLE_PERIOD 0x0080
#define GPCT_SINGLE_PW 0x0100
#define GPCT_CONT_PULSE_OUT 0x0200
#define GPCT_SINGLE_PULSE_OUT 0x0400
/* instructions */
#define INSN_MASK_WRITE 0x8000000
#define INSN_MASK_READ 0x4000000
#define INSN_MASK_SPECIAL 0x2000000
#define INSN_READ (0 | INSN_MASK_READ)
#define INSN_WRITE (1 | INSN_MASK_WRITE)
#define INSN_BITS (2 | INSN_MASK_READ | INSN_MASK_WRITE)
#define INSN_CONFIG (3 | INSN_MASK_READ | INSN_MASK_WRITE)
#define INSN_GTOD (4 | INSN_MASK_READ | INSN_MASK_SPECIAL)
#define INSN_WAIT (5 | INSN_MASK_WRITE | INSN_MASK_SPECIAL)
#define INSN_INTTRIG (6 | INSN_MASK_WRITE | INSN_MASK_SPECIAL)
/* command flags */
/* These flags are used in comedi_cmd structures */
#define CMDF_BOGUS 0x00000001 /* do the motions */
/* try to use a real-time interrupt while performing command */
#define CMDF_PRIORITY 0x00000008
/* wake up on end-of-scan events */
#define CMDF_WAKE_EOS 0x00000020
#define CMDF_WRITE 0x00000040
#define CMDF_RAWDATA 0x00000080
/* timer rounding definitions */
#define CMDF_ROUND_MASK 0x00030000
#define CMDF_ROUND_NEAREST 0x00000000
#define CMDF_ROUND_DOWN 0x00010000
#define CMDF_ROUND_UP 0x00020000
#define CMDF_ROUND_UP_NEXT 0x00030000
#define COMEDI_EV_START 0x00040000
#define COMEDI_EV_SCAN_BEGIN 0x00080000
#define COMEDI_EV_CONVERT 0x00100000
#define COMEDI_EV_SCAN_END 0x00200000
#define COMEDI_EV_STOP 0x00400000
/* compatibility definitions */
#define TRIG_BOGUS CMDF_BOGUS
#define TRIG_RT CMDF_PRIORITY
#define TRIG_WAKE_EOS CMDF_WAKE_EOS
#define TRIG_WRITE CMDF_WRITE
#define TRIG_ROUND_MASK CMDF_ROUND_MASK
#define TRIG_ROUND_NEAREST CMDF_ROUND_NEAREST
#define TRIG_ROUND_DOWN CMDF_ROUND_DOWN
#define TRIG_ROUND_UP CMDF_ROUND_UP
#define TRIG_ROUND_UP_NEXT CMDF_ROUND_UP_NEXT
/* trigger sources */
#define TRIG_ANY 0xffffffff
#define TRIG_INVALID 0x00000000
#define TRIG_NONE 0x00000001 /* never trigger */
#define TRIG_NOW 0x00000002 /* trigger now + N ns */
#define TRIG_FOLLOW 0x00000004 /* trigger on next lower level trig */
#define TRIG_TIME 0x00000008 /* trigger at time N ns */
#define TRIG_TIMER 0x00000010 /* trigger at rate N ns */
#define TRIG_COUNT 0x00000020 /* trigger when count reaches N */
#define TRIG_EXT 0x00000040 /* trigger on external signal N */
#define T