Path: blob/master/drivers/media/video/davinci/vpif_capture.h
17681 views
/*1* Copyright (C) 2009 Texas Instruments Inc2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA16*/1718#ifndef VPIF_CAPTURE_H19#define VPIF_CAPTURE_H2021#ifdef __KERNEL__2223/* Header files */24#include <linux/videodev2.h>25#include <linux/version.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>3132#include "vpif.h"3334/* Macros */35#define VPIF_MAJOR_RELEASE 036#define VPIF_MINOR_RELEASE 037#define VPIF_BUILD 138#define VPIF_CAPTURE_VERSION_CODE ((VPIF_MAJOR_RELEASE << 16) | \39(VPIF_MINOR_RELEASE << 8) | VPIF_BUILD)4041#define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \42(V4L2_FIELD_NONE == field)) || \43(((V4L2_FIELD_INTERLACED == field) || \44(V4L2_FIELD_SEQ_TB == field)) || \45(V4L2_FIELD_SEQ_BT == field)))4647#define VPIF_CAPTURE_MAX_DEVICES 248#define VPIF_VIDEO_INDEX 049#define VPIF_NUMBER_OF_OBJECTS 15051/* Enumerated data type to give id to each device per channel */52enum vpif_channel_id {53VPIF_CHANNEL0_VIDEO = 0,54VPIF_CHANNEL1_VIDEO,55};5657struct video_obj {58enum v4l2_field buf_field;59/* Currently selected or default standard */60v4l2_std_id stdid;61u32 dv_preset;62struct v4l2_bt_timings bt_timings;63/* This is to track the last input that is passed to application */64u32 input_idx;65};6667struct common_obj {68/* Pointer pointing to current v4l2_buffer */69struct videobuf_buffer *cur_frm;70/* Pointer pointing to current v4l2_buffer */71struct videobuf_buffer *next_frm;72/*73* This field keeps track of type of buffer exchange mechanism74* user has selected75*/76enum v4l2_memory memory;77/* Used to store pixel format */78struct v4l2_format fmt;79/* Buffer queue used in video-buf */80struct videobuf_queue buffer_queue;81/* Queue of filled frames */82struct list_head dma_queue;83/* Used in video-buf */84spinlock_t irqlock;85/* lock used to access this structure */86struct mutex lock;87/* number of users performing IO */88u32 io_usrs;89/* Indicates whether streaming started */90u8 started;91/* Function pointer to set the addresses */92void (*set_addr) (unsigned long, unsigned long, unsigned long,93unsigned long);94/* offset where Y top starts from the starting of the buffer */95u32 ytop_off;96/* offset where Y bottom starts from the starting of the buffer */97u32 ybtm_off;98/* offset where C top starts from the starting of the buffer */99u32 ctop_off;100/* offset where C bottom starts from the starting of the buffer */101u32 cbtm_off;102/* Indicates width of the image data */103u32 width;104/* Indicates height of the image data */105u32 height;106};107108struct channel_obj {109/* Identifies video device for this channel */110struct video_device *video_dev;111/* Used to keep track of state of the priority */112struct v4l2_prio_state prio;113/* number of open instances of the channel */114int usrs;115/* Indicates id of the field which is being displayed */116u32 field_id;117/* flag to indicate whether decoder is initialized */118u8 initialized;119/* Identifies channel */120enum vpif_channel_id channel_id;121/* index into sd table */122int curr_sd_index;123/* ptr to current sub device information */124struct vpif_subdev_info *curr_subdev_info;125/* vpif configuration params */126struct vpif_params vpifparams;127/* common object array */128struct common_obj common[VPIF_NUMBER_OF_OBJECTS];129/* video object */130struct video_obj video;131};132133/* File handle structure */134struct vpif_fh {135/* pointer to channel object for opened device */136struct channel_obj *channel;137/* Indicates whether this file handle is doing IO */138u8 io_allowed[VPIF_NUMBER_OF_OBJECTS];139/* Used to keep track priority of this instance */140enum v4l2_priority prio;141/* Used to indicate channel is initialize or not */142u8 initialized;143};144145struct vpif_device {146struct v4l2_device v4l2_dev;147struct channel_obj *dev[VPIF_CAPTURE_NUM_CHANNELS];148struct v4l2_subdev **sd;149};150151struct vpif_config_params {152u8 min_numbuffers;153u8 numbuffers[VPIF_CAPTURE_NUM_CHANNELS];154s8 device_type;155u32 min_bufsize[VPIF_CAPTURE_NUM_CHANNELS];156u32 channel_bufsize[VPIF_CAPTURE_NUM_CHANNELS];157u8 default_device[VPIF_CAPTURE_NUM_CHANNELS];158u8 max_device_type;159};160/* Struct which keeps track of the line numbers for the sliced vbi service */161struct vpif_service_line {162u16 service_id;163u16 service_line[2];164};165#endif /* End of __KERNEL__ */166#endif /* VPIF_CAPTURE_H */167168169