Skip to content
Newer
Older
100644 276 lines (218 sloc) 7.47 KB
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
1 #ifndef __SAA7146_VV__
2 #define __SAA7146_VV__
3
5e87efa @mchehab V4L/DVB (4068): Removed all references to kernel stuff from videodev.…
mchehab authored
4 #include <media/v4l2-common.h>
35ea11f V4L/DVB (8430): videodev: move some functions from v4l2-dev.h to v4l2…
Hans Verkuil authored
5 #include <media/v4l2-ioctl.h>
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
6 #include <media/saa7146.h>
c1accaa @mchehab V4L/DVB (6252): Adapt drivers to use the newer videobuf modules
mchehab authored
7 #include <media/videobuf-dma-sg.h>
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
8
9 #define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */
10 #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */
11
12 #define WRITE_RPS0(x) do { \
13 dev->d_rps0.cpu_addr[ count++ ] = cpu_to_le32(x); \
14 } while (0);
15
16 #define WRITE_RPS1(x) do { \
17 dev->d_rps1.cpu_addr[ count++ ] = cpu_to_le32(x); \
18 } while (0);
19
20 struct saa7146_video_dma {
21 u32 base_odd;
22 u32 base_even;
23 u32 prot_addr;
24 u32 pitch;
25 u32 base_page;
26 u32 num_line_byte;
27 };
28
29 #define FORMAT_BYTE_SWAP 0x1
30 #define FORMAT_IS_PLANAR 0x2
31
32 struct saa7146_format {
33 char *name;
34 u32 pixelformat;
35 u32 trans;
36 u8 depth;
37 u8 flags;
38 u8 swap;
39 };
40
41 struct saa7146_standard
42 {
43 char *name;
44 v4l2_std_id id;
45
46 int v_offset; /* number of lines of vertical offset before processing */
47 int v_field; /* number of lines in a field for HPS to process */
48
49 int h_offset; /* horizontal offset of processing window */
50 int h_pixels; /* number of horizontal pixels to process */
51
52 int v_max_out;
53 int h_max_out;
54 };
55
56 /* buffer for one video/vbi frame */
57 struct saa7146_buf {
58 /* common v4l buffer stuff -- must be first */
59 struct videobuf_buffer vb;
60
61 /* saa7146 specific */
62 struct v4l2_pix_format *fmt;
63 int (*activate)(struct saa7146_dev *dev,
64 struct saa7146_buf *buf,
65 struct saa7146_buf *next);
66
67 /* page tables */
68 struct saa7146_pgtable pt[3];
69 };
70
71 struct saa7146_dmaqueue {
72 struct saa7146_dev *dev;
73 struct saa7146_buf *curr;
74 struct list_head queue;
75 struct timer_list timeout;
76 };
77
78 struct saa7146_overlay {
79 struct saa7146_fh *fh;
80 struct v4l2_window win;
81 struct v4l2_clip clips[16];
82 int nclips;
83 };
84
85 /* per open data */
86 struct saa7146_fh {
87 struct saa7146_dev *dev;
88 /* if this is a vbi or capture open */
89 enum v4l2_buf_type type;
90
91 /* video overlay */
92 struct saa7146_overlay ov;
93
94 /* video capture */
95 struct videobuf_queue video_q;
96 struct v4l2_pix_format video_fmt;
97
98 /* vbi capture */
99 struct videobuf_queue vbi_q;
100 struct v4l2_vbi_format vbi_fmt;
101 struct timer_list vbi_read_timeout;
102
103 unsigned int resources; /* resource management for device open */
104 };
105
106 #define STATUS_OVERLAY 0x01
107 #define STATUS_CAPTURE 0x02
108
109 struct saa7146_vv
110 {
111 int vbi_minor;
112
113 /* vbi capture */
114 struct saa7146_dmaqueue vbi_q;
115 /* vbi workaround interrupt queue */
afd1a0c [PATCH] V4L/DVB: (3086c) Whitespaces cleanups part 3
Mauro Carvalho Chehab authored
116 wait_queue_head_t vbi_wq;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
117 int vbi_fieldcount;
118 struct saa7146_fh *vbi_streaming;
119
120 int video_minor;
121
122 int video_status;
123 struct saa7146_fh *video_fh;
124
125 /* video overlay */
126 struct v4l2_framebuffer ov_fb;
127 struct saa7146_format *ov_fmt;
128 struct saa7146_overlay *ov_data;
129 struct saa7146_fh *ov_suspend;
130
131 /* video capture */
132 struct saa7146_dmaqueue video_q;
133 enum v4l2_field last_field;
134
135 /* common: fixme? shouldn't this be in saa7146_fh?
136 (this leads to a more complicated question: shall the driver
137 store the different settings (for example S_INPUT) for every open
138 and restore it appropriately, or should all settings be common for
139 all opens? currently, we do the latter, like all other
140 drivers do... */
141 struct saa7146_standard *standard;
142
143 int vflip;
144 int hflip;
145 int current_hps_source;
146 int current_hps_sync;
147
148 struct saa7146_dma d_clipping; /* pointer to clipping memory */
149
150 unsigned int resources; /* resource management for device */
151 };
152
153 #define SAA7146_EXCLUSIVE 0x1
154 #define SAA7146_BEFORE 0x2
155 #define SAA7146_AFTER 0x4
156
157 struct saa7146_extension_ioctls
158 {
159 unsigned int cmd;
160 int flags;
161 };
162
163 /* flags */
164 #define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */
165
166 struct saa7146_ext_vv
167 {
168 /* informations about the video capabilities of the device */
169 int inputs;
170 int audios;
171 u32 capabilities;
172 int flags;
173
174 /* additionally supported transmission standards */
175 struct saa7146_standard *stds;
176 int num_stds;
177 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
178
179 struct saa7146_extension_ioctls *ioctls;
069b747 V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlo…
Hans Verkuil authored
180 long (*ioctl)(struct saa7146_fh *, unsigned int cmd, void *arg);
5b0fa4f V4L/DVB (3325): WSS output interface for av7110
Oliver Endriss authored
181
bec4366 V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Hans Verkuil authored
182 struct v4l2_file_operations vbi_fops;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
183 };
184
185 struct saa7146_use_ops {
afd1a0c [PATCH] V4L/DVB: (3086c) Whitespaces cleanups part 3
Mauro Carvalho Chehab authored
186 void (*init)(struct saa7146_dev *, struct saa7146_vv *);
187 int(*open)(struct saa7146_dev *, struct file *);
188 void (*release)(struct saa7146_dev *, struct file *);
189 void (*irq_done)(struct saa7146_dev *, unsigned long status);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
190 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
191 };
192
193 /* from saa7146_fops.c */
194 int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type);
195 int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev);
196 void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state);
197 void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi);
198 int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf);
199 void saa7146_buffer_timeout(unsigned long data);
c7b0ac0 @mchehab V4L/DVB (3516): Make video_buf more generic
mchehab authored
200 void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,
201 struct saa7146_buf *buf);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
202
203 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
204 int saa7146_vv_release(struct saa7146_dev* dev);
205
206 /* from saa7146_hlp.c */
207 int saa7146_enable_overlay(struct saa7146_fh *fh);
208 void saa7146_disable_overlay(struct saa7146_fh *fh);
209
210 void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next);
211 void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma) ;
212 void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sync);
213 void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
214
215 /* from saa7146_video.c */
216 extern struct saa7146_use_ops saa7146_video_uops;
217 int saa7146_start_preview(struct saa7146_fh *fh);
218 int saa7146_stop_preview(struct saa7146_fh *fh);
069b747 V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlo…
Hans Verkuil authored
219 long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
220
221 /* from saa7146_vbi.c */
222 extern struct saa7146_use_ops saa7146_vbi_uops;
223
224 /* resource management functions */
225 int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit);
226 void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits);
227
228 #define RESOURCE_DMA1_HPS 0x1
229 #define RESOURCE_DMA2_CLP 0x2
230 #define RESOURCE_DMA3_BRS 0x4
231
232 /* saa7146 source inputs */
233 #define SAA7146_HPS_SOURCE_PORT_A 0x00
234 #define SAA7146_HPS_SOURCE_PORT_B 0x01
235 #define SAA7146_HPS_SOURCE_YPB_CPA 0x02
236 #define SAA7146_HPS_SOURCE_YPA_CPB 0x03
237
238 /* sync inputs */
239 #define SAA7146_HPS_SYNC_PORT_A 0x00
240 #define SAA7146_HPS_SYNC_PORT_B 0x01
241
242 /* some memory sizes */
7a7cd19 V4L/DVB (5441): Saa7146: Fix allocation of clipping memory
Oliver Endriss authored
243 /* max. 16 clipping rectangles */
244 #define SAA7146_CLIPPING_MEM (16 * 4 * sizeof(u32))
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
245
246 /* some defines for the various clipping-modes */
247 #define SAA7146_CLIPPING_RECT 0x4
248 #define SAA7146_CLIPPING_RECT_INVERTED 0x5
249 #define SAA7146_CLIPPING_MASK 0x6
250 #define SAA7146_CLIPPING_MASK_INVERTED 0x7
251
252 /* output formats: each entry holds four informations */
253 #define RGB08_COMPOSED 0x0217 /* composed is used in the sense of "not-planar" */
254 /* this means: planar?=0, yuv2rgb-conversation-mode=2, dither=yes(=1), format-mode = 7 */
255 #define RGB15_COMPOSED 0x0213
256 #define RGB16_COMPOSED 0x0210
257 #define RGB24_COMPOSED 0x0201
258 #define RGB32_COMPOSED 0x0202
259
260 #define Y8 0x0006
261 #define YUV411_COMPOSED 0x0003
262 #define YUV422_COMPOSED 0x0000
263 /* this means: planar?=1, yuv2rgb-conversion-mode=0, dither=no(=0), format-mode = b */
264 #define YUV411_DECOMPOSED 0x100b
265 #define YUV422_DECOMPOSED 0x1009
266 #define YUV420_DECOMPOSED 0x100a
267
268 #define IS_PLANAR(x) (x & 0xf000)
269
270 /* misc defines */
271 #define SAA7146_NO_SWAP (0x0)
272 #define SAA7146_TWO_BYTE_SWAP (0x1)
273 #define SAA7146_FOUR_BYTE_SWAP (0x2)
274
275 #endif
Something went wrong with that request. Please try again.