cinergyT2.h 2.9 KB

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