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