00001
00023 #ifndef __ANALOGY_SUBDEVICE__
00024 #define __ANALOGY_SUBDEVICE__
00025
00026 #ifdef __KERNEL__
00027 #include <linux/list.h>
00028 #endif
00029
00030 #include <analogy/types.h>
00031 #include <analogy/context.h>
00032 #include <analogy/instruction.h>
00033 #include <analogy/command.h>
00034 #include <analogy/channel_range.h>
00035
00036
00037
00038
00039
00040
00041
00042 #define A4L_SUBD_MASK_READ 0x80000000
00043 #define A4L_SUBD_MASK_WRITE 0x40000000
00044 #define A4L_SUBD_MASK_SPECIAL 0x20000000
00045
00060 #define A4L_SUBD_UNUSED (A4L_SUBD_MASK_SPECIAL|0x1)
00061
00064 #define A4L_SUBD_AI (A4L_SUBD_MASK_READ|0x2)
00065
00068 #define A4L_SUBD_AO (A4L_SUBD_MASK_WRITE|0x4)
00069
00072 #define A4L_SUBD_DI (A4L_SUBD_MASK_READ|0x8)
00073
00076 #define A4L_SUBD_DO (A4L_SUBD_MASK_WRITE|0x10)
00077
00080 #define A4L_SUBD_DIO (A4L_SUBD_MASK_SPECIAL|0x20)
00081
00084 #define A4L_SUBD_COUNTER (A4L_SUBD_MASK_SPECIAL|0x40)
00085
00088 #define A4L_SUBD_TIMER (A4L_SUBD_MASK_SPECIAL|0x80)
00089
00092 #define A4L_SUBD_MEMORY (A4L_SUBD_MASK_SPECIAL|0x100)
00093
00096 #define A4L_SUBD_CALIB (A4L_SUBD_MASK_SPECIAL|0x200)
00097
00100 #define A4L_SUBD_PROC (A4L_SUBD_MASK_SPECIAL|0x400)
00101
00104 #define A4L_SUBD_SERIAL (A4L_SUBD_MASK_SPECIAL|0x800)
00105
00108 #define A4L_SUBD_TYPES (A4L_SUBD_UNUSED | \
00109 A4L_SUBD_AI | \
00110 A4L_SUBD_AO | \
00111 A4L_SUBD_DI | \
00112 A4L_SUBD_DO | \
00113 A4L_SUBD_DIO | \
00114 A4L_SUBD_COUNTER | \
00115 A4L_SUBD_TIMER | \
00116 A4L_SUBD_MEMORY | \
00117 A4L_SUBD_CALIB | \
00118 A4L_SUBD_PROC | \
00119 A4L_SUBD_SERIAL)
00120
00129
00134 #define A4L_SUBD_CMD 0x1000
00135
00140 #define A4L_SUBD_MMAP 0x8000
00141
00144 #ifdef __KERNEL__
00145
00146
00147
00148 struct a4l_device;
00149 struct a4l_driver;
00150
00156 struct a4l_subdevice {
00157
00158 struct list_head list;
00161 struct a4l_device *dev;
00163 unsigned int idx;
00166
00167 unsigned long flags;
00169 a4l_chdesc_t *chan_desc;
00171 a4l_rngdesc_t *rng_desc;
00173 a4l_cmd_t *cmd_mask;
00176
00177 int (*insn_read) (struct a4l_subdevice *, a4l_kinsn_t *);
00179 int (*insn_write) (struct a4l_subdevice *, a4l_kinsn_t *);
00181 int (*insn_bits) (struct a4l_subdevice *, a4l_kinsn_t *);
00183 int (*insn_config) (struct a4l_subdevice *, a4l_kinsn_t *);
00185 int (*do_cmd) (struct a4l_subdevice *, a4l_cmd_t *);
00187 int (*do_cmdtest) (struct a4l_subdevice *, a4l_cmd_t *);
00189 int (*cancel) (struct a4l_subdevice *);
00191 void (*munge) (struct a4l_subdevice *, void *, unsigned long);
00193 int (*trigger) (struct a4l_subdevice *, lsampl_t);
00196 char priv[0];
00198 };
00199 typedef struct a4l_subdevice a4l_subd_t;
00200
00201 #endif
00202
00205 #ifndef DOXYGEN_CPP
00206
00207
00208
00209
00210 struct a4l_subd_info {
00211 unsigned long flags;
00212 unsigned long status;
00213 unsigned char nb_chan;
00214 };
00215 typedef struct a4l_subd_info a4l_sbinfo_t;
00216
00217
00218 struct a4l_chan_info {
00219 unsigned long chan_flags;
00220 unsigned char nb_rng;
00221 unsigned char nb_bits;
00222 };
00223 typedef struct a4l_chan_info a4l_chinfo_t;
00224
00225 struct a4l_chinfo_arg {
00226 unsigned int idx_subd;
00227 void *info;
00228 };
00229 typedef struct a4l_chinfo_arg a4l_chinfo_arg_t;
00230
00231
00232 struct a4l_rng_info {
00233 long min;
00234 long max;
00235 unsigned long flags;
00236 };
00237 typedef struct a4l_rng_info a4l_rnginfo_t;
00238
00239 struct a4l_rng_info_arg {
00240 unsigned int idx_subd;
00241 unsigned int idx_chan;
00242 void *info;
00243 };
00244 typedef struct a4l_rng_info_arg a4l_rnginfo_arg_t;
00245
00246 #ifdef __KERNEL__
00247
00248
00249 a4l_chan_t *a4l_get_chfeat(a4l_subd_t * sb, int idx);
00250 a4l_rng_t *a4l_get_rngfeat(a4l_subd_t * sb,
00251 int chidx, int rngidx);
00252 int a4l_check_chanlist(a4l_subd_t * subd,
00253 unsigned char nb_chan, unsigned int *chans);
00254
00255
00256
00257 a4l_subd_t * a4l_get_subd(struct a4l_device *dev, int idx);
00258 a4l_subd_t * a4l_alloc_subd(int sizeof_priv,
00259 void (*setup)(a4l_subd_t *));
00260 int a4l_add_subd(struct a4l_device *dev, a4l_subd_t * subd);
00261 int a4l_ioctl_subdinfo(a4l_cxt_t * cxt, void *arg);
00262 int a4l_ioctl_chaninfo(a4l_cxt_t * cxt, void *arg);
00263 int a4l_ioctl_rnginfo(a4l_cxt_t * cxt, void *arg);
00264 int a4l_ioctl_nbchaninfo(a4l_cxt_t * cxt, void *arg);
00265 int a4l_ioctl_nbrnginfo(a4l_cxt_t * cxt, void *arg);
00266
00267 #endif
00268
00269 #endif
00270
00271 #endif