-- File: TedIn.mesa, Last Edit: HGM February 24, 1980 5:34 AM -- Copyright Xerox Corporation 1979, 1980 DIRECTORY CommUtilDefs: FROM "CommUtilDefs" USING [GetTicks, msPerTick], TedDefs: FROM "TedDefs", AltoEthernetDefs: FROM "AltoEthernetDefs", BufferDefs: FROM "BufferDefs", DriverTypes: FROM "DriverTypes" USING [pupEthernetPacket]; TedIn: MONITOR LOCKS TedDefs.lock IMPORTS CommUtilDefs, AltoEthernetDefs, TedDefs EXPORTS TedDefs SHARES BufferDefs, DriverTypes = BEGIN OPEN BufferDefs, AltoEthernetDefs, TedDefs; Watcher: PUBLIC PROCEDURE = BEGIN UNTIL tedPleaseStop DO THROUGH [0..25) DO IF myDevice.postData=EthernetNotPosted THEN EXIT; -- If the post location is not zero, an interrupt should be pending. Since the interrupt routine is higher priority than we are, it should get processed before we can see it. If we get here, an interrupt has probably been lost. It could have been generated between the time we started decoding the instruction and the time that the data is actually fetched. That is why we look at the post location several times. Of course, if it is still not zero when we look again, it could be a new interrupt that has just arrived. REPEAT FINISHED => BEGIN WatcherNotify[]; END; ENDLOOP; IF currentOutputBuffer#NIL AND (CommUtilDefs.GetTicks[]-timeSendStarted)>250/CommUtilDefs.msPerTick THEN StartIO[resetCommand]; -- interrupt code will flush it WatcherWait[]; ENDLOOP; END; WatcherWait: ENTRY PROCEDURE = INLINE BEGIN WAIT timer; END; WatcherNotify: ENTRY PROCEDURE = INLINE BEGIN NOTIFY hardware; END; DecapsulateBuffer: PUBLIC PROCEDURE [b: Buffer] RETURNS [BufferType] = BEGIN SELECT b.encapsulation.ethernetType FROM DriverTypes.pupEthernetPacket => BEGIN IF b.length#((b.pupLength+1+ethernetEncapsulationBytes)/2) THEN BEGIN RETURN[rejected]; END; RETURN[pup]; END; ENDCASE => RETURN[rejected]; END; END. -- TedIn(2048)\495b7B133i525I307b11B57b13B62b17B