This is intended to be a tutorial covering the SCSI tm interface in the GYPSY-2000 SCSI to VPItm Adapter. It may be useful to those who wish to develop their own driver, or desire to integrate the adapter into their application software. It may also be useful in understanding what happens inside the Gypsy under particular circumstances. The various options available for controlling the Gypsy are also explained. This text is limited to the SCSI-2 protocol as implemented by the GYPSY-2000. For a more general discussion of SCSI-2, please refer to the ANSI SCSI-2 Standard, X3T10 Committee.
GYPSY-2000 SCSI-II TO ELECTROSTATIC PLOTTER ADAPTER INTERFACE SPECIFICATION. AcuLab, Inc.
ANSI SCSI-2 Standard, X3T10 Committee. Available from Global Engineering Documents at (800) 854-7179 or (303) 792-2181.
The following SCSI commands are implemented (either partially or fully) by the Gypsy firmware. Some are mandatory by the SCSI-2 standard, some are optional, and some include vendor-unique areas.
The INQUIRY command is most likely the very first command to be issued by an initiator. Upon power-up, an initiator typically issues several INQUIRY commands to determine the which devices are on the SCSI bus. It starts at SCSI ID 0, Logical Unit Number (LUN) 0. If a device is located, the scan continues with SCSI ID 0, LUN 1, then LUN 2, and so on until either no device is located, or LUN 7 has been scanned. At this point, the scan continues with SCSI ID 1, LUN 0, proceeding through to SCSI ID 7, LUN 7. The results from this initial scan may be available to application and driver software through the use of the host's SCSI system routines.
The information returned by the INQUIRY command includes the Peripheral Qualifier and Peripheral Device Type (2 = Printer Device at LUN 0, or 7Fh = unsupported LUN), Vendor and Product Identification ("AcuLab GYPSY-2000 "), and the Product Revision Level. ANSI-Approved Version claimed is 2 (SCSI-2 compliant).
The SCSI bus will go through several bus phases during the INQUIRY command.
(free) - (ARB) - (SEL) - (MSG) - (CMD) - (DATA) - (STATUS) - (MSG) - (free)
Starting with a free bus, the initiator arbitrates (ARB) for control of the bus. The initiator winning arbitration then selects (SEL) the target with which it wishes to communicate. During the selection bus phase, the control of bus phases shifts from the initiator to the target. The initiator should assert the Attention SCSI bus signal (ATN), causing the target to change the bus phase to message (MSG) out. Note that all directions are with respect to the initiator. During the MSG out phase, the initiator sends a single IDENTIFY message byte. A standard four cycle request/acknowledge handshake is performed for each byte transferred between the initiator and the target. The initiator always controls the signal called ACK, while the target always controls the signal called REQ. Contained within the ID message is the DiscPriv bit. This bit allows the initiator to either grant or revoke the target's Privilege of Disconnecting from the initiator on the SCSI bus at a later time. If the initiator keeps ATN asserted, the target should continue in the message out phase receiving message bytes until the initiator finally drops ATN. This technique is often used at startup to negotiate a Synchronous Data Transfer Request (SDTR). The Gypsy politely declines the SDTR message with a REJECT message. When the command (CMD) phase is reached, the initiator transfers either a 6, 10, or 12 byte Command Descriptor Block (CDB). The Gypsy needs just the 6-byte version. The CDB for an INQUIRY command for LUN 0 would be 12h 00h 00h 00h FFh 00h, and indicates the initiator has set aside a buffer of FFh bytes to receive the response. The target proceeds to the data-in bus phase, and transfers the INQUIRY response data block. Following this, the target changes to the status-in bus phase and sends a GOOD (00h) status byte. The bus phase is changed to MSG in and a command complete (CMD CMPLT) (00h) message byte is sent to the initiator. Finally the target releases control of the bus, and the bus is free once again. (Whew!)
This basic scenario is repeated for all SCSI commands, although the direction of data transfer may be different, additional status and message bytes may be exchanged, and the bus may go free somewhere in the middle. Under extreme conditions, like for a BUS DEVICE RESET message, the target may go bus free without completing the command.
The INQUIRY command will always return with GOOD status unless the initiator has set unsupported bits in the CDB. The Gypsy allows the INQUIRY command from an initiator even if another initiator has issued a RESERVE UNIT command for exclusive use of the Gypsy. This permits multiple initiators to power on at different times, and for each to receive the INQUIRY data block.
If the initiator did not want to reserve FFh bytes for the target's INQUIRY response, it could issue the INQUIRY command twice. The first time, it would request only 6 bytes of data. After receiving this data, it observes how much memory must be used to retrieve all of this target's INQUIRY response and issues the second INQUIRY. The first CDB would be 12h 00h 00h 00h 06h 00h. Observing that the Gypsy declares an additional length of 1Fh, the initiator computes 24h bytes should be retrieved (1Fh + 4h + 1h), so issues a second INQUIRY CDB of 12h 00h 00h 00h 24h 00h. This technique allows the initiator to retrieve all of the target's INQUIRY data with a minimum of memory, without knowing in advance how much memory will be required.
A basic test of the INQUIRY data should include verification of the Peripheral Qualifier and Peripheral Device Type. This may be used to double-check the user's input when installing a device driver, or running application software.
The RESERVE UNIT command is used to reserve the Gypsy for exclusive use by one and only one initiator. Obviously this becomes unnecessary in a single-initiator environment, although it cannot hurt. If the same initiator performs multiple reserves, no harm is done, and the Gypsy remains reserved for that same initiator.
If the Gypsy has already been reserved by one initiator, then RESERVATION CONFLICT (18h) is returned during the status-in bus phase to all other initiators for nearly all commands. The INQUIRY, RESERVE UNIT, and REQUEST SENSE commands are the exceptions. Any initiator is allowed to perform the INQUIRY and REQUEST SENSE commands at almost any time.
This command should be issued prior to the first PRINT command when the printer's output would not look as nice if PRINT commands were also issued from other initiators.
A typical CDB for reserving the Gypsy is 16h 00h 00h 00h 00h 00h. Third Party reservations are not supported.
The RELEASE UNIT command releases the exclusive hold one initiator has placed on the Gypsy. This command should always return GOOD status, independent of current Gypsy reservation status. If one initiator has reserved the Gypsy, and another initiator issues the RELEASE UNIT command, no harm is done as the first initiator will still have the Gypsy reserved.
This command should be issued after the last PRINT command at the completion of the printing task.
A typical CDB for releasing the Gypsy is 17h 00h 00h 00h 00h 00h. Again, Third Party operations are not supported.
The MODE SENSE command may not be supported in all versions of the firmware. If the command is not supported, the ending status will be CHECK CONDITION. This is most likely to come from an older Gypsy.
This command requests information concerning the special control options available in the Gypsy. The 'Page Control' (PC) and 'page code' fields within the CDB determines the information returned.
For a somewhat general driver, capable of working with several versions of the firmware, the first MODE SENSE command should request the supported pages, lengths, and modifiable fields by using the following CDB: 1Ah 08h 7Fh 00h FFh 00h. A sample response is 0Fh 00h 00h 00h 20h 0Ah FFh FFh FFh FFh FFh FFh 07 01 00 00.
The first 4 bytes returned by MODE SENSE are the header and are not dependent upon the PC or page code fields. The buffered mode field inside the header always returns the current value (regardless of PC field). The above sample response shows buffered mode is not enabled, page code 20h exists with a length of 10 more bytes, of which all of the first 6 may be modified, as well as some bits of the 7th and 8th bytes.
Although the CDB indicated the initiator has reserved FFh bytes to receive the target's response, the Gypsy returned only 10h bytes. This should not cause any problems inside the initiator, as the first byte of the header indicates the returned MODE SENSE data length. For each Page Code returned, a Page Length will also be supplied.
To determine the current values, use PC = 0 as shown in this CDB: 1Ah 08h 20h 00h 10h 00h. Until a MODE SELECT command has been issued, these will match the default values.
The driver may retrieve the default values (power-on values), if desired, for page 20h with a CDB of 1Ah 08h A0h 00h 10h 00h. These will become the current values each time the Gypsy is powered on, or goes through a hard reset, as from a Bus Device Reset message. A sample response is 0Fh 00h 00h 00h 20h 0Ah 00h 1Eh 00h 1Eh 00h 00h 01h 00h 00h 00h.
The Gypsy is not currently able to store data when powered off, so Saved Values (PC = 3) are not supported.
The Gypsy will return MODE SENSE parameters specific to the requesting initiator. One initiator may not change or retrieve the MODE parameters for another initiator.
This command allows the initiator to make changes to the special control options available in the Gypsy. The current firmware supports 7 control features:
The preferred method of using MODE SELECT is to use MODE SENSE to retrieve all pages and their changeable fields and their current values, select the page to be sent, then mask out the current value from the fields being modified and mask in the new replacement values, and then issue the MODE SELECT command for the selected page using the page length returned by MODE SENSE. This technique allows for changes in the Gypsy without requiring changes in drivers. Naturally a driver would require change in order to make use of newly available control options; an unmodified driver would still be able to control all of the older options.
When enabled, this directs the target, during PRINT or FORMAT commands, to accept the data, return GOOD status and CMD CMPLT message, and go bus free prior to actually sending the data to the plotter.
If an error occurs later while sending data to the plotter, it will be reported as a deferred error, rather than a current error in the REQUEST SENSE data.
The Gypsy currently is capable of buffering data for 3 PRINT and/or FORMAT commands. Once all buffers are full, and another PRINT or FORMAT command is issued while the plotter is still OPERATIONAL, the Gypsy's response depends upon the initiator's DiscPriv bit in the ID message: if DiscPriv is granted, then the Gypsy tries to disconnect from the initiator without taking the data (and will re-select the initiator later when it can take the data); if DiscPriv is not granted, then the Gypsy returns BUSY status and CMD CMPLT message, and goes bus free.
If the Gypsy is in buffered mode of operation when a MODE SELECT command is issued, the data is taken and will be processed when all other buffered commands are complete. The Gypsy may disconnect prior to taking the data if no buffers are available within the Gypsy to receive the data, or after having received the data waiting for the other buffers to be processed. When the MODE SELECT data has been processed, the Gypsy will return the ending status and CMD CMPLT message and go bus free.
Performance tends to improve when using buffered mode of operation, especially when sending the maximum amount of data with each PLOT command.
Buffered mode of operation is disabled by default.
This timeout is the amount of time the Gypsy allows, once it starts processing the FORMAT data, until it declares an error because the plotter handshaking is not complete. If the Gypsy is able to process all FORMAT data within the allotted time (handshake the remote commands with the plotter), then it is not an error.
If this time is exceeded in unbuffered mode, a CHECK CONDITION will be returned for the FORMAT command.
If this time is exceeded during buffered mode of operation, and the Gypsy is not disconnected from the same initiator, then the next command issued by the initiator will receive a CHECK CONDITION.
If this time is exceeded while disconnected from the same initiator in buffered mode of operation, the current (disconnected) command receives a CHECK CONDITION.
Even though a timeout has occurred, the Gypsy will continue to handshake with the plotter in an attempt to complete the FORMAT command.
The default timeout is 30 seconds.
This timeout is the time allowed for all PLOT data to be sent to the plotter before an error is declared.
The timeout processing proceeds as described above for the FORMAT timeout.
The default timeout is 30 seconds.
A value of 0 (which is the default value) disables this feature. When non-zero, the Gypsy sends this number of bytes of PLOT data to the plotter, then sends a Remote Line TERminate (RLTER) to the plotter. This process is repeated until all data from a PLOT command has been sent to the plotter.
This automatic RLTER performed by the Gypsy alleviates the initiator from having to send one line of data in a PLOT command, then send a FORMAT command to perform the RLTER. Instead, the initiator may declare with the line length how many PLOT data bytes should be sent in-between each RLTER.
If the initiator does not send PLOT commands with an integral multiple of the line length, then the exactRLTER option will control whether an RLTER occurs at the end of each PLOT command.
Performance tends to improve when using the autoRLTER option, especially when sending the maximum amount of data with each PLOT command.
The RDYCOND field controls how the Gypsy conditions the plotter's READY signal. The default value (1) assures good handshaking with the plotter. Faster handshaking may occur by selecting a larger value (up to 7), but the results are plotter dependent. We recommend extensive testing before relying upon any value besides the default.
The SCSI-2 standard provides a method for a target to notify an initiator that the LU's device has gone from an 'offline' state to an 'online' state (a UNIT ATTENTION status with an Additional Sense Code for "Not Ready to Ready transition, medium may have changed"). However, no common technique has been provided within the SCSI-2 standard for notification that the LU's device has gone from an 'online' state to an 'offline' state. An initiator normally performs a Test Unit Ready command to verify the device is 'online'.
The differential plotter interface has two signals (wires) that make up the OPERATIONAL signal. The names of the two signals on the differential interface may be misleading. Their signal names are '/ONLIN' (not online) and 'NOPAP' (NO PAPer). The Gypsy cannot determine when the plotter is online or offline, nor can the Gypsy determine when paper is available. The Gypsy can determine when the plotter is OPERATIONAL by looking at this differential pair of signals.
This PLOn2Off (PLotter On to Off) notification option, when enabled, causes the Gypsy to return CHECK CONDITION status at its earliest convenience upon detecting the plotter becoming NOT OPERATIONAL after having been OPERATIONAL. The use of this option is not necessary, but is available for those who want this extra information.
If the Gypsy detects the NOT OPERATIONAL condition in-between commands, then CHECK CONDITION status will be returned (as it would have been without this option enabled) for the next command from the initiator. This is the case during both unbuffered and buffered modes of operation.
If the Gypsy detects the NOT OPERATIONAL condition while a command is being processed by the Gypsy, and the Gypsy is disconnected from the initiator, the Gypsy will re-select the initiator and return CHECK CONDITION status (only because the PLOn2Off option is enabled).
If the Gypsy detects the NOT OPERATIONAL condition while a command is being processed by the Gypsy, and the Gypsy is still connected on the SCSI bus to the initiator, the Gypsy may return CHECK CONDITION status for the command in progress, depending upon the current bus phase. If the Gypsy is unable to return CHECK CONDITION status for the command in progress, then the next command will receive the CHECK CONDITION status.
The PLOn2Off notification is disabled by default.
This option is meaningful only when the automatic RLTER option is in use.
With exactRLTER disabled and the automatic RLTER option enabled, the Gypsy will always issue a Remote Line TERminate following the last data byte of each PLOT command.
With exactRLTER enabled and the automatic RLTER option enabled, the Gypsy will issue a Remote Line TERminate only when the full line length has been sent to the plotter, even if this means data from two or more PLOT commands must be sent.
By default, the exactRLTER option is disabled.
A sample MODE SELECT CDB is 15h 10h 00h 00h 10h 00h. A sample data block for enabling buffered mode of operation, setting the FORMAT timeout to 5 minutes, setting the PLOT timeout to 2 minutes, enabling automatic RLTERs every 264 bytes, leaving RDYCOND at 1 as retrieved by the MODE SENSE command, not enabling the PLOn2Off notification, and allowing multiple PLOT commands to provide data for a single plotter scan line is 00h 00h 10h 00h 20h 0Ah 01h 2Ch 00h 78h 01h 08h 01h 02h 00h 00h.
The REQUEST SENSE command returns information from the Gypsy which may explain a previous CHECK CONDITION status. A driver should issue a REQUEST SENSE command each time it receives CHECK CONDITION status and determine the cause of the CHECK CONDITION status. In fact, many initiators may provide a technique whereby the host's SCSI adapter driver issues the REQUEST SENSE command automatically upon receipt of CHECK CONDITION STATUS. REQUEST SENSE data is not created for GOOD status, BUSY status, or RESERVATION CONFLICT status. The Gypsy will not return an infinite number of CHECK CONDITIONs if corrective action is taken.
Although the plotter interface status is included, this information should not be necessary when operating the Gypsy. This status has been included for debug purposes. The signals may change much faster than an initiator at the other end of a SCSI bus may be able to detect.
A typical driver should always look at the Error Code, Sense Key, Additional Sense Code (ASC), and Additional Sense Code Qualifier (ASCQ) when attempting to determine the cause of the status given on the previous command. The plotter interface status may not accurately reflect the cause of the previous status. The SCSI protocol should be used for error detection and any corrective action.
The Error Code indicates whether the CHECK CONDITION status was returned as a result of the command just issued, or because of some previous command for which GOOD status has already been return (as in buffered mode of operation). An Error Code of 70h indicates a current error, whereas 71h indicates a deferred error.
The Sense Key gives a general overall view of the sense data. A Sense Key of 0h (No Sense) indicates no sense data is available. This shouldn't happen if the previous command received CHECK CONDITION status.
A Sense Key of 2h (Not Ready) indicates the plotter was NOT OPERATIONAL. A human may have pressed the "pause" button on the plotter, or the plotter may have run out of paper. Verify this by looking at the ASC/ASCQ fields.
A Sense Key of 4h (Hardware Error) is returned when the Gypsy has detected an internal hardware or software error. Record the Field Replaceable Unit (FRU), the Incorrect Length Indicator (ILI), and the Information fields specifically, but try to get a log of all sense data returned by the Gypsy. Please report the scenario, equipment in use, and the sense data back to AcuLab.
A Sense Key of 5h (Illegal Request) indicates the initiator is requesting a non-zero LUN, an unsupported op code in the CDB, has set reserved bits in the CDB, or is using an unsupported value within a CDB field. The ASC/ASCQ should help clarify the reason.
A Sense Key of 6h (Unit Attention) indicates the initiator has not necessarily done anything wrong to cause the CHECK CONDITION on the previous command, but rather indicates that the Gypsy has some information for the initiator. The ASC/ASCQ will report the additional information. The Gypsy may queue up several Unit Attentions, but each one is for a reason. The initiator should always do a REQUEST SENSE when it receives a CHECK CONDITION status.
When the Gypsy is powered on, it generates Unit Attentions for all initiators and sets the ASC/ASCQ to 2900h. The first REQUEST SENSE issued by each initiator should expect this ASC/ASCQ. This is informational status for the initiator. If the initiator receives this additionally after the initial power on, it is an indication that the Gypsy has gone through a reset or power cycle, and that all of its MODE parameters are back to the default states.
When the Gypsy detects the plotter becoming OPERATIONAL, Unit Attentions are again generated for all initiators with ASC/ASCQ of 2800h. Only 1 pending Unit Attention is generated for each initiator, no matter how many times the plotter becomes OPERATIONAL before the initiator performs a REQUEST SENSE. This is informational status for the initiator. The plotter is OPERATIONAL and should be ready to receive data. Begin printing and plotting.
If an initiator attempts to issue a command not recognized by the Gypsy, the ASC/ASCQ is set to 2000h. This hopefully will occur only during development. Change the first byte of the CDB to an op code supported by the Gypsy.
If an initiator sends a command with reserved bits set, or invalid settings of a field within the CDB, the Gypsy sets the ASC/ASCQ to 2400h. Verify each field within the CDB is set according to the GYPSY-2000 SCSI-II TO ELECTROSTATIC PLOTTER ADAPTER INTERFACE SPECIFICATION.
If an initiator attempts to address any LUN other than 0 with any command other than INQUIRY or REQUEST SENSE, the Gypsy sets the ASC/ASCQ to 2500h. Only one LUN is supported by the GYPSY-2000. Change the LUN field within the CDB to 0 and re-try the command.
The MODE SENSE and MODE SELECT commands may cause one of several ASC/ASCQ values as described in the next 3 paragraphs.
When the initiator issues a MODE SENSE command requesting the saved parameters, the ASC/ASCQ is set to 3900h. The Gypsy cannot save parameters, so don't request them. Current, Default, and Changeable parameters are all available from the MODE SENSE command.
When the initiator issues a MODE SENSE command with the Allocation Length not equal to 0 (which is not very useful, but legal), 4 (for just the parameter header block), or equal to or greater than the length of the header and all mode code pages, the ASC/ASCQ is set to 1A00h. Additionally, when the initiator issues a MODE SELECT command with a Parameter List Length not 0, 4, or exactly the length of the header and page 20h, the ASC/ASCQ is set to 1A00h. When performing a MODE SENSE (which should be done before doing a MODE SELECT), the initiator may over-allocate memory for the response data. When performing a MODE SELECT, the initiator should know by looking at the MODE SENSE data how much MODE SELECT data to send.
When the initiator issues a MODE SELECT command with any reserved bits or unchangeable bits set, or with a non-zero Block Descriptor Length, or the Page Code is not 20h, or the Page Length is not correct, the ASC/ASCQ is set to 2600h. To correct this, which should happen during development only, look more closely at all of the MODE SENSE data reported by the Gypsy. During the development of the Gypsy, page 20h has changed. Not all options currently available were always available, but the mask of changeable bits will always reflect which fields are supported. Once defined, a page 20h field will not move.
If the PLOn2Off feature has been enabled, and the Gypsy has detected the plotter going from an OPERATIONAL condition to a NOT OPERATIONAL condition, the Gypsy creates a Unit Attention and set the ASC/ASCQ to 8200h (just the reverse of 2800h). Only 1 pending Unit Attention is generated, no matter how many times the plotter becomes NOT OPERATIONAL. This is informational status for the initiator. The plotter is NOT OPERATIONAL. Human intervention is most likely required to restore the plotter to its OPERATIONAL condition.
When the Gypsy detects the plotter not completing all handshaking required for a FORMAT command within the time period permitted by the initiator, the ASC/ASCQ is set to 0404h. If this happens regularly, but the plotter is functioning correctly (not being paused), consider lengthening the FORMAT timeout. Some plotters, especially color ones, can take quite a while to perform the remote commands available from the FORMAT command. To allow different timeout periods for different plotter remote commands, issue FORMAT commands with 4 bytes of data, thus including the timeout parameter with the remote command. This may also occur when the plotter runs out of paper during a remote command, or the plotter is manually paused. Human intervention is required in these cases. The initiator has no alternative but to wait for the plotter to become OPERATIONAL. The TEST UNIT READY command may be used to determine when the plotter becomes OPERATIONAL again.
When the Gypsy detects the plotter not accepting all of the PLOT data within the time period permitted by the initiator, the ASC/ASCQ is set 0801h. This may happen when the plotter is connected through an RPM box, in which case the time may need to be adjusted. This may also occur when the plotter runs out of paper and fills its internal buffer with PLOT data, or when the plotter is manually paused. Human intervention is required in these cases. The initiator has no alternative but to wait for the plotter to become OPERATIONAL. The TEST UNIT READY command may be used to determine when the plotter becomes OPERATIONAL again.
When the initiator sends a command that requires the Gypsy to communicate with the plotter, and the Gypsy notices the plotter is NOT OPERATIONAL, the somewhat generic ASC/ASCQ of 0400h is set. This could be caused by the plotter not being powered on, or not being cabled to the Gypsy, or being manually paused, or being out of paper. In any case, human intervention is required to correct the problem. After the problem has been corrected, the initiator should re-try the command.
When a REQUEST SENSE command has been issued outside of a contingent allegiance condition (the Gypsy did not return CHECK CONDITION status on the prior command), the ASC/ASCQ is set to 0000h. In this case, the vendor-unique data fields contain current data rather than status queued up at the time of the error.
In very unusual circumstances, or when trying to process PLOT, FORMAT, or MODE SELECT commands, the ASC/ASCQ may be set to 4400h. The Sense Key should be 4h. Record the FRU, ILI, and the Information fields specifically, but try to get a log of all sense data returned by the Gypsy. Please report the scenario, equipment in use, and the sense data back to AcuLab.
A sample REQUEST SENSE CDB is 03h 00h 00h 00h 80h 00h. A sample response caused by an invalid command is F0h 00h 05h 00h 00h 00h 00h 0Eh 00h 00h 00h 00h 20h 00h 00h 00h 00h 00h 38h 01h 00h 00h. The Error Code is 70h; Sense Key is 5h; ASC/ASCQ is 2000h.
The TEST UNIT READY command performs a check of the plotter's condition for the initiator. If the plotter is OPERATIONAL, this command returns GOOD status, else CHECK CONDITION status is returned.
This command is typically used to determine if a FORMAT or PRINT command should be successful, but without the overhead of preparing or transferring any data. The Gypsy will never disconnect while executing this command. It does not affect any parameters.
The TEST UNIT READY CDB for LUN 0 is 00h 00h 00h 00h 00h 00h. All other LUNs cause CHECK CONDITION status.
The FORMAT command allows the initiator to control some of the plotter interface signals. The initiator may select either Print or Plot modes, along with the Simultaneous Print Plot (SPP) mode. The plotter's Remote commands (RFFED, RLTER, and REOTR) are also controlled here, as well as the plotter's CLEAR and RESET signals.
This command also provides for enabling debug messages at a maintenance port within the Gypsy, and is intended for factory debug of the internal firmware. A special card is required to operate the maintenance port. Its output data format is not defined here, and may change without notice. Its use will adversely affect Gypsy performance.
If a FORMAT timeout is specified, the Gypsy records the new value for this initiator, overwriting any previous values set by either a FORMAT command, or by a MODE SELECT command.
A timer is started. If the Gypsy is not successful in completing all FORMAT operations prior to this timer expiring, the ending status returned will be CHECK CONDITION. If in buffered mode, the FORMAT command will end with GOOD status, although later, after the timeout, some other command may end with CHECK CONDITION status.
The Print/Plot and SPP mode bits, if ValidMod is set, are then updated at the plotter port, and will remain until another FORMAT command with ValidMod set, or the Gypsy goes through a power cycle, or is reset.
Then if any remote commands or CLEAR are requested, the Gypsy handshakes them with the plotter. The RESET signal, if requested, is asserted at the plotter interface without regard to the normal handshake process.
When in unbuffered mode, the Gypsy prefers to disconnect from the initiator during the processing of the FORMAT command, not knowing in advance how long it will take to complete.
A sample FORMAT CDB is 04h 02h 00h 00h 04h 00h. Sample data to set Plot mode and to issue a Remote Line TERminate with a timeout of 5 seconds is C0h 08h 00h 05h.
The PRINT command is used to send data to the plotter. For convenience in terminology, the PRINT command (SCSI terminology) may be referred to as the PLOT command (Gypsy terminology). Within the CDB is the Transfer Length. The maximum amount of data supported in a single PLOT command is 65536 bytes (a.k.a. 64KB). Earlier versions of the firmware supported a maximum transfer length just 3 bytes shorter. This limit is less than the theoretical limit of FFFFFFh due to the internal firmware and hardware.
The data associated with the PLOT command may be anything. The Gypsy does not attempt to interpret any of the data destined for the plotter. It is the initiator's responsibility to issue a FORMAT command to place the plotter into the correct print or plot mode before sending the PLOT command.
A timer is started when the Gypsy begins sending the PLOT data to the plotter. If the Gypsy is not successful in sending all of the data prior to this timer expiring, the ending status returned will be CHECK CONDITION. Note that if in buffered mode, the PLOT command will end with GOOD status, although later, after the timeout and some data has not been transferred to the Gypsy, some other command may end with CHECK CONDITION status.
When in unbuffered mode, the Gypsy prefers to disconnect from the initiator during the processing of the PLOT command, not knowing in advance how long it will take to complete. Here is the particular bus phase sequence.
(free) - (ARB) - (SEL) - (MSGO) - (CMD) - (DATA) - (MSGI) - (MSGI) - (free)
(free) - (ARB) - (RESEL) - (MSGI) - (STATUS) - (MSGI) - (free)
The sequence through the DATA phase is as shown for the INQUIRY command above, but here the direction of data transfer is from the initiator to the target. After the DATA phase, the Gypsy sends two message bytes to the initiator: Save Data Pointer message and Disconnect message. When the initiator acknowledges these messages, the Gypsy disconnects from the SCSI bus (is bus free). Later, when the Gypsy is ready to report the ending status to the initiator, the Gypsy arbitrates for the bus, reselects the initiator, and sends an ID message back to the initiator. This now puts the Gypsy back in the groove, ready to send the ending status and CMD CMPLT message before going bus free again.
If the initiator has not granted DiscPriv within the ID message, then the Gypsy will remain on the SCSI bus with the initiator until the PLOT command has been completely processed, including any data transfer from the Gypsy to the plotter if necessary, before returning the ending status and CMD CMPLT message to the initiator.
If the plotter is NOT OPERATIONAL when the Gypsy has received the CDB (but before the data transfer on the SCSI bus has occurred), the Gypsy will skip the DATA phase and return CHECK CONDITION status with a CMD CMPLT message byte.
When in buffered mode of operation, and the Gypsy has an internal buffer available for temporarily storing the data, and the plotter is OPERATIONAL, the Gypsy will transfer the data from the initiator and return GOOD status. When the Gypsy has sent all previous data to the plotter, the Gypsy begins handshaking this new data with the plotter.
When in buffered mode, and all of the internal Gypsy buffers are full, and the plotter is OPERATIONAL, the Gypsy prefers to disconnect after having received the CDB, but before receiving the data on the SCSI bus. When a buffer is available to receive the data, the Gypsy will arbitrate for the bus, reselect the initiator, transfer the data from the initiator, and return GOOD status and a CMD CMPLT message before going bus free. This sequence of bus phases is shown here.
(free) - (ARB) - (SEL) - (MSGO) - (CMD) - (MSGI) - (MSGI) - (free)
(free) - (ARB) - (RESEL) - (MSGI) - (DATA) - (STATUS) - (MSGI) - (free)
If, while disconnected, the Gypsy detects a timeout, or detects the plotter going from OPERATIONAL to NOT OPERATIONAL (and the disconnected initiator has selected the PLOn2Off notification), the Gypsy will arbitrate for the bus, reselect the initiator, and return CHECK CONDITION status and a CMD CMPLT message. It does not matter if the Gypsy was disconnected before having received the data from the initiator, or afterwards.
If the Gypsy is operating in a multiple initiator environment, and the Gypsy is not reserved for exclusive use by one initiator, and one initiator uses buffered mode to fill up all of the Gypsy's internal buffers, and to cause the Gypsy to disconnect after having received the CDB from another PLOT command, and a different initiator attempts to issue a PLOT command, this last initiator will receive BUSY status following the CMD phase, and its data will not be taken.
A sample PLOT CDB for 10 bytes is 0Ah 00h 00h 00h 0Ch 00h. A sample data block is 41h 63h 75h 4Ch 61h 62h 2Ch 20h 49h 6Eh 63h 2Eh.
The STOP PRINT command becomes useful during buffered mode of operations, and causes the Gypsy to stop sending data to the plotter. The initiator may request that the Gypsy retain all data not yet transferred, or the discard the data associated with this initiator. If the data is retained by the Gypsy, the initiator may re-start the Gypsy sending data to the plotter by issuing a PLOT command with a zero (0) transfer length.
A sample STOP PRINT CDB requesting the Gypsy discard this initiator's data is 1Bh 00h 00h 00h 00h 00h.
The SEND DIAGNOSTIC command is commonly used to initiate a diagnostic routine within the target. At present, though, this command functions much like a TEST UNIT READY command.
In the future, if this command is further developed, the Page Format field will be implemented. At that time, the new RECEIVE DIAGNOSTIC RESULTS responses will make use of the SCSI Page Format standard. The current RECEIVE DIAGNOSTIC RESULTS response will remain vendor unique for backward compatibility.
A sample SEND DIAGNOSTIC CDB is 1Dh 00h 00h 00h 00h 00h.
The RECEIVE DIAGNOSTIC RESULTS command normally returns the results of the diagnostic routine initiated via a SEND DIAGNOSTIC command. The Gypsy currently returns some diagnostic counters in a vendor unique format, and then clears those diagnostic counters. These counters indicate how many different PLOT commands with data have been received by the Gypsy (from all initiators, if in a multiple initiator environment), and how many of some various bits within the FORMAT command have been set.
Additionally, the internal Gypsy plotter interface port registers are returned for diagnostics.
In the future, if the SEND DIAGNOSTIC command is ever updated, the results it generates will follow the SCSI Page Format. The current data, though, may remain in its current vendor unique format for backward compatibility.
A sample RECEIVE DIAGNOSTIC RESULTS CDB is 1Ch 00h 00h 00h 28h 00h. Sample data returned by the Gypsy is 33h 01h 00h 00h 00h 00h 03h 82h 00h 00h 03h 88h 00h 00h 03h 81h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 03h 87h 00h 00h 00h 00h 00h 00h 00h 02h 00h 00h 00h 00h. This says the Gypsy has counted 382h PLOT commands, 388h ValidMod bits, 381h Print/Plot mode bits, 387h RLTER bits, and 2 CLEARs.
MSG C/D I/O bus phase
--- --- --- -----------
0 0 0 Data Out
0 0 1 Data In
0 1 0 Command Out
0 1 1 Status In
1 1 0 Message Out
1 1 1 Message In