1 /* $OpenBSD: video_if.h,v 1.19 2022/03/21 19:22:40 miod 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 (*s_parm)(void *, struct v4l2_streamparm *); 44 int (*g_parm)(void *, struct v4l2_streamparm *); 45 int (*enum_input)(void *, struct v4l2_input *); 46 int (*s_input)(void *, int); 47 int (*g_input)(void *, int *); 48 int (*reqbufs)(void *, struct v4l2_requestbuffers *); 49 int (*querybuf)(void *, struct v4l2_buffer *); 50 int (*qbuf)(void *, struct v4l2_buffer *); 51 int (*dqbuf)(void *, struct v4l2_buffer *); 52 int (*streamon)(void *, int); 53 int (*streamoff)(void *, int); 54 int (*try_fmt)(void *, struct v4l2_format *); 55 int (*queryctrl)(void *, struct v4l2_queryctrl *); 56 int (*g_ctrl)(void *, struct v4l2_control *); 57 int (*s_ctrl)(void *, struct v4l2_control *); 58 caddr_t (*mappage)(void *, off_t, int); 59 60 /* other functions */ 61 int (*get_bufsize)(void *); 62 int (*start_read)(void *); 63 }; 64 65 struct video_attach_args { 66 const void *hwif; 67 void *hdl; 68 }; 69 70 struct device *video_attach_mi(const struct video_hw_if *, void *, 71 struct device *); 72 73 #endif /* _SYS_DEV_VIDEO_IF_H */ 74