Xenomai  3.0.8
subdevice.h
Go to the documentation of this file.
1 
22 #ifndef _COBALT_RTDM_ANALOGY_SUBDEVICE_H
23 #define _COBALT_RTDM_ANALOGY_SUBDEVICE_H
24 
25 #include <linux/list.h>
26 #include <rtdm/analogy/instruction.h>
27 #include <rtdm/analogy/command.h>
29 
30 /* --- Subdevice descriptor structure --- */
31 
32 struct a4l_device;
33 struct a4l_buffer;
34 
40 struct a4l_subdevice {
41 
42  struct list_head list;
45  struct a4l_device *dev;
48  unsigned int idx;
51  struct a4l_buffer *buf;
54  /* Subdevice's status (busy, linked?) */
55  unsigned long status;
58  /* Descriptors stuff */
59  unsigned long flags;
63  struct a4l_rngdesc *rng_desc;
68  /* Functions stuff */
69  int (*insn_read) (struct a4l_subdevice *, struct a4l_kernel_instruction *);
71  int (*insn_write) (struct a4l_subdevice *, struct a4l_kernel_instruction *);
73  int (*insn_bits) (struct a4l_subdevice *, struct a4l_kernel_instruction *);
75  int (*insn_config) (struct a4l_subdevice *, struct a4l_kernel_instruction *);
77  int (*do_cmd) (struct a4l_subdevice *, struct a4l_cmd_desc *);
79  int (*do_cmdtest) (struct a4l_subdevice *, struct a4l_cmd_desc *);
81  void (*cancel) (struct a4l_subdevice *);
83  void (*munge) (struct a4l_subdevice *, void *, unsigned long);
85  int (*trigger) (struct a4l_subdevice *, lsampl_t);
88  char priv[0];
90 };
91 
94 /* --- Subdevice related functions and macros --- */
95 
96 struct a4l_channel *a4l_get_chfeat(struct a4l_subdevice * sb, int idx);
97 struct a4l_range *a4l_get_rngfeat(struct a4l_subdevice * sb, int chidx, int rngidx);
98 int a4l_check_chanlist(struct a4l_subdevice * subd,
99  unsigned char nb_chan, unsigned int *chans);
100 
101 #define a4l_subd_is_input(x) ((A4L_SUBD_MASK_READ & (x)->flags) != 0)
102 /* The following macro considers that a DIO subdevice is firstly an
103  output subdevice */
104 #define a4l_subd_is_output(x) \
105  ((A4L_SUBD_MASK_WRITE & (x)->flags) != 0 || \
106  (A4L_SUBD_DIO & (x)->flags) != 0)
107 
108 /* --- Upper layer functions --- */
109 
110 struct a4l_subdevice * a4l_get_subd(struct a4l_device *dev, int idx);
111 struct a4l_subdevice * a4l_alloc_subd(int sizeof_priv,
112  void (*setup)(struct a4l_subdevice *));
113 int a4l_add_subd(struct a4l_device *dev, struct a4l_subdevice * subd);
114 int a4l_ioctl_subdinfo(struct a4l_device_context * cxt, void *arg);
115 int a4l_ioctl_chaninfo(struct a4l_device_context * cxt, void *arg);
116 int a4l_ioctl_rnginfo(struct a4l_device_context * cxt, void *arg);
117 int a4l_ioctl_nbchaninfo(struct a4l_device_context * cxt, void *arg);
118 int a4l_ioctl_nbrnginfo(struct a4l_device_context * cxt, void *arg);
119 
120 #endif /* !_COBALT_RTDM_ANALOGY_SUBDEVICE_H */
Structure describing some channel&#39;s characteristics.
Definition: channel_range.h:159
struct a4l_buffer * buf
Linked buffer.
Definition: subdevice.h:51
struct a4l_channels_desc * chan_desc
Tab of channels descriptors pointers.
Definition: subdevice.h:61
unsigned int idx
Subdevice index.
Definition: subdevice.h:48
Structure describing the asynchronous instruction.
Definition: analogy.h:289
unsigned long status
Subdevice&#39;s status.
Definition: subdevice.h:55
int(* do_cmdtest)(struct a4l_subdevice *, struct a4l_cmd_desc *)
Callback for command checking.
Definition: subdevice.h:79
struct a4l_rngdesc * rng_desc
Tab of ranges descriptors pointers.
Definition: subdevice.h:63
void(* munge)(struct a4l_subdevice *, void *, unsigned long)
Callback for munge operation.
Definition: subdevice.h:83
struct list_head list
List stuff.
Definition: subdevice.h:42
int(* insn_write)(struct a4l_subdevice *, struct a4l_kernel_instruction *)
Callback for the instruction "write".
Definition: subdevice.h:71
void(* cancel)(struct a4l_subdevice *)
Callback for asynchronous transfer cancellation.
Definition: subdevice.h:81
int(* insn_config)(struct a4l_subdevice *, struct a4l_kernel_instruction *)
Callback for the configuration instruction.
Definition: subdevice.h:75
Analogy for Linux, channel, range related features.
struct a4l_cmd_desc * cmd_mask
Command capabilities mask.
Definition: subdevice.h:65
Structure describing a (unique) range.
Definition: channel_range.h:202
Structure describing the subdevice.
Definition: subdevice.h:40
char priv[0]
Private data.
Definition: subdevice.h:88
Structure describing a channels set.
Definition: channel_range.h:187
int(* do_cmd)(struct a4l_subdevice *, struct a4l_cmd_desc *)
Callback for command handling.
Definition: subdevice.h:77
int(* insn_read)(struct a4l_subdevice *, struct a4l_kernel_instruction *)
Callback for the instruction "read".
Definition: subdevice.h:69
int(* insn_bits)(struct a4l_subdevice *, struct a4l_kernel_instruction *)
Callback for the instruction "bits".
Definition: subdevice.h:73
int(* trigger)(struct a4l_subdevice *, lsampl_t)
Callback for trigger operation.
Definition: subdevice.h:85
struct a4l_device * dev
Containing device.
Definition: subdevice.h:45
unsigned long flags
Type flags.
Definition: subdevice.h:59