*DECK NPESTOF
USETEXT NIPDEF
USETEXT BACKBUF
USETEXT CET
USETEXT NBT
USETEXT PIT
USETEXT PT
USETEXT PARAMP
USETEXT KDIS
USETEXT NHEADER
USETEXT DRHDR
USETEXT KSTTAB
PRGM NPESTOF;
STARTIMS;
#
*1DC NPESTOF
*
*
* 1. PROC NAME AUTHOR DATE
* NPESTOF C. BITTNER 82/06/18
*
* 2. FUNCTIONAL DESCRIPTION
* PROCESS EST/OFF
*
* 3. METHOD USED
* UPDATE NUMBER OF ON AND OFF ENTRIES IN CET
* UPDATE NUMBER OF ACTIVE AND FREE ENTRIES IN NBT
* CLEAR NBTE ENTRY IN PIT
*
* 4. ENTRY PARAMETERS
* PARAMP1 - SM BUFFER (EST/OFF)
*
* 5. EXIT PARAMETERS
* PARAMP2 - IF NON-ZERO THEN BAD BLOCK
*
* 6. SYMPL TEXTS USED
* BACKBUF SPECIAL BUFFER FOR DOWNLINE BACKS
* NIPDEF CET
* NBT PIT
* PT PARAMP
* KDIS
* NHEADER DRHDR
*
* 7. ROUTINES CALLED
* KDEL - UPDATE K-DISPLAY
* XTRACE - TRACE PROCEDURE CALL
* MRELS - RELEASE BUFFER
*
* 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
* THIS PROGRAM IS CALLED BY NPNIPSM
* W A R N I N G - THIS PROGRAM CANNOT EXCEED THE PRIMARY
*CALL OPSIZE
*
#
STOPIMS;
#
PARAMP1 - SM BUFFER (EST/OFF)
EXIT PARAMETER
PARAMP2 - IF NON-ZERO THEN BAD BLK
#
#
EXTERNAL VARIABLES
#
XREF
BEGIN
PROC BLDKWL; # FORMAT KWL TO DELETE EST ENTRY FROM ST #
PROC XTRACE; # TRACE PROCEDURE CALL #
PROC MRELS ;
LABEL RJMAIN; # RETURN ADDRESS IN OVLCALL #
END
#
INTERNAL VARIABLES
#
ITEM NBTIND; # CURRENT INDEX INTO NBT INPUT FET #
ITEM PITIND; # CURRENT INDEX INTO PIT #
ITEM FOUND B; # CET ENTRY FOUND FLAG #
ITEM IDXCET; # CET ENTRY INDEX #
ITEM PIPNO; # PIP NUMBER TO MATCH #
ITEM I; # LOOP VARIABLE #
ITEM TEMP ; # LOOP VARIABLE #
BASED ARRAY PITNBTW S(1); # TEMPLATE FOR NBT ENTRY WD IN PIT #
BEGIN
ITEM PITNBTWH B(00,00,01); # HALT NPU FLAG #
ITEM PITNBTWE U(00,30,06); # NBT TABLE ENTRY INDEX #
ITEM PITNBTWA I(00,42,18); # NBT ENTRY ADDRESS #
END
#**********************************************************************#
BEGIN
CONTROL IFEQ DEBUG,1;
XTRACE("ESTOF");
CONTROL FI;
P<NHEADER> = PARAMP1 + BLKHSIZE;
FOUND = FALSE;
FOR I = 0 STEP NBTFETNO WHILE NOT FOUND AND
I LQ NBTMAXID
DO # SEARCH NBT FOR MATCHING COUPLER NODE #
BEGIN
IF NBTIUF[I] AND NBTHN[I] EQ DN[0]
THEN
BEGIN # FOUND NBT ENTRY #
FOUND = TRUE;
NBTIND = I; # SAVE NBT INDEX #
END
END
IF FOUND
THEN
BEGIN # NBT FOUND #
#
UPDATE CET
#
FOUND = FALSE;
FOR IDXCET = CETHSIZE WHILE NOT FOUND AND
IDXCET LS CETBS[0] DO
BEGIN
IF CETEST[IDXCET] EQ NBTEST[NBTIND]
THEN
FOUND = TRUE;
ELSE
IDXCET = IDXCET + 1;
END
IF FOUND AND NOT CETOFF[IDXCET]
THEN
BEGIN # CET ENTRY FOUND #
CETNON[0] = CETNON[0] - 1; # DECREM NO. OF ON ENTRIES #
CETNOFF[0] = CETNOFF[0] + 1; # INCREM NO. OF OFF ENTRIES #
# CORRECT CET ENTRY WAS FOUND #
CETOFF[IDXCET] = TRUE; # SET OFF COUPLER FLAG #
PIPNO = CETPIP[IDXCET];
# UPDATE NBT #
NBTNAE[0] = NBTNAE[0] - 1; # UPDATE NO. ACTIVE ENTRIES #
NBTNFE[0] = NBTNFE[0] + 1; # UPDATE NO. FREE ENTRIES #
#
RELEASE ACTIVE INBOUND BUFFER(S) ASSOCIATED WITH THE
OFF NPU ENTRY
#
FOR I=NBTIND STEP 1 UNTIL NBTIND+1
DO
BEGIN
IF NBTBFS[I] # BUFFER AVAILABLE OR ACTIVE OR RELEASABLE #
AND NBTOUT[I] NQ 0 # INBOUND BUFFER EXISTS #
THEN # RELEASE THE INBOUND BUFFER #
BEGIN
P<DRHDRWD> = NBTOUT[I];
NBTBFS[I] = FALSE; # CLEAR ACTIVE BUFFER FLAGS #
IF P<DRHDRWD> EQ PARAMP1
THEN # CURRENT INBOUND BUFFER, CANNOT RELEASE EST/OFF #
BEGIN # FAKE IN=OUT TO TERMINATE NEIB PROCESSING #
NBTIN[I] = P<DRHDRWD> + BLKBS[0];
NBTBRF[I] = TRUE; # SET BUFFER RELEASE FLAG #
END
ELSE
BEGIN # RELEASE INBOUND BUFFER #
BLKBS[0] = NBTLIMIT[I] - P<DRHDRWD>; # BUFFER SIZE #
MRELS(P<DRHDRWD>); # RELEASE BUFFER #
NBTIN[I] = NBTLIMIT[I];
NBTOUT[I] = NBTLIMIT[I];
END
END
END
#
RELEASE ALL DOWN LINE MESSAGES (ALWAYS AT LEAST ONE)
#
FOR I = NBTIND+2 STEP 1 UNTIL NBTIND+4 DO
BEGIN
P<DRHDRWD> = NBTFIRST[I];
FOR TEMP = TEMP WHILE P<DRHDRWD> NQ 0 # WE DID NOT PASS #
DO
BEGIN
TEMP = NEXTPTR[0] ; # NEXT DOWN-LINE MESSAGE #
IF (P<DRHDRWD> LS BACKBLWA) AND
(P<DRHDRWD> GQ BACKBFWA)
THEN # THIS IS BACK ENTRY IN BACK BUFFER #
BEGIN
P<DRHDRWD> = P<DRHDRWD> - 1; # 1ST WD OF BCK BUF ENTRY#
CMWORD[0] = BACKFFREE; # PTR TO NEXT FREE ENTRY #
BACKFFREE = P<DRHDRWD>; # NEW FIRST FREE ENTRY #
END
ELSE # THIS IS REGULAR DYNAMIC BUFFER #
BEGIN
MRELS(P<DRHDRWD>); # RELEASE BUFFER #
END
P<DRHDRWD> = TEMP ;
END
NBTFIRST[I] = 0 ;
NBTIN [I] = 0 ;
NBTOUT [I] = 0 ;
END
#
RELEASE PIP TRACE BUFFER IF ONE EXISTS
#
I=NBTIND+5; # PIP TRACE FET INDEX #
IF NBTFIRST[I] NQ 0
THEN # PIP TRACE BUFFER EXISTS #
BEGIN
MRELS(NBTFIRST[I]-BLKHSIZE);
NBTWD1[I] = 0; # CLEAR TRACE NBT BUFFER INCLUDING FLAGS #
NBTWD2[I] = 0;
NBTWD3[I] = 0;
NBTWD4[I] = 0;
END
IF KDST[0]
THEN # STATUS DISPLAY ON, DELETE EST ENTRY FROM DISPLAY #
BLDKWL(KST"EST",NBTKNDX[NBTIND],0,KDELIDVALUE);
#
UPDATE PIT ENTRY
#
P<PITNBTW> = LOC(PITNBTE1[PIPNO]); # ADR OF 1ST NBTE ENTRY #
FOR I = 0 STEP 1 UNTIL MAXNPU-1
DO # CHECK ALL NBTE SLOTS IN PIT ENTRY #
BEGIN
IF PITNBTWE[I] EQ (NBTINDX[NBTIND] + 1)
THEN # FOUND NBTE ENTRY #
BEGIN
PITNBTWH[I] = FALSE; # CLEAR HALT NPU FLAG #
PITNBTWE[I] = 0; # CLEAR NBT TABLE ENTRY INDEX #
PITNBTWA[I] = 0; # CLEAR NBT TABLE ENTRY ADDRESS #
END
END
END
NBTIUF[NBTIND] = FALSE; # CLEAR NBT IN USE FLAG #
END
GOTO RJMAIN;
END
TERM