Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/nml/nmumcb.r16
There are no other files named nmumcb.r16 in the archive.
!EXODUS:<BRANNON.AP7.NMLMCB>NMUMCB.R16 1-Nov-83 13:43:06, Edit by BRANNON
!
! Fix TIME_PLUS bugs to handle exact hour correctly.
!
!NET:<BRANDT.DEVELOPMENT>NMUMCB.R16.1 29-Jun-82 15:29:19, Edit by BRANDT
!
! Include nesting count in interrupt off/on macros so nested calls work
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.2 26-Mar-82 08:09:19, Edit by PECKHAM
!
! Merge TIME_TOP and TIME_BOTTOM into TIME_SECOND in TIME_BLOCK.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.2 17-Feb-82 11:01:39, Edit by PECKHAM
!
! Change MEMSIZE to reference MEMTOP instead of MEMSIZ.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.2 13-Feb-82 22:34:16, Edit by PECKHAM
!
! Fix comparisons in TIME_PLUS
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.2 24-Jan-82 02:25:57, Edit by PECKHAM
!
! Change bit field definitions in TIME_BLOCK to word definitions
! for more efficient access.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.2 23-Jan-82 23:09:31, Edit by PECKHAM
!
! Fix bug in TIME_PLUS which was caught by operation priority
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.3 22-Jan-82 07:04:54, Edit by PECKHAM
!
! Correct parameter naming bug in TIME_DIFFERENCE_SECONDS.
!
!NET:<PECKHAM.DEVELOPMENT>NMUMCB.R16.2 21-Jan-82 12:19:57, Edit by PECKHAM
!
! Add macros TIME_DIFFERENCE_SECONDS and TIME_PLUS to compute the temporal
! difference between two TIME_BLOCKS and to add an offset in seconds to a
! TIME_BLOCK.
!
! NET:<DECNET20-V3P1.NMLLIB>NMUMCB.R16 02-Dec-81 09:49:20, Edit by THIGPEN
!
! Add WAIT_BLOCK for use in timing out NMU$SCHED_WAIT calls.
!
! NMUMCB - Network Management Utilities MCB definitions
!
!                    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: LSG DECnet Network Management
!
! Abstract: This file contains definitions that are specific to
!	    MCB.
!
! Environment: MCB
!
! Author: Scott G. Robinson, Creation date: 29-Dec-80
!
!--

!<BLF/PAGE>
!
! Other requirements for MCB
!

switches list (norequire);		! Suppress monitor symbol listing

require 'BLI:RSX11M';			! RSX11 Definitions
require 'NETDIR';			! RSX11 Network definitions
%( switches list (yesrequire); )%

!
literal
	CONTEXT_SIZE = 1;		!Just the SP is context
!<BLF/PAGE>
!
! Semaphore LOCK/UNLOCK macros
!
! macro: LOCK
!		This macro attempts a semaphore lock.  If the lock
!		attempt is successful, a "true" value is returned.
!
!	LOCK (SEMAPHORE)
!
!	where SEMAPHORE is the address of a SEMAPHORE_BLOCK.

macro
    LOCK (SEMA_ADDR) =
	begin
	bind SEMBLK = SEMA_ADDR : SEMAPHORE_BLOCK;
	if .SEMBLK[SEMAPHORE] NEQ 0 then 0 else (SEMBLK[SEMAPHORE]=1)
	end
			%;
!
! macro: UNLOCK
!
!		This macro unlocks a semaphore that has been locked
!		with a LOCK macro call.
!
!	UNLOCK (SEMAPHORE)
!
!	where SEMAPHORE is the address of a SEMAPHORE_BLOCK.

macro
    UNLOCK (SEMA_ADDR) =
	begin
	bind SEMBLK = SEMA_ADDR : SEMAPHORE_BLOCK;
	SEMBLK[SEMAPHORE] = 0;
	end
			 %;
!<BLF/PAGE>
!
! Task scheduling macros
!
! macro: CONTEXT_SWITCH
!
!		This macro swaps the current task with the
!		specified future task.
!
!	CONTEXT_SWITCH (NEW_TASK)
!
!	where NEW_TASK is the address of the new task's task block.

macro
    CONTEXT_SWITCH (NEW_TASK) =
	begin
	    external routine SS$CTX : novalue;	! System specific routine
	    SS$CTX (NEW_TASK);
	end %;

