Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/drivers/dmcini.b16
There are no other files named dmcini.b16 in the archive.
module DMCINI (	! DMC-11 Driver Initialization
		ident = 'X01120',
		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 DMC Driver
!
! ABSTRACT:
!
!	This module contains the DMC 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 DMCNMX module.
! 02	- Add alternate DMC/DMR line names.
! 03	- Add DMCDBI - data base initializer.
! 04	- Fix REGISTER_NXM.
! 05	- Use $MCB_GET_DEVICE_NAME to get circuit/line name.
! 06	- Allow specification of max rcv buffers.
! 07	- Expand buffer for GET_DEVICE_NAME from 6 to 33!
! 08	- Save NMX PIX for NM parameter access in DMCNMX.
! 09	- Make default receive buffers 7 for DMC.
! 10	- Maintain new system specific line counters (2500,2501,2502).
! 11	- Turn on NMX$FLG_maintenance_allowed for circuit.
! 12	- Initialize time-line-zeroed for seconds-since-last-zeroed support.
!--
!
! INCLUDE FILES:
!

library 'MCBLIB';

library 'XPORTX';

library 'NMXLIB';

library 'DMCDAT';

!
! TABLE OF CONTENTS:
!

linkage
    DMC_CSR_NUM = jsr (register = 0, register = 1);

forward routine
    DMCDBI : novalue,
    DMCDVI,
    DMCNMI,
    NXM_CATCHER,
    REGISTER_NXM : DMC_CSR_NUM;

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

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

!
! OWN STORAGE:
!
!	None
!
! EXTERNAL REFERENCES:
!

linkage
    LINKAGE_DB_CSR = jsr (register = 5, register = 1);

external routine
    DMCIN : MCB_INTERRUPT novalue,
    DMCOUT : MCB_INTERRUPT novalue,
    MASTER_CLEAR : LINKAGE_DB_CSR;

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

bind
    DB_BIAS = MCB$GAW_PROCESS_DATA_BASE [0];
global routine DMCDBI : novalue =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	None
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DMC_DATA_BASE (DB)

    DB [D_NEXT_TRANSMIT_BUFFER] = DB [D_BUF];
    DB [D_HIGHEST_TRANSMIT_BUFFER] = DB [D_BUF] + .DB [D_MAXIMUM_TRANSMIT_COUNT]*.DB [D_TRANSMIT_BUFFER_SIZE];

    if .DB [DI_HD] eql 0
    then
	DB [DF_HALF_DUPLEX] = FALSE
    else
	DB [DF_HALF_DUPLEX] = TRUE;

    $NM_TIME (DB [DB_TIME_LINE_ZEROED]);
    end;			!of routine DMCDBI
global routine DMCDVI =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	None
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DMC_DATA_BASE (DB)

    literal
	DMC_TEST_VALUE = %o'177';

    DB [D_DEVICE_STATE] = DD_CLEARED;

    if .DB [D_REGISTER] lssa %o'160000'
    then
	begin
	COUNTER_INCREMENT (DB, D_INVALID_CONTROLLER_REGISTER);
	COUNTER_INCREMENT (DB, D_CONFIGURATION_ERRORS);
	return FALSE
	end;

    if REGISTER_NXM (.DB [D_REGISTER], 4)
    then
	begin
	COUNTER_INCREMENT (DB, D_NXM_CONTROLLER_REGISTER);
	COUNTER_INCREMENT (DB, D_CONFIGURATION_ERRORS);
	return FALSE
	end;

    begin

    local
	STATUS;

    STATUS = $MCB_SET_VECTOR (.DB [D_VECTOR], DMCIN, .DB [D_PRIORITY]);

    if .STATUS
    then
	begin
	STATUS = $MCB_SET_VECTOR (.DB [D_VECTOR] + 4, DMCOUT, .DB [D_PRIORITY]);

	if not .STATUS
	then
	    $MCB_CLEAR_VECTOR (.DB [D_VECTOR]);

	end;

    if not .STATUS
    then
	begin

	selectone .STATUS of
	    set
	    [CE$VEC]:
		COUNTER_INCREMENT (DB, D_INVALID_VECTOR);
	    [CE$VCU]:
		COUNTER_INCREMENT (DB, D_CONFLICTING_VECTOR);
	    [CE$PRI]:
		COUNTER_INCREMENT (DB, D_INVALID_PRIORITY);
	    tes;

	COUNTER_INCREMENT (DB, D_CONFIGURATION_ERRORS);
	return FALSE
	end;

    end;
    DB [D_DEVICE_STATE] = DD_MASTER_CLEARED;

    begin

    bind
	REG = .DB [D_REGISTER] : block field (DMC_FIELDS);

    REG [BSEL3] = DMC_TEST_VALUE;

    if not MASTER_CLEAR (DB [D_TIM], REG [SEL0])
    then
	begin
	DB [D_DEVICE_STATE] = DD_CLEARED;
	return FALSE;
	end;

    selectone .REG [$SUB_FIELD (BSEL3, 0, 0, 8, 0)] of
	set
	[%o'1', %o'2', %o'100', %o'200'] :
	    begin
	    DB [DF_DMR] = TRUE;

	    if .DB [D_MAXIMUM_RECEIVE_COUNT] eql 0
	    then
		DB [D_MAXIMUM_RECEIVE_COUNT] = 8;

	    end;
	[otherwise] :
	    begin
	    DB [DF_DMR] = FALSE;

	    if .DB [D_MAXIMUM_RECEIVE_COUNT] eql 0
	    then
		DB [D_MAXIMUM_RECEIVE_COUNT] = 7;

	    end;
	tes;

    end;
    TRUE
    end;			!of routine DMCDVI
global routine DMCNMI =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	None
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin
    GET_DMC_DATA_BASE (DB)

    local
	NAME_BUFFER : vector [ch$allocation (17)],
	NMXID,
	NMXPIX;

    bind
	NAME_PTR = ch$ptr (NAME_BUFFER);

    if not $MCB_GET_PROCESS_HANDLE (%rad50_11 'NMX', NMXPIX) then return FALSE;

    DB [D_NMX_PIX] = .NMXPIX;
    $MCB_GET_DEVICE_NAME (.DB [D_LINE_ENTITY], NAME_PTR);
    NMX$CREATE_LINE (.NMXPIX, NAME_PTR, 0, NMXID);
    NMX$MODIFY_LINE_PROVIDER (.NMXPIX, NAME_PTR,
	.MCB$GW_PROCESS_HANDLE^8 + DMC_K_LINE_PROVIDER,
	DB [D_LINE_ENTITY]);
    NMX$MODIFY_LINE_OWNER (.NMXPIX, NAME_PTR,
	.MCB$GW_PROCESS_HANDLE^8 + DMC_K_LINE_OWNER,
	NMXID);
    NMX$CREATE_CIRCUIT (.NMXPIX, NAME_PTR, NMX$FLG_maintenance_allowed, NMXID);
    NMX$MODIFY_CIRCUIT_PROVIDER (.NMXPIX, NAME_PTR,
	.MCB$GW_PROCESS_HANDLE^8 + DMC_K_CIRCUIT_PROVIDER,
	DB [D_CIRCUIT_ENTITY]);
    TRUE
    end;			!of routine DMCNMI
routine NXM_CATCHER (SIG, MCH, ENB) =

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!	SIG = signal vector address
!	MCH = mechanism vector address
!	ENB = enable vector address
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
! COMPLETION CODES:
!	None
!
! SIDE EFFECTS:
!	None
!--

    begin

    map
	ENB : ref vector,
	MCH : ref vector,
	SIG : ref vector;

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

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

!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
       (CSR : ref vector volatile,
	NUM)
!
! IMPLICIT INPUTS:
!	None
!
! IMPLICIT OUTPUTS:
!	None
!
! ROUTINE VALUE:
	: DMC_CSR_NUM =
!
! SIDE EFFECTS:
!	None
!--

    begin

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

    enable
	NXM_CATCHER (FLAG);

    do
	begin
	TEMP = .CSR [0];
	CSR = CSR [1];
	end
    while (NUM = .NUM - 1) nequ 0;

    .FLAG
    end;			!of routine REGISTER_NXM
end
eludom