antoine-source/scsi2/SCSI.Drivers/SCSI Main Driver

1 line
26 KiB
Plaintext
Raw Normal View History

;******************************************************* ; ; SCSI Driver 'Main Driver'. ; ; Written by Matt Gulick. Started May 25,1988 ; ; Copyright Apple Computer, Inc. 1988,89 ; ;******************************************************* ;******************************************************* ; ; This file contains the 'Main Driver' as defined in ; the ERS. ; ;******************************************************* ;******************************************************* ; ; Revision History: ; ;******************************************************* ; May 25, 1988 File started. ; June 6, 1988 Turned sections into subroutines ; and wrote the Main Driver Proper. ; June 20, 1988 Added Register Input and Output. ; Also included the changes from ; the code review. ; Oct 25, 1988 Made changes in code to reflect the ; redesign of the SCSI Manager interface. ; STRING PASCAL BLANKS OFF PAGESIZE 70 PRINT NOGEN PRINT NOMDIR MACHINE M65816 IMPORT cmd_t_tbl IMPORT call_type IMPORT scratch0 IMPORT cmd_ps_tbl IMPORT c_len_len IMPORT c_blk_len IMPORT divide IMPORT result IMPORT divend IMPORT divsor IMPORT time_cnt IMPORT rout2_s_disp IMPORT gsos_dpage IMPORT f_partition IMPORT internal IMPORT disk_switch IMPORT scsi_mgrnum IMPORT manager_cmd IMPORT cur_cmd IMPORT cur_cmd2 IMPORT cur_group IMPORT trans_dest IMPORT p_block_num IMPORT killer_blk IMPORT trans_flag IMPORT temp_x IMPORT temp_y IMPORT timeout_flag IMPORT auto_sense_data IMPORT lst_rslt_ec IMPORT lst_rslt_stat IMPORT lst_rslt_skey IMPORT lst_rslt_info IMPORT lst_rslt_rqlen IMPORT lst_rslt_scode PRINT OFF INCLUDE 'scsihd.equates' INCLUDE 'M16.MEMORY' INCLUDE 'M16.UTIL' PRINT ON EJECT ;******************************************************* ; ; Main Entry point to the 'Main Driver'. ; ; The function of this code is to take the callers ; command data and build a SCSI Command Packet. This ; is done using the conversion tables in the file ; 'SCSI Command Table'. The command and other data ; is actually built in the space that has been added ; to the DIB and then routed to the SCSI Manager. ; ; The routine is called with the LONG pointer to the ; callers command data in the Direct Page location ; 'scsi_mdrvr'. This, in conjunction with the DIB Ptr ; at direct page location 'dib_ptr' as the address ; for the template overlay, will be used to do the ; following: ; ; Transfer the callers command data to the command ; packet. ; Zero all 12 bytes first. ; Validate Internal Command flag if set. ; .OR. in all values durring translation. ; Adjust Transfer length if needed. ; Convert Block Number from Logical to Actual ; If partition Flag is <20> zero then leave ; block number unmodified. ; Check for command errors. ; ; Stuff SCSI Manager Flags ; ; Stuff data in the TRX buffer data structure ; ; Ship the call out to the SCSI Manager. ; ; Clear Partition Call Flag. ; ; Clear the Internal Command Flag. ; ; Translate any SCSI errors into GS/OS errors. ; ; Inputs: Acc = Unspecified ; Y register = Unspecified ; X register = Unspecified ; P register = 0=M=X=e ; Direct Page = Ours ; Data Bank = Ours ; ; Outputs: Acc = Unspecified ; Y register = Unspecified ; X register = Unspecified ; P register = 0=M=X=e ; Direct Page = Ours ; Data Bank = Ours ; ; Errors: Carry set if Error. ; ;******************************************************* EXPORT main_drvr main_drvr PROC ; ; Clear the Timeout flag ; stz |timeout_flag ; ; Clear the last error stuff ; stz |lst_rslt_ec stz |lst_rslt_stat stz |lst_rslt_skey stz |lst_rslt_info stz |lst_rslt_rqlen stz |lst_rslt_scode ; ; Clear the Command Buffer