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 <linux/version.h>
27 #include <media/v4l2-common.h>
28 #include <media/v4l2-device.h>
29 #include <media/videobuf-core.h>
30 #include <media/videobuf-dma-contig.h>
31 #include <mach/dm646x.h>
36 #define VPIF_MAJOR_RELEASE 0
37 #define VPIF_MINOR_RELEASE 0
39 #define VPIF_CAPTURE_VERSION_CODE ((VPIF_MAJOR_RELEASE << 16) | \
40 (VPIF_MINOR_RELEASE << 8) | VPIF_BUILD)
42 #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \
43 (V4L2_FIELD_NONE == field)) || \
44 (((V4L2_FIELD_INTERLACED == field) || \
45 (V4L2_FIELD_SEQ_TB == field)) || \
46 (V4L2_FIELD_SEQ_BT == field)))
48 #define VPIF_CAPTURE_MAX_DEVICES 2
49 #define VPIF_VIDEO_INDEX 0
50 #define VPIF_NUMBER_OF_OBJECTS 1
52 /* Enumerated data type to give id to each device per channel */
53 enum vpif_channel_id
{
54 VPIF_CHANNEL0_VIDEO
= 0,
59 enum v4l2_field buf_field
;
60 /* Currently selected or default standard */
62 /* This is to track the last input that is passed to application */
67 /* Pointer pointing to current v4l2_buffer */
68 struct videobuf_buffer
*cur_frm
;
69 /* Pointer pointing to current v4l2_buffer */
70 struct videobuf_buffer
*next_frm
;
72 * This field keeps track of type of buffer exchange mechanism
75 enum v4l2_memory memory
;
76 /* Used to store pixel format */
77 struct v4l2_format fmt
;
78 /* Buffer queue used in video-buf */
79 struct videobuf_queue buffer_queue
;
80 /* Queue of filled frames */
81 struct list_head dma_queue
;
82 /* Used in video-buf */
84 /* lock used to access this structure */
86 /* number of users performing IO */
88 /* Indicates whether streaming started */
90 /* Function pointer to set the addresses */
91 void (*set_addr
) (unsigned long, unsigned long, unsigned long,
93 /* offset where Y top starts from the starting of the buffer */
95 /* offset where Y bottom starts from the starting of the buffer */
97 /* offset where C top starts from the starting of the buffer */
99 /* offset where C bottom starts from the starting of the buffer */
101 /* Indicates width of the image data */
103 /* Indicates height of the image data */
108 /* Identifies video device for this channel */
109 struct video_device
*video_dev
;
110 /* Used to keep track of state of the priority */
111 struct v4l2_prio_state prio
;
112 /* number of open instances of the channel */
114 /* Indicates id of the field which is being displayed */
116 /* flag to indicate whether decoder is initialized */
118 /* Identifies channel */
119 enum vpif_channel_id channel_id
;
120 /* index into sd table */
122 /* ptr to current sub device information */
123 struct vpif_subdev_info
*curr_subdev_info
;
124 /* vpif configuration params */
125 struct vpif_params vpifparams
;
126 /* common object array */
127 struct common_obj common
[VPIF_NUMBER_OF_OBJECTS
];
129 struct video_obj video
;
132 /* File handle structure */
134 /* pointer to channel object for opened device */
135 struct channel_obj
*channel
;
136 /* Indicates whether this file handle is doing IO */
137 u8 io_allowed
[VPIF_NUMBER_OF_OBJECTS
];
138 /* Used to keep track priority of this instance */
139 enum v4l2_priority prio
;
140 /* Used to indicate channel is initialize or not */
145 struct v4l2_device v4l2_dev
;
146 struct channel_obj
*dev
[VPIF_CAPTURE_NUM_CHANNELS
];
147 struct v4l2_subdev
**sd
;
150 struct vpif_config_params
{
152 u8 numbuffers
[VPIF_CAPTURE_NUM_CHANNELS
];
154 u32 min_bufsize
[VPIF_CAPTURE_NUM_CHANNELS
];
155 u32 channel_bufsize
[VPIF_CAPTURE_NUM_CHANNELS
];
156 u8 default_device
[VPIF_CAPTURE_NUM_CHANNELS
];
159 /* Struct which keeps track of the line numbers for the sliced vbi service */
160 struct vpif_service_line
{
164 #endif /* End of __KERNEL__ */
165 #endif /* VPIF_CAPTURE_H */