1139749Simp/*-
2123223Simp * Copyright (c) 1995 Mark Tinguely and Jim Lowe
3123223Simp * All rights reserved.
4123223Simp *
5123223Simp * Redistribution and use in source and binary forms, with or without
6123223Simp * modification, are permitted provided that the following conditions
7123223Simp * are met:
8123223Simp * 1. Redistributions of source code must retain the above copyright
9123223Simp *    notice, this list of conditions and the following disclaimer.
10123223Simp * 2. Redistributions in binary form must reproduce the above copyright
11123223Simp *    notice, this list of conditions and the following disclaimer in the
12123223Simp *    documentation and/or other materials provided with the distribution.
13123223Simp * 3. All advertising materials mentioning features or use of this software
14123223Simp *    must display the following acknowledgement:
15123223Simp *	This product includes software developed by Mark Tinguely and Jim Lowe
16123223Simp * 4. The name of the author may not be used to endorse or promote products
17123223Simp *    derived from this software without specific prior written permission.
18123223Simp *
19123223Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20123223Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21123223Simp * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22123223Simp * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23123223Simp * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24123223Simp * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25123223Simp * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26123223Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27123223Simp * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28123223Simp * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29123223Simp * POSSIBILITY OF SUCH DAMAGE.
30123223Simp *
31123223Simp * $FreeBSD$
32123223Simp */
33123223Simp/*
34123223Simp *	ioctl constants for Matrox Meteor Capture card.
35123223Simp */
36123223Simp
37123688Sobrien#ifndef	_DEV_BKTR_IOCTL_METEOR_H_
38123688Sobrien#define	_DEV_BKTR_IOCTL_METEOR_H_
39123223Simp
40123223Simp#ifndef _KERNEL
41123223Simp#include <sys/types.h>
42123223Simp#endif
43123223Simp#include <sys/ioccom.h>
44123223Simp
45123223Simpstruct meteor_capframe {
46123223Simp	short	command;	/* see below for valid METEORCAPFRM commands */
47123223Simp	short	lowat;		/* start transfer if < this number */
48123223Simp	short	hiwat;		/* stop transfer if > this number */
49123223Simp} ;
50123223Simp
51123223Simp/* structure for METEOR[GS]ETGEO - get/set geometry  */
52123223Simpstruct meteor_geomet {
53205781Sgibbs	unsigned short		rows;
54205781Sgibbs	unsigned short		columns;
55205781Sgibbs	unsigned short		frames;
56205781Sgibbs	unsigned long		oformat;
57123223Simp} ;
58123223Simp
59123223Simp/* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
60123223Simpstruct meteor_counts {
61205781Sgibbs	unsigned long fifo_errors;	/* count of fifo errors since open */
62205781Sgibbs	unsigned long dma_errors;	/* count of dma errors since open */
63205781Sgibbs	unsigned long frames_captured;	/* count of frames captured since open */
64205781Sgibbs	unsigned long even_fields_captured; /* count of even fields captured */
65205781Sgibbs	unsigned long odd_fields_captured; /* count of odd fields captured */
66123223Simp} ;
67123223Simp
68123223Simp/* structure for getting and setting direct transfers to vram */
69123223Simpstruct meteor_video {
70205781Sgibbs	unsigned long	addr;		/* Address of location to dma to */
71205781Sgibbs	unsigned long	width;		/* Width of memory area */
72205781Sgibbs	unsigned long	banksize;	/* Size of Vram bank */
73205781Sgibbs	unsigned long	ramsize;	/* Size of Vram */
74123223Simp};
75123223Simp
76123223Simp#define METEORCAPTUR _IOW('x', 1, int)			 /* capture a frame */
77123223Simp#define METEORCAPFRM _IOW('x', 2, struct meteor_capframe)  /* sync capture */
78123223Simp#define METEORSETGEO _IOW('x', 3, struct meteor_geomet)  /* set geometry */
79123223Simp#define METEORGETGEO _IOR('x', 4, struct meteor_geomet)  /* get geometry */
80123223Simp#define METEORSTATUS _IOR('x', 5, unsigned short)	/* get status */
81123223Simp#define METEORSHUE   _IOW('x', 6, signed char)		/* set hue */
82123223Simp#define METEORGHUE   _IOR('x', 6, signed char)		/* get hue */
83123223Simp#define METEORSFMT   _IOW('x', 7, unsigned long)	/* set format */
84123223Simp#define METEORGFMT   _IOR('x', 7, unsigned long)	/* get format */
85123223Simp#define METEORSINPUT _IOW('x', 8, unsigned long)	/* set input dev */
86123223Simp#define METEORGINPUT _IOR('x', 8, unsigned long)	/* get input dev */
87123223Simp#define	METEORSCHCV  _IOW('x', 9, unsigned char)	/* set uv gain */
88123223Simp#define	METEORGCHCV  _IOR('x', 9, unsigned char)	/* get uv gain */
89123223Simp#define	METEORSCOUNT _IOW('x',10, struct meteor_counts)
90123223Simp#define	METEORGCOUNT _IOR('x',10, struct meteor_counts)
91123223Simp#define METEORSFPS   _IOW('x',11, unsigned short)	/* set fps */
92123223Simp#define METEORGFPS   _IOR('x',11, unsigned short)	/* get fps */
93123223Simp#define METEORSSIGNAL _IOW('x', 12, unsigned int)	/* set signal */
94123223Simp#define METEORGSIGNAL _IOR('x', 12, unsigned int)	/* get signal */
95123223Simp#define	METEORSVIDEO _IOW('x', 13, struct meteor_video)	/* set video */
96123223Simp#define	METEORGVIDEO _IOR('x', 13, struct meteor_video)	/* get video */
97123223Simp#define	METEORSBRIG  _IOW('x', 14, unsigned char)	/* set brightness */
98123223Simp#define METEORGBRIG  _IOR('x', 14, unsigned char)	/* get brightness */
99123223Simp#define	METEORSCSAT  _IOW('x', 15, unsigned char)	/* set chroma sat */
100123223Simp#define METEORGCSAT  _IOR('x', 15, unsigned char)	/* get uv saturation */
101123223Simp#define	METEORSCONT  _IOW('x', 16, unsigned char)	/* set contrast */
102123223Simp#define	METEORGCONT  _IOR('x', 16, unsigned char)	/* get contrast */
103123223Simp#define METEORSBT254 _IOW('x', 17, unsigned short)	/* set Bt254 reg */
104123223Simp#define METEORGBT254 _IOR('x', 17, unsigned short)	/* get Bt254 reg */
105123223Simp#define METEORSHWS   _IOW('x', 18, unsigned char)	/* set hor start reg */
106123223Simp#define METEORGHWS   _IOR('x', 18, unsigned char)	/* get hor start reg */
107123223Simp#define METEORSVWS   _IOW('x', 19, unsigned char)	/* set vert start reg */
108123223Simp#define METEORGVWS   _IOR('x', 19, unsigned char)	/* get vert start reg */
109123223Simp#define	METEORSTS    _IOW('x', 20, unsigned char)	/* set time stamp */
110123223Simp#define	METEORGTS    _IOR('x', 20, unsigned char)	/* get time stamp */
111123223Simp
112123223Simp#define	METEOR_STATUS_ID_MASK	0xf000	/* ID of 7196 */
113123223Simp#define	METEOR_STATUS_DIR	0x0800	/* Direction of Expansion port YUV */
114123223Simp#define	METEOR_STATUS_OEF	0x0200	/* Field detected: Even/Odd */
115123223Simp#define	METEOR_STATUS_SVP	0x0100	/* State of VRAM Port:inactive/active */
116123223Simp#define	METEOR_STATUS_STTC	0x0080	/* Time Constant: TV/VCR */
117123223Simp#define	METEOR_STATUS_HCLK	0x0040	/* Horiz PLL: locked/unlocked */
118123223Simp#define	METEOR_STATUS_FIDT	0x0020	/* Field detect: 50/60hz */
119123223Simp#define	METEOR_STATUS_ALTD	0x0002	/* Line alt: no line alt/line alt */
120123223Simp#define METEOR_STATUS_CODE	0x0001	/* Colour info: no colour/colour */
121123223Simp
122123223Simp				/* METEORCAPTUR capture options */
123123223Simp#define METEOR_CAP_SINGLE	0x0001	/* capture one frame */
124123223Simp#define METEOR_CAP_CONTINOUS	0x0002	/* continuously capture */
125123223Simp#define METEOR_CAP_STOP_CONT	0x0004	/* stop the continuous capture */
126123223Simp
127123223Simp				/* METEORCAPFRM capture commands */
128123223Simp#define METEOR_CAP_N_FRAMES	0x0001	/* capture N frames */
129123223Simp#define METEOR_CAP_STOP_FRAMES	0x0002	/* stop capture N frames */
130123223Simp#define	METEOR_HALT_N_FRAMES	0x0003	/* halt of capture N frames */
131123223Simp#define METEOR_CONT_N_FRAMES	0x0004	/* continue after above halt */
132123223Simp
133123223Simp				/* valid video input formats:  */
134123223Simp#define METEOR_FMT_NTSC		0x00100	/* NTSC --  initialized default */
135123223Simp#define METEOR_FMT_PAL		0x00200	/* PAL */
136123223Simp#define METEOR_FMT_SECAM	0x00400	/* SECAM */
137123223Simp#define METEOR_FMT_AUTOMODE	0x00800 /* auto-mode */
138123223Simp#define METEOR_INPUT_DEV0	0x01000	/* camera input 0 -- default */
139123223Simp#define METEOR_INPUT_DEV_RCA	METEOR_INPUT_DEV0
140123223Simp#define METEOR_INPUT_DEV1	0x02000	/* camera input 1 */
141123223Simp#define METEOR_INPUT_DEV2	0x04000	/* camera input 2 */
142123223Simp#define METEOR_INPUT_DEV3	0x08000	/* camera input 3 */
143123223Simp#define METEOR_INPUT_DEV_RGB	0x0a000	/* for rgb version of meteor */
144123223Simp#define METEOR_INPUT_DEV_SVIDEO	0x06000 /* S-video input port */
145123223Simp
146123223Simp				/* valid video output formats:  */
147123223Simp#define METEOR_GEO_RGB16	0x0010000 /* packed -- initialized default */
148123223Simp#define METEOR_GEO_RGB24	0x0020000 /* RBG 24 bits packed */
149123223Simp					  /* internally stored in 32 bits */
150123223Simp#define METEOR_GEO_YUV_PACKED	0x0040000 /* 4-2-2 YUV 16 bits packed */
151123223Simp#define METEOR_GEO_YUV_PLANAR	0x0080000 /* 4-2-2 YUV 16 bits planer */
152123223Simp#define METEOR_GEO_YUV_PLANER	METEOR_GEO_YUV_PLANAR
153123223Simp#define METEOR_GEO_UNSIGNED	0x0400000 /* unsigned uv outputs */
154123223Simp#define METEOR_GEO_EVEN_ONLY	0x1000000 /* set for even only field capture */
155123223Simp#define METEOR_GEO_ODD_ONLY	0x2000000 /* set for odd only field capture */
156123223Simp#define METEOR_GEO_FIELD_MASK	0x3000000
157123223Simp#define METEOR_GEO_YUV_422	0x4000000 /* 4-2-2 YUV in Y-U-V combined */
158123223Simp#define METEOR_GEO_OUTPUT_MASK	0x40f0000
159123223Simp#define METEOR_GEO_YUV_12	0x10000000	/* YUV 12 format */
160123223Simp#define METEOR_GEO_YUV_9	0x40000000	/* YUV 9 format */
161123223Simp
162123223Simp#define	METEOR_FIELD_MODE	0x80000000	/* Field cap or Frame cap */
163123223Simp
164123223Simp#define	METEOR_SIG_MODE_MASK	0xffff0000
165123223Simp#define	METEOR_SIG_FRAME	0x00000000	/* signal every frame */
166123223Simp#define	METEOR_SIG_FIELD	0x00010000	/* signal every field */
167123223Simp
168123223Simp	/* following structure is used to coordinate the synchronous */
169123223Simp
170123223Simpstruct meteor_mem {
171123223Simp		/* kernel write only  */
172123223Simp	int	frame_size;	 /* row*columns*depth */
173123223Simp	unsigned num_bufs;	 /* number of frames in buffer (1-32) */
174123223Simp		/* user and kernel change these */
175123223Simp	int	lowat;		 /* kernel starts capture if < this number */
176123223Simp	int	hiwat;		 /* kernel stops capture if > this number.
177123223Simp				    hiwat <= numbufs */
178123223Simp	unsigned active;	 /* bit mask of active frame buffers
179123223Simp				    kernel sets, user clears */
180123223Simp	int	num_active_bufs; /* count of active frame buffer
181123223Simp				    kernel increments, user decrements */
182123223Simp
183123223Simp		/* reference to mmapped data */
184123223Simp	caddr_t	buf;		 /* The real space (virtual addr) */
185123223Simp} ;
186123223Simp
187123688Sobrien#endif /* !_DEV_BKTR_IOCTL_METEOR_H_ */
188