beautypg.com

1 saving the processor state, Saving the processor state – Avago Technologies LSI53C1010 User Manual

Page 208

background image

9-10

SCRIPTS Programming Topics

The third type of disconnect may occur at any time. It occurs when data
is being written to a SCSI device and its internal buffers become full. The
device disconnects before completing the data transfer to empty its
buffers and avoid an overflow condition. When it does, the SCSI bus is
in a different phase from that expected by the initiator, creating a phase
mismatch. When this happens, the processor interrupts and the CPU
must perform byte recovery. When this type of disconnect occurs, data
may be in transition; it is important to determine how much data and its
location. In addition, you must know where in the SCRIPTS program the
transfer was interrupted so that it can be resumed at a later time. To save
the state of the chip at the time of the disconnect, get the address of the
current SCRIPTS instruction and calculate the number of bytes of active
data remaining to be transferred. After saving the state of the chip,
update the SCRIPTS program and flush or clear the FIFO.

9.3.1 Saving the Processor State

The first step in saving the state of the SCRIPTS processor is to write
the address of the current SCRIPTS instruction from the DSP register to
a special table indexed by SCSI ID. The instruction at that address can
be restored later to resume processing. The DSP increments as the
current instruction is fetched, so it always points to the next instruction.
Therefore, the DSP decrements by 8 or 12, depending on whether the
instruction was a regular SCRIPTS instruction or a Memory-to-Memory
Move. This is determined by reading the DCMD register. Typically, the
instruction is a Block Move. If table indirect addressing is used, it may
only be necessary to update the table and not the SCRIPTS code.

Target disconnect may create a need to recover bytes in the chip’s data
paths. The location of the data is dependent on whether data is being
moved into or out of the chip, and whether SCSI data is being transferred
asynchronously or synchronously. Please consult the appropriate product
technical manual for exact information on the default and extended (when
supported) DMA FIFO sizes.

Saving the processor state for each type of SCSI transfer is described in
the following sections.

9.3.1.1 Asynchronous SCSI Send

If the DMA FIFO size is set to the default size, check the DFIFO and
DBC registers and calculate if there are bytes left in the DMA FIFO. To

This manual is related to the following products: