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