head     56.3;
access   paws bayes jws quist dew jwh;
symbols  ;
locks    ; strict;
comment  @# @;


56.3
date     93.01.27.13.54.13;  author jwh;  state Exp;
branches ;
next     56.2;

56.2
date     93.01.27.12.26.15;  author jwh;  state Exp;
branches ;
next     56.1;

56.1
date     91.11.05.10.01.58;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.36.49;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.37.30;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.35.53;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.21.59;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.20.37;  author jwh;  state Exp;
branches ;
next     50.1;

50.1
date     90.10.29.16.34.28;  author jwh;  state Exp;
branches ;
next     49.1;

49.1
date     90.08.14.14.18.08;  author jwh;  state Exp;
branches ;
next     48.1;

48.1
date     90.07.26.11.24.43;  author jwh;  state Exp;
branches ;
next     47.1;

47.1
date     90.05.14.11.11.20;  author dew;  state Exp;
branches ;
next     46.1;

46.1
date     90.05.07.08.58.25;  author jwh;  state Exp;
branches ;
next     45.2;

45.2
date     90.04.25.17.27.26;  author dew;  state Exp;
branches ;
next     45.1;

45.1
date     90.04.19.16.06.15;  author jwh;  state Exp;
branches ;
next     44.1;

44.1
date     90.04.01.22.26.16;  author jwh;  state Exp;
branches ;
next     43.1;

43.1
date     90.03.20.14.16.39;  author jwh;  state Exp;
branches ;
next     42.2;

42.2
date     90.03.13.15.49.09;  author dew;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.18.00.14;  author jwh;  state Exp;
branches ;
next     41.3;

41.3
date     90.01.12.18.01.15;  author dew;  state Exp;
branches ;
next     41.2;

41.2
date     90.01.10.15.02.06;  author dew;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.41.54;  author jwh;  state Exp;
branches ;
next     40.6;

40.6
date     89.10.25.16.02.51;  author dew;  state Exp;
branches ;
next     40.5;

40.5
date     89.10.24.13.26.00;  author dew;  state Exp;
branches ;
next     40.4;

40.4
date     89.10.18.17.05.42;  author dew;  state Exp;
branches ;
next     40.3;

40.3
date     89.10.13.09.58.10;  author dew;  state Exp;
branches ;
next     40.2;

40.2
date     89.10.11.17.04.33;  author dew;  state Exp;
branches ;
next     40.1;

40.1
date     89.09.29.12.02.59;  author jwh;  state Exp;
branches ;
next     39.1;

39.1
date     89.09.26.16.47.53;  author dew;  state Exp;
branches ;
next     1.1;

1.1
date     89.09.14.10.26.47;  author dew;  state Exp;
branches ;
next     ;


desc
@SCSI_DEFS contains the types and constants required by the SCSI Generic Driver,
Operating System Depending modules, and Session Level programs that are
iterfacing to SCSI peripherals.
@


56.3
log
@
pws2rcs automatic delta on Wed Jan 27 13:14:25 MST 1993
@
text
@{
	SCSI definitions

	SCSI definitions are kept in a separate module...
}
module SCSI_DEFS;

import STATE_PROCS;

export


{-----------------------------------------------------------------------}
{forward pointer definitions.                                           }
{-----------------------------------------------------------------------}
type
	PtrSessionBlockType = ^SessionBlockType;
	PtrSelectCodeBlockType = ^SelectCodeBlockType;

{-----------------------------------------------------------------------}
{Miscellaneous types and constants.                                     }
{-----------------------------------------------------------------------}
{ SCSIIF common follows - do not erase this line as it is used during turn process }
type
	s_byte = 0 .. 255;
	s_short = 0..65535;
	s_short_signed = -32768..32767;
	PtrS_byte = ^s_byte;
	PtrChar = ^char;
	s_TYPE_ISC = 0..31;
const
	trace_size = 1000;

{ SCSIIF common precedes - do not erase this line as it is used during turn process }

{-----------------------------------------------------------------------}
{State types and constants                                              }
{-----------------------------------------------------------------------}
const
	state_stack_size = 10;

