Xenomai API  2.6.4
device.h
Go to the documentation of this file.
1 
23 #ifndef __ANALOGY_DEVICE__
24 #define __ANALOGY_DEVICE__
25 
26 #ifndef DOXYGEN_CPP
27 
28 #include <analogy/context.h>
29 #include <analogy/driver.h>
30 #include <analogy/transfer.h>
31 
32 #ifdef __KERNEL__
33 
34 #define A4L_NB_DEVICES 10
35 
36 #define A4L_DEV_ATTACHED_NR 0
37 
38 struct a4l_device {
39 
40  /* Spinlock for global device use */
41  a4l_lock_t lock;
42 
43  /* Device specific flags */
44  unsigned long flags;
45 
46  /* Driver assigned to this device thanks to attaching
47  procedure */
48  a4l_drv_t *driver;
49 
50  /* Hidden description stuff */
51  struct list_head subdvsq;
52 
53  /* Context-dependent stuff */
54  a4l_trf_t transfer;
55 
56  /* Private data useful for drivers functioning */
57  void *priv;
58 };
59 typedef struct a4l_device a4l_dev_t;
60 
61 #endif /* __KERNEL__ */
62 
63 /* DEVCFG ioctl argument structure */
64 struct a4l_link_desc {
65  unsigned char bname_size;
66  char *bname;
67  unsigned int opts_size;
68  void *opts;
69 };
70 typedef struct a4l_link_desc a4l_lnkdesc_t;
71 
72 /* DEVINFO ioctl argument structure */
73 struct a4l_dev_info {
74  char board_name[A4L_NAMELEN];
75  int nb_subd;
76  int idx_read_subd;
77  int idx_write_subd;
78 };
79 typedef struct a4l_dev_info a4l_dvinfo_t;
80 
81 #ifdef __KERNEL__
82 
83 /* --- Devices tab related functions --- */
84 void a4l_init_devs(void);
85 int a4l_check_cleanup_devs(void);
86 int a4l_rdproc_devs(struct seq_file *p, void *data);
87 
88 /* --- Context related function / macro --- */
89 void a4l_set_dev(a4l_cxt_t *cxt);
90 #define a4l_get_dev(x) ((x)->dev)
91 
92 /* --- Upper layer functions --- */
93 int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg);
94 int a4l_ioctl_devinfo(a4l_cxt_t * cxt, void *arg);
95 
96 #endif /* __KERNEL__ */
97 
98 #endif /* !DOXYGEN_CPP */
99 
100 #endif /* __ANALOGY_DEVICE__ */