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