SYM53C876/876E Data Manual
2-23
Functional Description
SCSI Functional Description
Interrupt Handling
The SCRIPTS processors in the
SYM53C876 performs most functions inde-
pendently of the host microprocessor. How-
ever, certain interrupt situations must be
handled by the external microprocessor. This
section explains all aspects of interrupts as
they apply to the SYM53C876.
Polling and Hardware Interrupts
The external microprocessor is informed of an
interrupt condition by polling or hardware
interrupts. Polling means that the micropro-
cessor must continually loop and read a regis-
ter until it detects a bit set that indicates an
interrupt. This method is the fastest, but it
wastes CPU time that could be used for other
system tasks. The preferred method of detect-
ing interrupts in most systems is hardware
interrupts. In this case, the SYM53C876
asserts the Interrupt Request (INTA/ or
INTB/) line that interrupts the microproces-
sor, causing the microprocessor to execute an
interrupt service routine. A hybrid approach
would use hardware interrupts for long waits,
and use polling for short waits.
Registers
The registers in the SYM53C876 that are
used for detecting or defining interrupts are
the ISTAT, SIST0, SIST1, DSTAT, SIEN0,
SIEN1, DCNTL, and DIEN.
ISTAT
The ISTAT is the only register that can be
accessed as a slave during SCRIPTS opera-
tion, therefore it is the register that is polled
when polled interrupts are used. It is also the
first register that should be read after the
INTA/ (or INTB/) pin is asserted in associa-
tion with a hardware interrupt. The INTF
(Interrupt on the Fly) bit should be the first
interrupt serviced. It must be written to one
to be cleared. This interrupt must be cleared
before servicing any other interrupts. If the
SIP bit in the ISTAT register is set, then a
SCSI-type interrupt has occurred and the
SIST0 and SIST1 registers should be read. If
the DIP bit in the ISTAT register is set, then a
DMA-type interrupt has occurred and the
DSTAT register should be read. SCSI-type
and DMA-type interrupts may occur simulta-
neously, so in some cases both SIP and DIP
may be set.
SIST0 and SIST1
The SIST0 and SIST1 registers contain the
SCSI-type interrupt bits. Reading these regis-
ters determines which condition or conditions
caused the SCSI-type interrupt, and clears
that SCSI interrupt condition. If the
SYM53C876 is receiving data from the SCSI
bus and a fatal interrupt condition occurs, the
chip attempts to send the contents of the
DMA FIFO to memory before generating the
interrupt. If the SYM53C876 is sending data
to the SCSI bus and a fatal SCSI interrupt
condition occurs, data could be left in the
DMA FIFO. Because of this the DMA FIFO
Empty (DFE) bit in DSTAT should be
checked. If this bit is clear, set the CLF (Clear
DMA FIFO) and CSF (Clear SCSI FIFO)
bits before continuing. The CLF bit is bit 2 in
CTEST3. The CSF bit is bit 1 in STEST3.
DSTAT
The DSTAT register contains the DMA-type
interrupt bits. Reading this register deter-
mines which condition or conditions caused
the DMA-type interrupt, and clears that
DMA interrupt condition. Bit 7 in DSTAT,
DFE, is purely a status bit; it does not gener-
ate an interrupt under any circumstances and
is not cleared when read. DMA interrupts
flushes neither the DMA nor SCSI FIFOs
before generating the interrupt, so the DFE
bit in the DSTAT register should be checked
after any DMA interrupt. If the DFE bit is
clear, then the FIFOs must be cleared by set-