-- File: AltoEthernetDefs.mesa,  Last Edit: HGM  December 4, 1980  7:22 AM

DIRECTORY
  Mopcodes USING [zSTARTIO],
  InlineDefs USING [BcplLongNumber];

AltoEthernetDefs: DEFINITIONS =
  BEGIN

  Byte: TYPE = [0..377B];

  EthernetPost: TYPE = MACHINE DEPENDENT RECORD [
    microcodeStatus: EthernetMicrocodeStatus,
    hardwareStatus: EthernetHardwareStatus];
  ethernetNotPosted: EthernetPost = LOOPHOLE[0];

  EthernetMicrocodeStatus: TYPE = MACHINE DEPENDENT{
    inputDone(0), outputDone(1), inputBufferOverflow(2), outputLoadOverflow(3),
    zeroLengthBuffer(4), hardwareReset(5), interfaceBroken(6), last(377B)};

  EthernetHardwareStatus: TYPE = RECORD [Byte];
  hardwareAOK: EthernetHardwareStatus = [377B];
  -- from bit 200 [unused,unused,inputDataLate,Collision
  -- ,CRCbad,InputIssued,OutputIssued,packetNoEndOnWord]

  EthernetDeviceBlockHandle: TYPE = POINTER TO EthernetDeviceBlock;
  EthernetDeviceBlock: TYPE = MACHINE DEPENDENT RECORD [
    postData: EthernetPost,
    interruptBit: WORD,
    wordsLeft: CARDINAL,
    retransmissionMask: WORD,
    inputBuffer: WordBlockDescriptor,
    outputBuffer: WordBlockDescriptor,
    hostNumber: WORD,
    inputControlBlock: EthernetDeviceBlockHandle];
  -- Only used by Special MicroCode

  WordBlockDescriptor: TYPE = MACHINE DEPENDENT RECORD [
    count: CARDINAL, pointer: POINTER];

  NIL0: POINTER = LOOPHOLE[0]; -- hardware end tests



  StartIO: PROCEDURE [SioParameter] = MACHINE CODE BEGIN Mopcodes.zSTARTIO END;

  SioParameter: TYPE = RECORD [WORD];

  -- Standard Ethernet board
  standardEthernet: EthernetDeviceBlockHandle = LOOPHOLE[600B];
  standardReset: SioParameter = [standardInput + standardOutput];
  standardInput: SioParameter = [2];
  standardOutput: SioParameter = [1];

  -- Second Ethernet board
  secondEthernet: EthernetDeviceBlockHandle = LOOPHOLE[630B];
  secondReset: SioParameter = [secondInput + secondOutput];
  secondInput: SioParameter = [2*4];
  secondOutput: SioParameter = [1*4];

  -- Third Ethernet board
  thirdEthernet: EthernetDeviceBlockHandle = LOOPHOLE[642B];
  thirdReset: SioParameter = [thirdInput + thirdOutput];
  thirdInput: SioParameter = [2*4*4];
  thirdOutput: SioParameter = [1*4*4];


  -- Stats info for GateControl
  ethernetStatsReply: WORD = 1;
  EtherStatsEntry: TYPE = RECORD [
    version: WORD,
    packetsSent: InlineDefs.BcplLongNumber,
    badSendSatus: InlineDefs.BcplLongNumber,
    overruns: InlineDefs.BcplLongNumber,
    packetsRecv: InlineDefs.BcplLongNumber,
    badRecvStatus: InlineDefs.BcplLongNumber,
    inputOff: InlineDefs.BcplLongNumber,
    loadTable: ARRAY [0..16] OF InlineDefs.BcplLongNumber];
  etherVersion: WORD = 1;

  -- This is the way it is stored internally
  EtherStatsInfo: TYPE = RECORD [
    packetsSent: LONG CARDINAL ← 0,
    wordsSent: LONG CARDINAL ← 0,
    badSendSatus: LONG CARDINAL ← 0,
    overruns: LONG CARDINAL ← 0,
    packetsRecv: LONG CARDINAL ← 0,
    wordsRecv: LONG CARDINAL ← 0,
    badRecvStatus: LONG CARDINAL ← 0,
    inputOff: LONG CARDINAL ← 0,
    loadTable: ARRAY [0..16] OF LONG CARDINAL ← ALL[0]];

  END.