!
! macro: CURRENT_TASK
!
!		This macro returns the address of the
!		current task's task block.

macro
    CURRENT_TASK =
	begin
	    external CURTSK;		! Cell containing current task
	    .CURTSK
	end %;

!
! macro: TASK_INITIALIZE
!
!		This macro initializes a task's task block.
!		Specifically it sets up the stack and the
!		starting address so that the task will swap
!		context properly the first time that it
!		is scheduled.
!
!	TASK_INITIALIZE (TASK_BLOCK, STACK_SIZE)
!
!	where TK_BLOCK is the task's task block address
!	      STACK_SIZE is the number of fullwords its stack.

macro
    TASK_INITIALIZE (TK_BLOCK, STACK_SIZE) =
	begin
	    external routine SS$TNI : novalue;	! System specific routine
	    SS$TNI (TK_BLOCK, STACK_SIZE);
	end %;

!<BLF/PAGE>
!
! Interrupt system operation macros
!
! macro: CLEAR_INTERRUPT_SYSTEM
!
!		This macro clears the interrupt system.  All interrupts
!		disabled.
!

macro
    CLEAR_INTERRUPT_SYSTEM =
	begin
	%inform('CLEAR_INTERRUPT_SYSTEM is a NOOP for MCB')
	end %;

!
! macro: INITIALIZE_INTERRUPT_SYSTEM
!
!		This macro setups any initial values needed in
!		the interrupt data base and informs the operating
!		system about the interrupt vector tables.
!

macro
    INITIALIZE_INTERRUPT_SYSTEM =
	begin
	%inform('INITIALIZE_INTERRUPT_SYSTEM is a NOOP for MCB')
	end %;

!
! macro: ACTIVATE_INTERRUPT
!
!		This macro enables a specific interrupt.  The
!		variable HANDLE points to the relevant interrupt
!		data base.

macro
    ACTIVATE_INTERRUPT =
	begin
	%inform('ACTIVATE_INTERRUPT is a NOOP for MCB')
	end %;

!
! macro: DEACTIVATE_INTERRUPT
!
!		This macro disables a specific interrupt.  The
!		variable HANDLE is the index into the HANDLE_TAB
!		interrup data base.

macro
    DEACTIVATE_INTERRUPT =
	begin
	%inform('DEACTIVATE_INTERRUPT is a NOOP for MCB')
	end %;

!
! macro: INTERRUPT_ON
!
!		This macro enables the interrupt system.  If nested
!		INTERRUPT_OFF calls have been made, this call only
!		decrements the nesting count.

macro
    INTERRUPT_ON =
	begin
        external INTNST;
	dsar$s();			! Interrupts off
	if (INTNST = .INTNST - 1) leq 0
	then
	    begin
	    INTNST = 0;			! Zero nesting count
	    enar$s();			! Interrupts on
	    end;
	end %;

!
! macro: INTERRUPT_OFF
!
!		This macro turns the interrupt system off.  It
!		also increments the nesting count of times that
!		it has been turned off.

macro
    INTERRUPT_OFF =
	begin
        external INTNST;
	dsar$s();
        INTNST = .INTNST + 1;           ! Increment nesting count
	end %;

!
! INTERRUPT routine declarations
!

macro
    RSX$AST_PARAMETERS =
	RSX_EVMASK,RSX_PSW,RSX_PC,RSX_DSW %,
    VANILLA_INTERRUPT_ROUTINE =
	(RSX$AST_PARAMETERS) : VANILLA_INTERRUPT_LINKAGE %,
    TIMER_INTERRUPT_ROUTINE =
	(RSX$AST_PARAMETERS,TIME_EVENT_FLAG) :TIMER_INTERRUPT_LINKAGE%,
    NETWORK_INTERRUPT_ROUTINE =
	(RSX$AST_PARAMETERS,NETWORK_STATUS_BLOCK) :NETWORK_INTERRUPT_LINKAGE%,
    IO_INTERRUPT_ROUTINE =
        (RSX$AST_PARAMETERS,IO_STATUS_BLOCK): IO_INTERRUPT_LINKAGE%;

macro
    INTERRUPT_LINKAGE =
	rsx_ast(standard)%;

linkage
    VANILLA_INTERRUPT_LINKAGE =
	INTERRUPT_LINKAGE ,
    TIMER_INTERRUPT_LINKAGE =
	INTERRUPT_LINKAGE ,
    NETWORK_INTERRUPT_LINKAGE =
	INTERRUPT_LINKAGE ,
    IO_INTERRUPT_LINKAGE =
        INTERRUPT_LINKAGE ;

macro
    INTERRUPT_ROUTINE [] =
	(RSX$AST_PARAMETERS
		%if not %null (%remaining) %then
		, %remaining
		%fi
	) : VANILLA_INTERRUPT_LINKAGE
	%warn('Best to Use ???_INTERRUPT_ROUTINE') %;

macro
    ALLOCATE_INTERRUPT_CHANNEL =
	%warn('Who wants to ALLOCATE_INTERRUPT_CHANNEL?')
	%;

macro
    RELEASE_INTERRUPT_CHANNEL (CHANNEL) =
	%warn('Who supposedly has to RELEASE_INTERRUPT_CHANNEL?')
	%;
!
!<BLF/PAGE>
! System specific time interface
!
! This set of macros allows transparent manipulation of "time"
! in a particular system.  The macros are defined to read time
! from the operating system, read time with a offset, compare time,
! set and clear interrupts on time.
!
!
! Time block structure
!
!	This structure defines the format needed for a specific
!	system to store a internal time/date value.
!	It is patterned after the EVENT TIME needs of event logging
!

$field
    TIME_BLOCK_FIELDS =
	set
	TIME_JULIAN = [$integer],	!Julian Half-Days
	TIME_SECOND = [$integer],	!Seconds in Half-Day
	TIME_MILLISECOND = [$integer]	!Milliseconds in second
					!or %o'100000'
	tes;

literal
    TIME_BLOCK_SIZE = $field_set_size,
    TIME_BLOCK_ALLOCATION = $field_set_units;


macro TIME_BLOCK = block [TIME_BLOCK_SIZE] field(TIME_BLOCK_FIELDS) %;

!
! Macro - TIME_PLUS
!
! Function -	This macro adds the second argument (which is in units of
!		seconds) to the first argument which is a time block.
!

macro
    TIME_PLUS (TIME, SECONDS) =
    begin
	bind TBLK = TIME : TIME_BLOCK;
	local $NMU$SECS : unsigned;

    $NMU$SECS = (SECONDS);

    if .$NMU$SECS gequ (12*60*60)
    then begin
	TBLK [TIME_JULIAN] = .TBLK [TIME_JULIAN] + 1;
	$NMU$SECS = .$NMU$SECS - (12*60*60);
	end;
    TBLK [TIME_SECOND] = .TBLK [TIME_SECOND] + .$NMU$SECS;
    end %;

!
! Macro - TIME_DIFFERENCE_SECONDS
!
! Function - Compute the difference (in seconds) of two TIME_BLOCKS
!

macro
    TIME_DIFFERENCE_SECONDS (TIME1, TIME2) =
    begin
	local $NMU$SECS;
	external routine SS$TDF;
	SS$TDF(TIME1,TIME2,$NMU$SECS);
	.$NMU$SECS
    end %;

!
! macro: TIME_INTERRUPT_CLEAR
!
!		This macro clears all outstanding timer interrupts.
!

macro
    TIME_INTERRUPT_CLEAR =
	begin
	cmkt$s();
	end %;

!
! macro: TIME_INTERRUPT_SET
!
!		This macro sets a time interrupt.  It also
!		defines the routine to be called when the
!		interrupt occurs.
!
!		Note that since the interrupt channel is
!		hard coded the time interrupt must be unique.
!
!	TIME_INTERRUPT_SET (TIME_BLK, TROUTINE)
!
!	where	TIM_BLK	is the time in the future for a interrupt
!		ROUTINE	is the address of the interrupt service routine

macro
    TIME_INTERRUPT_SET (TIM_BLK, TROUTINE) =
	begin
	external routine SS$STI;
	SS$STI(TIM_BLK, TROUTINE);
	end %;


!
! macro: TIME_CURRENT
!
!		This macro returns the current time in
!		the host operating systems time format.
!		This is the format needed to set timer
!		interrupts.
!
!	TIME_CURRENT (OFFSET, TIM_BLK)
!
!	where	OFFSET	is the number of seconds to add to the
!			actual current time.
!		TIM_BLK	is the address of the time block in which
!			to store the resulting time.

macro
    TIME_CURRENT (OFFSET, TIM_BLK) =
	begin
	external routine SS$GTM : novalue;
	SS$GTM(OFFSET, TIM_BLK);
	end %;

!
! macro: TIME_SET_NULL
!
!		This macro sets a time block to a null value.
!		This value is used as a sentinel to check for
!		a valid time value (null/not null).
!
!	TIME_SET_NULL (TIM_BLK)
!
!	where	TIM_BLK	is the address of the time block.

macro
    TIME_SET_NULL (TIM_BLK) =
	begin
	    bind TBLK = TIM_BLK : TIME_BLOCK;
	    TBLK [TIME_JULIAN] = -1;
	end %;

!
! macro: TIME_NOT_NULL
!
!		This macro checks to the value in a time block
!		to see if it is not null (see TIME_SET_NULL).
!
!	TIME_NOT_NULL (TIM_BLK)
!
!	where	TIM_BLK	is the address of the time block to test.

macro TIME_NOT_NULL (TIM_BLK) =
	begin
	    bind TBLK = TIM_BLK : TIME_BLOCK;
	    .TBLK [TIME_JULIAN] neq -1
	end %;


!
! macro: TIME_NULL
!
!		This macro checks to the value in a time block
!		to see if it is null (see TIME_SET_NULL).
!
!	TIME_NULL (TIM_BLK)
!
!	where	TIM_BLK	is the address of the time block to test.

macro TIME_NULL (TIM_BLK) =
	begin
	    bind TBLK = TIM_BLK : TIME_BLOCK;
	    .TBLK [TIME_JULIAN] eql -1
	end %;

!
! macro: TIME_COPY
!
!		This macro copies the time from one time block
!		to another time block.
!
!	TIME_COPY (TO_BLK, FRM_BLK)
!
!	where	TO_BLK	is the time block to copy the time to.
!		FRM_BLK	is the time block to copy the time from.

macro TIME_COPY (TO_BLK, FRM_BLK) =
	begin
	    bind TOBLK = TO_BLK : TIME_BLOCK,
		 FRMBLK = FRM_BLK : TIME_BLOCK;

	    TOBLK [TIME_JULIAN] = .FRMBLK [TIME_JULIAN];
	    TOBLK [TIME_SECOND] = .FRMBLK [TIME_SECOND];
	    TOBLK [TIME_MILLISECOND] = .FRMBLK [TIME_MILLISECOND];
	end %;

!
! macro: TIME_TEST
!
!		This macro tests the chronological relation of
!		the values in two time blocks.  The test operator
!		is specified as an argument to the macro.  The
!		value returned by this macro is a boolean (true/false)
!		from the test "TB1 TST_FNC TB2" (i.e. TB1 lss TB2).
!
!	TIME_TEST (TBLK1, TST_FNC, TBLK2)
!
!	where	TBLK1	is the first time block.
!		TST_FNC	is the test operator (LSS, GTR, EQL,..etc)
!		TBLK2	is the second time time.

macro TIME_TEST (TBLK1, TST_FNC, TBLK2) =
	begin
	    bind TIMBLK1 = TBLK1 : TIME_BLOCK,
		 TIMBLK2 = TBLK2 : TIME_BLOCK;
	    external routine SS$TDF;
	    local ABTIME;
	    (SS$TDF(TIMBLK1,TIMBLK2,ABTIME) TST_FNC 0)
	end %;
!
! Wait Block Structure
!
!	This defines the WAIT_BLOCK used in timing out waiting for events,
!	specifically those waits implemented by calling NMU$SCHED_WAIT.
!
   $field WAIT_BLOCK_FIELDS =
	set
	  WAITING_TASK	= [$address],			!task block addr, to ref semaphore
		$ALIGN(FULLWORD)
	  WAIT_EVENT	= [$address],			!addr of event block to wait on
		$ALIGN(FULLWORD)
	  WAIT_TIME	= [$sub_block(TIME_BLOCK_SIZE)]	!time at which to 'wake'
	tes;
!
   literal
	WAIT_BLOCK_SIZE = $field_set_size;
!
   macro
	WAIT_BLOCK = block [WAIT_BLOCK_SIZE] field (WAIT_BLOCK_FIELDS)%;
