ss_mustek.h revision 1.3.2.2 1 1.3.2.2 thorpej /* $NetBSD: ss_mustek.h,v 1.3.2.2 1997/08/27 23:33:36 thorpej Exp $ */
2 1.3.2.2 thorpej
3 1.3.2.2 thorpej /*
4 1.3.2.2 thorpej * Copyright (c) 1995 Joachim Koenig-Baltes. All rights reserved.
5 1.3.2.2 thorpej *
6 1.3.2.2 thorpej * Redistribution and use in source and binary forms, with or without
7 1.3.2.2 thorpej * modification, are permitted provided that the following conditions
8 1.3.2.2 thorpej * are met:
9 1.3.2.2 thorpej * 1. Redistributions of source code must retain the above copyright
10 1.3.2.2 thorpej * notice, this list of conditions and the following disclaimer.
11 1.3.2.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
12 1.3.2.2 thorpej * notice, this list of conditions and the following disclaimer in the
13 1.3.2.2 thorpej * documentation and/or other materials provided with the distribution.
14 1.3.2.2 thorpej * 3. All advertising materials mentioning features or use of this software
15 1.3.2.2 thorpej * must display the following acknowledgement:
16 1.3.2.2 thorpej * This product includes software developed by Joachim Koenig-Baltes.
17 1.3.2.2 thorpej * 4. The name of the author may not be used to endorse or promote products
18 1.3.2.2 thorpej * derived from this software without specific prior written permission.
19 1.3.2.2 thorpej *
20 1.3.2.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.3.2.2 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.3.2.2 thorpej * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.3.2.2 thorpej * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.3.2.2 thorpej * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.3.2.2 thorpej * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.3.2.2 thorpej * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.3.2.2 thorpej * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.3.2.2 thorpej * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.3.2.2 thorpej * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.3.2.2 thorpej */
31 1.3.2.2 thorpej
32 1.3.2.2 thorpej #ifndef _SS_MUSTEK_H_
33 1.3.2.2 thorpej #define _SS_MUSTEK_H_ 1
34 1.3.2.2 thorpej
35 1.3.2.2 thorpej /*
36 1.3.2.2 thorpej * support for MUSTEK flatbed SCSI scanners MFS-06000CX and MFS-12000CX
37 1.3.2.2 thorpej * (600 and 1200 dpi horizontally resp), not conforming to the SCSI2 spec.
38 1.3.2.2 thorpej */
39 1.3.2.2 thorpej
40 1.3.2.2 thorpej /*
41 1.3.2.2 thorpej * Configuration section: describes the mode in which scanner is driven
42 1.3.2.2 thorpej * MUSTEK_INCH_SPEC: frame/window sizes are given in inches instead of
43 1.3.2.2 thorpej * pixels, note: unit is 1/8th of an inch
44 1.3.2.2 thorpej * MUSTEK_WINDOWS: number of windows in a frame, up to 4 allowed,
45 1.3.2.2 thorpej * not used yet, so set to 0
46 1.3.2.2 thorpej */
47 1.3.2.2 thorpej #define MUSTEK_INCH_SPEC /* use inches to specify sizes */
48 1.3.2.2 thorpej #define MUSTEK_WINDOWS 0 /* no window support yet */
49 1.3.2.2 thorpej
50 1.3.2.2 thorpej /* mustek scsi commands */
51 1.3.2.2 thorpej #define MUSTEK_SET_WINDOW 0x04 /* set image area and windows */
52 1.3.2.2 thorpej #define MUSTEK_READ 0x08 /* read command */
53 1.3.2.2 thorpej #define MUSTEK_GET_STATUS 0x0f /* image status */
54 1.3.2.2 thorpej #define MUSTEK_MODE_SELECT 0x15 /* set resolution, paper length, .. */
55 1.3.2.2 thorpej #define MUSTEK_ADF 0x10 /* ADF and backtracking selection */
56 1.3.2.2 thorpej #define MUSTEK_START_STOP 0x1b /* start/stop scan */
57 1.3.2.2 thorpej #define MUSTEK_LUT 0x55 /* look up table download */
58 1.3.2.2 thorpej
59 1.3.2.2 thorpej /* the size spec is at the same bit position in different commands */
60 1.3.2.2 thorpej #define MUSTEK_UNIT_INCHES 0x00
61 1.3.2.2 thorpej #define MUSTEK_UNIT_PIXELS 0x08
62 1.3.2.2 thorpej #ifdef MUSTEK_INCH_SPEC
63 1.3.2.2 thorpej #define MUSTEK_UNIT_SPEC MUSTEK_UNIT_INCHES
64 1.3.2.2 thorpej #else
65 1.3.2.2 thorpej #define MUSTEK_UNIT_SPEC MUSTEK_UNIT_PIXELS
66 1.3.2.2 thorpej #endif
67 1.3.2.2 thorpej
68 1.3.2.2 thorpej /*
69 1.3.2.2 thorpej * SCSI command formats
70 1.3.2.2 thorpej */
71 1.3.2.2 thorpej
72 1.3.2.2 thorpej struct mustek_set_window_cmd {
73 1.3.2.2 thorpej u_int8_t opcode; /* 0x04 */
74 1.3.2.2 thorpej u_int8_t reserved[3];
75 1.3.2.2 thorpej u_int8_t length; /* in bytes */
76 1.3.2.2 thorpej u_int8_t control;
77 1.3.2.2 thorpej };
78 1.3.2.2 thorpej
79 1.3.2.2 thorpej struct mustek_window {
80 1.3.2.2 thorpej u_int8_t header; /* unit-defines also apply */
81 1.3.2.2 thorpej u_int8_t tl_x[2]; /* LSB */
82 1.3.2.2 thorpej u_int8_t tl_y[2];
83 1.3.2.2 thorpej u_int8_t br_x[2];
84 1.3.2.2 thorpej u_int8_t br_y[2];
85 1.3.2.2 thorpej };
86 1.3.2.2 thorpej
87 1.3.2.2 thorpej struct mustek_set_window_data {
88 1.3.2.2 thorpej #define MUSTEK_LINEART_BACKGROUND 0x00
89 1.3.2.2 thorpej #define MUSTEK_HALFTONE_BACKGROUND 0x01
90 1.3.2.2 thorpej struct mustek_window frame;
91 1.3.2.2 thorpej #if MUSTEK_WINDOWS >= 1
92 1.3.2.2 thorpej #define MUSTEK_WINDOW_MASK 0x80
93 1.3.2.2 thorpej struct mustek_window window1;
94 1.3.2.2 thorpej #endif
95 1.3.2.2 thorpej #if MUSTEK_WINDOWS >= 2
96 1.3.2.2 thorpej struct mustek_window window2;
97 1.3.2.2 thorpej #endif
98 1.3.2.2 thorpej #if MUSTEK_WINDOWS >= 3
99 1.3.2.2 thorpej struct mustek_window window3;
100 1.3.2.2 thorpej #endif
101 1.3.2.2 thorpej #if MUSTEK_WINDOWS >= 4
102 1.3.2.2 thorpej struct mustek_window window4;
103 1.3.2.2 thorpej #endif
104 1.3.2.2 thorpej };
105 1.3.2.2 thorpej
106 1.3.2.2 thorpej struct mustek_read_cmd {
107 1.3.2.2 thorpej u_int8_t opcode; /* 0x08 */
108 1.3.2.2 thorpej u_int8_t reserved;
109 1.3.2.2 thorpej u_int8_t length[3];
110 1.3.2.2 thorpej u_int8_t control;
111 1.3.2.2 thorpej };
112 1.3.2.2 thorpej
113 1.3.2.2 thorpej struct mustek_get_status_cmd {
114 1.3.2.2 thorpej u_int8_t opcode; /* 0x0f */
115 1.3.2.2 thorpej u_int8_t reserved[3];
116 1.3.2.2 thorpej u_int8_t length; /* 0x06 */
117 1.3.2.2 thorpej u_int8_t control;
118 1.3.2.2 thorpej };
119 1.3.2.2 thorpej
120 1.3.2.2 thorpej struct mustek_get_status_data {
121 1.3.2.2 thorpej #define MUSTEK_READY 0
122 1.3.2.2 thorpej #define MUSTEK_BUSY -1
123 1.3.2.2 thorpej u_int8_t ready_busy; /* 0 = ready */
124 1.3.2.2 thorpej u_int8_t bytes_per_line[2]; /* LSB */
125 1.3.2.2 thorpej u_int8_t lines[3]; /* LSB */
126 1.3.2.2 thorpej };
127 1.3.2.2 thorpej
128 1.3.2.2 thorpej struct mustek_mode_select_cmd {
129 1.3.2.2 thorpej u_int8_t opcode; /* 0x15 */
130 1.3.2.2 thorpej u_int8_t reserved[2];
131 1.3.2.2 thorpej u_int8_t length[2];
132 1.3.2.2 thorpej u_int8_t control;
133 1.3.2.2 thorpej };
134 1.3.2.2 thorpej
135 1.3.2.2 thorpej /*
136 1.3.2.2 thorpej * resolution settings:
137 1.3.2.2 thorpej * MFS06000CX:
138 1.3.2.2 thorpej * 1% : 0x01 0x02 ... 0x64
139 1.3.2.2 thorpej * 3 6 ... 300 dpi
140 1.3.2.2 thorpej * 10%: 0x1e 0x3c 0x5a 0x14 0x32 0x50 0x0a 0x28 0x46 0x64
141 1.3.2.2 thorpej * 330 360 390 420 450 480 510 540 570 600 dpi
142 1.3.2.2 thorpej * MFS12000CX:
143 1.3.2.2 thorpej * 1% : 0x01 0x02 ... 0x64
144 1.3.2.2 thorpej * 6 12 ... 600 dpi
145 1.3.2.2 thorpej * 10%: 0x1e 0x3c 0x5a 0x14 0x32 0x50 0x0a 0x28 0x46 0x64
146 1.3.2.2 thorpej * 660 720 780 840 900 960 1020 1080 1140 1200 dpi
147 1.3.2.2 thorpej */
148 1.3.2.2 thorpej struct mustek_mode_select_data {
149 1.3.2.2 thorpej #define MUSTEK_MODE_MASK 0x83
150 1.3.2.2 thorpej #define MUSTEK_HT_PATTERN_BUILTIN 0x00
151 1.3.2.2 thorpej #define MUSTEK_HT_PATTERN_DOWNLOADED 0x10
152 1.3.2.2 thorpej u_int8_t mode;
153 1.3.2.2 thorpej u_int8_t resolution;
154 1.3.2.2 thorpej u_int8_t brightness;
155 1.3.2.2 thorpej u_int8_t contrast;
156 1.3.2.2 thorpej u_int8_t grain; /* 0 = 8x8, ..... 5 = 2x2 */
157 1.3.2.2 thorpej u_int8_t velocity; /* 0 = fast, ...., 4 = slow */
158 1.3.2.2 thorpej u_int8_t reserved[2];
159 1.3.2.2 thorpej u_int8_t paperlength[2]; /* LSB */
160 1.3.2.2 thorpej };
161 1.3.2.2 thorpej
162 1.3.2.2 thorpej struct mustek_start_scan_cmd {
163 1.3.2.2 thorpej u_int8_t opcode; /* 0x1b */
164 1.3.2.2 thorpej u_int8_t reserved[3];
165 1.3.2.2 thorpej #define MUSTEK_SCAN_STOP 0x00
166 1.3.2.2 thorpej #define MUSTEK_SCAN_START 0x01
167 1.3.2.2 thorpej #define MUSTEK_GRAY_FILTER 0x00
168 1.3.2.2 thorpej #define MUSTEK_RED_FILTER 0x08
169 1.3.2.2 thorpej #define MUSTEK_GREEN_FILTER 0x10
170 1.3.2.2 thorpej #define MUSTEK_BLUE_FILTER 0x18
171 1.3.2.2 thorpej #define MUSTEK_GRAY_MODE 0x40
172 1.3.2.2 thorpej #define MUSTEK_BIT_MODE 0x00
173 1.3.2.2 thorpej #define MUSTEK_RES_STEP_1 0x00
174 1.3.2.2 thorpej #define MUSTEK_RES_STEP_10 0x80
175 1.3.2.2 thorpej u_int8_t mode;
176 1.3.2.2 thorpej u_int8_t control;
177 1.3.2.2 thorpej };
178 1.3.2.2 thorpej
179 1.3.2.2 thorpej #endif /* _SS_MUSTEK_H_ */
180