Google
 

Trailing-Edge - PDP-10 Archives - TOPS-20_V6.1_DECnetSrc_7-23-85 - mcb/utilities/ndt.b16
There is 1 other file named ndt.b16 in the archive. Click here to see a list.
module NDT (					! Node Debugging Tool
		ident = 'X01050',
		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: DN20 Node Debugging Tool
!
! ABSTRACT:
!
!	This is a hack process to let DNDDT talk to the DN20.
!
! ENVIRONMENT: MCB V3.0
!
! AUTHOR: Alan D. Peckham	CREATION DATE: 02-Sep-81
!
! MODIFIED BY:
!
!	Alan Peckham, 02-Sep-81
! 01	- New process for DN20 testing.
! 02	- Pick up data message from right CCB.
!	  Fix up call linkages on RETURN_CCB calls.
! 03	- Make sure no optional data on ACCEPT.
! 04	- Fix problems with large EXAMINEs (buffering)
!--

!
! INCLUDE FILES:
!

library 'MCBLIB';

library 'XPORTX';

require 'SCSYS';

library 'NDTDAT';

!
! TABLE OF CONTENTS:
!

linkage
    NDT_DB_CCB = jsr (register = 5, register = 4) : nopreserve (4),
    NDT_DB_CCB_X = jsr (register = 5, register = 4) : nopreserve (1, 2, 3, 4, 5);

forward routine
    DO_ABORT : NDT_DB_CCB novalue,
    DO_ACCEPT : NDT_DB_CCB novalue,
    DO_DATA : NDT_DB_CCB_X novalue,
    DO_REQUEST : NDT_DB_CCB novalue,
    DO_SEND : NDT_DB_CCB novalue,
    MEMORY_EXISTS,
    NEW_PROCESS : CALL$,
    NDTTIM : MCB_DB_CCB_MOD novalue,	
    NXM_CATCHER,
    RCV_ABO : MCB_DB_CCB novalue,
    RCV_ACC : MCB_DB_CCB novalue,
    RCV_CNR : MCB_DB_CCB novalue,
    RCV_DAT : MCB_DB_CCB novalue,
    RCV_DRQ : MCB_DB_CCB novalue,
    RCV_DSR : MCB_DB_CCB novalue,
    RCV_SND : MCB_DB_CCB novalue,
    RETURN_CCB : NDT_DB_CCB novalue,
    START_ABORT : LINKAGE_DB novalue;

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

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

global literal
    %name ('D.LEN') = D_LENGTH*%upval;

field	word_0 = [0, 0, 16, 0],
	word_1 = [1, 0, 16, 0],
	byte_0 = [0, 0, 8, 0],
	byte_1 = [0, 8, 8, 0];

!
! OWN STORAGE:
!

external routine
    $DSPCR : novalue;

routine SCRCP (DB, CCB, MODF) : MCB_DB_CCB_MOD novalue =
    DISPATCH$ (TABLE$ ($DSPCR, 6,
	(S$CNR, RCV_CNR),
	(S$DAT, RCV_DAT),
	(S$DSR, RCV_DSR)),
	.MODF, (.DB, .CCB), MCB_DB_CCB);

routine SCXCP (DB, CCB, MODF) : MCB_DB_CCB_MOD novalue =
    DISPATCH$ (TABLE$ ($DSPCR, 20,
	(S$ABO, RCV_ABO),
	(S$ACC, RCV_ACC),
	(S$DRQ, RCV_DRQ),
	(S$SND, RCV_SND)),
	.MODF, (.DB, .CCB), MCB_DB_CCB);

bind
    DISPATCH = TABLE$ ($DSPCR, FC_CCP,		! LLC Dispatch vector:
		(FC_RCP, SCRCP),
		(FC_XCP, SCXCP),
		(FC_TIM, NDTTIM));		!  timeout

$MCB_PROCESS (NAME = NDT,			! Process name
    LLC_DISPATCH = DISPATCH);
!
! EXTERNAL REFERENCES:
!

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

bind
    DB_ADDR = MCB$GAW_PROCESS_DATA_BASE [1] : ref block field (D_FIELDS),
    DB_BIAS = MCB$GAW_PROCESS_DATA_BASE [0];
routine DO_ABORT

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

    begin
    $MCB_CANCEL_CCB_REQUEST ();
    $SC_ABORT (.CCB, .DB [D_SC_PIX], .MCB$GW_PROCESS_HANDLE, (0, 0, 0));
    end;					!of routine DO_ABORT
routine DO_ACCEPT

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

    begin
    $SC_ACCEPT (.CCB, .DB [D_SC_PIX], .DB [D_LLA], .MCB$GW_PROCESS_HANDLE, S$PSEG, (0, 0, 0));
    end;					!of routine DO_ACCEPT
routine DO_DATA

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

    begin

    local
	ADDR,
	BIAS,
	CMD,
	CNT,
	PTR;

    begin

    bind
	DAT_CCB = .DB [D_PENDING_DATA_CCB] : block field (C_FIELDS);

    CCB [C_STK] = DAT_CCB;
    MAP$ (.DAT_CCB [C_BIAS]);
    PTR = .DAT_CCB [C_ADDR];
    end;
    DB [D_PENDING_DATA_CCB] = 0;

    CMD = ch$rchar_a (PTR);
    PTR = ch$plus (.PTR, 1);

    ADDR = ch$rchar_a (PTR);
    ADDR = .ADDR or %o'140000';

    BIAS <0, 8> = ch$rchar_a (PTR);
    BIAS <8, 8> = ch$rchar_a (PTR);
    BIAS = .BIAS^2;
    PTR = ch$plus (.PTR, 1);

    CNT = ch$rchar_a (PTR);

    CCB [C_BIAS] = 0;
    ch$wchar (18, CCB [C_ADDR] = ch$ptr (CCB [C_PRM2],, 8));
    CCB [C_CNT] = 1;

    selectone .CMD of
	set
	[12] :				! Deposit
	    begin

	    if MEMORY_EXISTS (.CNT, .BIAS, .ADDR)
	    then
		begin
		$MCB_MOVE_BUFFER_TO_BUFFER (.CNT, .PTR, (.BIAS, .ADDR));
		ch$wchar (1, .CCB [C_ADDR]);
		end;

	    end;
	[13] :				! Examine

	    if MEMORY_EXISTS (.CNT, .BIAS, .ADDR)
	    then
		begin

		local
		    BUF;

		if .CNT leq 6
		then
		    begin
		    BUF = .CCB [C_ADDR];
		    ch$wchar_a (1, BUF);
		    ch$wchar_a (.CNT, BUF);
		    $MCB_MOVE_BUFFER_TO_BUFFER (.CNT, (.BIAS, .ADDR), .BUF);
		    CCB [C_BIAS] = 0;
		    CCB [C_CNT] = CNT = .CNT + 2;
		    end
		else

		    if $MCB_GET_BUFFER (.CNT+2, BUF)
		    then
			begin
			SMAP$ (CCB [C_BIAS]);
			CCB [C_ADDR] = .BUF;
			ch$wchar_a (1, BUF);
			ch$wchar_a (.CNT, BUF);
			$MCB_MOVE_BUFFER_TO_BUFFER (.CNT, (.BIAS, .ADDR), .BUF);
			CCB [C_CNT] = CNT = .CNT + 2;
			end;

		end;

	[otherwise] :
	    begin
	    START_ABORT (DB [D_BASE]);
	    $SC_DATA_SEGMENT_RETURN (.CCB [C_STK]);
	    RETURN_CCB (DB [D_BASE], .CCB);
	    return;
	    end;
	tes;

    $SC_DATA_SEGMENT_RETURN (.CCB [C_STK]);
    DO_SEND (DB [D_BASE], .CCB);
    end;					!of routine DO_DATA
routine DO_REQUEST

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

    begin

    if .DB [D_STATE] eql DS_RUN
    then
	$SC_DATA_SEGMENT_REQUEST (.CCB, .DB [D_SC_PIX], .DB [D_LLA], .MCB$GW_PROCESS_HANDLE, 1)
    else
	RETURN_CCB (DB [D_BASE], .CCB);

    end;					!of routine DO_REQUEST
routine DO_SEND

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

    begin

    if .DB [D_STATE] eql DS_RUN
    then
	$SC_DATA_SEGMENT_TRANSMIT (.CCB, .DB [D_SC_PIX], .DB [D_LLA], .MCB$GW_PROCESS_HANDLE, S$PEOM)
    else
	RETURN_CCB (DB [D_BASE], .CCB);

    end;					!of routine DO_SEND
routine MEMORY_EXISTS

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
       (CNT,
	BIAS,
	ADDR)
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!
	=
!
! SIDE EFFECTS:
!	None
!--

    begin

    local
	BYTES,
	FLAG : volatile, %(BLISS initializes to 0 = FALSE)%
	PTR,
	SAVE_MAP,
	TEMP;

    enable
	NXM_CATCHER (FLAG);

    if (BYTES = .CNT) eqlu 0 then return not .FLAG;

    SMAP$ (SAVE_MAP);
    MAP$ (.BIAS);
    PTR = .ADDR;

    do (TEMP = ch$rchar_a (PTR)) while (BYTES = .BYTES - 1) nequ 0;

    MAP$ (.SAVE_MAP);
    not .FLAG
    end;			!of routine MEMORY_EXISTS
routine NEW_PROCESS

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
       (CCB : ref block field (C_FIELDS))
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!
	: CALL$ =
!
! SIDE EFFECTS:
!	None
!--

    begin

    bind
	DB = DB_ADDR : ref block field (D_FIELDS);

    MCB$GA_PROCESS_DISPATCH = DISPATCH;

    if not $MCB_GET_DSR (D_LENGTH*%upval, DB) then return FALSE;

    DB [D_STATE] = DS_ACCEPT;
    DB [D_SC_PIX] = .CCB [C_PIX];
    DB [D_ALLOCATED_CCB_COUNT] = 0;
    DB [D_PENDING_DATA_CCB] = 0;
    $SC_GET_LLA (.CCB, DB [D_LLA]);
    $SC_CONNECT_RECEIVED (.CCB, 0);
    begin

    local
	ACC_CCB : ref block field (C_FIELDS);

    if $MCB_GET_CCB (ACC_CCB)
    then
	begin
	DB [D_ALLOCATED_CCB_COUNT] = .DB [D_ALLOCATED_CCB_COUNT] + 1;
	DO_ACCEPT (DB [D_BASE], .ACC_CCB);
	end
    else
	$MCB_REQUEST_CCB ();

    end;
    TRUE
    end;					!of routine NEW_PROCESS
routine NDTTIM

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

    begin

    if .MODF neq FM_CCB then return;

    DB [D_ALLOCATED_CCB_COUNT] = .DB [D_ALLOCATED_CCB_COUNT] + 1;

    case .DB [D_STATE] from DS_LOW to DS_HIGH of
	set
	[DS_ACCEPT] :
	    DO_ACCEPT (DB [D_BASE], .CCB);
	[DS_RUN] :
	    DO_DATA (DB [D_BASE], .CCB);
	[DS_ABORT] : 
	    DO_ABORT (DB [D_BASE], .CCB);
	[DS_KILL] :
	    $MCB_RETURN_CCB (.CCB);
	tes;

    end;					!of routine NDTTIM
routine NXM_CATCHER

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
       (SIG : ref vector,		! Signal vector address
	MCH : ref vector,		! Mechanism vector address
	ENB : ref vector)		! Enable vector address
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
!
	=
!
! SIDE EFFECTS:
!	None
!--

    begin

    if .SIG [1] neq SS$NXM then return FALSE;

    .ENB [1] = TRUE;
    TRUE
    end;			!of routine NXM_CATCHER
routine RCV_ABO

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

    begin
    DB [D_STATE] = DS_KILL;
    RETURN_CCB (DB [D_BASE], .CCB);
    end;					!of routine RCV_ABO
routine RCV_ACC

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

    begin
    DB [D_STATE] = DS_RUN;
    DO_REQUEST (DB [D_BASE], .CCB);
    end;				!of routine RCV_ACC
routine RCV_CNR

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

    begin

    local
	PIX;

    if not $MCB_SET_PROCESS (, PIX)
    then
	begin
	$SC_CONNECT_RECEIVED (.CCB, 0, S_ERES);
	return;
	end;

    if not CALL$P (NEW_PROCESS, .PIX, .CCB)
    then
	$SC_CONNECT_RECEIVED (.CCB, 0, S_ERES);

    end;					!of routine RCV_CNR
routine RCV_DAT

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

    begin
    DB [D_PENDING_DATA_CCB] = .CCB;
    begin

    local
	STK_CCB : ref block field (C_FIELDS);

    if $MCB_GET_CCB (STK_CCB)
    then
	begin
	DB [D_ALLOCATED_CCB_COUNT] = .DB [D_ALLOCATED_CCB_COUNT] + 1;
	DO_DATA (DB [D_BASE], .STK_CCB);
	end
    else
	$MCB_REQUEST_CCB ();

    end;
    end;					!of routine RCV_DAT
routine RCV_DRQ

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

    begin
    RETURN_CCB (DB [D_BASE], .CCB);
    end;					!of routine RCV_DRQ
routine RCV_DSR

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

    begin
    $SC_DISCONNECTED (.CCB);
    START_ABORT (DB [D_BASE]);
    end;					!of routine RCV_DSR
routine RCV_SND

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

    begin

    local K;

    SMAP$(K);
    if .CCB[C_BIAS] neq 0 then begin		! If we got a buffer,
	MAP$ (.CCB [C_BIAS]);			!   return it
	$MCB_RETURN_BUFFER (.CCB [C_CNT], .CCB [C_ADDR]);
	MAP$ (.K);
	end;
    DO_REQUEST (DB [D_BASE], .CCB);
    end;					!of routine RCV_SND
routine RETURN_CCB

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

    begin
    $MCB_RETURN_CCB (.CCB);
    DB [D_ALLOCATED_CCB_COUNT] = .DB [D_ALLOCATED_CCB_COUNT] - 1;

    if .DB [D_ALLOCATED_CCB_COUNT] neq 0 then return ;

    if .DB [D_STATE] neq DS_KILL then return;

    $MCB_RETURN_DSR (D_LENGTH*%upval, DB [D_BASE]);
    DB_ADDR = 0;
    $MCB_CLEAR_PROCESS ();
    end;					!of routine RETURN_CCB
routine START_ABORT

!++
! 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

    DB [D_STATE] = DS_ABORT;
    begin

    local
	CCB : ref block field (C_FIELDS);

    if (CCB = .DB [D_PENDING_DATA_CCB]) neqa 0
    then
	begin
	$SC_DATA_SEGMENT_RETURN (.CCB);
	DB [D_PENDING_DATA_CCB] = 0;
	end;

    end;
    begin

    local
	CCB : ref block field (C_FIELDS);

    if $MCB_GET_CCB (CCB)
    then
	begin
	DB [D_ALLOCATED_CCB_COUNT] = .DB [D_ALLOCATED_CCB_COUNT] + 1;
	DO_ABORT (DB [D_BASE], .CCB);
	end
    else
	$MCB_REQUEST_CCB ();

    end;
    end;					!of routine START_ABORT
end
eludom