📄 cx88.h
字号:
/* * * v4l2 device driver for cx2388x based TV cards * * (c) 2003,04 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */#include <linux/pci.h>#include <linux/i2c.h>#include <linux/i2c-algo-bit.h>#include <linux/videodev2.h>#include <linux/kdev_t.h>#include <media/tuner.h>#include <media/tveeprom.h>#include <media/audiochip.h>#include <media/video-buf.h>#include <media/video-buf-dvb.h>#include "btcx-risc.h"#include "cx88-reg.h"#include <linux/version.h>#define CX88_VERSION_CODE KERNEL_VERSION(0,0,5)#ifndef TRUE# define TRUE (1==1)#endif#ifndef FALSE# define FALSE (1==0)#endif#define UNSET (-1U)#define CX88_MAXBOARDS 8/* Max number of inputs by card */#define MAX_CX88_INPUT 8/* ----------------------------------------------------------- *//* defines and enums */#define FORMAT_FLAGS_PACKED 0x01#define FORMAT_FLAGS_PLANAR 0x02#define VBI_LINE_COUNT 17#define VBI_LINE_LENGTH 2048/* need "shadow" registers for some write-only ones ... */#define SHADOW_AUD_VOL_CTL 1#define SHADOW_AUD_BAL_CTL 2#define SHADOW_MAX 2/* FM Radio deemphasis type */enum cx88_deemph_type { FM_NO_DEEMPH = 0, FM_DEEMPH_50, FM_DEEMPH_75};/* ----------------------------------------------------------- *//* tv norms */struct cx88_tvnorm { char *name; v4l2_std_id id; u32 cxiformat; u32 cxoformat;};static unsigned int inline norm_maxw(struct cx88_tvnorm *norm){ return (norm->id & V4L2_STD_625_50) ? 768 : 640;}static unsigned int inline norm_maxh(struct cx88_tvnorm *norm){ return (norm->id & V4L2_STD_625_50) ? 576 : 480;}/* ----------------------------------------------------------- *//* static data */struct cx8800_fmt { char *name; u32 fourcc; /* v4l2 format id */ int depth; int flags; u32 cxformat;};struct cx88_ctrl { struct v4l2_queryctrl v; u32 off; u32 reg; u32 sreg; u32 mask; u32 shift;};/* ----------------------------------------------------------- *//* SRAM memory management data (see cx88-core.c) */#define SRAM_CH21 0 /* video */#define SRAM_CH22 1#define SRAM_CH23 2#define SRAM_CH24 3 /* vbi */#define SRAM_CH25 4 /* audio */#define SRAM_CH26 5#define SRAM_CH28 6 /* mpeg *//* more */struct sram_channel { char *name; u32 cmds_start; u32 ctrl_start; u32 cdt; u32 fifo_start; u32 fifo_size; u32 ptr1_reg; u32 ptr2_reg; u32 cnt1_reg; u32 cnt2_reg;};extern struct sram_channel cx88_sram_channels[];/* ----------------------------------------------------------- *//* card configuration */#define CX88_BOARD_NOAUTO UNSET#define CX88_BOARD_UNKNOWN 0#define CX88_BOARD_HAUPPAUGE 1#define CX88_BOARD_GDI 2#define CX88_BOARD_PIXELVIEW 3#define CX88_BOARD_ATI_WONDER_PRO 4#define CX88_BOARD_WINFAST2000XP_EXPERT 5#define CX88_BOARD_AVERTV_STUDIO_303 6#define CX88_BOARD_MSI_TVANYWHERE_MASTER 7#define CX88_BOARD_WINFAST_DV2000 8#define CX88_BOARD_LEADTEK_PVR2000 9#define CX88_BOARD_IODATA_GVVCP3PCI 10#define CX88_BOARD_PROLINK_PLAYTVPVR 11#define CX88_BOARD_ASUS_PVR_416 12#define CX88_BOARD_MSI_TVANYWHERE 13#define CX88_BOARD_KWORLD_DVB_T 14#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 15#define CX88_BOARD_KWORLD_LTV883 16#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q 17#define CX88_BOARD_HAUPPAUGE_DVB_T1 18#define CX88_BOARD_CONEXANT_DVB_T1 19#define CX88_BOARD_PROVIDEO_PV259 20#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21#define CX88_BOARD_PCHDTV_HD3000 22#define CX88_BOARD_DNTV_LIVE_DVB_T 23#define CX88_BOARD_HAUPPAUGE_ROSLYN 24#define CX88_BOARD_DIGITALLOGIC_MEC 25#define CX88_BOARD_IODATA_GVBCTV7E 26#define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28#define CX88_BOARD_ADSTECH_DVB_T_PCI 29#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30#define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31#define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32#define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33#define CX88_BOARD_ATI_HDTVWONDER 34#define CX88_BOARD_WINFAST_DTV1000 35#define CX88_BOARD_AVERTV_303 36enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, CX88_VMUX_COMPOSITE2, CX88_VMUX_COMPOSITE3, CX88_VMUX_COMPOSITE4, CX88_VMUX_SVIDEO, CX88_VMUX_TELEVISION, CX88_VMUX_CABLE, CX88_VMUX_DVB, CX88_VMUX_DEBUG, CX88_RADIO,};struct cx88_input { enum cx88_itype type; unsigned int vmux; u32 gpio0, gpio1, gpio2, gpio3;};struct cx88_board { char *name; unsigned int tuner_type; unsigned int radio_type; unsigned char tuner_addr; unsigned char radio_addr; int tda9887_conf; struct cx88_input input[MAX_CX88_INPUT]; struct cx88_input radio; unsigned int blackbird:1; unsigned int dvb:1;};struct cx88_subid { u16 subvendor; u16 subdevice; u32 card;};#define INPUT(nr) (&cx88_boards[core->board].input[nr])/* ----------------------------------------------------------- *//* device / file handle status */#define RESOURCE_OVERLAY 1#define RESOURCE_VIDEO 2#define RESOURCE_VBI 4#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds *//* buffer for one video frame */struct cx88_buffer { /* common v4l buffer stuff -- must be first */ struct videobuf_buffer vb; /* cx88 specific */ unsigned int bpl; struct btcx_riscmem risc; struct cx8800_fmt *fmt; u32 count;};struct cx88_dmaqueue { struct list_head active; struct list_head queued; struct timer_list timeout; struct btcx_riscmem stopper; u32 count;};struct cx88_core { struct list_head devlist; atomic_t refcount; /* board name */ int nr; char name[32]; /* pci stuff */ int pci_bus; int pci_slot; u32 __iomem *lmmio; u8 __iomem *bmmio; u32 shadow[SHADOW_MAX]; int pci_irqmask; /* i2c i/o */ struct i2c_adapter i2c_adap; struct i2c_algo_bit_data i2c_algo; struct i2c_client i2c_client; u32 i2c_state, i2c_rc; /* config info -- analog */ unsigned int board; unsigned int tuner_type; unsigned int radio_type; unsigned char tuner_addr; unsigned char radio_addr; unsigned int tda9887_conf; unsigned int has_radio; /* config info -- dvb */ struct dvb_pll_desc *pll_desc; unsigned int pll_addr; /* state info */ struct task_struct *kthread; struct cx88_tvnorm *tvnorm; u32 tvaudio; u32 audiomode_manual; u32 audiomode_current; u32 input; u32 astat; u32 use_nicam; /* IR remote control state */ struct cx88_IR *ir;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -