// PupAlEth.decl -- declarations specific to Alto Ethernet
// Copyright Xerox Corporation 1979, 1980

// Last modified March 9, 1980  5:27 PM by Taft

manifest
[
// An Ethernet packet type, in second word of Ether Packets
typePup = 1000b		// I'm a Pup in an Ether packet

etherStatsVersion = 1

// Error codes
ecNoEthernetInterface = 2230
ecBadEtherStatus = 2231
ecZeroHostAddress = 2232
]


//----------------------------------------------------------------------------
structure EtherPBI:	// Ethernet encapsulation:
//----------------------------------------------------------------------------
[
blank word offset PBI.pup/16-2
dest byte		// destination host address
src byte		// source host address
type word		// packet type
]

// ensure consistency of constants defined in PupAlEtha.asm
compileif offset PBI.packetLength/16 ne 6 %
 offset EtherPBI.dest/16 ne 7 % offset EtherPBI.type/16 ne 8 %
 offset PBI.pup.length/16 ne 9 then
   [ Error("Change PBI constants in PupAlEtha.asm") ]


//----------------------------------------------------------------------------
structure EtherStats:	// Ethernet Statistics
//----------------------------------------------------------------------------
[
statsType word		// = netTypeEther
statsVersion word	// = etherStatsVersion

packetsSent word 2
numBadXmtStatus word 2
numOverRuns word 2	// input or output data late

packetsRcvd word 2
numBadRcvStatus word 2
inputOff word 2

loadTable↑0,16 word 2
]
manifest lenEtherStats = size EtherStats/8  // *** in BYTES ***

//----------------------------------------------------------------------------
structure EtherNDB:	// Ethernet NDB
//----------------------------------------------------------------------------
[
@NDB			// standard portion
// *** Update PupAlEtha.asm if the following is moved or rearranged ***
lastEPLoc word		// EPLoc for most recent interrupt
lastEELoc word		// EELoc for most recent interrupt
lastEIB word		// -> input PBI for most recent interrupt
eIB word		// -> input PBI or 0 if none
eOB word		// -> output PBI or 0 if none
eState word		// -1: xmting, 0: off, 1: rcving
ePLoc word		// -> Post location
eBLoc word		// -> Interrupt bit mask location
eELoc word		// -> EOT count location, Posted
eLLoc word		// -> Load location (mask)
eICLoc word		// -> Input count location
eIPLoc word		// -> Input pointer location
eOCLoc word		// -> Output count location
eOPLoc word		// -> Output pointer location
eHLoc word		// -> Host Address location
outCmd word		// SIO bits to start transmitter
inCmd word		// SIO bits to start receiver
resetCmd word		// SIO bits to reset hardware & firmware
prolog word 7 =		// machine code prolog for this interface
   [
   asmProlog word 3	// prolog for asm interrupt code
   bcplProlog word 2	// prolog for bcpl interrupt code
   ndb word		// -> this ndb
   save3 word		// ac3 temp
   ]
savedID word		// -> saved interrupt dispatch
stack word		// ac2 temp
// ***
tTimer word		// for timing out transmitter
oQ:			// device output queue
   [
   head word
   tail word
   ]
mask word		// interrupt mask
stats word = @EtherStats
zone word		// zone from which NDB allocated
ctxQ word		// ctxQ on which EtherFeeder ctx put
feederCtx word		// the EtherFeeder context
]
manifest lenEtherNDB = size EtherNDB/16
compileif offset EtherNDB.stack/16 ne 40 then
   [ Error("Change NDB offsets in PupAlEtha.asm") ]