File:  [DVB] / DVB / driver / dvbdev.h
Revision 1.12: download - view: text, annotated - select for diffs
Wed Aug 20 16:21:30 2003 UTC (20 years, 9 months ago) by hunold
Branches: MAIN
CVS tags: branch_f_092003, branch_20040513, branch_20031217, LINUXTV-DVB-1_0_1, HEAD
- Introduce the variable "readers" to "struct dvbdev". Some devices
might be opened read-only or read-write (even multiple times) and therefore
we need to keep track of the open count for "readers" and "writers"
separately.
- Follow this change in the generic_open() and close() functions for dvbdev
- Make the av7110 video device aware of RD_ONLY opens. If the device is
opened RD_ONLY, only poll() for events and the GET_...() IOCTLs can be called.

/* 
 * dvbdev.h
 *
 * Copyright (C) 2000 Ralph  Metzler <ralph@convergence.de>
 *                  & Marcus Metzler <marcus@convergence.de>
                      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/version.h>
#include <linux/poll.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/list.h>

#define DVB_MAJOR 250

#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


struct dvb_adapter {
	int num;
	devfs_handle_t devfs_handle;
	struct list_head list_head;
	struct list_head device_list;
	const char *name;
	u8 proposed_mac[6];
};


struct dvb_device {
	struct list_head list_head;
	struct file_operations *fops;
	devfs_handle_t devfs_handle;
	struct dvb_adapter *adapter;
	int type;
	u32 id;

	/* in theory, 'users' can vanish now,
	   but I don't want to change too much now... */
	int readers;
	int writers;
	int users;

        /* don't really need those !? -- FIXME: use video_usercopy  */
        int (*kernel_ioctl)(struct inode *inode, struct file *file,
			    unsigned int cmd, void *arg);

	void *priv;
};


extern int dvb_register_adapter (struct dvb_adapter **padap, const char *name);
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);

#endif /* #ifndef _DVBDEV_H_ */


LinuxTV legacy CVS <linuxtv.org/cvs>