type

	EventType =     (
			{
			 NOTE: The following event list must match the assembler event
			 list defined in ST_EQU
			}

			{Standard events}
			NoEvent, ScsiErr, WaitForISR,

			{Bus Phase Events, returned by hwiGetPhase}
			BusFree, BusBusy, MsgIn, MsgOut, CmdPhase, DataPhase, StatusPhase,

			{Message In Events}
			Synch, SaveDataPtr, RestorePtrs, Disconnect, CmdComplete,
			Reject, Identify, LCC, LCCwFlag,

			{Establish Path}
			NeedSynchParms,

			{Do a Transfer}
			OriginalPhase
			);



{-----------------------------------------------------------------------}
{Hardware interface types and constants                                 }
{-----------------------------------------------------------------------}
type

	{-----------------------------------------------------------------------}
	{Scsi Card interface definitions.                                       }
	{-----------------------------------------------------------------------}
	id_reg_type = packed record
			byte0 : s_byte;
			case integer of
			1:(idb : s_byte);
			2:(rl  : boolean;  { remote/local }
			   dd  : boolean;  { differential drivers }
			   d16 : boolean;  { 16 bit DMA only }
			   pid : 0..31);
			3:(reset : s_byte);
		      end;
	 sc_reg_type = packed record
			 byte2 : s_byte;
			 case integer of
			 1:(control : s_byte); {write}
			 2:(status  : s_byte); {read}
			 3:(ie      : boolean;{interupt enable}
			    ir      : boolean;{currently generating an interupt}
			    intlevel: 0..3;{card interupt level}
			    dma_32  : boolean;{Select 32 bit dma (default 16)}
			    dma_dir : boolean;{software sets}
			    d_enab_1: boolean;{dma enable channel 1}
			    d_enab_0: boolean);{dma enable channel 0}
		       end;
	 wrap_reg_type = packed record      { WRITE ONLY REGISTER }
			   byte4 : s_byte;
			   case integer of
			   1:(wraparound : s_byte);
			   2:(req  : boolean;
			      pad  : 0..7;
			      bsy  : boolean;
			      msg  : boolean;
			      cd   : boolean;
			      io   : boolean);
			 end;
	 config_reg_type = packed record
			     byte6 : s_byte;
			     case integer of
			     1:(no_power : boolean;{ 1= no power to terminators }
				sync_rate: 0..3;   { max syncronus tranfer rate }
				bd_state : boolean;{ 1= bus drivers messed up }
				parity   : boolean;{ 1= parity selected }
				dev_addr : 0..7);  { default bus address
						     stored as 1s compliment }
			     2:(pal_reset: s_byte);{ write only}
			   end;

	ScsiCardType = PACKED RECORD
			  id_reg     : id_reg_type;
			  sc_reg     : sc_reg_type;
			  wrap_reg   : wrap_reg_type;  { write only register }
			  config_reg : config_reg_type;
		       END;
	PtrScsiCardType = ^ScsiCardType;


	{-----------------------------------------------------------------------}
	{Chip Register values.                                                  }
	{-----------------------------------------------------------------------}
type
	cmd_code = (bus_release_cmd,select_cmd,reset_atn_cmd,
		    set_atn_cmd,transfer_cmd,transfer_pause_cmd,
		    reset_ack_req_cmd,set_ack_req_cmd);
	phase_code = (data_out_phase,data_in_phase,cmd_phase,status_phase,
		      bus_free_phase,arb_sel_phase,msg_out_phase,msg_in_phase);
const
	{ sctl bit data values }
	reset_disable = HEX('80');
	control_reset = HEX('40');
	arbit_enable  = HEX('10');
	parity_enable = HEX('08');
	reselect_enable = HEX('02');
	int_enable    = HEX('01');

	{ ints bit data values }
	selected      = HEX('80');
	reselected    = HEX('40');
	disconnected  = HEX('20');
	cmd_complete  = HEX('10');
	svc_required  = HEX('08');
	timeout       = HEX('04');
	spc_hard_err  = HEX('02');
	reset_cond    = HEX('01');

	{ scmd values }
	transfer_prgx = HEX('84'); { transfer + prgx }
	transfer_dmax = HEX('80'); { transfer + dmax }
	bus_release_scmd = HEX('00');
	rst_out = HEX('10'); { rst_out set all others clear }

	{ssts action values }
	spc_not_connected       = hex('0');
	spc_waiting_select      = hex('2');
	spc_target_idle         = hex('4');
	spc_target_reselect     = hex('6');
	spc_target_xfer         = hex('7');
	spc_init_idle           = hex('8');
	spc_init_wait_xfer      = hex('9');
	spc_init_doing_select   = hex('a');
	spc_init_xfer           = hex('b');





	{-----------------------------------------------------------------------}
	{Scsi Chip interface definitions.                                       }
	{-----------------------------------------------------------------------}
