blob: 697be2a17adef131b68a2f34a2401b2108174b68 [file] [log] [blame]
Johannes Stezenbach776338e2005-06-23 22:02:35 -07001/* Header file for all dibusb-based-receivers.
2 *
Patrick Boettcher99e44da2016-01-24 12:56:58 -02003 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
Johannes Stezenbach776338e2005-06-23 22:02:35 -07004 *
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"
Patrick Boettcherb7571f82006-08-08 15:48:10 -030020#include "dib3000mc.h"
Olivier DANETa16bf5d2006-08-08 15:48:09 -030021#include "mt2060.h"
Johannes Stezenbach776338e2005-06-23 22:02:35 -070022
23/*
24 * protocol of all dibusb related devices
25 */
26
27/*
28 * bulk msg to/from endpoint 0x01
29 *
30 * general structure:
31 * request_byte parameter_bytes
32 */
33
34#define DIBUSB_REQ_START_READ 0x00
35#define DIBUSB_REQ_START_DEMOD 0x01
36
37/*
38 * i2c read
Raimonds Cicansad86faa2014-07-08 07:38:20 -030039 * bulk write: 0x02 ((7bit i2c_addr << 1) | 0x01) register_bytes length_word
Johannes Stezenbach776338e2005-06-23 22:02:35 -070040 * bulk read: byte_buffer (length_word bytes)
41 */
42#define DIBUSB_REQ_I2C_READ 0x02
43
44/*
45 * i2c write
46 * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
47 */
48#define DIBUSB_REQ_I2C_WRITE 0x03
49
50/*
51 * polling the value of the remote control
52 * bulk write: 0x04
53 * bulk read: byte_buffer (5 bytes)
54 */
55#define DIBUSB_REQ_POLL_REMOTE 0x04
56
57/* additional status values for Hauppauge Remote Control Protocol */
58#define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
59#define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03
60
61/* streaming mode:
62 * bulk write: 0x05 mode_byte
63 *
64 * mode_byte is mostly 0x00
65 */
66#define DIBUSB_REQ_SET_STREAMING_MODE 0x05
67
68/* interrupt the internal read loop, when blocking */
69#define DIBUSB_REQ_INTR_READ 0x06
70
71/* io control
72 * 0x07 cmd_byte param_bytes
73 *
74 * param_bytes can be up to 32 bytes
75 *
76 * cmd_byte function parameter name
77 * 0x00 power mode
78 * 0x00 sleep
79 * 0x01 wakeup
80 *
81 * 0x01 enable streaming
82 * 0x02 disable streaming
83 *
84 *
85 */
86#define DIBUSB_REQ_SET_IOCTL 0x07
87
88/* IOCTL commands */
89
90/* change the power mode in firmware */
91#define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
92#define DIBUSB_IOCTL_POWER_SLEEP 0x00
93#define DIBUSB_IOCTL_POWER_WAKEUP 0x01
94
95/* modify streaming of the FX2 */
96#define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
97#define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
98
Mauro Carvalho Chehab426398b2016-10-07 07:34:36 -030099/* Max transfer size done by I2C transfer functions */
100#define MAX_XFER_SIZE 64
101
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700102struct dibusb_state {
103 struct dib_fe_xfer_ops ops;
Patrick Boettchere4d6c1f2006-08-08 15:48:09 -0300104 int mt2060_present;
Michael Krufky6c08d9292007-06-12 12:43:25 -0300105 u8 tuner_addr;
Patrick Boettcher6a742162006-10-13 11:33:26 -0300106};
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700107
Patrick Boettcher6a742162006-10-13 11:33:26 -0300108struct dibusb_device_state {
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700109 /* for RC5 remote control */
110 int old_toggle;
111 int last_repeat_count;
112};
113
114extern struct i2c_algorithm dibusb_i2c_algo;
115
Patrick Boettcher4d43e132006-09-30 06:53:48 -0300116extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *);
117extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *);
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700118
Patrick Boettcher4d43e132006-09-30 06:53:48 -0300119extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int);
120extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int);
121extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int);
122extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int);
123
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700124extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700125extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
126
127#define DEFAULT_RC_INTERVAL 150
128//#define DEFAULT_RC_INTERVAL 100000
129
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300130extern struct rc_map_table rc_map_dibusb_table[];
Johannes Stezenbach776338e2005-06-23 22:02:35 -0700131extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
132extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
133
134#endif