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