diff options
author | Thierry MERLE <thierry.merle@free.fr> | 2006-12-04 06:31:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:05:45 -0500 |
commit | f2242ee5474f46d87a45cd4e214b5c3aa02ff293 (patch) | |
tree | 38d7eff61756058d6bec246b672effb0f0f0c04c /drivers/media/video/usbvision/usbvision.h | |
parent | 18d8a4540caddaa9a42fb4dbc04c75c4b806278b (diff) |
V4L/DVB (4927): Enhancements on usbvision driver
Enhance the buffer management of this driver + some corrections
- linux list.h usage for buffer management
- VIDIOC_ENUMSTD/VIDIOC_G_STD/VIDIOC_S_STD simplification (use of
v4l2_video_std_construct)
- create_sysfs : remove of warnings for video_device_create_file return code
- make the driver compatible with 2.6.19 kernel version (remove
slave_send and slave_recv in usbvision-i2c, change ctrlUrb_complete
function prototype)
- deactivated v4l2_read because this code was not the priority but
working on it :)
Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvision/usbvision.h')
-rw-r--r-- | drivers/media/video/usbvision/usbvision.h | 91 |
1 files changed, 59 insertions, 32 deletions
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index 813b258f89c7..870c0cc81d84 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * USBVISION.H | 2 | * USBVISION.H |
3 | * usbvision header file | 3 | * usbvision header file |
4 | * | 4 | * |
@@ -38,7 +38,7 @@ | |||
38 | #define USBVISION_SSPND_EN (1 << 1) | 38 | #define USBVISION_SSPND_EN (1 << 1) |
39 | #define USBVISION_RES2 (1 << 2) | 39 | #define USBVISION_RES2 (1 << 2) |
40 | #define USBVISION_PWR_VID (1 << 5) | 40 | #define USBVISION_PWR_VID (1 << 5) |
41 | #define USBVISION_E2_EN (1 << 7) | 41 | #define USBVISION_E2_EN (1 << 7) |
42 | #define USBVISION_CONFIG_REG 0x01 | 42 | #define USBVISION_CONFIG_REG 0x01 |
43 | #define USBVISION_ADRS_REG 0x02 | 43 | #define USBVISION_ADRS_REG 0x02 |
44 | #define USBVISION_ALTER_REG 0x03 | 44 | #define USBVISION_ALTER_REG 0x03 |
@@ -139,7 +139,7 @@ | |||
139 | #define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023 | 139 | #define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023 |
140 | 140 | ||
141 | #define USBVISION_NUM_HEADERMARKER 20 | 141 | #define USBVISION_NUM_HEADERMARKER 20 |
142 | #define USBVISION_NUMFRAMES 2 | 142 | #define USBVISION_NUMFRAMES 3 |
143 | #define USBVISION_NUMSBUF 2 | 143 | #define USBVISION_NUMSBUF 2 |
144 | 144 | ||
145 | #define USBVISION_POWEROFF_TIME 3 * (HZ) // 3 seconds | 145 | #define USBVISION_POWEROFF_TIME 3 * (HZ) // 3 seconds |
@@ -225,6 +225,13 @@ enum FrameState { | |||
225 | FrameState_Error, /* Something bad happened while processing */ | 225 | FrameState_Error, /* Something bad happened while processing */ |
226 | }; | 226 | }; |
227 | 227 | ||
228 | /* stream states */ | ||
229 | enum StreamState { | ||
230 | Stream_Off, | ||
231 | Stream_Interrupt, | ||
232 | Stream_On, | ||
233 | }; | ||
234 | |||
228 | enum IsocState { | 235 | enum IsocState { |
229 | IsocState_InFrame, /* Isoc packet is member of frame */ | 236 | IsocState_InFrame, /* Isoc packet is member of frame */ |
230 | IsocState_NoFrame, /* Isoc packet is not member of any frame */ | 237 | IsocState_NoFrame, /* Isoc packet is not member of any frame */ |
@@ -272,27 +279,36 @@ struct usbvision_frame_header { | |||
272 | __u16 frameHeight; /* 10 - 11 after endian correction*/ | 279 | __u16 frameHeight; /* 10 - 11 after endian correction*/ |
273 | }; | 280 | }; |
274 | 281 | ||
282 | /* tvnorms */ | ||
283 | struct usbvision_tvnorm { | ||
284 | char *name; | ||
285 | v4l2_std_id id; | ||
286 | /* mode for saa7113h */ | ||
287 | int mode; | ||
288 | }; | ||
289 | |||
275 | struct usbvision_frame { | 290 | struct usbvision_frame { |
276 | char *data; /* Frame buffer */ | 291 | char *data; /* Frame buffer */ |
277 | struct usbvision_frame_header isocHeader; /* Header from stream */ | 292 | struct usbvision_frame_header isocHeader; /* Header from stream */ |
278 | 293 | ||
279 | int width; /* Width application is expecting */ | 294 | int width; /* Width application is expecting */ |
280 | int height; /* Height */ | 295 | int height; /* Height */ |
281 | 296 | int index; /* Frame index */ | |
282 | int frmwidth; /* Width the frame actually is */ | 297 | int frmwidth; /* Width the frame actually is */ |
283 | int frmheight; /* Height */ | 298 | int frmheight; /* Height */ |
284 | 299 | ||
285 | volatile int grabstate; /* State of grabbing */ | 300 | volatile int grabstate; /* State of grabbing */ |
286 | int scanstate; /* State of scanning */ | 301 | int scanstate; /* State of scanning */ |
287 | 302 | ||
303 | struct list_head frame; | ||
304 | |||
288 | int curline; /* Line of frame we're working on */ | 305 | int curline; /* Line of frame we're working on */ |
289 | 306 | ||
290 | long scanlength; /* uncompressed, raw data length of frame */ | 307 | long scanlength; /* uncompressed, raw data length of frame */ |
291 | long bytes_read; /* amount of scanlength that has been read from data */ | 308 | long bytes_read; /* amount of scanlength that has been read from data */ |
292 | struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/ | 309 | struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/ |
293 | int v4l2_linesize; /* bytes for one videoline*/ | 310 | int v4l2_linesize; /* bytes for one videoline*/ |
294 | struct timeval timestamp; | 311 | struct timeval timestamp; |
295 | wait_queue_head_t wq; /* Processes waiting */ | ||
296 | int sequence; // How many video frames we send to user | 312 | int sequence; // How many video frames we send to user |
297 | }; | 313 | }; |
298 | 314 | ||
@@ -305,23 +321,23 @@ struct usbvision_frame { | |||
305 | #define USBVISION_I2C_CLIENTS_MAX 8 | 321 | #define USBVISION_I2C_CLIENTS_MAX 8 |
306 | 322 | ||
307 | struct usbvision_device_data_st { | 323 | struct usbvision_device_data_st { |
308 | int idVendor; | 324 | int idVendor; |
309 | int idProduct; | 325 | int idProduct; |
310 | int Interface; /* to handle special interface number like BELKIN and Hauppauge WinTV-USB II */ | 326 | int Interface; /* to handle special interface number like BELKIN and Hauppauge WinTV-USB II */ |
311 | int Codec; | 327 | int Codec; |
312 | int VideoChannels; | 328 | int VideoChannels; |
313 | __u64 VideoNorm; | 329 | __u64 VideoNorm; |
314 | int AudioChannels; | 330 | int AudioChannels; |
315 | int Radio; | 331 | int Radio; |
316 | int vbi; | 332 | int vbi; |
317 | int Tuner; | 333 | int Tuner; |
318 | int TunerType; | 334 | int TunerType; |
319 | int Vin_Reg1; | 335 | int Vin_Reg1; |
320 | int Vin_Reg2; | 336 | int Vin_Reg2; |
321 | int X_Offset; | 337 | int X_Offset; |
322 | int Y_Offset; | 338 | int Y_Offset; |
323 | int Dvi_yuv; | 339 | int Dvi_yuv; |
324 | char *ModelString; | 340 | char *ModelString; |
325 | }; | 341 | }; |
326 | 342 | ||
327 | /* Declared on usbvision-cards.c */ | 343 | /* Declared on usbvision-cards.c */ |
@@ -332,7 +348,7 @@ struct usb_usbvision { | |||
332 | struct video_device *vdev; /* Video Device */ | 348 | struct video_device *vdev; /* Video Device */ |
333 | struct video_device *rdev; /* Radio Device */ | 349 | struct video_device *rdev; /* Radio Device */ |
334 | struct video_device *vbi; /* VBI Device */ | 350 | struct video_device *vbi; /* VBI Device */ |
335 | struct video_audio audio_dev; /* Current audio params */ | 351 | struct video_audio audio_dev; /* Current audio params */ |
336 | 352 | ||
337 | /* i2c Declaration Section*/ | 353 | /* i2c Declaration Section*/ |
338 | struct i2c_adapter i2c_adap; | 354 | struct i2c_adapter i2c_adap; |
@@ -373,7 +389,7 @@ struct usb_usbvision { | |||
373 | int usbvision_used; /* Is this structure in use? */ | 389 | int usbvision_used; /* Is this structure in use? */ |
374 | int initialized; /* Had we already sent init sequence? */ | 390 | int initialized; /* Had we already sent init sequence? */ |
375 | int DevModel; /* What type of USBVISION device we got? */ | 391 | int DevModel; /* What type of USBVISION device we got? */ |
376 | int streaming; /* Are we streaming Isochronous? */ | 392 | enum StreamState streaming; /* Are we streaming Isochronous? */ |
377 | int last_error; /* What calamity struck us? */ | 393 | int last_error; /* What calamity struck us? */ |
378 | int curwidth; /* width of the frame the device is currently set to*/ | 394 | int curwidth; /* width of the frame the device is currently set to*/ |
379 | int curheight; /* height of the frame the device is currently set to*/ | 395 | int curheight; /* height of the frame the device is currently set to*/ |
@@ -382,7 +398,10 @@ struct usb_usbvision { | |||
382 | char *fbuf; /* Videodev buffer area for mmap*/ | 398 | char *fbuf; /* Videodev buffer area for mmap*/ |
383 | int max_frame_size; /* Bytes in one video frame */ | 399 | int max_frame_size; /* Bytes in one video frame */ |
384 | int fbuf_size; /* Videodev buffer size */ | 400 | int fbuf_size; /* Videodev buffer size */ |
385 | int curFrameNum; // number of current frame in frame buffer mode | 401 | spinlock_t queue_lock; /* spinlock for protecting mods on inqueue and outqueue */ |
402 | struct list_head inqueue, outqueue; /* queued frame list and ready to dequeue frame list */ | ||
403 | wait_queue_head_t wait_frame; /* Processes waiting */ | ||
404 | wait_queue_head_t wait_stream; /* Processes waiting */ | ||
386 | struct usbvision_frame *curFrame; // pointer to current frame, set by usbvision_find_header | 405 | struct usbvision_frame *curFrame; // pointer to current frame, set by usbvision_find_header |
387 | struct usbvision_frame frame[USBVISION_NUMFRAMES]; // frame buffer | 406 | struct usbvision_frame frame[USBVISION_NUMFRAMES]; // frame buffer |
388 | int curSbufNum; // number of current receiving sbuf | 407 | int curSbufNum; // number of current receiving sbuf |
@@ -397,20 +416,21 @@ struct usb_usbvision { | |||
397 | int scratch_headermarker_read_ptr; | 416 | int scratch_headermarker_read_ptr; |
398 | int scratch_headermarker_write_ptr; | 417 | int scratch_headermarker_write_ptr; |
399 | int isocstate; | 418 | int isocstate; |
400 | /* color controls */ | 419 | /* color controls */ |
401 | int saturation; | 420 | int saturation; |
402 | int hue; | 421 | int hue; |
403 | int brightness; | 422 | int brightness; |
404 | int contrast; | 423 | int contrast; |
405 | int depth; | 424 | int depth; |
406 | struct usbvision_v4l2_format_st palette; | 425 | struct usbvision_v4l2_format_st palette; |
407 | 426 | ||
408 | struct v4l2_capability vcap; /* Video capabilities */ | 427 | struct v4l2_capability vcap; /* Video capabilities */ |
409 | struct v4l2_input input; /* May be used for tuner support */ | 428 | unsigned int ctl_input; /* selected input */ |
429 | struct usbvision_tvnorm *tvnorm; /* selected tv norm */ | ||
410 | unsigned char video_endp; /* 0x82 for USBVISION devices based */ | 430 | unsigned char video_endp; /* 0x82 for USBVISION devices based */ |
411 | 431 | ||
412 | // Overlay stuff: | 432 | // Overlay stuff: |
413 | struct v4l2_framebuffer vid_buf; | 433 | struct v4l2_framebuffer vid_buf; |
414 | struct v4l2_format vid_win; | 434 | struct v4l2_format vid_win; |
415 | int vid_buf_valid; // Status: video buffer is valid (set) | 435 | int vid_buf_valid; // Status: video buffer is valid (set) |
416 | int vid_win_valid; // Status: video window is valid (set) | 436 | int vid_win_valid; // Status: video window is valid (set) |
@@ -435,8 +455,8 @@ struct usb_usbvision { | |||
435 | struct proc_dir_entry *proc_devdir; /* Per-device proc directory */ | 455 | struct proc_dir_entry *proc_devdir; /* Per-device proc directory */ |
436 | struct proc_dir_entry *proc_info; /* <minor#>/info entry */ | 456 | struct proc_dir_entry *proc_info; /* <minor#>/info entry */ |
437 | struct proc_dir_entry *proc_register; /* <minor#>/register entry */ | 457 | struct proc_dir_entry *proc_register; /* <minor#>/register entry */ |
438 | struct proc_dir_entry *proc_freq; /* <minor#>/freq entry */ | 458 | struct proc_dir_entry *proc_freq; /* <minor#>/freq entry */ |
439 | struct proc_dir_entry *proc_input; /* <minor#>/input entry */ | 459 | struct proc_dir_entry *proc_input; /* <minor#>/input entry */ |
440 | struct proc_dir_entry *proc_frame; /* <minor#>/frame entry */ | 460 | struct proc_dir_entry *proc_frame; /* <minor#>/frame entry */ |
441 | struct proc_dir_entry *proc_button; /* <minor#>/button entry */ | 461 | struct proc_dir_entry *proc_button; /* <minor#>/button entry */ |
442 | struct proc_dir_entry *proc_control; /* <minor#>/control entry */ | 462 | struct proc_dir_entry *proc_control; /* <minor#>/control entry */ |
@@ -463,3 +483,10 @@ struct usb_usbvision { | |||
463 | 483 | ||
464 | #endif /* __LINUX_USBVISION_H */ | 484 | #endif /* __LINUX_USBVISION_H */ |
465 | 485 | ||
486 | /* | ||
487 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
488 | * --------------------------------------------------------------------------- | ||
489 | * Local variables: | ||
490 | * c-basic-offset: 8 | ||
491 | * End: | ||
492 | */ | ||