1 /*
2  * TerraTec Cinergy T2/qanu USB2 DVB-T adapter.
3  *
4  * Copyright (C) 2007 Tomi Orava (tomimo@ncircle.nullnet.fi)
5  *
6  * Based on the dvb-usb-framework code and the
7  * original Terratec Cinergy T2 driver by:
8  *
9  * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
10  *                  Holger Waechtler <holger@qanu.de>
11  *
12  *  Protocol Spec published on http://qanu.de/specs/terratec_cinergyT2.pdf
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License,  or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not,  write to the Free Software
26  * Foundation,  Inc.,  675 Mass Ave,  Cambridge,  MA 02139,  USA.
27  *
28  */
29 
30 #ifndef _DVB_USB_CINERGYT2_H_
31 #define _DVB_USB_CINERGYT2_H_
32 
33 #include <linux/usb/input.h>
34 
35 #define DVB_USB_LOG_PREFIX "cinergyT2"
36 #include "dvb-usb.h"
37 
38 #define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
39 
40 extern int dvb_usb_cinergyt2_debug;
41 
42 #define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
43 #define deb_xfer(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x002, args)
44 #define deb_pll(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x004, args)
45 #define deb_ts(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x008, args)
46 #define deb_err(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x010, args)
47 #define deb_rc(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x020, args)
48 #define deb_fw(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x040, args)
49 #define deb_mem(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x080, args)
50 #define deb_uxfer(args...) dprintk(dvb_usb_cinergyt2_debug,  0x100, args)
51 
52 
53 
54 enum cinergyt2_ep1_cmd {
55 	CINERGYT2_EP1_PID_TABLE_RESET		= 0x01,
56 	CINERGYT2_EP1_PID_SETUP			= 0x02,
57 	CINERGYT2_EP1_CONTROL_STREAM_TRANSFER	= 0x03,
58 	CINERGYT2_EP1_SET_TUNER_PARAMETERS	= 0x04,
59 	CINERGYT2_EP1_GET_TUNER_STATUS		= 0x05,
60 	CINERGYT2_EP1_START_SCAN		= 0x06,
61 	CINERGYT2_EP1_CONTINUE_SCAN		= 0x07,
62 	CINERGYT2_EP1_GET_RC_EVENTS		= 0x08,
63 	CINERGYT2_EP1_SLEEP_MODE		= 0x09,
64 	CINERGYT2_EP1_GET_FIRMWARE_VERSION	= 0x0A
65 };
66 
67 
68 struct dvbt_get_status_msg {
69 	uint32_t freq;
70 	uint8_t bandwidth;
71 	uint16_t tps;
72 	uint8_t flags;
73 	__le16 gain;
74 	uint8_t snr;
75 	__le32 viterbi_error_rate;
76 	uint32_t rs_error_rate;
77 	__le32 uncorrected_block_count;
78 	uint8_t lock_bits;
79 	uint8_t prev_lock_bits;
80 } __attribute__((packed));
81 
82 
83 struct dvbt_set_parameters_msg {
84 	uint8_t cmd;
85 	__le32 freq;
86 	uint8_t bandwidth;
87 	__le16 tps;
88 	uint8_t flags;
89 } __attribute__((packed));
90 
91 
92 extern struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d);
93 
94 #endif /* _DVB_USB_CINERGYT2_H_ */
95 
96