diff options
Diffstat (limited to 'drivers/media/dvb/bt8xx')
| -rw-r--r-- | drivers/media/dvb/bt8xx/Kconfig | 22 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/Makefile | 6 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/bt878.c | 609 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/bt878.h | 159 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dst.c | 1873 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dst_ca.c | 727 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dst_ca.h | 58 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dst_common.h | 182 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dst_priv.h | 35 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dvb-bt8xx.c | 970 | ||||
| -rw-r--r-- | drivers/media/dvb/bt8xx/dvb-bt8xx.h | 63 |
11 files changed, 4704 insertions, 0 deletions
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig new file mode 100644 index 00000000000..8668e634c7e --- /dev/null +++ b/drivers/media/dvb/bt8xx/Kconfig | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | config DVB_BT8XX | ||
| 2 | tristate "BT8xx based PCI cards" | ||
| 3 | depends on DVB_CORE && PCI && I2C && VIDEO_BT848 | ||
| 4 | select DVB_MT352 if !DVB_FE_CUSTOMISE | ||
| 5 | select DVB_SP887X if !DVB_FE_CUSTOMISE | ||
| 6 | select DVB_NXT6000 if !DVB_FE_CUSTOMISE | ||
| 7 | select DVB_CX24110 if !DVB_FE_CUSTOMISE | ||
| 8 | select DVB_OR51211 if !DVB_FE_CUSTOMISE | ||
| 9 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE | ||
| 10 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | ||
| 11 | select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE | ||
| 12 | help | ||
| 13 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are | ||
| 14 | the Nebula cards, the Pinnacle PCTV cards, the Twinhan DST cards, | ||
| 15 | the pcHDTV HD2000 cards, the DViCO FusionHDTV Lite cards, and | ||
| 16 | some AVerMedia cards. | ||
| 17 | |||
| 18 | Since these cards have no MPEG decoder onboard, they transmit | ||
| 19 | only compressed MPEG data over the PCI bus, so you need | ||
| 20 | an external software decoder to watch TV on your computer. | ||
| 21 | |||
| 22 | Say Y if you own such a device and want to use it. | ||
diff --git a/drivers/media/dvb/bt8xx/Makefile b/drivers/media/dvb/bt8xx/Makefile new file mode 100644 index 00000000000..d98f1d49ffa --- /dev/null +++ b/drivers/media/dvb/bt8xx/Makefile | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o | ||
| 2 | |||
| 3 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | ||
| 4 | EXTRA_CFLAGS += -Idrivers/media/dvb/frontends | ||
| 5 | EXTRA_CFLAGS += -Idrivers/media/video/bt8xx | ||
| 6 | EXTRA_CFLAGS += -Idrivers/media/common/tuners | ||
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c new file mode 100644 index 00000000000..b34fa95185e --- /dev/null +++ b/drivers/media/dvb/bt8xx/bt878.c | |||
| @@ -0,0 +1,609 @@ | |||
| 1 | /* | ||
| 2 | * bt878.c: part of the driver for the Pinnacle PCTV Sat DVB PCI card | ||
| 3 | * | ||
| 4 | * Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> | ||
| 5 | * | ||
| 6 | * large parts based on the bttv driver | ||
| 7 | * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@metzlerbros.de) | ||
| 8 | * & Marcus Metzler (mocm@metzlerbros.de) | ||
| 9 | * (c) 1999,2000 Gerd Knorr <kraxel@goldbach.in-berlin.de> | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or | ||
| 12 | * modify it under the terms of the GNU General Public License | ||
| 13 | * as published by the Free Software Foundation; either version 2 | ||
| 14 | * of the License, or (at your option) any later version. | ||
| 15 | * | ||
| 16 | |||
| 17 | * This program is distributed in the hope that it will be useful, | ||
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | * GNU General Public License for more details. | ||
| 21 | * | ||
| 22 | |||
| 23 | * You should have received a copy of the GNU General Public License | ||
| 24 | * along with this program; if not, write to the Free Software | ||
| 25 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 26 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | |||
| 30 | #include <linux/module.h> | ||
| 31 | #include <linux/kernel.h> | ||
| 32 | #include <linux/pci.h> | ||
| 33 | #include <asm/io.h> | ||
| 34 | #include <linux/ioport.h> | ||
| 35 | #include <asm/pgtable.h> | ||
| 36 | #include <asm/page.h> | ||
| 37 | #include <linux/types.h> | ||
| 38 | #include <linux/interrupt.h> | ||
| 39 | #include <linux/kmod.h> | ||
| 40 | #include <linux/vmalloc.h> | ||
| 41 | #include <linux/init.h> | ||
| 42 | |||
| 43 | #include "dmxdev.h" | ||
| 44 | #include "dvbdev.h" | ||
| 45 | #include "bt878.h" | ||
| 46 | #include "dst_priv.h" | ||
| 47 | |||
| 48 | |||
| 49 | /**************************************/ | ||
| 50 | /* Miscellaneous utility definitions */ | ||
| 51 | /**************************************/ | ||
| 52 | |||
| 53 | static unsigned int bt878_verbose = 1; | ||
| 54 | static unsigned int bt878_debug; | ||
| 55 | |||
| 56 | module_param_named(verbose, bt878_verbose, int, 0444); | ||
| 57 | MODULE_PARM_DESC(verbose, | ||
| 58 | "verbose startup messages, default is 1 (yes)"); | ||
| 59 | module_param_named(debug, bt878_debug, int, 0644); | ||
| 60 | MODULE_PARM_DESC(debug, "Turn on/off debugging, default is 0 (off)."); | ||
| 61 | |||
| 62 | int bt878_num; | ||
| 63 | struct bt878 bt878[BT878_MAX]; | ||
| 64 | |||
| 65 | EXPORT_SYMBOL(bt878_num); | ||
| 66 | EXPORT_SYMBOL(bt878); | ||
| 67 | |||
| 68 | #define btwrite(dat,adr) bmtwrite((dat), (bt->bt878_mem+(adr))) | ||
| 69 | #define btread(adr) bmtread(bt->bt878_mem+(adr)) | ||
| 70 | |||
| 71 | #define btand(dat,adr) btwrite((dat) & btread(adr), adr) | ||
| 72 | #define btor(dat,adr) btwrite((dat) | btread(adr), adr) | ||
| 73 | #define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr) | ||
| 74 | |||
| 75 | #if defined(dprintk) | ||
| 76 | #undef dprintk | ||
| 77 | #endif | ||
| 78 | #define dprintk(fmt, arg...) \ | ||
| 79 | do { \ | ||
| 80 | if (bt878_debug) \ | ||
| 81 | printk(KERN_DEBUG fmt, ##arg); \ | ||
| 82 | } while (0) | ||
| 83 | |||
| 84 | static void bt878_mem_free(struct bt878 *bt) | ||
| 85 | { | ||
| 86 | if (bt->buf_cpu) { | ||
| 87 | pci_free_consistent(bt->dev, bt->buf_size, bt->buf_cpu, | ||
| 88 | bt->buf_dma); | ||
| 89 | bt->buf_cpu = NULL; | ||
| 90 | } | ||
| 91 | |||
| 92 | if (bt->risc_cpu) { | ||
| 93 | pci_free_consistent(bt->dev, bt->risc_size, bt->risc_cpu, | ||
| 94 | bt->risc_dma); | ||
| 95 | bt->risc_cpu = NULL; | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | static int bt878_mem_alloc(struct bt878 *bt) | ||
| 100 | { | ||
| 101 | if (!bt->buf_cpu) { | ||
| 102 | bt->buf_size = 128 * 1024; | ||
| 103 | |||
| 104 | bt->buf_cpu = | ||
| 105 | pci_alloc_consistent(bt->dev, bt->buf_size, | ||
| 106 | &bt->buf_dma); | ||
| 107 | |||
| 108 | if (!bt->buf_cpu) | ||
| 109 | return -ENOMEM; | ||
| 110 | |||
| 111 | memset(bt->buf_cpu, 0, bt->buf_size); | ||
| 112 | } | ||
| 113 | |||
| 114 | if (!bt->risc_cpu) { | ||
| 115 | bt->risc_size = PAGE_SIZE; | ||
| 116 | bt->risc_cpu = | ||
| 117 | pci_alloc_consistent(bt->dev, bt->risc_size, | ||
| 118 | &bt->risc_dma); | ||
| 119 | |||
| 120 | if (!bt->risc_cpu) { | ||
| 121 | bt878_mem_free(bt); | ||
| 122 | return -ENOMEM; | ||
| 123 | } | ||
| 124 | |||
| 125 | memset(bt->risc_cpu, 0, bt->risc_size); | ||
| 126 | } | ||
| 127 | |||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | |||
| 131 | /* RISC instructions */ | ||
| 132 | #define RISC_WRITE (0x01 << 28) | ||
| 133 | #define RISC_JUMP (0x07 << 28) | ||
| 134 | #define RISC_SYNC (0x08 << 28) | ||
| 135 | |||
| 136 | /* RISC bits */ | ||
| 137 | #define RISC_WR_SOL (1 << 27) | ||
| 138 | #define RISC_WR_EOL (1 << 26) | ||
| 139 | #define RISC_IRQ (1 << 24) | ||
| 140 | #define RISC_STATUS(status) ((((~status) & 0x0F) << 20) | ((status & 0x0F) << 16)) | ||
| 141 | #define RISC_SYNC_RESYNC (1 << 15) | ||
| 142 | #define RISC_SYNC_FM1 0x06 | ||
| 143 | #define RISC_SYNC_VRO 0x0C | ||
| 144 | |||
| 145 | #define RISC_FLUSH() bt->risc_pos = 0 | ||
| 146 | #define RISC_INSTR(instr) bt->risc_cpu[bt->risc_pos++] = cpu_to_le32(instr) | ||
| 147 | |||
| 148 | static int bt878_make_risc(struct bt878 *bt) | ||
| 149 | { | ||
| 150 | bt->block_bytes = bt->buf_size >> 4; | ||
| 151 | bt->block_count = 1 << 4; | ||
| 152 | bt->line_bytes = bt->block_bytes; | ||
| 153 | bt->line_count = bt->block_count; | ||
| 154 | |||
| 155 | while (bt->line_bytes > 4095) { | ||
| 156 | bt->line_bytes >>= 1; | ||
| 157 | bt->line_count <<= 1; | ||
| 158 | } | ||
| 159 | |||
| 160 | if (bt->line_count > 255) { | ||
| 161 | printk(KERN_ERR "bt878: buffer size error!\n"); | ||
| 162 | return -EINVAL; | ||
| 163 | } | ||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | |||
| 168 | static void bt878_risc_program(struct bt878 *bt, u32 op_sync_orin) | ||
| 169 | { | ||
