ioctl_meteor.h revision 139749
1275970Scy/*-
2275970Scy * Copyright (c) 1995 Mark Tinguely and Jim Lowe
3275970Scy * All rights reserved.
4275970Scy *
5275970Scy * Redistribution and use in source and binary forms, with or without
6275970Scy * modification, are permitted provided that the following conditions
7275970Scy * are met:
8275970Scy * 1. Redistributions of source code must retain the above copyright
9275970Scy *    notice, this list of conditions and the following disclaimer.
10275970Scy * 2. Redistributions in binary form must reproduce the above copyright
11275970Scy *    notice, this list of conditions and the following disclaimer in the
12275970Scy *    documentation and/or other materials provided with the distribution.
13275970Scy * 3. All advertising materials mentioning features or use of this software
14275970Scy *    must display the following acknowledgement:
15275970Scy *	This product includes software developed by Mark Tinguely and Jim Lowe
16275970Scy * 4. The name of the author may not be used to endorse or promote products
17275970Scy *    derived from this software without specific prior written permission.
18275970Scy *
19275970Scy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20275970Scy * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21275970Scy * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22275970Scy * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23275970Scy * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24275970Scy * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25275970Scy * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26275970Scy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27275970Scy * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28275970Scy * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29275970Scy * POSSIBILITY OF SUCH DAMAGE.
30275970Scy *
31275970Scy * $FreeBSD: head/sys/dev/bktr/ioctl_meteor.h 139749 2005-01-06 01:43:34Z imp $
32275970Scy */
33275970Scy/*
34275970Scy *	ioctl constants for Matrox Meteor Capture card.
35275970Scy */
36275970Scy
37275970Scy#ifndef	_DEV_BKTR_IOCTL_METEOR_H_
38275970Scy#define	_DEV_BKTR_IOCTL_METEOR_H_
39275970Scy
40275970Scy#ifndef _KERNEL
41275970Scy#include <sys/types.h>
42275970Scy#endif
43275970Scy#include <sys/ioccom.h>
44275970Scy
45275970Scystruct meteor_capframe {
46275970Scy	short	command;	/* see below for valid METEORCAPFRM commands */
47275970Scy	short	lowat;		/* start transfer if < this number */
48275970Scy	short	hiwat;		/* stop transfer if > this number */
49275970Scy} ;
50275970Scy
51275970Scy/* structure for METEOR[GS]ETGEO - get/set geometry  */
52275970Scystruct meteor_geomet {
53275970Scy	u_short		rows;
54275970Scy	u_short		columns;
55275970Scy	u_short		frames;
56275970Scy	u_long		oformat;
57275970Scy} ;
58275970Scy
59275970Scy/* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
60275970Scystruct meteor_counts {
61275970Scy	u_long fifo_errors;	/* count of fifo errors since open */
62275970Scy	u_long dma_errors;	/* count of dma errors since open */
63275970Scy	u_long frames_captured;	/* count of frames captured since open */
64275970Scy	u_long even_fields_captured; /* count of even fields captured */
65275970Scy	u_long odd_fields_captured; /* count of odd fields captured */
66275970Scy} ;
67275970Scy
68275970Scy/* structure for getting and setting direct transfers to vram */
69275970Scystruct meteor_video {
70275970Scy	u_long	addr;	/* Address of location to dma to */
71275970Scy	u_long	width;	/* Width of memory area */
72275970Scy	u_long	banksize;	/* Size of Vram bank */
73275970Scy	u_long	ramsize;	/* Size of Vram */
74275970Scy};
75275970Scy
76275970Scy#define METEORCAPTUR _IOW('x', 1, int)			 /* capture a frame */
77275970Scy#define METEORCAPFRM _IOW('x', 2, struct meteor_capframe)  /* sync capture */
78275970Scy#define METEORSETGEO _IOW('x', 3, struct meteor_geomet)  /* set geometry */
79275970Scy#define METEORGETGEO _IOR('x', 4, struct meteor_geomet)  /* get geometry */
80275970Scy#define METEORSTATUS _IOR('x', 5, unsigned short)	/* get status */
81275970Scy#define METEORSHUE   _IOW('x', 6, signed char)		/* set hue */
82275970Scy#define METEORGHUE   _IOR('x', 6, signed char)		/* get hue */
83275970Scy#define METEORSFMT   _IOW('x', 7, unsigned long)	/* set format */
84275970Scy#define METEORGFMT   _IOR('x', 7, unsigned long)	/* get format */
85275970Scy#define METEORSINPUT _IOW('x', 8, unsigned long)	/* set input dev */
86275970Scy#define METEORGINPUT _IOR('x', 8, unsigned long)	/* get input dev */
87275970Scy#define	METEORSCHCV  _IOW('x', 9, unsigned char)	/* set uv gain */
88275970Scy#define	METEORGCHCV  _IOR('x', 9, unsigned char)	/* get uv gain */
89275970Scy#define	METEORSCOUNT _IOW('x',10, struct meteor_counts)
90275970Scy#define	METEORGCOUNT _IOR('x',10, struct meteor_counts)
91275970Scy#define METEORSFPS   _IOW('x',11, unsigned short)	/* set fps */
92275970Scy#define METEORGFPS   _IOR('x',11, unsigned short)	/* get fps */
93275970Scy#define METEORSSIGNAL _IOW('x', 12, unsigned int)	/* set signal */
94275970Scy#define METEORGSIGNAL _IOR('x', 12, unsigned int)	/* get signal */
95275970Scy#define	METEORSVIDEO _IOW('x', 13, struct meteor_video)	/* set video */
96275970Scy#define	METEORGVIDEO _IOR('x', 13, struct meteor_video)	/* get video */
97275970Scy#define	METEORSBRIG  _IOW('x', 14, unsigned char)	/* set brightness */
98275970Scy#define METEORGBRIG  _IOR('x', 14, unsigned char)	/* get brightness */
99275970Scy#define	METEORSCSAT  _IOW('x', 15, unsigned char)	/* set chroma sat */
100275970Scy#define METEORGCSAT  _IOR('x', 15, unsigned char)	/* get uv saturation */
101275970Scy#define	METEORSCONT  _IOW('x', 16, unsigned char)	/* set contrast */
102275970Scy#define	METEORGCONT  _IOR('x', 16, unsigned char)	/* get contrast */
103275970Scy#define METEORSBT254 _IOW('x', 17, unsigned short)	/* set Bt254 reg */
104275970Scy#define METEORGBT254 _IOR('x', 17, unsigned short)	/* get Bt254 reg */
105275970Scy#define METEORSHWS   _IOW('x', 18, unsigned char)	/* set hor start reg */
106275970Scy#define METEORGHWS   _IOR('x', 18, unsigned char)	/* get hor start reg */
107275970Scy#define METEORSVWS   _IOW('x', 19, unsigned char)	/* set vert start reg */
108275970Scy#define METEORGVWS   _IOR('x', 19, unsigned char)	/* get vert start reg */
109275970Scy#define	METEORSTS    _IOW('x', 20, unsigned char)	/* set time stamp */
110275970Scy#define	METEORGTS    _IOR('x', 20, unsigned char)	/* get time stamp */
111275970Scy
112275970Scy#define	METEOR_STATUS_ID_MASK	0xf000	/* ID of 7196 */
113275970Scy#define	METEOR_STATUS_DIR	0x0800	/* Direction of Expansion port YUV */
114275970Scy#define	METEOR_STATUS_OEF	0x0200	/* Field detected: Even/Odd */
115275970Scy#define	METEOR_STATUS_SVP	0x0100	/* State of VRAM Port:inactive/active */
116275970Scy#define	METEOR_STATUS_STTC	0x0080	/* Time Constant: TV/VCR */
117275970Scy#define	METEOR_STATUS_HCLK	0x0040	/* Horiz PLL: locked/unlocked */
118275970Scy#define	METEOR_STATUS_FIDT	0x0020	/* Field detect: 50/60hz */
119275970Scy#define	METEOR_STATUS_ALTD	0x0002	/* Line alt: no line alt/line alt */
120275970Scy#define METEOR_STATUS_CODE	0x0001	/* Colour info: no colour/colour */
121275970Scy
122275970Scy				/* METEORCAPTUR capture options */
123275970Scy#define METEOR_CAP_SINGLE	0x0001	/* capture one frame */
124275970Scy#define METEOR_CAP_CONTINOUS	0x0002	/* continuously capture */
125275970Scy#define METEOR_CAP_STOP_CONT	0x0004	/* stop the continuous capture */
126275970Scy
127275970Scy				/* METEORCAPFRM capture commands */
128275970Scy#define METEOR_CAP_N_FRAMES	0x0001	/* capture N frames */
129275970Scy#define METEOR_CAP_STOP_FRAMES	0x0002	/* stop capture N frames */
130275970Scy#define	METEOR_HALT_N_FRAMES	0x0003	/* halt of capture N frames */
131275970Scy#define METEOR_CONT_N_FRAMES	0x0004	/* continue after above halt */
132275970Scy
133275970Scy				/* valid video input formats:  */
134275970Scy#define METEOR_FMT_NTSC		0x00100	/* NTSC --  initialized default */
135275970Scy#define METEOR_FMT_PAL		0x00200	/* PAL */
136275970Scy#define METEOR_FMT_SECAM	0x00400	/* SECAM */
137275970Scy#define METEOR_FMT_AUTOMODE	0x00800 /* auto-mode */
138275970Scy#define METEOR_INPUT_DEV0	0x01000	/* camera input 0 -- default */
139275970Scy#define METEOR_INPUT_DEV_RCA	METEOR_INPUT_DEV0
140275970Scy#define METEOR_INPUT_DEV1	0x02000	/* camera input 1 */
141275970Scy#define METEOR_INPUT_DEV2	0x04000	/* camera input 2 */
142275970Scy#define METEOR_INPUT_DEV3	0x08000	/* camera input 3 */
143275970Scy#define METEOR_INPUT_DEV_RGB	0x0a000	/* for rgb version of meteor */
144275970Scy#define METEOR_INPUT_DEV_SVIDEO	0x06000 /* S-video input port */
145275970Scy
146275970Scy				/* valid video output formats:  */
147275970Scy#define METEOR_GEO_RGB16	0x0010000 /* packed -- initialized default */
148275970Scy#define METEOR_GEO_RGB24	0x0020000 /* RBG 24 bits packed */
149275970Scy					  /* internally stored in 32 bits */
150275970Scy#define METEOR_GEO_YUV_PACKED	0x0040000 /* 4-2-2 YUV 16 bits packed */
151275970Scy#define METEOR_GEO_YUV_PLANAR	0x0080000 /* 4-2-2 YUV 16 bits planer */
152275970Scy#define METEOR_GEO_YUV_PLANER	METEOR_GEO_YUV_PLANAR
153275970Scy#define METEOR_GEO_UNSIGNED	0x0400000 /* unsigned uv outputs */
154275970Scy#define METEOR_GEO_EVEN_ONLY	0x1000000 /* set for even only field capture */
155275970Scy#define METEOR_GEO_ODD_ONLY	0x2000000 /* set for odd only field capture */
156275970Scy#define METEOR_GEO_FIELD_MASK	0x3000000
157275970Scy#define METEOR_GEO_YUV_422	0x4000000 /* 4-2-2 YUV in Y-U-V combined */
158275970Scy#define METEOR_GEO_OUTPUT_MASK	0x40f0000
159275970Scy#define METEOR_GEO_YUV_12	0x10000000	/* YUV 12 format */
160275970Scy#define METEOR_GEO_YUV_9	0x40000000	/* YUV 9 format */
161275970Scy
162275970Scy#define	METEOR_FIELD_MODE	0x80000000	/* Field cap or Frame cap */
163275970Scy
164275970Scy#define	METEOR_SIG_MODE_MASK	0xffff0000
165275970Scy#define	METEOR_SIG_FRAME	0x00000000	/* signal every frame */
166275970Scy#define	METEOR_SIG_FIELD	0x00010000	/* signal every field */
167275970Scy
168275970Scy	/* following structure is used to coordinate the synchronous */
169275970Scy
170275970Scystruct meteor_mem {
171275970Scy		/* kernel write only  */
172275970Scy	int	frame_size;	 /* row*columns*depth */
173275970Scy	unsigned num_bufs;	 /* number of frames in buffer (1-32) */
174275970Scy		/* user and kernel change these */
175275970Scy	int	lowat;		 /* kernel starts capture if < this number */
176275970Scy	int	hiwat;		 /* kernel stops capture if > this number.
177275970Scy				    hiwat <= numbufs */
178275970Scy	unsigned active;	 /* bit mask of active frame buffers
179275970Scy				    kernel sets, user clears */
180275970Scy	int	num_active_bufs; /* count of active frame buffer
181275970Scy				    kernel increments, user decrements */
182285612Sdelphij
183285612Sdelphij		/* reference to mmapped data */
184285612Sdelphij	caddr_t	buf;		 /* The real space (virtual addr) */
185285612Sdelphij} ;
186275970Scy
187275970Scy#endif /* !_DEV_BKTR_IOCTL_METEOR_H_ */
188275970Scy