-- WaferProberImpl.mesa -- Access to Wafer Prober DIRECTORY Inline USING [LowHalf], IODefs: FROM "IODefs" USING [ WriteChar, ReadChar, CR, LF, ControlE, ControlS, ControlQ, ControlR, ControlT, ControlU, WriteString, WriteDecimal], PupStream: FROM "PupStream" USING [ GetPupAddress, PupAddress, PupPackageDestroy, PupPackageMake, SecondsToTocks, PupByteStreamCreate], Storage USING [Words, FreeWords, String], Stream: FROM "Stream" USING [ Handle, Delete, SetInputOptions, SendNow, Block, GetBlock, PutBlock, InputOptions, CompletionCode, GetChar, PutChar, TimeOut], String USING [ AppendChar, AppendSubString, AppendString, DeleteSubString, SubString, EqualSubString, SubStringDescriptor, EquivalentString, WordsForString], WaferProber; WaferProberImpl: PROGRAM IMPORTS Inline, IODefs, PupStream, Storage, Stream, String EXPORTS WaferProber = BEGIN OPEN IODefs, PupStream, Stream, String; WaferProberObject: PUBLIC TYPE = RECORD[streamHandle: Stream.Handle, pupAddress: PupAddress, inBlock, outBlock: Block, buffer: STRING _ NIL]; Handle: TYPE = LONG POINTER TO WaferProberObject; MyOptions: InputOptions = [terminateOnEndPhysicalRecord: TRUE, signalLongBlock: FALSE, signalShortBlock: TRUE, signalSSTChange: FALSE, signalEndOfStream: FALSE]; -- -- Open: PUBLIC PROCEDURE [name: STRING] RETURNS [h: Handle _ NIL] = BEGIN h _ Storage.Words[SIZE[WaferProberObject]]; h.buffer _ Storage.Words[WordsForString[256]]; h.buffer^ _ [length: 0, maxlength: 256, text:]; h.inBlock.blockPointer _ @h.buffer.text; h.inBlock.startIndex _ 0; h.inBlock.stopIndexPlusOne _ h.buffer.maxlength; h.outBlock.startIndex _ 0; PupPackageMake; GetPupAddress[Inline.LowHalf[@h.pupAddress], name]; h.streamHandle _ PupByteStreamCreate[h.pupAddress, SecondsToTocks[60]]; SetInputOptions[h.streamHandle, MyOptions]; RETURN[h] END; -- Open Close: PUBLIC PROCEDURE [ph: LONG POINTER TO Handle] = BEGIN h: Handle = ph^; Stream.Delete[h.streamHandle]; PupPackageDestroy; ph^ _ NIL; Storage.FreeWords[h.buffer]; Storage.FreeWords[Inline.LowHalf[h]]; END; -- Close Align: PUBLIC PROCEDURE [h: Handle] = BEGIN [] _ TalkToWaferProber[h, "AL*"]; END; -- Align GetDeviceCoordinate: PUBLIC PROCEDURE [h: Handle] RETURNS [x, y: STRING _ NIL] = BEGIN response: STRING = TalkToWaferProber[h, "?DC*", FALSE]; ssd: SubStringDescriptor; ss: SubString = @ssd; IF response[0] = 'D AND response[1] = 'C THEN { indexSep: CARDINAL _ 0; indexLast: CARDINAL _ 0; FOR i: CARDINAL IN [0..response.length) DO IF response[i] = '- THEN indexSep _ i; IF response[i] = '* THEN indexLast _ i; ENDLOOP; x _ Storage.String[indexSep-2]; ssd _ [base: response, offset: 2, length: x.maxlength]; AppendSubString[x, ss]; y _ Storage.String[indexLast-(indexSep+1)]; ssd _ [base: response, offset: (indexSep+1), length: y.maxlength]; AppendSubString[y, ss]; } ELSE {ERROR}; RETURN[x, y] END; -- GetDeviceCoordinate GoHide: PUBLIC PROCEDURE [h: Handle] = BEGIN [] _ TalkToWaferProber[h, "HI*"]; END; -- GoHide GoHome: PUBLIC PROCEDURE [h: Handle] = BEGIN [] _ TalkToWaferProber[h, "HO*"]; END; -- GoHome InitializeZ: PUBLIC PROCEDURE [h: Handle] = BEGIN [] _ TalkToWaferProber[h, "ZI*"]; END; -- InitializeZ Load: PUBLIC PROCEDURE [h: Handle] = BEGIN [] _ TalkToWaferProber[h, "LD*"]; END; -- Load SetDieSize: PUBLIC PROCEDURE [h: Handle, x, y: STRING] = BEGIN command: STRING = [128]; command.length _ 0; AppendString[command, "DS"L]; AppendString[command, x]; AppendString[command, "-"L]; AppendString[command, y]; AppendString[command, "*"L]; [] _ TalkToWaferProber[h, command]; END; -- SetDieSize Seek: PUBLIC PROCEDURE [h: Handle, x, y: STRING] = BEGIN command: STRING = [128]; command.length _ 0; AppendString[command, "SK"L]; AppendString[command, x]; AppendString[command, "-"L]; AppendString[command, y]; AppendString[command, "*"L]; [] _ TalkToWaferProber[h, command]; END; -- Seek SetDeviceCoordinate: PUBLIC PROCEDURE [h: Handle, x, y: STRING] = BEGIN command: STRING = [128]; command.length _ 0; AppendString[command, "DC"L]; AppendString[command, x]; AppendString[command, "-"L]; AppendString[command, y]; AppendString[command, "*"L]; [] _ TalkToWaferProber[h, command]; END; -- SetDeviceCoordinate ToggleZ: PUBLIC PROCEDURE [h: Handle] = BEGIN [] _ TalkToWaferProber[h, "ZM*"]; END; -- ToggleZ -- -- -- TalkToWaferProber: PROCEDURE [h: Handle, DummyPointer: STRING, actionCompleteExpected: BOOLEAN _ TRUE] RETURNS [NewPointer: STRING] = BEGIN Why: CompletionCode; h.outBlock.blockPointer _ @DummyPointer.text; h.outBlock.stopIndexPlusOne _ DummyPointer.length; PutBlock[h.streamHandle, h.outBlock, FALSE]; SendNow[h.streamHandle]; [h.buffer.length, Why] _ GetBlock[h.streamHandle, h.inBlock! TimeOut => BEGIN WriteChar[CR]; WriteString["No response from LoGlas, it may be busy"]; WriteChar[CR]; WriteString["Try Again,Debugger,Quit?"]; SELECT ReadChar[] FROM 'T, 't => RETRY; 'C, 'c => CONTINUE; 'D, 'd => ERROR TimeOut[nextIndex]; 'Q, 'q => BEGIN WriteString["Will now close data base"]; WriteChar[CR]; --NoMoreWafers _ TRUE; GOTO End; END; ENDCASE => ERROR; END; ]; SELECT Why FROM = normal => NULL;--WriteString["CompletionCode is Normal "]; = endRecord => NULL;--WriteString["CompletionCode is endRecord "]; = sstChange => WriteString["CompletionCode is sstChange "]; = endOfStream => WriteString["CompletionCode is endOfStream "]; ENDCASE => WriteString["CompletionCode Error "]; --WriteChar[CR]; SELECT h.buffer[h.buffer.length - 2] FROM = ControlS => NULL; = ControlQ => BEGIN WriteString["On-Line mode Selected---"]; WriteString["Strike a key to continue"]; [] _ ReadChar[]; END; = ControlR => BEGIN WriteString["Off-Line mode Selected---"]; WriteString["Strike a key to continue"]; [] _ ReadChar[]; END; = ControlT => BEGIN WriteString["Repeat Transmission---"]; WriteString["Strike a key to continue"]; [] _ ReadChar[]; END; = ControlU => BEGIN WriteString["Data Not Acknowledged---"]; WriteString["Strike a key to continue"]; [] _ ReadChar[]; END; ENDCASE; -- => WriteString["You must not have found the correct character"]; -- WriteChar[CR]; -- WriteString["Prober responds with "]; -- WriteString[h.buffer]; -- WriteChar[CR]; NewPointer _ h.buffer; EXITS End => NULL; END; -- TalkToWaferProber CutOffRecord: SubStringDescriptor; CutOff: SubString = @CutOffRecord; PromptString: STRING = "COMMAND:"; PromptRecord: SubStringDescriptor _ [PromptString, 0, 8]; Prompt: SubString = @PromptRecord; BREAKString: STRING = "*BREAK"; BREAKRecord: SubStringDescriptor _ [BREAKString, 0, 6]; BREAK: SubString = @BREAKRecord; LineRecord: SubStringDescriptor; LinePointer: SubString = @LineRecord; CRLF: STRING _ [2]; ContE: STRING _ [1]; -- Mainline Statements Follow, Initialization only AppendChar[CRLF, CR]; AppendChar[CRLF, LF]; AppendChar[ContE, ControlE]; END.-- WaferProberImpl