SASC-NG
DVBSoftCAM

dvbdev-2.6.v4l.h

Go to the documentation of this file.
00001 /*
00002  * dvbdev.h
00003  *
00004  * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
00005  *                    for convergence integrated media GmbH
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Lesser Public License
00009  * as published by the Free Software Foundation; either version 2.1
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  *
00021  */
00022 
00023 #ifndef _DVBDEV_H_
00024 #define _DVBDEV_H_
00025 
00026 #include <linux/types.h>
00027 #include <linux/poll.h>
00028 #include <linux/fs.h>
00029 #include <linux/list.h>
00030 
00031 #define DVB_MAJOR 212
00032 
00033 #define DVB_MAX_ADAPTERS 8
00034 
00035 #define DVB_UNSET (-1)
00036 
00037 #define DVB_DEVICE_VIDEO      0
00038 #define DVB_DEVICE_AUDIO      1
00039 #define DVB_DEVICE_SEC        2
00040 #define DVB_DEVICE_FRONTEND   3
00041 #define DVB_DEVICE_DEMUX      4
00042 #define DVB_DEVICE_DVR        5
00043 #define DVB_DEVICE_CA         6
00044 #define DVB_DEVICE_NET        7
00045 #define DVB_DEVICE_OSD        8
00046 
00047 #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
00048         static short adapter_nr[] = \
00049                 {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
00050         module_param_array(adapter_nr, short, NULL, 0444); \
00051         MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
00052 
00053 struct dvb_adapter {
00054         int num;
00055         struct list_head list_head;
00056         struct list_head device_list;
00057         const char *name;
00058         u8 proposed_mac [6];
00059         void* priv;
00060 
00061         struct device *device;
00062 
00063         struct module *module;
00064 
00065         int mfe_shared;         /* indicates mutually exclusive frontends */
00066         struct dvb_device *mfe_dvbdev;   /* frontend device in use */
00067         struct mutex mfe_lock;      /* access lock for thread creation */
00068 };
00069 
00070 
00071 struct dvb_device {
00072         struct list_head list_head;
00073         const struct file_operations *fops;
00074         struct dvb_adapter *adapter;
00075         int type;
00076         int minor;
00077         u32 id;
00078 
00079         /* in theory, 'users' can vanish now,
00080            but I don't want to change too much now... */
00081         int readers;
00082         int writers;
00083         int users;
00084 
00085         wait_queue_head_t         wait_queue;
00086         /* don't really need those !? -- FIXME: use video_usercopy  */
00087         int (*kernel_ioctl)(struct inode *inode, struct file *file,
00088                             unsigned int cmd, void *arg);
00089 
00090         void *priv;
00091 };
00092 
00093 
00094 extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
00095                                 struct module *module, struct device *device,
00096                                 short *adapter_nums);
00097 extern int dvb_unregister_adapter (struct dvb_adapter *adap);
00098 
00099 extern int dvb_register_device (struct dvb_adapter *adap,
00100                                 struct dvb_device **pdvbdev,
00101                                 const struct dvb_device *template,
00102                                 void *priv,
00103                                 int type);
00104 
00105 extern void dvb_unregister_device (struct dvb_device *dvbdev);
00106 
00107 extern int dvb_generic_open (struct inode *inode, struct file *file);
00108 extern int dvb_generic_release (struct inode *inode, struct file *file);
00109 extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
00110                               unsigned int cmd, unsigned long arg);
00111 
00112 /* we don't mess with video_usercopy() any more,
00113 we simply define out own dvb_usercopy(), which will hopefully become
00114 generic_usercopy()  someday... */
00115 
00116 extern int dvb_usercopy(struct inode *inode, struct file *file,
00117                             unsigned int cmd, unsigned long arg,
00118                             int (*func)(struct inode *inode, struct file *file,
00119                             unsigned int cmd, void *arg));
00120 
00122 #ifdef CONFIG_MEDIA_ATTACH
00123 #define dvb_attach(FUNCTION, ARGS...) ({ \
00124         void *__r = NULL; \
00125         typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
00126         if (__a) { \
00127                 __r = (void *) __a(ARGS); \
00128                 if (__r == NULL) \
00129                         symbol_put(FUNCTION); \
00130         } else { \
00131                 printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
00132         } \
00133         __r; \
00134 })
00135 
00136 #else
00137 #define dvb_attach(FUNCTION, ARGS...) ({ \
00138         FUNCTION(ARGS); \
00139 })
00140 
00141 #endif
00142 
00143 #endif /* #ifndef _DVBDEV_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines