scsi_scanner.h revision 1.8 1 1.8 thorpej /* $NetBSD: scsi_scanner.h,v 1.8 2004/12/07 23:07:31 thorpej Exp $ */
2 1.4 perry
3 1.1 mycroft /*
4 1.1 mycroft * Copyright (c) 1995 Kenneth Stailey. All rights reserved.
5 1.1 mycroft * modified for configurable scanner support by Joachim Koenig
6 1.1 mycroft *
7 1.1 mycroft * Redistribution and use in source and binary forms, with or without
8 1.1 mycroft * modification, are permitted provided that the following conditions
9 1.1 mycroft * are met:
10 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
11 1.1 mycroft * notice, this list of conditions and the following disclaimer.
12 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
14 1.1 mycroft * documentation and/or other materials provided with the distribution.
15 1.1 mycroft * 3. All advertising materials mentioning features or use of this software
16 1.1 mycroft * must display the following acknowledgement:
17 1.1 mycroft * This product includes software developed by Kenneth Stailey.
18 1.1 mycroft * 4. The name of the author may not be used to endorse or promote products
19 1.1 mycroft * derived from this software without specific prior written permission.
20 1.1 mycroft *
21 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.1 mycroft * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.1 mycroft * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.1 mycroft * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.1 mycroft * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.1 mycroft * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.1 mycroft * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.1 mycroft * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.1 mycroft * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.1 mycroft * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.1 mycroft */
32 1.1 mycroft
33 1.1 mycroft /*
34 1.1 mycroft * SCSI scanner interface description
35 1.1 mycroft */
36 1.1 mycroft
37 1.1 mycroft /* SCSI scanner commands */
38 1.1 mycroft #define GET_IMAGE_STATUS 0x0f
39 1.8 thorpej #define READ_10 0x28
40 1.8 thorpej #define WRITE_10 0x2a
41 1.1 mycroft #define OBJECT_POSITION 0x31
42 1.1 mycroft #define GET_BUFFER_STATUS 0x34
43 1.1 mycroft
44 1.1 mycroft /* generic scanner command formats */
45 1.1 mycroft
46 1.1 mycroft struct scsi_rw_scanner {
47 1.1 mycroft #define READ 0x08
48 1.1 mycroft #define WRITE 0x0a
49 1.2 mycroft u_int8_t opcode;
50 1.2 mycroft u_int8_t byte2;
51 1.1 mycroft #define SRW_FIXED 0x01
52 1.2 mycroft u_int8_t len[3];
53 1.2 mycroft u_int8_t control;
54 1.1 mycroft };
55 1.1 mycroft
56 1.1 mycroft struct scsi_set_window {
57 1.1 mycroft #define SET_WINDOW 0x24 /* set params of image area and windows */
58 1.1 mycroft #define GET_WINDOW 0x25
59 1.2 mycroft u_int8_t opcode;
60 1.2 mycroft u_int8_t byte2;
61 1.2 mycroft u_int8_t reserved[4];
62 1.2 mycroft u_int8_t len[3];
63 1.2 mycroft u_int8_t control;
64 1.1 mycroft };
65 1.1 mycroft
66 1.1 mycroft struct scsi_window_header {
67 1.2 mycroft u_int8_t reserved[6];
68 1.2 mycroft u_int8_t len[2];
69 1.1 mycroft };
70 1.1 mycroft
71 1.1 mycroft struct scsi_window_data {
72 1.2 mycroft u_int8_t window_id; /* must be zero */
73 1.2 mycroft u_int8_t res1:7;
74 1.2 mycroft u_int8_t auto_bit:1;
75 1.2 mycroft u_int8_t x_res[2];
76 1.2 mycroft u_int8_t y_res[2];
77 1.2 mycroft u_int8_t x_org[4];
78 1.2 mycroft u_int8_t y_org[4];
79 1.2 mycroft u_int8_t width[4];
80 1.2 mycroft u_int8_t length[4];
81 1.2 mycroft u_int8_t brightness;
82 1.2 mycroft u_int8_t threshold;
83 1.2 mycroft u_int8_t contrast;
84 1.2 mycroft u_int8_t image_comp; /* image composition (data type) */
85 1.2 mycroft u_int8_t bits_per_pixel;
86 1.2 mycroft u_int8_t halftone_pattern[2];
87 1.2 mycroft u_int8_t rif:1; /* reverse image format (mono negative) */
88 1.2 mycroft u_int8_t res2:4;
89 1.2 mycroft u_int8_t pad_type:3;
90 1.2 mycroft u_int8_t bit_ordering[2];
91 1.2 mycroft u_int8_t compression_type;
92 1.2 mycroft u_int8_t compression_arg;
93 1.2 mycroft u_int8_t res3[6];
94 1.1 mycroft };
95 1.1 mycroft
96 1.1 mycroft /* mustek scsi commands */
97 1.1 mycroft
98 1.1 mycroft #define MUSTEK_SET_WINDOW 0x04 /* set image area and windows */
99 1.1 mycroft #define MUSTEK_ADF 0x10 /* ADF and backtracking selection */
100 1.1 mycroft #define MUSTEK_LUT 0x55 /* look up table download */
101