vp702x.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef _DVB_USB_VP7021_H_
  2. #define _DVB_USB_VP7021_H_
  3. #define DVB_USB_LOG_PREFIX "vp702x"
  4. #include "dvb-usb.h"
  5. extern int dvb_usb_vp702x_debug;
  6. #define deb_info(args...) dprintk(dvb_usb_vp702x_debug,0x01,args)
  7. #define deb_xfer(args...) dprintk(dvb_usb_vp702x_debug,0x02,args)
  8. #define deb_rc(args...) dprintk(dvb_usb_vp702x_debug,0x04,args)
  9. #define deb_fe(args...) dprintk(dvb_usb_vp702x_debug,0x08,args)
  10. /* commands are read and written with USB control messages */
  11. /* consecutive read/write operation */
  12. #define REQUEST_OUT 0xB2
  13. #define REQUEST_IN 0xB3
  14. /* the out-buffer of these consecutive operations contain sub-commands when b[0] = 0
  15. * request: 0xB2; i: 0; v: 0; b[0] = 0, b[1] = subcmd, additional buffer
  16. * the returning buffer looks as follows
  17. * request: 0xB3; i: 0; v: 0; b[0] = 0xB3, additional buffer */
  18. #define GET_TUNER_STATUS 0x05
  19. /* additional in buffer:
  20. * 0 1 2 3 4 5 6 7 8
  21. * N/A N/A 0x05 signal-quality N/A N/A signal-strength lock==0 N/A */
  22. #define GET_SYSTEM_STRING 0x06
  23. /* additional in buffer:
  24. * 0 1 2 3 4 5 6 7 8
  25. * N/A 'U' 'S' 'B' '7' '0' '2' 'X' N/A */
  26. #define SET_DISEQC_CMD 0x08
  27. /* additional out buffer:
  28. * 0 1 2 3 4
  29. * len X1 X2 X3 X4
  30. * additional in buffer:
  31. * 0 1 2
  32. * N/A 0 0 b[1] == b[2] == 0 -> success, failure otherwise */
  33. #define SET_LNB_POWER 0x09
  34. /* additional out buffer:
  35. * 0 1 2
  36. * 0x00 0xff 1 = on, 0 = off
  37. * additional in buffer:
  38. * 0 1 2
  39. * N/A 0 0 b[1] == b[2] == 0 -> success failure otherwise */
  40. #define GET_MAC_ADDRESS 0x0A
  41. /* #define GET_MAC_ADDRESS 0x0B */
  42. /* additional in buffer:
  43. * 0 1 2 3 4 5 6 7 8
  44. * N/A N/A 0x0A or 0x0B MAC0 MAC1 MAC2 MAC3 MAC4 MAC5 */
  45. #define SET_PID_FILTER 0x11
  46. /* additional in buffer:
  47. * 0 1 ... 14 15 16
  48. * PID0_MSB PID0_LSB ... PID7_MSB PID7_LSB PID_active (bits) */
  49. /* request: 0xB2; i: 0; v: 0;
  50. * b[0] != 0 -> tune and lock a channel
  51. * 0 1 2 3 4 5 6 7
  52. * freq0 freq1 divstep srate0 srate1 srate2 flag chksum
  53. */
  54. /* one direction requests */
  55. #define READ_REMOTE_REQ 0xB4
  56. /* IN i: 0; v: 0; b[0] == request, b[1] == key */
  57. #define READ_PID_NUMBER_REQ 0xB5
  58. /* IN i: 0; v: 0; b[0] == request, b[1] == 0, b[2] = pid number */
  59. #define WRITE_EEPROM_REQ 0xB6
  60. /* OUT i: offset; v: value to write; no extra buffer */
  61. #define READ_EEPROM_REQ 0xB7
  62. /* IN i: bufferlen; v: offset; buffer with bufferlen bytes */
  63. #define READ_STATUS 0xB8
  64. /* IN i: 0; v: 0; bufferlen 10 */
  65. #define READ_TUNER_REG_REQ 0xB9
  66. /* IN i: 0; v: register; b[0] = value */
  67. #define READ_FX2_REG_REQ 0xBA
  68. /* IN i: offset; v: 0; b[0] = value */
  69. #define WRITE_FX2_REG_REQ 0xBB
  70. /* OUT i: offset; v: value to write; 1 byte extra buffer */
  71. #define SET_TUNER_POWER_REQ 0xBC
  72. /* IN i: 0 = power off, 1 = power on */
  73. #define WRITE_TUNER_REG_REQ 0xBD
  74. /* IN i: register, v: value to write, no extra buffer */
  75. #define RESET_TUNER 0xBE
  76. /* IN i: 0, v: 0, no extra buffer */
  77. struct vp702x_device_state {
  78. struct mutex buf_mutex;
  79. int buf_len;
  80. u8 *buf;
  81. };
  82. extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d);
  83. extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec);
  84. extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
  85. #endif