2 * Copyright (C) 2009 Texas Instruments Inc
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef VPIF_CAPTURE_H
20 #define VPIF_CAPTURE_H
25 #include <linux/videodev2.h>
26 #include <media/v4l2-common.h>
27 #include <media/v4l2-device.h>
28 #include <media/videobuf-core.h>
29 #include <media/videobuf-dma-contig.h>
30 #include <mach/dm646x.h>
35 #define VPIF_CAPTURE_VERSION "0.0.2"
37 #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \
38 (V4L2_FIELD_NONE == field)) || \
39 (((V4L2_FIELD_INTERLACED == field) || \
40 (V4L2_FIELD_SEQ_TB == field)) || \
41 (V4L2_FIELD_SEQ_BT == field)))
43 #define VPIF_CAPTURE_MAX_DEVICES 2
44 #define VPIF_VIDEO_INDEX 0
45 #define VPIF_NUMBER_OF_OBJECTS 1
47 /* Enumerated data type to give id to each device per channel */
48 enum vpif_channel_id
{
49 VPIF_CHANNEL0_VIDEO
= 0,
54 enum v4l2_field buf_field
;
55 /* Currently selected or default standard */
58 struct v4l2_bt_timings bt_timings
;
59 /* This is to track the last input that is passed to application */
64 /* Pointer pointing to current v4l2_buffer */
65 struct videobuf_buffer
*cur_frm
;
66 /* Pointer pointing to current v4l2_buffer */
67 struct videobuf_buffer
*next_frm
;
69 * This field keeps track of type of buffer exchange mechanism
72 enum v4l2_memory memory
;
73 /* Used to store pixel format */
74 struct v4l2_format fmt
;
75 /* Buffer queue used in video-buf */
76 struct videobuf_queue buffer_queue
;
77 /* Queue of filled frames */
78 struct list_head dma_queue
;
79 /* Used in video-buf */
81 /* lock used to access this structure */
83 /* number of users performing IO */
85 /* Indicates whether streaming started */
87 /* Function pointer to set the addresses */
88 void (*set_addr
) (unsigned long, unsigned long, unsigned long,
90 /* offset where Y top starts from the starting of the buffer */
92 /* offset where Y bottom starts from the starting of the buffer */
94 /* offset where C top starts from the starting of the buffer */
96 /* offset where C bottom starts from the starting of the buffer */
98 /* Indicates width of the image data */
100 /* Indicates height of the image data */
105 /* Identifies video device for this channel */
106 struct video_device
*video_dev
;
107 /* Used to keep track of state of the priority */
108 struct v4l2_prio_state prio
;
109 /* number of open instances of the channel */
111 /* Indicates id of the field which is being displayed */
113 /* flag to indicate whether decoder is initialized */
115 /* Identifies channel */
116 enum vpif_channel_id channel_id
;
117 /* index into sd table */
119 /* ptr to current sub device information */
120 struct vpif_subdev_info
*curr_subdev_info
;
121 /* vpif configuration params */
122 struct vpif_params vpifparams
;
123 /* common object array */
124 struct common_obj common
[VPIF_NUMBER_OF_OBJECTS
];
126 struct video_obj video
;
129 /* File handle structure */
131 /* pointer to channel object for opened device */
132 struct channel_obj
*channel
;
133 /* Indicates whether this file handle is doing IO */
134 u8 io_allowed
[VPIF_NUMBER_OF_OBJECTS
];
135 /* Used to keep track priority of this instance */
136 enum v4l2_priority prio
;
137 /* Used to indicate channel is initialize or not */
142 struct v4l2_device v4l2_dev
;
143 struct channel_obj
*dev
[VPIF_CAPTURE_NUM_CHANNELS
];
144 struct v4l2_subdev
**sd
;
147 struct vpif_config_params
{
149 u8 numbuffers
[VPIF_CAPTURE_NUM_CHANNELS
];
151 u32 min_bufsize
[VPIF_CAPTURE_NUM_CHANNELS
];
152 u32 channel_bufsize
[VPIF_CAPTURE_NUM_CHANNELS
];
153 u8 default_device
[VPIF_CAPTURE_NUM_CHANNELS
];
156 /* Struct which keeps track of the line numbers for the sliced vbi service */
157 struct vpif_service_line
{
161 #endif /* End of __KERNEL__ */
162 #endif /* VPIF_CAPTURE_H */