Google
 

Trailing-Edge - PDP-10 Archives - BB-R595B-SM_11-9-85 - mcb/xpt/xpttim.bli
There is 1 other file named xpttim.bli in the archive. Click here to see a list.
module XPTTIM	(
		IDENT = 'X01150'
		) =
begin

!
!                    COPYRIGHT (c) 1980, 1981, 1982
!                    DIGITAL EQUIPMENT CORPORATION
!                        Maynard, Massachusetts
!
!     This software is furnished under a license and may  be  used
!     and copied only in accordance with the terms of such license
!     and with the inclusion of the above copyright notice.   This
!     software  or any other copies thereof may not be provided or
!     otherwise made available to any other person.  No  title  to
!     and ownership of the software is hereby transferred.
!
!     The information  in  this  software  is  subject  to  change
!     without  notice  and should not be construed as a commitment
!     by DIGITAL EQUIPMENT CORPORATION.
!
!     DIGITAL assumes no responsibility for the use or reliability
!     of  its  software  on  equipment  which  is  not supplied by
!     DIGITAL.
!

!++
! FACILITY:	Transport
!
! ABSTRACT:
!
!	Transport timer service routine: updates all timers and calls the timer
!	routines in the various Transport process modules.
!
! ENVIRONMENT:	MCB
!
! AUTHOR: L. Webber , CREATION DATE: 27-Jul-79
!
! MODIFIED BY:
!
!	27-Jul-79 : VERSION 1.00
!
! 1.01	L. Webber, 19-Dec-79
!	Deleted update of T6 timer and call to LISTENER
!
! 1.02	L. Webber, 4-Apr-80
!	Change call to DECTIM to extension process call
!
! 1.03	L. Webber, 15-Apr-80
!	Add process initialization code to initialize the pointer
!	to the Transport Data Base
!
! 1.04	L. Webber, 30-Jun-80
!	Modify to use MCBLIB macros
!
! 1.05	L. Webber, 11-Dec-80
!	Modify to support MCB 3.1
!
! 1.06	L. Webber, 20-Jan-81
!	Add code to set up PIXes of other processes in the Transport
!	data base; also don't pass NLN any more.
!
! 1.07	L. Webber, 9-Feb-81
!	Fix resource recovery code so it recognizes a resource failure
!	during the redispatch of a CCB, and stops dispatching CCBs.
!
! 1.08	L. Webber, 10-Feb-81
!	The Update module is now in XPE; CALL$E to UPDTIM.
!	The Hello module is also in XPE; CALL$E to HELLO.
!
! 1.09	L. Webber, 18-Feb-81
!	Add debugging code to maintain a count of buffers on the retry
!	  queue.
!
! 1.10	L. Webber, 24-Feb-81
!	CALL$P TLITIM when the timer goes off.
!	Put in the new form of timer maintenance.
!
! 1.11	L. Webber, 27-Feb-81
!	Get the PIX for the XNM process.
!
! 1.12	L. Webber, 10-Mar-81
!	Fix input quota accounting for buffers going onto the retry
!	queue; they will be counted again when redispatched.
!
! 1.13	L. Webber, 23-Feb-82
!	Add maintenance of DLLquota.
!
! 1.14	A. Peckham,19-Apr-82
!	Eliminate references to GETLINE.
!       Optimize linkages.
!
! 1.15	D. Brannon, 23-Sep-83
!	In TIMLTM fix the crash caused by calling INI_LIN with 2 args
!	instead of 3.  Also fixed the calls to TERM_LIN and TLITIM
!	that had the same problem.
!
!--
!
! TABLE OF CONTENTS
!

require 'XPTMAC';
forward routine
	XPTTIM: MCB_DB_MOD novalue,
        TIMLTM: MCB_DB novalue,
        TIMPIN: MCB_DB novalue,
        GET_PIX,
	GETNLN: novalue,
	RE_QUEUE: novalue;

!
! INCLUDE FILES:
!


!
! MACROS:
!

!
! EQUATED SYMBOLS:
!

!
! OWN STORAGE:
!

!
! EXTERNAL REFERENCES:
!

external routine
    XPEDB: novalue,
    TLIDB: novalue,
    DECTIM: novalue,
    UPDTIM: novalue,
    HELLO: LINKAGE_DB novalue,
    TLITIM: novalue;

external $XPTLL: vector;
global
routine XPTTIM (XPTDB,MODIFIER): MCB_DB_MOD novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  Dispatch FC_TIM related services
!
! FORMAL PARAMETERS
!
!	XPTDB   	Address of Transport data base
!	MODIFIER	Modifier code
!
! IMPLICIT INPUTS
!
!	?
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!
!--

begin
require 'XPTSYM';
external routine $DSPCR;
DISPATCH$(.MODIFIER,TABLE$($DSPCR,FD_TIM,
    (FM_PIN, TIMPIN),
    (FM_LTM, TIMLTM)),(.XPTDB),MCB_DB);
end;				!End of XPTTIM
routine TIMLTM (XPTDB): MCB_DB novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  This routine is called once every time interval.  It updates
!  all the timers except T6 (which is updated in Transport Line
!  Interface), and then calls all of the routines in the indivi-
!  dual Transport modules which do timer processing.  In addition,
!  it redispatches all the CCBs on the retry queue.
!
! FORMAL PARAMETERS
!
!	XPTDB   	Address of Transport data base
!
! IMPLICIT INPUTS
!
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	See the timer routines for each module.
!
!--

