1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef __PVRUSB2_HDW_H
17#define __PVRUSB2_HDW_H
18
19#include <linux/usb.h>
20#include <linux/videodev2.h>
21#include <media/v4l2-dev.h>
22#include "pvrusb2-io.h"
23#include "pvrusb2-ctrl.h"
24
25
26
27
28#define PVR2_CID_STDCUR 2
29#define PVR2_CID_STDAVAIL 3
30#define PVR2_CID_INPUT 4
31#define PVR2_CID_AUDIOMODE 5
32#define PVR2_CID_FREQUENCY 6
33#define PVR2_CID_HRES 7
34#define PVR2_CID_VRES 8
35#define PVR2_CID_CROPL 9
36#define PVR2_CID_CROPT 10
37#define PVR2_CID_CROPW 11
38#define PVR2_CID_CROPH 12
39#define PVR2_CID_CROPCAPPAN 13
40#define PVR2_CID_CROPCAPPAD 14
41#define PVR2_CID_CROPCAPBL 15
42#define PVR2_CID_CROPCAPBT 16
43#define PVR2_CID_CROPCAPBW 17
44#define PVR2_CID_CROPCAPBH 18
45#define PVR2_CID_STDDETECT 19
46
47
48#define PVR2_CVAL_INPUT_TV 0
49#define PVR2_CVAL_INPUT_DTV 1
50#define PVR2_CVAL_INPUT_COMPOSITE 2
51#define PVR2_CVAL_INPUT_SVIDEO 3
52#define PVR2_CVAL_INPUT_RADIO 4
53
54enum pvr2_config {
55 pvr2_config_empty,
56 pvr2_config_mpeg,
57 pvr2_config_vbi,
58 pvr2_config_pcm,
59 pvr2_config_rawvideo,
60};
61
62enum pvr2_v4l_type {
63 pvr2_v4l_type_video,
64 pvr2_v4l_type_vbi,
65 pvr2_v4l_type_radio,
66};
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89#define PVR2_STATE_NONE 0
90#define PVR2_STATE_DEAD 1
91#define PVR2_STATE_COLD 2
92#define PVR2_STATE_WARM 3
93#define PVR2_STATE_ERROR 4
94#define PVR2_STATE_READY 5
95#define PVR2_STATE_RUN 6
96
97
98const char *pvr2_config_get_name(enum pvr2_config);
99
100struct pvr2_hdw;
101
102
103
104struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
105 const struct usb_device_id *devid);
106
107
108
109int pvr2_hdw_initialize(struct pvr2_hdw *,
110 void (*callback_func)(void *),
111 void *callback_data);
112
113
114void pvr2_hdw_destroy(struct pvr2_hdw *);
115
116
117int pvr2_hdw_dev_ok(struct pvr2_hdw *);
118
119
120
121int pvr2_hdw_get_unit_number(struct pvr2_hdw *);
122
123
124struct usb_device *pvr2_hdw_get_dev(struct pvr2_hdw *);
125
126
127unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *);
128
129
130const char *pvr2_hdw_get_bus_info(struct pvr2_hdw *);
131
132
133const char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *);
134
135
136void pvr2_hdw_disconnect(struct pvr2_hdw *);
137
138
139void pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *, struct video_device *);
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
214
215
216
217void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *,
218 int mode,
219 int enable_flag);
220
221
222int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *);
223
224
225
226
227int pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs,
228 char *buf,unsigned int cnt);
229
230
231int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index);
232
233
234void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
235 enum pvr2_v4l_type index,int);
236
237
238
239
240
241
242int pvr2_send_request(struct pvr2_hdw *,
243 void *write_ptr,unsigned int write_len,
244 void *read_ptr,unsigned int read_len);
245
246
247int pvr2_write_register(struct pvr2_hdw *, u16, u32);
248
249
250
251void pvr2_hdw_render_useless(struct pvr2_hdw *);
252
253
254void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int);
255
256
257void pvr2_hdw_device_reset(struct pvr2_hdw *);
258
259
260int pvr2_hdw_untrip(struct pvr2_hdw *);
261
262
263
264
265int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *);
266
267
268int pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
269
270
271int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);
272
273
274int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *);
275int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *);
276int pvr2_hdw_gpio_get_in(struct pvr2_hdw *hdw,u32 *);
277int pvr2_hdw_gpio_chg_dir(struct pvr2_hdw *hdw,u32 msk,u32 val);
278int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val);
279
280
281struct pvr2_hdw_debug_info {
282 int big_lock_held;
283 int ctl_lock_held;
284 int flag_disconnected;
285 int flag_init_ok;
286 int flag_ok;
287 int fw1_state;
288 int flag_decoder_missed;
289 int flag_tripped;
290 int state_encoder_ok;
291 int state_encoder_run;
292 int state_decoder_run;
293 int state_decoder_ready;
294 int state_usbstream_run;
295 int state_decoder_quiescent;
296 int state_pipeline_config;
297 int state_pipeline_req;
298 int state_pipeline_pause;
299 int state_pipeline_idle;
300 int cmd_debug_state;
301 int cmd_debug_write_len;
302 int cmd_debug_read_len;
303 int cmd_debug_write_pend;
304 int cmd_debug_read_pend;
305 int cmd_debug_timeout;
306 int cmd_debug_rstatus;
307 int cmd_debug_wstatus;
308 unsigned char cmd_code;
309};
310
311
312
313
314
315void pvr2_hdw_get_debug_info_unlocked(const struct pvr2_hdw *hdw,
316 struct pvr2_hdw_debug_info *);
317
318
319
320
321
322void pvr2_hdw_get_debug_info_locked(struct pvr2_hdw *hdw,
323 struct pvr2_hdw_debug_info *);
324
325
326
327unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
328 char *buf_ptr,unsigned int buf_size);
329
330
331void pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw);
332
333
334
335
336int pvr2_upload_firmware2(struct pvr2_hdw *hdw);
337
338#endif
339