type
	sctl_type = packed record
		      byte34 : s_byte;
		      case integer of
		      1:(sctl : s_byte);
		      2:(rd   : boolean;
			 cr   : boolean;
			 dm   : boolean;
			 ae   : boolean;
			 pe   : boolean;
			 se   : boolean;
			 re   : boolean;
			 ie   : boolean);
		    end;
	scmd_type = packed record
		      byte36 : s_byte;
		      case integer of
		      1:(scmd : s_byte);
		      2:(cmd     : cmd_code;
			 rst_out : boolean;
			 ix      : boolean;
			 prgx    : boolean;
			 pad     : boolean;
			 tmode   : boolean);
		      3:(pad1 : 0..31;
			 tm   : 0..7);
		    end;
	tmod_type = packed record
		      byte38 : s_byte;
		      case integer of
		      1:(tmod : s_byte);
		      2:(sx   : boolean;
			 maxto: 0..7;
			 mintp: 0..3;
			 pad  : 0..3);
		    end;
	ints_type = packed record
		      byte40 : s_byte;
		      case integer of
		      1:(ints : s_byte);
		      2:(selected     : boolean;
			 reselected   : boolean;
			 disconnected : boolean;
			 cmd_complete : boolean;
			 svc_required : boolean;
			 time_out     : boolean;
			 spc_hard_err : boolean;
			 reset_cond   : boolean);
		    end;
	psns_type = packed record
		      byte42 : s_byte;
		      case integer of
		      1:(psns : s_byte);
		      2:(req : boolean;
			 ack : boolean;
			 atn : boolean;
			 sel : boolean;
			 bsy : boolean;
			 msg : boolean;
			 cd  : boolean;
			 io  : boolean);
		      3:(sdgc : s_byte);
		      4:(dummy   : 0..31;
			 t_phase : phase_code);
		      5:(dummy1   : 0..7;
			 bus_free : 0..3);
		    end;
	ssts_type = packed record
		      byte44 : s_byte;
		      case integer of
		      1:(ssts : s_byte);
		      2:(init : boolean;
			 targ : boolean;
			 busy : boolean;
			 xfer : boolean;
			 rst  : boolean;
			 tc0  : boolean;
			 dfull: boolean;
			 dempty: boolean);
		      3:(free : 0..7); { combines init,targ & busy }
		      4:(action: 0..15); { combines init,targ,busy & xfer }
		      5:(dummy : 0..3;
			 xfer_state : 0..3); { combines busy & xfer }
		    end;
	serr_type = packed record
		      byte46 : s_byte;
		      case integer of
		      1:(serr : s_byte);
		      2:(scsi_err   : boolean;
			 spc_err    : boolean;
			 pad        : 0..3;
			 tcp_err    : boolean;
			 phase_err  : boolean;
			 short_p    : boolean;
			 offset_err : boolean);
		    end;
	pctl_type = packed record
		      byte48 : s_byte;
		      case integer of
		      1:(pctl : s_byte);
		      2:(bfree_ie: boolean;
			 pad     : 0..15;
			 msg_out : boolean;
			 cd_out  : boolean;
			 io_out  : boolean);
		      3:(pad1    : 0..31;
			 t_phase : phase_code);
		    end;
	   data_reg_type = packed record

			      byte50 ,
			  mbc        ,
			      byte52 ,
			  dreg       ,
			      byte54 ,
			  temp       ,
			      byte56 ,
			  tch        ,
			      byte58 ,
			  tcm        ,
			      byte60 ,
			  tcl        : char;
		       end;

	ScsiChipType = PACKED RECORD
			     byte32  : char;
			  bdid       : char;
			  sctl       : sctl_type;
			  scmd       : scmd_type;
			  tmod       : tmod_type;
			  ints       : ints_type;
			  psns       : psns_type;
			  ssts       : ssts_type;
			  serr       : serr_type;
			  pctl       : pctl_type;
			  data_regs: data_reg_type;
			END;
	PtrScsiChipType = ^ScsiChipType;


