Xenomai API  2.5.6.1
include/analogy/instruction.h
Go to the documentation of this file.
00001 
00023 #ifndef __ANALOGY_INSTRUCTION__
00024 #define __ANALOGY_INSTRUCTION__
00025 
00026 #include <analogy/types.h>
00027 #include <analogy/context.h>
00028 
00029 #define A4L_INSN_MASK_READ 0x8000000
00030 #define A4L_INSN_MASK_WRITE 0x4000000
00031 #define A4L_INSN_MASK_SPECIAL 0x2000000
00032 
00047 #define A4L_INSN_READ (0 | A4L_INSN_MASK_READ)
00048 
00051 #define A4L_INSN_WRITE (1 | A4L_INSN_MASK_WRITE)
00052 
00055 #define A4L_INSN_BITS (2 | A4L_INSN_MASK_READ | \
00056                        A4L_INSN_MASK_WRITE)
00057 
00060 #define A4L_INSN_CONFIG (3 | A4L_INSN_MASK_READ | \
00061                          A4L_INSN_MASK_WRITE)
00062 
00065 #define A4L_INSN_GTOD (4 | A4L_INSN_MASK_READ | \
00066                        A4L_INSN_MASK_SPECIAL)
00067 
00070 #define A4L_INSN_WAIT (5 | A4L_INSN_MASK_WRITE | \
00071                        A4L_INSN_MASK_SPECIAL)
00072 
00075 #define A4L_INSN_INTTRIG (6 | A4L_INSN_MASK_WRITE | \
00076                           A4L_INSN_MASK_SPECIAL)
00077 
00083 #define A4L_INSN_WAIT_MAX 100000
00084 
00091 #define A4L_INSN_CONFIG_DIO_INPUT               0
00092 #define A4L_INSN_CONFIG_DIO_OUTPUT              1
00093 #define A4L_INSN_CONFIG_DIO_OPENDRAIN           2
00094 #define A4L_INSN_CONFIG_ANALOG_TRIG             16
00095 #define A4L_INSN_CONFIG_ALT_SOURCE              20
00096 #define A4L_INSN_CONFIG_DIGITAL_TRIG            21
00097 #define A4L_INSN_CONFIG_BLOCK_SIZE              22
00098 #define A4L_INSN_CONFIG_TIMER_1                 23
00099 #define A4L_INSN_CONFIG_FILTER                  24
00100 #define A4L_INSN_CONFIG_CHANGE_NOTIFY           25
00101 #define A4L_INSN_CONFIG_SERIAL_CLOCK            26
00102 #define A4L_INSN_CONFIG_BIDIRECTIONAL_DATA      27
00103 #define A4L_INSN_CONFIG_DIO_QUERY               28
00104 #define A4L_INSN_CONFIG_PWM_OUTPUT              29
00105 #define A4L_INSN_CONFIG_GET_PWM_OUTPUT          30
00106 #define A4L_INSN_CONFIG_ARM                     31
00107 #define A4L_INSN_CONFIG_DISARM                  32
00108 #define A4L_INSN_CONFIG_GET_COUNTER_STATUS      33
00109 #define A4L_INSN_CONFIG_RESET                   34
00110 #define A4L_INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR     1001    /* Use CTR as single pulsegenerator */
00111 #define A4L_INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR      1002    /* Use CTR as pulsetraingenerator */
00112 #define A4L_INSN_CONFIG_GPCT_QUADRATURE_ENCODER 1003    /* Use the counter as encoder */
00113 #define A4L_INSN_CONFIG_SET_GATE_SRC            2001    /* Set gate source */
00114 #define A4L_INSN_CONFIG_GET_GATE_SRC            2002    /* Get gate source */
00115 #define A4L_INSN_CONFIG_SET_CLOCK_SRC           2003    /* Set master clock source */
00116 #define A4L_INSN_CONFIG_GET_CLOCK_SRC           2004    /* Get master clock source */
00117 #define A4L_INSN_CONFIG_SET_OTHER_SRC           2005    /* Set other source */
00118 #define A4L_INSN_CONFIG_SET_COUNTER_MODE        4097
00119 #define A4L_INSN_CONFIG_SET_ROUTING             4099
00120 #define A4L_INSN_CONFIG_GET_ROUTING             4109
00121 
00130 #define A4L_COUNTER_ARMED               0x1
00131 #define A4L_COUNTER_COUNTING            0x2
00132 #define A4L_COUNTER_TERMINAL_COUNT      0x4
00133 
00142 #define A4L_INPUT       0
00143 #define A4L_OUTPUT      1
00144 #define A4L_OPENDRAIN   2
00145 
00156 #define A4L_EV_START            0x00040000
00157 #define A4L_EV_SCAN_BEGIN       0x00080000
00158 #define A4L_EV_CONVERT          0x00100000
00159 #define A4L_EV_SCAN_END         0x00200000
00160 #define A4L_EV_STOP             0x00400000
00161 
00169 struct a4l_instruction {
00170         unsigned int type;
00172         unsigned int idx_subd;
00174         unsigned int chan_desc;
00176         unsigned int data_size;
00178         void *data;
00180 };
00181 typedef struct a4l_instruction a4l_insn_t;
00182 
00188 struct a4l_instruction_list {
00189         unsigned int count;
00191         a4l_insn_t *insns;
00193 };
00194 typedef struct a4l_instruction_list a4l_insnlst_t;
00195 
00198 #if defined(__KERNEL__) && !defined(DOXYGEN_CPP)
00199 
00200 struct a4l_kernel_instruction {
00201         unsigned int type;
00202         unsigned int idx_subd;
00203         unsigned int chan_desc;
00204         unsigned int data_size;
00205         void *data;
00206         void *__udata;
00207 };
00208 typedef struct a4l_kernel_instruction a4l_kinsn_t;
00209 
00210 struct a4l_kernel_instruction_list {
00211         unsigned int count;
00212         a4l_kinsn_t *insns;
00213         a4l_insn_t *__uinsns;
00214 };
00215 typedef struct a4l_kernel_instruction_list a4l_kilst_t;
00216 
00217 /* Instruction related functions */
00218 
00219 /* Upper layer functions */
00220 int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg);
00221 int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg);
00222 
00223 #endif /* __KERNEL__ && !DOXYGEN_CPP */
00224 
00225 #endif /* __ANALOGY_INSTRUCTION__ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines