ioctl_meteor.h revision 123223
11573Srgrimes/*
21573Srgrimes * Copyright (c) 1995 Mark Tinguely and Jim Lowe
31573Srgrimes * All rights reserved.
41573Srgrimes *
51573Srgrimes * Redistribution and use in source and binary forms, with or without
61573Srgrimes * modification, are permitted provided that the following conditions
71573Srgrimes * are met:
81573Srgrimes * 1. Redistributions of source code must retain the above copyright
91573Srgrimes *    notice, this list of conditions and the following disclaimer.
101573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111573Srgrimes *    notice, this list of conditions and the following disclaimer in the
121573Srgrimes *    documentation and/or other materials provided with the distribution.
131573Srgrimes * 3. All advertising materials mentioning features or use of this software
141573Srgrimes *    must display the following acknowledgement:
151573Srgrimes *	This product includes software developed by Mark Tinguely and Jim Lowe
16148834Sstefanf * 4. The name of the author may not be used to endorse or promote products
171573Srgrimes *    derived from this software without specific prior written permission.
181573Srgrimes *
191573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
201573Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
211573Srgrimes * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
221573Srgrimes * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
231573Srgrimes * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
241573Srgrimes * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
251573Srgrimes * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
261573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
271573Srgrimes * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
281573Srgrimes * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291573Srgrimes * POSSIBILITY OF SUCH DAMAGE.
301573Srgrimes *
3184260Sobrien * $FreeBSD: head/sys/i386/include/ioctl_meteor.h 123223 2003-12-07 06:37:32Z imp $
32237448Spfg */
331573Srgrimes/*
341573Srgrimes *	ioctl constants for Matrox Meteor Capture card.
351573Srgrimes */
3611678Sbde
371573Srgrimes#ifndef	_MACHINE_IOCTL_METEOR_H_
3884260Sobrien#define	_MACHINE_IOCTL_METEOR_H_
3984260Sobrien
401573Srgrimes#ifndef _KERNEL
411573Srgrimes#include <sys/types.h>
421573Srgrimes#endif
431573Srgrimes#include <sys/ioccom.h>
441573Srgrimes
451573Srgrimesstruct meteor_capframe {
461573Srgrimes	short	command;	/* see below for valid METEORCAPFRM commands */
471573Srgrimes	short	lowat;		/* start transfer if < this number */
481573Srgrimes	short	hiwat;		/* stop transfer if > this number */
491573Srgrimes} ;
501573Srgrimes
519898Sache/* structure for METEOR[GS]ETGEO - get/set geometry  */
52148834Sstefanfstruct meteor_geomet {
53148834Sstefanf	u_short		rows;
54148834Sstefanf	u_short		columns;
551573Srgrimes	u_short		frames;
5617141Sjkh	u_long		oformat;
571573Srgrimes} ;
581573Srgrimes
591573Srgrimes/* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
601573Srgrimesstruct meteor_counts {
611573Srgrimes	u_long fifo_errors;	/* count of fifo errors since open */
621573Srgrimes	u_long dma_errors;	/* count of dma errors since open */
631573Srgrimes	u_long frames_captured;	/* count of frames captured since open */
641573Srgrimes	u_long even_fields_captured; /* count of even fields captured */
651573Srgrimes	u_long odd_fields_captured; /* count of odd fields captured */
661573Srgrimes} ;
6784260Sobrien
681573Srgrimes/* structure for getting and setting direct transfers to vram */
6984260Sobrienstruct meteor_video {
7084260Sobrien	u_long	addr;	/* Address of location to dma to */
7184260Sobrien	u_long	width;	/* Width of memory area */
7284260Sobrien	u_long	banksize;	/* Size of Vram bank */
731573Srgrimes	u_long	ramsize;	/* Size of Vram */
7484260Sobrien};
7584260Sobrien
7684260Sobrien#define METEORCAPTUR _IOW('x', 1, int)			 /* capture a frame */
7784260Sobrien#define METEORCAPFRM _IOW('x', 2, struct meteor_capframe)  /* sync capture */
7884260Sobrien#define METEORSETGEO _IOW('x', 3, struct meteor_geomet)  /* set geometry */
7984260Sobrien#define METEORGETGEO _IOR('x', 4, struct meteor_geomet)  /* get geometry */
8084260Sobrien#define METEORSTATUS _IOR('x', 5, unsigned short)	/* get status */
8184260Sobrien#define METEORSHUE   _IOW('x', 6, signed char)		/* set hue */
8284260Sobrien#define METEORGHUE   _IOR('x', 6, signed char)		/* get hue */
8384260Sobrien#define METEORSFMT   _IOW('x', 7, unsigned long)	/* set format */
8484260Sobrien#define METEORGFMT   _IOR('x', 7, unsigned long)	/* get format */
8584260Sobrien#define METEORSINPUT _IOW('x', 8, unsigned long)	/* set input dev */
8684260Sobrien#define METEORGINPUT _IOR('x', 8, unsigned long)	/* get input dev */
8784260Sobrien#define	METEORSCHCV  _IOW('x', 9, unsigned char)	/* set uv gain */
8884260Sobrien#define	METEORGCHCV  _IOR('x', 9, unsigned char)	/* get uv gain */
8984260Sobrien#define	METEORSCOUNT _IOW('x',10, struct meteor_counts)
9084260Sobrien#define	METEORGCOUNT _IOR('x',10, struct meteor_counts)
9184260Sobrien#define METEORSFPS   _IOW('x',11, unsigned short)	/* set fps */
9284260Sobrien#define METEORGFPS   _IOR('x',11, unsigned short)	/* get fps */
9384260Sobrien#define METEORSSIGNAL _IOW('x', 12, unsigned int)	/* set signal */
9484260Sobrien#define METEORGSIGNAL _IOR('x', 12, unsigned int)	/* get signal */
9584260Sobrien#define	METEORSVIDEO _IOW('x', 13, struct meteor_video)	/* set video */
9684260Sobrien#define	METEORGVIDEO _IOR('x', 13, struct meteor_video)	/* get video */
9784260Sobrien#define	METEORSBRIG  _IOW('x', 14, unsigned char)	/* set brightness */
9884260Sobrien#define METEORGBRIG  _IOR('x', 14, unsigned char)	/* get brightness */
9984260Sobrien#define	METEORSCSAT  _IOW('x', 15, unsigned char)	/* set chroma sat */
10084260Sobrien#define METEORGCSAT  _IOR('x', 15, unsigned char)	/* get uv saturation */
10184260Sobrien#define	METEORSCONT  _IOW('x', 16, unsigned char)	/* set contrast */
10284260Sobrien#define	METEORGCONT  _IOR('x', 16, unsigned char)	/* get contrast */
10384260Sobrien#define METEORSBT254 _IOW('x', 17, unsigned short)	/* set Bt254 reg */
10484260Sobrien#define METEORGBT254 _IOR('x', 17, unsigned short)	/* get Bt254 reg */
10584260Sobrien#define METEORSHWS   _IOW('x', 18, unsigned char)	/* set hor start reg */
10684260Sobrien#define METEORGHWS   _IOR('x', 18, unsigned char)	/* get hor start reg */
10784260Sobrien#define METEORSVWS   _IOW('x', 19, unsigned char)	/* set vert start reg */
10884260Sobrien#define METEORGVWS   _IOR('x', 19, unsigned char)	/* get vert start reg */
10984260Sobrien#define	METEORSTS    _IOW('x', 20, unsigned char)	/* set time stamp */
11084260Sobrien#define	METEORGTS    _IOR('x', 20, unsigned char)	/* get time stamp */
11184260Sobrien
11284260Sobrien#define	METEOR_STATUS_ID_MASK	0xf000	/* ID of 7196 */
11384260Sobrien#define	METEOR_STATUS_DIR	0x0800	/* Direction of Expansion port YUV */
11484260Sobrien#define	METEOR_STATUS_OEF	0x0200	/* Field detected: Even/Odd */
11584260Sobrien#define	METEOR_STATUS_SVP	0x0100	/* State of VRAM Port:inactive/active */
11684260Sobrien#define	METEOR_STATUS_STTC	0x0080	/* Time Constant: TV/VCR */
11784260Sobrien#define	METEOR_STATUS_HCLK	0x0040	/* Horiz PLL: locked/unlocked */
11884260Sobrien#define	METEOR_STATUS_FIDT	0x0020	/* Field detect: 50/60hz */
11984260Sobrien#define	METEOR_STATUS_ALTD	0x0002	/* Line alt: no line alt/line alt */
12084260Sobrien#define METEOR_STATUS_CODE	0x0001	/* Colour info: no colour/colour */
12184260Sobrien
12284260Sobrien				/* METEORCAPTUR capture options */
12384260Sobrien#define METEOR_CAP_SINGLE	0x0001	/* capture one frame */
12484260Sobrien#define METEOR_CAP_CONTINOUS	0x0002	/* continuously capture */
12584260Sobrien#define METEOR_CAP_STOP_CONT	0x0004	/* stop the continuous capture */
12684260Sobrien
12784260Sobrien				/* METEORCAPFRM capture commands */
12884260Sobrien#define METEOR_CAP_N_FRAMES	0x0001	/* capture N frames */
12984260Sobrien#define METEOR_CAP_STOP_FRAMES	0x0002	/* stop capture N frames */
13084260Sobrien#define	METEOR_HALT_N_FRAMES	0x0003	/* halt of capture N frames */
13184260Sobrien#define METEOR_CONT_N_FRAMES	0x0004	/* continue after above halt */
13284260Sobrien
13384260Sobrien				/* valid video input formats:  */
13484260Sobrien#define METEOR_FMT_NTSC		0x00100	/* NTSC --  initialized default */
13584260Sobrien#define METEOR_FMT_PAL		0x00200	/* PAL */
13684260Sobrien#define METEOR_FMT_SECAM	0x00400	/* SECAM */
13784260Sobrien#define METEOR_FMT_AUTOMODE	0x00800 /* auto-mode */
13884260Sobrien#define METEOR_INPUT_DEV0	0x01000	/* camera input 0 -- default */
13984260Sobrien#define METEOR_INPUT_DEV_RCA	METEOR_INPUT_DEV0
14084260Sobrien#define METEOR_INPUT_DEV1	0x02000	/* camera input 1 */
14184260Sobrien#define METEOR_INPUT_DEV2	0x04000	/* camera input 2 */
14284260Sobrien#define METEOR_INPUT_DEV3	0x08000	/* camera input 3 */
14384260Sobrien#define METEOR_INPUT_DEV_RGB	0x0a000	/* for rgb version of meteor */
14484260Sobrien#define METEOR_INPUT_DEV_SVIDEO	0x06000 /* S-video input port */
14584260Sobrien
14684260Sobrien				/* valid video output formats:  */
14784260Sobrien#define METEOR_GEO_RGB16	0x0010000 /* packed -- initialized default */
14884260Sobrien#define METEOR_GEO_RGB24	0x0020000 /* RBG 24 bits packed */
1491573Srgrimes					  /* internally stored in 32 bits */
15084260Sobrien#define METEOR_GEO_YUV_PACKED	0x0040000 /* 4-2-2 YUV 16 bits packed */
15184260Sobrien#define METEOR_GEO_YUV_PLANAR	0x0080000 /* 4-2-2 YUV 16 bits planer */
15284260Sobrien#define METEOR_GEO_YUV_PLANER	METEOR_GEO_YUV_PLANAR
15384260Sobrien#define METEOR_GEO_UNSIGNED	0x0400000 /* unsigned uv outputs */
15484260Sobrien#define METEOR_GEO_EVEN_ONLY	0x1000000 /* set for even only field capture */
15584260Sobrien#define METEOR_GEO_ODD_ONLY	0x2000000 /* set for odd only field capture */
15684260Sobrien#define METEOR_GEO_FIELD_MASK	0x3000000
15784260Sobrien#define METEOR_GEO_YUV_422	0x4000000 /* 4-2-2 YUV in Y-U-V combined */
15884260Sobrien#define METEOR_GEO_OUTPUT_MASK	0x40f0000
15984260Sobrien#define METEOR_GEO_YUV_12	0x10000000	/* YUV 12 format */
16084260Sobrien#define METEOR_GEO_YUV_9	0x40000000	/* YUV 9 format */
16184260Sobrien
1621573Srgrimes#define	METEOR_FIELD_MODE	0x80000000	/* Field cap or Frame cap */
16384260Sobrien
1641573Srgrimes#define	METEOR_SIG_MODE_MASK	0xffff0000
16584260Sobrien#define	METEOR_SIG_FRAME	0x00000000	/* signal every frame */
1661573Srgrimes#define	METEOR_SIG_FIELD	0x00010000	/* signal every field */
16784260Sobrien
1681573Srgrimes	/* following structure is used to coordinate the synchronous */
16984260Sobrien
1701573Srgrimesstruct meteor_mem {
17184260Sobrien		/* kernel write only  */
1721573Srgrimes	int	frame_size;	 /* row*columns*depth */
17384260Sobrien	unsigned num_bufs;	 /* number of frames in buffer (1-32) */
1741573Srgrimes		/* user and kernel change these */
17584260Sobrien	int	lowat;		 /* kernel starts capture if < this number */
1761573Srgrimes	int	hiwat;		 /* kernel stops capture if > this number.
17784260Sobrien				    hiwat <= numbufs */
1788870Srgrimes	unsigned active;	 /* bit mask of active frame buffers
17984260Sobrien				    kernel sets, user clears */
1801573Srgrimes	int	num_active_bufs; /* count of active frame buffer
18184260Sobrien				    kernel increments, user decrements */
1821573Srgrimes
18384260Sobrien		/* reference to mmapped data */
1841573Srgrimes	caddr_t	buf;		 /* The real space (virtual addr) */
18584260Sobrien} ;
18684260Sobrien
18784260Sobrien#endif /* !_MACHINE_IOCTL_METEOR_H_ */
18884260Sobrien