*DECK XCHKABC
USETEXT NIPDEF
USETEXT FREETAB
USETEXT PARAMP
USETEXT PIT
USETEXT PRUBUFF
USETEXT SYSTIME
PRGM XCHKABC ;
STARTIMS ;
#
*1DC
* 1. PROC NAME AUTHOR DATE
* XCHKABC E. GEE 85/05/04
*
* 2. FUNCTIONAL DISCRIPTION:
* ALLOCATE PRU BUFFERS FOR PIP.
*
* 3. METHOD USED:
* LOOP CHECKING PIT ENTRY FOR EACH SIZE OF PRU BUFFER
* IF BUFFERS NEEDED,
* CALL MGETS TO ALLOCATE PRU BUFFER.
* INITIALIZE PRU BUFFER.
* LINK BUFFERS TOGETHER.
*
* 4. INPUT PARAMS:
* PARAMP1 PIT ENTRY INDEX
*
* 5. EXIT PARAMS :
* NONE.
*
* 6. COMMON DECKS AND SYMPL TEXTS USED.
* NIPDEF CONSTANT DEFINITIONS
* FREETAB FREE BUFFER TABLE
* PARAMP BUFFER FOR PASSING PARAMS TO PRIMARY OVLS
* PIT PIP INTERFACE TABLE TEMPLATE
* PRUBUFF PRU BUFFER TEMPLATE
* SYSTIME SYSTEM TIME TABLE
*
* 7. ROUTINES CALLED:
* MGETS TO GET BUFFER.
* XTRACE TRACE PROCEDURE CALL.
*
* 8. DAYFILE MESSAGES OR OTHER IMPORTANT INFORMATION.
* THIS PROGRAM IS A PRIMARY OVERLAY LOADED BY SUBROUTINE
* OVLCALL. WHEN EXECUTION HAS COMPLETED, A JUMP IS MADE TO
* LOCATION RJMAIN TO RETURN TO THE CALLING PROGRAM.
*
* W A R N I N G - THIS PROGRAM CANNOT EXCEED THE PRIMARY
* OVERLAY BUFFER SIZE MINUS 5 (560B WORDS).
*
* THIS OVERLAY IS CALLED BY XEXEC.
#
STOPIMS;
XREF
BEGIN
PROC MGETS; # GET BUFFER #
PROC XTRACE; # TRACE PROCEDURE CALL #
LABEL RJMAIN; # RETURN ADDRESS IN OVLCALL #
END
#
INTERNAL VARIABLES
#
ITEM BUFFER; # NEWLY ALLOCATED PRU BUFFER #
ITEM FIRSTBUF; # ADDR OF FIRST BUF ALLOCATED #
ITEM I; # INDUCTION VARIABLE #
ITEM J; # INDUCTION VARIABLE #
ITEM K; # INDUCTION VARIABLE #
ITEM L; # INDUCTION VARIABLE #
ITEM NUMALLOC; # NUMBER OF PRU BUFFERS ALLOCATD#
ITEM TEMP1; # ADDR OF NEXT PRU BUF IN CHAIN #
ITEM TMP; # FWA OF CIO BUFFER IN PRU BUF #
BASED ARRAY PRUNIPWD S(1); # TEMPLATE FOR NIP WORD IN PIT #
BEGIN
ITEM PRUNIPMFB U(0,00,06); # MINIMUM NO OF PRU BUFS #
ITEM PRUNIPMAB U(0,06,06); # MAXIMUM NO OF PRU BUFS #
ITEM PRUNIPNCA U(0,12,12); # CURRENT NO OF BUFFERS ASSIGNED#
ITEM PRUNIPNC U(0,24,12); # CURRENT NO OF PRU CONNECTIONS #
ITEM PRUNIPFPB U(0,42,18); # ADR OF FIRST BUF IN FREE CHAIN#
END
BASED ARRAY PRUPIPWD S(1); # TEMPLATE FOR PIP WORD IN PIT #
BEGIN
ITEM PRUPIPNFB U(0,00,12); # NO OF BUFS IN FREE CHAIN #
ITEM PRUPIPNRA U(0,12,12); # NO OF BUS NEEDED BY PIP #
ITEM PRUPIPRPB U(0,42,18); # ADDR OF BUF TO RELEASE #
END
#**********************************************************************#
CONTROL EJECT;
BEGIN # BEGIN XCHKABC #
CONTROL IFEQ DEBUG,1;
XTRACE("XCHKA");
CONTROL FI;
#
CHECK EACH PIT ENTRY
#
FOR L = 1 STEP 1 UNTIL MAXPIP
DO
BEGIN
P<PRUNIPWD> = LOC(PITW5[L])-1;
P<PRUPIPWD> = LOC(PITW8[L])-1;
#
CHECK EACH SIZE OF PRU BUFFER
#
FOR I = 1 STEP 1 UNTIL MAXPRU
DO # PROCESS EACH SIZE OF PRU BUF #
BEGIN
J = PRUPIPNRA[I] - PRUNIPNCA[I]; # NO OF BUFFERS PIP NEEDS #
IF PRUPIPNRA[I] GR PRUNIPMAB[I]
THEN # PIP NEEDS MORE BUF THAN MAX #
BEGIN
J = PRUNIPMAB[I] - PRUNIPNCA[I]; # MAX NO THAT CAN BE ADDED #
END
IF J GR 0
THEN # PRU BUFFERS NEED TO BE ALLOCAT#
#
ALLOCATE PRU BUFFERS
#
BEGIN
NUMALLOC = 0; # INITIALIZE NO OF BUFS ALLOCATD#
TEMP1 = 0; # INIT ADDR OF PREV ALLOCATD BUF#
FOR K = 1 STEP 1 WHILE K LQ J AND HRL EQ HRLV3
DO # ALLOCATE PRU BUFFER #
BEGIN
NUMALLOC = NUMALLOC + 1; # INCREMENT NO OF BUFS ALLOCATED#
MGETS(PBHSIZE + I*PRUSIZE + I,BUFFER,TRUE);
# ALLOCATE BUFFER FOR EACH SIZE #
# FOR 1 PRU BUFFER SIZE = 102 #
# FOR 2 PRU BUFFER SIZE = 204 #
# FOR 3 PRU BUFFER SIZE = 306 #
#
SET UP PRU BUFFERS AND LINK TOGETHER
#
IF TEMP1 EQ 0
THEN # THIS IS FIRST BUF ALLOCATED #
BEGIN
FIRSTBUF = BUFFER; # ADDR OF FIRST BUF ALLOCATED #
END
P<PRUBUFF> = BUFFER;
PRUBID[0] = PRUBIDVALUE;
PRUBPBS[0] = I - 1;
PRUBTBA[0] = MSECS[0];
PRUBUP[0] = TRUE; # SET USER PROCESSING BIT #
PRUBEP[0] = TRUE; # SET ERROR PROCESSING BIT #
PRUBFETL[0] = 2;
TMP = P<PRUBUFF> + PBHSIZE - 1;
PRUBFIRST[0] = TMP;
PRUBIN[0] = TMP;
PRUBOUT[0] = TMP;
PRUBLIMIT[0] = P<PRUBUFF> + PRUBBS[0];
PRUBDLFP[0] = TEMP1; # POINTER TO NEXT BUF IN CHAIN #
TEMP1 = BUFFER;
END
IF TEMP1 NQ 0
THEN # AT LEAST ONE BUF WAS ALLOCATED#
BEGIN
P<PRUBUFF> = FIRSTBUF; # ADDR OF FIRST ALLOCATED BUF #
PRUBDLFP[0] = PRUNIPFPB[I];# ADDR OF FIRST BUF IN CHAIN #
PRUNIPFPB[I] = BUFFER; # ADDR OF NEW FIRST BUF IN CHAIN#
PRUNIPNCA[I] = PRUNIPNCA[I] + NUMALLOC; # UPDATE PIT FIELD#
END
END
END
END
GOTO RJMAIN ; # RETURN TO CALLING PROGRAM #
END # END XCHKABC #
TERM