| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * dvbdev.h | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2000 Ralph Metzler & Marcus Metzler | 
					
						
							|  |  |  |  *                    for convergence integrated media GmbH | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Lesser Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2.1 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Lesser General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef _DVBDEV_H_
 | 
					
						
							|  |  |  | #define _DVBDEV_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/types.h>
 | 
					
						
							|  |  |  | #include <linux/poll.h>
 | 
					
						
							|  |  |  | #include <linux/fs.h>
 | 
					
						
							|  |  |  | #include <linux/list.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define DVB_MAJOR 212
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-01 19:15:39 -03:00
										 |  |  | #if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
 | 
					
						
							|  |  |  | #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #warning invalid CONFIG_DVB_MAX_ADAPTERS value
 | 
					
						
							| 
									
										
										
										
											2008-04-09 19:13:13 -03:00
										 |  |  | #define DVB_MAX_ADAPTERS 8
 | 
					
						
							| 
									
										
										
										
											2009-09-01 19:15:39 -03:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-04-09 19:13:13 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define DVB_UNSET (-1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define DVB_DEVICE_VIDEO      0
 | 
					
						
							|  |  |  | #define DVB_DEVICE_AUDIO      1
 | 
					
						
							|  |  |  | #define DVB_DEVICE_SEC        2
 | 
					
						
							|  |  |  | #define DVB_DEVICE_FRONTEND   3
 | 
					
						
							|  |  |  | #define DVB_DEVICE_DEMUX      4
 | 
					
						
							|  |  |  | #define DVB_DEVICE_DVR        5
 | 
					
						
							|  |  |  | #define DVB_DEVICE_CA         6
 | 
					
						
							|  |  |  | #define DVB_DEVICE_NET        7
 | 
					
						
							|  |  |  | #define DVB_DEVICE_OSD        8
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-09 19:13:13 -03:00
										 |  |  | #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
 | 
					
						
							|  |  |  | 	static short adapter_nr[] = \ | 
					
						
							|  |  |  | 		{[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \ | 
					
						
							|  |  |  | 	module_param_array(adapter_nr, short, NULL, 0444); \ | 
					
						
							|  |  |  | 	MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers") | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct dvb_adapter { | 
					
						
							|  |  |  | 	int num; | 
					
						
							|  |  |  | 	struct list_head list_head; | 
					
						
							|  |  |  | 	struct list_head device_list; | 
					
						
							|  |  |  | 	const char *name; | 
					
						
							|  |  |  | 	u8 proposed_mac [6]; | 
					
						
							|  |  |  | 	void* priv; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-10 09:27:37 -03:00
										 |  |  | 	struct device *device; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct module *module; | 
					
						
							| 
									
										
										
										
											2008-10-11 11:44:05 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	int mfe_shared;			/* indicates mutually exclusive frontends */ | 
					
						
							|  |  |  | 	struct dvb_device *mfe_dvbdev;	/* frontend device in use */ | 
					
						
							|  |  |  | 	struct mutex mfe_lock;		/* access lock for thread creation */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct dvb_device { | 
					
						
							|  |  |  | 	struct list_head list_head; | 
					
						
							| 
									
										
										
										
											2009-01-11 06:12:43 -03:00
										 |  |  | 	const struct file_operations *fops; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct dvb_adapter *adapter; | 
					
						
							|  |  |  | 	int type; | 
					
						
							| 
									
										
										
										
											2008-10-23 12:11:19 -03:00
										 |  |  | 	int minor; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	u32 id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* in theory, 'users' can vanish now,
 | 
					
						
							|  |  |  | 	   but I don't want to change too much now... */ | 
					
						
							|  |  |  | 	int readers; | 
					
						
							|  |  |  | 	int writers; | 
					
						
							|  |  |  | 	int users; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-04-14 10:18:58 -03:00
										 |  |  | 	wait_queue_head_t	  wait_queue; | 
					
						
							| 
									
										
										
										
											2005-12-12 00:37:27 -08:00
										 |  |  | 	/* don't really need those !? -- FIXME: use video_usercopy  */ | 
					
						
							|  |  |  | 	int (*kernel_ioctl)(struct inode *inode, struct file *file, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			    unsigned int cmd, void *arg); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void *priv; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-09 19:13:13 -03:00
										 |  |  | extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name, | 
					
						
							|  |  |  | 				struct module *module, struct device *device, | 
					
						
							|  |  |  | 				short *adapter_nums); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | extern int dvb_unregister_adapter (struct dvb_adapter *adap); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int dvb_register_device (struct dvb_adapter *adap, | 
					
						
							|  |  |  | 				struct dvb_device **pdvbdev, | 
					
						
							|  |  |  | 				const struct dvb_device *template, | 
					
						
							|  |  |  | 				void *priv, | 
					
						
							|  |  |  | 				int type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern void dvb_unregister_device (struct dvb_device *dvbdev); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int dvb_generic_open (struct inode *inode, struct file *file); | 
					
						
							|  |  |  | extern int dvb_generic_release (struct inode *inode, struct file *file); | 
					
						
							|  |  |  | extern int dvb_generic_ioctl (struct inode *inode, struct file *file, | 
					
						
							|  |  |  | 			      unsigned int cmd, unsigned long arg); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* we don't mess with video_usercopy() any more,
 | 
					
						
							|  |  |  | we simply define out own dvb_usercopy(), which will hopefully become | 
					
						
							|  |  |  | generic_usercopy()  someday... */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int dvb_usercopy(struct inode *inode, struct file *file, | 
					
						
							| 
									
										
										
										
											2006-01-09 15:25:34 -02:00
										 |  |  | 			    unsigned int cmd, unsigned long arg, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			    int (*func)(struct inode *inode, struct file *file, | 
					
						
							|  |  |  | 			    unsigned int cmd, void *arg)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-08 09:10:08 -03:00
										 |  |  | /** generic DVB attach function. */ | 
					
						
							| 
									
										
										
										
											2008-04-29 21:38:46 -03:00
										 |  |  | #ifdef CONFIG_MEDIA_ATTACH
 | 
					
						
							| 
									
										
										
										
											2006-08-08 09:10:08 -03:00
										 |  |  | #define dvb_attach(FUNCTION, ARGS...) ({ \
 | 
					
						
							|  |  |  | 	void *__r = NULL; \ | 
					
						
							|  |  |  | 	typeof(&FUNCTION) __a = symbol_request(FUNCTION); \ | 
					
						
							|  |  |  | 	if (__a) { \ | 
					
						
							|  |  |  | 		__r = (void *) __a(ARGS); \ | 
					
						
							|  |  |  | 		if (__r == NULL) \ | 
					
						
							|  |  |  | 			symbol_put(FUNCTION); \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							|  |  |  | 		printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	__r; \ | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define dvb_attach(FUNCTION, ARGS...) ({ \
 | 
					
						
							|  |  |  | 	FUNCTION(ARGS); \ | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif /* #ifndef _DVBDEV_H_ */
 |