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