Xenomai API  2.6.5
instruction.h
Go to the documentation of this file.
1 
23 #ifndef __ANALOGY_INSTRUCTION__
24 #define __ANALOGY_INSTRUCTION__
25 
26 #include <analogy/types.h>
27 #include <analogy/context.h>
28 
29 #define A4L_INSN_MASK_READ 0x8000000
30 #define A4L_INSN_MASK_WRITE 0x4000000
31 #define A4L_INSN_MASK_SPECIAL 0x2000000
32 
47 #define A4L_INSN_READ (0 | A4L_INSN_MASK_READ)
48 
51 #define A4L_INSN_WRITE (1 | A4L_INSN_MASK_WRITE)
52 
55 #define A4L_INSN_BITS (2 | A4L_INSN_MASK_READ | \
56  A4L_INSN_MASK_WRITE)
57 
60 #define A4L_INSN_CONFIG (3 | A4L_INSN_MASK_READ | \
61  A4L_INSN_MASK_WRITE)
62 
65 #define A4L_INSN_GTOD (4 | A4L_INSN_MASK_READ | \
66  A4L_INSN_MASK_SPECIAL)
67 
70 #define A4L_INSN_WAIT (5 | A4L_INSN_MASK_WRITE | \
71  A4L_INSN_MASK_SPECIAL)
72 
75 #define A4L_INSN_INTTRIG (6 | A4L_INSN_MASK_WRITE | \
76  A4L_INSN_MASK_SPECIAL)
77 
83 #define A4L_INSN_WAIT_MAX 100000
84 
91 #define A4L_INSN_CONFIG_DIO_INPUT 0
92 #define A4L_INSN_CONFIG_DIO_OUTPUT 1
93 #define A4L_INSN_CONFIG_DIO_OPENDRAIN 2
94 #define A4L_INSN_CONFIG_ANALOG_TRIG 16
95 #define A4L_INSN_CONFIG_ALT_SOURCE 20
96 #define A4L_INSN_CONFIG_DIGITAL_TRIG 21
97 #define A4L_INSN_CONFIG_BLOCK_SIZE 22
98 #define A4L_INSN_CONFIG_TIMER_1 23
99 #define A4L_INSN_CONFIG_FILTER 24
100 #define A4L_INSN_CONFIG_CHANGE_NOTIFY 25
101 #define A4L_INSN_CONFIG_SERIAL_CLOCK 26
102 #define A4L_INSN_CONFIG_BIDIRECTIONAL_DATA 27
103 #define A4L_INSN_CONFIG_DIO_QUERY 28
104 #define A4L_INSN_CONFIG_PWM_OUTPUT 29
105 #define A4L_INSN_CONFIG_GET_PWM_OUTPUT 30
106 #define A4L_INSN_CONFIG_ARM 31
107 #define A4L_INSN_CONFIG_DISARM 32
108 #define A4L_INSN_CONFIG_GET_COUNTER_STATUS 33
109 #define A4L_INSN_CONFIG_RESET 34
110 #define A4L_INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR 1001 /* Use CTR as single pulsegenerator */
111 #define A4L_INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR 1002 /* Use CTR as pulsetraingenerator */
112 #define A4L_INSN_CONFIG_GPCT_QUADRATURE_ENCODER 1003 /* Use the counter as encoder */
113 #define A4L_INSN_CONFIG_SET_GATE_SRC 2001 /* Set gate source */
114 #define A4L_INSN_CONFIG_GET_GATE_SRC 2002 /* Get gate source */
115 #define A4L_INSN_CONFIG_SET_CLOCK_SRC 2003 /* Set master clock source */
116 #define A4L_INSN_CONFIG_GET_CLOCK_SRC 2004 /* Get master clock source */
117 #define A4L_INSN_CONFIG_SET_OTHER_SRC 2005 /* Set other source */
118 #define A4L_INSN_CONFIG_SET_COUNTER_MODE 4097
119 #define A4L_INSN_CONFIG_SET_ROUTING 4099
120 #define A4L_INSN_CONFIG_GET_ROUTING 4109
121 
130 #define A4L_COUNTER_ARMED 0x1
131 #define A4L_COUNTER_COUNTING 0x2
132 #define A4L_COUNTER_TERMINAL_COUNT 0x4
133 
142 #define A4L_INPUT 0
143 #define A4L_OUTPUT 1
144 #define A4L_OPENDRAIN 2
145 
156 #define A4L_EV_START 0x00040000
157 #define A4L_EV_SCAN_BEGIN 0x00080000
158 #define A4L_EV_CONVERT 0x00100000
159 #define A4L_EV_SCAN_END 0x00200000
160 #define A4L_EV_STOP 0x00400000
161 
170  unsigned int type;
172  unsigned int idx_subd;
174  unsigned int chan_desc;
176  unsigned int data_size;
178  void *data;
180 };
181 typedef struct a4l_instruction a4l_insn_t;
182 
189  unsigned int count;
193 };
194 typedef struct a4l_instruction_list a4l_insnlst_t;
195 
198 #if defined(__KERNEL__) && !defined(DOXYGEN_CPP)
199 
200 struct a4l_kernel_instruction {
201  unsigned int type;
202  unsigned int idx_subd;
203  unsigned int chan_desc;
204  unsigned int data_size;
205  void *data;
206  void *__udata;
207 };
208 typedef struct a4l_kernel_instruction a4l_kinsn_t;
209 
210 struct a4l_kernel_instruction_list {
211  unsigned int count;
212  a4l_kinsn_t *insns;
213  a4l_insn_t *__uinsns;
214 };
215 typedef struct a4l_kernel_instruction_list a4l_kilst_t;
216 
217 /* Instruction related functions */
218 
219 /* Upper layer functions */
220 int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg);
221 int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg);
222 
223 #endif /* __KERNEL__ && !DOXYGEN_CPP */
224 
225 #endif /* __ANALOGY_INSTRUCTION__ */
unsigned int idx_subd
Subdevice to which the instruction will be applied.
Definition: instruction.h:172
unsigned int chan_desc
Channel descriptor.
Definition: instruction.h:174
Analogy for Linux, context structure / macros declarations.
void * data
Instruction data.
Definition: instruction.h:178
a4l_insn_t * insns
Tab containing the instructions pointers.
Definition: instruction.h:191
Structure describing the synchronous instruction.
Definition: instruction.h:169
Analogy for Linux, misc declarations.
unsigned int data_size
Size of the intruction data.
Definition: instruction.h:176
unsigned int type
Instruction type.
Definition: instruction.h:170
unsigned int count
Instructions count.
Definition: instruction.h:189
Structure describing the list of synchronous instructions.
Definition: instruction.h:188