blob: c2f97f96c21fc1feae79ac7caa455cb641d1e8f0 [file] [log] [blame]
Patrick Boettcher3706a4d2005-09-09 13:02:41 -07001#ifndef _DVB_USB_VP7021_H_
2#define _DVB_USB_VP7021_H_
3
4#define DVB_USB_LOG_PREFIX "vp702x"
5#include "dvb-usb.h"
6
7extern int dvb_usb_vp702x_debug;
8#define deb_info(args...) dprintk(dvb_usb_vp702x_debug,0x01,args)
9#define deb_xfer(args...) dprintk(dvb_usb_vp702x_debug,0x02,args)
10#define deb_rc(args...) dprintk(dvb_usb_vp702x_debug,0x04,args)
11#define deb_fe(args...) dprintk(dvb_usb_vp702x_debug,0x08,args)
12
13/* commands are read and written with USB control messages */
14
15/* consecutive read/write operation */
Marc Koschewski4e5910e2006-01-09 18:21:33 -020016#define REQUEST_OUT 0xB2
17#define REQUEST_IN 0xB3
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070018
19/* the out-buffer of these consecutive operations contain sub-commands when b[0] = 0
20 * request: 0xB2; i: 0; v: 0; b[0] = 0, b[1] = subcmd, additional buffer
21 * the returning buffer looks as follows
22 * request: 0xB3; i: 0; v: 0; b[0] = 0xB3, additional buffer */
23
Marc Koschewski4e5910e2006-01-09 18:21:33 -020024#define GET_TUNER_STATUS 0x05
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070025/* additional in buffer:
26 * 0 1 2 3 4 5 6 7 8
27 * N/A N/A 0x05 signal-quality N/A N/A signal-strength lock==0 N/A */
28
Marc Koschewski4e5910e2006-01-09 18:21:33 -020029#define GET_SYSTEM_STRING 0x06
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070030/* additional in buffer:
31 * 0 1 2 3 4 5 6 7 8
32 * N/A 'U' 'S' 'B' '7' '0' '2' 'X' N/A */
33
Marc Koschewski4e5910e2006-01-09 18:21:33 -020034#define SET_DISEQC_CMD 0x08
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070035/* additional out buffer:
36 * 0 1 2 3 4
37 * len X1 X2 X3 X4
38 * additional in buffer:
39 * 0 1 2
Marc Koschewski4e5910e2006-01-09 18:21:33 -020040 * N/A 0 0 b[1] == b[2] == 0 -> success, failure otherwise */
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070041
Marc Koschewski4e5910e2006-01-09 18:21:33 -020042#define SET_LNB_POWER 0x09
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070043/* additional out buffer:
44 * 0 1 2
45 * 0x00 0xff 1 = on, 0 = off
46 * additional in buffer:
47 * 0 1 2
Marc Koschewski4e5910e2006-01-09 18:21:33 -020048 * N/A 0 0 b[1] == b[2] == 0 -> success failure otherwise */
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070049
Marc Koschewski4e5910e2006-01-09 18:21:33 -020050#define GET_MAC_ADDRESS 0x0A
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070051/* #define GET_MAC_ADDRESS 0x0B */
52/* additional in buffer:
53 * 0 1 2 3 4 5 6 7 8
54 * N/A N/A 0x0A or 0x0B MAC0 MAC1 MAC2 MAC3 MAC4 MAC5 */
55
Marc Koschewski4e5910e2006-01-09 18:21:33 -020056#define SET_PID_FILTER 0x11
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070057/* additional in buffer:
58 * 0 1 ... 14 15 16
59 * PID0_MSB PID0_LSB ... PID7_MSB PID7_LSB PID_active (bits) */
60
61/* request: 0xB2; i: 0; v: 0;
62 * b[0] != 0 -> tune and lock a channel
63 * 0 1 2 3 4 5 6 7
64 * freq0 freq1 divstep srate0 srate1 srate2 flag chksum
65 */
66
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070067/* one direction requests */
Marc Koschewski4e5910e2006-01-09 18:21:33 -020068#define READ_REMOTE_REQ 0xB4
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070069/* IN i: 0; v: 0; b[0] == request, b[1] == key */
70
Marc Koschewski4e5910e2006-01-09 18:21:33 -020071#define READ_PID_NUMBER_REQ 0xB5
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070072/* IN i: 0; v: 0; b[0] == request, b[1] == 0, b[2] = pid number */
73
Marc Koschewski4e5910e2006-01-09 18:21:33 -020074#define WRITE_EEPROM_REQ 0xB6
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070075/* OUT i: offset; v: value to write; no extra buffer */
76
Marc Koschewski4e5910e2006-01-09 18:21:33 -020077#define READ_EEPROM_REQ 0xB7
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070078/* IN i: bufferlen; v: offset; buffer with bufferlen bytes */
79
Marc Koschewski4e5910e2006-01-09 18:21:33 -020080#define READ_STATUS 0xB8
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070081/* IN i: 0; v: 0; bufferlen 10 */
82
Marc Koschewski4e5910e2006-01-09 18:21:33 -020083#define READ_TUNER_REG_REQ 0xB9
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070084/* IN i: 0; v: register; b[0] = value */
85
Marc Koschewski4e5910e2006-01-09 18:21:33 -020086#define READ_FX2_REG_REQ 0xBA
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070087/* IN i: offset; v: 0; b[0] = value */
88
Marc Koschewski4e5910e2006-01-09 18:21:33 -020089#define WRITE_FX2_REG_REQ 0xBB
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070090/* OUT i: offset; v: value to write; 1 byte extra buffer */
91
Marc Koschewski4e5910e2006-01-09 18:21:33 -020092#define SET_TUNER_POWER_REQ 0xBC
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070093/* IN i: 0 = power off, 1 = power on */
94
Marc Koschewski4e5910e2006-01-09 18:21:33 -020095#define WRITE_TUNER_REG_REQ 0xBD
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070096/* IN i: register, v: value to write, no extra buffer */
97
Marc Koschewski4e5910e2006-01-09 18:21:33 -020098#define RESET_TUNER 0xBE
Patrick Boettcher3706a4d2005-09-09 13:02:41 -070099/* IN i: 0, v: 0, no extra buffer */
100
101extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d);
102
103extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec);
Patrick Boettcher3706a4d2005-09-09 13:02:41 -0700104extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
Patrick Boettcher3706a4d2005-09-09 13:02:41 -0700105
106#endif