begin
require 'XPTSYM';
!
!  Re-request a one-second timer interrupt
!
Timer = .Timer + 1;
!
!  Call the module timer routines
!

if .Routing_clock neq 0
then if (Routing_clock = .Routing_clock - 1) eql 0 
     then begin
          Routing_clock = .Routing_timer;
          CALL$E(DECTIM,PD_XPE);        ! Check the routing data base
          end;

if .Update_clock neq 0
then if (Update_clock = .Update_clock - 1) eql 0
     then begin
          Update_clock = .Update_timer;
          CALL$E(UPDTIM,PD_XPE);        ! Routing timer
          end;

$XPT_for_each_LINEb_do_begin

    if .Hello_clock neq 0
    then if (Hello_clock = .Hello_clock - 1) eql 0
         then begin
              Hello_clock = .Hello_timer;
              Send_hello = true;
              end;

    if .Service_line
    then begin
         Service_line = false;
         if BITON(.XPTflags,Running)
         then CALL$P(INI_LIN,PD_TLI,.LINEb)
         else CALL$P(TERM_LIN,PD_TLI,.LINEb);
         end;

    If .Send_hello
    then HELLO(.LINEb);

$XPT_next_LINEb_end;

CALL$P(TLITIM,PD_TLI);                  ! Listen timers

!
!  Redispatch the contents of the retry queue
!

while true do begin
    local CCB : ref block field (C_FIELDS);
    if not $MCB_DEQUEUE_CCB(REqueue,CCB) then exitloop;
    clearbit(XPTflags,Rfail);		! Clear "resource failure" flag
    REqueue_count = .REqueue_count - 1;	! Decrement retry queue length
    DISPATCH$(.CCB[C_FNC],$XPTLL,(.XPTDB,.CCB,.CCB[C_MOD]),MCB_DB_CCB_MOD);
                                        ! Dispatch the CCB
    if biton(.XPTflags,Rfail) then	! If a resource failure occured,
	exitloop;                       !   quit
    end;

end;				!End of TIMLTM
routine TIMPIN (XPTDB): MCB_DB novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!  This routine is called during process initialization
!
! FORMAL PARAMETERS
!
!	XPTDB   	Address of Transport data base
!
! IMPLICIT INPUTS
!
!	?
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!--

begin

macro RAD50(NAME) =
    %IF %bliss(BLISS36) %THEN
	%RAD50_10 %string(NAME)
    %ELSE
	%RAD50_11 %string(NAME)
    %FI %;
require 'XPTSYM';

!
!  Initialization entry point:
!	. Get PIXes for TLI, XPE, NMX, and XPT itself
!	. Get Transport data base address and distribute it to
!	  TLI and XPE
!

    XPTDB[XPTxpt]=GET_PIX(rad50(XPT));	! Pick up
    XPTDB[XPTxpe]=GET_PIX(rad50(XPE));	!   processes
    XPTDB[XPTtli]=GET_PIX(rad50(TLI));	!   PIXes for
    XPTDB[XPTnm]=GET_PIX(rad50(NMX));	!   communicating
    CALL$P(XPEDB,PD_XPE,.XPTDB);	! Give the data base address
    CALL$P(TLIDB,PD_TLI,.XPTDB);	!   to XPE and TLI

end;				!End of TIMPIN
routine GET_PIX (NAME) =

!++
! FUNCTIONAL DESCRIPTION:
!
!  Get the process index for the given process name
!
! FORMAL PARAMETERS
!
!	NAME   	RAD50 name of desired process
!
! IMPLICIT INPUTS
!
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	None
!
!--

begin
local PIX;
if $MCB_GET_PROCESS_HANDLE (.NAME,PIX) then .PIX else 0
end;				!End of GET_PIX
routine GETNLN: novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
! Puts the value of NLN from the data base into an OWN intermediate
! location (for the use of STRUCTURE references and such, which cannot
! reference BOUND variables)
!
! FORMAL PARAMETERS
!
!	NONE.
!
! IMPLICIT INPUTS
!
!	NONE.
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	NONE.
!
!--

begin

require 'XPTSYM';

0;      		! This routine now has no function.

end;				!End of GETNLN
global
routine RE_QUEUE (CCB): novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
! Puts a CCB on the retry queue.  The CCB will be redispatched the next
! time XPTTIM is called (on a timer interval).
!
! FORMAL PARAMETERS
!
!	CCB	CCB to be put on the retry queue. It must be a CCB which
!		was dispatched to Transport by another process, in the
!		same condition as when it was dispatched.
!
! IMPLICIT INPUTS
!
!	REqueue
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
!	NONE.
!
! SIDE EFFECTS:
!
!	The CCB will be redispatched at some time in the future.
!
!--

begin

local LINEb;
require 'XPTSYM';
map CCB: ref block field(C_fields);

setbit(XPTflags,Rfail);			! Flag a recoverable resource failure
$MCB_QUEUE_CCB(REqueue,.CCB);           ! Chain in the CCB
REqueue_count = .REqueue_count + 1;	! Increment retry queue length
if .CCB[C_FNC] eql FC_RCP then begin	! Adjust buffer input count
    LINEb = $XPT_GET_LINE_DB(.CCB[C_LIX]); !   and global input quota
    INPUTcount = .INPUTcount - 1;	!   as if the buffer
    DLLquota = .DLLquota + 1;		!   were terminated
    end
else BPT(XPT$_REQU);

end;				!End of RE_QUEUE

end				!End of module XPTTIM
eludom