1 /* $OpenBSD: video_if.h,v 1.16 2008/08/24 11:05:02 mglocker Exp $ */ 2 /* 3 * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> 4 * Copyright (c) 2008 Marcus Glocker <mglocker@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _SYS_DEV_VIDEO_IF_H 20 #define _SYS_DEV_VIDEO_IF_H 21 22 /* 23 * Generic interface to hardware driver 24 */ 25 26 #define VIDEOUNIT(x) (minor(x)) 27 28 struct video_hw_if { 29 /* open hardware */ 30 int (*open)(void *, int, int *, uint8_t *, void (*)(void *), 31 void *); 32 33 /* close hardware */ 34 int (*close)(void *); 35 36 /* ioctl's */ 37 int (*querycap)(void *, struct v4l2_capability *); 38 int (*enum_fmt)(void *, struct v4l2_fmtdesc *); 39 int (*enum_fsizes)(void *, struct v4l2_frmsizeenum *); 40 int (*enum_fivals)(void *, struct v4l2_frmivalenum *); 41 int (*s_fmt)(void *, struct v4l2_format *); 42 int (*g_fmt)(void *, struct v4l2_format *); 43 int (*enum_input)(void *, struct v4l2_input *); 44 int (*s_input)(void *, int); 45 int (*reqbufs)(void *, struct v4l2_requestbuffers *); 46 int (*querybuf)(void *, struct v4l2_buffer *); 47 int (*qbuf)(void *, struct v4l2_buffer *); 48 int (*dqbuf)(void *, struct v4l2_buffer *); 49 int (*streamon)(void *, int); 50 int (*streamoff)(void *, int); 51 int (*try_fmt)(void *, struct v4l2_format *); 52 int (*queryctrl)(void *, struct v4l2_queryctrl *); 53 int (*g_ctrl)(void *, struct v4l2_control *); 54 int (*s_ctrl)(void *, struct v4l2_control *); 55 caddr_t (*mappage)(void *, off_t, int); 56 57 /* other functions */ 58 int (*get_bufsize)(void *); 59 int (*start_read)(void *); 60 }; 61 62 struct video_attach_args { 63 void *hwif; 64 void *hdl; 65 }; 66 67 struct device *video_attach_mi(struct video_hw_if *, void *, struct device *); 68 69 #endif /* _SYS_DEV_VIDEO_IF_H */ 70