1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
/*
* dvb-dibusb.h
*
* Copyright (C) 2004 Patrick Boettcher (patrick.boettcher@desy.de)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2.
*
* for more information see dvb-dibusb.c .
*/
#ifndef __DVB_DIBUSB_H__
#define __DVB_DIBUSB_H__
#include "dib3000.h"
typedef enum {
DIBUSB1_1 = 0,
DIBUSB2_0,
DIBUSB1_1_AN2235,
} dibusb_type;
static const char * dibusb_fw_filenames1_1[] = {
"dvb-dibusb-5.0.0.11.fw"
};
static const char * dibusb_fw_filenames1_1_an2235[] = {
"dvb-dibusb-an2235-1.fw"
};
static const char * dibusb_fw_filenames2_0[] = {
"dvb-dibusb-6.0.0.5.fw"
};
struct dibusb_device_parameter {
dibusb_type type;
u8 demod_addr;
const char **fw_filenames;
const char *usb_controller;
u16 usb_cpu_csreg;
int num_urbs;
int urb_buf_size;
int default_size;
int firmware_bug;
int cmd_pipe;
int result_pipe;
int data_pipe;
};
static struct dibusb_device_parameter dibusb_dev_parm[3] = {
{ .type = DIBUSB1_1,
.demod_addr = 0x10,
.fw_filenames = dibusb_fw_filenames1_1,
.usb_controller = "Cypress AN2135",
.usb_cpu_csreg = 0x7f92,
.num_urbs = 3,
.urb_buf_size = 4096,
.default_size = 188*21,
.firmware_bug = 1,
.cmd_pipe = 0x01,
.result_pipe = 0x81,
.data_pipe = 0x82,
},
{ .type = DIBUSB2_0,
.demod_addr = 0x10,
.fw_filenames = dibusb_fw_filenames2_0,
.usb_controller = "Cypress FX2",
.usb_cpu_csreg = 0xe600,
.num_urbs = 3,
.urb_buf_size = 40960,
.default_size = 188*210,
.firmware_bug = 0,
.cmd_pipe = 0x01,
.result_pipe = 0x81,
.data_pipe = 0x86,
},
{ .type = DIBUSB1_1_AN2235,
.demod_addr = 0x10,
.fw_filenames = dibusb_fw_filenames1_1_an2235,
.usb_controller = "Cypress CY7C64613 (AN2235)",
.usb_cpu_csreg = 0x7f92,
.num_urbs = 3,
.urb_buf_size = 4096,
.default_size = 188*21,
.firmware_bug = 1,
.cmd_pipe = 0x01,
.result_pipe = 0x81,
.data_pipe = 0x82,
}
};
struct dibusb_device {
const char *name;
u16 cold_product_id;
u16 warm_product_id;
struct dibusb_device_parameter *parm;
};
/* Vendor IDs */
#define USB_VID_ANCHOR 0x0547
#define USB_VID_AVERMEDIA 0x14aa
#define USB_VID_COMPRO 0x185b
#define USB_VID_DIBCOM 0x10b8
#define USB_VID_EMPIA 0xeb1a
#define USB_VID_GRANDTEC 0x5032
#define USB_VID_HYPER_PALTEK 0x1025
#define USB_VID_IMC_NETWORKS 0x13d3
#define USB_VID_TWINHAN 0x1822
#define USB_VID_ULTIMA_ELECTRONIC 0x05d8
/* Product IDs */
#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001
#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002
#define USB_PID_COMPRO_DVBU2000_COLD 0xd000
#define USB_PID_COMPRO_DVBU2000_WARM 0xd001
#define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8
#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9
#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6
#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7
#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
#define USB_PID_KWORLD_VSTREAM_COLD 0x17de
#define USB_PID_KWORLD_VSTREAM_WARM 0x17df
#define USB_PID_TWINHAN_VP7041_COLD 0x3201
#define USB_PID_TWINHAN_VP7041_WARM 0x3202
#define USB_PID_ULTIMA_TVBOX_COLD 0x8105
#define USB_PID_ULTIMA_TVBOX_WARM 0x8106
#define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107
#define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108
#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235
#define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e
#define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f
#define USB_PID_YAKUMO_DTT200U_COLD 0x0201
#define USB_PID_YAKUMO_DTT200U_WARM 0x0301
#define DIBUSB_SUPPORTED_DEVICES 12
/* USB Driver stuff */
static struct dibusb_device dibusb_devices[DIBUSB_SUPPORTED_DEVICES] = {
{ .name = "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device",
.cold_product_id = USB_PID_TWINHAN_VP7041_COLD,
.warm_product_id = USB_PID_TWINHAN_VP7041_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "KWorld V-Stream XPERT DTV - DVB-T USB1.1",
.cold_product_id = USB_PID_KWORLD_VSTREAM_COLD,
.warm_product_id = USB_PID_KWORLD_VSTREAM_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "Grandtec USB1.1 DVB-T/DiBcom USB1.1 DVB-T reference design (MOD3000)",
.cold_product_id = USB_PID_DIBCOM_MOD3000_COLD,
.warm_product_id = USB_PID_DIBCOM_MOD3000_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "Artec T1 USB1.1 TVBOX with AN2135",
.cold_product_id = USB_PID_ULTIMA_TVBOX_COLD,
.warm_product_id = USB_PID_ULTIMA_TVBOX_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "Artec T1 USB1.1 TVBOX with AN2235",
.cold_product_id = USB_PID_ULTIMA_TVBOX_AN2235_COLD,
.warm_product_id = USB_PID_ULTIMA_TVBOX_AN2235_WARM,
.parm = &dibusb_dev_parm[2],
},
{ .name = "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)",
.cold_product_id = USB_PID_ULTIMA_TVBOX_ANCHOR_COLD,
.warm_product_id = 0, /* undefined, this design becomes USB_PID_DIBCOM_MOD3000_WARM in warm state */
.parm = &dibusb_dev_parm[2],
},
{ .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1",
.cold_product_id = USB_PID_COMPRO_DVBU2000_COLD,
.warm_product_id = USB_PID_COMPRO_DVBU2000_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "Unkown USB1.1 DVB-T device ???? please report the name to the author",
.cold_product_id = USB_PID_UNK_HYPER_PALTEK_COLD,
.warm_product_id = USB_PID_UNK_HYPER_PALTEK_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "DiBcom USB2.0 DVB-T reference design (MOD3000P)",
.cold_product_id = USB_PID_DIBCOM_MOD3001_COLD,
.warm_product_id = USB_PID_DIBCOM_MOD3001_WARM,
.parm = &dibusb_dev_parm[1],
},
{ .name = "Grandtec DVB-T USB1.1",
.cold_product_id = USB_PID_GRANDTEC_DVBT_USB_COLD,
.warm_product_id = USB_PID_GRANDTEC_DVBT_USB_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "Avermedia AverTV DVBT USB1.1",
.cold_product_id = USB_PID_AVERMEDIA_DVBT_USB_COLD,
.warm_product_id = USB_PID_AVERMEDIA_DVBT_USB_WARM,
.parm = &dibusb_dev_parm[0],
},
{ .name = "Yakumo DVB-T mobile USB2.0",
.cold_product_id = USB_PID_YAKUMO_DTT200U_COLD,
.warm_product_id = USB_PID_YAKUMO_DTT200U_WARM,
.parm = &dibusb_dev_parm[1],
}
};
/* USB Driver stuff */
/* table of devices that work with this driver */
static struct usb_device_id dibusb_table [] = {
{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)},
{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)},
{ USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) },
{ USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) },
{ USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) },
{ USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) },
{ USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) },
{ USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) },
{ USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) },
{ USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) },
{ USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) },
{ USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) },
{ USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) },
{ USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) },
{ USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) },
{ USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) },
{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) },
{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) },
{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) },
{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) },
{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) },
{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) },
/*
* activate the following define when you have the device and want to compile
* build from build-2.6 in dvb-kernel
*/
// #define CONFIG_DVB_DIBUSB_MISDESIGNED_AN2235
#ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_AN2235
{ USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
#endif
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, dibusb_table);
#define DIBUSB_I2C_TIMEOUT HZ*5
struct usb_dibusb {
/* usb */
struct usb_device * udev;
struct dibusb_device * dibdev;
int feedcount;
struct dib3000_xfer_ops xfer_ops;
struct urb **urb_list;
u8 *buffer;
dma_addr_t dma_handle;
/* I2C */
struct i2c_adapter i2c_adap;
struct i2c_client i2c_client;
/* locking */
struct semaphore usb_sem;
struct semaphore i2c_sem;
/* dvb */
int dvb_is_ready;
struct dvb_adapter *adapter;
struct dmxdev dmxdev;
struct dvb_demux demux;
struct dvb_net dvb_net;
struct dvb_frontend* fe;
};
/* types of first byte of each buffer */
#define DIBUSB_REQ_START_READ 0x00
#define DIBUSB_REQ_START_DEMOD 0x01
#define DIBUSB_REQ_I2C_READ 0x02
#define DIBUSB_REQ_I2C_WRITE 0x03
/* prefix for reading the current RC key */
#define DIBUSB_REQ_POLL_REMOTE 0x04
#define DIBUSB_RC_NEC_EMPTY 0x00
#define DIBUSB_RC_NEC_KEY_PRESSED 0x01
#define DIBUSB_RC_NEC_KEY_REPEATED 0x02
/* 0x05 0xXX */
#define DIBUSB_REQ_SET_STREAMING_MODE 0x05
/* interrupt the internal read loop, when blocking */
#define DIBUSB_REQ_INTR_READ 0x06
/* IO control
* 0x07 <cmd 1 byte> <param 32 bytes>
*/
#define DIBUSB_REQ_SET_IOCTL 0x07
/* IOCTL commands */
/* change the power mode in firmware */
#define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
#define DIBUSB_IOCTL_POWER_SLEEP 0x00
#define DIBUSB_IOCTL_POWER_WAKEUP 0x01
#endif
|