GPIB.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Last edited by Neil Gunther, November 8, 1985 1:57:25 pm PST
Tim Diebert: March 25, 1986 10:44:41 am PST
Last Edited by: Gasbarro March 4, 1986 10:25:28 am PST
This interface defines the IEEE 488 General Purpose Interface Bus (GPIB) standard for asynchronous byte serial bit parallel interfacing to instrumentation. It contains all the standard commands, both universal and selected, and data transfer PROC's. To keep machine-dependent applications organized, this PUBLIC interface is EXPORTED by the appropriate driver-level implementation which must be bound into the client's configuration.
IEEE 488 Technical Parameters:
o Maximum transmission length = 20 meters/bus; 2m/device; Star or Linear network.
o Maximum number of devices/bus = 15; 1 talker/14 listeners.
o Maximum data rate = 1Mbps for short paths; ~300 Kbps typical; device limited.
o Signals: 8 data/8 control simultaneously active.
o Data Transfer: byte serial bit parallel, asynchronous, with 3-wire handshake.
o Only one controller may be active at once. The sytem controller is the master.
For the formal bus specification see: IEEE Standard Digital Interface for Programmable Instrumentation, ANSI/IEEE Std 488-1978 and ANSI/IEEE Std 728-1982.
DIRECTORY Rope;
GPIB: DEFINITIONS = BEGIN
Types and Constants
Bus Status
StatusFlag: TYPE = {
DAV, -- Data Valid
NRFD, -- Not Ready For Data
NDAC, -- NOT Data Accepted
IFC, -- Interface Cleared
SRQ, -- Service Request
REN, -- Remote Enable
EOI, -- End or Identify
ATN -- Attention [switch Command/Data modes]
};
maxWriteBuffer: NAT = 512+5;
maxReadBuffer: NAT = 512+5;
StatusVec: TYPE = ARRAY StatusFlag OF BOOL;
SRQLabels: TYPE = ARRAY StatusFlag OF Rope.ROPE;
Command Group
goToLocal: CHAR = 001C;   -- GTL
selectedDeviceClear: CHAR = 004C;  -- SDC
parallelPollConfigure: CHAR = 005C;  -- PPC
groupExecuteTrigger: CHAR = 010C;  -- GET
takeControl: CHAR = 011C;  -- TCT
localLockout: CHAR = 021C;  -- LLO
devicesClear: CHAR = 024C;  -- DCL
parallelPollUnconfigure: CHAR = 025C; -- PPU
serialPollEnable: CHAR = 030C;  -- SPE
serialPollDisable: CHAR = 031C;  -- SPD
parallelPollEnable: SecondaryCommand = 140C; -- PPE
parallelPollDisable: SecondaryCommand = 160C; -- PPD
Listen/Talk Address Groups
ListenAddress: TYPE = CHAR [040C..077C];
UnListen: ListenAddress = 077C;
TalkAddress: TYPE = CHAR [100C..137C];
UnTalk: TalkAddress = 137C;
SecondaryCommand: TYPE = CHAR [100C..177C];
FORMAT: TYPE = {F0, F1, F2, F3, F4, F5};
PrimaryAddress: TYPE = CHAR [040C..137C];
DeviceAddr: TYPE = NAT [0..31);
Terminator: TYPE = {CR, LF, EOI};
Procedures
Universal commands (all devices whether addressed or not)
Command: PROC [sendMsg: Rope.ROPE];
DevicesClear: PROC;
GoToLocal: PROC;
GroupExecuteTrigger: PROC;
InterfaceClear: PROC;
LocalLockout: PROC;
RemoteEnable: PROC;
Selected Device Commands (only those devices addressed)
SelectedDeviceClear: PROC [device: DeviceAddr];
SelectedGoToLocal: PROC [device: DeviceAddr];
SelectedGroupEnableTrigger: PROC [device: DeviceAddr];
SelectedRemoteEnable: PROC [device: DeviceAddr];
Explicit Polling Routines
ParallelPollConfigure: PROC [device: DeviceAddr];
ParallelPollUnconfigure: PROC;
SelectedParallelPollConfigure: PROC [device: DeviceAddr];
SelectedParallelPollUnconfigure: PROC [device: DeviceAddr];
Read Specific Devices
PollDevice: PROC [device: DeviceAddr, labels: SRQLabels];
ReadDevice: PROC [device: DeviceAddr, terminator: Terminator ← EOI]
RETURNS [recvMsg: Rope.ROPE];
ReadOnInterrupt: PROC [device: DeviceAddr, recvMsg: Rope.ROPE, labels: SRQLabels];
SelectedReadSerialPoll: PROC [device: DeviceAddr] RETURNS [statusByte: CHAR];
ReadStatusByte: PROC [device: DeviceAddr] RETURNS [char: CHAR]; 
Write Specific Devices
WriteDevice: PROC [device: DeviceAddr, sendMsg: Rope.ROPE];
WriteDeviceBuffered: PROC [device: DeviceAddr, sendMsg: Rope.ROPE, hold: BOOL];
Uses a double buffer scheme to make RPC go faster. Set hold: TRUE on last packet of buffer to ensure syncronization with next command.
Convenience Functions
InitializeController: PROC RETURNS [open: BOOL];
FinalizeController: PROC;
SRQAsserted: PROC RETURNS [asserted: BOOL];
Printer Functions (see Tim Diebert)
WriteDeviceInitial: PROC [device: DeviceAddr, sendMsg: Rope.ROPE];
-- Sends the string without asserting EOI.
WriteDeviceContinued: PROC [device: DeviceAddr, sendMsg: Rope.ROPE, last: BOOL];
-- Sends the string without the initial stuff.
WriteDeviceBlock: UNSAFE PROC [device: DeviceAddr,
lp: LONG POINTER TO WORD, -- For Lupine --
quadWordCnt: CARDINAL, last: BOOL];
-- Sends the bytes pointed to by lp, the total bytes count must be a multiple of 8.
WriteDMABlock: UNSAFE PROC [device: DeviceAddr,
multiBusAddress: LONG POINTER TO WORD, -- For Lupine --
byteCnt: CARDINAL, last: BOOL];
-- Sends the bytes pointed to by multiBusAddress from the MultiBus Memory card in the busmaster.
CheckDMADone: PROC RETURNS [BOOL];
Indicates that the DMA transfer is complete and the controller is willing to start another.
END.