Xenomai  3.1
analogy.h File Reference

Analogy for Linux, UAPI bits. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  a4l_cmd_desc
 Structure describing the asynchronous instruction. More...
 
struct  a4l_instruction
 Structure describing the synchronous instruction. More...
 
struct  a4l_instruction_list
 Structure describing the list of synchronous instructions. More...
 

Macros

#define A4L_RNG_FACTOR   1000000
 Constant for internal use only (must not be used by driver developer). More...
 
#define A4L_RNG_VOLT_UNIT   0x0
 Volt unit range flag.
 
#define A4L_RNG_MAMP_UNIT   0x1
 MilliAmpere unit range flag.
 
#define A4L_RNG_NO_UNIT   0x2
 No unit range flag.
 
#define A4L_RNG_EXT_UNIT   0x4
 External unit range flag.
 
#define A4L_RNG_UNIT(x)
 Macro to retrieve the range unit from the range flags.
 
#define A4L_INSN_WAIT_MAX   100000
 Maximal wait duration.
 
ANALOGY_CMD_xxx

Common command flags definitions

#define A4L_CMD_SIMUL   0x1
 Do not execute the command, just check it.
 
#define A4L_CMD_BULK   0x2
 Perform data recovery / transmission in bulk mode.
 
#define A4L_CMD_WRITE   0x4
 Perform a command which will write data to the device.
 
TRIG_xxx

Command triggers flags definitions

#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 TRIG_INT   0x00000080
 Trigger on analogy-internal signal N.
 
#define TRIG_OTHER   0x00000100
 Driver defined trigger.
 
#define TRIG_WAKE_EOS   0x0020
 Wake up on end-of-scan.
 
#define TRIG_ROUND_MASK   0x00030000
 Trigger not implemented yet.
 
#define TRIG_ROUND_NEAREST   0x00000000
 Trigger not implemented yet.
 
#define TRIG_ROUND_DOWN   0x00010000
 Trigger not implemented yet.
 
#define TRIG_ROUND_UP   0x00020000
 Trigger not implemented yet.
 
#define TRIG_ROUND_UP_NEXT   0x00030000
 Trigger not implemented yet.
 
Channel macros

Specific precompilation macros and constants useful for the channels descriptors tab located in the command structure

#define CHAN(a)   ((a) & 0xffff)
 Channel indication macro.
 
#define RNG(a)   (((a) & 0xff) << 16)
 Range definition macro.
 
#define AREF(a)   (((a) & 0x03) << 24)
 Reference definition macro.
 
#define FLAGS(a)   ((a) & CR_FLAGS_MASK)
 Flags definition macro.
 
#define PACK(a, b, c)   (a | RNG(b) | AREF(c))
 Channel + range + reference definition macro.
 
#define PACK_FLAGS(a, b, c, d)   (PACK(a, b, c) | FLAGS(d))
 Channel + range + reference + flags definition macro.
 
#define AREF_GROUND   0x00
 Analog reference is analog ground.
 
#define AREF_COMMON   0x01
 Analog reference is analog common.
 
#define AREF_DIFF   0x02
 Analog reference is differential.
 
#define AREF_OTHER   0x03
 Analog reference is undefined.
 
Subdevices types

Flags to define the subdevice type

#define A4L_SUBD_UNUSED   (A4L_SUBD_MASK_SPECIAL|0x1)
 Unused subdevice.
 
#define A4L_SUBD_AI   (A4L_SUBD_MASK_READ|0x2)
 Analog input subdevice.
 
#define A4L_SUBD_AO   (A4L_SUBD_MASK_WRITE|0x4)
 Analog output subdevice.
 
#define A4L_SUBD_DI   (A4L_SUBD_MASK_READ|0x8)
 Digital input subdevice.
 
#define A4L_SUBD_DO   (A4L_SUBD_MASK_WRITE|0x10)
 Digital output subdevice.
 
#define A4L_SUBD_DIO   (A4L_SUBD_MASK_SPECIAL|0x20)
 Digital input/output subdevice.
 
#define A4L_SUBD_COUNTER   (A4L_SUBD_MASK_SPECIAL|0x40)
 Counter subdevice.
 
#define A4L_SUBD_TIMER   (A4L_SUBD_MASK_SPECIAL|0x80)
 Timer subdevice.
 
#define A4L_SUBD_MEMORY   (A4L_SUBD_MASK_SPECIAL|0x100)
 Memory, EEPROM, DPRAM.
 
#define A4L_SUBD_CALIB   (A4L_SUBD_MASK_SPECIAL|0x200)
 Calibration subdevice DACs.
 
#define A4L_SUBD_PROC   (A4L_SUBD_MASK_SPECIAL|0x400)
 Processor, DSP.
 
#define A4L_SUBD_SERIAL   (A4L_SUBD_MASK_SPECIAL|0x800)
 Serial IO subdevice.
 
#define A4L_SUBD_TYPES
 Mask which gathers all the types.
 
Subdevice features

Flags to define the subdevice's capabilities

#define A4L_SUBD_CMD   0x1000
 The subdevice can handle command (i.e it can perform asynchronous acquisition)
 
