; Assembler header file for SCSI
; Written by DefMod (Dec  9 2012) on Sun Dec  9 15:43:44 2012
; Jonathan Coxhead, jonathan@doves.demon.co.uk, 27 June 1995

; OSLib---efficient, type-safe, transparent, extensible,
; register-safe API coverage of RISC OS
; 
; Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
; 
; Licence:
; 
;    OSLib is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 1, or (at your option)
; any later version - and this with the following clarification and
; special exception:
; 
;    Linking this library statically or dynamically with other modules
; is making a combined work based on this library. Thus, the terms
; and conditions of the GNU General Public License cover the whole
; combination.
; 
;    As a special exception, the copyright holders of this library
; give you permission to link this library with independent modules
; to produce an executable, regardless of the license terms of these
; independent modules, and to copy and distribute the resulting
; executable under terms of your choice, provided that you also meet,
; for each linked independent module, the terms and conditions of the
; license of that module. An independent module is a module which is
; not derived from or based on this library. If you modify this
; library, you may extend this exception to your version of the library,
; but you are not obliged to do so. If you do not wish to do so, delete
; this exception statement from your version.
; 
;    OSLib is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
; 
;    You should have received a copy of the GNU General Public License
; along with this programme; if not, write to the Free Software
; Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

        [       :LNOT: :DEF: SCSI_Hdr
        GBLS    SCSI_Hdr

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

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

;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
        ^       0
        #       Bits
SCSI_SoftwareFeatures           *       @

        ^       0
        #       Bits
SCSI_HardwareFeatures           *       @

        ^       0
        #       Byte
SCSI_DeviceType                 *       @

        ^       0
        #       Byte
SCSI_DeviceFlags                *       @

        ^       0
        #       Byte
SCSI_DeviceVersion              *       @

        ^       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          *       @

        ^       0
        #       Int
SCSI_ErrorResponseLevel         *       @

        ^       0
        #       Int
SCSI_QueueBehaviour             *       @

        ^       0
        #       Int
SCSI_Disconnection              *       @

        ^       0
SCSI_OpBlock_o                  #       Int
SCSI_OpBlock                    *       @

        ^       0
        #       Int
SCSI_DeviceStatus               *       @

        ^       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 (pointer to 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 (pointer to code)
   ;  R3 = workspace (pointer to Void)
   ;  R8 = access_key (Int)

SCSIReserve_ForceClaim          *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = device_id (Int)
   ;  R2 = release_code (pointer to 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
