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