Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/mcb/nmlib.r16
There are no other files named nmlib.r16 in the archive.
! [Beginning of NMLIB]
!
!
!                    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: MCB Network Management Support
!
! ABSTRACT:
!
!	This contains common definitions for driver Network Management support.
!
! ENVIRONMENT: MCB V3.0
!
! AUTHOR: Alan D. Peckham	CREATION DATE: 4-Sep-81
!
! MODIFIED BY:
!
!	Alan D. Peckham, 4-Sep-81: Version 1
! 01	- New Library.
!--

%if not %declared (XPO$K_VERSION) %then library 'MCB:XPORTX'; %fi

%if not %declared (MCB$K_VERSION) %then library 'MCB:MCBLIB'; %fi

!
! Linkages
!

linkage
    NM_LL_CTR = jsr (register = 0, register = 1),
    NM_LL_NUM = jsr (standard, register = 0, register = 1),
    NM_LL_PRM = jsr (register = 0, register = 1),
    NM_LL_RSP = jsr (register = 4),
    NM_LL_TIM = jsr (register = 0);

!
! Event Logging
!

macro
    $NM$COUNTER_ROUTINE (NAM, NUM) =
	begin
	external routine %name ('$D', NAM) : NM_LL_NUM novalue;
	%name ('$D', NAM) (NUM, %remaining)
	end %,
    $NM$DISPATCHES [ENTRY] =
	$NM$ENTRY_1 (%remove (ENTRY)) %,
    $NM$ENTRY_0 (VAL0, VAL1) =
	VAL0 %,
    $NM$ENTRY_1 (VAL0, VAL1) =
	VAL1 %,
    $NM$PARAMETER [RTN] =
	RTN; %,
    $NM$PARAMETER_ROUTINE (NAM, NUM) =
	%if not %null (NUM)
	%then
	    begin
	    external routine %name ('$D', NAM) : NM_LL_NUM novalue;
	    %name ('$D', NAM) (NUM, %remaining)
	    end
	%else
	    begin
	    external routine %name ('$T', NAM) : NM_LL_PRM novalue;
	    %name ('$T', NAM) (%remaining)
	    end
	%fi %,
    $NM$PARAMETERS [ENTRY] =
	$NM$ENTRY_0 (%remove (ENTRY)) %,
    $NM_DLL_EVENT (CODE, ENTITY) =
	begin
	$NM_LOG_BEGIN ();
	$NM$PARAMETER (%remaining)
	$NM_LOG_END (5^6 + CODE, ENTITY);
	end %,
    $NM_LOG_BEGIN (DUMMY) =
	begin

	external routine
	    %name ('$NLBEG') : NM_LL_PRM novalue;

	%name ('$NLBEG') ();
	end %,
    $NM_LOG_END (CODE, ENTITY) =
	begin

	external routine
	    %name ('$NLEND') : NM_LL_PRM novalue;

	%name ('$NLEND') (CODE, ENTITY);
	end %,
    $NM_PARAMETER_DISPATCH (PRM, DFLT, DISP, ARGS, LNKG) =
	%if %null (LNKG) %then bliss %else LNKG %fi (
	    .(uplit (DFLT, $NM$DISPATCHES (%remove (DISP))) +
		$MCB_MATCH_VALUE (PRM, plit ($NM$PARAMETERS (%remove (DISP))))
		%if %bliss (bliss16) %then ^1 %else *%upval %fi),
	    %remove (ARGS)) %,
    $NM_PLL_EVENT (CODE, ENTITY) =
	begin
	$NM_LOG_BEGIN ();
	$NM$PARAMETER (%remaining)
	$NM_LOG_END (6^6 + CODE, ENTITY);
	end %,
    $NM_RESPONSE_BEGIN (CCB) =
	begin

	external routine
	    %name ('$NRBEG') : NM_LL_RSP novalue;

	%name ('$NRBEG') (CCB);
	end %,
    $NM_RESPONSE_END (CCB) =
	begin

	external routine
	    %name ('$NREND') : NM_LL_RSP novalue;

	%name ('$NREND') (CCB);
	end %,
    $NM_TIME (BUF) =
	begin

	external routine
	    %name ('$ST32') : NM_LL_TIM novalue;

	%name ('$ST32') (BUF);
	end %;

