DriverDefs.Mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
HGM January 6, 1981 9:21 PM
BLyon January 16, 1981 2:48 PM
Russ Atkinson (RRA) February 2, 1985 3:03:00 pm PST
DIRECTORY
StatsDefs USING [StatCounterIndex],
BufferDefs USING [
Buffer, BufferAccessHandle, BufferFunction, BufferType, OisBuffer, PupBuffer,
Queue, systemAccessHandle],
PupTypes USING [PupHostID, PupErrorCode],
DriverTypes USING [DeviceType],
NSAddress USING [HostNumber, NetworkNumber];
DriverDefs: DEFINITIONS IMPORTS BufferDefs =
BEGIN OPEN BufferDefs;
Interface from device drivers to Dispatcher and QueuePackage
PutOnGlobalInputQueue: PROCEDURE [Buffer];
PutOnGlobalDoneQueue: PROCEDURE [Buffer];
GetInputBuffer: PROCEDURE [tryToWaitForBuffer: BOOLEANFALSE]
RETURNS [Buffer]; -- b.length (words) includes encap
ReturnFreeBuffer: PROCEDURE [Buffer];
These will return the last buffer. They never wait. Be careful. NIL if its empty.
MaybeGetFreePupBuffer: PROCEDURE RETURNS [PupBuffer] = INLINE {
RETURN[
LOOPHOLE[MaybeGetFreeBuffer[
pup, BufferDefs.systemAccessHandle, systemUse]]]};
MaybeGetFreeOisBuffer: PROCEDURE RETURNS [OisBuffer] = INLINE {
RETURN[
LOOPHOLE[MaybeGetFreeBuffer[
ois, BufferDefs.systemAccessHandle, systemUse]]]};
MaybeGetFreeBuffer: PROCEDURE [
bufType: BufferType ← raw,
aH: BufferAccessHandle ← BufferDefs.systemAccessHandle,
bufFunc: BufferFunction ← systemUse] RETURNS [Buffer];
Interface to Routers
Router: TYPE = LONG POINTER TO RouterObject;
RouterObject: TYPE = RECORD [
input: PROCEDURE [Buffer],
broadcast: PROCEDURE [Buffer],
addNetwork: PROCEDURE [Network],
removeNetwork: PROCEDURE [Network],
stateChanged: PROCEDURE [Network]];
Interface to Device Drivers
nilNetwork: Network = NIL;
Network: TYPE = LONG POINTER TO NetworkObject;
NetworkObject: TYPE = RECORD [
next: Network,
decapsulateBuffer: PROCEDURE [Buffer] RETURNS [BufferDefs.BufferType],
encapsulatePup: PROCEDURE [PupBuffer, PupTypes.PupHostID],
encapsulateOis: PROCEDURE [OisBuffer, NSAddress.HostNumber],
sendBuffer: PROCEDURE [Buffer],
forwardBuffer: PROCEDURE [Buffer] RETURNS [PupTypes.PupErrorCode],
activateDriver: PROCEDURE,
deactivateDriver: PROCEDURE,
deleteDriver: PROCEDURE,
interrupt: PROCEDURE, -- to lock things in memory
changeNumberOfInputBuffers: PROCEDURE [ --increaseBuffers--BOOLEAN] ← NIL,
index: [0..400B), -- assigned by AddDeviceToChain (starts at 1)
device: DriverTypes.DeviceType, -- 4 bits
alive: BOOLEAN,
speed: CARDINAL, -- KiloBits/Sec
buffers: [0..256),
spare: [0..256),
netNumber: NSAddress.NetworkNumber,
hostNumber: CARDINAL, -- This is the Pup host number
pupStats: PROCEDURE [PupBuffer, Network] RETURNS [BOOLEAN],
stats: LONG POINTER]; -- and debugging
ON/OFF
CommPackageGo: PROCEDURE;
CommPackageOff: PROCEDURE;
GetUseCount: PROCEDURE RETURNS [CARDINAL];
SetPupRouter, SetOisRouter: PROCEDURE [Router]; -- NIL to Deactivate
GetPupRouter, GetOisRouter: PROCEDURE RETURNS [Router];
StateChanged: PROCEDURE [Network];
Device Things
AddDeviceToChain: PROCEDURE [network: Network, iocbSize: CARDINAL];
RemoveDeviceFromChain: PROCEDURE [Network];
GetDeviceChain: PROCEDURE RETURNS [Network];
SmashDeviceChain: PROCEDURE; -- only used by LoopBackPlug (to forget Ethernet)
ChangeNumberOfInputBuffers: PROCEDURE [increaseTheBuffers: BOOLEAN];
affects all drivers on the chain
Setting up individual device drivers
CreateDefaultEthernetOneDrivers: PROCEDURE RETURNS [BOOLEAN];
CreateDefaultEthernetDrivers: PROCEDURE RETURNS [BOOLEAN];
CreateLoopBackDriver: PROCEDURE RETURNS [BOOLEAN];
CreateEthernetDriver: PROCEDURE [netNumber: CARDINAL, deviceNumber: [0..3)]
RETURNS [BOOLEAN];
CreateChainedEthernetDriver: PROCEDURE [
netNumber: CARDINAL, deviceNumber: [0..3)] RETURNS [BOOLEAN];
CreateEIADriver: PROCEDURE [host, net, lines: CARDINAL] RETURNS [BOOLEAN];
CreateCommProcDriver: PROCEDURE [host, net, lines: CARDINAL] RETURNS [BOOLEAN];
AssignPassword: PROCEDURE [line: CARDINAL, password: STRING];
CreatePacketRadioDriver: PROCEDURE [host, net: CARDINAL] RETURNS [BOOLEAN];
AdjustLengthOfEthernetInputQueue: PROCEDURE [CARDINAL];
AdjustLengthOfEthernetIIInputQueue: PROCEDURE [CARDINAL];
Stats linkage
EthernetStats: PROCEDURE [PupBuffer, Network] RETURNS [BOOLEAN];
SlaStats: PROCEDURE [PupBuffer, Network] RETURNS [BOOLEAN];
PacketRadioStats: PROCEDURE [PupBuffer, Network] RETURNS [BOOLEAN];
Internal routines
DispatcherOn: PROCEDURE;
DispatcherOff: PROCEDURE;
Larry and Yogen
DriverXmitStatus: TYPE = {
pending, goodCompletion, aborted, noRouteToNetwork, hardwareProblem,
invalidDestAddr, crateTooSmall,
the following apply to circuit-like media only and mostly to the first packet sent
noAnswerOrBusy, -- auto-dial case only
noTranslationForDestination, -- no phone number for this destination
circuitInUse, -- being used to talk to another destination
circuitNotReady, -- dial the phone or connect modems (non-auto-dial case)
noDialingHardware, dialerHardwareProblem};
General catchall for things that shouldn't happen
Glitch: PROCEDURE [ERROR];
interface to SystemBufferPool
GetWordsPerIocb: PROCEDURE RETURNS [CARDINAL];
SetWordsPerIocb: PROCEDURE [CARDINAL];
For getting things STARTed
Boss, DispatcherImpl, BufferMgr: PROGRAM;
Beware MakeImage does not preserve debugPointer.
GetGiantVector: PROCEDURE RETURNS [POINTER TO GiantVector];
GiantVector: TYPE = RECORD [
firstNetwork: Network,
firstBuffer: Buffer,
bufferPoolSize: CARDINAL,
wordsPerBuffer: CARDINAL,
pupRoutingTable: LONG DESCRIPTOR FOR ARRAY OF UNSPECIFIED,
firstPupSocket: LONG POINTER,
freeQueue, globalInputQueue, globalOutputQueue: Queue,
firstBufferAccessHandle: BufferDefs.BufferAccessHandle,
hacks until we get more drivers
ethernetOutputQueue: Queue,
currentInputBuffer, nextInputBuffer, currentOutputBuffer: POINTER TO Buffer,
statCounters: LONG POINTER TO ARRAY StatsDefs.StatCounterIndex OF LONG
CARDINAL,
statStrings: LONG POINTER TO ARRAY StatsDefs.StatCounterIndex OF STRING,
slaThings: LONG POINTER,
prThings: LONG POINTER,
spare: LONG POINTER];
END.
LOG
August 1, 1980 3:38 PM by BLyon, Action: modified netNumber in NetworkObject.
August 6, 1980 10:17 AM By: Garlick Action: Added several DriverXmitStatus's for circuit-oriented network errors.
August 1, 1980 3:38 PM by HGM, Action: added buffers, stateChanged, and such.
Time: October 10, 1980 4:50 PM By: Garlick Action: Added DriverXmitStatus noAnswerOrBusy.
Time: November 25, 1980 6:31 PM By: BLyon Action: turned off doStats