*DECK CSTSNR
USETEXT TEXTCS
USETEXT TXTCTCS
USETEXT TXTSMCS
USETEXT TXTAPSS
USETEXT TXTSUSS
PROC CSTSNR (SWTESS);
# TITLE CSTSNR - START NCF READ REQUESTS. #
BEGIN # CSTSNR #
#
** CSTSNR - START NCF READ REQUESTS.
*
* D. G. DEPEW. 81/08/06.
*
* THIS PROCEDURE INITIATES THE READING OF THE NCF LINE RECORD
* REQUIRED TO PROCESS A CONFIGURE TERMINAL REQUEST (CNF/TE/R SM)
* FROM AN NPU.
*
* PROC CSTSNR (SWTESS)
*
* ENTRY THE CONFIGURE TERMINAL REQUEST QUEUE CONTAINS ONE OR MORE
* CNF/TE/R SMS EXCEPT FOR A SINGLE, FIRST TIME CALL MADE
* DURING INITIALIZATION AT WHICH TIME THE QUEUE IS EMPTY.
* THE NCF READ REQUESTS QUEUE IS EMPTY.
*
* EXIT A CIO READLS FUNCTION IS ISSUED FOR UP TO 10 LINE RECORDS.
* THE CORRESPONDING ENTRIES HAVE BEEN MADE IN THE NCF READ
* REQUESTS QUEUE.
* A CNF/TE/A SM IS PLACED IN THE OUTGOING TRAFFIC QUEUE IF
* THE LINE CANNOT BE LOCATED IN THE LINE RECORD INDEX
* (THIS SHOULD NEVER HAPPEN).
* FORMAL ARRAY SWTESS IS SET SO THAT PROC CSTRND IS CALLED
* WHEN THE NCF FET COMPLETE BIT IS SET OR THE IN POINTER
* CHANGES.
* ALL CONFIGURE TERMINAL REQUEST QUEUE ENTRIES THAT GET
* PROCESSED ARE DELETED FROM THAT QUEUE.
* FOR THE INITIALIZATION CALL AND FOR THE HOPEFULLY
* IMPOSSIBLE CIRCUMSTANCE WHEREIN NONE OF THE LINES FOR
* WHICH CNF/TE/R SMS HAVE BEEN RECEIVED CAN BE LOCATED IN
* THE LINE RECORD INDEX, FORMAL ARRAY SWTESS IS SET SUCH
* THAT THIS ROUTINE WILL AGAIN BE CALLED WHEN AN ENTRY IS
* MADE IN THE CONFIGURE TERMINAL REQUEST QUEUE.
*
* NOTES THIS ROUTINE COMBINES THE LOGIC OF CS GID PROCESSES 4.2
* AND 4.3. THIS WAS DONE BECAUSE THOSE PROCESSES ARE
* SHORT, IT SAVES SOME DATA SHUFFLING, AND IT MAKE CS MORE
* RESPONSIVE TO THE CONFIGURE TERMINAL REQUEST QUEUE.
#
*CALL SWTESS
#
**** PROC CSTSNR - XREF LIST BEGIN.
#
XREF
BEGIN
PROC CSTRND; #RECEIVE NCF DATA #
PROC MOVE; #MOVE STORAGE DIRECT ADDRESSING (MACREL) #
PROC READLS; #ISSUE CIO READLS FUNCTION (MACREL) #
PROC SSTAQE; #ACCEPT QUEUE ENTRY #
PROC SSTATS; #ALLOCATE STORAGE AT END OF TABLE #
PROC SSTRTS; #REMOVE STORAGE ANYWHERE IN TABLE #
PROC XSST; #SHELL SORT TBL IN ASCENDING ORDER(MACREL)#
END
#
****
#
ITEM I; #LOOP INDUCTION VARIABLE #
ITEM LORD; #LINE RECORD INDEX ENTRY ORDINAL #
ITEM QORD; #CALCULATED ORDINAL OF ANY DESIRED Q ENTRY#
ITEM WC; #WORD COUNT OF CTQ/NRQ ENTRIES #
ARRAY LRIKEY [00:00] S(1); #LINE RECORD INDEX SEARCH KEY #
BEGIN
ITEM LK$WORD U(00,00,60); #WHOLE WORD FOR ACTUAL SEARCH KEY#
ITEM LK$NPUID U(00,44,08); #NPU NODE ID TO SEARCH LRI FOR #
ITEM LK$PORT U(00,52,08); #PORT NUMBER TO SEARCH LRI FOR #
END
RLCOUNT = 0; # INITIALIZE COUNT OF RECORDS TO BE READ #
FOR I=0 WHILE CTQL NQ 0
AND RLCOUNT LS RLMAX$
DO # LOOP UNTIL CTQ EMPTY OR 10 RECS TO READ #
BEGIN
WC = CTQ$ESIZE[0]; # SET SIZE OF CURRENT ENTRY #
LK$WORD[0] = 0;
LK$NPUID[0] = CTQ$NPUID[0]; # SET UP TO SEARCH LINE REC INDEX #
LK$PORT[0] = CTQ$PORT[0];
FOR LORD=0 STEP 1 # SEARCH LRI FOR LARGER NPU/PORT COMBO #
WHILE LK$WORD[0] GQ LIKEY[LORD]
DO
BEGIN END
LORD = LORD - 1; # DESIRED NTRY ONE BEFORE LARGER NPU/PORT #
IF CTQ$NPUID[0] EQ LINID[LORD]
AND CTQ$PORT[0] LQ (LIPORT[LORD] + LIGC[LORD])
THEN # NPU NODE ID AND PORT NUMBER ARE VALID #
BEGIN # PREPARE FOR ISSUANCE OF NCF READ REQUEST#
RLI$RPA[RLCOUNT] = LIRPA[LORD]; # SET UP READ LIST INDEX #
RLI$LRIORD[RLCOUNT] = LORD;
RLCOUNT = RLCOUNT + 1;
QORD = NRQL; # SAVE ORD OF NEXT NCF READ QUEUE ENTRY #
SSTATS (P<NRQ>, WC); # ADD NEW ENTRY SPACE TO NCF READ Q #
MOVE (WC, CTQ, NRQ[QORD]); # MAKE THE ENTRY #
NRQ$LRIORD[QORD] = LORD; # COMPLETE NCF READ QUEUE ENTRY #
END
ELSE # BOGUS CNF/TE/R SM RECEIVED #
BEGIN # ISSUE CNF/TE/A #
# THE FOLLOWING CODE REFERENCES ITEMS IN TWO BASED ARRAYS, *CSSM* #
# (IN TXTSMCS) AND *APSM* (IN TXTAPSS), THAT DEFINE DIFFERENT PARTS#
# OF THE BODY OF ANY SM CS MAY SEND OR RECEIVE. THESE TWO BASED #
# ARRAYS ARE POINTED TO THE SM BUFFER, *MSGBUF* (IN TEXTSS), AT #
# INITIALIZATION TIME. ALSO, BASED ARRAY *ABH* (IN TXTAPSS) IS #
# USED, WHICH AGAIN IS POINTED TO THE ABH BUFFER, *ABHBUF* (IN #
# TEXTSS), AT INITIALIZATION TIME. SINCE THESE BASED ARRAYS ARE #
# PREPOINTED, THIS PROC DOES NOT REQUIRE TEXTSS. #
ABHWORD[1] = CTQ$WORD[1]; # SET UP OUTGOING ABH #
ABHSN[1] = ABHDN[1]; # REVERSE DN AND SN FOR RESPONSE SM #
ABHDN[1] = CTQ$NPUID[0]; # DESTINATION #
ABHTLC[1] = NCNFA; # DEFINED IN TXTSMCS. ABH COMPLETE #
SPMSG0[1] = 0; # SET UP CNF/TE/A SM BODY #
PFCSFC[1] = CNFTEA; # DEFINED IN TXTSUSS #
CNFP[1] = CTQ$PORT[0]; # SM BODY COMPLETE #
SSTAQE (P<OTQ>, CTEAQL$, ABH[1], CSSM[1]); # QUEUE CNF/TE/A#
END
SSTRTS (P<CTQ>, 0, WC); # DELETE 1ST ENTRY IN CNF/TE/R QUEUE #
END
IF RLCOUNT NQ 0
THEN # THERE ARE TERMINALS TO CONFIGURE #
BEGIN # PREPARE AND ISSUE READLS FUNCTION #
XSST (RLI, RLCOUNT); # SORT THE READ LIST INDEX #
FOR I=0 STEP 1 UNTIL RLCOUNT-1
DO # SET UP ACTUAL READ LIST FOR READLS FUNC #
RL$RPA[I] = RLI$RPA[I];
RL$RPA[RLCOUNT] = 0; # INDICATE END OF READ LIST #
RLIORD = 0; # INITIALIZE POINTER TO CURRENT RLI ENTRY #
NF$LA[0] = LOC (READLIST); # STORE READ LIST ADDRESS IN FET #
READLS (NCFFET); # ISSUE READLS FUNCTION #
# SET UP FORMAL RETURN PARAMETER ARRAY SWTESS. #
STE$ADDR1[0] = LOC (NCFFET); # WATCH COMP BIT IN 1ST WD OF FET#
STE$ADDR2[0] = LOC (NF$IN[0]); # WATCH FET IN POINTER #
STE$RTN[0] = LOC (CSTRND); # RECEIVER OF NCF LINE RECORDS #
STE$INIT1[0] = NF$WORD[0]; # SET UP INIT VALUE OF FET 1ST WD #
STE$CBIT1[0] = FALSE; # CALL *CSTRND* WHEN FET COMP BIT IS SET#
STE$INIT2[0] = NF$OUT[0]; # CALL *CSTRND* WHEN *IN* NQ *OUT* #
END
ELSE # ALL CNF/TE/R SMS WERE INVALID (YUK) OR #
BEGIN # THIS IS INITIALIZATION CALL #
ICSTSNR = 0; # INSURE INTERRUPT CELL IS CLEAR #
STE$ADDR1[0] = LOC (ICSTSNR); # WATCH INTERRUPT CELL #
STE$ADDR2[0] = 0; # ONLY WATCHING ONE CELL #
STE$RTN[0] = LOC (CSTSNR); # RECALL THIS ROUTINE #
STE$INIT1[0] = 0; # CALL WHEN ENTRIES IN CNF/TE/R Q NONZERO #
STE$INIT2[0] = 0;
END
END # CSTSNR #
TERM