Xenomai API  2.5.6.1
include/analogy/device.h
Go to the documentation of this file.
00001 
00023 #ifndef __ANALOGY_DEVICE__
00024 #define __ANALOGY_DEVICE__
00025 
00026 #ifndef DOXYGEN_CPP
00027 
00028 #include <analogy/context.h>
00029 #include <analogy/driver.h>
00030 #include <analogy/transfer.h>
00031 
00032 #ifdef __KERNEL__
00033 
00034 #define A4L_NB_DEVICES 10
00035 
00036 #define A4L_DEV_ATTACHED_NR 0
00037 
00038 struct a4l_device {
00039 
00040         /* Spinlock for global device use */
00041         a4l_lock_t lock;
00042 
00043         /* Device specific flags */
00044         unsigned long flags;
00045 
00046         /* Driver assigned to this device thanks to attaching
00047            procedure */
00048         a4l_drv_t *driver;
00049 
00050         /* Hidden description stuff */
00051         struct list_head subdvsq;
00052 
00053         /* Context-dependent stuff */
00054         a4l_trf_t transfer;
00055 
00056         /* Private data useful for drivers functioning */
00057         void *priv;
00058 };
00059 typedef struct a4l_device a4l_dev_t;
00060 
00061 #endif /* __KERNEL__ */
00062 
00063 /* DEVCFG ioctl argument structure */
00064 struct a4l_link_desc {
00065         unsigned char bname_size;
00066         char *bname;
00067         unsigned int opts_size;
00068         void *opts;
00069 };
00070 typedef struct a4l_link_desc a4l_lnkdesc_t;
00071 
00072 /* DEVINFO ioctl argument structure */
00073 struct a4l_dev_info {
00074         char board_name[A4L_NAMELEN];
00075         int nb_subd;
00076         int idx_read_subd;
00077         int idx_write_subd;
00078 };
00079 typedef struct a4l_dev_info a4l_dvinfo_t;
00080 
00081 #ifdef __KERNEL__
00082 
00083 /* --- Devices tab related functions --- */
00084 void a4l_init_devs(void);
00085 int a4l_check_cleanup_devs(void);
00086 int a4l_rdproc_devs(char *page,
00087                     char **start,
00088                     off_t off, int count, int *eof, void *data);
00089 
00090 /* --- Context related function / macro --- */
00091 void a4l_set_dev(a4l_cxt_t *cxt);
00092 #define a4l_get_dev(x) ((x)->dev)
00093 
00094 /* --- Upper layer functions --- */
00095 int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg);
00096 int a4l_ioctl_devinfo(a4l_cxt_t * cxt, void *arg);
00097 
00098 #endif /* __KERNEL__ */
00099 
00100 #endif /* !DOXYGEN_CPP */
00101 
00102 #endif /* __ANALOGY_DEVICE__ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines