162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * TerraTec Cinergy T2/qanu USB2 DVB-T adapter.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2007 Tomi Orava (tomimo@ncircle.nullnet.fi)
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Based on the dvb-usb-framework code and the
862306a36Sopenharmony_ci * original Terratec Cinergy T2 driver by:
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
1162306a36Sopenharmony_ci *                  Holger Waechtler <holger@qanu.de>
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci *  Protocol Spec published on http://qanu.de/specs/terratec_cinergyT2.pdf
1462306a36Sopenharmony_ci */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#ifndef _DVB_USB_CINERGYT2_H_
1762306a36Sopenharmony_ci#define _DVB_USB_CINERGYT2_H_
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#include <linux/usb/input.h>
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define DVB_USB_LOG_PREFIX "cinergyT2"
2262306a36Sopenharmony_ci#include "dvb-usb.h"
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciextern int dvb_usb_cinergyt2_debug;
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
2962306a36Sopenharmony_ci#define deb_xfer(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x002, args)
3062306a36Sopenharmony_ci#define deb_pll(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x004, args)
3162306a36Sopenharmony_ci#define deb_ts(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x008, args)
3262306a36Sopenharmony_ci#define deb_err(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x010, args)
3362306a36Sopenharmony_ci#define deb_rc(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x020, args)
3462306a36Sopenharmony_ci#define deb_fw(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x040, args)
3562306a36Sopenharmony_ci#define deb_mem(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x080, args)
3662306a36Sopenharmony_ci#define deb_uxfer(args...) dprintk(dvb_usb_cinergyt2_debug,  0x100, args)
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cienum cinergyt2_ep1_cmd {
4162306a36Sopenharmony_ci	CINERGYT2_EP1_PID_TABLE_RESET		= 0x01,
4262306a36Sopenharmony_ci	CINERGYT2_EP1_PID_SETUP			= 0x02,
4362306a36Sopenharmony_ci	CINERGYT2_EP1_CONTROL_STREAM_TRANSFER	= 0x03,
4462306a36Sopenharmony_ci	CINERGYT2_EP1_SET_TUNER_PARAMETERS	= 0x04,
4562306a36Sopenharmony_ci	CINERGYT2_EP1_GET_TUNER_STATUS		= 0x05,
4662306a36Sopenharmony_ci	CINERGYT2_EP1_START_SCAN		= 0x06,
4762306a36Sopenharmony_ci	CINERGYT2_EP1_CONTINUE_SCAN		= 0x07,
4862306a36Sopenharmony_ci	CINERGYT2_EP1_GET_RC_EVENTS		= 0x08,
4962306a36Sopenharmony_ci	CINERGYT2_EP1_SLEEP_MODE		= 0x09,
5062306a36Sopenharmony_ci	CINERGYT2_EP1_GET_FIRMWARE_VERSION	= 0x0A
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_cistruct dvbt_get_status_msg {
5562306a36Sopenharmony_ci	uint32_t freq;
5662306a36Sopenharmony_ci	uint8_t bandwidth;
5762306a36Sopenharmony_ci	uint16_t tps;
5862306a36Sopenharmony_ci	uint8_t flags;
5962306a36Sopenharmony_ci	__le16 gain;
6062306a36Sopenharmony_ci	uint8_t snr;
6162306a36Sopenharmony_ci	__le32 viterbi_error_rate;
6262306a36Sopenharmony_ci	uint32_t rs_error_rate;
6362306a36Sopenharmony_ci	__le32 uncorrected_block_count;
6462306a36Sopenharmony_ci	uint8_t lock_bits;
6562306a36Sopenharmony_ci	uint8_t prev_lock_bits;
6662306a36Sopenharmony_ci} __attribute__((packed));
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_cistruct dvbt_set_parameters_msg {
7062306a36Sopenharmony_ci	uint8_t cmd;
7162306a36Sopenharmony_ci	__le32 freq;
7262306a36Sopenharmony_ci	uint8_t bandwidth;
7362306a36Sopenharmony_ci	__le16 tps;
7462306a36Sopenharmony_ci	uint8_t flags;
7562306a36Sopenharmony_ci} __attribute__((packed));
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciextern struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d);
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#endif /* _DVB_USB_CINERGYT2_H_ */
8162306a36Sopenharmony_ci
82