Merge branch 'vendor/GCC44'
[dragonfly.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  * $DragonFly: src/sys/platform/pc32/include/spigot.h,v 1.2 2003/06/17 04:28:36 dillon Exp $
29  */
30
31 #ifndef _MACHINE_SPIGOT_H_
32 #define _MACHINE_SPIGOT_H_
33
34 #include <sys/ioccom.h>
35
36 struct spigot_info {
37         unsigned long   maddr;
38         unsigned short  irq;
39 };
40
41 /*
42  * Get memory address.
43  */
44 #define SPIGOT_GET_INFO         _IOR('s', 4, struct spigot_info)
45 /*
46  * Set up a user interrupt.
47  */
48 #define SPIGOT_SETINT           _IOW('s', 5, int)
49 /*
50  * Allow/disallow access to the I/O Page.
51  */
52 #define SPIGOT_IOPL_ON          _IO ('s', 6)
53 #define SPIGOT_IOPL_OFF         _IO ('s', 7)
54
55 #ifndef _KERNEL
56 /*
57  * Defines for spigot library.
58  */
59 unsigned short *        spigot_open(char *dev);
60 void                    spigot_close(void);
61 void                    spigot_set_capture_size(int width, int vtof);
62 unsigned char           spigot_start_xfer(int num_frames);
63 void                    spigot_stop_xfer(void);
64 unsigned char           spigot_status(void);
65
66 /*
67  * Define the status bits.
68  */
69 #define SPIGOT_COLOR                    0x01    /* Color present (No color) */
70 #define SPIGOT_60HZ                     0x02    /* 60 hz input signal (50hz) */
71 #define SPIGOT_NO_HORIZONTAL_LOCK       0x04    /* Horizontal lock present */
72 #define SPIGOT_HPLL_LOCKED              0x08    /* HPLL locked (HPLL unlocked)*/
73 #define SPIGOT_VCR_MODE                 0x10    /* VCR mode (TV mode) */
74 #define SPIGOT_VSYNC_PRESENT            0x20    /* Vsync present */
75
76 /*
77  * spigot_open() returns a data address pointing to the spigot data.
78  * Each read from this address returns the next word.  The ``dev'' passed
79  * is usually "/dev/spigot".  Data is described in the phillips desktop
80  * video data handbook under the 7191 chip.  Formats may be either
81  * YUV 4:2:2 or YUV 4:1:1.  A sample device driver for ``nv'' is included
82  * with this code.
83  *
84  * spigot_close() cleans up and closes the device.
85  *
86  * spigot_set_capture_size() will set the capture window size.  Width should be
87  * one of:      80, 160, 240, 320, or 640 for NTSC or
88  *              96, 192, 288, 384 for PAL.
89  * vtof is the Vertical top of frame offset and must be between 0 and 15 lines.
90  *
91  * spigot_start_xfer() will start a transfer from the 7191 to the data fifo.
92  * spigot_stop_xfer() will clear the data fifo and abort any transfers.
93  *
94  * spigot_status() will return the above status bits.
95  */
96 #endif /* !_KERNEL */
97
98 #endif /* !_MACHINE_SPIGOT_H_ */