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