aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision/usbvision.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/usbvision/usbvision.h')
-rw-r--r--drivers/media/video/usbvision/usbvision.h47
1 files changed, 24 insertions, 23 deletions
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h
index 514115930b4a..8074787fd1ac 100644
--- a/drivers/media/video/usbvision/usbvision.h
+++ b/drivers/media/video/usbvision/usbvision.h
@@ -139,7 +139,7 @@
139#define MAX_USB_HEIGHT 240 /* 288 */ 139#define MAX_USB_HEIGHT 240 /* 288 */
140#define MAX_FRAME_HEIGHT 240 /* 288 */ /* Streching sometimes causes crashes*/ 140#define MAX_FRAME_HEIGHT 240 /* 288 */ /* Streching sometimes causes crashes*/
141 141
142#define MAX_FRAME_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * MAX_BYTES_PER_PIXEL) 142#define MAX_FRAME_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * MAX_BYTES_PER_PIXEL)
143#define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) /* bytesize of clipmask */ 143#define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) /* bytesize of clipmask */
144 144
145#define USBVISION_URB_FRAMES 32 145#define USBVISION_URB_FRAMES 32
@@ -148,7 +148,7 @@
148#define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ 148#define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */
149#define USBVISION_NUMSBUF 2 /* Dimensioning the USB S buffering */ 149#define USBVISION_NUMSBUF 2 /* Dimensioning the USB S buffering */
150 150
151#define USBVISION_POWEROFF_TIME 3 * (HZ) /* 3 seconds */ 151#define USBVISION_POWEROFF_TIME (3 * HZ) /* 3 seconds */
152 152
153 153
154#define FRAMERATE_MIN 0 154#define FRAMERATE_MIN 0
@@ -161,7 +161,8 @@ enum {
161}; 161};
162 162
163/* This macro restricts an int variable to an inclusive range */ 163/* This macro restricts an int variable to an inclusive range */
164#define RESTRICT_TO_RANGE(v,mi,ma) { if ((v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); } 164#define RESTRICT_TO_RANGE(v, mi, ma) \
165 { if ((v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); }
165 166
166/* 167/*
167 * We use macros to do YUV -> RGB conversion because this is 168 * We use macros to do YUV -> RGB conversion because this is
@@ -183,18 +184,18 @@ enum {
183 * Make sure the output values are within [0..255] range. 184 * Make sure the output values are within [0..255] range.
184 */ 185 */
185#define LIMIT_RGB(x) (((x) < 0) ? 0 : (((x) > 255) ? 255 : (x))) 186#define LIMIT_RGB(x) (((x) < 0) ? 0 : (((x) > 255) ? 255 : (x)))
186#define YUV_TO_RGB_BY_THE_BOOK(my,mu,mv,mr,mg,mb) { \ 187#define YUV_TO_RGB_BY_THE_BOOK(my, mu, mv, mr, mg, mb) { \
187 int mm_y, mm_yc, mm_u, mm_v, mm_r, mm_g, mm_b; \ 188 int mm_y, mm_yc, mm_u, mm_v, mm_r, mm_g, mm_b; \
188 mm_y = (my) - 16; \ 189 mm_y = (my) - 16; \
189 mm_u = (mu) - 128; \ 190 mm_u = (mu) - 128; \
190 mm_v = (mv) - 128; \ 191 mm_v = (mv) - 128; \
191 mm_yc= mm_y * 76284; \ 192 mm_yc = mm_y * 76284; \
192 mm_b = (mm_yc + 132252*mm_v ) >> 16; \ 193 mm_b = (mm_yc + 132252 * mm_v) >> 16; \
193 mm_g = (mm_yc - 53281*mm_u - 25625*mm_v ) >> 16; \ 194 mm_g = (mm_yc - 53281 * mm_u - 25625 * mm_v) >> 16; \
194 mm_r = (mm_yc + 104595*mm_u ) >> 16; \ 195 mm_r = (mm_yc + 104595 * mm_u) >> 16; \
195 mb = LIMIT_RGB(mm_b); \ 196 mb = LIMIT_RGB(mm_b); \
196 mg = LIMIT_RGB(mm_g); \ 197 mg = LIMIT_RGB(mm_g); \
197 mr = LIMIT_RGB(mm_r); \ 198 mr = LIMIT_RGB(mm_r); \
198} 199}
199 200
200/* Debugging aid */ 201/* Debugging aid */
@@ -202,7 +203,7 @@ enum {
202 wait_queue_head_t wq; \ 203 wait_queue_head_t wq; \
203 init_waitqueue_head(&wq); \ 204 init_waitqueue_head(&wq); \
204 printk(KERN_INFO "Say: %s\n", what); \ 205 printk(KERN_INFO "Say: %s\n", what); \
205 interruptible_sleep_on_timeout (&wq, HZ*3); \ 206 interruptible_sleep_on_timeout(&wq, HZ * 3); \
206} 207}
207 208
208/* 209/*
@@ -265,8 +266,8 @@ struct usbvision_sbuf {
265 struct urb *urb; 266 struct urb *urb;
266}; 267};
267 268
268#define USBVISION_MAGIC_1 0x55 269#define USBVISION_MAGIC_1 0x55
269#define USBVISION_MAGIC_2 0xAA 270#define USBVISION_MAGIC_2 0xAA
270#define USBVISION_HEADER_LENGTH 0x0c 271#define USBVISION_HEADER_LENGTH 0x0c
271#define USBVISION_SAA7111_ADDR 0x48 272#define USBVISION_SAA7111_ADDR 0x48
272#define USBVISION_SAA7113_ADDR 0x4a 273#define USBVISION_SAA7113_ADDR 0x4a
@@ -358,8 +359,8 @@ extern struct usb_device_id usbvision_table[];
358 359
359struct usb_usbvision { 360struct usb_usbvision {
360 struct v4l2_device v4l2_dev; 361 struct v4l2_device v4l2_dev;
361 struct video_device *vdev; /* Video Device */ 362 struct video_device *vdev; /* Video Device */
362 struct video_device *rdev; /* Radio Device */ 363 struct video_device *rdev; /* Radio Device */
363 364
364 /* i2c Declaration Section*/ 365 /* i2c Declaration Section*/
365 struct i2c_adapter i2c_adap; 366 struct i2c_adapter i2c_adap;
@@ -401,7 +402,7 @@ struct usb_usbvision {
401 enum stream_state streaming; /* Are we streaming Isochronous? */ 402 enum stream_state streaming; /* Are we streaming Isochronous? */
402 int last_error; /* What calamity struck us? */ 403 int last_error; /* What calamity struck us? */
403 int curwidth; /* width of the frame the device is currently set to*/ 404 int curwidth; /* width of the frame the device is currently set to*/
404 int curheight; /* height of the frame the device is currently set to*/ 405 int curheight; /* height of the frame the device is currently set to*/
405 int stretch_width; /* stretch-factor for frame width (from usb to screen)*/ 406 int stretch_width; /* stretch-factor for frame width (from usb to screen)*/
406 int stretch_height; /* stretch-factor for frame height (from usb to screen)*/ 407 int stretch_height; /* stretch-factor for frame height (from usb to screen)*/
407 char *fbuf; /* Videodev buffer area for mmap*/ 408 char *fbuf; /* Videodev buffer area for mmap*/
@@ -434,7 +435,7 @@ struct usb_usbvision {
434 435
435 /* Decompression stuff: */ 436 /* Decompression stuff: */
436 unsigned char *intra_frame_buffer; /* Buffer for reference frame */ 437 unsigned char *intra_frame_buffer; /* Buffer for reference frame */
437 int block_pos; /* for test only */ 438 int block_pos; /* for test only */
438 int request_intra; /* 0 = normal; 1 = intra frame is requested; */ 439 int request_intra; /* 0 = normal; 1 = intra frame is requested; */
439 int last_isoc_frame_num; /* check for lost isoc frames */ 440 int last_isoc_frame_num; /* check for lost isoc frames */
440 int isoc_packet_size; /* need to calculate used_bandwidth */ 441 int isoc_packet_size; /* need to calculate used_bandwidth */
@@ -494,7 +495,7 @@ void usbvision_scratch_free(struct usb_usbvision *usbvision);
494int usbvision_decompress_alloc(struct usb_usbvision *usbvision); 495int usbvision_decompress_alloc(struct usb_usbvision *usbvision);
495void usbvision_decompress_free(struct usb_usbvision *usbvision); 496void usbvision_decompress_free(struct usb_usbvision *usbvision);
496 497
497int usbvision_setup(struct usb_usbvision *usbvision,int format); 498int usbvision_setup(struct usb_usbvision *usbvision, int format);
498int usbvision_init_isoc(struct usb_usbvision *usbvision); 499int usbvision_init_isoc(struct usb_usbvision *usbvision);
499int usbvision_restart_isoc(struct usb_usbvision *usbvision); 500int usbvision_restart_isoc(struct usb_usbvision *usbvision);
500void usbvision_stop_isoc(struct usb_usbvision *usbvision); 501void usbvision_stop_isoc(struct usb_usbvision *usbvision);