#define A4L_SUBD_MMAP   0x8000
 The subdevice support mmap operations (technically, any driver can do it; however, the developer might want that his driver must be accessed through read / write.
 
Subdevice status

Flags to define the subdevice's status

#define A4L_SUBD_BUSY_NR   0
 The subdevice is busy, a synchronous or an asynchronous acquisition is occuring.
 
#define A4L_SUBD_BUSY   (1 << A4L_SUBD_BUSY_NR)
 The subdevice is busy, a synchronous or an asynchronous acquisition is occuring.
 
#define A4L_SUBD_CLEAN_NR   1
 The subdevice is about to be cleaned in the middle of the detach procedure.
 
#define A4L_SUBD_CLEAN   (1 << A4L_SUBD_CLEAN_NR)
 The subdevice is busy, a synchronous or an asynchronous acquisition is occuring.
 
Instruction type

Flags to define the type of instruction

#define A4L_INSN_READ   (0 | A4L_INSN_MASK_READ)
 Read instruction.
 
#define A4L_INSN_WRITE   (1 | A4L_INSN_MASK_WRITE)
 Write instruction.
 
#define A4L_INSN_BITS
 "Bits" instruction
 
#define A4L_INSN_CONFIG
 Configuration instruction.
 
#define A4L_INSN_GTOD
 Get time instruction.
 
#define A4L_INSN_WAIT
 Wait instruction.
 
#define A4L_INSN_INTTRIG
 Trigger instruction (to start asynchronous acquisition)
 
Configuration instruction type

Values to define the type of configuration instruction

#define A4L_INSN_CONFIG_DIO_INPUT   0
 
#define A4L_INSN_CONFIG_DIO_OUTPUT   1
 
#define A4L_INSN_CONFIG_DIO_OPENDRAIN   2
 
#define A4L_INSN_CONFIG_ANALOG_TRIG   16
 
#define A4L_INSN_CONFIG_ALT_SOURCE   20
 
#define A4L_INSN_CONFIG_DIGITAL_TRIG   21
 
#define A4L_INSN_CONFIG_BLOCK_SIZE   22
 
#define A4L_INSN_CONFIG_TIMER_1   23
 
#define A4L_INSN_CONFIG_FILTER   24
 
#define A4L_INSN_CONFIG_CHANGE_NOTIFY   25
 
#define A4L_INSN_CONFIG_SERIAL_CLOCK   26
 
#define A4L_INSN_CONFIG_BIDIRECTIONAL_DATA   27
 
#define A4L_INSN_CONFIG_DIO_QUERY   28
 
#define A4L_INSN_CONFIG_PWM_OUTPUT   29
 
#define A4L_INSN_CONFIG_GET_PWM_OUTPUT   30
 
#define A4L_INSN_CONFIG_ARM   31
 
#define A4L_INSN_CONFIG_DISARM   32
 
#define A4L_INSN_CONFIG_GET_COUNTER_STATUS   33
 
#define A4L_INSN_CONFIG_RESET   34
 
#define A4L_INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR   1001 /* Use CTR as single pulsegenerator */
 
#define A4L_INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR   1002 /* Use CTR as pulsetraingenerator */
 
#define A4L_INSN_CONFIG_GPCT_QUADRATURE_ENCODER   1003 /* Use the counter as encoder */
 
#define A4L_INSN_CONFIG_SET_GATE_SRC   2001 /* Set gate source */
 
#define A4L_INSN_CONFIG_GET_GATE_SRC   2002 /* Get gate source */
 
#define A4L_INSN_CONFIG_SET_CLOCK_SRC   2003 /* Set master clock source */
 
#define A4L_INSN_CONFIG_GET_CLOCK_SRC   2004 /* Get master clock source */
 
#define A4L_INSN_CONFIG_SET_OTHER_SRC   2005 /* Set other source */
 
#define A4L_INSN_CONFIG_SET_COUNTER_MODE   4097
 
#define A4L_INSN_CONFIG_SET_ROUTING   4099
 
#define A4L_INSN_CONFIG_GET_ROUTING   4109
 
Counter status bits

Status bits for INSN_CONFIG_GET_COUNTER_STATUS

#define A4L_COUNTER_ARMED   0x1
 
#define A4L_COUNTER_COUNTING   0x2
 
#define A4L_COUNTER_TERMINAL_COUNT   0x4
 
IO direction

Values to define the IO polarity

#define A4L_INPUT   0
 
#define A4L_OUTPUT   1
 
#define A4L_OPENDRAIN   2
 
Events types

Values to define the Analogy events. They might used to send some specific events through the instruction interface.

#define A4L_EV_START   0x00040000
 
#define A4L_EV_SCAN_BEGIN   0x00080000
 
#define A4L_EV_CONVERT   0x00100000
 
#define A4L_EV_SCAN_END   0x00200000
 
#define A4L_EV_STOP   0x00400000
 

Detailed Description

Analogy for Linux, UAPI bits.

Note
Copyright (C) 1997-2000 David A. Schleef ds@sc.nosp@m.hlee.nosp@m.f.org
Copyright (C) 2008 Alexis Berlemont alexi.nosp@m.s.be.nosp@m.rlemo.nosp@m.nt@f.nosp@m.ree.f.nosp@m.r

This library 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 library 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

Macro Definition Documentation

◆ A4L_RNG_FACTOR

#define A4L_RNG_FACTOR   1000000

Constant for internal use only (must not be used by driver developer).