what the heck one last one before i go take a nap...
[dragonfly.git] / sys / i386 / include / ioctl_meteor.h
1 /*
2  * Copyright (c) 1995 Mark Tinguely and Jim Lowe
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Mark Tinguely and Jim Lowe
16  * 4. The name of the author may not be used to endorse or promote products 
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  * $FreeBSD: src/sys/i386/include/ioctl_meteor.h,v 1.11 1999/12/29 04:33:02 peter Exp $
32  * $DragonFly: src/sys/i386/include/Attic/ioctl_meteor.h,v 1.2 2003/06/17 04:28:35 dillon Exp $
33  */
34 /*
35  *      ioctl constants for Matrox Meteor Capture card.
36  */
37
38 #ifndef _MACHINE_IOCTL_METEOR_H_
39 #define _MACHINE_IOCTL_METEOR_H_
40
41 #ifndef _KERNEL
42 #include <sys/types.h>
43 #endif
44 #include <sys/ioccom.h>
45
46 struct meteor_capframe {
47         short   command;        /* see below for valid METEORCAPFRM commands */
48         short   lowat;          /* start transfer if < this number */
49         short   hiwat;          /* stop transfer if > this number */
50 } ;
51
52 /* structure for METEOR[GS]ETGEO - get/set geometry  */
53 struct meteor_geomet {
54         u_short         rows;
55         u_short         columns;
56         u_short         frames;
57         u_long          oformat;
58 } ;
59
60 /* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
61 struct meteor_counts {
62         u_long fifo_errors;     /* count of fifo errors since open */
63         u_long dma_errors;      /* count of dma errors since open */
64         u_long frames_captured; /* count of frames captured since open */
65         u_long even_fields_captured; /* count of even fields captured */
66         u_long odd_fields_captured; /* count of odd fields captured */
67 } ;
68
69 /* structure for getting and setting direct transfers to vram */
70 struct meteor_video {
71         u_long  addr;   /* Address of location to dma to */
72         u_long  width;  /* Width of memory area */
73         u_long  banksize;       /* Size of Vram bank */
74         u_long  ramsize;        /* Size of Vram */
75 };
76
77 #define METEORCAPTUR _IOW('x', 1, int)                   /* capture a frame */
78 #define METEORCAPFRM _IOW('x', 2, struct meteor_capframe)  /* sync capture */
79 #define METEORSETGEO _IOW('x', 3, struct meteor_geomet)  /* set geometry */
80 #define METEORGETGEO _IOR('x', 4, struct meteor_geomet)  /* get geometry */
81 #define METEORSTATUS _IOR('x', 5, unsigned short)       /* get status */
82 #define METEORSHUE   _IOW('x', 6, signed char)          /* set hue */
83 #define METEORGHUE   _IOR('x', 6, signed char)          /* get hue */
84 #define METEORSFMT   _IOW('x', 7, unsigned long)        /* set format */
85 #define METEORGFMT   _IOR('x', 7, unsigned long)        /* get format */
86 #define METEORSINPUT _IOW('x', 8, unsigned long)        /* set input dev */
87 #define METEORGINPUT _IOR('x', 8, unsigned long)        /* get input dev */
88 #define METEORSCHCV  _IOW('x', 9, unsigned char)        /* set uv gain */
89 #define METEORGCHCV  _IOR('x', 9, unsigned char)        /* get uv gain */
90 #define METEORSCOUNT _IOW('x',10, struct meteor_counts)
91 #define METEORGCOUNT _IOR('x',10, struct meteor_counts)
92 #define METEORSFPS   _IOW('x',11, unsigned short)       /* set fps */
93 #define METEORGFPS   _IOR('x',11, unsigned short)       /* get fps */
94 #define METEORSSIGNAL _IOW('x', 12, unsigned int)       /* set signal */
95 #define METEORGSIGNAL _IOR('x', 12, unsigned int)       /* get signal */
96 #define METEORSVIDEO _IOW('x', 13, struct meteor_video) /* set video */
97 #define METEORGVIDEO _IOR('x', 13, struct meteor_video) /* get video */
98 #define METEORSBRIG  _IOW('x', 14, unsigned char)       /* set brightness */
99 #define METEORGBRIG  _IOR('x', 14, unsigned char)       /* get brightness */
100 #define METEORSCSAT  _IOW('x', 15, unsigned char)       /* set chroma sat */
101 #define METEORGCSAT  _IOR('x', 15, unsigned char)       /* get uv saturation */
102 #define METEORSCONT  _IOW('x', 16, unsigned char)       /* set contrast */
103 #define METEORGCONT  _IOR('x', 16, unsigned char)       /* get contrast */
104 #define METEORSBT254 _IOW('x', 17, unsigned short)      /* set Bt254 reg */
105 #define METEORGBT254 _IOR('x', 17, unsigned short)      /* get Bt254 reg */
106 #define METEORSHWS   _IOW('x', 18, unsigned char)       /* set hor start reg */
107 #define METEORGHWS   _IOR('x', 18, unsigned char)       /* get hor start reg */
108 #define METEORSVWS   _IOW('x', 19, unsigned char)       /* set vert start reg */
109 #define METEORGVWS   _IOR('x', 19, unsigned char)       /* get vert start reg */
110 #define METEORSTS    _IOW('x', 20, unsigned char)       /* set time stamp */
111 #define METEORGTS    _IOR('x', 20, unsigned char)       /* get time stamp */
112
113 #define METEOR_STATUS_ID_MASK   0xf000  /* ID of 7196 */
114 #define METEOR_STATUS_DIR       0x0800  /* Direction of Expansion port YUV */
115 #define METEOR_STATUS_OEF       0x0200  /* Field detected: Even/Odd */
116 #define METEOR_STATUS_SVP       0x0100  /* State of VRAM Port:inactive/active */
117 #define METEOR_STATUS_STTC      0x0080  /* Time Constant: TV/VCR */
118 #define METEOR_STATUS_HCLK      0x0040  /* Horiz PLL: locked/unlocked */
119 #define METEOR_STATUS_FIDT      0x0020  /* Field detect: 50/60hz */
120 #define METEOR_STATUS_ALTD      0x0002  /* Line alt: no line alt/line alt */
121 #define METEOR_STATUS_CODE      0x0001  /* Colour info: no colour/colour */
122
123                                 /* METEORCAPTUR capture options */
124 #define METEOR_CAP_SINGLE       0x0001  /* capture one frame */
125 #define METEOR_CAP_CONTINOUS    0x0002  /* continuously capture */
126 #define METEOR_CAP_STOP_CONT    0x0004  /* stop the continuous capture */
127
128                                 /* METEORCAPFRM capture commands */
129 #define METEOR_CAP_N_FRAMES     0x0001  /* capture N frames */
130 #define METEOR_CAP_STOP_FRAMES  0x0002  /* stop capture N frames */
131 #define METEOR_HALT_N_FRAMES    0x0003  /* halt of capture N frames */
132 #define METEOR_CONT_N_FRAMES    0x0004  /* continue after above halt */
133
134                                 /* valid video input formats:  */
135 #define METEOR_FMT_NTSC         0x00100 /* NTSC --  initialized default */
136 #define METEOR_FMT_PAL          0x00200 /* PAL */
137 #define METEOR_FMT_SECAM        0x00400 /* SECAM */
138 #define METEOR_FMT_AUTOMODE     0x00800 /* auto-mode */
139 #define METEOR_INPUT_DEV0       0x01000 /* camera input 0 -- default */
140 #define METEOR_INPUT_DEV_RCA    METEOR_INPUT_DEV0
141 #define METEOR_INPUT_DEV1       0x02000 /* camera input 1 */
142 #define METEOR_INPUT_DEV2       0x04000 /* camera input 2 */
143 #define METEOR_INPUT_DEV3       0x08000 /* camera input 3 */
144 #define METEOR_INPUT_DEV_RGB    0x0a000 /* for rgb version of meteor */
145 #define METEOR_INPUT_DEV_SVIDEO 0x06000 /* S-video input port */
146
147                                 /* valid video output formats:  */
148 #define METEOR_GEO_RGB16        0x0010000 /* packed -- initialized default */
149 #define METEOR_GEO_RGB24        0x0020000 /* RBG 24 bits packed */
150                                           /* internally stored in 32 bits */
151 #define METEOR_GEO_YUV_PACKED   0x0040000 /* 4-2-2 YUV 16 bits packed */
152 #define METEOR_GEO_YUV_PLANAR   0x0080000 /* 4-2-2 YUV 16 bits planer */
153 #define METEOR_GEO_YUV_PLANER   METEOR_GEO_YUV_PLANAR
154 #define METEOR_GEO_UNSIGNED     0x0400000 /* unsigned uv outputs */
155 #define METEOR_GEO_EVEN_ONLY    0x1000000 /* set for even only field capture */
156 #define METEOR_GEO_ODD_ONLY     0x2000000 /* set for odd only field capture */
157 #define METEOR_GEO_FIELD_MASK   0x3000000
158 #define METEOR_GEO_YUV_422      0x4000000 /* 4-2-2 YUV in Y-U-V combined */
159 #define METEOR_GEO_OUTPUT_MASK  0x40f0000
160 #define METEOR_GEO_YUV_12       0x10000000      /* YUV 12 format */
161 #define METEOR_GEO_YUV_9        0x40000000      /* YUV 9 format */
162
163 #define METEOR_FIELD_MODE       0x80000000      /* Field cap or Frame cap */
164
165 #define METEOR_SIG_MODE_MASK    0xffff0000
166 #define METEOR_SIG_FRAME        0x00000000      /* signal every frame */
167 #define METEOR_SIG_FIELD        0x00010000      /* signal every field */
168
169         /* following structure is used to coordinate the synchronous */
170            
171 struct meteor_mem {
172                 /* kernel write only  */
173         int     frame_size;      /* row*columns*depth */
174         unsigned num_bufs;       /* number of frames in buffer (1-32) */
175                 /* user and kernel change these */
176         int     lowat;           /* kernel starts capture if < this number */
177         int     hiwat;           /* kernel stops capture if > this number.
178                                     hiwat <= numbufs */
179         unsigned active;         /* bit mask of active frame buffers
180                                     kernel sets, user clears */
181         int     num_active_bufs; /* count of active frame buffer
182                                     kernel increments, user decrements */
183
184                 /* reference to mmapped data */
185         caddr_t buf;             /* The real space (virtual addr) */
186 } ;
187
188 #endif /* !_MACHINE_IOCTL_METEOR_H_ */