NCR 5380 SCSI Interface Chip Design Manual Microelectronics Division, Colorado Springs Copyright © 1985, by NCR Corporation Dayton, Ohio All Rights Reserved Printed in U.S.A. This document contains the latest information available at the time of publication. However, NCR reserves the right to modify the contents of this material at any time. Also, all features, functions and operations described herein may not be marketed by NCR in all parts of the world. Therefore, before using this document, consult your NCR representative or NCR office for the information that is applic- able and current. TABLE OF CONTENTS SECTION PAGE 1. General Description ............................................................. 3 2. SCSI Background .............................................................. 4 3. Block Diagram ................................................................. 5 4. Pin Description .................................................................. . 4.1 Microprocessor Interface Signals .......................................... 6 4.2 SCSI Interface Signals ................................................... 8 5. Electrical Characteristics ........................................................ 9 6. Internal Registers ................................................................ . 6.0 General .................................................................10 6.1 Data Registers .......................................................... 10 6.1.1 Current SCSI Data Register ............................................. 10 6.1.2 Output Data Register ................................................... 10 6.1.3 Input Data Register ..................................................... 11 6.2 Initiator Command Register ............................................... 11 6.3 Mode Register .......................................................... 13 6.4 Target Command Register ............................................... 14 6.5 Current SCSI Bus Status Register ......................................... 15 6.6 Select Enable Register ................................................... 15 6.7 Bus and Status Register ................................................. 15 6.8 DMA Registers .......................................................... 16 6.8.1 Start DMA Send ....................................................... 16 6.8.2 Start DMA Target Receive .............................................. 17 6.8.3 Start DMA Initiator Receive .............................................. 17 6.9 Reset Parity/ Interrupt .................................................... 17 7. On-Chip SCSI Hardware Support ................................................. 18 8. Interrupts ....................................................................... . 8.1 Selection/ Reselection ................................................... 19 8.2 End of Process (EOP) Interrupt ........................................... 20 8.3 SCSI Bus Reset ........................................................ 21 8.4 Parity Error ............................................................. 21 8.5 Bus Phase Mismatch .................................................... 22 8.6 Loss of BSY ............................................................ 22 9. Reset Conditions ............................................................... 23 9.1 Hardware Chip Reset .................................................... 23 9.2 SCSI Bus Reset Received ............................................... 23 9.3 SCSI Bus Reset Issued .................................................. 23 10. Data Transfers ................................................................. 24 10.1 Programmed 110 Transfers ............................................... 24 10.2 Normal DMA Mode ...................................................... 24 10.3 Block Mode DMA ....................................................... 24 10.4 Pseudo DMA Mode ...................................................... 25 10.5 Halting a DMA Operation ................................................. 25 10.5.1 Using the EOP Signal .................................................. 25 10.5.2 Bus Phase Mismatch Interrupt ........................................... 25 10.5.3 Resetting the DMA MODE Bit ........................................... 25 11. External Timing Diagrams 11.1 CPU Write .............................................................. 26 11.2 CPU Read ............................................................. 26 11.3 DMA Write (Non-block Mode) Target Send ................................. 27 11.4 DMA Write (Non-block Mode) Initiator Send ................................ 28 11.5 DMA Read (Non-block Mode) Target Receive .............................. 29 11.6 DMA Read (Non-block Mode) Initiator Receive ............................. 30 11.7 DMA Write (Block Mode) Target Send ..................................... 31 11.8 DMA Read (Block Mode) Target Receive .................................. 32 11.9 Reset .................................................................. 33 11 .10 Arbitration .............................................................. 33 APPENDICES A 1. NCR 5380 vs. NCR 5385/86 .................................................... 34 A2. Flowchartsl Software ............................................................ 35 A3. 65C02 Interface Diagram ........................................................ 50 A4. NCR 5381 Differential Pair Option ................................................ 51 A5. SCSII Plus ..................................................................... 54 A6. Register Reference Chart ....................................................... 56 2 SECTION 1 GENERAL DESCRIPTION The NCR 5380 SCSI interface device is a 40 pin The NCR 5380 communicates with the system micro- NMOS device designed to accommodate the Small processor as a peripheral device. The chip is control- Computer Systems Interface (SCSI) as defined by the led by reading and writing several internal registers ANSI X3T9.2 committee. The NCR 5380 operates in which may be addressed as standard or memory both the initiator and target roles and can therefore be mapped 1/0. Minimal processor intervention is re- used in host adapter, host port and formatter designs. quired for DMA transfers because the 5380 controls This device supports arbitration, including reselection. the necessary handshake signals. The NCR 5380 in- Special high-current open collector output drivers, terrupts the MPU when it detects a bus condition that capable of sinking 48mA at 0.5V, allow for direct con- requires attention. Normal and block mode DMA is nection to the SCSI bus. Differential pair operation is provided to match many popular DMA controllers. supported using a 48 pin version of this part, desig- nated the NCR 5381 (refer to Appendix A4). SCSI INTERFACE MPUINTERFACE * Asynchronous, interface to 1.5 MBPS * Memory or 110 mapped interface * Supports initiator and target roles * DMA or programmed 1/0 * Parity generation wi optional checking * Normal or block mode DMA * Supports arbitration * Optional MPU interrupts * Direct control of all bus signals * High current outputs drive SCSI bus directly FUNCTIONAL PIN GROUPING PINOUT SCSI DATA BUS DO 01 i I 02 DMA [EOP READY OSO ... 7, DBP DB7 OB6 03 CONTROL ORO BSY DB5 04 OACK SEL OB4 05 RST OB3 06 CS OB2 07 lOR ATN SCSI OB1 A2 REGISTER lOW NCR ACK CONTROLS DBO NCR A1 ADDRESSING AD REO DBP 5380 VOO A1 5380 MSG GND SEL AD lOW A2 C/O BSY RESET 110 ACK EOP DATA BUS ATN DACR RESET RST READY IRO 110 lOR C/O IRa GNO VOD MSG ORO REO CS 3 SECTION 2 SCSI BACKGROUND SCSI (Small Computer Systems Interface) has Other documents which may be useful are: evolved from the SASI (Shugart Associates Systems Interface) disk controller interface standard developed • NCR 5385 SCSI Protocol Controller Data Sheet by Shugart Associates in the late 1970's. NCR and (MC-704) Shugart jointly approached the ANSC X3T9.3 sub- committee in December of 1981 and proposed that a • NCR 5385 SCSI Protocol Controller User's Guide committee be formed to develop an intelligent inter- (MC-903) face standard based on SASI. The ANSC X3T9.3 sub- committee divided into two groups so that SASI could • SCSI Engineering Notebook be pursued. In February of 1982, NCR and Shugart Associates presented SASI as a working document. It These documents may be obtained by contacting your was agreed that a separate group should develop the local NCR Microelectronics sales representative or by standard and the ANSC X3T9.2 subcommittee was writing/ calling: established. This group met in April of that year and formally changed the name to the Small Computer NCR Microelectronics Systems Interface (SCSI). Logic Products Marketing 1635 Aeroplaza Drive The proposed standard has since been forwarded Colorado Springs, CO 80916 from the subcommittee and is becoming a major in- PH# 1-800-525-2252 dustry standard. It is expected that other standards organizations such as ECMA (European Computer Manufactures Association) and ISO (International Standards Organization) will adopt the proposed stan- dard as well. NCR Microelectronics announced the NCR 5385, the first SCSI protocol controller, in April of 1983. This product family includes the NCR 5386 and the soon-to-be-announced NCR 5386S. The NCR 5380 and 5381 were designed to compliment this initial of- fering. Differences between the product families are described in Appendix A 1. This design manual is not an SCSI specification and assumes some prior knowledge of the SCSI proposed standard. Copies of the proposed standard may be obtained, with pre-payment of $20, from: X3 Secretariat, Computer and Business Equipment Manufacturers Association 311 First Street, NW, Suite 500 Washington, D.C. 20001 Please include a self-addressed mailing label. 4 EOP CS, lOR, OACK CPU lOW INTERFACE Ao, AI, A2 r- Reset parity v Address or interrupt decoding register EOP,ORQ logic Input data Current Data output enable SCSI data register register register register Bus phase Identification DMA Parity Arbitration comparison comparison Parity control checking logic generator I (Start OMA --I- send, start I OMA target receive, start OMA initiator --1_ ------------1 receive) High-current open-collector output drivers I --t-- I - -, 1/0, C/O, I SCSI BUS INTERFACE MSG,REQ I _J SECTION 4 PIN DESCRIPTION 4.1 Microprocessor Interface Signals Pin Name Pin # Description AO,A1,A2 30, 32, 33 INPUTS These signals are used with CS, lOR or lOW to address all internal registers. 21 INPUT Chip Select enables a read or write of the internal register selected by AO, A 1 and A2. CS is an active low signal. 26 INPUT DMA Acknowledge resets DRO and selects the data register for input or output data transfers. DACK is an active low signal. ORO 22 OUTPUT DMA Request indicates that the data register is ready to be read or written. DRO occurs only if DMA mode is true in the Command Register. It is cleared by OACK. 00 ... 07 1,40 ... 34 BI-DIRECTIONAL, TRI-STATE Microprocessor data bus active high 27 INPUT The End of Process signal is used to terminate a DMA transfer. If asserted during a DMA cycle, the current byte will be transferred but no additional bytes will be requested. 24 INPUT 110 Read is used to read an internal register selected by CS and AO, A 1 and A2. It also selects the Input Data Register when used with DACK. lOR is active low. 6 Pin Name Pin # Description lOW 29 INPUT 110 Write is used to write an internal register selected by CS and AD, A 1 and A2. It also selects the Output Data Register when used with DACK. lOW is active low. IRQ 23 OUTPUT Interrupt Request alerts a microprocessor of an error condition or an event completion. READY 25 OUTPUT Ready can be used to control the speed of block mode DMA transfers. This signal goes active to indi- cate the chip is ready to sendl receive data and re- mains false after a transfer until the last byte is sent or until the DMA Mode bit is reset. RESET 28 INPUT Reset clears all registers. It does not force the SCSI signal RST to the active state. RESET is an active low signal. Power Signals Pin Name Pin # Description VDD 31 +5 VOLTS GND 11 GROUND 7 4.2 SCSI Interface Signals The following signals are all bi-directional, active low, open collector signals. With 48 rnA sink capability, all pins interface directly with the SCSI bus. Pin Name Pin # Description 14 Driven by an initiator, ACK indicates an acknow- ledgment for a REal ACK data transfer handshake. In the target role, ACK is received as a response to the REO signal. 15 Driven by an initiator, ATN indicates an attention condition. This signal is received in the target role. 13 This signal indicates that the SCSI bus is being used and can be driven by both the initiator and the target device. CID 18 A signal driven by the target, CID indicates Control or Data information is on the data bus. This signal is received by the initiator. 17 110 is a signal driven by a target which controls the direction of data movement on the SCSI bus. True indicates input to the initiator. This signal is also used to distinguish between Selection and Reselection phases. 19 MSG is a signal driven by the target during the Mes- sage phase. This signal is received by the initiator. 20 Driven by a target, REO indicates a request for a REal ACK data transfer handshake. This signal is received by the initiator. 16 The RST signal indicates an SCSI bus RESET con- dition. DBO ... DB7 9 ... 2 DBP 10 These eight data bits (DBO-DB7) plus a parity bit (DBP) form the data bus. DB7 is the most significant bit and has the highest priority during the Arbitration phase. Data parity is odd. Parity is always generated and optionally checked. Parity is not valid during arbitration. 12 SEL is used by an initiator to select a target or by a target to reselect an initiator. 8 SECTION 5 ELECTRICAL CHARACTERISTICS OPERATING CONDITIONS PARAMETER SYMBOL MIN MAX UNITS Supply Voltage VOO 4.75 5.25 Volts Supply Current 100 145 rnA. Ambient Temperature TA 0 70 °C INPUT SIGNAL REQUIREMENTS PARAMETER CONDITIONS MIN MAX UNITS High-level, Input VIH 2.0 5.25 Volts Low-level, Input VIL -0.3 0.8 Volts SCSI BUS pins 2 .•. 20 High-level Input Current, IIH VIH = 5.25 V 50 LJa. Low-level Input Current, IlL VIL= 0 Volts -50 .l.Ja. All other pins High-level Input Current, IIH VIH= 5.25 V 10 ).la. Low-level Input Current, IlL VIL= 0 Volts -10 )la. OUTPUT SIGNAL REQUIREMENTS PARAMETER CONDITIONS MIN MAX UNITS SCSI BUS pins 2 ••. 20 Low-level Output VOL VOO = 4.75 V IOL= 48.0mA. 0.5 Volts All other pins High-level Output VOH VOO = 4.75 V IOH = -3.0mA. 2.4 Volts Low-level Output VOL VOO = 4.75 V IOL = 7.0 rnA. 0.5 Volts PRELIMINARY Notice: This is not a final specification. Some parametric limits are subject to change. 9 SECTION 6 INTERNAL REGISTERS 6.0 General 6.1.1 Current SCSI Data Register- Address 0 (Read-only) The NCR 5380 SCSI Interface Device appears as a set of eight registers to the controlling CPU. By reading The Current SCSI Data Register is a read-only register and writing the appropriate registers, the CPU may which allows the microprocessor to read the active initiate any SCSI bus activity or may sample and assert SCSI data bus. This is accomplished by activating CS any signal on the SCSI bus. This allows the user to with an address on A2-AO of 000 and issuing an lOR implement all or portions of the SCSI protocol in pulse. If parity checking is enabled, the SCSI bus parity software. These registers are read (written) by ac- is checked at the beginning of the read cycle. This tivating CS with an address on A2-AO and then issuing register is used during a programmed 110 data read or an lOR (lOW) pulse. This section describes the opera- during arbitration to check for higher priority arbitrating tion of the internal registers. devices. Parity is not guaranteed valid during arbitra- tion. Address A2 A1 AO RlW Register Name Current SCSI Data Register 000 R Current SCSI Data 000 W Output Data 7 6 5 4 3 2 o 001 R/W Initiator Command 010 R/W Mode o 1 1 100 R/W Target Command R Current SCSI Bus Status I I I I I I I I I 100 W Select Enable 1 0 1 R Bus and Status 1 0 1 W Start DMA Send 1 1 0 R Input Data 6.1.2 Output Data Register- 1 1 0 W Start DMA Target Receive Address 0 (write-only) 111 R Reset Parityl Interrupts 111 W Start DMA Initiator Receive The Output Data Register is a write-only register that is used to send data to the SCSI bus. This is Register Summary accomplished by either using a normal MPU write, or under DMA control, by using lOW and DACK. This 6.1 Data Registers register is also used to assert the proper ID bits or the SCSI bus during the arbitration and selection phases. The data registers are used to transfer SCSI com- mands, data, status, and message bytes between the Output Data Register microprocessor data bus and the SCSI bus. The NCR 5380 does not interpret any information that passes through the data registers. The data registers consist 7 6 5 4 3 2 1 o of the transparent Current SCSI Data Register, the Output Data Register, and the Input Data Register. I I I I I I I I DB7 DB6 DBS DB4 DB3 DB2 DB 1 DBO I 10 6.1.3 Input Data Register- 6.2 Initiator Command Register- Address 6 (Read-only) Address 1 (Read/Write) The Input Data Register is a read-only register that is The Initiator Command Register is a read/write regis- used to read latched data from the SCSI bus. Data is ter which is used to assert certain SCSI bus signals, to latched either during a DMA Target receive operation monitor those signals, and to monitor the progress of when ACK (pin 14) goes active or during a DMA In- bus arbitration. Many of these bits are significant only itiator receive when REO (pin 20) goes active. The when being used as an Initiator; however, most can be DMA Mode bit (port 2, bit 1) must be set before data used during Target role operation. can be latched in the Input Data Register. This register may be read under DMA control using lOR and DACK. Initiator Command Register Parity is optionally checked when the Input Data Re- (Register Read) gister is loaded. 7 6 5 4 3 2 o Input Data Register 7 6 5 4 3 2 o I III I I I II ASSERT RST AlP LA ASSERT ASSERT ASSERT ASSERT ASSERT ACK SSY SEL ATN DATA SUS I I I I I I I I I '-0-S7--1--- - -->--0-S-5--'--0-S4----L-=OS=3:--'--0=S=2:--'---=0=S=1-'-=o=so=-' 0 S6 In itiator Command Reg ister (Register Write) 7 6 543 2 1 0 I [I I I I III ASSERT TEST RST MODE OIFF ENSL ASSERT ASSERT ASSERT ASSERT ASSERT ACK SSY SEL ATN DATA SUS 11 The following describes the operation of all bits in the BIT 4-ASSERT ACK Initiator Command Register. This bit is used by the bus initiator to assert ACK (pin BIT 7-ASSERT RST 14) on the SCSI bus. In order to assert ACK the TARGETMODE bit (port 2, bit 6) must be false. Writing Whenever a one (1) is written to bit 7 of the Initiator a zero to this bit resets ACK on the SCSI bus. Reading Command Register, the RST signal (pin 16) is as- this register simply reflects the status of this bit. serted on the SCSI bus. The RST signal will remain asserted until this bit is reset or until an external BIT 3-ASSERT BSV RESET (pin 28) occurs. After this bit is set (1), IRQ (pin 23) goes active and all internal logic and control regis- Writing a one (1) into this bit position asserts BSY (pin ters are reset (except for the interrupt latch and the 13) onto the SCSI bus. Conversely, a zero (0) resets ASSERT RST bit). Writing a zero (0) to bit 7 of the the BSY signal. Asserting BSY indicates a successful Initiator Command Register de-asserts the RST sig- selection or reselection and resetting this bit creates a nal. Reading this register simply reflects the status of bus disconnect condition. Reading this register simply this bit. reflects the status of this bit. BIT 6-AIP (Arbitration in Progress-read bit) BIT 2-ASSERT SEL This bit is used to determine if arbitration is in progress. Writing a one (1) into this bit position asserts SEL (pin For this bit to be active, the ARBITRATE bit (port 2, bit 12) onto the SCSI bus. SEL is normally asserted after 0) must have been set previously. It indicates that a arbitration has been successfully completed. SEL may bus free condition has been detected and that the chip be de-asserted by resetting this bit to a zero. A read of has asserted BSY (pin 13) and the contents of the this register simply reflects the status of this bit. Output Data Register (port 0) onto the SCSI bus. AlP will remain active until the ARBITRATE bit is reset. BIT 1-ASSERT ATN ATN (pin 15) may be asserted on the SCSI bus by BIT 6-TEST MODE (write bit) setting this bit to a one (1) if the TARGETMODE bit This bit may be written during a test environment to (port 2, bit 6) is false. ATN is normally asserted by the disable all output drivers, effectively removing the initiator to request a Message Out bus phase. Note NCR 5380 from the circuit. Resetting this bit returns that since ASSERT SEL and ASSERT ATN are in the the part to normal operation. same register, a select with ATN may be implemented with one MPU write. ATN may be de-asserted by re- BIT 5-LA (Lost Arbitration-read bit) setting this bit to a zero (0). A read of this register simply reflects the status of this bit. This bit, when active, indicates that the NCR 5380 detected a bus free condition, arbitrated for use of the BIT O-ASSERT DATA BUS bus by asserting BSY (pin 13) and its ID on the data The ASSERT DATA BUS bit, when set, allows the bus and lost arbitration due to SEL (pin 12) being contents of the Output Data Register to be enabled as asserted by another bus device. For this bit to be active chip outputs on the signals DBO-DB7. Parity is also the ARBITRATE bit (port 2, bit 0) must be active. generated and asserted on DBP. In the NCR 5381 this bit asserts the DBEN signal (pin 36). Resetting this bit BIT 5-DIFF ENBL (Differential Enable-write bit) disables the output data bus or the DBEN signal. This bit is not used in the NCR 5380 and is only When connected as an Initiator, the outputs are only meaningful in the NCR 5381, a 48 pin device which enabled if the TARGETMODE bit (port 2, bit 6) is false, supports external differential pair transceivers. DIFF the received signal II 0 (pin 17) is false, and the phase ENBL should only be asserted if the device is physi- signals (C/D, 110, and MSG) match the contents of the cally connected as either an Initiator or as a Target. If ASSERT CI D, ASSERT 110, and ASSERT MSG in enabled, the signal TGS (pin 14-NCR 5381) is as- serted if the TARGETMODE bit (port 2, bit 6) is set (1) the Target Command Register. or the signallGS (pin 12-NCR 5381 ) is asserted if the This bit should also be set during DMA send TARGETMODE bit is reset (0). operations. 12 6.3 Mode Register-Address 2 BIT 4-ENABLE PARITY INTERRUPT (Read/Write) The ENABLE PARITY INTERRUPT bit, when set (1), The Mode Register is used to control the operation of will cause an interrupt (IRQ) to occur if a parity error is the chip. This register determines whether the NCR detected. A parity interrupt will only be generated if the 5380 operates as an initiator or a target, whether DMA ENABLE PARITY CHECKING bit (bit 5) is also transfers are being used, whether parity is checked, enabled (1). and whether interrupts are generated on various external conditions. This register may be read to check BIT 3-ENABLE EOP INTERRUPT the value of these internal control bits. The following describes the operation of these control bits. The ENABLE EOP INTERRUPT, when set (1), causes an interrupt to occur when an EOP (End of Process) Mode Register signal (pin 27) is received from the DMA controller logic. 7 6 5 4 3 2 0 BIT 2-MONITOR BUSY II1II1 I D BLOCK TARGET ENABLE ENABLE ENABLE MONITOR DMA MODE MODE PARITY PARITY EOP ARBI- BUSY MODE TRATE The MONITOR BUSY bit, when true (1), causes an interrupt to be generated for an unexpected loss of DMA CHECK- INTER- INTER- BSY (pin 13). When the interrupt is generated due to ING RUPT RUPT loss of BSY, the lower 6 bits of the Initiator Command Register are reset (0) and all Signals are removed from BIT 7-BLOCK MODE DMA the SCSI bus. The BLOCK MODE DMA bit controls the characteristics of the DMA DRQ-DACK handshake. When this bit is reset (0) and the DMA MODE bit is active (1), the DMA handshake uses the normal interlocked handshake and the rising edge of DACK (pin 26) indicates the end of each byte being transferred. In block mode operation, BLOCK MODE DMA bit set (1) and DMA MODE bit set (1), the end of lOR (pin 24) or lOW (pin 29) signifies the end of each byte transferred and DACK is allowed to remain active throughout the DMA operation. READY (pin 25) can then be used to request the next transfer. BIT 6-TARGETMODE The TARGETMODE bit allows the NCR 5380 to operate as either an SCSI bus initiator, bit reset (0), or as an SCSI.bus target device, bit set (1). In orderforthe signals ATN (pin 15) and ACK (pin 14) to be asserted on the SCSI bus, the TARGETMODE bit must be reset (0). In order for the signals C/O, 1/ 0, MSG and REQ to be asserted on the SCSI bus, the TARGETMODE bit must be set (1). BIT 5-ENABLE PARITY CHECKING The ENABLE PARITY CHECKING bit determines whether parity errors will be ignored or saved in the parity error latch. If this bit is reset (0), parity will be ignored. Conversely, if this bit is set (1) parity errors will be saved. 13 BIT 1-DMA MODE 6.4 Target Command Register- Address 3 (Read/Write) The DMA MODE bit is normally used to enable a DMA transfer and must be set (1) prior to writing ports 5 When connected as a target device, the Target Com- through 7. Ports 5 through 7 are used to start DMA mand Register allows the MPU to control the SCSI bus transfers. The TARGETMODE bit (port 2, bit 6) must information transfer phase andl or to assert REO (pin be consistent with writes to port 6 and 7 [i.e. set (1) for 20) simply by writing this register. The TARGETMODE a write to port 6 and reset (0) for a write to port 7] . The bit (port 2, bit 6) must be true (1) for bus assertion to control bit ASSERT DATA BUS (port 1, bit 0) must be occur. The SCSI bus phases are described in the true (1) for all DMA send operations. In the DMA mode, following table. REO (pin 20) and ACK (pin 14) are automatically con- trolled. SCSI Information Transfer Phases The DMA MODE bit is not reset upon the receipt of an EOP signal. Any DMA transfer may be stopped by writing a zero into this bit location, however care must ASSERT ASSERT ASSERT be taken not to cause CS and DACK to be active Bus Phase 1/0 C/D MSG simultaneously. Data Out 0 0 0 Unspecified 0 0 1 BIT O-ARBITRATE Command 0 0 The ARBITRATE bit is set (1) to start the arbitration Message Out 0 1 1 process. Prior to setting this bit the Output Data Data In 1 0 0 Register should contain the proper SCSI device ID Unspecified 0 1 value. Only one data bit should be active for SCSI bus Status 0 arbitration. The NCR 5380 will wait for a bus free Message In condition before entering the arbitration phase. The results of the arbitration phase may be determined by When connected as an Initiator with DMA Mode true, if reading the status bits LA and AlP (port 1, bits 5 & 6 the phase lines (1/0, C/D, and MSG) do not match the respectively) . phase bits in the Target Command Register, a phase mismatch interrupt is generated when REO (pin 20) goes active. In order to send data as an Initiator, the ASSERT 1/0, ASSERT CI D, and ASSERT MSG bits must match the corresponding bits in the Current SCSI Bus Status Register (port 4). The ASSERT REO bit (bit 3) has no meaning when operating as an Initiator. Target Command Register 7 6 5 432 0 LIIIIII D x x x X ASSERT ASSERT ASSERT ASSERT REO MSG C/O liD 14 6.5 Current SCSI Bus Status 6.7 Bus and Status Register-Address 5 Register-Address 4 (Read-only) (Read-only) The Current SCSI Bus Status register is a read-only The Bus and Status Register is a read-only register register which is used to monitor seven SCSI bus which can be used to monitor the remaining SCSI control signals plus the data bus parity bit. For exam- control signals not found in the Current SCSI Bus ple, an Initiator device can use this register to deter- Status Register (ATN & ACK) as well as six other mine the current bus phase and to poll REQ for pend- status bits. The following describes each bit of the Bus ing data transfers. This register may also be used to and Status Register individually. determine why a particular interrupt occurred. The fol- lowing describes the Current SCSI Bus Status Regis- Bus and Status Register ter. Current SCSI Bus Status Register 7 6 5 4 3 2 0 .----,--7~6 4 5 -r-- ~3 --r--2 1--,---.,0 \ \ \ \ \ I I \] lI I I I I I I I DBP END OF DMA DMA PARITY INTER- PHASE BUSY RE- QUEST ERROR RUPT MATCH ERROR RE- QUEST ACTIVE ATN ACK BIT 7-END OF DMA TRANSFER 6.6 Select Enable Register-Address 4 (Write-only) The END OF DMA TRANSFER bit is set if EOP (pin 27), DACK (pin 26), and either lOR (pin 24), or lOW The Select Enable Register is a write-only register (pin 29) are simultaneously active for at least 100 nsec. which is used as a mask to monitor a single ID during a Since the EOP signal can occur during the last byte selection attempt. The simultaneous occurrence of the sent to the Output Data Register (port 0), the REQ and correct ID bit, BSY false, and SEL true will cause an ACK signals should be monitored to insure that the last interrupt. This interrupt can be disabled by resetting all byte has been transferred. This bit is reset when the bits in this register. If the ENABLE PARITY CHECK- DMA MODE bit is reset (0) in the Mode Register (port ING bit (port 2, bit 5) is active (1), parity will be checked 2). during selection. Select Enable Register BIT 6-DMA REQUEST The DMA REQUEST bit allows the MPU to sample the 7 6 5 4 3 2 0 output pin DRQ (pin 22). DRQ can be cleared by asserting DACK (pin 26) or by resetting the DMA [ 1 1 1 I 1 I IJ MODE bit (bit 1) in the Mode Register (port 2). The DRQ signal does not reset when a phase mismatch interrupt occurs. 15 BIT 5-PARITY ERROR BIT 1-ATN This bit is set if a parity error occurs during a data This bit reflects the condition of the SCSI bus control receive or a device selection. The PARITY ERROR bit signal ATN (pin 15). This signal is normally monitored can only be set (1) if the ENABLE PARITY CHECK bit by the target device. (port 2, bit 5) is active (1). This bit may be cleared by reading the Reset Parityl Interrupt Register (port 7). BIT O-ACK BIT 4-INTERRUPT REQUEST ACTIVE This bit reflects the condition of the SCSI bus control signal ACK (pin 14). This signal is normally monitored This bit is set if an enabled interrupt condition occurs. It by the target device. reflects the current state of the IRQ (pin 23) output and can be cleared by reading the Reset Parityl Interrupt Register (port 7). 6.8 DMA Registers Three write-only registers are used to initiate all DMA BIT 3-PHASE MATCH activity. They are Start DMA Send (port 5), Start DMA Target Receive (port 6) and Start DMA Initiator Re- The SCSI signals MSG, CI D, and 110 (pins 19, 18, and ceive (port 7). Simply writing these registers starts the 17) represent the current information transfer phase. DMA transfers. Data presented to the NCR 5380 on The PHASE MATCH bit indicates whether the current signals DO-D7 during the register write is meaningless SCSI bus phase matches the lower 3 bits of the Target and has no effect on the operation. Prior to writing Command Register. PHASE MATCH is continuously these registers the BLOCK MODE DMA bit (bit 7), the updated and is only significant when operating as a DMA MODE bit (bit 1) and the TARGETMODE bit (bit bus initiator. A Phase Match is required for data trans- 6) in the Mode Register (port 2) must be appropriately fers to occur on the SCSI bus. set. The individual registers are briefly described below. BIT 2-BUSY ERROR 6.8.1 Start DMA Send-Address 5 The BUSY ERROR bit is active if an unexpected loss (Write-only) of the BSY signal (pin 13) has occurred. This latch is set whenever the MONITOR BUSY bit (port 2, bit 2) is This register is written to initiate a DMA send, from the true and BSY is false. An unexpected loss of BSY will DMA to the SCSI bus, for either initiator or target role disable any SCSI outputs and will reset the DMA operations. The DMA MODE bit (port 2, bit 1) must be MODE bit (port 2, bit 1). set prior to writing this register. 16 6.8.2 Start DMA Target Receive-Address 6 (Write-only) This register is written to initiate a DMA receive, from the SCSI bustothe DMA, for target operation only. The DMA MODE bit (bit 1) and the TARGETMODE bit (bit 6) in the Mode Register (port 2) must both be set (1) prior to writing this register. 6.8.3 Start DMA Initiator Receive-Address 7 (Write-only) This register is written to initiate a DMA receive, from the SCSI bus to the DMA, for initiator operation only. The DMA MODE bit (bit 1) must be true (1) and the TARGETMODE bit (bit 6) must be false (0) in the Mode Register (port 2) prior to writing this register. 6.9 Reset Parity/Interrupt-Address 7 (Read-only) Reading this register resets the PARITY ERROR bit (bit 5), the INTERRUPT REQUEST bit (bit 4) and the BUSY ERROR bit (bit 2) in the Bus and Status Register (port 5). 17 SECTION 7 ON-CHIP SCSI HARDWARE SUPPORT The NCR 5380 is easy to use because of its simple and arbitration may begin. Arbitration will begin if the architecture. The chip allows direct control and bus is free, SEL is inactive and the ARBITRATION bit monitoring of the SCSI bus by providing a latch for (port 2, bit 0) is active. Once arbitration has begun each signal. However, portions of the protocol define (BSY asserted), an arbitration delay of 2.2 /Lsec must timings which are much too quick for traditional mic- elapse before the data bus can be examined to deter- roprocessors to control. Therefore, hardware support mine if arbitration has been won. This delay must be has been provided for DMA transfers, bus arbitration, implemented in the controlling software driver. phase change monitoring, bus disconnection, bus reset, parity generation, parity checking, and device The NCR 5380 is a clockless device. Delays such as selection/ reselection. bus free delay, bus set delay and bus settle delay are implemented using gate delays. These delays may Arbitration is accomplished using a bus-free filter to differ between devices because of inherent process continuously monitor BSY. If BSY remains inactive for variations, but are well within the proposed ANSI at least 400 nsec then the SCSI bus is considered free X3T9.2 specification (Revision 14B). 18 SECTION 8 INTERRUPTS The NCR 5380 provides an interrupt output (IRQ) to If parity is supported, parity should also be good during indicate a task completion or an abnormal bus occurr- the selection phase. Therefore, if the ENABLE PAR- ence. The use of interrupts is optional and may be ITY BIT (port 2, bit 5) is active, then the PARITY disabled by resetting the appropriate bits in the Mode ERROR bit should be checked to insure that a proper Register (port 2) or the Select Enable Register (port 4). selection has occurred. The ENABLE PARITY INTERRUPT bit need not be set for this interrupt to be When an interrupt occurs, the Bus and Status Register generated. and the Current SCSI Bus Status Register must be read to determine which condition created the inter- The proposed SCSI specification also requires that no rupt. IRQ (pin 23) can be reset simply by reading the more than two device IDs be active during the selec- Reset Parityl Interrupt Register (port 7) tion process. To insure.this, the Current SCSI Data or by an external chip reset (RESET active for 200 Register (port 0) should be read. nsec). The proper values for the Bus and Status Register Assuming the NCR 5380 has been properly initialized, (port 5) and the Current SCSI Bus Status Register an interrupt will be generated if the chip is selected or (port 4) are displayed below. reselected, if an EOP signal occurs during a DMA transfer, if an SCSI bus reset occurs, if a parity error Bus and Status Register occurs during a data transfer, if a bus phase mismatch occurs, or if an SCSI bus disconnection occurs. 7 6 5 4 3 2 o 8.1 Selection/ Reselection The NCR 5380 can generate a select interrupt if SEL END DMA PARTlY INTER- PHASE BUSY ATN ACK (pin 12) is true (1), its device ID is true (1) and BSY (pin OF RE- ERROR RUPT MATCH ERROR 13) is false for at least a bus settle delay (400 ns). If 1/0 DMA QEST RE- QUEST (pin 17) is active this should be considered a reselect ACTIVE interrupt. The correct ID bit is determined by a match in the Select Enable Register (port 4). Only a single bit Current SCSI Bus Status Register match is required to generate an interrupt. This inter- rupt may be disabled by writing zeros into all bits of the Select Enable Register. 7 6 5 4 3 2 0 19 8.2 End of Process (EOP) Interrupt An End of Process signal (EOP, pin 27) which occurs The END OF DMA bit is used to determine when a during a DMA transfer (DMAMODE true) will set the block transfer is complete. Receive operations are END OF DMA status bit (port 5, bit 7) and will optionally complete when there is no data left in the chip and no generate an interrupt if ENABLE EOP INTERRUPT bit additional handshakes occurring. The only exception (port 2, bit 3) is true. The EOP pulse will not be recog- to this is receiving data as an initiator and the target nized (END OF DMA bit set) unless EOP, DACK and opts to send additional data for the same phase. In this either lOR or lOW are concurrently active for at least case, REO goes active and the new data is present in 100 nsec. DMA transfers can still occur if EOP/ was the Input Data Register. Since a phase mismatch inter- not asserted at the correct time. This interrupt can be rupt will not occur, REO and ACK need to be sampled disabled by resetting the ENABLE EOP INTERRUPT to determine that the Target is attempting to send more bit. data. The proper values for the Bus and Status Register For send operations, the END OF DMA bit is set when (port 5) and the Current SCSI Bus Status Register the DMA finishes its transfer, but the SCSI transfer (port 4) for this interrupt are displayed below. may still be in progress. If connected as a Target, REO and ACK should be sampled until both are false. If Bus and Status Register connected as an Initiator, a phase change interrupt can be used to signal the completion of the previous phase. It is possible for the Target to request additional 7 6 5 4 3 2 o data for the same phase. In this case, a phase change will not occur and both REO and ACK must be sampled to determine when the last byte was transferred. END DMA PARITY INTER- PHASE BUSY ATN ACK OF RE- ERROR RUPT MATCH ERROR DMA QUEST RE- QUEST ACTIVE Current SCSI Bus Status Register 20 8.3 SCSI Bus Reset 8.4 Parity Error The NCR 5380 generates an interrupt when the RST An interrupt is generated for a received parity error if signal (pin 16) transitions to true. The device releases the ENABLE PARITY CHECK (bit 5) and the ENABLE all bus signals within a bus clear delay (800 nsec) of PARITY INTERRUPT (bit 4) bits are set (1) in the this transition. This interrupt also occurs after setting Mode Register (port 2). Parity is checked during a read the ASSERT RST bit (port 1, bit 7). This interrupt of the Current SCSI Data Register (port 0) and during a cannot be disabled. (Note: The RST signal is not DMA receive operation. A parity error can be detected latched in bit 7 of the Current SCSI Bus Status Register without generating an interrupt by disabling the ENA- and may not be active when this port is read. For this BLE PARITY INTERRUPT bit and checking the PAR- case, the Bus Reset interrupt may be determined by ITY ERROR flag (port 5, bit 5). default.) The proper values for the Bus and Status Register The proper values for the Bus and Status Register (port 5) and the Current SCSI Bus Status Register (port 5) and the Current SCSI Bus Status Register (port 4) are displayed below. (port 4) are displayed below. Bus and Status Register Bus and Status Register 7 6 5 4 3 2 1 a 7 6 5 4 3 2 a END DMA PARITY INTER- PHASE BUSY ATN ACK END DMA PARITY INTER- PHASE BUSY ATN ACK OF RE- ERROR RUPT MATCH ERROR OF RE- ERROR RUPT MATCH ERROR DMA QUEST RE- DMA QUEST RE- QUEST QUEST ACTIVE ACTIVE Current SCSI Bus Status Register Current SCSI Bus Status Register 7 6 5 4 3 2 a 7 6 5 4 3 2 a RST BSY REQ MSG CID 1/0 SEL DBP 21 8.5 Bus Phase Mismatch 8.6 Loss of BSY The SCSI phase lines are comprised of the signals If the MONITOR BUSY bit (bit 2) in the Mode Register 1/0, CID and MSG. These signals are compared with (port 2) is active, an interrupt will be generated if the the corresponding bits in the Target Command Re- BSY signal (pin 13) goes false for at least a bus settle gister: ASSERT 110 (bit 0), ASSERT CI D (bit 1) and delay (400 nsec). This interrupt may be disabled by ASSERT MSG (bit 2). The comparison occurs con- resetting the MONITOR BUSY bit. Register values are tinuallyand is reflected in the PHASE MATCH bit (bit 3) as follows. of the Bus and Status Register (port 5). If the DMA MODE bit (port 2, bit 1) is active and a phase mismatch Bus and Status Register occurs when REO (pin 20) transitions from false to true, an interrupt (IRO) is generated. A phase mismatch prevents the recognition of REO and removes the chip from the bus during an initiator send operation. (DBO-DB7, DBP will not be driven END DMA PARITY INTER- PHASE BUSY ATN ACK even though the ASSERT DATA BUS bit (port 1, bit 0) OF RE- ERROR RUPT MATCH ERROR is active.) This interrupt is only significant when con- DMA QUEST RE- QUEST nected as an Initiator and may be disabled by resetting ACTIVE the DMA MODE bit. (Note: It is possible for this inter- rupt to occur when connected as a Target if another Current SCSI Bus Status Register device is driving the phase lines to a different state.) 7 6 5 4 3 2 0 The proper values for the Bus and Status Register (port 5) and the Current SCSI Bus Status Register (port 4) are displayed below. ~\ 0 I0 IX IX \ X \ 0 I0 \ Bus and Status Register 7 6 5 4 3 2 0 \o\olo\lo\o\xliJ END DMA PARITY INTER- PHASE BUSY ATN ACK OF RE- ERROR RUPT MATCH ERROR DMA QUEST RE- QUEST ACTIVE Current SCSI Bus Status Register 7 6 5 4 3 2 o 22 SECTION 9 RESET CONDITIONS Three possible reset situations exist with the NCR the Initiator Command Register (port 1). (Note: The 5380, as follows: RST signal may be sampled by reading the Current SCSI Bus Status Register (port 4); however, this signal 9.1 Hardware Chip Reset is not latched and may not be present when this port is read.) When the signal RESET/ (pin 28) is active for at least 200 nsec, the NCR 5380 device is re-initialized and all 9.3 SCSI Bus Reset (RST) Issued internal logic and control registers are cleared. This is a chip reset only and does not create an SCSI bus If the CPU sets the ASSERT RST bit (bit 7) in the reset condition. Initiator Command Register (port 1), the RST signal (pin 16) goes active on the SCSI bus and an internal 9.2 SCSI Bus Reset (RST) Received reset is performed. Again, all internal logic and regis- ters are cleared except for the IRQ interrupt latch and When an SCSI RST signal (pin 16) is received, an IRQ the ASSERT RST bit (bit 7) in the Initiator Command interrupt is generated and a chip reset is performed. All Register (port 1). The RST signal will continue to be internal logic and registers are cleared, except for the active until the ASSERT RST bit is reset or until a IRQ interrupt latch and the ASSERT RST bit (bit 7) in hardware reset occurs. 23 SECTION 10 DATA TRANSFERS Data may be transferred between SCSI bus devices in 10.2 Normal DMA Mode one of four modes: Programmed I/O; Normal DMA; Block Mode DMA; or Pseudo DMA. The following sec- DMA transfers are normally used for large block tions describe these modes in detail. (Note: For all data transfers. The SCSI chip outputs a DMA request (ORO transfers operations DACK and CS should never be - pin 22) whenever it is ready for a byte transfer. Exter- active simultaneously.) nal DMA logic uses this ORO signal to generate DACK and an lOR or an lOW pulse to the NCR 5380. ORO 10.1 Programmed 1/0 Transfers goes inactive when DACK is asserted and DACK goes inactive sometime after the minimum read or write Programmed I/O is the most primitive form of data pulse width. This process is repeated for every byte. transfer. The REO (pin 20) and ACK (pin 14) hand- For this mode, DACK should not be allowed to cycle shake signals are individually monitored and asserted unless a transfer is taking place. by reading and writing the appropriate register bits. This type of transfer is normally used when transferring Refer to Section 10.5 for information on halting a DMA small blocks of data such as command blocks or mes- transfer. sage and status bytes. 10.3 Block Mode DMA An Initiator send operation would begin by setting the C/O, I/O, and MSG bits in the Target Command Re- Some popular DMA controllers such as the Intel 8237 gister to the correct state so that a phase match exists. provide a block mode DMA transfer. This type of In addition to the phase match condition, it is neces- transfer allows the DMA controller to transfer blocks of sary for the ASSERT DATA BUS bit (port 1, bit 0) to be data without relinquishing the use of the data bus to the true and the received I/O signal to be false for the 5380 MPU after each byte is transferred. Thus, faster to send data. transfer rates are achieved by eliminating the repeti- tive access and release of the MPU bus. For each transfer, the data is loaded into the Output Data Register (port 0). The MPU then waits for the If the BLOCK MODE DMA bit (port 2, bit 7) is active, the REO bit (port 4, bit 5) to become active. Once REO NCR 5380 will begin the transfer by asserting ORO. goes active the PHASE MATCH bit (port 5, bit 3) is The DMA controller then asserts DACK for the re- checked and the ASSERT ACK bit (port 1, bit 4) is set. mainder of the block transfer. ORO goes inactive after The REO bit is sampled until it becomes false and the detecting DACK and also remains inactive for the du- MPU resets the ASSERT ACK bit to complete the ration of the transfer. The READY output (pin 25) is transfer. used to control the transfer rate. Non-block mode DMA transfers end when DACK goes false, whereas block mode transfers end when lOR or lOW becomes inactive. Since this is the case, DMA transfers may be started sooner in a block mode transfer. 24 To obtain optimum performance in block mode opera- 10.5.1 Using the EOP Signal tion, the DMA logic may optionally use the normal DMA mode interlocking handshake. READY is still available If EOP is used, it should be asserted for at least 100 to throttle the DMA transfer, but DRO is 30 to 40 nsec nsec while DACK and lOR or lOW are simultaneously faster than READY and may be used to start the cycle active. Note, however, that if lOR or lOW is not active sooner. an interrupt will be generated, but the DMA activity will continue. The EOP signal does not reset the DMA The methods described in Section 10.5 "Halting A MODE bit. Since the EOP signal can occur during the DMA Operation" apply for all DMA operations. last byte sent to the Output Data Register (port 0), the REO and ACK signals should be monitored to insure that the last byte has transferred. 10.4 Pseudo DMA Mode To avoid the tedium of monitoring and asserting the 10.5.2 Bus Phase Mismatch Interrupt request! acknowledge handshake signals for pro- grammed 110 transfers, the system may be designed A bus phase mismatch interrupt may be used to halt to implement a pseudo DMA mode. This mode is im- the transfer if operating as an Initiator. Using this plemented by programming the NCR 5380 to operate method frees the host from maintaining a data length in the DMA mode, but using the MPU to emulate the counter and frees the DMA logic from providing the DMA handshake. DRO (pin 22) may be detected by EOP signal. If performing an initiator send operation, polling the DMA REO bit (bit 6) in the Bus and Status the NCR 5380 requires DACK to cycle before ACK Register (port 5), by sampling the signal through an goes inactive. Since phase changes cannot occur if external port or by using it to generate an MPU inter- ACK is active, either DACK must be cycled after the rupt. Once DRO is detected, the MPU can perform a last byte is sent or the DMA MODE bit must be reset in DMA port read or write data transfer. This MPU readl order to receive the phase mismatch interrupt. write is externally decoded to generate the appropriate DACK and lOR or lOW signals. 10.5.3 Resetting the DMA MODE Bit Often, external decoding logic is necessary to gener- ate the NCR 5380 CS signal. This same logic may be A DMA operation may be halted at any time simply by used to generate DACK at no extra system cost and resetting the DMA MODE bit. It is recommended that provide an increased performance in programmed 10 the DMA MODE bit be reset after receiving an EOP or transfers. bus phase mismatch interrupt. The DMA MODE bit must then be set before writing any of the start DMA registers for subsequent bus phases. 10.5 Halting A DMA Operation If resetting the DMA MODE bit is used instead of EOP The EOP signal is not the only way to halt a DMA for Target role operation, then care must be taken to transfer. A bus phase mismatch or a reset of the DMA reset this bit at the proper time. If receiving data as a MODE bit (port 2, bit 1) can also terminate a DMA cycle target device, the DMA MODE bit must be reset once for the current bus phase. the last DRO is received and before DACK is asserted to prevent an additional REO from occurring. Reset- ting this bit causes DRO to go inactive. However, the last byte received remains in the Input Data Register and may be obtained either by performing a normal MPU read or by cycling DACK and lOR. In most cases EOP is easier to use when operating as a Target device. 25 SECTION 11 EXTERNAL TIMING DIAGRAMS 11.1 CPU WRITE AO .. 2 77777Z1-4---T-1--~~~-------r~~--T2--~777777777777711 ~ T3 \ ,..- T5 -14 T6 ~ DO .. 7 IOOZZOZOZZWIX________--'X77111/oZZ0Z1 NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 Address setup to write enable * 20 ns. T2 Address hold from end write enable * 20 ns. T3 Write enable width * 70 ns. T4 Chip select hold from end of lOW 0 ns. T5 Data setup to end of write enable * 50 ns. T6 Data hold time from end of lOW 30 ns. * Write enable is the occurrence of lOW and CS 11.2 CPU READ AO .. 2 777OZX_____-r--_ _ _ _- - - . _ _ _ xllllllllllll ~ T1 =+I ~T2~ f ~T3~ \'----t~r----T-4-+1---r----Ji-- T5 ~ DO .. 7 7777777777777777777777777277lX_ _ _ _ _.....XZ7777777777777 NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 Address setup to read enable * 20 ns. T2 Address hold from end read enable * 20 ns. T3 Chip select hold from end of lOR 0 ns. T4 Data access time from read enable * 130 ns. T5 Data hold time from end of lOR 20 ns. * Read enable is the occurrence of lOR and CS 26 11.3 DMA WRITE (NON-BLOCK MODE) TARGET SEND _____I \ 1 DRO ~T1~~------~---- ~T2~ DACK \ I !;i=T3 .. I~ T4 ~ i4= T5 ~ \ T6----1 DO .. 7 OlllllllllllllllllllX'-_ _ _~----'XIII II IIIIII 1111 ~T7=+1 --~----T-8-~----~\ 1~--------~----T-9-~----- REO ----------~I ~T11~~ ACK ~J-1 .... 1 T1 0 ',-.--------------------------__----'1 i4-T12~ ~~I J.-I~t---- T13 - - - -.... DBO .. 7 DBP -------------~-------------- NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 DRO false from DACK true 130 ns. T2 DACK false to DRO true 30 ns. T3 Write enable width * 100 ns. T4 DACK hold from end of lOW 0 ns. T5 Data setup to end of write enable * 50 ns. T6 Data hold time from end of lOW 40 ns. T7 Width of EOP pulse (note 1) 100 ns. - -- T8 ACK true to REO false 25 110 125 ns. T9 REO from end of DACK (ACK false) 30 140 150 ns. T10 ACK true to DRO true (target) 15 100 110 ns. T11 REO from end of ACK (DACK false) 20 140 150 ns. T12 DATA hold from write enable 15 ns. T13 Data setup to REO true (target) 60 ns. * Write enable is the occurrence of lOW and DACK Note 1: EOP, lOW, and DACK must be concurrently true for at least T7 for proper recogni- tion of the EOP pulse. 27 11.4 DMA WRITE (NON-BLOCK MODE) INITIATOR SEND DRO / \ I ----------~ ~T1~~------~~--~T2~~~ DACK \ I ~T3 ~.. T4~ \ l'4=T5 ..1: T6 ~ DO .. 7 IZlIllllIllllllllllt< >QIIIIIII17777177 EOP --------------~\ ~T7~,----------------------- f.: --.o! 1: T8 .IT9 I.. I ------~\~ ______________ ~------~--~-T-1-0~~/~------- -f4- T12..., 14= T11+i= DBO .. 7 ____________________--J>e1111711t<~_______________ DBP NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 DRO false from DACK true 130 ns. T2 DACK false to DRO true 30 ns. T3 Write enable width * 100 ns. T4 DACK hold from end of lOW 0 ns. T5 Data setup to end of write enable * 50 ns. T6 Data hold time from end of lOW 40 ns. T7 Width of EOP pulse (note 1) 100 ns. T8 REO true to ACK true 20 150 160 ns. T9 REO false to DRO true 20 100 110 ns. T10 DACK false to ACK false 25 140 150 ns. T11 lOW false to valid SCSI data 100 ns. T12 DATA hold from write enable 15 ns. * Write enable is the occurrence of lOW and DACK Note 1: EOP, lOW, and DACK must be concurrently true for at least T7 for proper recognition of the EOP pulse. 28 11.5 DMA READ (NON-BLOCK MODE) TARGET RECEIVE DRO / \ I ~T1~ ~ T2 ::::;t DACK \' - -_ _ _,-~_-..J~I T3 lOR \ I I~------------------- ~~----~~~T5~ t4=T4~ __ --IJ..,.____)q~_7~_7.....7~7:Z_Z~Z~ZT"'l/_~Z_~Z_7~Z~7 ::~.. 77...,.7...,..I-r-l.,....IF"'lI~I-rll...,.I.,...I.,....Ir-:l,...,Z-rZ7.,.7"7"'7.,....17""l1,...,I.....,e...,-r.,...77""l;r-7~...,..Ib< \ I t-- T8 ~ / ..)~--- ~T9:j;l t----- T10 \~----------------------~I T111~ .. I- T12-.l 8~~·· 7 < >qllllllllllllllllllllllllllllll/llllZlllllZ NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 DRO false from DACK true 130 ns. T2 DACK false to DRO true 30 ns. T3 DACK hold time from end of lOR 0 ns. T4 Data access time from read enable * 115 ns. T5 Data hold time from end of lOR 20 ns. T6 Width of EOP pulse (note 1) 100 ns. T7 ACK true to DRO true 15 100 110 ns. T8 DACK false to REO true (ACK false) 30 150 ns. T9 ACK true to REO false 25 110 125 ns. T10 ACK false to REO true (DACK false) 20 140 150 ns. T11 DATA setup time to ACK 20 ns. T12 DATA hold time from ACK 50 ns. * Read enable is the occurrence of lOR and DACK Note 1: EOP, lOR, and DACK must be concurrently true for at least T6 for proper recognition of the EOP pulse. 29 11.6 DMA READ (NON-BLOCK MODE) INITIATOR RECEIVE __________________1 \ r ORO ~T1~~----~~~~T2-~ DACK \ I ~ ;iT3 /~-------------- ~~~-T-4-~~--~T5~ 00 .. 7 ZZZZZZZZZZZZZZZZZZZZZZZZZZZ~;ShK---J-~------J>eZZZZZZ17 \ / k-T8~ T9);~-;f-r------------{"~I---- T10 ~ \~ ____________________________________r-- T11~ ... ,. T12-.f DBO .. 7 <'-_____-.JXlZZZZZ////////OZZ/ZZZZZZZZZZZZZ77ZZZ0ZZ1 DBP NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 ORO false from DACK true 130 ns. T2 DACK false to ORO true 30 ns. T3 DACK hold time from end of lOR 0 ns. T4 Data access time from read enable * 115 ns. T5 Data hold time from end of lOR 20 ns. T6 Width of EOP pulse (note 1) 100 ns. T7 REO true to ORO true 20 140 150 ns. T8 DAC K false to AC K false (REO false) 25 140 160 ns. T9 REO true to ACK true 20 150 160 ns. T10 REO false to AC K false (DAC K false) 15 120 140 ns. T11 DATA setup time to REO 20 ns. T12 DATA hold time from REO 50 ns. *Read enable is the occurrence of lOR and DAC K Note 1: EOP, lOR, and DAC K must be concurrently true for at least T6 for proper recognition of the EOP pulse. 30 11.7 DMA WRITE (BLOCK MODE) TARGET SEND ORO _ _ _- J 1 \ ~T1~~------------------- DACK ---------------~~~~--------------------~ ~ T2 ---I.~I.I------ T3 - - -...~~ \ 1 \ - - - - - - '----r-~-T-4--~-1-4 T5--.t 00 .. 7 ZZL7ZZZLZZZOZZZZZt:'--'--T-6-~~---~XlZZZZZZZZZZZZZO EOP I--- T7 ~ \ ~'--- T8 /.... _ _ _ _ _--'1 REO T9 ------I ... ~ ACK \ J 14= T10 .. I. T11 .1. T12 --I READY J \ I~ T13~ 14 T14 ~I DBO .. 7 ______________X'ZOZOzwx'--__________ DBP NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 ORO false from DACK true 130 ns. T2 Write enable width * 100 ns. T3 Write recovery time 120 ns. T4 Data setup to end of write enable * 50 ns. T5 Data hold time from end of lOW 40 ns. T6 Width of EOP pulse (note 1) 100 ns. T7 ACK true to REO false 25 110 125 ns. T8 REO from end of lOW (ACK false) 40 180 ns. T9 REO from end of ACK (lOW false) 20 160 170 ns. T10 ACK true to READY true 20 130 140 ns. - T11 READY true to lOW false 70 ns. T12 lOW false to READY false 20 130 140 ns. T13 OATA hold from ACK true 40 ns. T14 Data setup to REO true 60 ns. * Write enable is the occurrence of lOW and DACK Note 1: EOP , lOW, and DACK must be concurrently true for at least T6 for proper recognition of the EOP pulse. 31 11.8 DMA READ (BLOCK MODE) TARGET RECEIVE ~T1=4 ORO I DACK \ 14 T2 ~I \ J400 T3 -..:I / ~ T4-.1 '- 00 .. 7 I Z 7 Z 7 7 7 7 7 7 7 7 Z 7 JX'-________Xl! 7 7 7 7 7 7 7 ----------------~\ r-- T5 ---.,1-------------------- ~ ...II----- . .I T6 ----I~ I 14-- T8 ----I~~I'--- , - -...... "'T7~ ------~----------~--~I i4=T9 _14 T10 ~ ~ T11....1 READY I \'----- T12t4-14 T13~ DBO .. 7 <'-____~)q 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 Z 7 7 7 DBP NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 ORO false from DACK true 130 ns. T2 lOR recovery time 120 ns. T3 Data access time from read enable * 100 110 ns. T4 Data hold time from end of lOR 20 ns. T5 Width of EOP pulse (note 1) 100 ns. T6 lOR false to REO true (ACK false) 30 180 190 ns. T7 ACK true to REO false 25 110 125 ns. T8 ACK false to REO true (lOR false) 20 160 170 ns. T9 ACK true to READY true 20 130 140 ns. T10 READY true to valid data 50 ns. T11 lOR false to READY false 20 125 140 ns. T12 DATA setup time to ACK 20 ns. T13 DATA hold time from ACK 50 ns. * Read enable is the occurrence of lOR and DACK Note 1: EOP, lOR, and DACK must be concurrently true for at least T5 for proper recognition of the EOP pulse. 32 11.9 RESET 1-. T1 ~ RESET \~ _ _ _ _ _....JI NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 Minimum width of reset 200 ns. 11.10 ARBITRATION _ _---.1/ \ 1~4--T-1-~~--------- BSY 1-- ...J-----------1 T2 DBO .. 7 z:J 777 7 77 71 17 7 7 7 7 77 ARB --------------, \ t4- T3 ~'------- --------------------------_/ NAME DESCRIPTION MIN. TYP. MAX. UNITS T1 Bus clear from SEL true 600 ns. T2 ARBITRATE start from BSY false 1200 2200 ns. T3 Bus clear from BSY false 1100 ns. 33 APPENDICES A1. NCR 5380 vs. NCR 5385/86 The NCR 5380 was designed to provide a low-cost Functional Areas 5380 5385/86 SCSI interface using a minimum number of parts. Arbitration Optional, Automatically Much of the intelligence and some of the features Firmware Invoked Dependant included in the NCR 5385/86 have been removed. In some instances, such as arbitration, this causes the Maximum Transfer Rate 1.5 MBPS 2.5 MBPS controlling CPU to provide more of the protocol control. Transfer Counter None 24 bits The NCR 5385/86 remains appropriate for many ap- plications and will continue to be strongly supported. Data Buffering Single Double Clock Circuitry None Req'd 5-10 MHz The main differences between the NCR 5380 and the NCR 5385/86 are shown in the following table. D.C. Transceivers On-chip External Differential Pair External External (NCR 5381) Synchronous Mode No Firm NCR 5386s Plans 34 A2. FLOWCHARTS/SOFTWARE Flowcharts and sample software drivers are provided as a guideline to facilitate your firmware development. Firmware will vary depending on the application and the level of the SCSI protocol being supported. 35 ARBITRATION AND (RE) SELECTION ~ _ _ _ _ _ _- L_ _ _ _ _ _- - , * WRITE 10 BIT TO DATA OUTPUT SET TARGET MODE REGISTER (PORT 2, BIT 6) (PORTO) SET ARB IT SET 1/0 * (PORT 2, BIT 0) (PORT 3, Bit 0) WRITE CONTROLLER'S AND INITIATOR'S 10 BITS TO DATA OUTPUT REGISTER (PORT 0) SET DIFF. EN, ASRT. NOTE: WAIT 2.2 ILsec. BSY, AND ASRT. DATA DIFF. EN ONLY ARBITRATION DELAY BUS USED IN NCR 5381 (PORT 1, BITS 5, 3, 0) ON RESET ARBIT (PORT 2, BIT 0) READ PORT 0 TO SEE CLEAR THE SELECT IF A HIGHER ENABLE REGISTER PRIORITY 10 IS (PORT 4) PRESENT YES RESET BSY (PORT 1, BIT 3) ON SET SEL SET BSY (PORT 1, BIT 2) (PORT 1, BIT 3) CLEAR SEL AND ASRT. WAIT 1.2lLsec Min DATA BUS FLAGS (BUS CLEAR + SETTLE) (PORT 1, BITS 2.0) INFORMATION TRANSFER PHASES *RESELECTION ONLY 36 COMMAND TRANSFER PHASE (TARGET) SERVICE MESSAGE SET C/ D AND REO FLAGS REO = 1 CONDITION (PORT 3, BIT 1,3) ACK = 0 OFF SET C/O FLAG REO = 0 (PORT 3, BIT 1) ACK = 0 READ CURRENT SCSI REO = 1 DATA REGISTER ACK = 1 (PORT 0) SET C/O FLAG REO = 1 (PORT 3, BIT 1, 3) ACK = 0 SET C/D FLAG CLEAR REO FLAG (PORT 3, BIT 1, 3) OFF REO = 0 ACK = 0 READ CURRENT SCSI REO = 1 DATA REGISTER ACK = 1 (PORT 0) NO EXAMINE FUNCTION CODE SET COMMAND LENGTH POINTER ENTER NEXT PHASE SETC/D FLAG CLEAR-REO FLAG REO = 0 (PORT 3, BIT 1, 3) ACK = 1 ON OFF 37 DATA TRANSFER TO HOST VIA PROGRAMMED 1/0 ACCEPT AND RESPOND TO MESSAGE ON SET BSY, DIFF. EN. NOTE: AND ASRT. DATA BUS DIFF. EN ONLY USED (PORT 1, BITS 5, 3, 0) IN NCR 5381. SET ASRT.//O (PORT 3, BIT 0) WRITE DATA BYTE TO OUTPUT DATA REO = 0 REGISTER ACK = 0 (PORTO) SET ASRT.//O AND REO (PORT 3, BITS 3, 0 DOWNCOUNT OFF BYTE COUNTER SET ASRT. //0 RESET REO (PORT 3, BITS 3, 0) ON NO 38 DATA TRANSFER VIA DMA ~ SET-UP DMA CHIP WITH BASE ADDRESS, WORD COUNT AND MODE OF OPERATION I SET BSY, DIFF. EN., NOTE: ASSERT DATA BUS DIFF. EN ONLY USED (PORT 1, BITS 5, 3, 0) IN NCR 5381. , SET BlK MODE DMA, EN. EOP INT., AND DMA MODE (PORT 2, BITS 7, 3,1) SET ASRT. 1/0 (PORT 3, BIT 1) ,~ SET START DMA (PORT 5) . NO EOP INTERRUPT? YES ,I CHECK ENDING STATUS (PORT 5) , STATUS PHAS E 39 LINE# LOC CODE LINE 00001 0000 NCR 5380 SCSI PROTOCOL DRIVER 00002 121000 1210003 0000 SUPPORTS BOTH INITIATOR AND TARGET ROLES 00004 0000 0012105 12101210 ASSUMES THAT THE COMMAND BLOCK (CDB)~ 00006 012100 DATA BLOCK(DBLK), AND THE EXPECTED PHASE 0121007 0000 TABLE HAVE BEEN SPECIFIED IN MEMORY 00008 0000 ; 00009 0000 SLFAIL=$01 SELECTION FAILED STATUS 00010 0121121121 DISCNT=$02 DISCONNECTED STATUS 0012111 121000 PRTYER=$03 PARITY ERROR STATUS 00012 12101210 BUSRST=$04 SCSI BUS RESET STATUS 00013 012100 CHIPFL=$05 CHIP FAILURE STATUS 00014 0000 MESSAG=$06 MESSAGE IN BYTe BEING RETND 0121015 0000 DIFFPH=$07 UNEXPECTED PHASE REQUESTED 00016 001210 ; 00017 121000 CI"1DCPL=$00 COMMAND COMPLETE MESSAGE 0012118 121000 ; 00019 0000 DATA0=$1Z10 DATA OUT PHASE 001212121 000121 CMD=$08 COMI'tlAND PHASE 0121021 001210 STATUS=$0C STATUS PHASE 1210022 0000 DATAI=$04 DATA IN PHASE 00023 01211210 IYIESSO=$18 MESSAGE OUT PHASE 00024 012101ZI MESSI=$lC MESSAGE IN PHASE 00025 i() 0 121 121 DISCON=$80 FLAG TO DISCONNECT 00026 001210 SELECT=$40 FLAG TOWAIT FOR SELECTION 00027 001210 0012128 001210 85380=$DE00 5380 ADDRESS SPACE 0121029 000121 SDMA=$DEIZtC PSEUDO DMA ADDRESS 0012130 Q)I2IIZ11Z1 IID=$DE08 INIT. ID EXT. LATCH 00031 0000 SRST=$DF01Z1 NCR5380 DEVICE RESET 00032 012100 BPNTR=$FB DATA BLOCK POINTER 0012133 121000 00034 121000 ;*=BPNTR 00035 0000 ; 012112136 001210 ;DATAB .~ORD DBLK 0121037 0000 012112138 001210 ; 12112112139 121000 *=$C0Q.~0 PROGRAM SPACE ORIGIN 0012140 C01210 TID *=*+1 ; TARGET 10 SPACE 00041 C001 ICRVAL *=*+1 ; INIT. CMD REG. STORAGE 1210042 C002 INITFL *=*+1 INITIATOR FLAG 00043 C003 OCFLAG *=*+1 OPEN COLL. FLAG 00044 C004 PTYFLG *=*+1 PARITY FLAG 00045 C005 ATNFLG *=*+1 ATN FLAG 00046 C006 ; 00Q)47 C006 PHSIDX *=*+1 EXPECTED PHASE INDEX 00048 C007 XPTPHS *=*+30 EXPECTED PHASE TABLE 00049 C025 ; 0121050 C025 COUNT *=*+1 ; BYTE COUNT 0121051 C026 XCNT *=*+1 BYTE COUNT MULTIPLIER 00052 C027 ; 012112153 C027 CDB *=*+12 CMD BLOCK STORAGE 00054 C033 DBLK *=*+512 DATA BLOCK 00055 C233 STAT *=*+2 STATUS BYTES 40 LINE*!: LOC CODE LINE 12112112156 C235 27 CIZ1 COBS • WORD CDB,DBLK, STAT 121121056 C237 33 C0 QI012156 C239 33 C2 121012157 1:23B 121 Q) 12158 C238 INITIALIZATION 1l)i{)Q)59 Cc:3B ; 12101216121 C23B A9 121121 START LDA #i{)0 ZERO ACCUM 0121061 C23D 8D 06 eel STA PHSIDX INITIALIZE PHASE INDEX 121012162 CL:::40 AD Q)IL' DF LDA SRST RESET 5380NUMBER 12112112163 C243 A9 04 LDA #1.1211210012111210 ENABLE MONITOR BSY 11\1T. 00064 C245 .AE 04 e0 LDX PTYFLG LOAD PARITY FLAG 0012165 C248 F0 02 BEQ NOPTY IF ZERO, NO PARITY 12112112166 C24A 09 30 ORA #'t.01Z111001Z1121 OR IN CHECK PARITY Brrs QI121067 C24C 8D 02 DE NOPTY STA S538121+2 STORE IN MODE REGISTER 12112112168 C24F 121 QI tZlE. 9 C24F AE 1Z1E. CI21 L_DX PHSIDX LOAD VALlJE: OF PHASE II'-IOEX 0012170 C252 A':;l 4Q.~ LDA #SELECT GET VALJ.JE OF SEI_ ervlo 012112171 C254 DD 1217 C0 CMP XPTPHS,X COIYlPARE w/CURRENT PHASE @ZIQI72 C257 DI2I 121-;;' ..... BNE INI,.. ; IF NOT = BEGIN ARBITRATION o ti) QI 7 3 C259 4C BD C3 JMP TARSEL ; Ei....SE,WAIT FOR TARGET SELECT 121012174 C25C 001Z17~:; C25C BEGIN SCSI BUS ARBITRATION 121012176 C25C ; 0121077 C25C AD 1212 DE INIT LDA S5380+2 READ MODE REG. 1210078 C25F 29 FE AND #1.11111110 MASK ARB BIT 0012179 C2E.l 8D 1212 DE STA S5380+2 ;RE8ET ARBITRATION BIT 0121080 C2EA AD III 8 DE ARB LOA 110 ;BEGIN ARBITRATION 00081 C267 80 0121 DE STA 5538121+0 ;LOAD ID INTO ODR 1210082 C26A AD 02 DE LOA 85380+2 ;READ IVIODE REG. 00083 C26D 09 ell ORA #1.12101210012101 ;SET ARBITRATION BiT 00084 C26F 8D 82 53 STA $538121+2 ;STORE IN MODE REC3. 00085 C272 00086 C272 HAS BUS GONE FREE? 00087 C272 ; 0008£.1 C272 2C 01 Dt:: NFREE BIT 5538121+1 ;BUS FREE ~i iLl tZI 089 C275 50 FB BVC NFREE ;NO LOOP UNTIL FREE 001219121 C277 0121091 C277 EA NOP ; YES, WAIT AN ARB DELAY (2.2USE 00092 C278 AD 01 DE LDA 85380+1 ;LOAD IN!T CIVID REG. 00093 C27B 29 20 AND :fI:~~0010012100 ;I'1ASt{ ALL BUT LA BIT 0121094 C27D DI2I DD BNE INIT ;IF LOST ARB, RESTART 0012195 C27F 00096 C27F CHECK FOR HIGHER PRIORI",Y ID? o tZI 12197 C27F 0121098 Ci.:::7F AD tZI0 DE LDA 85380+0 ;LOAD CURRENT DATA REG. 121121099 C282 38 SEC ;SET CARRY BIT 012110121 C283 ED 1218 DE sac lID ;5UB YOUR ID FROM DATA REG. 00101 C286 FI2I 08 BEQ WIN ;IF EQUAL TO ZERO, WIN ARB 0121102 C288 38 SEC ;I\IOT=, SOMEONE ELSE IS ARB-ING 00103 C289 ED 08 DE SBC lID ;SUBTRACT YOUR ID AGAIN 00104 C28C 3121 02 BI"1I WIN ;IF NEG, YOUR ID WAS HIGHER 121121105 C28E D0 CC BNE INIT ;OTHERWISE, RESTART 0121106 C290 0QI107 C290 RECHECK LOST ARBITRATION 0Q'108 C290 41 LINE# LOC CODE LINE 1211211121'3 C2'30 AD 1211 DE WIN LDA S538121+1 ;LOAD INIT. C\YID REG. 121121110 C293 29 2121 AND #1-1211211121121121121121 ;MASK ALL BUT LA BIT 121121111 C295 DI21 C5 BI\IE INIT ;IF LOST ARB, RESTART 1210112 C297 121121113 C297 A9 I21C LDA #1-121012.101100 ;LOAD VALUE TO SET SEL SIGNAL 121121114 C299 AE 1215 C0 LDX ATNFLG ;LOAD ATN FLAG 121121115 C29C F0 02 BEQ WOATN ; IF ZERO, SEL W/O ATN 0121116 C29E 1219 02 ORA #1-12100001211121 ; OR IN ATN BIT 0121117 C2A0 80 01 DE WOATN STA S538121+1 ;TURN ON SEL LINE 121121118 C2A3 00119 C2A3 WAIT 1.2 USEe 121121120 C2A3 12112112l. C2A3 EA NOP 0121122 C2A4 AD 1212 CI21 LOA INITFL ;LOAD IN A SOFTWARE FLAG 1210123 C2A7 00 0D BNE SEL ;IF FLAG SET, PERFORM INIT. BEL 1210124 C2A'3 1210125 C2A9 ELSE, TARGET RESELECTION 00126 C2A9 00127 C2A9 1210128 C2A9 AD 02 DE LDA S538121+2 ;READ IVIODE REG. 121012';) C2AC 1219 40 ORA #1-12111210121000 ; ENABLE TARGET MODE 012113121 C2AE SD 1212 DE STA S538121+2 ;SET TARGET MODE 00131 C2B1 A'3 1211 LDA #$1211 ;ENABLE ASSERT liD 121121132 C2B3 80 03 DE STA 8538121+3 ;SET ASSERT I/O 00133 C2B6 ; 121121134 C2B6 AD 1218 DE 8EL LOA 110 ; LOAD INITIATOR 10 121121135 C2B9 1210 121121 C0 ORA TID ; OR IN TARGET ID 121121136 C2BC BD 121121 DE STA 8538121+121 ;LOAD INT & TAR 10'8 INTO OOR 1210137 C2BF 121121138 C2BF TEST FOR DIFFERENTIAL PAIR 0121139 C2BF 1210140 C2BF A9 1215 LOA #1-121012112112111211 ;8EL & DATA BUS BITS 1210141 C2C1 AE 03 CI21 LDX OCFLAG ;LOAD IN A SOFTWARE FLAG 121121142 C2C4 0121 02 BNE OPNCOL ;IF FLAG SET, OPEN COLLECTOR 1210143 C2C6 121121144 C2C6 DIFFERENTIAL PAIR 121121145 C2C6 0121146 C2C6 09 2121 ORA #1-0121101210121121 ... OR IN DIFF. ENBL BITS 0121147 C2C8 80 1211 DE OPNCOL STA S5380+1 ;SET SEL, DATA BUS, & (DIFF. PAl 1210148 C2CB 80 1211 C0 8TA ICRVAL ; RETAIN VALUE OF INIT CMD REG. 12112114'3 C2CE 0015121 C2CE RESET ARBITRATION BIT 121121151 C2CE 00152 C2CE AD 02 DE LDA S538121+2 ;REAO MODE REGISTER 00153 C2Dl 29 FE AND #Y-1111111121 ;MA8K ARB BIT 00154 C2D3 80 02 DE 8TA 85380+2 ;RE8ET ARB BIT 00155 C2D6 ; 0121156 C2D6 DI8ABLE THE 8EL EN REGISTER TO AVOID A 8EL INT. 1210157 C2D6 00158 C2D6 A9 0121 LDA #$0121 ZERO ACCUM. 1210159 C2D8 8D 04 DE STA S5380+4 ZERO SELECT ENABLE REG. 0016121 C2DB 00161 C2DB RELEASE BUSY 121121162 C2DB 00163 C2DB AD 1211 CI2I LDA ICRVAL GET INIT CMD REG VALUE 42 LINE# LOC CODE LINE 00164 C2DE 29 F7 AND #~11110111 MASK OUT BSY BIT 00165 C2E0 80 01 DE STA S5380+1 RESET BSY 00166 C2E3 80 01 C0 STA ICRVAL RETAIN ICR VALUE 00167 C2E6 00168 C2E6 NOW WAIT 400NSEC AND BEGIN LOOKING FOR BSY 00169 C2E6 00170 C2E6 A0 60 LDY #$60 LOAD UP X REG FOR COUNTER 00171 C2E8 A2 FF RELD LOX #$FF LOAD UP Y REG FOR COUNTER 00172 C2EA 2C 04 DE STIM BIT S5380+4 SAMPLE BSY BIT 00173 C2ED 70 18 BVS SLEeT IF BSY ACTIVE, SELECTED 0121174 C2EF 00175 C2EF WAIT 250 MSEC 00176 C2EF 0121177 C2EF CA DEX Dt::LAY 00178 C2F0 D0 F8 BNE STIM IF NOT ZERO LOOP 00179 C2F2 88 DEY 00180 C2F3 D0 F3 BNE RELD IF Y NOT ZERO RELOAD X 1210181 C2F5 00182 C2F5 SELECTION TIMEOUT 00183 C2F5 00184 C2F5 A9 00 LOA #$00 ;TAR. DID NOT RESPOND TO SEL 00185 C2F7 80 00 DE 8TA 85380+0 RESET ID BITS 00186 C2FA A2 20 LDX #$20 LOAD 200 USEC COUNTER 00187 C2FC 2C 04 DE CHK BIT 85380+4 CHECK BSY AGAIN 00188 C2FF 70 06 evs SLECT IF SET SELECTION OK 00189 C301 CA DEX 00190 C302 D0 F8 BNE CHK 00191 C304 00192 C304 SELECTION FAILED 00193 C304 00194 C304 A9 01 LDA #SLFAIL LOAD STATUS IN ACCUM. 00195 C306 60 RTS RETURN TO CALLING PRGM 00196 C307 00197 C307 SUCCESSFUL (RE)SELECTION 00198 C307 ; 00199 C307 AD 01 C0 SLECT LDA ICRVAL ; GET VALUE OF INIT CMD REG. 00200 C30A AE 02 C0 LDX INITFL GET INIT FLAG 00201 C30D D0 08 BNE IF IF INITIATOR JUMP 00202 C30F 09 08 ORA #"00001000 AND SET BSY IF TARGET. 01Z1203 C311 8D 01 DE STA 85380+1 WRITE TO ICR 00204 C314 80 01 C0 STA ICRVAL ; UPDATE PRESENT ICR VALUE 00205 C317 A9 28 IF LDA *"00101000 ;MASK TO RESET SEL & DATA BUS 00206 C319 2D 01 C0 AND ICRVAL ; AND WITH ICR VALUE 00207 C31C 8D 01 DE STA 85380+1 ; RESET BEL & DATA BUS 00208 C31F 80 01 C0 8TA ICRVAL ; UPDATE NEW ICR VALUE 00209 C322 0021121 C322 BEGIN TRAN8FERS 00211 C322 00212 C322 CA DEX DEC INITIATOR FLAG 00213 C323 F0 03 BEQ PDMA IF ZERO, INITIATOR ROLE 00214 C325 4C 20 C4 JMP RES ELSE, TARGET ROLE 00215 C328 00216 C328 INITIATOR ROLE 00217 C328 00218 C328 U8E PSEUDO DMA MODE 43 LINE# LOC CODE LINE 1210219 C328 ; 1210220 C328 A9 121121 PDMA LOA #OATAI2I LOAD TCR W/DATA OUT PHASE 0121221 C32A 8D 03 DE STA S538121+3 121121222 C32D AD 1212 DE NXT LOA S5380+2 GET MODE REGISTER 121121223 C330 1219 1212 ORA ~~012100012110;OR IN DMA MODE BIT 121121224 C332 8D 1212 DE STA S538121+2 seT DMA MODE BIT 0121225 C335 AE 06 CI2I LOX PHSIDX ; LOAD X W/PHASE INDEX 121121226 C338 BD 1218 CI2I LDA XPTPHS+1,X; GET PHASE COUNT 121121227 C33B 8D 25 Ct2I STA COUNT ; STORE IN PHASE COUNT BYTE 121121228 C33E BD 1219 CI2I LDA XPTPHS+2,X; GET COUNT MULTIPLIER 00229 C341 8D 26 CI2I STA XCNT ~ STORE IN MULTIPLIER 12112123121 C344 121121231 C344 WAIT FOR PHASE MISMATCH INT. 121121232 C344 ; 0121233 C344 AD 1215 DE WAIT LDA S5380+5 SAMPLE BUS&STATUS REG. 121121234 C347 29 1121 AND ~1.12I121121101211210 LOOK FOR INT. REQ. 121121235 C349 FI2I F9 BEQ WAIT IF NOT SET, WAIT 1210236 C34B 121121237 C34B IRQ IS ACTIVE 121121238 C34B 1210239 C34B AD 1212 DE LDA S5380+2 GET MODE REG. 12112124121 C34E 29 FD AND #1.1111111211 RESET DMA MASK 121121241 C35121 8D 1212 DE STA S538121+2 RESET DMA MODE BIT 0121242 C353 AD 1215 DE LOA S538121+5 GET BUS & STATUS REG 121121243 C356 AD 1215 DE LSR SHIFT RIGHT 3 TIMES 0121244 C359 AD 05 DE LSR 121121245 C35C AD 1215 DE LSR 1210246 C35F B0 15 BCS EBUSY LOSS OF BUSY ERROR 121121247 C361 BI2I 15 DE LSR SHIFT 00248 C364 9121 76 BCC PHSMM IF CARRY CLEAR, MISMATCH 121121249 C366 9121 76 DE LSR SHIFT TWICE 0121250 C369 90 76 DE LSR 121121251 C36C BI2I I2IB BCS EPRTY IF SET. PARITY ERROR 0121252 C36E 2C 1214 DE BIT S538121+4 GET CURRENT SCSI BUS STATUS 121121253 C371 3121 14 BMI BRST IF BIT 7 SET, BUS RESET OCCURED 121121254 C373 4C 8A C3 JMP FAIL SHOULD NOT GET HERE 1210255 C376 121121256 C376 RETURN ERROR STATUS TO CALLING PROGRAM 121121257 C376 ; 121121258 C376 A9 1212 eBUSY LDA #DISCNT SET DISCONNECT FLAG 0121259 C378 60 RTS 121121260 C379 AD 1211 C0 EPRTY LDA ICRVAL GET INIT. CMD REG. VALUE 00261 C37C 1219 1212 ORA ~1.012112101211211121 TURN ON ATN SIGNAL 121121262 C37E 8D 1211 DE STA S5380+1 S'::T ATN 121121263 C381 8D 01 C0 STA ICRVAL 0121264 C384 A9 1213 LDA #':'RTYER SET PARITY ERROR 121121265 C386 6121 RTS 1210266 C387 A9 04 BRST LOA "BUSRST S'::T BUS RESET ERROR 1210267 C389 6121 RTS 121121268 C38A A9 05 FAIL LDA #CHIPFL SET CHIP FAIL ERROR 121121269 C38C 6121 RTS RETURN TO CALLING PRGM 121121270 C38D 121121271 C38D WAIT FOR TARGET SELECTION 1210272 C38D ; 0121273 C38D AD 02 DE TARSEL LOA S5380+2 ; GET MODE REG. 44 LINE# LOC CODE LINE 00274 C390 09 40 ORA #~01000000 SET TARGET MODE MASK Q)0275 C392 8D 02 DE STA S5380+2 SET TARGET MODE BIT 00275 C395 AD 08 DE LOA 110 GET TARGET 10 1210277 C398 80 04 DE STA S5380+4 STORE IN SELECT ENABLE REG. 1210278 C39B f:.)0 05 DE LOOK LOA S538121+5 SAMPLE BUS&STATUS REG. 00279 C39E 29 1121 AND #~~00010000 LOOK FOR INT REQ 12112128121 C3A 1l' FI21 F9 BEQ LOOK KEEP WAITING 00281 C3A2 1210282 C3A2 0121283 C3A2 CHECK FOR MORE THAN TWO IO'S ACTIVE 121121284 C3A2 1210285 C3A2 AD 00 DE LDA 85380+0 READ SCSI DATA BUS 00285 C3A5 A2 09 LDX #$09 SHIFT COUNT 1210287 C3A7 A0 00 LDY #$00 INITIALIZE BIT COUNT 1210288 C3A9 AIZ! 00 DE UP LSR SHIFT BIT INTO CARRY BIT 00289 C3AC CA DEX DECR. SHIFT COUNT 1210290 C3AD F0 III 5 BEQ OUT IF ZERO, DONE COUNTING 002'31 C3AF 9121 F8 BCC UP IF CARRY NOT SET, DO NEXT IZlIi)292 C3Bl C8 INY IF CARF< 00426 C4A9 CA DEX MOVE POINTER TO CQUI\IT .VALLiE 00 L,,2-' C4AA 90 07 C0 STA XPTPHS, X STORE COUNT 00428 C4AD CA DEX MOVE TO Pl-1ASE 00429 C4AE 8E 06 C0 STX PHSIDX UPDATE ~10VED PH~~St::: INDE.X 00430 C4Bl 4C 82 C4 JMP TDMAO DO DMA OwT 00431 C4B4 00432 C4B4 DIFFERENT PHASE 00433 C4B4 ; 00434 C4B4 A9 1C DP LDA #MESSI LOAD VALUE OF Mt::SSAGE Ii'\I Pt1ASC: 00435 C4B6 DD 07 Cill CMP XPTPHS, X IS THIS A MESSAGE IN ;::'hASt:: 00436 C4B9 F0 1213 BEQ MESSIN IF=, READ MESSAGE 0043-' C4BB A9 07 LDA #DIFFPH LOAD DIFFERENT PHASE ST. 00438 C4BO 60 RTS RETI\I W/UNEXPECTED PHASE S-,ATU5 47 LINE# LOC CODE LINE 1210439 C4BE 0044121 C4BE MESSAGE IN PHASE 00441 C4BE 00442 C4BE 60 07 C0 MESSIN LSR St-HFT TO TCR FORMAT 1210443 C4Cl 60 1217 C0 LSR 00444 C4C4 8D 1213 DE STA S5380+3 LOAD TCR 1210445 C4C7 AD 1217 DE LDA S5380+7 RESET H-.iT. 0121446 C4CA AD 04 DE POLL LDA S5380+4 READ CURRENT BUS STATUS 1210447 C4CD 2'3 2121 AND #~00100IZJ00 LOOK FOR liEG!. 0121448 C4CF F0 F9 BEQ POLL IF ZERO, NO REQ. 0121449 C4Dl AD 01 C0 LDA ICRVAL GET CUrH~ENT ICR V(-)LUE 00450 C4D4 1219 1121 ORA #1.12100112112100 OR IN ASSERT ACK 00451 C4D6 8D 01 DE STA S5380+1 ASSERT ACK 00452 C4D9 80 01 C0 STA ICRVAL UPDATE ICR 1210453 C4DC AD 1214 DE STILON LDA 85380+4 READ CUHRENT BLJ~3 STATUS 0121454 C4DF 29 2121 AND #1.0011210000 LOOK FOR NOT f~ ___ --'-t-":"~_""~I- t -.. .....____---=O:..:B=(O) (3) DB7 ~ ... .. (4) 086 ... ... (5) DB5 ~ .. .... (6) DB4 ... ~ "r' -ACK (7) DB3 .... . .. - .... -ACK (8) 5B2 ... ... ... (9) DBl ... .. 3 - - - - -, 6 _ -ATN (10) DBO : .. ~j...<~0-_ _ _ _Tf-'-.l.-..:.17_""''''I---I''~_-.::cA=TN NCR ~(~11~)~D~B~P_-J~_ _ _1---