{-----------------------------------------------------------------------}
{SCSI SessionBlock types and constants                                  }
{-----------------------------------------------------------------------}
{ SCSIIF common follows - do not erase this line as it is used during turn process }
type
	ScsiDeviceType = 0 .. 7;

	InternalErrType = ( NoIntErr, ScsiStackingErr, RunLevelErr,
			    StateMachineErr, ScsiInteruptErr, ScsiAddressErr,
			    SelectRetryErr, ScsiManXferErr, ScsiXferErr,
			    XferRetryErr, ScsiEscapeErr, ScsiPhaseErr,
			    ScsiCatastrophicErr, ScsiBadMsg, ScsiTimeOutErr,
			    ScsiXferParmErr, ScsiMiscErr );

	SessionStateType = (
			    SessionWaiting,     {Session is initialized and waiting to be started.}
			    SessionRunning,     {Session running (State Machine is started)}
			    SessionSuspended,   {Target disconnected, bus released, awaiting reselection}
			    SessionComplete     {Session terminated, either normally or with an err}
			   );


	ScsiCallBackType = Procedure(pSB:PtrSessionBlockType);

	BufferBlockType = RECORD
				BufPtr:PtrS_byte;
				BufLen:integer;
				DoDMA:Boolean;
			END;

const
	SelectRetryMax = 0;
	XferRetryMax = 2;

type
	XferBlockType = RECORD
				XferPhase:phase_code;  {The H/W phase (not event phase)}
				XferRetryCount:s_byte;
				XferSavedDataPointer:PtrS_byte;
				XferSavedDataLength:integer;
				XferDMACount:integer;
				XferBufBlock:BufferBlockType;
			END;

	SysCleanUpProc = Procedure(SelectCode:s_TYPE_ISC);

	InternalBlockType = RECORD
				NextSession:PtrSessionBlockType;
				pScBlock:PtrSelectCodeBlockType;
				CallBackLoaded:BOOLEAN;
				StateErrCode:s_short_signed;
				StateErrExt:s_short_signed;
				ISRWaiting:Boolean;
				ISRError:Boolean;
				ISRMask:s_byte;
				SelectRetryCount:s_byte;
				XferBlock:XferBlockType;
				TargetSynchReqAck:s_byte;
				TargetSynchPeriod:s_byte;
				SysCleanUp:SysCleanUpProc;
				StateControlRec:control_rec;
			END;


	SessionBlockType = RECORD
				{Caller sets before session}
				SelectCode:s_TYPE_ISC;
				Device:ScsiDeviceType;
				LUN:s_byte;
				SUN:s_byte;
				Overlap:Boolean;
				DoNotDisconnect:Boolean;
				CmdPtr:ANYPTR;
				CmdLen:s_byte;
				BufIn:BufferBlockType;
				BufOut:BufferBlockType;
				SessionCompleteCallBack:ScsiCallBackType;

				{set by SCSI Bus Driver during session}
				SessionState:SessionStateType;
				SessionStatus:s_byte;
				InternalStatus:InternalErrType;
				ResidualCount: INTEGER;

				{Internal Use Only}
				{Trace set by caller}
				{InternalBlock used by driver}
				DoTrace:Boolean;
				TracePtr:ANYPTR;
				TraceSize:integer;
				TraceStuff:ANYPTR;
				InternalBlock:InternalBlockType;
			END;

{ SCSIIF common precedes - do not erase this line as it is used during turn process }

{-----------------------------------------------------------------------}
{Scsi Select Code Block.  Common to PWS/RMB O/Ss.                       }
{-----------------------------------------------------------------------}
type
	SynchStateType = (NeedSynch, NoSynch, Synched);
	SynchParmType = RECORD
				SynchState:SynchStateType;
				TMODValue:tmod_type;
			END;
	ScsiIsrProcType = Procedure(Sc:s_TYPE_ISC);
	SelectCodeBlockType = RECORD
				DeviceSessionPtrs:Array[ScsiDeviceType] of PtrSessionBlockType;
				DeviceSynchParms:Array[ScsiDeviceType] of SynchParmType;
				PtrScsiCard:PtrScsiCardType;
				PtrScsiChip:PtrScsiChipType;
				ScsiIntLevel:s_byte;
				ScsiSelectCode:s_TYPE_ISC;
				DMAInProgress:boolean;
				DMA32bit:boolean;
				DMAChannel:integer;
				ScsiIsrProc:ScsiIsrProcType;
			END;




implement
end;
@


56.2
log
@
pws2rcs automatic delta on Wed Jan 27 11:57:27 MST 1993
@
text
@d1 447
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 447
{
	SCSI definitions

	SCSI definitions are kept in a separate module...
}
module SCSI_DEFS;

import STATE_PROCS;

export


{-----------------------------------------------------------------------}
{forward pointer definitions.                                           }
{-----------------------------------------------------------------------}
type
	PtrSessionBlockType = ^SessionBlockType;
	PtrSelectCodeBlockType = ^SelectCodeBlockType;

{-----------------------------------------------------------------------}
{Miscellaneous types and constants.                                     }
{-----------------------------------------------------------------------}
{ SCSIIF common follows - do not erase this line as it is used during turn process }
type
	s_byte = 0 .. 255;
	s_short = 0..65535;
	s_short_signed = -32768..32767;
	PtrS_byte = ^s_byte;
	PtrChar = ^char;
	s_TYPE_ISC = 0..31;
const
	trace_size = 1000;

{ SCSIIF common precedes - do not erase this line as it is used during turn process }

{-----------------------------------------------------------------------}
{State types and constants                                              }
{-----------------------------------------------------------------------}
const
	state_stack_size = 10;

type

	EventType =     (
			{
			 NOTE: The following event list must match the assembler event
			 list defined in ST_EQU
			}

			{Standard events}
			NoEvent, ScsiErr, WaitForISR,

			{Bus Phase Events, returned by hwiGetPhase}
			BusFree, BusBusy, MsgIn, MsgOut, CmdPhase, DataPhase, StatusPhase,

			{Message In Events}
			Synch, SaveDataPtr, RestorePtrs, Disconnect, CmdComplete,
			Reject, Identify, LCC, LCCwFlag,

			{Establish Path}
			NeedSynchParms,

			{Do a Transfer}
			OriginalPhase
			);



{-----------------------------------------------------------------------}
{Hardware interface types and constants                                 }
{-----------------------------------------------------------------------}
type

	{-----------------------------------------------------------------------}
	{Scsi Card interface definitions.                                       }
	{-----------------------------------------------------------------------}
	id_reg_type = packed record
			byte0 : s_byte;
			case integer of
			1:(idb : s_byte);
			2:(rl  : boolean;  { remote/local }
			   dd  : boolean;  { differential drivers }
			   d16 : boolean;  { 16 bit DMA only }
			   pid : 0..31);
			3:(reset : s_byte);
		      end;
	 sc_reg_type = packed record
			 byte2 : s_byte;
			 case integer of
			 1:(control : s_byte); {write}
			 2:(status  : s_byte); {read}
			 3:(ie      : boolean;{interupt enable}
			    ir      : boolean;{currently generating an interupt}
			    intlevel: 0..3;{card interupt level}
			    dma_32  : boolean;{Select 32 bit dma (default 16)}
			    dma_dir : boolean;{software sets}
			    d_enab_1: boolean;{dma enable channel 1}
			    d_enab_0: boolean);{dma enable channel 0}
		       end;
	 wrap_reg_type = packed record      { WRITE ONLY REGISTER }
			   byte4 : s_byte;
			   case integer of
			   1:(wraparound : s_byte);
			   2:(req  : boolean;
			      pad  : 0..7;
			      bsy  : boolean;
			      msg  : boolean;
			      cd   : boolean;
			      io   : boolean);
			 end;
	 config_reg_type = packed record
			     byte6 : s_byte;
			     case integer of
			     1:(no_power : boolean;{ 1= no power to terminators }
				sync_rate: 0..3;   { max syncronus tranfer rate }
				bd_state : boolean;{ 1= bus drivers messed up }
				parity   : boolean;{ 1= parity selected }
				dev_addr : 0..7);  { default bus address
						     stored as 1s compliment }
			     2:(pal_reset: s_byte);{ write only}
			   end;

	ScsiCardType = PACKED RECORD
			  id_reg     : id_reg_type;
			  sc_reg     : sc_reg_type;
			  wrap_reg   : wrap_reg_type;  { write only register }
			  config_reg : config_reg_type;
		       END;
	PtrScsiCardType = ^ScsiCardType;


	{-----------------------------------------------------------------------}
	{Chip Register values.                                                  }
	{-----------------------------------------------------------------------}
type
	cmd_code = (bus_release_cmd,select_cmd,reset_atn_cmd,
		    set_atn_cmd,transfer_cmd,transfer_pause_cmd,
		    reset_ack_req_cmd,set_ack_req_cmd);
	phase_code = (data_out_phase,data_in_phase,cmd_phase,status_phase,
		      bus_free_phase,arb_sel_phase,msg_out_phase,msg_in_phase);