!
!
! Memory allocation
!
! macro: CORE_GET
!
!		This macro gets a block of memory from the
!		operating system of the specified size.  The
!		address of the block is returned as the value
!		of the macro.
!
!	CORE_GET (BLOCK_SIZE)
!
!	where BLOCK_SIZE is the number of fullwords to be allocated.

macro
    CORE_GET (BLKSIZE) =
	begin
	external routine SS$COR;
	SS$COR(BLKSIZE)
	end %;

!
! MEMSIZE - return current address to top of memory
!

macro
    MEMSIZE =
	begin
	external MEMTOP;
	MEMTOP
	end %;

!<BLF/PAGE>
!
! Process sleep and indefinite waits
!
! macro: PROCESS_SLEEP
!
!		This macro puts the current process to
!		sleep for the specified amount of time.
!		The process is not guaranteed to sleep
!		the specified amount.
!
!	PROCESS_SLEEP (TIME)
!
!	where TIME is the number of milliseconds to sleep

macro
    PROCESS_SLEEP (TIME) =
	begin
	WTSE$S(32);
	CLEF$S(32);
	end %;

!
! macro: PROCESS_WAKE
!
!		This macro wakes up the current process.
!		It may be called at interrupt level to
!		complement the PROCESS_SLEEP function.
!

macro
    PROCESS_WAKE =
	begin
	SETF$S(32)
	end %;

!
!<BLF/PAGE>
!
! MCB Specific Network Definitions
!
$field
	NMU$NETSB$fields =		! Network QIO Status Block
	  set
	  NETSB$ERROR	= [$integer],	! Composite error code:
		$overlay(NETSB$ERROR)
	  	NETSB$ERR = [$tiny_integer], !error code
	  	NETSB$ERR1= [$tiny_integer], !0 = I/O error, -1 = directive error
		$continue
	  NETSB$IO_COUNT= [$integer],	! I/O count (bytes)
		$overlay(NETSB$IO_COUNT)
		NETSB$CNT = [$byte],	! Lower Byte
		NETSB$CNT1= [$byte],	! Upper Byte
		$continue
	  NETSB$LINK_ID = [$integer]	! LINK_ID for this operation
	  tes;

literal
	NMU$_NETSB_SIZE = $field_set_size,
	NMU$_NETSB_ALLOCATION = $field_set_units;

macro
	$NETWORK_STATUS_BLOCK =
	    BLOCK[NMU$_NETSB_SIZE]  FIELD( NMU$NETSB$fields ) %;

literal
	NMU$_NETWORK_MAX_INCOMING = 3,	!The Maximum number of targets
	NMU$_NETWORK_MAX_OUTGOING = 5,	!The Maximum number of sources
	NMU$_NETWORK_MAX_LUNS = NMU$_NETWORK_MAX_INCOMING + NMU$_NETWORK_MAX_OUTGOING;	!The Maximum number of Network LUNS

$literal
        NMU$_CONSOLE_LUN = $distinct,	!The LUN to use for the CONSOLE
	NMU$_NM_DEVICE_LUN = $distinct, !The LUN for the NM: device
	NMU$_DL0_DEVICE_LUN = $distinct, !A LUN for DLX device access
	NMU$_DL1_DEVICE_LUN = $distinct,!A LUN for DLX device access
! Note: all LUNs not associated with the network must be defined before here
	NMU$_NETWORK_LUN = $distinct;	!The LUN to use for Network Events
! Note: NETWORK_LUNS go to NMU$NETWORK_LUN + NMU$_NUMBER_OF_LUNS

$literal
	NMU$_CONSOLE_FLAG = $distinct,	!The Console Event Flag
	NMU$_NM_DEVICE_FLAG = $distinct,!The NM: device Event Flag
	NMU$_DL0_DEVICE_FLAG = $distinct,!A DLX device access Event Flag
	NMU$_DL1_DEVICE_FLAG = $distinct,!A DLX device access Event Flag
! Note: all Event flags not associated with the network must be defined before here
	NMU$_NETWORK_FLAG = $distinct;	!The Event Flag for Network Waits
! Note: NETWORK_FLAGS go to NMU$NETWORK_FLAG+ NMU$_NUMBER_OF_LUNS
!
! Define the NMUNET Data Structures
!
require 'NMUNTS';
!
!
! Local Modes:
! Mode:Fundamental
! Comment Start:!
! Comment Column:40
! Comment Rounding:+1
! Auto Save Mode:2
! End: