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