dibusb.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. #define DVB_USB_LOG_PREFIX "dibusb"
  14. #include "dvb-usb.h"
  15. #include "dib3000.h"
  16. /*
  17. * protocol of all dibusb related devices
  18. */
  19. /*
  20. * bulk msg to/from endpoint 0x01
  21. *
  22. * general structure:
  23. * request_byte parameter_bytes
  24. */
  25. #define DIBUSB_REQ_START_READ 0x00
  26. #define DIBUSB_REQ_START_DEMOD 0x01
  27. /*
  28. * i2c read
  29. * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word
  30. * bulk read: byte_buffer (length_word bytes)
  31. */
  32. #define DIBUSB_REQ_I2C_READ 0x02
  33. /*
  34. * i2c write
  35. * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
  36. */
  37. #define DIBUSB_REQ_I2C_WRITE 0x03
  38. /*
  39. * polling the value of the remote control
  40. * bulk write: 0x04
  41. * bulk read: byte_buffer (5 bytes)
  42. */
  43. #define DIBUSB_REQ_POLL_REMOTE 0x04
  44. /* additional status values for Hauppauge Remote Control Protocol */
  45. #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
  46. #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03
  47. /* streaming mode:
  48. * bulk write: 0x05 mode_byte
  49. *
  50. * mode_byte is mostly 0x00
  51. */
  52. #define DIBUSB_REQ_SET_STREAMING_MODE 0x05
  53. /* interrupt the internal read loop, when blocking */
  54. #define DIBUSB_REQ_INTR_READ 0x06
  55. /* io control
  56. * 0x07 cmd_byte param_bytes
  57. *
  58. * param_bytes can be up to 32 bytes
  59. *
  60. * cmd_byte function parameter name
  61. * 0x00 power mode
  62. * 0x00 sleep
  63. * 0x01 wakeup
  64. *
  65. * 0x01 enable streaming
  66. * 0x02 disable streaming
  67. *
  68. *
  69. */
  70. #define DIBUSB_REQ_SET_IOCTL 0x07
  71. /* IOCTL commands */
  72. /* change the power mode in firmware */
  73. #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
  74. #define DIBUSB_IOCTL_POWER_SLEEP 0x00
  75. #define DIBUSB_IOCTL_POWER_WAKEUP 0x01
  76. /* modify streaming of the FX2 */
  77. #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
  78. #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
  79. struct dibusb_state {
  80. struct dib_fe_xfer_ops ops;
  81. /* for RC5 remote control */
  82. int old_toggle;
  83. int last_repeat_count;
  84. };
  85. extern struct i2c_algorithm dibusb_i2c_algo;
  86. extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *);
  87. extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *);
  88. extern int dibusb_streaming_ctrl(struct dvb_usb_device *, int);
  89. extern int dibusb_pid_filter(struct dvb_usb_device *, int, u16, int);
  90. extern int dibusb_pid_filter_ctrl(struct dvb_usb_device *, int);
  91. extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
  92. extern int dibusb2_0_streaming_ctrl(struct dvb_usb_device *, int);
  93. extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
  94. #define DEFAULT_RC_INTERVAL 150
  95. //#define DEFAULT_RC_INTERVAL 100000
  96. extern struct dvb_usb_rc_key dibusb_rc_keys[];
  97. extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
  98. extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
  99. #endif