const
	{ sctl bit data values }
	reset_disable = HEX('80');
	control_reset = HEX('40');
	arbit_enable  = HEX('10');
	parity_enable = HEX('08');
	reselect_enable = HEX('02');
	int_enable    = HEX('01');

	{ ints bit data values }
	selected      = HEX('80');
	reselected    = HEX('40');
	disconnected  = HEX('20');
	cmd_complete  = HEX('10');
	svc_required  = HEX('08');
	timeout       = HEX('04');
	spc_hard_err  = HEX('02');
	reset_cond    = HEX('01');

	{ scmd values }
	transfer_prgx = HEX('84'); { transfer + prgx }
	transfer_dmax = HEX('80'); { transfer + dmax }
	bus_release_scmd = HEX('00');
	rst_out = HEX('10'); { rst_out set all others clear }

	{ssts action values }
	spc_not_connected       = hex('0');
	spc_waiting_select      = hex('2');
	spc_target_idle         = hex('4');
	spc_target_reselect     = hex('6');
	spc_target_xfer         = hex('7');
	spc_init_idle           = hex('8');
	spc_init_wait_xfer      = hex('9');
	spc_init_doing_select   = hex('a');
	spc_init_xfer           = hex('b');





	{-----------------------------------------------------------------------}
	{Scsi Chip interface definitions.                                       }
	{-----------------------------------------------------------------------}
type
	sctl_type = packed record
		      byte34 : s_byte;
		      case integer of
		      1:(sctl : s_byte);
		      2:(rd   : boolean;
			 cr   : boolean;
			 dm   : boolean;
			 ae   : boolean;
			 pe   : boolean;
			 se   : boolean;
			 re   : boolean;
			 ie   : boolean);
		    end;
	scmd_type = packed record
		      byte36 : s_byte;
		      case integer of
		      1:(scmd : s_byte);
		      2:(cmd     : cmd_code;
			 rst_out : boolean;
			 ix      : boolean;
			 prgx    : boolean;
			 pad     : boolean;
			 tmode   : boolean);
		      3:(pad1 : 0..31;
			 tm   : 0..7);
		    end;
	tmod_type = packed record
		      byte38 : s_byte;
		      case integer of
		      1:(tmod : s_byte);
		      2:(sx   : boolean;
			 maxto: 0..7;
			 mintp: 0..3;
			 pad  : 0..3);
		    end;
	ints_type = packed record
		      byte40 : s_byte;
		      case integer of
		      1:(ints : s_byte);
		      2:(selected     : boolean;
			 reselected   : boolean;
			 disconnected : boolean;
			 cmd_complete : boolean;
			 svc_required : boolean;
			 time_out     : boolean;
			 spc_hard_err : boolean;
			 reset_cond   : boolean);
		    end;
	psns_type = packed record
		      byte42 : s_byte;
		      case integer of
		      1:(psns : s_byte);
		      2:(req : boolean;
			 ack : boolean;
			 atn : boolean;
			 sel : boolean;
			 bsy : boolean;
			 msg : boolean;
			 cd  : boolean;
			 io  : boolean);
		      3:(sdgc : s_byte);
		      4:(dummy   : 0..31;
			 t_phase : phase_code);
		      5:(dummy1   : 0..7;
			 bus_free : 0..3);
		    end;
	ssts_type = packed record
		      byte44 : s_byte;
		      case integer of
		      1:(ssts : s_byte);
		      2:(init : boolean;
			 targ : boolean;
			 busy : boolean;
			 xfer : boolean;
			 rst  : boolean;
			 tc0  : boolean;
			 dfull: boolean;
			 dempty: boolean);
		      3:(free : 0..7); { combines init,targ & busy }
		      4:(action: 0..15); { combines init,targ,busy & xfer }
		      5:(dummy : 0..3;
			 xfer_state : 0..3); { combines busy & xfer }
		    end;
	serr_type = packed record
		      byte46 : s_byte;
		      case integer of
		      1:(serr : s_byte);
		      2:(scsi_err   : boolean;
			 spc_err    : boolean;
			 pad        : 0..3;
			 tcp_err    : boolean;
			 phase_err  : boolean;
			 short_p    : boolean;
			 offset_err : boolean);
		    end;
	pctl_type = packed record
		      byte48 : s_byte;
		      case integer of
		      1:(pctl : s_byte);
		      2:(bfree_ie: boolean;
			 pad     : 0..15;
			 msg_out : boolean;
			 cd_out  : boolean;
			 io_out  : boolean);
		      3:(pad1    : 0..31;
			 t_phase : phase_code);
		    end;
	   data_reg_type = packed record

			      byte50 ,
			  mbc        ,
			      byte52 ,
			  dreg       ,
			      byte54 ,
			  temp       ,
			      byte56 ,
			  tch        ,
			      byte58 ,
			  tcm        ,
			      byte60 ,
			  tcl        : char;
		       end;

	ScsiChipType = PACKED RECORD
			     byte32  : char;
			  bdid       : char;
			  sctl       : sctl_type;
			  scmd       : scmd_type;
			  tmod       : tmod_type;
			  ints       : ints_type;
			  psns       : psns_type;
			  ssts       : ssts_type;
			  serr       : serr_type;
			  pctl       : pctl_type;
			  data_regs: data_reg_type;
			END;
	PtrScsiChipType = ^ScsiChipType;


