;Assembler header file for SCSI
;written by DefMod (Oct 26 2000) on Tue Dec 12 18:10:33 2000
;Jonathan Coxhead, jonathan@doves.demon.co.uk, 27 June 1995

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET OSLib:oslib.Hdr.Types"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET OSLib:oslib.Hdr.OS"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

        [       :LNOT: :DEF: SCSI_Hdr
        GBLS    SCSI_Hdr

;Symbols for constants
SCSI_CheckNoChange              *       &FFFFFFFF
SCSI_CheckError                 *       &0
SCSI_CheckSense                 *       &1
SCSI_CheckRetry                 *       &2
SCSI_BehaviourNoChange          *       &FFFFFFFF
SCSI_BehaviourWait              *       &0
SCSI_BehaviourAwaitQueue        *       &1
SCSI_BehaviourAwaitDevice       *       &2
SCSI_BehaviourAwaitCard         *       &3
SCSI_DisconnectNoChange         *       &FFFFFFFF
SCSI_DisconnectAllowed          *       &0
SCSI_DisconnectInhibitedByBlocking *       &1
SCSI_DisconnectInhibited        *       &2
SCSI_DeviceStatusIdle           *       &1
SCSI_DeviceStatusBusy           *       &2

;Symbols for structure offsets and sizes
SCSI_SoftwareFeatures           *       Bits

SCSI_HardwareFeatures           *       Bits

SCSI_DeviceType                 *       Byte

SCSI_DeviceFlags                *       Byte

SCSI_DeviceVersion              *       Byte

                                ^       0
SCSI_DeviceDescription_type     #       SCSI_DeviceType
SCSI_DeviceDescription_flags    #       SCSI_DeviceFlags
SCSI_DeviceDescription_version  #       SCSI_DeviceVersion
SCSI_DeviceDescription_reserved0 #       Byte
SCSI_DeviceDescription_length   #       Byte
SCSI_DeviceDescription_reserved1 #       Byte
SCSI_DeviceDescription_reserved2 #       Byte
SCSI_DeviceDescription_reserved3 #       Byte
SCSI_DeviceDescription_block_count #       Int
SCSI_DeviceDescription_block_size #       Int
SCSI_DeviceDescription          *       @

SCSI_ErrorResponseLevel         *       Int

SCSI_QueueBehaviour             *       Int

SCSI_Disconnection              *       Int

                                ^       0
SCSI_OpBlock_o                  #       Int
SCSI_OpBlock                    *       @

SCSI_DeviceStatus               *       Int

                                ^       0
SCSI_CardAddressList_addr       #       Ptr
SCSI_CardAddressList            *       @


;Symbols for SWI's and SWI reason codes
XSCSI_Version                   *       &603C0
SCSI_Version                    *       &403C0
   ;Exit
   ;  R0 = software_version (Bits)
   ;  R1 = software_features (SCSI_SoftwareFeatures)
   ;  R2 = hardware_version (Bits)
   ;  R3 = hardware_features (SCSI_HardwareFeatures)

XSCSI_Initialise                *       &603C1
SCSI_Initialise                 *       &403C1

SCSIInitialise_ResetBus         *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = host_id (Int)

SCSIInitialise_ResetDevice      *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = device_id (Int)
   ;  R8 = access_key (Int)

SCSIInitialise_DetermineDevice  *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = device_id (Int)
   ;  R2 = description (pointer to SCSI_DeviceDescription)

SCSIInitialise_EnumerateDevice  *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 = device_id (Int)
   ;  R2 = description (pointer to String)
   ;  R3 = size (Int)

XSCSI_Control                   *       &603C2
SCSI_Control                    *       &403C2

SCSIControl_AbortDevice         *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = device_id (Int)
   ;  R8 = access_key (Int)

SCSIControl_AbortOp             *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = device_id (Int)
   ;  R2 = op_id (Int)
   ;  R8 = access_key (Int)

SCSIControl_SetTimeout          *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 = device_id (Int)
   ;  R2 = timeout (Int)
   ;  R8 = access_key (Int)
   ;Exit
   ;  R2 = old_timeout (Int)

SCSIControl_SetErrorResponse    *       &4
   ;Entry
   ;  R0 = &4
   ;  R1 = device_id (Int)
   ;  R2 = level (SCSI_ErrorResponseLevel)
   ;  R8 = access_key (Int)
   ;Exit
   ;  R2 = old_level (Int)

SCSIControl_SetQueueBehaviour   *       &5
   ;Entry
   ;  R0 = &5
   ;  R1 = device_id (Int)
   ;  R2 = behaviour (SCSI_QueueBehaviour)
   ;  R8 = access_key (Int)
   ;Exit
   ;  R2 = old_level (Int)

SCSIControl_Disconnect          *       &6
   ;Entry
   ;  R0 = &6
   ;  R1 = device_id (Int)
   ;  R2 = disconnection (SCSI_Disconnection)
   ;Exit
   ;  R2 = old_disconnection (Int)
   ;  R8 = access_key (Int)

XSCSI_Op                        *       &603C3
SCSI_Op                         *       &403C3
   ;Entry
   ;  R0 = op (Bits)
   ;  R1 = block_size (Int)
   ;  R2 -> block (SCSI_OpBlock)
   ;  R3 = start_addr (pointer to data)
   ;  R4 = length (Int)
   ;  R5 = timeout (Int)
   ;  R6 -> callback_code (code)
   ;  R7 = workspace (pointer to Void)
   ;  R8 = access_key (Int)
   ;Exit
   ;  R0 = op_id (Int)
   ;  R3 = next_addr (pointer to data)
   ;  R4 = undone (Int)

XSCSI_Status                    *       &603C4
SCSI_Status                     *       &403C4

SCSIStatus_CheckDevice          *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = device_id (Int)
   ;Exit
   ;  R0 = status (SCSI_DeviceStatus)

XSCSI_Reserve                   *       &603C7
SCSI_Reserve                    *       &403C7

SCSIReserve_Claim               *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = device_id (Int)
   ;  R2 -> release_code (code)
   ;  R3 = workspace (pointer to Void)
   ;  R8 = access_key (Int)

SCSIReserve_ForceClaim          *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = device_id (Int)
   ;  R2 -> release_code (code)
   ;  R3 = workspace (pointer to Void)
   ;  R8 = access_key (Int)

SCSIReserve_Release             *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = device_id (Int)
   ;  R8 = access_key (Int)

XSCSI_List                      *       &603C8
SCSI_List                       *       &403C8
   ;Entry
   ;  R0 -> list (SCSI_CardAddressList)

XSCSI_TargetControl             *       &603C9
SCSI_TargetControl              *       &403C9

        ]
        END
