Xenomai API  2.6.5
command.h
Go to the documentation of this file.
1 
23 #ifndef __ANALOGY_CMD__
24 #define __ANALOGY_CMD__
25 
26 #include <analogy/context.h>
27 
42 #define A4L_CMD_SIMUL 0x1
43 
46 #define A4L_CMD_BULK 0x2
47 
50 #define A4L_CMD_WRITE 0x4
51 
63 #define TRIG_NONE 0x00000001
64 
67 #define TRIG_NOW 0x00000002
68 
71 #define TRIG_FOLLOW 0x00000004
72 
75 #define TRIG_TIME 0x00000008
76 
79 #define TRIG_TIMER 0x00000010
80 
83 #define TRIG_COUNT 0x00000020
84 
87 #define TRIG_EXT 0x00000040
88 
91 #define TRIG_INT 0x00000080
92 
95 #define TRIG_OTHER 0x00000100
96 
99 #define TRIG_WAKE_EOS 0x0020
100 
103 #define TRIG_ROUND_MASK 0x00030000
104 
107 #define TRIG_ROUND_NEAREST 0x00000000
108 
111 #define TRIG_ROUND_DOWN 0x00010000
112 
115 #define TRIG_ROUND_UP 0x00020000
116 
119 #define TRIG_ROUND_UP_NEXT 0x00030000
120 
133 #define CHAN(a) ((a) & 0xffff)
134 
137 #define RNG(a) (((a) & 0xff) << 16)
138 
141 #define AREF(a) (((a) & 0xf) << 24)
142 
145 #define FLAGS(a) ((a) & CR_FLAGS_MASK)
146 
149 #define PACK(a, b, c) (CHAN(a) | RNG(b) | AREF(c))
150 
153 #define PACK_FLAGS(a, b, c, d) (CHAN(a) | RNG(b) | AREF(c) | FLAGS(d))
154 
158 #define AREF_GROUND 0x00
159 
162 #define AREF_COMMON 0x01
163 
166 #define AREF_DIFF 0x02
167 
170 #define AREF_OTHER 0x03
171 
174 #if !defined(DOXYGEN_CPP)
175 
176 #define CR_FLAGS_MASK 0xfc000000
177 #define CR_ALT_FILTER (1<<26)
178 #define CR_DITHER CR_ALT_FILTER
179 #define CR_DEGLITCH CR_ALT_FILTER
180 #define CR_ALT_SOURCE (1<<27)
181 #define CR_EDGE (1<<28)
182 #define CR_INVERT (1<<29)
183 
184 #if defined(__KERNEL__)
185 /* Channels macros only useful for the kernel side */
186 #define CR_CHAN(a) CHAN(a)
187 #define CR_RNG(a) (((a)>>16)&0xff)
188 #define CR_AREF(a) (((a)>>24)&0xf)
189 #endif /* __KERNEL__ */
190 
191 #endif /* !DOXYGEN_CPP */
192 
198 struct a4l_cmd_desc {
199  unsigned char idx_subd;
202  unsigned long flags;
205  /* Command trigger characteristics */
206  unsigned int start_src;
208  unsigned int start_arg;
210  unsigned int scan_begin_src;
212  unsigned int scan_begin_arg;
214  unsigned int convert_src;
216  unsigned int convert_arg;
218  unsigned int scan_end_src;
220  unsigned int scan_end_arg;
222  unsigned int stop_src;
224  unsigned int stop_arg;
227  unsigned char nb_chan;
229  unsigned int *chan_descs;
232  /* Driver specific fields */
233  unsigned int data_len;
235  sampl_t *data;
237 };
238 typedef struct a4l_cmd_desc a4l_cmd_t;
239 
242 #if defined(__KERNEL__) && !defined(DOXYGEN_CPP)
243 
244 /* --- Command related function --- */
245 void a4l_free_cmddesc(a4l_cmd_t * desc);
246 
247 /* --- Upper layer functions --- */
248 int a4l_check_cmddesc(a4l_cxt_t * cxt, a4l_cmd_t * desc);
249 int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg);
250 
251 #endif /* __KERNEL__ && !DOXYGEN_CPP */
252 
253 #endif /* __ANALOGY_CMD__ */
unsigned int scan_begin_arg
Scan begin trigger argument.
Definition: command.h:212
unsigned int stop_arg
Stop trigger argument.
Definition: command.h:224
sampl_t * data
Driver specific buffer pointer.
Definition: command.h:235
Analogy for Linux, context structure / macros declarations.
Structure describing the asynchronous instruction.
Definition: command.h:198
unsigned char idx_subd
Subdevice to which the command will be applied.
Definition: command.h:199
unsigned long flags
Command flags.
Definition: command.h:202
unsigned int scan_begin_src
Scan begin trigger type.
Definition: command.h:210
unsigned int convert_src
Convert trigger type.
Definition: command.h:214
unsigned int * chan_descs
Tab containing channels descriptors.
Definition: command.h:229
unsigned int start_arg
Start trigger argument.
Definition: command.h:208
unsigned int scan_end_arg
Scan end trigger argument.
Definition: command.h:220
unsigned int scan_end_src
Scan end trigger type.
Definition: command.h:218
unsigned int start_src
Start trigger type.
Definition: command.h:206
unsigned int convert_arg
Convert trigger argument.
Definition: command.h:216
unsigned char nb_chan
Count of channels related with the command.
Definition: command.h:227
unsigned int data_len
Driver specific buffer size.
Definition: command.h:233
unsigned int stop_src
Stop trigger type.
Definition: command.h:222