{-----------------------------------------------------------------------}
{SCSI SessionBlock types and constants                                  }
{-----------------------------------------------------------------------}
{ SCSIIF common follows - do not erase this line as it is used during turn process }
type
	ScsiDeviceType = 0 .. 7;

	InternalErrType = ( NoIntErr, ScsiStackingErr, RunLevelErr,
			    StateMachineErr, ScsiInteruptErr, ScsiAddressErr,
			    SelectRetryErr, ScsiManXferErr, ScsiXferErr,
			    XferRetryErr, ScsiEscapeErr, ScsiPhaseErr,
			    ScsiCatastrophicErr, ScsiBadMsg, ScsiTimeOutErr,
			    ScsiXferParmErr, ScsiMiscErr );

	SessionStateType = (
			    SessionWaiting,     {Session is initialized and waiting to be started.}
			    SessionRunning,     {Session running (State Machine is started)}
			    SessionSuspended,   {Target disconnected, bus released, awaiting reselection}
			    SessionComplete     {Session terminated, either normally or with an err}
			   );


	ScsiCallBackType = Procedure(pSB:PtrSessionBlockType);

	BufferBlockType = RECORD
				BufPtr:PtrS_byte;
				BufLen:integer;
				DoDMA:Boolean;
			END;

const
	SelectRetryMax = 0;
	XferRetryMax = 2;

type
	XferBlockType = RECORD
				XferPhase:phase_code;  {The H/W phase (not event phase)}
				XferRetryCount:s_byte;
				XferSavedDataPointer:PtrS_byte;
				XferSavedDataLength:integer;
				XferDMACount:integer;
				XferBufBlock:BufferBlockType;
			END;

	SysCleanUpProc = Procedure(SelectCode:s_TYPE_ISC);

	InternalBlockType = RECORD
				NextSession:PtrSessionBlockType;
				pScBlock:PtrSelectCodeBlockType;
				CallBackLoaded:BOOLEAN;
				StateErrCode:s_short_signed;
				StateErrExt:s_short_signed;
				ISRWaiting:Boolean;
				ISRError:Boolean;
				ISRMask:s_byte;
				SelectRetryCount:s_byte;
				XferBlock:XferBlockType;
				TargetSynchReqAck:s_byte;
				TargetSynchPeriod:s_byte;
				SysCleanUp:SysCleanUpProc;
				StateControlRec:control_rec;
			END;


	SessionBlockType = RECORD
				{Caller sets before session}
				SelectCode:s_TYPE_ISC;
				Device:ScsiDeviceType;
				LUN:s_byte;
				SUN:s_byte;
				Overlap:Boolean;
				DoNotDisconnect:Boolean;
				CmdPtr:ANYPTR;
				CmdLen:s_byte;
				BufIn:BufferBlockType;
				BufOut:BufferBlockType;
				SessionCompleteCallBack:ScsiCallBackType;

				{set by SCSI Bus Driver during session}
				SessionState:SessionStateType;
				SessionStatus:s_byte;
				InternalStatus:InternalErrType;
				ResidualCount: INTEGER;

				{Internal Use Only}
				{Trace set by caller}
				{InternalBlock used by driver}
				DoTrace:Boolean;
				TracePtr:ANYPTR;
				TraceSize:integer;
				TraceStuff:ANYPTR;
				InternalBlock:InternalBlockType;
			END;

