dibusb.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* Header file for all dibusb-based-receivers.
  2. *
  3. * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the Free
  7. * Software Foundation, version 2.
  8. *
  9. * see Documentation/dvb/README.dvb-usb for more information
  10. */
  11. #ifndef _DVB_USB_DIBUSB_H_
  12. #define _DVB_USB_DIBUSB_H_
  13. #ifndef DVB_USB_LOG_PREFIX
  14. #define DVB_USB_LOG_PREFIX "dibusb"
  15. #endif
  16. #include "dvb-usb.h"
  17. #include "dib3000.h"
  18. #include "dib3000mc.h"
  19. #include "mt2060.h"
  20. /*
  21. * protocol of all dibusb related devices
  22. */
  23. /*
  24. * bulk msg to/from endpoint 0x01
  25. *
  26. * general structure:
  27. * request_byte parameter_bytes
  28. */
  29. #define DIBUSB_REQ_START_READ 0x00
  30. #define DIBUSB_REQ_START_DEMOD 0x01
  31. /*
  32. * i2c read
  33. * bulk write: 0x02 ((7bit i2c_addr << 1) | 0x01) register_bytes length_word
  34. * bulk read: byte_buffer (length_word bytes)
  35. */
  36. #define DIBUSB_REQ_I2C_READ 0x02
  37. /*
  38. * i2c write
  39. * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
  40. */
  41. #define DIBUSB_REQ_I2C_WRITE 0x03
  42. /*
  43. * polling the value of the remote control
  44. * bulk write: 0x04
  45. * bulk read: byte_buffer (5 bytes)
  46. */
  47. #define DIBUSB_REQ_POLL_REMOTE 0x04
  48. /* additional status values for Hauppauge Remote Control Protocol */
  49. #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
  50. #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03
  51. /* streaming mode:
  52. * bulk write: 0x05 mode_byte
  53. *
  54. * mode_byte is mostly 0x00
  55. */
  56. #define DIBUSB_REQ_SET_STREAMING_MODE 0x05
  57. /* interrupt the internal read loop, when blocking */
  58. #define DIBUSB_REQ_INTR_READ 0x06
  59. /* io control
  60. * 0x07 cmd_byte param_bytes
  61. *
  62. * param_bytes can be up to 32 bytes
  63. *
  64. * cmd_byte function parameter name
  65. * 0x00 power mode
  66. * 0x00 sleep
  67. * 0x01 wakeup
  68. *
  69. * 0x01 enable streaming
  70. * 0x02 disable streaming
  71. *
  72. *
  73. */
  74. #define DIBUSB_REQ_SET_IOCTL 0x07
  75. /* IOCTL commands */
  76. /* change the power mode in firmware */
  77. #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
  78. #define DIBUSB_IOCTL_POWER_SLEEP 0x00
  79. #define DIBUSB_IOCTL_POWER_WAKEUP 0x01
  80. /* modify streaming of the FX2 */
  81. #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
  82. #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
  83. struct dibusb_state {
  84. struct dib_fe_xfer_ops ops;
  85. int mt2060_present;
  86. u8 tuner_addr;
  87. };
  88. struct dibusb_device_state {
  89. /* for RC5 remote control */
  90. int old_toggle;
  91. int last_repeat_count;
  92. };
  93. extern struct i2c_algorithm dibusb_i2c_algo;
  94. extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *);
  95. extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *);
  96. extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int);
  97. extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int);
  98. extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int);
  99. extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int);
  100. extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
  101. extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
  102. #define DEFAULT_RC_INTERVAL 150
  103. //#define DEFAULT_RC_INTERVAL 100000
  104. extern struct rc_map_table rc_map_dibusb_table[];
  105. extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
  106. extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
  107. #endif