1 /*
2 * Connectix QuickCam parallel-port camera video capture driver.
3 * Copyright (c) 1996, Paul Traina.
4 *
5 * This driver is based in part on work
6 * Copyright (c) 1996, Thomas Davis.
7 *
8 * QuickCam(TM) is a registered trademark of Connectix Inc.
9 * Use this driver at your own risk, it is not warranted by
10 * Connectix or the authors.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer
17 * in this position and unchanged.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. The name of the author may not be used to endorse or promote products
22 * derived from this software withough specific prior written permission
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 * The information in this file is private and shared between various
36 * parts of the QuickCam(TM) driver.
37 */
38
39 #ifndef _QCAM_DEFS_H
40 #define _QCAM_DEFS_H 1
41
42 extern int qcam_debug;
43
44 struct qcam_softc {
45
46 #if defined(bsdi) && defined(KERNEL)
47 /* must be first in structure */
48 struct device sc_dev; /* kernel configuration */
49 #endif /* bsdi KERNEL */
50
51 u_char *buffer; /* frame buffer */
52 u_char *buffer_end; /* end of frame buffer */
53 u_int flags;
54 u_int iobase;
55 int unit; /* device */
56 void (*scanner)(struct qcam_softc *);
57
58 int init_req; /* initialization required */
59 int x_size; /* pixels */
60 int y_size; /* pixels */
61 int x_origin; /* ?? units */
62 int y_origin; /* ?? units */
63 int zoom; /* 0=none, 1=1.5x, 2=2x */
64 int bpp; /* 4 or 6 */
65 int exposure; /* time to open shutter */
66 u_char xferparms; /* calcualted transfer params */
67 u_char contrast;
68 u_char brightness;
69 u_char whitebalance;
70
71 #if defined(__FreeBSD__) && defined(KERNEL)
72 #ifdef DEVFS
73 void *devfs_token; /* device filesystem handle */
74 #endif /* DEVFS */
75 #endif /* __FreeBSD__ KERNEL */
76 };
77
78 /* flags in softc */
79 #define QC_OPEN 0x01 /* device open */
80 #define QC_ALIVE 0x02 /* probed and attached */
81 #define QC_BIDIR_HW 0x04 /* bidir parallel port */
82 #define QC_FORCEUNI 0x08 /* ...but force unidir mode */
83
84 #define QC_MAXFRAMEBUFSIZE (QC_MAX_XSIZE*QC_MAX_YSIZE)
85
86 #ifdef __linux__ /* Linux is backwards from *BSD */
87
88 #define read_data(P) inb((P))
89 #define read_data_word(P) inw((P))
90 #define read_status(P) inb((P)+1)
91 #define write_data(P, V) outb((V), (P)+0)
92 #define write_status(P, V) outb((V), (P)+1)
93 #define write_control(P, V) outb((V), (P)+2)
94
95 #define LONGDELAY(n) tsleep((n)/1000)
96
97 #else /* FreeBSD/NetBSD/BSDI */
98
99 #define read_data(P) inb((P))
100 #define read_data_word(P) inw((P))
101 #define read_status(P) inb((P)+1)
102 #define write_data(P, V) outb((P)+0, (V))
103 #define write_status(P, V) outb((P)+1, (V))
104 #define write_control(P, V) outb((P)+2, (V))
105
106 #define LONGDELAY(n) DELAY(n)
107
108 #ifndef KERNEL
109 #define DELAY(n) usleep(n)
110 #endif
111
112 #ifndef min
113 #define min(a, b) ((a) < (b) ? (a) : (b))
114 #endif
115
116 #endif
117
118 #define QC_TIMEOUT_INIT 60000 /* timeout for first
119 read of scan */
120 #define QC_TIMEOUT_CMD 5000 /* timeout for control cmds */
121 #define QC_TIMEOUT 400 /* timeout on scan reads */
122
123 /* This value could be OS
124 dependant */
125 #define QC_DEF_EXPOSURE 200 /* default exposure */
126
127 extern int qcam_detect __P((u_int port));
128 extern void qcam_reset __P((struct qcam_softc *qs));
129 extern int qcam_scan __P((struct qcam_softc *qs));
130 extern void qcam_default __P((struct qcam_softc *qs));
131 extern int qcam_ioctl_get __P((struct qcam_softc *qs,
132 struct qcam *info));
133 extern int qcam_ioctl_set __P((struct qcam_softc *qs,
134 struct qcam *info));
135 #endif /* _QCAM_DEFS_H */
Cache object: 5a962a443ff2a1e26df696061814a8e8
|