macro
    COUNTER_16 (NUM, ADR) =
	$NM$COUNTER_ROUTINE (C16, 1^15 + 2^13 + NUM, .(ADR) <0, 2*8, 1>) %,
    COUNTER_32 (NUM, ADR) =
	$NM$COUNTER_ROUTINE (C32, 1^15 + 3^13 + NUM, ch$ptr (ADR,, 8)) %,
    COUNTER_8 (NUM, ADR) =
	$NM$COUNTER_ROUTINE (C8, 1^15 + 1^13 + NUM, .(ADR) <0, 8, 1>) %,
    COUNTER_8_BM (NUM, ADR) =
	$NM$COUNTER_ROUTINE (C8B, 1^15 + 1^13 + 1^12 + NUM, .(ADR) <0, 2*8, 1>) %,
    COUNTER_16_TIME (NUM, ADR) =
	$NM$COUNTER_ROUTINE (T16, 1^15 + 2^13 + NUM, ch$ptr (ADR,, 8)) %,
    PARAMETER_AI (NUM, CNT, ADR) =
	$NM$PARAMETER_ROUTINE (PAI, NUM, CNT, ADR) %,
    PARAMETER_C_1 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PC1, NUM, .(ADR) <0, 8, 1>) %,
    PARAMETER_C_2 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PC2, NUM, .(ADR) <0, 2*8, 1>) %,
    PARAMETER_CM (NUM, CNT) =
	$NM$PARAMETER_ROUTINE (PCM, NUM, CNT) %,
    PARAMETER_DS_1 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PDS1, NUM, .(ADR) <0, 8, 1>) %,
    PARAMETER_DU_1 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PDU1, NUM, .(ADR) <0, 8, 1>) %,
    PARAMETER_DU_2 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PDU2, NUM, .(ADR) <0, 2*8, 1>) %,
    PARAMETER_H_1 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PH1, NUM, .(ADR) <0, 8, 1>) %,
    PARAMETER_H_2 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PH2, NUM, .(ADR) <0, 2*8, 1>) %,
    PARAMETER_HI (NUM, CNT, ADR) =
	$NM$PARAMETER_ROUTINE (PHI, NUM, CNT, ADR) %,
    PARAMETER_O_2 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PO2, NUM, .(ADR) <0, 2*8, 1>) %,
    PARAMETER_O_4 (NUM, ADR) =
	$NM$PARAMETER_ROUTINE (PO4, NUM, ADR) %;

!
! Counter items
!

macro
    !
    ! Allocate room for a counter
    !
    $COUNTER (BITS) =
	%if BITS eql 1
	%then
	    $BIT %exitmacro %fi
	%if BITS eql 8
	%then
	    $TINY_INTEGER %exitmacro %fi
	%if BITS eql 16
	%then
	    $INTEGER %exitmacro %fi
	%if BITS eql 32
	%then
	    $LONG_INTEGER %exitmacro %fi
	%errormacro ('Counter size not supported: ', %number (BITS)) %fi %,
    $TIME =
	$LONG_INTEGER %;

macro
    !
    ! Add value to the specified counter in the data base
    !
    COUNTER_ADD (DB, FLD, VALUE) =
	%if %fieldexpand (FLD, 2) eql 0
	%then
	    begin

	    external routine
		%name ('$AC32') : NM_LL_CTR novalue;

	    %name ('$AC32') (DB [FLD], VALUE)
	    end
	%exitmacro %fi
	begin

	builtin
	    ROT;

	if ROT (DB [FLD] = .DB [FLD] + VALUE, 1) then DB [FLD] = - 1
	end %,
    !
    ! Increment the specified counter in the data base
    !
    COUNTER_INCREMENT (DB, FLD) =
	%if %fieldexpand (FLD, 2) eql 1
	%then
	    DB [FLD] = 1
	%exitmacro %fi
	%if %fieldexpand (FLD, 2) eql 8
	%then
	    begin
	    external routine
		%name ('$IC8') : NM_LL_CTR novalue;

	    %name ('$IC8') (DB [FLD])
	    end
	%exitmacro %fi
	%if %fieldexpand (FLD, 2) eql 0
	%then
	    begin
	    external routine
		%name ('$IC32') : NM_LL_CTR novalue;

	    %name ('$IC32') (DB [FLD])
	    end
	%exitmacro %fi
	begin
	DB [FLD] = .DB [FLD] + 1;

	if .DB [FLD] eql 0 then DB [FLD] = .DB [FLD] - 1
	end %,
    !
    ! Zero counter in data base
    !
    COUNTER_ZERO (DB, FLD, BMAP) =
	%if not %null (BMAP)
	%then
	    DB [%fieldexpand (FLD, 0), 0, 16, 0] = 0
	%exitmacro %fi
	%if %fieldexpand (FLD, 2) eql 0
	%then
	    begin
	    DB [$sub_field (FLD, 0, 0, 16, 0)] = 0;
	    DB [$sub_field (FLD, 1, 0, 16, 0)] = 0
	    end
	%exitmacro %fi
	DB [FLD] = 0 %;

!
! [End of NMLIB]