📄 cx18-driver.h
字号:
/* * cx18 driver internal defines and structures * * Derived from ivtv-driver.h * * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 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 CX18_DRIVER_H#define CX18_DRIVER_H#include <linux/version.h>#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/sched.h>#include <linux/fs.h>#include <linux/pci.h>#include <linux/interrupt.h>#include <linux/spinlock.h>#include <linux/i2c.h>#include <linux/i2c-algo-bit.h>#include <linux/list.h>#include <linux/unistd.h>#include <linux/pagemap.h>#include <linux/workqueue.h>#include <linux/mutex.h>#include <asm/byteorder.h>#include <linux/dvb/video.h>#include <linux/dvb/audio.h>#include <media/v4l2-common.h>#include <media/v4l2-ioctl.h>#include <media/tuner.h>#include "cx18-mailbox.h"#include "cx18-av-core.h"#include "cx23418.h"/* DVB */#include "demux.h"#include "dmxdev.h"#include "dvb_demux.h"#include "dvb_frontend.h"#include "dvb_net.h"#include "dvbdev.h"#ifndef CONFIG_PCI# error "This driver requires kernel PCI support."#endif/* Default delay to throttle mmio access to the CX23418 */#define CX18_DEFAULT_MMIO_NDELAY 0 /* 0 ns = 0 PCI clock(s) / 33 MHz */#define CX18_MEM_OFFSET 0x00000000#define CX18_MEM_SIZE 0x04000000#define CX18_REG_OFFSET 0x02000000/* Maximum cx18 driver instances. */#define CX18_MAX_CARDS 32/* Supported cards */#define CX18_CARD_HVR_1600_ESMT 0 /* Hauppauge HVR 1600 (ESMT memory) */#define CX18_CARD_HVR_1600_SAMSUNG 1 /* Hauppauge HVR 1600 (Samsung memory) */#define CX18_CARD_COMPRO_H900 2 /* Compro VideoMate H900 */#define CX18_CARD_YUAN_MPC718 3 /* Yuan MPC718 */#define CX18_CARD_CNXT_RAPTOR_PAL 4 /* Conexant Raptor PAL */#define CX18_CARD_TOSHIBA_QOSMIO_DVBT 5 /* Toshiba Qosmio Interal DVB-T/Analog*/#define CX18_CARD_LEADTEK_PVR2100 6 /* Leadtek WinFast PVR2100 */#define CX18_CARD_LAST 6#define CX18_ENC_STREAM_TYPE_MPG 0#define CX18_ENC_STREAM_TYPE_TS 1#define CX18_ENC_STREAM_TYPE_YUV 2#define CX18_ENC_STREAM_TYPE_VBI 3#define CX18_ENC_STREAM_TYPE_PCM 4#define CX18_ENC_STREAM_TYPE_IDX 5#define CX18_ENC_STREAM_TYPE_RAD 6#define CX18_MAX_STREAMS 7/* system vendor and device IDs */#define PCI_VENDOR_ID_CX 0x14f1#define PCI_DEVICE_ID_CX23418 0x5b7a/* subsystem vendor ID */#define CX18_PCI_ID_HAUPPAUGE 0x0070#define CX18_PCI_ID_COMPRO 0x185b#define CX18_PCI_ID_YUAN 0x12ab#define CX18_PCI_ID_CONEXANT 0x14f1#define CX18_PCI_ID_TOSHIBA 0x1179#define CX18_PCI_ID_LEADTEK 0x107D/* ======================================================================== *//* ========================== START USER SETTABLE DMA VARIABLES =========== *//* ======================================================================== *//* DMA Buffers, Default size in MB allocated */#define CX18_DEFAULT_ENC_TS_BUFFERS 1#define CX18_DEFAULT_ENC_MPG_BUFFERS 2#define CX18_DEFAULT_ENC_IDX_BUFFERS 1#define CX18_DEFAULT_ENC_YUV_BUFFERS 2#define CX18_DEFAULT_ENC_VBI_BUFFERS 1#define CX18_DEFAULT_ENC_PCM_BUFFERS 1/* i2c stuff */#define I2C_CLIENTS_MAX 16/* debugging *//* Flag to turn on high volume debugging */#define CX18_DBGFLG_WARN (1 << 0)#define CX18_DBGFLG_INFO (1 << 1)#define CX18_DBGFLG_API (1 << 2)#define CX18_DBGFLG_DMA (1 << 3)#define CX18_DBGFLG_IOCTL (1 << 4)#define CX18_DBGFLG_FILE (1 << 5)#define CX18_DBGFLG_I2C (1 << 6)#define CX18_DBGFLG_IRQ (1 << 7)/* Flag to turn on high volume debugging */#define CX18_DBGFLG_HIGHVOL (1 << 8)/* NOTE: extra space before comma in 'cx->num , ## args' is required for gcc-2.95, otherwise it won't compile. */#define CX18_DEBUG(x, type, fmt, args...) \ do { \ if ((x) & cx18_debug) \ printk(KERN_INFO "cx18-%d " type ": " fmt, cx->num , ## args); \ } while (0)#define CX18_DEBUG_WARN(fmt, args...) CX18_DEBUG(CX18_DBGFLG_WARN, "warning", fmt , ## args)#define CX18_DEBUG_INFO(fmt, args...) CX18_DEBUG(CX18_DBGFLG_INFO, "info", fmt , ## args)#define CX18_DEBUG_API(fmt, args...) CX18_DEBUG(CX18_DBGFLG_API, "api", fmt , ## args)#define CX18_DEBUG_DMA(fmt, args...) CX18_DEBUG(CX18_DBGFLG_DMA, "dma", fmt , ## args)#define CX18_DEBUG_IOCTL(fmt, args...) CX18_DEBUG(CX18_DBGFLG_IOCTL, "ioctl", fmt , ## args)#define CX18_DEBUG_FILE(fmt, args...) CX18_DEBUG(CX18_DBGFLG_FILE, "file", fmt , ## args)#define CX18_DEBUG_I2C(fmt, args...) CX18_DEBUG(CX18_DBGFLG_I2C, "i2c", fmt , ## args)#define CX18_DEBUG_IRQ(fmt, args...) CX18_DEBUG(CX18_DBGFLG_IRQ, "irq", fmt , ## args)#define CX18_DEBUG_HIGH_VOL(x, type, fmt, args...) \ do { \ if (((x) & cx18_debug) && (cx18_debug & CX18_DBGFLG_HIGHVOL)) \ printk(KERN_INFO "cx18%d " type ": " fmt, cx->num , ## args); \ } while (0)#define CX18_DEBUG_HI_WARN(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_WARN, "warning", fmt , ## args)#define CX18_DEBUG_HI_INFO(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_INFO, "info", fmt , ## args)#define CX18_DEBUG_HI_API(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_API, "api", fmt , ## args)#define CX18_DEBUG_HI_DMA(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_DMA, "dma", fmt , ## args)#define CX18_DEBUG_HI_IOCTL(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_IOCTL, "ioctl", fmt , ## args)#define CX18_DEBUG_HI_FILE(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_FILE, "file", fmt , ## args)#define CX18_DEBUG_HI_I2C(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_I2C, "i2c", fmt , ## args)#define CX18_DEBUG_HI_IRQ(fmt, args...) CX18_DEBUG_HIGH_VOL(CX18_DBGFLG_IRQ, "irq", fmt , ## args)/* Standard kernel messages */#define CX18_ERR(fmt, args...) printk(KERN_ERR "cx18-%d: " fmt, cx->num , ## args)#define CX18_WARN(fmt, args...) printk(KERN_WARNING "cx18-%d: " fmt, cx->num , ## args)#define CX18_INFO(fmt, args...) printk(KERN_INFO "cx18-%d: " fmt, cx->num , ## args)/* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */#define MPEG_FRAME_TYPE_IFRAME 1#define MPEG_FRAME_TYPE_IFRAME_PFRAME 3#define MPEG_FRAME_TYPE_ALL 7#define CX18_MAX_PGM_INDEX (400)extern int cx18_retry_mmio; /* enable check & retry of mmio accesses */extern int cx18_debug;struct cx18_options { int megabytes[CX18_MAX_STREAMS]; /* Size in megabytes of each stream */ int cardtype; /* force card type on load */ int tuner; /* set tuner on load */ int radio; /* enable/disable radio */ unsigned long mmio_ndelay; /* delay in ns after every PCI mmio access */};/* per-buffer bit flags */#define CX18_F_B_NEED_BUF_SWAP 0 /* this buffer should be byte swapped *//* per-stream, s_flags */#define CX18_F_S_CLAIMED 3 /* this stream is claimed */#define CX18_F_S_STREAMING 4 /* the fw is decoding/encoding this stream */#define CX18_F_S_INTERNAL_USE 5 /* this stream is used internally (sliced VBI processing) */#define CX18_F_S_STREAMOFF 7 /* signal end of stream EOS */#define CX18_F_S_APPL_IO 8 /* this stream is used read/written by an application *//* per-cx18, i_flags */#define CX18_F_I_LOADED_FW 0 /* Loaded the firmware the first time */#define CX18_F_I_EOS 4 /* End of encoder stream reached */#define CX18_F_I_RADIO_USER 5 /* The radio tuner is selected */#define CX18_F_I_ENC_PAUSED 13 /* the encoder is paused */#define CX18_F_I_INITED 21 /* set after first open */#define CX18_F_I_FAILED 22 /* set if first open failed *//* These are the VBI types as they appear in the embedded VBI private packets. */#define CX18_SLICED_TYPE_TELETEXT_B (1)#define CX18_SLICED_TYPE_CAPTION_525 (4)#define CX18_SLICED_TYPE_WSS_625 (5)#define CX18_SLICED_TYPE_VPS (7)struct cx18_buffer { struct list_head list; dma_addr_t dma_handle; u32 id; unsigned long b_flags; char *buf; u32 bytesused; u32 readpos;};struct cx18_queue { struct list_head list; atomic_t buffers; u32 bytesused;};struct cx18_dvb { struct dmx_frontend hw_frontend; struct dmx_frontend mem_frontend; struct dmxdev dmxdev; struct dvb_adapter dvb_adapter; struct dvb_demux demux; struct dvb_frontend *fe; struct dvb_net dvbnet; int enabled; int feeding;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -