Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/drivers/dtenmx.b16
There are no other files named dtenmx.b16 in the archive.
module DTENMX (	! DTE20 Driver Network Management
		ident = 'X01130',
		language (bliss16)
		) =
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: MCB DTE Driver
!
! ABSTRACT:
!
!	This module contains the DTE driver Network Management routines.
!
! ENVIRONMENT: MCB V3.2
!
! AUTHOR: Alan D. Peckham	CREATION DATE: 3-Mar-81
!
! MODIFIED BY:
!
!	Alan D. Peckham, 3-Mar-81: Version 1
! 01	- Split off from DTE module.
! 02	- Identify line and circuit to NMX in SET_DTE_DEVICE.
! 03	- Correct dispatches in DTENM.
!	  Get counters from unmapped data base.
! 04	- Correct interaction between line state and protocol state.
! 05	- Optimize out useless code.
! 06	- Use NMX$PARAMETER routines.
!	  Move line counters to circuit counters.
! 07	- Update to NM V3.0 .
!	  Fix circuit handling to call the zero counter routines.
!	  (found by LEAPLINE).
! 08	- Remove 'counters zeroed' event.
! 09	- Display pause timeout value in LINE CHARACTERISTICS.
! 10	- Support new system specific line counters (2500,2501,2502).
! 12	- fix output of parameter #1110 in CIRCUIT CHARACTERISTICS.
! 13	- Add seconds-since-last-zeroed support for line.
!	  Eliminate double line counter report from owner and provider.
!--
!
! INCLUDE FILES:
!

library 'MCBLIB';

library 'XPORTX';

library 'NMXLIB';

library 'DTEDAT';

!
! TABLE OF CONTENTS:
!

linkage
    DTE_DB = jsr (register = 5),
    DTE_DB_NUM = jsr (register = 5, register = 0);

forward routine
    CLEAR_CIRCUIT : LINKAGE_CCB,
    CLEAR_LINE : LINKAGE_CCB,
    DTENM : MCB_CCB novalue,
    PARAMETER_CIRCUIT_COUNTERS : LINKAGE_DB novalue,
    PARAMETER_LINE_COUNTERS : LINKAGE_DB novalue,
    SET_CIRCUIT : LINKAGE_CCB,
    SET_LINE : LINKAGE_CCB,
    SET_LINE_STATE : DTE_DB_NUM,
    SHOW_AND_ZERO_CIRCUIT_COUNTERS : LINKAGE_CCB,
    SHOW_AND_ZERO_LINE_COUNTERS : LINKAGE_CCB,
    SHOW_CIRCUIT : LINKAGE_CCB,
    SHOW_LINE : LINKAGE_CCB,
    SHOW_SUCCESS : LINKAGE_CCB,
    SUCCESS : LINKAGE_CCB,
    ZERO_CIRCUIT_COUNTERS : LINKAGE_CCB,
    ZERO_LINE_COUNTERS : LINKAGE_CCB;

!
! MACROS:
!
!	None
!
! EQUATED SYMBOLS:
!

literal
    TRUE = 1 EQL 1,
    FALSE = 1 EQL 0,
    NO_OPERATION = 0;

!
! OWN STORAGE:
!

external routine
    $DSPCR : novalue;

!
! EXTERNAL REFERENCES:
!

linkage
    LNK_DB = jsr (register = 5) : nopreserve (0, 1, 2, 3, 4);

external routine
    DTEIN : MCB_INTERRUPT novalue,
    DTESTP : LNK_DB novalue,
    DTESTR : LNK_DB novalue;

external
    MCB$GAW_PROCESS_DATA_BASE : vector [2],
    MCB$GW_PROCESS_HANDLE;

bind
    DB_BIAS = MCB$GAW_PROCESS_DATA_BASE [0];

macro
    GET_DTE_DATA_BASE (NAME) =
	%if %declared (NAME)
	%then map NAME : ref
	%else bind NAME = .MCB$GAW_PROCESS_DATA_BASE [1] :
	%fi block field (D_FIELDS); %;
routine CLEAR_CIRCUIT (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    if .CCB [C_CNT] eql 0
    then
	NM$SUC
    else
	NE$PNA

    end;
routine CLEAR_LINE (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    if .CCB [C_CNT] eql 0
    then
	NM$SUC
    else
	NE$PNA

    end;
global routine DTENM (CCB) : MCB_CCB novalue =

!++
! FUNCTIONAL DESCRIPTION:
!	This routine is activated by a control request from
!	Network Management.
!
! FORMAL PARAMETERS:
!	CCB	CCB to pass to handler routine
!
! IMPLICIT INPUTS:
!	CCB Contents
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin

    map
	CCB: ref block field (C_NM_FIELDS);

    CCB [C_STS] =
	begin

	case .CCB [C_NM_ENTITY] from NMX$ENT_lo to NMX$ENT_hi of
	    set
	    [NMX$ENT_ckt] :			! NM function for
		begin				!  CIRCUIT parameter
		case .CCB [C_NM_FUNC] from NMX$FNC_lo to NMX$FNC_hi of
		    set
		    [NMX$FNC_set] :		! Set parameters
			SET_CIRCUIT (.CCB);
		    [NMX$FNC_clr] :		! Clear parameters
			CLEAR_CIRCUIT (.CCB);
		    [NMX$FNC_sho] :		! Show selected items
			SHOW_CIRCUIT (.CCB);
		    [NMX$FNC_zro] :		! Zero counters
			ZERO_CIRCUIT_COUNTERS (.CCB);
		    [NMX$FNC_szc] :		! Show and zero counters
			SHOW_AND_ZERO_CIRCUIT_COUNTERS (.CCB);
		    [inrange] :
			$NM$ERR_SFS;
		    [outrange] :
			$NM$ERR_MPE;
		    tes
		end;

	    [NMX$ENT_lin] : 			! NM function for
		begin				!  LINE parameter
		case .CCB [C_NM_FUNC] from NMX$FNC_lo to NMX$FNC_hi of
		    set
		    [NMX$FNC_set] :		! Set parameters
			DISPATCH$ (.CCB [C_LIX],
			    TABLE$ (SUCCESS, DTE_K_NMID_HIGH,
				(DTE_K_LINE_OWNER, SET_LINE),
				(DTE_K_LINE_PROVIDER, SET_LINE)),
			    (.CCB), LINKAGE_CCB);
		    [NMX$FNC_clr] :		! Clear parameters
			DISPATCH$ (.CCB [C_LIX],
			    TABLE$ (SUCCESS, DTE_K_NMID_HIGH,
				(DTE_K_LINE_OWNER, CLEAR_LINE),
				(DTE_K_LINE_PROVIDER, CLEAR_LINE)),
			    (.CCB), LINKAGE_CCB);
		    [NMX$FNC_sho] :		! Show selected items
			DISPATCH$ (.CCB [C_LIX],
			    TABLE$ (SHOW_SUCCESS, DTE_K_NMID_HIGH,
				(DTE_K_LINE_OWNER, SHOW_SUCCESS),
				(DTE_K_LINE_PROVIDER, SHOW_LINE)),
			    (.CCB), LINKAGE_CCB);
		    [NMX$FNC_zro] :		! Zero counters
			DISPATCH$ (.CCB [C_LIX],
			    TABLE$ (SUCCESS, DTE_K_NMID_HIGH,
				(DTE_K_LINE_OWNER, ZERO_LINE_COUNTERS),
				(DTE_K_LINE_PROVIDER, ZERO_LINE_COUNTERS)),
			    (.CCB), LINKAGE_CCB);
		    [NMX$FNC_szc] :		! Show and zero counters
			DISPATCH$ (.CCB [C_LIX],
			    TABLE$ (SUCCESS, DTE_K_NMID_HIGH,
				(DTE_K_LINE_PROVIDER, SHOW_AND_ZERO_LINE_COUNTERS)),
			    (.CCB), LINKAGE_CCB);
		    [inrange] :
			$NM$ERR_SFS;
		    [outrange] :
			$NM$ERR_MPE;
		    tes
		end;

	    [inrange, outrange] :
		$NM$ERR_MPE;

	    tes

	end;

    CCB [C_FNC] = FC_CCP;
    LLCRS$ (.CCB);
    end;
global routine PARAMETER_CIRCUIT_COUNTERS

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
       (DB : ref block field (D_FIELDS))
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
	: LINKAGE_DB novalue =
!
! SIDE EFFECTS:
!	None
!--

    begin
    COUNTER_32 (1000, DB [D_BYTES_RECEIVED]);
    COUNTER_32 (1001, DB [D_BYTES_SENT]);
    COUNTER_32 (1010, DB [D_DATA_BLOCKS_RECEIVED]);
    COUNTER_32 (1011, DB [D_DATA_BLOCKS_SENT]);
    end;			!of routine PARAMETER_CIRCUIT_COUNTERS
global routine PARAMETER_LINE_COUNTERS

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
       (DB : ref block field (D_FIELDS))
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
	: LINKAGE_DB novalue =
!
! SIDE EFFECTS:
!	None
!--

    begin
    COUNTER_16_TIME (0, DB [D_TIME_LINE_ZEROED]);

    if .DB [D_CONFIGURATION_ERRORS] neq 0
    then
	COUNTER_8_BM (2500, DB [D_CONFIGURATION_ERRORS]);

    if .DB [D_DEVICE_SERVICE_ERRORS] neq 0
    then
	COUNTER_8_BM (2501, DB [D_DEVICE_SERVICE_ERRORS]);

    if .DB [D_FATAL_DEVICE_ERRORS] neq 0
    then
	COUNTER_8_BM (2502, DB [D_FATAL_DEVICE_ERRORS]);

    end;			!of routine PARAMETER_LINE_COUNTERS
routine SET_CIRCUIT (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    if .CCB [C_CNT] eql 0
    then
	NM$SUC
    else
	NE$PNA

    end;
routine SET_LINE (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    local
	BUF_PTR,
	DATA_ID,
	DATA_VALUE;

    if .CCB [C_CNT] eql 0
    then
	begin
	return NM$SUC;
	end;

    MAP$ (.CCB [C_BIAS]);
    BUF_PTR = .CCB [C_ADDR];
    DATA_ID <0, 8> = ch$rchar_a (BUF_PTR);
    DATA_ID <8, 8> = ch$rchar_a (BUF_PTR);
    DATA_ID = .DATA_ID <0, 12>;
    DATA_VALUE <0, 8> = ch$rchar_a (BUF_PTR);
    DATA_VALUE <8, 8> = ch$rchar_a (BUF_PTR);
    MAP$ (.DB_BIAS);

    selectone .DATA_ID of
	set
	[0] : SET_LINE_STATE (DB [D_TIM], .DATA_VALUE);
	[otherwise] : NE$PNA;
	tes

    end;
routine SET_LINE_STATE (DB, STATE) : DTE_DB_NUM =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	STATE = (OFF, ON)
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)
    STATE = .STATE <0, 8>;

    selectone .STATE of
	set
	[DL_ON] :
	    begin
	    $MCB_ENABLE_LONG_TIMER ();

	    if .DB [D_REQUESTED_STATE] eql DS_RUNNING
	    then
		DTESTR (DB [D_TIM]);

	    DB [D_LINE_STATE] = .STATE;
	    NM$SUC
	    end;
	[DL_OFF] :
	    begin

	    if .DB [D_PROTOCOL_STATE] neq DS_HALTED
	    then
		DTESTP (DB [D_TIM]);

	    DB [D_LINE_STATE] = .STATE;
	    NM$SUC
	    end;
	[otherwise] : NE$MPE;
	tes

    end;
routine SHOW_AND_ZERO_CIRCUIT_COUNTERS (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!	This routine writes the counter contents into the NM buffer.
!
! FORMAL PARAMETERS:
!	DB	Database address
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    $NM_RESPONSE_BEGIN (.CCB);
    PARAMETER_CIRCUIT_COUNTERS (DB [D_TIM]);
    $NM_RESPONSE_END (.CCB);
    ZERO_CIRCUIT_COUNTERS (.CCB);
    .CCB [C_STS]
    end;
routine SHOW_AND_ZERO_LINE_COUNTERS (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!	This routine writes the counter contents into the NM buffer.
!
! FORMAL PARAMETERS:
!	DB	Database address
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    $NM_RESPONSE_BEGIN (.CCB);
    PARAMETER_LINE_COUNTERS (DB [D_TIM]);
    $NM_RESPONSE_END (.CCB);
    ZERO_LINE_COUNTERS (.CCB);
    .CCB [C_STS]
    end;
routine SHOW_CIRCUIT (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    $NM_RESPONSE_BEGIN (.CCB);

    selectone .CCB [C_NM_SELECT] of
	set

	[NMX$SEL_sum, NMX$SEL_sta] :
	    NMX$PARAMETER_CIRCUIT_USER (.DB [D_NMX_PIX], .DB [D_CIRCUIT_ENTITY], 1000);

	[NMX$SEL_cha]:
	    begin
	    NMX$PARAMETER_CIRCUIT_OWNER (.DB [D_NMX_PIX], .DB [D_CIRCUIT_ENTITY], 1100);
	    NMX$PARAMETER_LINE (.DB [D_NMX_PIX], .DB [D_LINE_ENTITY], 1110);
	    end;

	[NMX$SEL_cou] :
	    PARAMETER_CIRCUIT_COUNTERS (DB [D_TIM]);

	[otherwise] :
	    return $NM$ERR_MPE;

	tes;

    $NM_RESPONSE_END (.CCB);
    .CCB [C_STS]
    end;
routine SHOW_LINE (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)

    map
	CCB: ref block field (C_NM_FIELDS);

    $NM_RESPONSE_BEGIN (.CCB);

    selectone .CCB [C_NM_SELECT] of
	set

	[NMX$SEL_sum, NMX$SEL_sta]:
	    begin
	    PARAMETER_C_1 (0, DB [D_LINE_STATE]);
	    end;

	[NMX$SEL_cha]:
	    begin
	    NMX$PARAMETER_LINE (.DB [D_NMX_PIX], .DB [D_LINE_ENTITY], 1100);
						! DEVICE
	    begin
	    local REG;
	    REG = .DB [D_REGISTER] and not %o'37';
	    PARAMETER_O_2 (2650, REG);
	    end;
	    PARAMETER_O_2 (2655, DB [D_VECTOR]);
	    PARAMETER_DU_1 (2660, DB [D_PRIORITY]);
	    PARAMETER_DU_2 (2670, uplit (DTE_K_PAUSE_TIMEOUT));
	    end;

	[NMX$SEL_cou] :
	    begin
	    PARAMETER_LINE_COUNTERS (DB [D_TIM]);
	    end;

	[otherwise] :
	    return $NM$ERR_MPE;

	tes;

    $NM_RESPONSE_END (.CCB);
    .CCB [C_STS]
    end;
routine SHOW_SUCCESS (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin

    map
	CCB: ref block field (C_NM_FIELDS);

    CCB [C_CNT] = 0;
    NM$SUC
    end;
routine SUCCESS (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin

    map
	CCB: ref block field (C_NM_FIELDS);

    NM$SUC
    end;
routine ZERO_CIRCUIT_COUNTERS (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	DB	Database address
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)
    COUNTER_ZERO (DB, D_BYTES_RECEIVED);
    COUNTER_ZERO (DB, D_BYTES_SENT);
    COUNTER_ZERO (DB, D_DATA_BLOCKS_RECEIVED);
    COUNTER_ZERO (DB, D_DATA_BLOCKS_SENT);
    return NM$SUC
    end;
routine ZERO_LINE_COUNTERS (CCB) : LINKAGE_CCB =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	DB	Database address
!	CCB	Address of CCB
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!	The appropriate NM status code
!
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DTE_DATA_BASE (DB)
    $NM_TIME (DB [D_TIME_LINE_ZEROED]);
    COUNTER_ZERO (DB, D_CONFIGURATION_ERRORS, 8);
    COUNTER_ZERO (DB, D_DEVICE_SERVICE_ERRORS, 8);
    COUNTER_ZERO (DB, D_FATAL_DEVICE_ERRORS, 8);
    return NM$SUC
    end;
end
eludom