diff options
author | Alex Woods <devnull@localhost> | 2003-12-02 23:46:14 +0000 |
---|---|---|
committer | Alex Woods <devnull@localhost> | 2003-12-02 23:46:14 +0000 |
commit | 5560d1ca660a40bad6d76ec6270d09d11944b733 (patch) | |
tree | 36386d80aac7ea362926b981eedd8984bf23d585 /linux | |
parent | d470469de4b9b0ae7d1815306a6713aa69b6244f (diff) | |
download | mediapointer-dvb-s2-5560d1ca660a40bad6d76ec6270d09d11944b733.tar.gz mediapointer-dvb-s2-5560d1ca660a40bad6d76ec6270d09d11944b733.tar.bz2 |
Integrate frontend into ttusb_dec module and remove pseudo-i2c bits.
Move ttusb_dec header into source file.
Build just a ttusb_dec.o module.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/dec2000_frontend.c | 178 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 240 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/ttusb_dec.h | 99 |
3 files changed, 202 insertions, 315 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/dec2000_frontend.c b/linux/drivers/media/dvb/ttusb-dec/dec2000_frontend.c deleted file mode 100644 index b1bce427b..000000000 --- a/linux/drivers/media/dvb/ttusb-dec/dec2000_frontend.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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"); - diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 4f9626b39..57fbc2d1f 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -19,20 +19,105 @@ * */ -#include <linux/version.h> +#include <asm/semaphore.h> +#include <linux/interrupt.h> +#include <linux/list.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/slab.h> +#include <linux/spinlock.h> #include <linux/usb.h> +#include <linux/version.h> -#include "ttusb_dec.h" +#include "dmxdev.h" +#include "dvb_demux.h" +#include "dvb_i2c.h" +#include "dvb_filter.h" #include "dvb_frontend.h" +#include "dvb_net.h" #include "dvb_usb_compat.h" static int debug = 0; #define dprintk if (debug) printk +#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; +}; + +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 ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, int param_length, const u8 params[], int *result_length, u8 cmd_result[]) @@ -132,22 +217,6 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec) ttusb_dec_av_pes2ts_cb, dec->demux.feed); } -static int ttusb_dec_i2c_master_xfer(struct dvb_i2c_bus *i2c, - const struct i2c_msg msgs[], int num) -{ - int result, i; - - dprintk("%s\n", __FUNCTION__); - - for (i = 0; i < num; i++) - if ((result = ttusb_dec_send_command(i2c->data, msgs[i].addr, - msgs[i].len, msgs[i].buf, - NULL, NULL))) - return result; - - return 0; -} - static void ttusb_dec_process_av_pes(struct ttusb_dec *dec, u8 *av_pes, int length) { @@ -793,15 +862,6 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) return result; } - if (!(dec->i2c_bus = dvb_register_i2c_bus(ttusb_dec_i2c_master_xfer, - dec, dec->adapter, 0))) { - printk("%s: dvb_register_i2c_bus failed\n", __FUNCTION__); - - dvb_unregister_adapter(dec->adapter); - - return -ENOMEM; - } - dec->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; dec->demux.priv = (void *)dec; @@ -815,8 +875,6 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, result); - dvb_unregister_i2c_bus(ttusb_dec_i2c_master_xfer, dec->adapter, - 0); dvb_unregister_adapter(dec->adapter); return result; @@ -831,8 +889,6 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) __FUNCTION__, result); dvb_dmx_release(&dec->demux); - dvb_unregister_i2c_bus(ttusb_dec_i2c_master_xfer, dec->adapter, - 0); dvb_unregister_adapter(dec->adapter); return result; @@ -847,8 +903,6 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) dvb_dmxdev_release(&dec->dmxdev); dvb_dmx_release(&dec->demux); - dvb_unregister_i2c_bus(ttusb_dec_i2c_master_xfer, dec->adapter, - 0); dvb_unregister_adapter(dec->adapter); return result; @@ -862,8 +916,6 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) dec->demux.dmx.remove_frontend(&dec->demux.dmx, &dec->frontend); dvb_dmxdev_release(&dec->dmxdev); dvb_dmx_release(&dec->demux); - dvb_unregister_i2c_bus(ttusb_dec_i2c_master_xfer, dec->adapter, - 0); dvb_unregister_adapter(dec->adapter); return result; @@ -883,7 +935,6 @@ static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) dec->demux.dmx.remove_frontend(&dec->demux.dmx, &dec->frontend); dvb_dmxdev_release(&dec->dmxdev); dvb_dmx_release(&dec->demux); - dvb_unregister_i2c_bus(ttusb_dec_i2c_master_xfer, dec->adapter, 0); dvb_unregister_adapter(dec->adapter); } @@ -915,6 +966,116 @@ static void ttusb_dec_exit_tasklet(struct ttusb_dec *dec) } } +static int dec2000_frontend_ioctl(struct dvb_frontend *fe, unsigned int cmd, + void *arg) +{ + struct ttusb_dec *dec = fe->data; + + 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; + + 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)); + ttusb_dec_send_command(dec, 0x71, 20, b, NULL, NULL); + + 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 void ttusb_dec_init_frontend(struct ttusb_dec *dec) +{ + dec->i2c_bus.adapter = dec->adapter; + dvb_register_frontend(dec2000_frontend_ioctl, &dec->i2c_bus, + (void *)dec, &dec2000_frontend_info); +} + +static void ttusb_dec_exit_frontend(struct ttusb_dec *dec) +{ + dvb_unregister_frontend(dec2000_frontend_ioctl, &dec->i2c_bus); +} + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) static void *ttusb_dec_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id) @@ -938,6 +1099,7 @@ static void *ttusb_dec_probe(struct usb_device *udev, unsigned int ifnum, ttusb_dec_init_usb(dec); ttusb_dec_init_stb(dec); ttusb_dec_init_dvb(dec); + ttusb_dec_init_frontend(dec); ttusb_dec_init_v_pes(dec); ttusb_dec_init_tasklet(dec); @@ -966,6 +1128,7 @@ static int ttusb_dec_probe(struct usb_interface *intf, ttusb_dec_init_usb(dec); ttusb_dec_init_stb(dec); ttusb_dec_init_dvb(dec); + ttusb_dec_init_frontend(dec); ttusb_dec_init_v_pes(dec); ttusb_dec_init_tasklet(dec); @@ -992,6 +1155,7 @@ static void ttusb_dec_disconnect(struct usb_interface *intf) ttusb_dec_exit_tasklet(dec); ttusb_dec_exit_usb(dec); + ttusb_dec_exit_frontend(dec); ttusb_dec_exit_dvb(dec); kfree(dec); @@ -999,8 +1163,8 @@ static void ttusb_dec_disconnect(struct usb_interface *intf) static struct usb_device_id ttusb_dec_table[] = { {USB_DEVICE(0x0b48, 0x1006)}, /* Unconfirmed */ - {USB_DEVICE(0x0b48, 0x1007)}, /* Unconfirmed */ - {USB_DEVICE(0x0b48, 0x1008)}, /* DEC 2000 t */ + {USB_DEVICE(0x0b48, 0x1007)}, /* DEC3000-s */ + {USB_DEVICE(0x0b48, 0x1008)}, /* DEC2000-t */ {} }; diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.h b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.h deleted file mode 100644 index db1c13f5e..000000000 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 |