blob: b33267b0e5cb392a7b150c9d892c822a4d0bbdd0 [file] [log] [blame]
Antti Palosaari2bf290b2009-11-13 22:38:55 -03001/*
2 * E3C EC168 DVB USB driver
3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22#ifndef EC168_H
23#define EC168_H
24
25#define DVB_USB_LOG_PREFIX "ec168"
Antti Palosaari3eee0472012-06-12 16:45:54 -030026#include "dvb_usb.h"
27
28#ifdef CONFIG_DVB_USB_DEBUG
29#define dprintk(var, level, args...) \
30 do { if ((var & level)) printk(args); } while (0)
31#define DVB_USB_DEBUG_STATUS
32#else
33#define dprintk(args...)
34#define debug_dump(b, l, func)
35#define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
36#endif
Antti Palosaari2bf290b2009-11-13 22:38:55 -030037
38#define deb_info(args...) dprintk(dvb_usb_ec168_debug, 0x01, args)
39#define deb_rc(args...) dprintk(dvb_usb_ec168_debug, 0x02, args)
40#define deb_xfer(args...) dprintk(dvb_usb_ec168_debug, 0x04, args)
41#define deb_reg(args...) dprintk(dvb_usb_ec168_debug, 0x08, args)
42#define deb_i2c(args...) dprintk(dvb_usb_ec168_debug, 0x10, args)
43#define deb_fw(args...) dprintk(dvb_usb_ec168_debug, 0x20, args)
44
45#define ec168_debug_dump(r, t, v, i, b, l, func) { \
46 int loop_; \
47 func("%02x %02x %02x %02x %02x %02x %02x %02x", \
48 t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
49 if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
50 func(" >>> "); \
51 else \
52 func(" <<< "); \
53 for (loop_ = 0; loop_ < l; loop_++) \
54 func("%02x ", b[loop_]); \
55 func("\n");\
56}
57
58#define EC168_USB_TIMEOUT 1000
59
60struct ec168_req {
61 u8 cmd; /* [1] */
62 u16 value; /* [2|3] */
63 u16 index; /* [4|5] */
64 u16 size; /* [6|7] */
65 u8 *data;
66};
67
68enum ec168_cmd {
69 DOWNLOAD_FIRMWARE = 0x00,
70 CONFIG = 0x01,
71 DEMOD_RW = 0x03,
72 GPIO = 0x04,
73 STREAMING_CTRL = 0x10,
74 READ_I2C = 0x20,
75 WRITE_I2C = 0x21,
76 HID_DOWNLOAD = 0x30,
77 GET_CONFIG,
78 SET_CONFIG,
79 READ_DEMOD,
80 WRITE_DEMOD,
81};
82
83#endif