xref: /linux/drivers/media/usb/dvb-usb/cinergyT2.h (revision 0d3b051adbb72ed81956447d0d1e54d5943ee6f5)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * TerraTec Cinergy T2/qanu USB2 DVB-T adapter.
4  *
5  * Copyright (C) 2007 Tomi Orava (tomimo@ncircle.nullnet.fi)
6  *
7  * Based on the dvb-usb-framework code and the
8  * original Terratec Cinergy T2 driver by:
9  *
10  * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
11  *                  Holger Waechtler <holger@qanu.de>
12  *
13  *  Protocol Spec published on http://qanu.de/specs/terratec_cinergyT2.pdf
14  */
15 
16 #ifndef _DVB_USB_CINERGYT2_H_
17 #define _DVB_USB_CINERGYT2_H_
18 
19 #include <linux/usb/input.h>
20 
21 #define DVB_USB_LOG_PREFIX "cinergyT2"
22 #include "dvb-usb.h"
23 
24 #define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
25 
26 extern int dvb_usb_cinergyt2_debug;
27 
28 #define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
29 #define deb_xfer(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x002, args)
30 #define deb_pll(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x004, args)
31 #define deb_ts(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x008, args)
32 #define deb_err(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x010, args)
33 #define deb_rc(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x020, args)
34 #define deb_fw(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x040, args)
35 #define deb_mem(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x080, args)
36 #define deb_uxfer(args...) dprintk(dvb_usb_cinergyt2_debug,  0x100, args)
37 
38 
39 
40 enum cinergyt2_ep1_cmd {
41 	CINERGYT2_EP1_PID_TABLE_RESET		= 0x01,
42 	CINERGYT2_EP1_PID_SETUP			= 0x02,
43 	CINERGYT2_EP1_CONTROL_STREAM_TRANSFER	= 0x03,
44 	CINERGYT2_EP1_SET_TUNER_PARAMETERS	= 0x04,
45 	CINERGYT2_EP1_GET_TUNER_STATUS		= 0x05,
46 	CINERGYT2_EP1_START_SCAN		= 0x06,
47 	CINERGYT2_EP1_CONTINUE_SCAN		= 0x07,
48 	CINERGYT2_EP1_GET_RC_EVENTS		= 0x08,
49 	CINERGYT2_EP1_SLEEP_MODE		= 0x09,
50 	CINERGYT2_EP1_GET_FIRMWARE_VERSION	= 0x0A
51 };
52 
53 
54 struct dvbt_get_status_msg {
55 	uint32_t freq;
56 	uint8_t bandwidth;
57 	uint16_t tps;
58 	uint8_t flags;
59 	__le16 gain;
60 	uint8_t snr;
61 	__le32 viterbi_error_rate;
62 	uint32_t rs_error_rate;
63 	__le32 uncorrected_block_count;
64 	uint8_t lock_bits;
65 	uint8_t prev_lock_bits;
66 } __attribute__((packed));
67 
68 
69 struct dvbt_set_parameters_msg {
70 	uint8_t cmd;
71 	__le32 freq;
72 	uint8_t bandwidth;
73 	__le16 tps;
74 	uint8_t flags;
75 } __attribute__((packed));
76 
77 
78 extern struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d);
79 
80 #endif /* _DVB_USB_CINERGYT2_H_ */
81 
82