Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - t20/nmlt20/nmudte.b36
There is 1 other file named nmudte.b36 in the archive. Click here to see a list.
! UPD ID= 189, SNARK:<6.1.NML>NMUDTE.B36.3,  10-Dec-84 14:40:22 by HALPIN
! Get MONSYM Library file out of default directory, not BLI:
!
! UPD ID= 95, SLICE:<6.1.NML>NMUDTE.B36.2,  18-Sep-84 15:21:00 by GUNN
! WORK:<GUNN.NML>NMUDTE.B36.4 21-Aug-84 09:59:41, Edit by GUNN
!
! Change to accomodate new LIBRARY conventions. MONSYM.L36 and JLNKG.L36
! are now explicity declared here rather than in NMULIB.
!
! Remove definition for CD_BLOCK_FIELDS and move to NMUCOM.REQ.
!
! SNARK:<6.1.NML.TOPS-10>NMUDTE.B36.4 21-May-84 12:25:36, Edit by GUNN
!
! Ident 01.
! Fix WRITE_SECONDARY_DATA to call NMU$PAGE_GET correctly. Needed
! parentheses in expression.
! Fix all calls to NMU$PAGE_RELEASE to pass page number not address.
!
module NMUDTE =

begin

!
! COPYRIGHT (C) 1984.
! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS  01754
!
! THIS SOFTWARE IS FURNISHED  UNDER A LICENSE FOR USE ONLY ON A SINGLE
! COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY 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
! EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE
! TERMS.  TITLE TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES
! REMAIN IN DEC.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD  NOT BE CONSTRUED  AS A COMMITMENT  BY DIGITAL  EQUIPMENT
! CORPORATION.
!
! DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE USE OR  RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
!

!++
!
! Facility:	LSG DECnet Management
!
! Abstract:	This module provides direct line access for
!		DTE circuits on KL or KS systems.
!
! Environment:	TOPS-10 version 7.02 or later
!		TOPS-20 version 6.1 or later
!
! Author:	Bill Davenport		Creation date:	23-Feb-84
!
! Modified by:
!
!--
!
! Library files
!

library 'NMULIB';			! Get all required definitions

library 'MONSYM';			! Monitor symbols

library 'JLNKG';			! JSYS linkage definitions

!
! Global routines
!

forward routine
    NMU$DTE_ROUTINES,
    GET_DTE_SYSID,
    OPEN_DTE_DEVICE,
    CLOSE_DTE_DEVICE,
    START_PROTOCOL,
    STOP_PROTOCOL,
    DECNET_RUNNING,
    TRIGGER_ROM,
    ROM_DUMP,
    READ_MOP_DATA,
    WRITE_MOP_DATA,
    WRITE_SECONDARY_DATA,
    OWNER_IS_DECNET;


!
! External references
!

external routine
    NMU$TEXT,
    NMU$PAGE_ALLOCATOR,
    NMU$SCHED_MANAGER;
%global_routine ('NMU$DTE_OPEN', CD: ref CD_BLOCK, RSP_POINTER) =

!++
! Functional description:
!
!	This routine is called by NMU$DLX_OPEN to open a
!	DTE circuit in MOP protocol mode.  The link is
!	set up properly depending upon its usage.
!
! Formal parameters:
!
!	.CD			Pointer to circuit data block
!	.RSP_POINTER		Pointer to NICE response buffer
!
! Routine value:
!
!	$true			No errors
!	$false			Error occured
!
!--

begin

    !
    ! Fill in the circuit data block DTE specific entries
    !

    CD [CD_DTE_SYSID] = GET_DTE_SYSID (.CD);
    CD [CD_DTE_PAGE0] = 0;
    CD [CD_DTE_PAGE1] = 0;
    CD [CD_DTE_DADDR] = 0;
    CD [CD_DTE_DCNT] = -1;
    CD [CD_DTE_DPTR] = 0;

    !
    ! Check for valid operations (only LOAD and DUMP on DTE device)
    !

    if (.CD [CD_USAGE] neq DLX_PROTOCOL)
	and
       (.CD [CD_USAGE] neq DLX_LOAD)
	and
       (.CD [CD_USAGE] neq DLX_DUMP)
    then
	begin
	    $RESPONSE (.RSP_POINTER, NICE$_OPF, 0,
		       'Function not supported on device');
	    return $false;
	end;

    !
    ! Insure DECNET is line owner (so we don't step on
    ! ANF10 or diagnostics)
    !

    if not OWNER_IS_DECNET (.CD, .RSP_POINTER)
    then
	return $false;

    !
    ! Return now if just doing protocol start/stop
    !

    if .CD [CD_USAGE] eql DLX_PROTOCOL
    then
	return $true;

    !
    ! Clear protocol on this DTE
    !

    if not STOP_PROTOCOL (.CD, .RSP_POINTER)
    then
	return $false;

    !
    ! Trigger ROM in FE for functions LOAD & DUMP
    !

    if not TRIGGER_ROM (.CD, .RSP_POINTER)
    then
	return $false;

    !
    ! Do system specific open of DTE device
    !

    if not OPEN_DTE_DEVICE (.CD, .RSP_POINTER)
    then
	return $false;

    !
    ! If DLX_DUMP usage, then extract some dump data
    ! (4k bytes) from the DN20 so that the secondary
    ! bootstrap won't overwrite needed info.
    !

    if (.CD [CD_USAGE] eql DLX_DUMP)
    then
	begin
	    CD [CD_DTE_PAGE0] = NMU$PAGE_GET ();
	    CD [CD_DTE_PAGE1] = NMU$PAGE_GET ();

	    if not (ROM_DUMP (.CD, .CD [CD_DTE_PAGE0], .RSP_POINTER)
		     and
		    ROM_DUMP (.CD, .CD [CD_DTE_PAGE1], .RSP_POINTER))
	    then
		begin
		    NMU$PAGE_RELEASE (.CD [CD_DTE_PAGE0]);
		    NMU$PAGE_RELEASE (.CD [CD_DTE_PAGE1]);
		    CD [CD_DTE_PAGE0] = 0;
		    CD [CD_DTE_PAGE1] = 0;
		    return $false;
		end;

	    CD [CD_DTE_DADDR] = 0;
	    CD [CD_DTE_DCNT] = 2 * 512;
	    CD [CD_DTE_DPTR] = ch$ptr (.CD [CD_DTE_PAGE0]^9,,16);
	end;

    $true

end;				! End of NMU$DTE_OPEN
%global_routine ('NMU$DTE_CLOSE', CD: ref CD_BLOCK) =

!++
! Functional description:
!
!	This routine is called from NMU$DLX_CLOSE to release
!	a DTE circuit from network management service.
!
! Formal parameters:
!
!	.CD			Pointer to circuit data block
!
! Routine value:
!
!	$true			Successful
!	$false			Error during close
!
!--

begin

    !
    ! Return now if just doing protocol start/stop
    !

    if .CD [CD_USAGE] eql DLX_PROTOCOL
    then
	return $true;

    !
    ! Free up any extracted dump pages
    !

    if .CD [CD_DTE_PAGE0] neqa 0
    then
	NMU$PAGE_RELEASE (.CD [CD_DTE_PAGE0]);

    if .CD [CD_DTE_PAGE1] neqa 0
    then
	NMU$PAGE_RELEASE (.CD [CD_DTE_PAGE1]);

    CD [CD_DTE_PAGE0] = 0;
    CD [CD_DTE_PAGE1] = 0;

    !
    ! Do system specific DTE close
    !

    CLOSE_DTE_DEVICE (.CD)

end;				! End of NMU$DTE_CLOSE
%global_routine ('NMU$DTE_READ', CD: ref CD_BLOCK, USAGE, PTR, LEN, RSP_POINTER) =

!++
! Functional description:
!
!	This routine is called from NMU$DLX_READ to read a MOP
!	message from a DTE circuit.
!
! Formal parameters:
!
!	.CD			Pointer to circuit data block
!	.USAGE			What type of read is supposed to be done
!				    (DLX_DATA for MOP data)
!	.PTR			Pointer to message buffer
!	.LEN			Number of bytes in message buffer to write
!	.RSP_POINTER		Pointer to NICE response buffer
!
! Routine value:
!
!	Number of bytes read on circuit
!
!--

begin

    local
	WORD_COUNT,
	MOP_COUNT,
	MOP_POINTER,
	MOP_DATA_WORD;

    !
    ! Return an indication if just finished reading data from ROM dump
    !

    if .CD [CD_DTE_DCNT] eql 0
    then
	begin
	    CD [CD_DTE_DCNT] = -1;
	    return 0;
	end;

    !
    ! Read MOP data from DN20 if no extracted dump data is left
    !

    if .CD [CD_DTE_DCNT] lss 0
    then
	return READ_MOP_DATA (.CD, .PTR, .LEN, .RSP_POINTER);

    !
    ! Format remaining extracted dump data into MOP data message
    !

    MOP_POINTER = .PTR;
    MOP_COUNT = 0;
    PUTB (MEMORY_DUMP_DATA, MOP_POINTER);
    PUT32 (CD [CD_DTE_DADDR], MOP_POINTER);
    MOP_COUNT = .MOP_COUNT + 5;

    !
    ! Copy data from extracted dump pages to MOP message
    !

    WORD_COUNT = min (.CD [CD_DTE_DCNT], (.LEN-.MOP_COUNT)/2);

    decr COUNT from .WORD_COUNT to 1
    do
	begin
	    MOP_DATA_WORD = ch$rchar_a (CD [CD_DTE_DPTR]);
	    PUTW (MOP_DATA_WORD, MOP_POINTER);
	end;

    MOP_COUNT = .MOP_COUNT + .WORD_COUNT*2;
    CD [CD_DTE_DADDR] = .CD [CD_DTE_DADDR] + .WORD_COUNT*2;
    CD [CD_DTE_DCNT] = .CD [CD_DTE_DCNT] - .WORD_COUNT;

    if .CD [CD_DTE_DCNT] lss 0
    then
	TASK_ERROR ('DTE dump data word count has gone negative');

    if .CD [CD_DTE_DCNT] eql 0
    then
	begin
	    NMU$PAGE_RELEASE (.CD [CD_DTE_PAGE0]);
	    CD [CD_DTE_PAGE0] = .CD [CD_DTE_PAGE1];
	    CD [CD_DTE_PAGE1] = 0;
	    if .CD [CD_DTE_PAGE0] neqa 0
	    then
		begin
		    CD [CD_DTE_DCNT] = 2 * 512;
		    CD [CD_DTE_DPTR] = ch$ptr (.CD [CD_DTE_PAGE0]^9,,16);
		end;
	end;

    .MOP_COUNT

end;				! End of NMU$DTE_READ
%global_routine ('NMU$DTE_WRITE', CD: ref CD_BLOCK, USAGE, PTR, LEN, RSP_POINTER) =

!++
! Functional description:
!
!	This routine is called from NMU$DLX_WRITE to write a MOP
!	message onto a DTE circuit.
!
! Formal parameters:
!
!	.CD			Pointer to circuit data block
!	.USAGE			What type of write is supposed to be done
!				    (DLX_DATA for MOP data)
!	.PTR			Pointer to message buffer
!	.LEN			Number of bytes in message buffer to write
!	.RSP_POINTER		Pointer to NICE response buffer
!
! Routine value:
!
!	$true			Success
!	$false			Failure during write
!
!--

begin

    !
    ! If we are dumping the DN20 and are still processing
    ! the 4K bytes of dump data read by NMU$DTE_OPEN, then
    ! discard the NMU$DTE_WRITE of DUMP REQUEST messages.
    !

    if (.CD [CD_USAGE] eql DLX_DUMP)
	and
       (.CD [CD_DTE_DCNT] geq 0)
    then
	return $true;

    !
    ! Do write based on type of usage
    !

    selectone .USAGE of
    set

	[DLX_SECONDARY]:		! Secondary bootstrap
	    return WRITE_SECONDARY_DATA (.CD, .PTR, .LEN, .RSP_POINTER);

	[DLX_DATA]:			! MOP data message
	    return WRITE_MOP_DATA (.CD, .PTR, .LEN, .RSP_POINTER);

	[otherwise]:
	    TASK_ERROR ('NMU$DTE_WRITE called with invalid usage');

    tes;

    $false

end;				! End of NMU$DTE_WRITE
%global_routine ('NMU$DTE_START_PROTOCOL', CD: ref CD_BLOCK, RSP_POINTER) =

!++
! Functional description:
!
!	This routine is called from NMU$DLX_START_PROTOCOL to
!	initialize protocol on a DTE circuit.
!
! Formal parameters:
!
!	.CD			Pointer to circuit data block
!	.RSP_POINTER		Pointer to NICE response buffer
!
! Routine value:
!
!	$true			Protocol initialized successfully
!	$false			Error initializing protocol
!
!--

begin

    !
    ! Try to initialize protocol on this DTE
    !

    START_PROTOCOL (.CD, .RSP_POINTER)

end;				! End of NMU$DTE_START_PROTOCOL
%global_routine ('NMU$DTE_STOP_PROTOCOL', CD: ref CD_BLOCK, RSP_POINTER) =

!++
! Functional description:
!
!	This routine is called from NMU$DLX_STOP_PROTOCOL to clear
!	protocol on a DTE circuit.
!
! Formal parameters:
!
!	.CD			Pointer to circuit data block
!	.RSP_POINTER		Pointer to NICE response buffer
!
! Routine value:
!
!	$true			Protocol successfully terminated
!	$false			Error clearing protocol
!
!--

begin

    !
    ! Try to stop protocol on this DTE
    !

    STOP_PROTOCOL (.CD, .RSP_POINTER)

end;				! End of NMU$DTE_STOP_PROTOCOL
%global_routine ('NMU$DTE_DECNET_RUNNING', CD : ref CD_BLOCK, RSP_POINTER) =

!++
!
! Functional description:
!
!  This routine is called from NMU$DLX_DECNET_RUNNING to check if DECnet
!  protocol is running on a circuit.
!
! Formal parameters:
!
!  .CD            Pointer to circuit data block
!  .RSP_POINTER   Pointer to NICE response buffer
!
! Routine value:
!
!  $true          DECnet protocol is running
!  $false         No protocol, or some other protocol than DECnet
!
!--

begin

    ! Check the protocol
    return DECNET_RUNNING (.CD, .RSP_POINTER);

end;
!
! System specific DTE service routines
!

switches
    list (require);

%if $TOPS10
%then require 'DTET10';
%else %if $TOPS20
%then require 'DTET20';
%else %error ('NMUDTE not supported for MCB')
%fi %fi

end					! of module NMUDTE
eludom