Commit 6455aafe authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] DVB: Revamp of the TTUSB-DEC driver

 - Alter hotplug firmware naming to fit in with dvb standard.
 - Use the hotplug firmware loader for 2.6 kernels instead of compiling
   the firmware into the module. 
 - Integrate frontend into ttusb_dec module and remove pseudo-i2c bits,
   move ttusb_dec header into source file.
 - Rudimentary section filter support (enough for scan).
parent 6569e964
...@@ -9,6 +9,7 @@ Supported: ...@@ -9,6 +9,7 @@ Supported:
Linux Kernels 2.4 and 2.6 Linux Kernels 2.4 and 2.6
Video Streaming Video Streaming
Audio Streaming Audio Streaming
Section Filters
Channel Zapping Channel Zapping
Hotplug firmware loader under 2.6 kernels Hotplug firmware loader under 2.6 kernels
...@@ -16,14 +17,10 @@ In Progress: ...@@ -16,14 +17,10 @@ In Progress:
DEC3000-s DEC3000-s
To Do: To Do:
Section data
Teletext streams
Tuner status information Tuner status information
DVB network interface DVB network interface
Streaming video PC->DEC Streaming video PC->DEC
Note: Since section data can not be retreived yet, scan apps will not work.
Getting the Firmware Getting the Firmware
-------------------- --------------------
Currently, the driver only works with v2.15a of the firmware. The firmwares Currently, the driver only works with v2.15a of the firmware. The firmwares
...@@ -46,7 +43,7 @@ mv STB_PC_S.bin /etc/dvb/dec3000s.bin ...@@ -46,7 +43,7 @@ mv STB_PC_S.bin /etc/dvb/dec3000s.bin
Hotplug Firmware Loading for 2.6 kernels Hotplug Firmware Loading for 2.6 kernels
---------------------------------------- ----------------------------------------
For 2.6 kernels the firmware is loaded at the point that the driver module is For 2.6 kernels the firmware is loaded at the point that the driver module is
loaded. See linux/Documentation/dvb/FIRMWARE for more information. loaded. See linux/Documentation/dvb/firmware.txt for more information.
mv STB_PC_T.bin /usr/lib/hotplug/firmware/dec2000t.bin mv STB_PC_T.bin /usr/lib/hotplug/firmware/dvb-ttusb-dec-2000t-2.15a.fw
mv STB_PC_S.bin /usr/lib/hotplug/firmware/dec3000s.bin mv STB_PC_S.bin /usr/lib/hotplug/firmware/dvb-ttusb-dec-3000s-2.15a.fw
...@@ -13,15 +13,6 @@ config DVB_TTUSB_DEC ...@@ -13,15 +13,6 @@ config DVB_TTUSB_DEC
The DEC devices require firmware in order to boot into a mode in The DEC devices require firmware in order to boot into a mode in
which they are slaves to the PC. See which they are slaves to the PC. See
linux/Documentation/dvb/FIRMWARE for details. linux/Documentation/dvb/ttusb-dec.txt for details.
The firmware can be obtained and put into the default
locations 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 /usr/lib/hotplug/firmware/dec2000t.bin
unzip -j dec215a.exe Software/Oem/STB/App/Boot/STB_PC_S.bin
mv STB_PC_S.bin /usr/lib/hotplug/firmware/dec3000s.bin
Say Y if you own such a device and want to use it. Say Y if you own such a device and want to use it.
/*
* 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, void **data)
{
dprintk("%s\n", __FUNCTION__);
return dvb_register_frontend(dec2000_frontend_ioctl, i2c, NULL,
&dec2000_frontend_info);
}
static void dec2000_frontend_detach(struct dvb_i2c_bus *i2c, void *data)
{
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 <linux/interrupt.h>
#include <linux/list.h>
#include <linux/spinlock.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;
u8 v_pes[16 + MAX_AV_PES_LENGTH];
int v_pes_length;
int v_pes_postbytes;
struct list_head urb_frame_list;
struct tasklet_struct urb_tasklet;
spinlock_t urb_frame_list_lock;
};
struct urb_frame {
u8 data[ISO_FRAME_SIZE];
int length;
struct list_head urb_frame_list;
};
#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