Mauro Carvalho Chehab | d56410e | 2006-03-25 09:19:53 -0300 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * zoran - Iomega Buz driver |
| 3 | * |
| 4 | * Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> |
| 5 | * |
| 6 | * based on |
| 7 | * |
| 8 | * zoran.0.0.3 Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
| 9 | * |
| 10 | * and |
| 11 | * |
| 12 | * bttv - Bt848 frame grabber driver |
| 13 | * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) |
| 14 | * & Marcus Metzler (mocm@thp.uni-koeln.de) |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify |
| 17 | * it under the terms of the GNU General Public License as published by |
| 18 | * the Free Software Foundation; either version 2 of the License, or |
| 19 | * (at your option) any later version. |
| 20 | * |
| 21 | * This program is distributed in the hope that it will be useful, |
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 | * GNU General Public License for more details. |
| 25 | * |
| 26 | * You should have received a copy of the GNU General Public License |
| 27 | * along with this program; if not, write to the Free Software |
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 29 | */ |
| 30 | |
| 31 | #ifndef _BUZ_H_ |
| 32 | #define _BUZ_H_ |
| 33 | |
| 34 | struct zoran_requestbuffers { |
| 35 | unsigned long count; /* Number of buffers for MJPEG grabbing */ |
| 36 | unsigned long size; /* Size PER BUFFER in bytes */ |
| 37 | }; |
| 38 | |
| 39 | struct zoran_sync { |
| 40 | unsigned long frame; /* number of buffer that has been free'd */ |
| 41 | unsigned long length; /* number of code bytes in buffer (capture only) */ |
| 42 | unsigned long seq; /* frame sequence number */ |
| 43 | struct timeval timestamp; /* timestamp */ |
| 44 | }; |
| 45 | |
| 46 | struct zoran_status { |
| 47 | int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */ |
| 48 | int signal; /* Returned: 1 if valid video signal detected */ |
| 49 | int norm; /* Returned: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ |
| 50 | int color; /* Returned: 1 if color signal detected */ |
| 51 | }; |
| 52 | |
| 53 | struct zoran_params { |
| 54 | |
| 55 | /* The following parameters can only be queried */ |
| 56 | |
| 57 | int major_version; /* Major version number of driver */ |
| 58 | int minor_version; /* Minor version number of driver */ |
| 59 | |
| 60 | /* Main control parameters */ |
| 61 | |
| 62 | int input; /* Input channel: 0 = Composite, 1 = S-VHS */ |
| 63 | int norm; /* Norm: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ |
| 64 | int decimation; /* decimation of captured video, |
| 65 | * enlargement of video played back. |
| 66 | * Valid values are 1, 2, 4 or 0. |
| 67 | * 0 is a special value where the user |
| 68 | * has full control over video scaling */ |
| 69 | |
| 70 | /* The following parameters only have to be set if decimation==0, |
| 71 | * for other values of decimation they provide the data how the image is captured */ |
| 72 | |
| 73 | int HorDcm; /* Horizontal decimation: 1, 2 or 4 */ |
| 74 | int VerDcm; /* Vertical decimation: 1 or 2 */ |
| 75 | int TmpDcm; /* Temporal decimation: 1 or 2, |
| 76 | * if TmpDcm==2 in capture every second frame is dropped, |
| 77 | * in playback every frame is played twice */ |
| 78 | int field_per_buff; /* Number of fields per buffer: 1 or 2 */ |
| 79 | int img_x; /* start of image in x direction */ |
| 80 | int img_y; /* start of image in y direction */ |
| 81 | int img_width; /* image width BEFORE decimation, |
| 82 | * must be a multiple of HorDcm*16 */ |
| 83 | int img_height; /* image height BEFORE decimation, |
| 84 | * must be a multiple of VerDcm*8 */ |
| 85 | |
| 86 | /* --- End of parameters for decimation==0 only --- */ |
| 87 | |
| 88 | /* JPEG control parameters */ |
| 89 | |
| 90 | int quality; /* Measure for quality of compressed images. |
| 91 | * Scales linearly with the size of the compressed images. |
| 92 | * Must be beetween 0 and 100, 100 is a compression |
| 93 | * ratio of 1:4 */ |
| 94 | |
| 95 | int odd_even; /* Which field should come first ??? */ |
| 96 | |
| 97 | int APPn; /* Number of APP segment to be written, must be 0..15 */ |
| 98 | int APP_len; /* Length of data in JPEG APPn segment */ |
| 99 | char APP_data[60]; /* Data in the JPEG APPn segment. */ |
| 100 | |
| 101 | int COM_len; /* Length of data in JPEG COM segment */ |
| 102 | char COM_data[60]; /* Data in JPEG COM segment */ |
| 103 | |
| 104 | unsigned long jpeg_markers; /* Which markers should go into the JPEG output. |
| 105 | * Unless you exactly know what you do, leave them untouched. |
| 106 | * Inluding less markers will make the resulting code |
| 107 | * smaller, but there will be fewer aplications |
| 108 | * which can read it. |
| 109 | * The presence of the APP and COM marker is |
| 110 | * influenced by APP0_len and COM_len ONLY! */ |
| 111 | #define JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ |
| 112 | #define JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ |
| 113 | #define JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ |
| 114 | #define JPEG_MARKER_COM (1<<6) /* Comment segment */ |
| 115 | #define JPEG_MARKER_APP (1<<7) /* App segment, driver will allways use APP0 */ |
| 116 | |
| 117 | int VFIFO_FB; /* Flag for enabling Video Fifo Feedback. |
| 118 | * If this flag is turned on and JPEG decompressing |
| 119 | * is going to the screen, the decompress process |
| 120 | * is stopped every time the Video Fifo is full. |
| 121 | * This enables a smooth decompress to the screen |
| 122 | * but the video output signal will get scrambled */ |
| 123 | |
| 124 | /* Misc */ |
| 125 | |
| 126 | char reserved[312]; /* Makes 512 bytes for this structure */ |
| 127 | }; |
| 128 | |
| 129 | /* |
| 130 | Private IOCTL to set up for displaying MJPEG |
| 131 | */ |
| 132 | #define BUZIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct zoran_params) |
| 133 | #define BUZIOC_S_PARAMS _IOWR('v', BASE_VIDIOCPRIVATE+1, struct zoran_params) |
| 134 | #define BUZIOC_REQBUFS _IOWR('v', BASE_VIDIOCPRIVATE+2, struct zoran_requestbuffers) |
| 135 | #define BUZIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+3, int) |
| 136 | #define BUZIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOCPRIVATE+4, int) |
| 137 | #define BUZIOC_SYNC _IOR ('v', BASE_VIDIOCPRIVATE+5, struct zoran_sync) |
| 138 | #define BUZIOC_G_STATUS _IOWR('v', BASE_VIDIOCPRIVATE+6, struct zoran_status) |
| 139 | |
| 140 | |
| 141 | #ifdef __KERNEL__ |
| 142 | |
| 143 | #define MAJOR_VERSION 0 /* driver major version */ |
| 144 | #define MINOR_VERSION 9 /* driver minor version */ |
| 145 | #define RELEASE_VERSION 5 /* release version */ |
| 146 | |
| 147 | #define ZORAN_NAME "ZORAN" /* name of the device */ |
| 148 | |
| 149 | #define ZR_DEVNAME(zr) ((zr)->name) |
| 150 | |
| 151 | #define BUZ_MAX_WIDTH (zr->timing->Wa) |
| 152 | #define BUZ_MAX_HEIGHT (zr->timing->Ha) |
| 153 | #define BUZ_MIN_WIDTH 32 /* never display less than 32 pixels */ |
| 154 | #define BUZ_MIN_HEIGHT 24 /* never display less than 24 rows */ |
| 155 | |
| 156 | #define BUZ_NUM_STAT_COM 4 |
| 157 | #define BUZ_MASK_STAT_COM 3 |
| 158 | |
| 159 | #define BUZ_MAX_FRAME 256 /* Must be a power of 2 */ |
| 160 | #define BUZ_MASK_FRAME 255 /* Must be BUZ_MAX_FRAME-1 */ |
| 161 | |
| 162 | #define BUZ_MAX_INPUT 8 |
| 163 | |
| 164 | #if VIDEO_MAX_FRAME <= 32 |
| 165 | # define V4L_MAX_FRAME 32 |
| 166 | #elif VIDEO_MAX_FRAME <= 64 |
| 167 | # define V4L_MAX_FRAME 64 |
| 168 | #else |
| 169 | # error "Too many video frame buffers to handle" |
| 170 | #endif |
| 171 | #define V4L_MASK_FRAME (V4L_MAX_FRAME - 1) |
| 172 | |
| 173 | #define MAX_KMALLOC_MEM (128*1024) |
| 174 | |
| 175 | #include "zr36057.h" |
| 176 | |
| 177 | enum card_type { |
| 178 | UNKNOWN = -1, |
| 179 | |
| 180 | /* Pinnacle/Miro */ |
| 181 | DC10_old, /* DC30 like */ |
| 182 | DC10_new, /* DC10plus like */ |
| 183 | DC10plus, |
| 184 | DC30, |
| 185 | DC30plus, |
| 186 | |
| 187 | /* Linux Media Labs */ |
| 188 | LML33, |
| 189 | LML33R10, |
| 190 | |
| 191 | /* Iomega */ |
| 192 | BUZ, |
| 193 | |
| 194 | /* total number of cards */ |
| 195 | NUM_CARDS |
| 196 | }; |
| 197 | |
| 198 | enum zoran_codec_mode { |
| 199 | BUZ_MODE_IDLE, /* nothing going on */ |
| 200 | BUZ_MODE_MOTION_COMPRESS, /* grabbing frames */ |
| 201 | BUZ_MODE_MOTION_DECOMPRESS, /* playing frames */ |
| 202 | BUZ_MODE_STILL_COMPRESS, /* still frame conversion */ |
| 203 | BUZ_MODE_STILL_DECOMPRESS /* still frame conversion */ |
| 204 | }; |
| 205 | |
| 206 | enum zoran_buffer_state { |
| 207 | BUZ_STATE_USER, /* buffer is owned by application */ |
| 208 | BUZ_STATE_PEND, /* buffer is queued in pend[] ready to feed to I/O */ |
| 209 | BUZ_STATE_DMA, /* buffer is queued in dma[] for I/O */ |
| 210 | BUZ_STATE_DONE /* buffer is ready to return to application */ |
| 211 | }; |
| 212 | |
| 213 | enum zoran_map_mode { |
| 214 | ZORAN_MAP_MODE_RAW, |
| 215 | ZORAN_MAP_MODE_JPG_REC, |
| 216 | #define ZORAN_MAP_MODE_JPG ZORAN_MAP_MODE_JPG_REC |
| 217 | ZORAN_MAP_MODE_JPG_PLAY, |
| 218 | }; |
| 219 | |
| 220 | enum gpio_type { |
| 221 | GPIO_JPEG_SLEEP = 0, |
| 222 | GPIO_JPEG_RESET, |
| 223 | GPIO_JPEG_FRAME, |
| 224 | GPIO_VID_DIR, |
| 225 | GPIO_VID_EN, |
| 226 | GPIO_VID_RESET, |
| 227 | GPIO_CLK_SEL1, |
| 228 | GPIO_CLK_SEL2, |
| 229 | GPIO_MAX, |
| 230 | }; |
| 231 | |
| 232 | enum gpcs_type { |
| 233 | GPCS_JPEG_RESET = 0, |
| 234 | GPCS_JPEG_START, |
| 235 | GPCS_MAX, |
| 236 | }; |
| 237 | |
| 238 | struct zoran_format { |
| 239 | char *name; |
| 240 | int palette; |
| 241 | __u32 fourcc; |
| 242 | int colorspace; |
| 243 | int depth; |
| 244 | __u32 flags; |
| 245 | }; |
| 246 | /* flags */ |
| 247 | #define ZORAN_FORMAT_COMPRESSED 1<<0 |
| 248 | #define ZORAN_FORMAT_OVERLAY 1<<1 |
| 249 | #define ZORAN_FORMAT_CAPTURE 1<<2 |
| 250 | #define ZORAN_FORMAT_PLAYBACK 1<<3 |
| 251 | |
| 252 | /* overlay-settings */ |
| 253 | struct zoran_overlay_settings { |
| 254 | int is_set; |
| 255 | int x, y, width, height; /* position */ |
| 256 | int clipcount; /* position and number of clips */ |
| 257 | const struct zoran_format *format; /* overlay format */ |
| 258 | }; |
| 259 | |
| 260 | /* v4l-capture settings */ |
| 261 | struct zoran_v4l_settings { |
| 262 | int width, height, bytesperline; /* capture size */ |
| 263 | const struct zoran_format *format; /* capture format */ |
| 264 | }; |
| 265 | |
| 266 | /* whoops, this one is undeclared if !v4l2 */ |
| 267 | #ifndef HAVE_V4L2 |
| 268 | struct v4l2_jpegcompression { |
| 269 | int quality; |
| 270 | int APPn; |
| 271 | int APP_len; |
| 272 | char APP_data[60]; |
| 273 | int COM_len; |
| 274 | char COM_data[60]; |
| 275 | __u32 jpeg_markers; |
| 276 | __u8 reserved[116]; |
| 277 | }; |
| 278 | #endif |
| 279 | |
| 280 | /* jpg-capture/-playback settings */ |
| 281 | struct zoran_jpg_settings { |
| 282 | int decimation; /* this bit is used to set everything to default */ |
| 283 | int HorDcm, VerDcm, TmpDcm; /* capture decimation settings (TmpDcm=1 means both fields) */ |
| 284 | int field_per_buff, odd_even; /* field-settings (odd_even=1 (+TmpDcm=1) means top-field-first) */ |
| 285 | int img_x, img_y, img_width, img_height; /* crop settings (subframe capture) */ |
| 286 | struct v4l2_jpegcompression jpg_comp; /* JPEG-specific capture settings */ |
| 287 | }; |
| 288 | |
| 289 | struct zoran_mapping { |
| 290 | struct file *file; |
| 291 | int count; |
| 292 | }; |
| 293 | |
| 294 | struct zoran_jpg_buffer { |
| 295 | struct zoran_mapping *map; |
| 296 | u32 *frag_tab; /* addresses of frag table */ |
| 297 | u32 frag_tab_bus; /* same value cached to save time in ISR */ |
| 298 | enum zoran_buffer_state state; /* non-zero if corresponding buffer is in use in grab queue */ |
| 299 | struct zoran_sync bs; /* DONE: info to return to application */ |
| 300 | }; |
| 301 | |
| 302 | struct zoran_v4l_buffer { |
| 303 | struct zoran_mapping *map; |
| 304 | char *fbuffer; /* virtual address of frame buffer */ |
| 305 | unsigned long fbuffer_phys; /* physical address of frame buffer */ |
| 306 | unsigned long fbuffer_bus; /* bus address of frame buffer */ |
| 307 | enum zoran_buffer_state state; /* state: unused/pending/done */ |
| 308 | struct zoran_sync bs; /* DONE: info to return to application */ |
| 309 | }; |
| 310 | |
| 311 | enum zoran_lock_activity { |
| 312 | ZORAN_FREE, /* free for use */ |
| 313 | ZORAN_ACTIVE, /* active but unlocked */ |
| 314 | ZORAN_LOCKED, /* locked */ |
| 315 | }; |
| 316 | |
| 317 | /* buffer collections */ |
| 318 | struct zoran_jpg_struct { |
| 319 | enum zoran_lock_activity active; /* feature currently in use? */ |
| 320 | struct zoran_jpg_buffer buffer[BUZ_MAX_FRAME]; /* buffers */ |
| 321 | int num_buffers, buffer_size; |
| 322 | u8 allocated; /* Flag if buffers are allocated */ |
| 323 | u8 ready_to_be_freed; /* hack - see zoran_driver.c */ |
| 324 | u8 need_contiguous; /* Flag if contiguous buffers are needed */ |
| 325 | }; |
| 326 | |
| 327 | struct zoran_v4l_struct { |
| 328 | enum zoran_lock_activity active; /* feature currently in use? */ |
| 329 | struct zoran_v4l_buffer buffer[VIDEO_MAX_FRAME]; /* buffers */ |
| 330 | int num_buffers, buffer_size; |
| 331 | u8 allocated; /* Flag if buffers are allocated */ |
| 332 | u8 ready_to_be_freed; /* hack - see zoran_driver.c */ |
| 333 | }; |
| 334 | |
| 335 | struct zoran; |
| 336 | |
| 337 | /* zoran_fh contains per-open() settings */ |
| 338 | struct zoran_fh { |
| 339 | struct zoran *zr; |
| 340 | |
| 341 | enum zoran_map_mode map_mode; /* Flag which bufferset will map by next mmap() */ |
| 342 | |
| 343 | struct zoran_overlay_settings overlay_settings; |
| 344 | u32 *overlay_mask; /* overlay mask */ |
| 345 | enum zoran_lock_activity overlay_active; /* feature currently in use? */ |
| 346 | |
| 347 | struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */ |
| 348 | struct zoran_v4l_struct v4l_buffers; /* V4L buffers' info */ |
| 349 | |
| 350 | struct zoran_jpg_settings jpg_settings; /* structure with a lot of things to play with */ |
| 351 | struct zoran_jpg_struct jpg_buffers; /* MJPEG buffers' info */ |
| 352 | }; |
| 353 | |
| 354 | struct card_info { |
| 355 | enum card_type type; |
| 356 | char name[32]; |
| 357 | u16 i2c_decoder, i2c_encoder; /* I2C types */ |
| 358 | u16 video_vfe, video_codec; /* videocodec types */ |
| 359 | u16 audio_chip; /* audio type */ |
| 360 | u16 vendor_id, device_id; /* subsystem vendor/device ID */ |
| 361 | |
| 362 | int inputs; /* number of video inputs */ |
| 363 | struct input { |
| 364 | int muxsel; |
| 365 | char name[32]; |
| 366 | } input[BUZ_MAX_INPUT]; |
| 367 | |
| 368 | int norms; |
| 369 | struct tvnorm *tvn[3]; /* supported TV norms */ |
| 370 | |
| 371 | u32 jpeg_int; /* JPEG interrupt */ |
| 372 | u32 vsync_int; /* VSYNC interrupt */ |
| 373 | s8 gpio[GPIO_MAX]; |
| 374 | u8 gpcs[GPCS_MAX]; |
| 375 | |
| 376 | struct vfe_polarity vfe_pol; |
| 377 | u8 gpio_pol[GPIO_MAX]; |
| 378 | |
| 379 | /* is the /GWS line conected? */ |
| 380 | u8 gws_not_connected; |
| 381 | |
| 382 | void (*init) (struct zoran * zr); |
| 383 | }; |
| 384 | |
| 385 | struct zoran { |
| 386 | struct video_device *video_dev; |
| 387 | |
| 388 | struct i2c_adapter i2c_adapter; /* */ |
| 389 | struct i2c_algo_bit_data i2c_algo; /* */ |
| 390 | u32 i2cbr; |
| 391 | |
| 392 | struct i2c_client *decoder; /* video decoder i2c client */ |
| 393 | struct i2c_client *encoder; /* video encoder i2c client */ |
| 394 | |
| 395 | struct videocodec *codec; /* video codec */ |
| 396 | struct videocodec *vfe; /* video front end */ |
| 397 | |
Ingo Molnar | 384c368 | 2006-03-22 03:54:16 -0300 | [diff] [blame] | 398 | struct mutex resource_lock; /* prevent evil stuff */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | |
| 400 | u8 initialized; /* flag if zoran has been correctly initalized */ |
| 401 | int user; /* number of current users */ |
| 402 | struct card_info card; |
| 403 | struct tvnorm *timing; |
| 404 | |
| 405 | unsigned short id; /* number of this device */ |
| 406 | char name[32]; /* name of this device */ |
| 407 | struct pci_dev *pci_dev; /* PCI device */ |
| 408 | unsigned char revision; /* revision of zr36057 */ |
| 409 | unsigned int zr36057_adr; /* bus address of IO mem returned by PCI BIOS */ |
| 410 | unsigned char __iomem *zr36057_mem;/* pointer to mapped IO memory */ |
| 411 | |
| 412 | spinlock_t spinlock; /* Spinlock */ |
| 413 | |
| 414 | /* Video for Linux parameters */ |
| 415 | int input, norm; /* card's norm and input - norm=VIDEO_MODE_* */ |
| 416 | int hue, saturation, contrast, brightness; /* Current picture params */ |
| 417 | struct video_buffer buffer; /* Current buffer params */ |
| 418 | struct zoran_overlay_settings overlay_settings; |
| 419 | u32 *overlay_mask; /* overlay mask */ |
| 420 | enum zoran_lock_activity overlay_active; /* feature currently in use? */ |
| 421 | |
| 422 | wait_queue_head_t v4l_capq; |
| 423 | |
| 424 | int v4l_overlay_active; /* Overlay grab is activated */ |
| 425 | int v4l_memgrab_active; /* Memory grab is activated */ |
| 426 | |
| 427 | int v4l_grab_frame; /* Frame number being currently grabbed */ |
| 428 | #define NO_GRAB_ACTIVE (-1) |
| 429 | unsigned long v4l_grab_seq; /* Number of frames grabbed */ |
| 430 | struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */ |
| 431 | |
| 432 | /* V4L grab queue of frames pending */ |
| 433 | unsigned long v4l_pend_head; |
| 434 | unsigned long v4l_pend_tail; |
| 435 | unsigned long v4l_sync_tail; |
| 436 | int v4l_pend[V4L_MAX_FRAME]; |
| 437 | struct zoran_v4l_struct v4l_buffers; /* V4L buffers' info */ |
| 438 | |
| 439 | /* Buz MJPEG parameters */ |
| 440 | enum zoran_codec_mode codec_mode; /* status of codec */ |
| 441 | struct zoran_jpg_settings jpg_settings; /* structure with a lot of things to play with */ |
| 442 | |
| 443 | wait_queue_head_t jpg_capq; /* wait here for grab to finish */ |
| 444 | |
| 445 | /* grab queue counts/indices, mask with BUZ_MASK_STAT_COM before using as index */ |
| 446 | /* (dma_head - dma_tail) is number active in DMA, must be <= BUZ_NUM_STAT_COM */ |
| 447 | /* (value & BUZ_MASK_STAT_COM) corresponds to index in stat_com table */ |
| 448 | unsigned long jpg_que_head; /* Index where to put next buffer which is queued */ |
| 449 | unsigned long jpg_dma_head; /* Index of next buffer which goes into stat_com */ |
| 450 | unsigned long jpg_dma_tail; /* Index of last buffer in stat_com */ |
| 451 | unsigned long jpg_que_tail; /* Index of last buffer in queue */ |
| 452 | unsigned long jpg_seq_num; /* count of frames since grab/play started */ |
| 453 | unsigned long jpg_err_seq; /* last seq_num before error */ |
| 454 | unsigned long jpg_err_shift; |
| 455 | unsigned long jpg_queued_num; /* count of frames queued since grab/play started */ |
| 456 | |
| 457 | /* zr36057's code buffer table */ |
| 458 | u32 *stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */ |
| 459 | |
| 460 | /* (value & BUZ_MASK_FRAME) corresponds to index in pend[] queue */ |
| 461 | int jpg_pend[BUZ_MAX_FRAME]; |
| 462 | |
| 463 | /* array indexed by frame number */ |
| 464 | struct zoran_jpg_struct jpg_buffers; /* MJPEG buffers' info */ |
| 465 | |
| 466 | /* Additional stuff for testing */ |
| 467 | #ifdef CONFIG_PROC_FS |
| 468 | struct proc_dir_entry *zoran_proc; |
| 469 | #else |
| 470 | void *zoran_proc; |
| 471 | #endif |
| 472 | int testing; |
| 473 | int jpeg_error; |
| 474 | int intr_counter_GIRQ1; |
| 475 | int intr_counter_GIRQ0; |
| 476 | int intr_counter_CodRepIRQ; |
| 477 | int intr_counter_JPEGRepIRQ; |
| 478 | int field_counter; |
| 479 | int IRQ1_in; |
| 480 | int IRQ1_out; |
| 481 | int JPEG_in; |
| 482 | int JPEG_out; |
| 483 | int JPEG_0; |
| 484 | int JPEG_1; |
| 485 | int END_event_missed; |
| 486 | int JPEG_missed; |
| 487 | int JPEG_error; |
| 488 | int num_errors; |
| 489 | int JPEG_max_missed; |
| 490 | int JPEG_min_missed; |
| 491 | |
| 492 | u32 last_isr; |
| 493 | unsigned long frame_num; |
| 494 | |
| 495 | wait_queue_head_t test_q; |
| 496 | }; |
| 497 | |
| 498 | /*The following should be done in more portable way. It depends on define |
| 499 | of _ALPHA_BUZ in the Makefile.*/ |
| 500 | |
| 501 | #ifdef _ALPHA_BUZ |
| 502 | #define btwrite(dat,adr) writel((dat), zr->zr36057_adr+(adr)) |
| 503 | #define btread(adr) readl(zr->zr36057_adr+(adr)) |
| 504 | #else |
| 505 | #define btwrite(dat,adr) writel((dat), zr->zr36057_mem+(adr)) |
| 506 | #define btread(adr) readl(zr->zr36057_mem+(adr)) |
| 507 | #endif |
| 508 | |
| 509 | #define btand(dat,adr) btwrite((dat) & btread(adr), adr) |
| 510 | #define btor(dat,adr) btwrite((dat) | btread(adr), adr) |
| 511 | #define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr) |
| 512 | |
| 513 | #endif /* __kernel__ */ |
| 514 | |
| 515 | #endif |