Avision Scanner SCSI protocol V2.0 Rev date: 07/15/97' 1.1 SCSI Specification SCSI Version : SCSI-II, X3.131-199x, Mar. 9, 1990 Physical Specification Driver/Receiver : Single_ended Alternative Connector Alternative : Shielded Connector Alternative 2 - A Cable Cable Alternative : 25-signal twisted-pair cable Bus Termination Method : Optional built-in Alternative 1 termination method Protocol Specification SCSI-I Compatible : Yes CCS Compatible : No Information : Asynchronous Information Transfer Method Transfer Reset Alternative : Hard Reset Alternative Reselection Mode : No Linked Command : No Relative Address Mode : No Role : Target No. of Attatched L.U. : 1, (built-in, LUN = 0) 1.2 SCSI Protocol This chapter will describe the SCSI protocol used by Avision Scanner. The chapter is divided into three sections. Section 1 will describe the command set and their formats in detail. Section 2 will describe the status byte used by Avision Scanner. And Section 3 will describe the message system used by Avision Scanner Image Scanner. 1.3 Command Set and Command Format The commands used are abstracted from chapters 7 and 14 of this standard. All mandatory commands and some optional commands are adopted. For each command, the command format, field description, and data transfer during DATA IN/DATA OUT phase will be stated. Below is the command list for Avision Scanner. Command Name Code Type No. of Bytes INQUIRY 12h M 6 OBJECT POSITION 31h O 10 READ 28h M 10 RELEASE UNIT 17h M 6 REQUEST SENSE 03h M 6 RESERVE UNIT 16h M 6 SCAN 1Bh O 6 SEND DIAGNOSTIC 1Dh M 6 SET WINDOW 24h M 10 TEST UNIT READY 00h M 6 *** Note : O -- Optional M -- Mandatory Command : Inquiry Type : Mandatory Operation Code : 12h Group : 1 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (12h) | ------+--------------------+---------------------------+------| 1 | Logical Unit No. | Reserved | EVPO | ------+--------------------+---------------------------+------| 2 | Page Code (00h) | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Allocation Length (60H) | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Field Descriptions: EVPO : 0b. It means that Avision Scanner will return with the standard INQUIRY data format. Page Code : 00h in Avision Scanner. Standard INQUIRY Data Format: ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 |Peripheral Qualifier| Peripheral Device Type | ------+------+-------------+----------------------------------| 1 | RMB | Device Type Modifier | ------+------+------+--------------------+--------------------| 2 | ISO Version | ECMA Version | ANSI Version | ------+------+------+-------------+------+--------------------| 3 | AENC |TrmIOP| Reserved | Response Data Format | ------+------+------+-------------+---------------------------| 4 | Additional Length (n-4) | ------+-------------------------------------------------------| 5 | Reserved | ------+-------------------------------------------------------| 6 | Reserved | ------+------+------+------+------+------+------+------+------| 7 |RelAdr|WBus32|WBus16| Sync |Linked|Reser |CmdQue|Sftre | ------+------+------+------+------+------+------+------+------| 8 | (MSB) | ------+------ Vendor Identification ------| 15 | (LSB) | ------+-------------------------------------------------------| 16 | (MSB) | ------+------ Product Identification -------| 31 | (LSB) | ------+-------------------------------------------------------| 32 | (MSB) | ------+------ Product Revision Level -------| 35 | (LSB) | ------+------+--------------------+---------------------------| 36 | ADF | Color Mode | Color Plane Sequence | ------+------+--------------------+---------------------------| 37 | Optical Resolution | ------+-------------------------------------------------------| 38 | Maximum Resolution | ------+------+------+-------+-----+------+--------------------| 39 |Trans.|Q-Scan|Ext-Res|Calib|FB | | ------+------+------+-------+-----+------+--------------------| 40 | (MSB) | ------+------ X-axis resolution(gray) -------| 41 | (LSB) | ------+-------------------------------------------------------| 42 | (MSB) | ------+------ Y-axis resolution(gray) -------| 43 | (LSB) | ------+-------------------------------------------------------| 44 | (MSB) | ------+------ X-axis resolution(color) -------| 45 | (LSB) | ------+-------------------------------------------------------| 46 | (MSB) | ------+------ Y-axis resolution(color) -------| 47 | (LSB) | ------+-------------------------------------------------------| 56 | (MSB) | ------+------ Reserved -------| 95 | (LSB) | ------+-------------------------------------------------------¾ Field Descriptions: Peripheral Qualifier : 000b for Avision Scanner. Peripheral Devide Type : 00110b (06h, Scanner Device). RMB : 1b for Avision Scanner, indicating that the medium is removable. Device-Type Modifier : 00h. ISO Version : 00b. ECMA Version : 000b. ANSI Version : 010b. AENC : 0b. (reserved for initiator) TrmIOP : terminate I/O process. Set to 1 for Avision Scanner. Response Data Format : 2h, indicating that the SCSI standard used by Avision Scanner complies to X3.131-199X version. Additional Length : 5Bh RelAdr : 0b for Avision Scanner. WBus32 : 0b. WBus16 : 0b. Sync : 0b. Linked : 0b. CmdQue : 0b. Sftre : 0b. Vendor Identification : 41h, 56h, 49h, 53h, 49, 4Fh, 4Eh, 20h (AVISION) Product Identifivation : 41h, 56h, 38h, 30h, 30h, 53h, 20h, 20h, 20h, 20h, 20h, 20h, 20h, 20h, 20h, 20H (Avision Scanner) Product Revision Level : 58h, 31h, 2Eh, 30h (X2.0) ADF : 0 -- No built-in ADF module 1 -- with built-in ADF module Color Mode : 000b -- B&W Image only (8-bit and 1-bit) 001b -- 3-pass color scan mode 010b -- 1-pass color scan mode others - reserved Color Plane Sequence : 0 -- R-G-B 1 - F -- reserved Optical Resolution : n (n * 100 dpi) Default : 3 (300 dpi) Maximum Resolution : n (n * 100 dpi) Default : 3 (300 dpi) Trans. : 1 - w/o Trans. function : 0 - w/i Trans. function Q-scan : 1 - w/i quality scan function : 0 - w/o quality scan function Ext-Res. : 1 - Support extend resolution : 0 - Not support extend resolution Calib. : 1 - Support driver do calibration function : 0 - Not support FB : 1 - w/o Flatbed (For Sheet Feeder type only) : 0 - w/i Flatbed Command : Object Position Type : Optional Operation Code : 31h Gorup : 3 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (31h) | ------+--------------------+-------------+--------------------| 1 | Logical Unit No. | Reserved | Position Function | ------+--------------------+-------------+--------------------| 2 | (MSB) | ------+------- -------| 3 | Count (reserved) | ------+------- -------| 4 | (LSB) | ------+-------------------------------------------------------| 5 | Reserved | ------+-------------------------------------------------------| 6 | Reserved | ------+-------------------------------------------------------| 7 | Reserved | ------+-------------------------------------------------------| 8 | Reserved | ------+-------------------------------------------------------| 9 | Control | ------+-------------------------------------------------------¾ Field Descriptions: Position Function : ---------------------------------------------------- Position Function Description ---------------------------------------------------- 000b Reject the paper in ADF 001b Load the paper in ADF 100b Do transparence calibration (gray) 101b Do transparence calibration (color) others Reserved ---------------------------------------------------- Command : Read Type : Mandatory Operation Code : 28h Gorup : 2 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (28h) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Data Type Code | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | (MSB) | ------+------- Data Type Qualifier -------| 5 | (LSB) | ------+-------------------------------------------------------| 6 | (MSB) | ------+------- -------| 7 | Transfer Length | ------+------- -------| 8 | (LSB) | ------+-------------------------------------------------------| 9 | Control | ------+-------------------------------------------------------¾ Field Descriptions: Data Type Codes: ------------------------------------------------- Code Description ------------------------------------------------- 00h Image Data 20h Printer Information 40h Detect EOP 80h Pixel Size others Reserved ------------------------------------------------- Data Type Qualifier : 0A0Dh Transfer Length : indicate the number of bytes to be transferred to the initiator. Printer Information: ---------------+---------------------------------------------- Byte | Description ---------------+---------------------------------------------- 0 | Paper Size ---------------+---------------------------------------------- 1 | X-axis Resolution ---------------+---------------------------------------------- 2 | Y-axis Resolution ---------------+---------------------------------------------- 3 | (MSB) ---------------+---- X-axis pixel number ------- 4 | (LSB) ---------------+---------------------------------------------- 5 | (MSB) ---------------+---- Y-axis line number ------- 6 | (LSB) ---------------+---------------------------------------------- Paper Size : 0 - Letter 1 - A4 2 - Legal other - Reserved X-axis resolution : 0 - 300 1 - 600 other - Reserved Y-axis resolution : 0 - 300 1 - 600 other- Reserved X-axis pixel number : X-axis request pixel number Y-axis line number : Y-axis request line number Detect EOP Data Format: ---------------+---------------------------------------------- Byte | Description ---------------+---------------------------------------------- 0 | EOP Status ---------------+---------------------------------------------- EOP Status: 0 : Not EOP 1 : EOP other: reserved Pixel Size Data Format: ---------------+---------------------------------------------- Byte | Description ---------------+---------------------------------------------- 0 | (MSB) ---------------+------- 1 | Number of X-direction Pixels ---------------+------- 2 | ---------------+------- 3 | (LSB) ---------------+---------------------------------------------- 4 | (MSB) ---------------+------- 5 | Number of Y-direction Pixels ---------------+------- 6 | ---------------+------- 7 | (LSB) ---------------+---------------------------------------------- | --- 8 --+------- | --- | --+------- Reserved | --- F --+------- | ---------------+---------------------------------------------- Command : Release Unit Type : Mandatory Operation Code : 17h Gorup : 1 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (17h) | ------+--------------------+------+--------------------+------| 1 | Logical Unit No. |3rdPty| 3rd Party Device ID| Resrv| ------+--------------------+------+--------------------+------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Reserved | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Field Descriptions: 3rdPty : Avision Scanner does not support third party reservation. This field must be 0b. 3rd Party Device ID : This field must be 000b. Command : Request Sense Type : Mandatory Operation Code : 03h Gorup : 0 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (03h) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Allocation Length | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Fields Descriptions: Sense Data Format: ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 |Valid | Error Code (70h or 7Fh) | ------+------+------------------------------------------------| 1 | Segment number (00h) | ------+------+------+------+------+---------------------------| 2 |FilMrk| EOM | ILI |Resrvd| Sense Key | ------+------+------+------+------+---------------------------| 3 | (MSB) | ------+------ Information -----| 6 | (LSB) | ------+-------------------------------------------------------| 7 | Additional Sense Length (0Eh) | ------+-------------------------------------------------------| 8 | (MSB) | ------+----- Command Specific Information (0000h) ------| 11 | (LSB) | ------+-------------------------------------------------------| 12 | Additional Sense Code (ACS) | ------+-------------------------------------------------------| 13 | Additional Sense Code Qualifier (ASCQ) | ------+-------------------------------------------------------| 14 | Field Replaceable Unit Code (00h) | ------+------+------------------------------------------------| 15 | SKSV | | to -+------+- Sense Key Specific -------| 17 | | ------+-------------------------------------------------------| 18 | Additional Sense Bytes | ------+-------------------------------------------------------| 19 | Additional Sense Bytes | ------+-------------------------------------------------------| 20 | Additional Sense Bytes | ------+-------------------------------------------------------| 21 | Additional Sense Bytes | ------+-------------------------------------------------------¾ Fields Descriptions: Valid : 1b. Error Code : 70h -- standard sense code 7Fh -- AV specific sense code FilMrk : 0b. EOM : 0b. -- scan has not been completed 1b. -- end of scan ILI : 0b. -- correct logical length 1b. -- incorrect logical length Sense Key Description : ---------------------------------------------------------------- Sense Key Description ---------------------------------------------------------------- 0h NO SENSE. 2h NOT READY. 3h MEDIUM ERROR. (ADF empty, ADF cover open, or ADF paper jammed). 4h HARDWARE ERROR. 5h ILLEGAL REQUEST. 6h UNIT ATTENETION. 9h Vendor Specific. Bh ABORTED COMMAND. -------------------------------------------------- -------------- Avision Specific ASC and ASCQ Description: ---------------------------------------------------------- ASC ASCQ Description ---------------------------------------------------------- A0h 01h Filter Positioning Error ---------------------------------------------------------- Sense-Key Specific : This field is applicable when the sense key is set to "Illegal Request". ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 15 | SKSV | C/D |Resrvd|Resrvd| BPV | Bit Pointer | ------+------+------+------+------+------+--------------------| 16 | (MSB) | ------+------ Field Pointer -----| 17 | (LSB) | ------+-------------------------------------------------------¾ SKSV : sense-key specific valid, 0 -- not defined, 1 -- defined. C/D : 0 -- error parameter is in the data parameter, 1 -- error parameter is in the command parameter. BPV : 0 -- value in bit pointer field is not valid, 1 -- value in bit pointer field is valid. Bit Pointer : Error bit in the error byte. Field Pointer : Error byte in the parameter list, the value specifies the nth byte of the parameter list. Additional Sense Code (ASC) & Additional Sense Code Qualifier (ASCQ) Description : ---------------------------------------------------------------- ASC ASCQ Description ---------------------------------------------------------------- 00h 00h No Additional Sense Information (Fujitsu Compatible) 80h 01h ADF Paper Jam (Fujitsu Compatible) 80h 02h ADF Cover Open (Fujitsu Compatible) 80h 03h ADF Paper Chute Empty (Fujitsu Compatible) 44h 00h Internal Target Failure (Fujitsu Compatible) 47h 00h SCSI Parity Error (Fujitsu Compatible) 20h 00h Invalid Command Operation Code (Fujitsu Compatible) 24h 00h Invalid Field in CDB (Fujitsu Compatible) 25h 00h Logical Unit Not Supported (Fujitsu Compatible) 26h 00h Invalid Field in parameter List (Fujitsu Compatible) 2Ch 02h Invalid Combination of Window Specified (Fujitsu Compatible) 43h 00h Message Error (Fujitsu Compatible) 2Fh 00h Command Cleared By Another Initiator. 00h 06h I/O process Terminated. 3Dh 00h Invalid Bit in Identify Message 49h 00h Invalid Message Error 60h 00h Lamp Failure 15h 01h Mechanical Positioning Error 1Ah 00h Parameter List Length Error 26h 01h Parameter Not Supported 26h 02h Parameter Value Invalid 29h 00h Power-on, Reset, or Bus Device Reset Occurred 62h 00h Scan Head Positioning Error ---------------------------------------------------------------- Command : Reserve Unit Type : Mandatory Operation Code : 16h Gorup : 1 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (16h) | ------+--------------------+------+--------------------+------| 1 | Logical Unit No. |3rdPty| 3rd Party Device ID| Resrv| ------+--------------------+------+--------------------+------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Reserved | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Field Descriptions: 3rdPty : Thirty Party Reservation. Avision does not support this option. So it must be 0b. 3rd Party Device ID : 000b. Command : Scan Type : Optional Operation Code : 1Bh Gorup : 1 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (1Bh) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Transfer Length | ------+------+-------+----------------------------------------| 5 |Q-scan|Preview| Control | ------+------+-------+----------------------------------------¾ Field Description : Transfer Length : specify the length in bytes of the window identifier list that shall be sent during the DATA OUT phase. Currently Avision Scanner would only accept ONE window for the 'SCAN' command. Quality Scan: 0 - Speed scan 1 - Quality scan Preview : 0 - Not preview mode 1 - Preview mode Command : Send Diagnoctic Type : Mandatory Operation Code : 1Dh Gorup : 1 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (1Dh) | ------+--------------------+------+------+------+------+------| 1 | Logical Unit No. | PF |Resrvd|SlfTst|DevOfl|UntOfl| ------+--------------------+------+------+------+------+------| 2 | Reserved | ------+-------------------------------------------------------| 3 | (MSB) | ------+------ Parameter List Length (0000h) -------| 4 | (LSB) | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Field Descriptions: PF : 1 to indicate confirmation to the SCSI-2 standard. SlfTst : 1 to indicate selftest function. Note that Avision Scanner can only accept SlfTst bit 'one'. Value of zero of this bit will cause error to the command interpreter. DevOfl : don't care. DevOfl : don't care. Command : Set Window Type : Mandatory Operation Code : 24h Gorup : 2 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (24h) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Reserved | ------+-------------------------------------------------------| 5 | Reserved | ------+-------------------------------------------------------| 6 | (MSB) | ------+--------- --------| 7 | Transfer Length | ------+--------- -------| 8 | (LSB) | ------+-------------------------------------------------------| 9 | Control | ------+-------------------------------------------------------¾ Fields Descriptions: Set Window Data Header Format: ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Reserved | ------+-------------------------------------------------------| 1 | Reserved | ------+-------------------------------------------------------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Reserved | ------+-------------------------------------------------------| 5 | Reserved | ------+-------------------------------------------------------| 6 | (MSB) | ------+--------- Window Descriptor Length -------| 7 | (LSB) | ------+-------------------------------------------------------¾ Field Description: Window Descriptor Length : The length in bytes of a SINGLE window descriptor. Window Descriptor Format: ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Window Identifier | ------+-------------------------------------------------------| 1 | Reserved (00h) | ------+-------------------------------------------------------| 2 | (MSB) | ------+------ X-Axis Resolution ------| 3 | (LSB) | ------+-------------------------------------------------------| 4 | (MSB) | ------+------ Y-Axis Resolution -------| 5 | (LSB) | ------+-------------------------------------------------------| 6 | (MSB) | ------+------ X-Axis Upper Left -------| 9 | (LSB) | ------+-------------------------------------------------------| 10 | (MSB) | ------+------ Y-Axis Upper Left ------| 13 | (LSB) | ------+-------------------------------------------------------| 14 | (MSB) | ------+------ Window Width -------| 17 | (LSB) | ------+-------------------------------------------------------| 18 | (MSB) | ------+------ Window Length -------| 21 | (LSB) | ------+-------------------------------------------------------| 22 | Brightness | ------+-------------------------------------------------------| 23 | Threshold | ------+-------------------------------------------------------| 24 | Contrast | ------+-------------------------------------------------------| 25 | Image Composition | ------+-------------------------------------------------------| 26 | Bits Per Pixel | ------+-------------------------------------------------------| 27 | (MSB) | ------+------- Halftone Pattern ---------| 28 | (LSB) | ------+------+---------------------------+--------------------| 29 | RIF | Reserved (00) | Padding Type | ------+------+---------------------------+--------------------| 30 | (MSB) | ------+------ Bit Ordering (0000h) ---------| 31 | (LSB) | ------+-------------------------------------------------------| 32 | Compression Type (00h) | ------+-------------------------------------------------------| 33 | Compression Argument (00h) | ------+-------------------------------------------------------| 34 | (MSB) | to -+------ Reserved (0000h) -----| 39 | (LSB) | ------+-------------------------------------------------------| | Avision Specific Parameters | ------+-------------------------------------------------------| 40 | Vendor Specific Parameter Identifier (FFh) | ------+-------------------------------------------------------| 41 | Parameter Length (09d - 15d) | ------+------+------+--------------------+--------------------| 42 | ADF |Source| Color | Scan Speed | ------+------+------+--------------------+--------------------| 43 | Highlight Value | ------+-------------------------------------------------------| 44 | Shadow Value | ------+-------------------------------------------------------| 45 | Line Width (MSB) | ------+-------------------------------------------------------| 46 | Line Width (LSB) | ------+-------------------------------------------------------| 47 | Line Count (MSB) | ------+-------------------------------------------------------| 48 | Line Count (LSB) | ------+------+------+-----------------------------------------| 49 |Trans.|Byte |MSB/ | | | |Order |LSB | | ------+------+------+-----------------------------------------| 50 | Reserved (00h) | ------+-------------------------------------------------------| 51 | MSB | ------+------ Red exposure time factor --------| 52 | LSB | ------+-------------------------------------------------------| 53 | MSB | ------+------ Green exposure time factor --------| 54 | LSB | ------+-------------------------------------------------------| 55 | MSB | ------+------ Blue exposure time factor --------| 56 | LSB | ------+-------------------------------------------------------+ Fields Descriptions: Window Identifier : an ID for this window. X-Axis Resolution : specify the horizontal direction resolution. The measurement unit is pixel per inch. Value of zero indicates the default value, i.e., 300 dpi. Y-Axis Resolution : specify the vertical direction resolution. The measurement unit is pixel per inch. Value of zero indicates the default value, i.e., 300 dpi. X-Axis Upper Left : specify the x-axis coordinate of the upper- left corner point of the window. The measurement unit is 1/1200 inch. Y-Axis Upper Left : specify the y-axis coordinate of the upper- left corner point of the window. The measurement unit is 1/1200 inch. Window Width : specify the width of the window in the horizontal direction. The measure unit is 1/1200 inch. Window Length : specify the length of the window in the vertical direction. The measure unit is 1/1200 inch. Brightness : specify the brightness level used to scan the object. Value of zero means the default setting. 255 (FFh) means the darkest and 1 means the brightest. The nominal value is 128 (80h). Threshold : specify the threshold level used to scan the object in bi-level mode. Value of zero means the default setting. 255 (FFh) means the highest threshold level and 1 means the lowest threshold level. The nominal value is 128 (80h). Contrast : specify the contrast level used to scan the object. Value of zero means the default setting. 255 (FFh) means the most contrast and 1 means the blurrest. The nominal value is 128 (80h). Image Composition : specify the image type that the host desires. Image Composition Code Table: --------------------------------------- Code Description --------------------------------------- 00h Line Art --------------------------------------- 01h Dither Mode --------------------------------------- 02h Gray Scale Mode --------------------------------------- 03h One pass color (Color/Lineart) --------------------------------------- 04h One pass color (Color/Halftone) --------------------------------------- 05h One pass color (True Color) --------------------------------------- 03h - FFh Reserved --------------------------------------- Bits Per Pixel : specify the number of bit for each pixel. It could be either 1 or 8 for Avision Scanner. Halftone Pattern : specify the halftone pattern used to scan the object. Bit 7 of one indicates the downloaded pattern, while bit 7 of zero indicates the scanner built-in halftone pattern. Currently only values of 00h to 04h and 80h are allowed. The pattern number of 00h means the 'Line Art' mode. RIF : 0 - Normal 1 - Invert Padding Type : specify how the scanner pad the image data when it is not an integral number of bytes. See the table below. Padding Types --------------------------------------- Code Description --------------------------------------- 00h No Padding --------------------------------------- 01h Pad with 0's to boundary --------------------------------------- 02h Pad with 1's to boundary --------------------------------------- 03h Truncate to boundary (*) --------------------------------------- 04h - FFh Reserved --------------------------------------- (*) Avision Scanner only implemets this option. Bit Ordering : 0000h Compression Type : 00h (No compression) Compression Arg. : 00h (No compression) Vendor Specific Parameter Identifier : FFh Parameter Length : the number of vendor specific parameter in bytes to be transferred to the scanner. ADF : 0 -- Flatbed scan mode 1 -- ADF scan mode Color : 000b -- No filter : 001b -- Red Component, only used with one/three pass color : 010b -- Green Component, only used with one/three pass color : 011b -- Blue Component, only used with one/three pass color : 100b -- R-G-B color image, only used with one pass color Source : 0 -- The initiator could read the line width and line count of the current scan page by using "READ" command. When this bit is '0', the data bytes of (45, 46, 47, 48) will be ignored by the scanner. : 1 -- The initiator can tell the scanner the line width and line count for the current page. The information should be placed in Byte number (45, 46, 47, 48). Scan Speed : Range: 0 - 4 0 - fastest 4 - slowest Highlight Value : Indicating the start point for Hi-Lighting. The value is in the range of (0, FFH). Shadow Value : Indicating the start point for shadowing. The value is in the range of (0, FFH). Line Width : Set the line width in bytes for the current scan page. Line Count : Set the line count for the current scan page. Trans. : 0 - Normal mode 1 - Use transparency mode Byte Order : 0 - Intel (10/12 bit image data, low byte first) 1 - Motorola MSB/LSB : 0 - MSB (12/10 bit image data align to MSB) 1 - LSB Command : Test Unit Ready Type : Mandatory Operation Code : 00h Gorup : 0 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (00h) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Reserved | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Fields Descriptions: Response: ----------------------------------------- Status Sense Key ASC ASCQ ----------------------------------------- 00h 00h 00h 00h 02h 05h 25h 00h 02h 02h 05h 00h 02h 02h 04h 00h 02h 02h 04h 01h 02h 02h 04h 02h 02h 02h 04h 03h ----------------------------------------- Link : 0 -- single command 1 -- linked command Command : Send Type : Mandatory Operation Code : 2Ah Gorup : 3 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (2Ah) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Data type code (Vendor) | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | | ------+-------- Data type Qualifier --------| 5 | | ------+-------------------------------------------------------| 6 | | ------+-------- -------| 7 | Transfer Length | ------+-------- -------| 8 | | ------+-------------------------------------------------------| 9 | | ------+-------------------------------------------------------+ Data Type Codes: ------------------------------------------------- Code Description ------------------------------------------------- 40h Send print data 41h Send print information 81h Download gamma table Other Reserved ------------------------------------------------- Data Type Qualifier : 0 - Download red gamma table or Send red calibration data 1 - Download green gamma table or Send green calibration data 2 - Download blue gamma table or Send blue calibration data Transfer Length : indicate the number of bytes to be transferred to the scanner, fixed to 4096 for sending gamma table. For sending print data, the value is fixed to 32768 Print Information : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Page count | ------+-------------------------------------------------------| 1 | Brightness | ------+-------------------------------------------------------| Page count: 1 to 99 Brightness: 00 to 255, 127 is normal, 00 is darkest, 255 is lightest Gamma Data : 0 to 2047 is used to map 0 to 255. By another word, you can build up a 11 bits gamma table. Following is a sample code which allows you to convert 256 bytes gamma table to a 2048 bytes gamma table. * The value from byte 2048 to 4095 should be the same as byte 2047. /* Input: GammaTable - A 256 bytes GammaTable Output: BigGammaTable - A 4096 bytes GammaTable */ void ConvertGammaTable(LPBYTE GammaTable, LPBYTE BigGammaTable) { int i, j, c; BYTE value1, value2, temp; BOOL InvertGamma, ret; for (i=0; i<4096; i++) //Reset big gamma table BigGammaTable[i] = 255; c=0; for (i=0; i<256; i++) { value1 = GammaTable[i]; if (i==255) value2 = GammaTable[i]; else value2 = GammaTable[i+1]; for (j=0; j<8; j++, c++) BigGammaTable[c] = (value1*(8-j) + value2*j)/8; } for (i=2048; i<4096; i++) BigGammaTable[i] = BigGammaTable[2047]; } Command : Media Check Type : Option Operation Code : 8h Gorup : 1 Format : ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | Operation Code (08h) | ------+--------------------+----------------------------------| 1 | Logical Unit No. | Reserved | ------+--------------------+----------------------------------| 2 | Reserved | ------+-------------------------------------------------------| 3 | Reserved | ------+-------------------------------------------------------| 4 | Transfer Length | ------+-------------------------------------------------------| 5 | Control | ------+-------------------------------------------------------¾ Field Descriptions: Transfer Length: 1 Return Format: ------+------+------+------+------+------+------+------+------+ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ------+------+------+------+------+------+------+------+------| 0 | ADF Status | ------+-------------------------------------------------------Ù Field Descriptions: ADF Status: 1 - Has ADF and had paper on ADF Other - No ADF or No paper on ADF 1.4 Status Descriptions The status byte used by Avision Scanner is as below. See the standard document for detail information. ------------------------------------------------- Status Description ------------------------------------------------- 00h GOOD 02h CHECK CONDITION 04h CONDITION MET 08h BUSY 10h INTERMEDIATE 14h INTERMEDIATE-CONDITION MET 18h RESERVATION CONFLICT 22h COMMAND TERMINATED ------------------------------------------------- 1.5 Message System The message used by Avision Scanner is as below. See the standard document for detail information. ----------------------------------------------------------- Message Description Dir. ----------------------------------------------------------- 06h (M) ABORT O 0Ch (M) BUS DEVICE RESET O 00h (M) COMMAND COMPLETE I 80h (M) IDENTIFY B 05h (M) INITIATOR DETECTED ERROR O 09h (M) MESSAGE PARITY ERROR O 07h (M) MESSAGE REJECT B 08h (M) NO OPERATION O 11h (O) TERMINATE I/O PROCESS O ----------------------------------------------------------- * Character in parenthsis : M -- Mandatory O -- Option * Character in "Dir" field : I -- Input O -- Output B -- Bidirectional, I/O