18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * TerraTec Cinergy T2/qanu USB2 DVB-T adapter.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2007 Tomi Orava (tomimo@ncircle.nullnet.fi)
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Based on the dvb-usb-framework code and the
88c2ecf20Sopenharmony_ci * original Terratec Cinergy T2 driver by:
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
118c2ecf20Sopenharmony_ci *                  Holger Waechtler <holger@qanu.de>
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci *  Protocol Spec published on http://qanu.de/specs/terratec_cinergyT2.pdf
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifndef _DVB_USB_CINERGYT2_H_
178c2ecf20Sopenharmony_ci#define _DVB_USB_CINERGYT2_H_
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <linux/usb/input.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define DVB_USB_LOG_PREFIX "cinergyT2"
228c2ecf20Sopenharmony_ci#include "dvb-usb.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciextern int dvb_usb_cinergyt2_debug;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
298c2ecf20Sopenharmony_ci#define deb_xfer(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x002, args)
308c2ecf20Sopenharmony_ci#define deb_pll(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x004, args)
318c2ecf20Sopenharmony_ci#define deb_ts(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x008, args)
328c2ecf20Sopenharmony_ci#define deb_err(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x010, args)
338c2ecf20Sopenharmony_ci#define deb_rc(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x020, args)
348c2ecf20Sopenharmony_ci#define deb_fw(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x040, args)
358c2ecf20Sopenharmony_ci#define deb_mem(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x080, args)
368c2ecf20Sopenharmony_ci#define deb_uxfer(args...) dprintk(dvb_usb_cinergyt2_debug,  0x100, args)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cienum cinergyt2_ep1_cmd {
418c2ecf20Sopenharmony_ci	CINERGYT2_EP1_PID_TABLE_RESET		= 0x01,
428c2ecf20Sopenharmony_ci	CINERGYT2_EP1_PID_SETUP			= 0x02,
438c2ecf20Sopenharmony_ci	CINERGYT2_EP1_CONTROL_STREAM_TRANSFER	= 0x03,
448c2ecf20Sopenharmony_ci	CINERGYT2_EP1_SET_TUNER_PARAMETERS	= 0x04,
458c2ecf20Sopenharmony_ci	CINERGYT2_EP1_GET_TUNER_STATUS		= 0x05,
468c2ecf20Sopenharmony_ci	CINERGYT2_EP1_START_SCAN		= 0x06,
478c2ecf20Sopenharmony_ci	CINERGYT2_EP1_CONTINUE_SCAN		= 0x07,
488c2ecf20Sopenharmony_ci	CINERGYT2_EP1_GET_RC_EVENTS		= 0x08,
498c2ecf20Sopenharmony_ci	CINERGYT2_EP1_SLEEP_MODE		= 0x09,
508c2ecf20Sopenharmony_ci	CINERGYT2_EP1_GET_FIRMWARE_VERSION	= 0x0A
518c2ecf20Sopenharmony_ci};
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistruct dvbt_get_status_msg {
558c2ecf20Sopenharmony_ci	uint32_t freq;
568c2ecf20Sopenharmony_ci	uint8_t bandwidth;
578c2ecf20Sopenharmony_ci	uint16_t tps;
588c2ecf20Sopenharmony_ci	uint8_t flags;
598c2ecf20Sopenharmony_ci	__le16 gain;
608c2ecf20Sopenharmony_ci	uint8_t snr;
618c2ecf20Sopenharmony_ci	__le32 viterbi_error_rate;
628c2ecf20Sopenharmony_ci	uint32_t rs_error_rate;
638c2ecf20Sopenharmony_ci	__le32 uncorrected_block_count;
648c2ecf20Sopenharmony_ci	uint8_t lock_bits;
658c2ecf20Sopenharmony_ci	uint8_t prev_lock_bits;
668c2ecf20Sopenharmony_ci} __attribute__((packed));
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cistruct dvbt_set_parameters_msg {
708c2ecf20Sopenharmony_ci	uint8_t cmd;
718c2ecf20Sopenharmony_ci	__le32 freq;
728c2ecf20Sopenharmony_ci	uint8_t bandwidth;
738c2ecf20Sopenharmony_ci	__le16 tps;
748c2ecf20Sopenharmony_ci	uint8_t flags;
758c2ecf20Sopenharmony_ci} __attribute__((packed));
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciextern struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#endif /* _DVB_USB_CINERGYT2_H_ */
818c2ecf20Sopenharmony_ci
82