X3T9.2/87-103 Rev 1 August 13, 1987 To: X3T9.2 Membership From: John B. Lohmeyer, Principal NCR Corp. Subject: Revised NCR Printer Command Set Proposal Attached is the revised NCR proposal for enhancements to the Printer Command Set in SCSI-2. The proposal makes the following changes to the printer command set: 1. MODE SELECT and MODE SENSE are altered to use the page structure defined for most of the other command sets. 2. Three pages are defined for bridge controllers (parallel interface, serial interface, and target options). 3. Additional sense codes are defined for printer devices. NCR previously has made a similar proposal. However, the working group seemed to favor the idea of working on a raster-scan printer command set. Nothing was actually accomplished. While NCR would also like to see a common raster-scan printer command set developed, we believe that these less- glamorous enhancements are a useful addition to SCSI-2. This proposal is based on the Revision 2 files and is stuctured so that, if accepted, it could replace section 10 in Revision 3 of SCSI-2. Differences from Revision 2 are shown by using underscore for additions and strike-out for deletions.] Group 0 Command Descriptions for Printer Devices The Group 0 commands for printer devices shall be as shown in Table 10-1. Group 0 Commands for Printer Devices ============================================================================== Operation Code Type Command Name Section Page ------------------------------------------------------------------------------ 18h O COPY 10h O FLUSH BUFFER 04h O FORMAT 12h M INQUIRY 15h O MODE SELECT 1Ah O MODE SENSE 0Ah M PRINT 1Ch O RECEIVE DIAGNOSTIC RESULTS 14h O RECOVER BUFFERED DATA 17h O RELEASE UNIT 03h M REQUEST SENSE 16h O RESERVE UNIT 1Dh O SEND DIAGNOSTIC 0Bh O SLEW AND PRINT 1Bh O STOP PRINT 00h O TEST UNIT READY ============================================================================== Key: M = Command implementation is mandatory. O = Command implementation is optional. R = Operation code is reserved for future standardization. The following command codes are Vendor Unique: 01h,02h,05h,06h,07h,08h,09h,0Ch,0Dh,0Eh,0Fh,11h,13h,19h, and C0h thru FFh. All remaining command codes are reserved for future standardization. FLUSH BUFFER Command Peripheral Device Type: Printer Operation Code Type: Optional FLUSH BUFFER Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (10h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The FLUSH BUFFER command (Table 10-2) provides a means for an initiator to ensure that the data have been successfully printed prior to releasing the peripheral device. This is useful for applications that wish to handle any error or exception conditions (e.g., end-of-medium) prior to termination of the application. When all buffered data are actually printed the command shall be terminated with a GOOD status. If it is not possible to finish printing all of the buffered data (due to an error or exception condition on the peripheral device), then this command shall be terminated with a CHECK CONDITION status and the appropriate sense key. The target options page in the MODE SELECT command, if implemented, provides additional control over termination sequences when using this command. FORMAT Command Peripheral Device Type: Printer Operation Code Type: Optional FORMAT Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (04h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Format Type | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The FORMAT command (Table 10-3) provides a means for the initiator to specify forms or fonts to printers that support programmable forms or fonts. The format information sent is vendor unique since it is peripheral-device specific. The format type field specifies the type of format information to be transferred from the initiator to the target. This field is defined as follows: DB(1) DB(0) Format Type ----- ----- ------------- 0 0 Set Form 0 1 Set Font 1 0 Vendor Unique 1 1 Reserved The transfer length specifies the length in bytes of format information that shall be sent during the DATA OUT phase. A transfer length of zero indicates that no format information shall be sent. This condition shall not be considered as an error. MODE SELECT Command Peripheral Device Type: Printer Operation Code Type: Optional MODE SELECT Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (15h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | PF | Reserved | SP | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Parameter List Length | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== [7/87 WG - In an attempt to better document the Mode Sense command several options are under consideration: (1) Move the page descriptions to a seperate section and document them for both Mode Select and Mode Sense values. (2) Add page descriptions to Mode Sense where they can be documented for the Mode Sense values.] The MODE SELECT command (Table 10-4) provides a means for the initiator to specify medium, logical unit, or peripheral device parameters to the target. Targets that implement the MODE SELECT command shall also implement the MODE SENSE command. Initiators should issue MODE SENSE prior to MODE SELECT to determine supported pages, page lengths, and other parameters. After the MODE SELECT command has completed successfully the target shall generate a unit attention condition for all initiators except the one that issued the MODE SELECT command if any parameters that effect another initiator were changed (see section 6.1.3). The additional sense code shall be set to MODE SELECT Parameters Changed. A page format (PF) bit of zero indicates that the MODE SELECT parameters are as specified in ANSI X3.131-1986 (i.e., all parameters after the block descriptors are vendor unique). A PF bit of one indicates that the MODE SELECT parameters are structured as pages of related parameters and are as specified in this standard. The target shall return CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Invalid Field in Paramater List if the initiator attempts to change any field that is not changeable by the target. If the initiator sends a value for a parameter that is outside the range supported by the target and rounding is not allowed for that parameter, the target shall return a CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Invalid Field in Parameter List. If the initiator sends a value for a parameter that is outside the range supported by the target and rounding is allowed for that parameter, the target may either: (1) round the value to an acceptable value and terminate the command as described in section 6._._. (2) return a CHECK CONDITION status with a sense key of ILLEGAL REQUEST and an additional sense code of Invalid Field in Parameter List. A save parameters (SP) bit of zero indicates the target shall not save any parameters. A SP bit of one indicates that the target shall save to non- volatile memory all the savable parameters including any sent during the DATA OUT phase. (Savable pages are optional and identified by the PS bit that is returned in the page header by the MODE SENSE command.) If the target does not support saved parameters and the SP bit is one, CHECK CONDITION status shall be returned and the sense key shall be set to ILLEGAL REQUEST with an additional sense code of Illegal Field in command descriptor block (see 8.1.4.4, Saved Values). The parameter list length specifies the length in bytes of the MODE SELECT parameter list that shall be transferred during the DATA OUT phase from the initiator to the target. A parameter list length of zero indicates that no data shall be transferred. This condition shall not be considered as an error. Certain combinations of parameters and pages must be defined to a particular boundary. Truncation of such a parameter list by an incorrect length shall be considered an error. In such a case, the target shall set the sense key to INVALID REQUEST and the additional sense code to Invalid Field in Parameter List. The MODE SELECT parameter list (Table 10-5) contains a four-byte header, followed by zero or more pages, followed by the vendor unique parameters, if any. MODE SELECT Parameter List ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 |Reserved| Buffered Mode | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | ============================================================================== | Page(s) | ============================================================================== 0 |Reserved|Reserved| Page Code | -----|-----------------------------------------------------------------------| 1 | Page-Specific Parameter Length | -----|-----------------------------------------------------------------------| 2 | | - - -|- - Page-Specific Parameters - -| n | | ============================================================================== | Vendor Unique Parameter(s) | ============================================================================== 0 - n| Vendor Unique | | Parameter Byte(s) | ============================================================================== A buffered mode of zero indicates that the target shall not report a GOOD status on PRINT commands or SLEW AND PRINT commands until the data are actually printed. A buffered mode of one indicates that the target may report a GOOD status on PRINT commands or SLEW AND PRINT commands as soon as the data have been transferred to the SCSI device buffer. The data from one or more commands may be buffered prior to printing. Buffered modes of 2h through 7h are reserved. [All of the following section (thru MODE SENSE) is new. Underscores are not used to avoid the clutter.] Each page descriptor specifies parameters for the target to use for subsequent operations on the specific logical unit. The page codes for printer devices are given in Table 10-6. The parameter length field specifies the length in bytes of the parameters that follow for the specified page. The initiator should set this value to the value that is returned in the parameter length field for the same page by the MODE SENSE command. If this condition is not met, the target shall return CHECK CONDITION status and set the sense key to ILLEGAL REQUEST. (Note that the parameter length value returned by the MODE SENSE command may be less than the full page.) Page Codes for Printer Devices ============================================================================== Page Code Description Section ---------- -------------------------------------------- ------- 00h Vendor Unique (does not require page format) 01h Reserved 02h Reserved 03h Parallel Printer Interface Parameters 04h Serial Printer Interface Parameters 05h Target Options 06h - 1Fh Reserved 20h - 3Eh Vendor Unique 3Fh (Defined for MODE SENSE only) ============================================================================== Parallel Printer Interface Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 |Reserved|Reserved| Page Code (03h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (0Eh) | -----|-----------------------------------------------------------------------| 2 | Parity Select | PIPC |Reserved| VCBP | VCBS | VES | Autofd | -----|-----------------------------------------------------------------------| 3 | Reserved | ============================================================================== The parity select field controls parity generation on the printer interface and is defined as follows: Code Parity Select ---- ------------------------- 00b No parity generation 01b Even Parity 10b Odd Parity 11b Reserved [Is this bit necessary? Can the target just always generate parity?] A paper instruction parity check (PIPC) bit of one indicates that the printer interface "paper instruction" is included in parity checking by the printer. Otherwise, the printer does not check parity on paper instructions. The VFU Control Bit Polarity (VCBP) bit, the VFU Control Bit Select (VCBS) bit, and the VFU Extended Skip (VES) bit are used to select the format of a control byte that is used with some parallel printer interfaces. These interfaces use a "Control Bit" (C) to select whether to slew over a number of lines or to skip to a Vertical Forms Unit (VFU) channel number. This bit may be located in two different bit positions and may have either polarity. Additionally, the number of lines to slew over may be coded as an unsigned four-bit number (NNNN) or an unsigned six-bit number (EENNNN). The upper two bits of the six-bit number (EE) may be positioned contiguously with the lower four bits (NNNN) or they may be separated from the lower four bits by the control bit (C). Furthermore, the upper two bits may or may not be supported. [JBL: ] Pictorially, the control byte is as follows: VFU Control Byte Description 7 6 5 4 3 2 1 0 --------------- ------------------------------------------ 0 E E C N N N N Advance (EE)NNNN lines (C = line skip) 0 0 0 C N N N N Skip to VFU channel NNNN (C = VFU channel) 0 C E E N N N N Advance (EE)NNNN lines (C = line skip) 0 C 0 0 N N N N Skip to VFU channel NNNN (C = VFU channel) A VFU Control Bit Polarity (VCBP) bit of one indicates the state of the VFU control bit (C) is true for a VFU channel command and false for a line skip command. A VCBP bit of zero indicates the opposite polarity. A VFU Control Bit Select (VCBS) bit of one indicates that the control bit (C) is in bit position 6 and the EE bits are in bit positions 5 and 4. A VCBS bit of zero indicates that the control bit (C) is in bit position 4 and the EE bits are in bit positions 6 and 5. A VFU Extended Skip (VES) bit of one indicates that the EE bits are supported for line skip operations. A VES bit of zero indicates that the EE bits are not supported. An Autofd bit of one causes the target to assert the printer interface "Auto Line Feed" signal. An Autofd bit of zero causes the target to negate the printer interface "Auto Line Feed" signal. Serial Printer Interface Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 |Reserved|Reserved| Page Code (04h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (06h) | -----|-----------------------------------------------------------------------| 2 | Reserved | Stop Bit Length | -----|-----------------------------------------------------------------------| 3 | Parity Selection |Reserved| Bits per Character | -----|-+---------------------------------------------------------------------| 4 | RTS | CTS | Reserved | Pacing Protocol | -----|-----------------------------------------------------------------------| 5 | (MSB) | -----|--- ---| 6 | Baud Rate | -----|--- ---| 7 | (LSB) | ============================================================================== The stop bit length field specifies the length of the stop bit(s) in units of 1/16 bit. The target may round this field as described in 6._._. A stop bit length of zero indicates that the target shall use its default value. The parity selection field controls parity generation and checking as defined in the following table: Code Parity Selection ---- ---------------- 000b None 001b Mark 010b Space 011b Odd 100b Even 101b Reserved 110b Reserved 111b Reserved The bits per character field specifies the number of bits in each character. A value of zero indicates that the target shall use its default character size. A request to send (RTS) bit of one specifies that the target shall insure the "Request to Send" (RTS) signal in the serial interface follows the line state of the "Data Terminal Ready" (DTR) signal in the serial interface. A RTS bit of zero specifies that the target shall set the "Request to Send" (RTS) signal to "high" whenever the target power is on. A clear to send (CTS) bit of one specifies that the target shall delay data transmission to the printer device until the printer device asserts the "Clear to Send" (CTS) signal in the serial interface. A CTS bit of zero indicates that the target shall ignore the "Clear to Send" signal. The code values for the pacing protocol field are defined as follows: Code Pacing Protocol ---- -------------------------------- 0h None 1h XON/XOFF 2h ETX/ACK 3h DTR 4h-7h Reserved 8h-Fh Vendor Unique The buad rate field specifies the desired baud rate in bits per second. The target may round this value as described in 6._._. A baud rate of zero specifies the target's default buad rate. Target Options ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 |Reserved|Reserved| Page Code (05h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (0Ah) | -----|-----------------------------------------------------------------------| 2 | EVFU | Font Identification | -----|-----------------------------------------------------------------------| 3 | | Slew Mode | Reserved | SCTE | AFC | -----|-+---------------------------------------------------------------------| 4 | (MSB) | -----|--- Maximum Line Length ---| 5 | (LSB) | -----|-----------------------------------------------------------------------| 6 | EVFU Format Start Character | -----|-----------------------------------------------------------------------| 7 | EVFU Format Stop Character | -----|-+---------------------------------------------------------------------| 8 | Line Slew options | Form Slew Options | -----|-----------------------------------------------------------------------| 9 | Data Termination Options | Reserved | -----|-----------------------------------------------------------------------| 10 | Reserved | -----|-----------------------------------------------------------------------| 11 | Reserved | ============================================================================== An EVFU bit of one indicates that a tape or electronic vertical forms unit is present in the printer device. An EVFU bit of zero indicates that no such unit is present in the printer device. The font identification field specifies which font is to be used. In MODE SENSE, this field identifies the currently selected font. The font identification codes are defined as follows: Code Font Identification --------- ------------------- 00h Default Font 01h - 3Fh Reserved 40h - 7Fh Vendor Unique Font The slew mode field controls the target's behavior when a SLEW AND PRINT command is received with a channel bit of zero. This field is defined as follows: Code Slew Mode ---- ---------------------------------------------------------------------- 00b SLEW AND PRINT commands with a channel bit of zero are supported without any required setup. 01b SLEW AND PRINT commands with a channel bit of zero are only accepted after the initiator issues a FORMAT command with a format type of "set form" (to initialize the electronic vertical forms unit). 10b SLEW AND PRINT commands with a channel bit of zero are always accepted. The target shall use the electronic vertical forms unit if it has previously been initialized or it shall initialize the electronic vertical forms unit for line skipping by sending the EVFU start format character immediately followed by the EVFU stop format character (both are defined below) prior to executing the SLEW AND PRINT command. 11b Reserved A step count truncate enable (SCTE) bit of one indicates that the target shall truncate slew values in SLEW AND PRINT commands so that the data is printed on the first line of the next form. A SCTE bit of zero indicates that the target shall continue slewing over forms boundaries in SLEW AND PRINT commands if the slew value exceeds the number of remaining lines on the current form. An ASCII forms control (AFC) bit of one indicates that the printer supports ASCII forms control characters. An AFC bit of zero indicates that the printer does not support ASCII forms control characters. The maximum line length field specifies the maximum transfer length (maximum number of bytes per line) to be accepted in the SLEW AND PRINT command. A value of 0000h specifies the target's default value. The EVFU format start character field specifies the character code to used by the target to start the initialization of the electronic vertical forms unit if slew mode option is 10b is selected. The EVFU format stop character field specifies the character code to used by the target to stop the initialization of the electronic vertical forms unit if slew mode option is 10b is selected. The line slew options field specifies the desired implementation of line slewing in the SLEW AND PRINT command. Code values in this field are defined as follows: Code Line Slew Option ----- ---------------------------------------------------------------------- 0h Not implemented. (SLEW AND PRINT commands cause CHECK CONDITION status with ILLEGAL REQUEST sense key.) 1h The target shall output an ASCII carriage return character (0Dh) for each line slewed over. 2h The target shall output an ASCII line feed character (0Ah) for each line slewed over. 3h The target shall output a pair of ASCII carriage return and line feed characters (0Dh, 0Ah) for each line slewed over. 4h-7h Reserved 8h-Fh Vendor Unique The form slew options field specifies the desired implementation of form slewing in the SLEW AND PRINT command. Code values in this field are defined as follows: Code Form Slew Option ----- ---------------------------------------------------------------------- 0h Not implemented. (SLEW AND PRINT commands cause CHECK CONDITION status with ILLEGAL REQUEST sense key.) 1h The target shall output an ASCII form feed character (0Ch) to move to the beginning of the next form. 2h The target shall output a pair of ASCII carriage return and form feed characters (0Dh, 0Ch) to move to the beginning of the next form. 3h-7h Reserved 8h-Fh Vendor Unique The data termination options field specifies the termination sequence to be issued to the printer device when a FLUSH BUFFER command is received. Code values for this field are defined as follows: Code Data Termination Option ----- ----------------------- 0h Selects the target default implementation. 1h No termination sequence. (The target sends any remaining data in its buffer to the printer device with no termination sequence.) 2h The target shall send any buffered data followed by an ASCII carriage return character (0Dh). 3h The target shall send any buffered data followed by an ASCII line feed character (0Ah). 4h The target shall send any buffered data followed by an ASCII carriage return, line feed character sequence (0Dh, 0Ah). 5h The target shall send any buffered data followed by an ASCII form feed character (0Ch). 6h The target shall send any buffered data followed by an ASCII carriage return, form feed character sequence (0Dh, 0Ch). 7h The target shall issue a 0-line slew command to the printer device. 8h-Bh Reserved Ch-Fh Vendor Unique MODE SENSE Command Peripheral Device Type: Printer Operation Code Type: Optional MODE SENSE Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (1Ah) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | PF | Reserved | -----|-----------------------------------------------------------------------| 2 | PC | Page Code | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Allocation Length | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== [7/87 WG - In an attempt to better document the Mode Sense command several options are under consideration: (1) Move the page descriptions to a seperate section and document them for both Mode Select and Mode Sense values. (2) Add page descriptions to Mode Sense where they can be documented for the Mode Sense values.] The MODE SENSE command (Table 10-_) provides a means for a target to report its medium, logical unit, or peripheral device parameters to the initiator. It is a complementary command to the MODE SELECT command. If the MODE SELECT command is implemented the MODE SENSE command shall be implemented. A page format (PF) bit of zero indicates the MODE SENSE data format is as specified in ANSI X3.131-1986. A PF bit of one indicates the MODE SENSE data format is as specified in this document. The page control (PC) field defines the type of parameter values to be returned as shown below. PC Code Type of Parameter Values Section ------- ------------------------ ------- 00b Current Values 01b Changeable Values 10b Default Values 11b Saved Values The page code specifies which page or pages to return. The page codes are defined in Table 10-_. Page Codes for Printer Devices ============================================================================== Page Code Description Section ---------- -------------------------------------------- ------- 00h Vendor Unique (does not require page format) 01h Reserved 02h Reserved 03h Parallel Printer Interface Parameters 04h Serial Printer Interface Parameters 05h - 1Fh Reserved 20h - 3Eh Vendor Unique 3Fh (Defined for MODE SENSE only) ============================================================================== The allocation length specifies the number of bytes that the initiator has allocated for returned MODE SENSE data. An allocation length of zero indicates that no MODE SENSE data shall be transferred. This condition shall not be considered as an error. Any other value indicates the maximum number of bytes that shall be transferred. The target shall terminate the DATA IN phase when allocation length bytes have been transferred or when all available MODE SENSE data have been transferred to the initiator, whichever is less. Current Values The PF bit set to one and a PC field value of 0h requests the target return the current values for the page code specified. The current values returned are: 1) The parameters set in the last successful MODE SELECT command. 2) The saved values if a MODE SELECT command has not been executed since the last power-on or hard RESET condition. 3) The default values if saved values are not available or not supported. If the page code is 3Fh, the current values for all implemented pages are requested to be returned by the target. IMPLEMENTORS NOTE: Page code 0h is vendor unique and may be returned as the last page if it is returned at all during a page code 3Fh request. Normally the pages are returned in ascending order. Parameters not supported by the target shall be set to zero. The parameter length of each page indicates the length of the parameters that are supported. IMPLEMENTORS NOTE: Some targets may not support an entire page as defined in this document. [discuss applicablity of 3Fh and forshortened pages] Changeable Values The PF bit set to one and a PC field value of 1h requests the target return the changeable values for the page code specified. The page requested shall be returned with the bits that are allowed to be changed set to one. Parameters that are not changeable shall be set to zero. If any part of a field is changable all bits in that field are set to one. If the page code is 3Fh, the changeable values for all implemented pages are requested to be returned by the target. If none of parameters are changeable within a page, the target may or may not return bytes 0 and 1 of the page. If the target returns these two bytes, the page length value shall be set to zero by the target. [this creates problems in the device driver. We should re-address whether the full page must be returned. Should the 3F request have the parameter lists match page for page to allow easy compares?] Default Values The PF bit set to one and a PC field value of 2h requests the target return the default values for the page code specified. The page requested shall be returned with the default parameters set. Parameters not supported by the target shall be set to zero. IMPLEMENTORS NOTE: The value of the parameters returned is intended to avoid confusion over whether the value of zero is the default or the unsupported value. [What does this mean?? PRN] If the page code is 3Fh, the default values for all implemented pages are requested to be returned by the target. Saved Values The PF bit set to one and a PC field value of 3h requests the target return the saved values for the page code specified. The page requested shall be returned with the saved parameters set. Parameters not supported by the target shall be set to zero. (Implementors note: The value of the parameters returned is intended to avoid confusion over whether the value of zero is the default or the unsupported value.) If saved values are not available or not supported a CHECK CONDITION status shall be returned with the sense key set to ILLEGAL REQUEST and the Additional Sense Code set to Save Parameters Not Supported. If the page code is 3Fh, the saved values for all implemented pages are requested to be returned by the target. IMPLEMENTORS NOTE: The method of saving parameters is vendor unique. The parameters must be preserved in such a manner that they are retained when the target is powered down. All pages can be considered saved when the MODE SELECT command with the Save Parameters bit set has returned a status of GOOD or after the successful completion of a FORMAT UNIT command. Devices which use removable media may not support saving parameters. The target shall return the same page length value in each page that it supports with the 3Fh page code whatever the value of each bit of the PC field is.[What does this mean?? PRN] The MODE SENSE data (Table 10-_) contains a four-byte header, followed by zero or more pages,followed by the vendor unique parameters, if any. MODE SENSE Data ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Sense Data Length | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 |Reserved| Buffered Mode | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | ============================================================================== | Page(s) | ============================================================================== 0 | PS |Reserved| Page Code | -----|-----------------------------------------------------------------------| 1 | Page-Specific Parameter Length | -----|-----------------------------------------------------------------------| 2 | | - - -|- - Page-Specific Parameters - -| n | | ============================================================================== | Vendor Unique Parameter(s) | ============================================================================== 0 - n| Vendor Unique | | Parameter Byte(s) | ============================================================================== The sense data length specifies the length in bytes of the following MODE SENSE data that is available to be transferred during the DATA IN phase. The sense data length does not include itself. A buffered mode of zero indicates that the target does not report a GOOD status on PRINT commands or SLEW AND PRINT commands until the data are actually printed. A buffered mode of one indicates that the target may report a GOOD status on PRINT commands or SLEW AND PRINT commands as soon as the data have been transferred to the SCSI device buffer. The data from one or more commands may be buffered prior to printing. Buffered modes of 2h through 7h are reserved. Optional additional blocks of parameters called pages may be sent to the target in the DATA phase of the MODE SELECT command, following the MODE SELECT header. Each defined Page is preceded by a Header of two bytes defining the Page Code and the length of the page. Following the Header the Pages are separated into sub-blocks containing a list of related flags and/or values. The Parameters Saveable (PS) bits of each Page Header are set to one by the target to indicate that the supported parameters can be saved by the target. PS bits set to zero indicates that the supported parameters cannot be saved by the target. The Page Code identifies the meaning of the following bytes in the Page. The parameters in the defined Pages are classified in priority to ease implementation by the target. The Page Length indicates the number of bytes that the target supports in each Page. The Page Length value of each defined page, shall not include the Page Length byte. The target may return in the pages of the MODE SENSE commands as many consecutive bytes that it supports, for each page that it supports, without splitting fields of multiple bytes. The page length shall be set in the pages of the MODE SELECT commands to the value returned by the target in the MODE SENSE page length bytes. Otherwise, the target shall create CHECK CONDITION status with the sense key of ILLEGAL REQUEST. IMPLEMENTORS NOTE: The initiator should issue a MODE SENSE command requesting the target to return all changeable values (PCF field configuration 0 1 and page code 3Fh in byte 2 of the MODE SENSE CDB) prior to issuing any MODE SELECT commands, in order to find out which pages are implemented by the target and the length of each page for that particular logical unit. After a power up condition or hard SCSI reset condition, the following is required of the target in response to a MODE SENSE command. If Default Values are requested report the default values. If Saved Values are requested, report the valid restored parameters, or restore the parameters and report them. If the saved parameters are not able to be accessed in non-volatile memory terminate the command with a CHECK CONDITION status and the sense key set to NOT READY. If the current values are requested report a valid set of saved parameters, or restore the saved parameters and report them. If the saved parameters are not able to be accessed in non-volatile memory terminate the command with a CHECK CONDITION status and the sense key set to NOT READY. An attempt to may be made to return valid parameters if the target is unable to save parameters. At the targets option it may report default values. PRINT Command Peripheral Device Type: Printer Operation Code Type: Mandatory PRINT Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (0Ah) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The PRINT command (Table 10-3) transfers the specified number of bytes from the initiator to the target to be printed. The data sent is application dependent. The transfer length specifies the length in bytes of data that shall be sent during the DATA OUT phase. A transfer length of zero indicates that no data shall be sent. This condition shall not be considered as an error. RECOVER BUFFERED DATA Command Peripheral Device Type: Printer Operation Code Type: Optional RECOVER BUFFERED DATA Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (14h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | Transfer Length | -----|--- ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The RECOVER BUFFERED DATA command (Table 10-6) returns to the initiator the data that has been sent to the target, but not yet printed. This command is normally used only to recover from error or exception conditions that make it impossible to print the buffered data. The order in which the data is transferred from the target to the initiator is the same as it was when the data was previously transferred using the PRINT command or SLEW AND PRINT command. Data that is transferred by this command is deleted from the target data buffer. One or more RECOVER BUFFERED DATA commands may be used to return the unprinted buffered data. If an attempt is made to recover more data than is contained in the buffer, the command shall be terminated with a CHECK CONDITION status and the sense key shall be set to NO SENSE. In addition, the EOM, the valid, and the ILI bits in extended sense shall be set to one. The information bytes shall be set to the difference (residue) between the transfer length and the actual number of bytes returned. The transfer length specifies the maximum length in bytes of data that shall be transferred during the DATA IN phase. A transfer length of zero indicates that no data shall be transferred. This condition shall not be considered as an error. RESERVE UNIT and RELEASE UNIT Commands Peripheral Device Type: Printer Operation Code Type: Optional RESERVE UNIT and RELEASE UNIT Commands ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (16h & 17h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | 3rdPty | Third Party Device ID |Reserved| -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The RESERVE UNIT and RELEASE UNIT commands both use the command descriptor block shown in Table 10-9. RESERVE UNIT Command The RESERVE UNIT command (Table 10-9, operation code 16h) shall reserve the specified logical unit for the exclusive use by the requesting initiator or, if third-party reservation option is implemented, to another specified SCSI device. The reservation shall remain in effect until superseded by another RESERVE UNIT command from the initiator that made the reservation or until released by a RELEASE UNIT command from the same initiator, or a BUS DEVICE RESET message from any initiator, or a "hard" RESET condition. The occurrence of the last two conditions is indicated by a sense key of UNIT ATTENTION on the next command following the condition. It is not an error to issue this command to a logical unit that is currently reserved to the requesting initiator. IMPLEMENTORS NOTE: The reservation queuing option in X3.131-1986 has been removed from this version. If the logical unit is previously reserved by another initiator, then the target shall return a RESERVATION CONFLICT status. If, after honoring the reservation, any other initiator then subsequently attempts to perform any command on the reserved logical unit other than a RESERVE UNIT command, which may be queued, or a RELEASE UNIT command, which shall be ignored, then the command shall be rejected with a RESERVATION CONFLICT status. The third-party reservation option for the RESERVE UNIT command allows an initiator to reserve a logical unit for another SCSI device. This option is intended for use in multiple-initiator systems that use the COPY command. Any target that implements the third-party reservation option shall also implement the third-party release option (see 10.7.2). If the third-party (3rdPty) bit is zero, then the third-party reservation option is not requested. If the 3rdPty bit is one and the third-party reservation option is implemented, then the RESERVE UNIT command shall reserve the specified logical unit for the SCSI device specified in the third-party device ID field. The target shall preserve the reservation until superseded by another RESERVE UNIT command from the initiator that made the reservation or until released by the same initiator, by a BUS DEVICE RESET message from any initiator, or by a "hard" RESET condition. The target shall ignore (i.e., return GOOD status) any attempt made by any other initiator to release the reservation. If the 3rdPty bit is one and the third-party reservation option is not implemented, then the target shall reject the RESERVE UNIT command with a CHECK CONDITION status and a sense key of ILLEGAL REQUEST. An initiator that holds a current reservation may modify that reservation (e.g., switch third-parties) by issuing another RESERVE UNIT command to the same logical unit. The superseding RESERVE UNIT command shall release the previous reservation state only when the new reservation is granted. A superseding reservation takes priority over any previously queued reservation request. RELEASE UNIT Command The RELEASE UNIT command (Table 10-9, operation code 17h) shall release the logical unit if it is currently reserved by the requesting initiator. It is not an error to attempt to release a logical unit that is not currently reserved to the requesting initiator. However, it shall not be released if it is reserved by another initiator. The third-party release option for the RELEASE UNIT command allows an initiator to release a logical unit that was previously reserved using the third-party reservation option (see 10.7.1). This option shall be implemented if the third-party reservation option is implemented. This option is intended for use in multiple-initiator systems that use the COPY command. If the third-party (3rdPty) bit is zero, then the third-party release option is not requested. If the 3rdPty bit is one and the target implements the third-party release option, then the target shall release the specified logical unit, but only if the reservation was made using the third-party reservation option by the initiator that is requesting the release and for the same SCSI device as specified in the third-party device ID field. If the 3rdPty bit is one and the target does not implement the third-party release option, then the target shall terminate the command with a CHECK CONDITION status and the sense key shall be set to ILLEGAL REQUEST. SLEW AND PRINT Command Peripheral Device Type: Printer Operation Code Type: Optional SLEW AND PRINT Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (0Bh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Channel| -----|-----------------------------------------------------------------------| 2 | Slew Value | -----|-----------------------------------------------------------------------| 3 | (MSB) | -----|--- Transfer Length ---| 4 | (LSB) | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The SLEW AND PRINT command (Table 10-4) transfers the specified number of bytes from the initiator to the target to be printed. The data sent is application dependent. This command is provided for printers that do not support forms control information imbedded within the print data. The transfer length specifies the length in bytes of data that shall be sent during the DATA OUT phase. A transfer length of zero indicates that no data shall be sent. This condition shall not be considered as an error. If the channel bit is zero, the slew value specifies the number of lines the form shall be advanced before printing. A value of 255 indicates that the form shall be advanced to the first line of the next form before printing. If the channel bit is one, the slew value specifies the forms control channel number to which the form shall be advanced prior to printing the data. If implemented, the target options page in the MODE SELECT command provides additional control over the usage of the slew value field. If the channel bit is one, and the channel option is not implemented, the command shall be terminated with a CHECK CONDITION status and the sense key shall be set to ILLEGAL REQUEST. STOP PRINT Command Peripheral Device Type: Printer Operation Code Type: Optional STOP PRINT Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (1Bh) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | Retain | -----|-----------------------------------------------------------------------| 2 | Vendor Unique | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Control Byte | ============================================================================== The STOP PRINT command (Table 10-12) is used to halt printing on buffered devices in an orderly fashion. A retain bit of zero requests that the target data buffer be discarded; otherwise, the unprinted data is retained. The unprinted data may be recovered by use of the RECOVER BUFFERED DATA command, if supported. A subsequent PRINT command or SLEW AND PRINT command shall cause the remaining unprinted and unrecovered data to be printed followed by the data transferred by the subsequent command. The point at which printing is suspended by this command is peripheral-device specific and is not defined by this standard. Additional Sense Codes for Printer Devices The additional sense code (byte 12 of sense data) and the additional sense code qualifier (byte 13 of sense data) provide device-specific error information. If these fields are supported, the target shall report error conditions using the codes described in the table below. [The entire table below is new -- it may need some work to get it into the same form as section 8 or section 9.] Extended Sense -- Additional Sense Code Defintion ============================================================================== Byte # Related Sense Keys 12 13 Description (others may apply) -- -- ----------------------------------------- ------------------ 00 00 No additional sense information NO SENSE 01 00 No printer interface verify (printer device not present) HARDWARE ERROR 03 00 Printer-detected parity error HARDWARE ERROR 04 00 Printer not ready NOT READY 05 00 Printer off-line NOT READY 06 00 No Top-of-Form (TOF) detected HARDWARE ERROR 08 00 Paper movement failure HARDWARE ERROR 08 01 Slew failure 08 02 Paper jam 09 00 Printer Fault HARDWARE ERROR 10 00 Tape/Electronic Vertical Forms Unit (TVFU/EVFU) not ready NOT READY 1B 00 Synchronous transfer error HARDWARE ERROR 20 00 Invalid command operation code ILLEGAL REQUEST 20 01 Illegal function for device type 20 02 Unsupported function 21 00 Invalid byte transfer length ILLEGAL REQUEST 22 00 Invalid function for device type ILLEGAL REQUEST 24 00 Illegal CDB field ILLEGAL REQUEST 24 02 Reserved bit/field set 25 00 Invalid Logical Unit Number (LUN) ILLEGAL REQUEST 26 00 Invalid parameter list field ILLEGAL REQUEST 29 00 Power-on / bus reset occurred UNIT ATTENTION 2A 00 MODE SELECT parameters changed UNIT ATTENTION 31 00 FORMAT failed HARDWARE ERROR 3A 00 Out of paper MEDIUM ERROR 3B 00 Paper position error MEDIUM ERROR or HARDWARE ERROR 3B 01 Failed to sense Bottom-of-Form (BOF) 3B 02 Failed to sense Top-of-Form (TOF) 42 00 Power-on diagnostic failure HARDWARE ERROR 43 00 Message Reject Error ABORTED COMMAND 44 00 Internal controller SCSI failure HARDWARE ERROR 45 00 Select/Reselect failure HARDWARE ERROR 46 00 Unsuccessful soft reset HARDWARE ERROR ======================================================================== Byte # Related Sense Keys 12 13 Description (others may apply) -- -- ----------------------------------------- ------------------ 47 00 SCSI parity error ABORTED COMMAND or RECOVERED ERROR or HARDWARE ERROR 48 00 Initiator detected error ABORTED COMMAND or RECOVERED ERROR or HARDWARE ERROR 49 00 Inappropriate/Illegal message ABORTED COMMAND 60 00 Target status error on COPY command COPY ABORTED 70 00 Self-test failed HARDWARE ERROR