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