1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef __PVRUSB2_HDW_H
21#define __PVRUSB2_HDW_H
22
23#include <linux/usb.h>
24#include <linux/videodev2.h>
25#include "pvrusb2-io.h"
26#include "pvrusb2-ctrl.h"
27
28
29
30
31#define PVR2_CID_STDENUM 1
32#define PVR2_CID_STDCUR 2
33#define PVR2_CID_STDAVAIL 3
34#define PVR2_CID_INPUT 4
35#define PVR2_CID_AUDIOMODE 5
36#define PVR2_CID_FREQUENCY 6
37#define PVR2_CID_HRES 7
38#define PVR2_CID_VRES 8
39#define PVR2_CID_CROPL 9
40#define PVR2_CID_CROPT 10
41#define PVR2_CID_CROPW 11
42#define PVR2_CID_CROPH 12
43#define PVR2_CID_CROPCAPPAN 13
44#define PVR2_CID_CROPCAPPAD 14
45#define PVR2_CID_CROPCAPBL 15
46#define PVR2_CID_CROPCAPBT 16
47#define PVR2_CID_CROPCAPBW 17
48#define PVR2_CID_CROPCAPBH 18
49
50
51#define PVR2_CVAL_INPUT_TV 0
52#define PVR2_CVAL_INPUT_DTV 1
53#define PVR2_CVAL_INPUT_COMPOSITE 2
54#define PVR2_CVAL_INPUT_SVIDEO 3
55#define PVR2_CVAL_INPUT_RADIO 4
56
57enum pvr2_config {
58 pvr2_config_empty,
59 pvr2_config_mpeg,
60 pvr2_config_vbi,
61 pvr2_config_pcm,
62 pvr2_config_rawvideo,
63};
64
65enum pvr2_v4l_type {
66 pvr2_v4l_type_video,
67 pvr2_v4l_type_vbi,
68 pvr2_v4l_type_radio,
69};
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92#define PVR2_STATE_NONE 0
93#define PVR2_STATE_DEAD 1
94#define PVR2_STATE_COLD 2
95#define PVR2_STATE_WARM 3
96#define PVR2_STATE_ERROR 4
97#define PVR2_STATE_READY 5
98#define PVR2_STATE_RUN 6
99
100
101const char *pvr2_config_get_name(enum pvr2_config);
102
103struct pvr2_hdw;
104
105
106
107struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
108 const struct usb_device_id *devid);
109
110
111
112int pvr2_hdw_initialize(struct pvr2_hdw *,
113 void (*callback_func)(void *),
114 void *callback_data);
115
116
117void pvr2_hdw_destroy(struct pvr2_hdw *);
118
119
120int pvr2_hdw_dev_ok(struct pvr2_hdw *);
121
122
123
124int pvr2_hdw_get_unit_number(struct pvr2_hdw *);
125
126
127struct usb_device *pvr2_hdw_get_dev(struct pvr2_hdw *);
128
129
130unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *);
131
132
133const char *pvr2_hdw_get_bus_info(struct pvr2_hdw *);
134
135
136const char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *);
137
138
139void pvr2_hdw_disconnect(struct pvr2_hdw *);
140
141
142unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *);
143
144
145struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *,unsigned int);
146
147
148struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *,unsigned int);
149
150
151struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *,unsigned int ctl_id);
152
153
154struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *,
155 unsigned int ctl_id);
156
157
158int pvr2_hdw_commit_ctl(struct pvr2_hdw *);
159
160
161
162unsigned int pvr2_hdw_get_input_available(struct pvr2_hdw *);
163
164
165
166unsigned int pvr2_hdw_get_input_allowed(struct pvr2_hdw *);
167
168
169
170
171
172
173int pvr2_hdw_set_input_allowed(struct pvr2_hdw *,
174 unsigned int change_mask,
175 unsigned int change_val);
176
177
178const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *);
179
180
181void pvr2_hdw_execute_tuner_poll(struct pvr2_hdw *);
182
183
184int pvr2_hdw_get_tuner_status(struct pvr2_hdw *,struct v4l2_tuner *);
185
186
187int pvr2_hdw_get_cropcap(struct pvr2_hdw *, struct v4l2_cropcap *);
188
189
190int pvr2_hdw_is_hsm(struct pvr2_hdw *);
191
192
193const char *pvr2_hdw_get_type(struct pvr2_hdw *);
194
195
196const char *pvr2_hdw_get_desc(struct pvr2_hdw *);
197
198
199int pvr2_hdw_set_streaming(struct pvr2_hdw *,int);
200
201
202int pvr2_hdw_get_streaming(struct pvr2_hdw *);
203
204
205int pvr2_hdw_get_state(struct pvr2_hdw *);
206
207
208int pvr2_hdw_set_stream_type(struct pvr2_hdw *, enum pvr2_config);
209
210
211struct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *);
212
213
214int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw,struct v4l2_standard *std,
215 unsigned int idx);
216
217
218
219
220
221void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *,
222 int prom_flag,
223 int enable_flag);
224
225
226int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *);
227
228
229
230
231int pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs,
232 char *buf,unsigned int cnt);
233
234
235int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index);
236
237
238void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
239 enum pvr2_v4l_type index,int);
240
241
242
243
244
245
246int pvr2_hdw_register_access(struct pvr2_hdw *,
247 struct v4l2_dbg_match *match, u64 reg_id,
248 int setFl, u64 *val_ptr);
249
250
251
252
253
254
255int pvr2_send_request(struct pvr2_hdw *,
256 void *write_ptr,unsigned int write_len,
257 void *read_ptr,unsigned int read_len);
258
259
260int pvr2_write_register(struct pvr2_hdw *, u16, u32);
261
262
263
264void pvr2_hdw_render_useless(struct pvr2_hdw *);
265
266
267void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int);
268
269
270void pvr2_hdw_device_reset(struct pvr2_hdw *);
271
272
273int pvr2_hdw_untrip(struct pvr2_hdw *);
274
275
276
277
278int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *);
279
280
281int pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
282
283
284int pvr2_hdw_cmd_powerdown(struct pvr2_hdw *);
285
286
287int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);
288
289
290int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *);
291int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *);
292int pvr2_hdw_gpio_get_in(struct pvr2_hdw *hdw,u32 *);
293int pvr2_hdw_gpio_chg_dir(struct pvr2_hdw *hdw,u32 msk,u32 val);
294int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val);
295
296
297struct pvr2_hdw_debug_info {
298 int big_lock_held;
299 int ctl_lock_held;
300 int flag_disconnected;
301 int flag_init_ok;
302 int flag_ok;
303 int fw1_state;
304 int flag_decoder_missed;
305 int flag_tripped;
306 int state_encoder_ok;
307 int state_encoder_run;
308 int state_decoder_run;
309 int state_usbstream_run;
310 int state_decoder_quiescent;
311 int state_pipeline_config;
312 int state_pipeline_req;
313 int state_pipeline_pause;
314 int state_pipeline_idle;
315 int cmd_debug_state;
316 int cmd_debug_write_len;
317 int cmd_debug_read_len;
318 int cmd_debug_write_pend;
319 int cmd_debug_read_pend;
320 int cmd_debug_timeout;
321 int cmd_debug_rstatus;
322 int cmd_debug_wstatus;
323 unsigned char cmd_code;
324};
325
326
327
328
329
330void pvr2_hdw_get_debug_info_unlocked(const struct pvr2_hdw *hdw,
331 struct pvr2_hdw_debug_info *);
332
333
334
335
336
337void pvr2_hdw_get_debug_info_locked(struct pvr2_hdw *hdw,
338 struct pvr2_hdw_debug_info *);
339
340
341
342unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
343 char *buf_ptr,unsigned int buf_size);
344
345
346void pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw);
347
348
349
350
351int pvr2_upload_firmware2(struct pvr2_hdw *hdw);
352
353#endif
354
355
356
357
358
359
360
361
362
363
364