Initial import from FreeBSD RELENG_4:
[games.git] / sys / platform / pc32 / include / spigot.h
1 /*
2  * Video spigot capture driver.
3  *
4  * Copyright (c) 1995, Jim Lowe.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer. 2.
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * Version 1.2, Aug 30, 1995.
27  * $FreeBSD: src/sys/i386/include/spigot.h,v 1.5 1999/12/29 04:33:08 peter Exp $
28  */
29
30 #ifndef _MACHINE_SPIGOT_H_
31 #define _MACHINE_SPIGOT_H_
32
33 #include <sys/ioccom.h>
34
35 struct spigot_info {
36         unsigned long   maddr;
37         unsigned short  irq;
38 };
39
40 /*
41  * Get memory address.
42  */
43 #define SPIGOT_GET_INFO         _IOR('s', 4, struct spigot_info)
44 /*
45  * Set up a user interrupt.
46  */
47 #define SPIGOT_SETINT           _IOW('s', 5, int)
48 /*
49  * Allow/disallow access to the I/O Page.
50  */
51 #define SPIGOT_IOPL_ON          _IO ('s', 6)
52 #define SPIGOT_IOPL_OFF         _IO ('s', 7)
53
54 #ifndef _KERNEL
55 /*
56  * Defines for spigot library.
57  */
58 unsigned short *        spigot_open(char *dev);
59 void                    spigot_close(void);
60 void                    spigot_set_capture_size(int width, int vtof);
61 unsigned char           spigot_start_xfer(int num_frames);
62 void                    spigot_stop_xfer(void);
63 unsigned char           spigot_status(void);
64
65 /*
66  * Define the status bits.
67  */
68 #define SPIGOT_COLOR                    0x01    /* Color present (No color) */
69 #define SPIGOT_60HZ                     0x02    /* 60 hz input signal (50hz) */
70 #define SPIGOT_NO_HORIZONTAL_LOCK       0x04    /* Horizontal lock present */
71 #define SPIGOT_HPLL_LOCKED              0x08    /* HPLL locked (HPLL unlocked)*/
72 #define SPIGOT_VCR_MODE                 0x10    /* VCR mode (TV mode) */
73 #define SPIGOT_VSYNC_PRESENT            0x20    /* Vsync present */
74
75 /*
76  * spigot_open() returns a data address pointing to the spigot data.
77  * Each read from this address returns the next word.  The ``dev'' passed
78  * is usually "/dev/spigot".  Data is described in the phillips desktop
79  * video data handbook under the 7191 chip.  Formats may be either
80  * YUV 4:2:2 or YUV 4:1:1.  A sample device driver for ``nv'' is included
81  * with this code.
82  *
83  * spigot_close() cleans up and closes the device.
84  *
85  * spigot_set_capture_size() will set the capture window size.  Width should be
86  * one of:      80, 160, 240, 320, or 640 for NTSC or
87  *              96, 192, 288, 384 for PAL.
88  * vtof is the Vertical top of frame offset and must be between 0 and 15 lines.
89  *
90  * spigot_start_xfer() will start a transfer from the 7191 to the data fifo.
91  * spigot_stop_xfer() will clear the data fifo and abort any transfers.
92  *
93  * spigot_status() will return the above status bits.
94  */
95 #endif /* !_KERNEL */
96
97 #endif /* !_MACHINE_SPIGOT_H_ */