ec168.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * E3C EC168 DVB USB driver
  3. *
  4. * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. */
  21. #ifndef EC168_H
  22. #define EC168_H
  23. #define DVB_USB_LOG_PREFIX "ec168"
  24. #include "dvb-usb.h"
  25. #define deb_info(args...) dprintk(dvb_usb_ec168_debug, 0x01, args)
  26. #define deb_rc(args...) dprintk(dvb_usb_ec168_debug, 0x02, args)
  27. #define deb_xfer(args...) dprintk(dvb_usb_ec168_debug, 0x04, args)
  28. #define deb_reg(args...) dprintk(dvb_usb_ec168_debug, 0x08, args)
  29. #define deb_i2c(args...) dprintk(dvb_usb_ec168_debug, 0x10, args)
  30. #define deb_fw(args...) dprintk(dvb_usb_ec168_debug, 0x20, args)
  31. #define ec168_debug_dump(r, t, v, i, b, l, func) { \
  32. int loop_; \
  33. func("%02x %02x %02x %02x %02x %02x %02x %02x", \
  34. t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
  35. if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
  36. func(" >>> "); \
  37. else \
  38. func(" <<< "); \
  39. for (loop_ = 0; loop_ < l; loop_++) \
  40. func("%02x ", b[loop_]); \
  41. func("\n");\
  42. }
  43. #define EC168_USB_TIMEOUT 1000
  44. struct ec168_req {
  45. u8 cmd; /* [1] */
  46. u16 value; /* [2|3] */
  47. u16 index; /* [4|5] */
  48. u16 size; /* [6|7] */
  49. u8 *data;
  50. };
  51. enum ec168_cmd {
  52. DOWNLOAD_FIRMWARE = 0x00,
  53. CONFIG = 0x01,
  54. DEMOD_RW = 0x03,
  55. GPIO = 0x04,
  56. STREAMING_CTRL = 0x10,
  57. READ_I2C = 0x20,
  58. WRITE_I2C = 0x21,
  59. HID_DOWNLOAD = 0x30,
  60. GET_CONFIG,
  61. SET_CONFIG,
  62. READ_DEMOD,
  63. WRITE_DEMOD,
  64. };
  65. #endif