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  */
25 
26 #ifndef _DVB_USB_CINERGYT2_H_
27 #define _DVB_USB_CINERGYT2_H_
28 
29 #include <linux/usb/input.h>
30 
31 #define DVB_USB_LOG_PREFIX "cinergyT2"
32 #include "dvb-usb.h"
33 
34 #define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
35 
36 extern int dvb_usb_cinergyt2_debug;
37 
38 #define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
39 #define deb_xfer(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x002, args)
40 #define deb_pll(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x004, args)
41 #define deb_ts(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x008, args)
42 #define deb_err(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x010, args)
43 #define deb_rc(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x020, args)
44 #define deb_fw(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x040, args)
45 #define deb_mem(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x080, args)
46 #define deb_uxfer(args...) dprintk(dvb_usb_cinergyt2_debug,  0x100, args)
47 
48 
49 
50 enum cinergyt2_ep1_cmd {
51 	CINERGYT2_EP1_PID_TABLE_RESET		= 0x01,
52 	CINERGYT2_EP1_PID_SETUP			= 0x02,
53 	CINERGYT2_EP1_CONTROL_STREAM_TRANSFER	= 0x03,
54 	CINERGYT2_EP1_SET_TUNER_PARAMETERS	= 0x04,
55 	CINERGYT2_EP1_GET_TUNER_STATUS		= 0x05,
56 	CINERGYT2_EP1_START_SCAN		= 0x06,
57 	CINERGYT2_EP1_CONTINUE_SCAN		= 0x07,
58 	CINERGYT2_EP1_GET_RC_EVENTS		= 0x08,
59 	CINERGYT2_EP1_SLEEP_MODE		= 0x09,
60 	CINERGYT2_EP1_GET_FIRMWARE_VERSION	= 0x0A
61 };
62 
63 
64 struct dvbt_get_status_msg {
65 	uint32_t freq;
66 	uint8_t bandwidth;
67 	uint16_t tps;
68 	uint8_t flags;
69 	__le16 gain;
70 	uint8_t snr;
71 	__le32 viterbi_error_rate;
72 	uint32_t rs_error_rate;
73 	__le32 uncorrected_block_count;
74 	uint8_t lock_bits;
75 	uint8_t prev_lock_bits;
76 } __attribute__((packed));
77 
78 
79 struct dvbt_set_parameters_msg {
80 	uint8_t cmd;
81 	__le32 freq;
82 	uint8_t bandwidth;
83 	__le16 tps;
84 	uint8_t flags;
85 } __attribute__((packed));
86 
87 
88 extern struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d);
89 
90 #endif /* _DVB_USB_CINERGYT2_H_ */
91 
92