{ SCSIIF common precedes - do not erase this line as it is used during turn process }

{-----------------------------------------------------------------------}
{Scsi Select Code Block.  Common to PWS/RMB O/Ss.                       }
{-----------------------------------------------------------------------}
type
	SynchStateType = (NeedSynch, NoSynch, Synched);
	SynchParmType = RECORD
				SynchState:SynchStateType;
				TMODValue:tmod_type;
			END;
	ScsiIsrProcType = Procedure(Sc:s_TYPE_ISC);
	SelectCodeBlockType = RECORD
				DeviceSessionPtrs:Array[ScsiDeviceType] of PtrSessionBlockType;
				DeviceSynchParms:Array[ScsiDeviceType] of SynchParmType;
				PtrScsiCard:PtrScsiCardType;
				PtrScsiChip:PtrScsiChipType;
				ScsiIntLevel:s_byte;
				ScsiSelectCode:s_TYPE_ISC;
				DMAInProgress:boolean;
				DMA32bit:boolean;
				DMAChannel:integer;
				ScsiIsrProc:ScsiIsrProcType;
			END;




implement
end;
@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@@


50.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


49.1
log
@Automatic bump of revision number for PWS version 3.24b
@
text
@@


48.1
log
@Automatic bump of revision number for PWS version 3.24a
@
text
@@


47.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


46.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


45.2
log
@
Because of the increased delay for a select timeout (from 1ms to 250ms),
the select retry max count was changed to 0 (no select retrys allowed).
Prior to this change, CTABLE ran inordinately long while searching for
devices that didn't exist.
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@d355 1
a355 1
	SelectRetryMax = 1;
@


44.1
log
@Automatic bump of revision number for PWS version 3.23B
@
text
@@


43.1
log
@Automatic bump of revision number for PWS version 3.23aA
@
text
@@


42.2
log
@Added two new internal error types.
@
text
@@


42.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@d335 2
a336 1
			    ScsiCatastrophicErr, ScsiBadMsg, ScsiTimeOutErr );
@


41.3
log
@For Stacked Sessions the tbderr was converted to ScsiStackingErr.
@
text
@@


41.2
log
@
No longer require the ScsiProtoType as this functionallity has been
removed.

The SessoinCompleteCallBackProc has a SessionBlockPtr has a paramter.
@
text
@d331 5
a335 5
	InternalErrType = ( NoIntErr, tbderr, RunLevelErr, StateMachineErr,
			    ScsiInteruptErr, ScsiAddressErr, SelectRetryErr,
			    ScsiManXferErr, ScsiXferErr,XferRetryErr,
			    ScsiEscapeErr, ScsiPhaseErr, ScsiCatastrophicErr,
			    ScsiBadMsg, ScsiTimeOutErr );
@


41.1
log
@Automatic bump of revision number for PWS version 3.23d
@
text
@a330 2
	ScsiProtoType = (Asynchronous, Synchronous, Fastest);

d345 2
d399 1
a399 1
				SessionCompleteCallBack:Procedure;
@


40.6
log
@Updated to support state trace after programmer's interface modifcations.
@
text
@@


40.5
log
@Modified so that programmer's interface required information can easily be
stripped out with a stream file.

Added dependency to STATE_PROCS back in.
@
text
@d31 2
a39 1
	trace_size = 1000;
d413 1
@


40.4
log
@Modifications for DMA support.
@
text
@d8 2
d23 1
d32 2
d326 1
a344 3
const
	SelectRetryMax = 1;
	XferRetryMax = 2;
a345 2
type

d352 5
d382 1
a382 1
				StateControlRec:Packed array [0..255] of char;
d414 2
@


40.3
log
@Updated to reflect SCSI_DEFS modifications for programmer's interface.
@
text
@d114 1
d156 1
d356 1
d426 3
@


40.2
log
@Modifications to support the synchronous protocol.
@
text
@a361 1
				SessionState:SessionStateType;
d378 1
a384 4
				DoTrace:Boolean;
				SessionCompleteCallBack:Procedure;
				SessionStatus:s_byte;
				InternalStatus:InternalErrType;
d389 6
d396 5
@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@a345 1
				Protocol:ScsiProtoType;
d371 2
d403 1
d405 2
a406 1
				DeviceSynched:BOOLEAN;
@


39.1
log
@Automatic bump of revision number for PWS version 3.23b
@
text
@@


1.1
log
@Initial revision
@
text
@@
