Commit f68bd787 authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] Add two drivers for USB based DVB-T adapters

 - add two new usb dvb drivers:
   o dvb-ttusb-budget.c for Technotrend/Hauppauge Nova-USB devices
     (Thanks to Holger Waechtler <holger@convergence.de> and elix Domke
     <tmbinc@gmx.net>)
   o dvb-ttusb-dec.c for Technotrend/Hauppauge USB DEC2000-T devices
     (Thanks to Alex Woods <linux-dvb@giblets.org>)
parent 9fd18c7e
config DVB_TTUSB_BUDGET
tristate "Technotrend/Hauppauge Nova-USB devices"
depends on DVB_CORE && USB
help
Support for external USB adapters designed by Technotrend and
produced by Hauppauge, shipped under the brand name 'Nova-USB'.
These devices don't have a MPEG decoder built in, so you need
an external software decoder to watch TV.
Say Y if you own such a device and want to use it.
obj-$(CONFIG_DVB_TTUSB_BUDGET) += dvb-ttusb-budget.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
This diff is collapsed.
This diff is collapsed.
config DVB_TTUSB_DEC
tristate "Technotrend/Hauppauge USB DEC2000-T devices"
depends on DVB_CORE && USB
help
Support for external USB adapters designed by Technotrend and
produced by Hauppauge, shipped under the brand name 'DEC2000-T'.
Even if these devices have a MPEG decoder built in, they transmit
only compressed MPEG data over the USB bus, so you need
an external software decoder to watch TV on your computer.
Say Y if you own such a device and want to use it.
config DVB_TTUSB_DEC_FIRMWARE_FILE
string "Full pathname of dec2000t.bin firmware file"
depends on DVB_TTUSB_DEC
default "/etc/dvb/dec2000t.bin"
help
The DEC2000-T requires a firmware in order to boot into a mode in
which it is a slave to the PC. The firmware file can obtained as
follows:
wget http://hauppauge.lightpath.net/de/dec215a.exe
unzip -j dec215a.exe Software/Oem/STB/App/Boot/STB_PC_T.bin
mv STB_PC_T.bin /etc/dvb/dec2000t.bin
obj-$(CONFIG_DVB_TTUSB_DEC) += ttusb_dec.o dec2000_frontend.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
host-progs := fdump
$(obj)/ttusb_dec.o: $(obj)/dsp_dec2000.h
$(obj)/dsp_dec2000.h: $(patsubst "%", %, $(CONFIG_DVB_TTUSB_DEC_FIRMWARE_FILE)) $(obj)/fdump
$(obj)/fdump $< dsp_dec2000 > $@
/*
* TTUSB DEC-2000-t Frontend
*
* Copyright (C) 2003 Alex Woods <linux-dvb@giblets.org>
*
* 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/init.h>
#include <linux/module.h>
#include "dvb_frontend.h"
#include "dvb_functions.h"
static int debug = 0;
#define dprintk if (debug) printk
static struct dvb_frontend_info dec2000_frontend_info = {
name: "TechnoTrend/Hauppauge DEC-2000-t Frontend",
type: FE_OFDM,
frequency_min: 51000000,
frequency_max: 858000000,
frequency_stepsize: 62500,
caps: FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
FE_CAN_HIERARCHY_AUTO,
};
static int dec2000_frontend_ioctl(struct dvb_frontend *fe, unsigned int cmd,
void *arg)
{
dprintk("%s\n", __FUNCTION__);
switch (cmd) {
case FE_GET_INFO:
dprintk("%s: FE_GET_INFO\n", __FUNCTION__);
memcpy(arg, &dec2000_frontend_info,
sizeof (struct dvb_frontend_info));
break;
case FE_READ_STATUS: {
fe_status_t *status = (fe_status_t *)arg;
dprintk("%s: FE_READ_STATUS\n", __FUNCTION__);
*status = FE_HAS_SIGNAL | FE_HAS_VITERBI |
FE_HAS_SYNC | FE_HAS_CARRIER | FE_HAS_LOCK;
break;
}
case FE_READ_BER: {
u32 *ber = (u32 *)arg;
dprintk("%s: FE_READ_BER\n", __FUNCTION__);
*ber = 0;
return -ENOSYS;
break;
}
case FE_READ_SIGNAL_STRENGTH: {
dprintk("%s: FE_READ_SIGNAL_STRENGTH\n", __FUNCTION__);
*(s32 *)arg = 0xFF;
return -ENOSYS;
break;
}
case FE_READ_SNR:
dprintk("%s: FE_READ_SNR\n", __FUNCTION__);
*(s32 *)arg = 0;
return -ENOSYS;
break;
case FE_READ_UNCORRECTED_BLOCKS:
dprintk("%s: FE_READ_UNCORRECTED_BLOCKS\n", __FUNCTION__);
*(u32 *)arg = 0;
return -ENOSYS;
break;
case FE_SET_FRONTEND:{
struct dvb_frontend_parameters *p =
(struct dvb_frontend_parameters *)arg;
u8 b[] = { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0xff, 0x00, 0x00, 0x00, 0xff };
u32 freq;
struct i2c_msg msg = { addr: 0x71, flags: 0, len:20 };
dprintk("%s: FE_SET_FRONTEND\n", __FUNCTION__);
dprintk(" frequency->%d\n", p->frequency);
dprintk(" symbol_rate->%d\n",
p->u.qam.symbol_rate);
dprintk(" inversion->%d\n", p->inversion);
freq = htonl(p->frequency / 1000);
memcpy(&b[4], &freq, sizeof (int));
msg.buf = b;
fe->i2c->xfer(fe->i2c, &msg, 1);
break;
}
case FE_GET_FRONTEND:
dprintk("%s: FE_GET_FRONTEND\n", __FUNCTION__);
break;
case FE_SLEEP:
dprintk("%s: FE_SLEEP\n", __FUNCTION__);
return -ENOSYS;
break;
case FE_INIT:
dprintk("%s: FE_INIT\n", __FUNCTION__);
break;
case FE_RESET:
dprintk("%s: FE_RESET\n", __FUNCTION__);
break;
default:
dprintk("%s: unknown IOCTL (0x%X)\n", __FUNCTION__, cmd);
return -EINVAL;
}
return 0;
}
static int dec2000_frontend_attach(struct dvb_i2c_bus *i2c)
{
dprintk("%s\n", __FUNCTION__);
dvb_register_frontend(dec2000_frontend_ioctl, i2c, NULL,
&dec2000_frontend_info);
return 0;
}
static void dec2000_frontend_detach(struct dvb_i2c_bus *i2c)
{
dprintk("%s\n", __FUNCTION__);
dvb_unregister_frontend(dec2000_frontend_ioctl, i2c);
}
static int __init dec2000_frontend_init(void)
{
return dvb_register_i2c_device(THIS_MODULE, dec2000_frontend_attach,
dec2000_frontend_detach);
}
static void __exit dec2000_frontend_exit(void)
{
dvb_unregister_i2c_device(dec2000_frontend_attach);
}
module_init(dec2000_frontend_init);
module_exit(dec2000_frontend_exit);
MODULE_DESCRIPTION("TechnoTrend/Hauppauge DEC-2000-t Frontend");
MODULE_AUTHOR("Alex Woods <linux-dvb@giblets.org");
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug level");
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main (int argc, char **argv)
{
unsigned char buf[8];
unsigned int i, count, bytes = 0;
int fd;
if (argc != 3) {
fprintf (stderr, "\n\tusage: %s <ucode.bin> <array_name>\n\n",
argv[0]);
return -1;
}
fd = open (argv[1], O_RDONLY);
printf ("\n#include <asm/types.h>\n\nu8 %s [] __initdata = {",
argv[2]);
while ((count = read (fd, buf, 8)) > 0) {
printf ("\n\t");
for (i=0;i<count;i++, bytes++)
printf ("0x%02x, ", buf[i]);
}
printf ("\n};\n\n");
close (fd);
return 0;
}
This diff is collapsed.
/*
* TTUSB DEC Driver
*
* Copyright (C) 2003 Alex Woods <linux-dvb@giblets.org>
*
* 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.
*
*/
#ifndef _TTUSB_DEC_H
#define _TTUSB_DEC_H
#include "asm/semaphore.h"
#include "dmxdev.h"
#include "dvb_demux.h"
#include "dvb_filter.h"
#include "dvb_i2c.h"
#include "dvb_net.h"
#define DRIVER_NAME "TechnoTrend/Hauppauge DEC USB"
#define COMMAND_PIPE 0x03
#define RESULT_PIPE 0x84
#define STREAM_PIPE 0x88
#define COMMAND_PACKET_SIZE 0x3c
#define ARM_PACKET_SIZE 0x1000
#define ISO_BUF_COUNT 0x04
#define FRAMES_PER_ISO_BUF 0x04
#define ISO_FRAME_SIZE 0x0380
#define MAX_AV_PES_LENGTH 6144
struct ttusb_dec {
/* DVB bits */
struct dvb_adapter *adapter;
struct dmxdev dmxdev;
struct dvb_demux demux;
struct dmx_frontend frontend;
struct dvb_i2c_bus *i2c_bus;
struct dvb_net dvb_net;
u16 pid[DMX_PES_OTHER];
/* USB bits */
struct usb_device *udev;
u8 trans_count;
unsigned int command_pipe;
unsigned int result_pipe;
unsigned int stream_pipe;
int interface;
struct semaphore usb_sem;
void *iso_buffer;
dma_addr_t iso_dma_handle;
struct urb *iso_urb[ISO_BUF_COUNT];
int iso_stream_count;
struct semaphore iso_sem;
u8 av_pes[MAX_AV_PES_LENGTH + 4];
int av_pes_state;
int av_pes_length;
int av_pes_payload_length;
struct dvb_filter_pes2ts a_pes2ts;
struct dvb_filter_pes2ts v_pes2ts;
struct semaphore pes2ts_sem;
u8 v_pes[16 + MAX_AV_PES_LENGTH];
int v_pes_length;
int v_pes_postbytes;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment