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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

43.1
date     90.03.20.14.16.48;  author jwh;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.18.00.24;  author jwh;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.42.03;  author jwh;  state Exp;
branches ;
next     40.4;

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

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

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

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

39.1
date     89.09.26.16.48.03;  author dew;  state Exp;
branches ;
next     1.2;

1.2
date     89.09.14.11.24.52;  author dew;  state Exp;
branches ;
next     1.1;

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


desc
@STATE_DVR is the module with the SCSI Generic Driver that interfaces to
Robert Quists generic state machine driver.
@


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

	interfaces the scsi driver to the state driver (exec) in state_procs
}
MODULE STATE_DRIVE;
import STATE_PROCS, SCSI_DEFS, SCSI_UTILS, OSD_LL;
export
	Procedure StartState(PtrSessionBlock:PtrSessionBlockType);
implement

Procedure StartState(PtrSessionBlock:PtrSessionBlockType);
Var
	SaveLevel:integer;
	i:integer;
	MyMachine['SCSI_DRIVER'] : integer;
begin
with PtrSessionBlock^, InternalBlock.pScBlock^ do
 begin
	{
	  set interrupt level
	}
	SaveLevel := osdGetRunLevel;
	if SaveLevel < ScsiIntLevel then
		osdSetRunLevel(ScsiIntLevel)
	else
		SaveLevel := 100; {larger than the largest interupt level}

	{
	  If session is not running, initialize the exec's control record.
	}
	if SessionState = SessionWaiting then
	begin
		SessionState := SessionRunning;
		init_exec_control(addr(InternalBlock.StateControlRec), PtrSessionBlock,
				  MyMachine, state_stack_size);
		if DoTrace then
		begin
			i := TraceSize Div sizeof(trace_data_elt);
			TraceStuff := addr(InternalBlock.StateControlRec);
		end
		else
		begin
			i := 0;
			TracePtr := Nil;
		end;
		init_trace(addr(InternalBlock.StateControlRec), i, TracePtr);
		trace_control(addr(InternalBlock.StateControlRec), DoTrace); { turn on tracing }
	end;

	{
	  Call the state machine.
	}
	exec(addr(InternalBlock.StateControlRec));

	{
	  If the state machine terminated abnormally, be sure that the sessioncomplete
	  flag is set.
	}
	with InternalBlock.StateControlRec do
	begin
		if (mdone) and (exit_code < 0) and
		   (SessionState <> SessionComplete) then
		begin
			utlSetInternalErr(PtrSessionBlock, StateMachineErr);
			InternalBlock.StateErrCode := exit_code;
			InternalBlock.StateErrExt  := exit_extension;
			call(InternalBlock.SysCleanUp, SelectCode);
		end;
	end;

	{
	  reset interrupt level
	}
	if SaveLevel < ScsiIntLevel then
		osdSetRunLevel(SaveLevel);
end;

end;

end;
@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 81
{
	Module: State_Drive

	interfaces the scsi driver to the state driver (exec) in state_procs
}
MODULE STATE_DRIVE;
import STATE_PROCS, SCSI_DEFS, SCSI_UTILS, OSD_LL;
export
	Procedure StartState(PtrSessionBlock:PtrSessionBlockType);
implement

Procedure StartState(PtrSessionBlock:PtrSessionBlockType);
Var
	SaveLevel:integer;
	i:integer;
	MyMachine['SCSI_DRIVER'] : integer;
begin
with PtrSessionBlock^, InternalBlock.pScBlock^ do
 begin
	{
	  set interrupt level
	}
	SaveLevel := osdGetRunLevel;
	if SaveLevel < ScsiIntLevel then
		osdSetRunLevel(ScsiIntLevel)
	else
		SaveLevel := 100; {larger than the largest interupt level}

	{
	  If session is not running, initialize the exec's control record.
	}
	if SessionState = SessionWaiting then
	begin
		SessionState := SessionRunning;
		init_exec_control(addr(InternalBlock.StateControlRec), PtrSessionBlock,
				  MyMachine, state_stack_size);
		if DoTrace then
		begin
			i := TraceSize Div sizeof(trace_data_elt);
			TraceStuff := addr(InternalBlock.StateControlRec);
		end
		else
		begin
			i := 0;
			TracePtr := Nil;
		end;
		init_trace(addr(InternalBlock.StateControlRec), i, TracePtr);
		trace_control(addr(InternalBlock.StateControlRec), DoTrace); { turn on tracing }
	end;

	{
	  Call the state machine.
	}
	exec(addr(InternalBlock.StateControlRec));

	{
	  If the state machine terminated abnormally, be sure that the sessioncomplete
	  flag is set.
	}
	with InternalBlock.StateControlRec do
	begin
		if (mdone) and (exit_code < 0) and
		   (SessionState <> SessionComplete) then
		begin
			utlSetInternalErr(PtrSessionBlock, StateMachineErr);
			InternalBlock.StateErrCode := exit_code;
			InternalBlock.StateErrExt  := exit_extension;
			call(InternalBlock.SysCleanUp, SelectCode);
		end;
	end;

	{
	  reset interrupt level
	}
	if SaveLevel < ScsiIntLevel then
		osdSetRunLevel(SaveLevel);
end;

end;

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
@
Setting the SessionState to Complete on a State Machine Error is
a no no!  This routine does call cmdScCleanUP which will react
to the session based on its current state.  THEN the state will
be set to complete.  Setting it here does not allow cmdScCleanUP
to properly react to the session.
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@a64 1
			SessionState := SessionComplete;
@


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.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@@


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


40.4
log
@Updated to support tracing after programmer's interface modifications.
@
text
@@


40.3
log
@SCSI_DEFS again has knowledge of a control_rec, so the pointer casting is no
longer required.
@
text
@d40 1
@


40.2
log
@Updated to reflect SCSI_DEFS modifications for programmer's interface.
@
text
@d59 1
a59 1
	with control_ptr(addr(InternalBlock.StateControlRec))^ do
@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@d32 1
a32 1
	if InternalBlock.SessionState = SessionWaiting then
d34 1
a34 1
		InternalBlock.SessionState := SessionRunning;
d62 1
a62 1
		   (InternalBlock.SessionState <> SessionComplete) then
d64 1
a64 1
			InternalBlock.SessionState := SessionComplete;
@


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


1.2
log
@Updated to reflect cleaner interface for tracing.
@
text
@@


1.1
log
@Initial revision
@
text
@a39 1
			control_ptr(addr(InternalBlock.StateControlRec))^.tdata := TracePtr;
d42 1
d44 3
a46 1
		init_trace(addr(InternalBlock.StateControlRec), i);
@
