Path: blob/master/drivers/media/dvb/dvb-core/dvbdev.h
15112 views
/*1* dvbdev.h2*3* Copyright (C) 2000 Ralph Metzler & Marcus Metzler4* for convergence integrated media GmbH5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Lesser Public License8* as published by the Free Software Foundation; either version 2.19* of the License, or (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU Lesser General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.19*20*/2122#ifndef _DVBDEV_H_23#define _DVBDEV_H_2425#include <linux/types.h>26#include <linux/poll.h>27#include <linux/fs.h>28#include <linux/list.h>2930#define DVB_MAJOR 2123132#if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 033#define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS34#else35#define DVB_MAX_ADAPTERS 836#endif3738#define DVB_UNSET (-1)3940#define DVB_DEVICE_VIDEO 041#define DVB_DEVICE_AUDIO 142#define DVB_DEVICE_SEC 243#define DVB_DEVICE_FRONTEND 344#define DVB_DEVICE_DEMUX 445#define DVB_DEVICE_DVR 546#define DVB_DEVICE_CA 647#define DVB_DEVICE_NET 748#define DVB_DEVICE_OSD 84950#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \51static short adapter_nr[] = \52{[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \53module_param_array(adapter_nr, short, NULL, 0444); \54MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")5556struct dvb_frontend;5758struct dvb_adapter {59int num;60struct list_head list_head;61struct list_head device_list;62const char *name;63u8 proposed_mac [6];64void* priv;6566struct device *device;6768struct module *module;6970int mfe_shared; /* indicates mutually exclusive frontends */71struct dvb_device *mfe_dvbdev; /* frontend device in use */72struct mutex mfe_lock; /* access lock for thread creation */7374/* Allow the adapter/bridge driver to perform an action before and/or75* after the core handles an ioctl:76*77* DVB_FE_IOCTL_PRE indicates that the ioctl has not yet been handled.78* DVB_FE_IOCTL_POST indicates that the ioctl has been handled.79*80* When DVB_FE_IOCTL_PRE is passed to the callback as the stage arg:81*82* return 0 to allow dvb-core to handle the ioctl.83* return a positive int to prevent dvb-core from handling the ioctl,84* and exit without error.85* return a negative int to prevent dvb-core from handling the ioctl,86* and return that value as an error.87*88* When DVB_FE_IOCTL_POST is passed to the callback as the stage arg:89*90* return 0 to allow the dvb_frontend ioctl handler to exit normally.91* return a negative int to cause the dvb_frontend ioctl handler to92* return that value as an error.93*/94#define DVB_FE_IOCTL_PRE 095#define DVB_FE_IOCTL_POST 196int (*fe_ioctl_override)(struct dvb_frontend *fe,97unsigned int cmd, void *parg,98unsigned int stage);99};100101102struct dvb_device {103struct list_head list_head;104const struct file_operations *fops;105struct dvb_adapter *adapter;106int type;107int minor;108u32 id;109110/* in theory, 'users' can vanish now,111but I don't want to change too much now... */112int readers;113int writers;114int users;115116wait_queue_head_t wait_queue;117/* don't really need those !? -- FIXME: use video_usercopy */118int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);119120void *priv;121};122123124extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,125struct module *module, struct device *device,126short *adapter_nums);127extern int dvb_unregister_adapter (struct dvb_adapter *adap);128129extern int dvb_register_device (struct dvb_adapter *adap,130struct dvb_device **pdvbdev,131const struct dvb_device *template,132void *priv,133int type);134135extern void dvb_unregister_device (struct dvb_device *dvbdev);136137extern int dvb_generic_open (struct inode *inode, struct file *file);138extern int dvb_generic_release (struct inode *inode, struct file *file);139extern long dvb_generic_ioctl (struct file *file,140unsigned int cmd, unsigned long arg);141142/* we don't mess with video_usercopy() any more,143we simply define out own dvb_usercopy(), which will hopefully become144generic_usercopy() someday... */145146extern int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg,147int (*func)(struct file *file, unsigned int cmd, void *arg));148149/** generic DVB attach function. */150#ifdef CONFIG_MEDIA_ATTACH151#define dvb_attach(FUNCTION, ARGS...) ({ \152void *__r = NULL; \153typeof(&FUNCTION) __a = symbol_request(FUNCTION); \154if (__a) { \155__r = (void *) __a(ARGS); \156if (__r == NULL) \157symbol_put(FUNCTION); \158} else { \159printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \160} \161__r; \162})163164#else165#define dvb_attach(FUNCTION, ARGS...) ({ \166FUNCTION(ARGS); \167})168169#endif170171#endif /* #ifndef _DVBDEV_H_ */172173174