<> <> <> DIRECTORY Buttons USING [Create], Containers USING [ChildXBound, ChildYBound], Convert USING [CardFromRope, Error, IntFromRope], FS USING [SetKeep], IO, PopUpSelection USING [Request], Rules USING [Create], TypeScript USING [Create], ViewerIO USING [CreateViewerStreams], ViewerTools USING [GetContents], SoftcardOps, SoftcardToolPrivate; SoftcardToolUtilsImpl: CEDAR PROGRAM IMPORTS Buttons, Containers, Convert, FS, IO, PopUpSelection, Rules, TypeScript, ViewerIO, ViewerTools, SoftcardOps, SoftcardToolPrivate EXPORTS SoftcardToolPrivate = BEGIN OPEN IO, SoftcardToolPrivate; <<* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >> InitArrays: PUBLIC PROC = { freqSelectArray[0] _ ["stopped", 0]; freqSelectArray[1] _ ["6.6 mhz", 1]; freqSelectArray[2] _ ["10 mhz", 2]; freqSelectArray[3] _ ["5 mhz", 3]; euSelectArray[0] _ ["left", 0]; euSelectArray[1] _ ["right", 1]; euSelectArray[2] _ ["st2A", 2]; euSelectArray[3] _ ["st2B", 3]; euSelectArray[4] _ ["st3A", 4]; euSelectArray[5] _ ["r2B", 7]; euSelectArray[6] _ ["r3A", 8]; euSelectArray[7] _ ["r3B", 9]; euSelectArray[8] _ ["dataIn", 15]; }; GetAsInt: PUBLIC PROC[who: Viewer] RETURNS[val: INT] = { rope: ROPE = ViewerTools.GetContents[who]; val _ -1; val _ Convert.IntFromRope[rope ! Convert.Error => CONTINUE]; }; GetAsCard: PUBLIC PROC[who: Viewer] RETURNS[val: LONG CARDINAL] = { rope: ROPE = ViewerTools.GetContents[who]; val _ LAST[LONG CARDINAL]; val _ Convert.CardFromRope[rope ! Convert.Error => CONTINUE]; }; ReadControlBits: PUBLIC ClickProc = { which: SoftcardOps.ControlBit; name: ROPE; val: BOOL; [which, name] _ SelectControlBit[]; IF name = NIL THEN RETURN; val _ SoftcardOps.ReadControlBit[which]; tsOut.PutF[" %g is %g\n", IO.rope[name], IO.bool[val] ]; }; SetControlBits: PUBLIC ClickProc = { which: SoftcardOps.ControlBit; name: ROPE; prev: BOOL; [which, name] _ SelectControlBit[]; IF name = NIL THEN RETURN; prev _ SoftcardOps.SetControlBit[which]; IF which = dragonRun THEN SetDragonStateLabelButton[running]; tsOut.PutF[" %g has been set: previous value was %g\n", IO.rope[name], IO.bool[prev] ]; }; ResetControlBits: PUBLIC ClickProc = { which: SoftcardOps.ControlBit; name: ROPE; prev: BOOL; [which, name] _ SelectControlBit[]; IF name = NIL THEN RETURN; prev _ SoftcardOps.ResetControlBit[which]; IF which = dragonRun THEN SetDragonStateLabelButton[stopped]; tsOut.PutF[" %g has been reset: previous value was %g\n", IO.rope[name], IO.bool[prev] ]; }; controlBitList: LIST OF ROPE = LIST[ "resetDragon", "notInterruptDragonToIOP", "interruptDragonToMesa", "dragonRun", "dragonStep", "writeParity", "virtualMemAccessIOP", "virtualMemAccessMesa", "virtualMemAccessIFU", "virtualMemAccessEU", "resetIFUCacheStateMachine", "notResetIFUCache", "ifuBreakpointEnabled", "resetEUCacheStateMachine", "notResetEUCache", "euBreakpointEnabled", "iopIntToDragon", "mesaIntToDragon", "notResetCounter"]; SelectControlBit: PROC RETURNS[SoftcardOps.ControlBit, ROPE] = { which: INT = PopUpSelection.Request[ header: "ControlBit", choice: controlBitList]; SELECT which FROM 1 => RETURN[resetDragon, "resetDragon"]; 2 => RETURN[interruptDragonToIOP, "interruptDragonToIOP"]; 3 => RETURN[interruptDragonToMesa, "interruptDragonToMesa"]; 4 => RETURN[dragonRun, "dragonRun"]; 5 => RETURN[dragonStep, "dragonStep"]; 6 => RETURN[writeParity, "writeParity"]; 7 => RETURN[virtualMemAccessIOP, "virtualMemAccessIOP"]; 8 => RETURN[virtualMemAccessMesa, "virtualMemAccessMesa"]; 9 => RETURN[virtualMemAccessIFU, "virtualMemAccessIFU"]; 10 => RETURN[virtualMemAccessEU, "virtualMemAccessEU"]; 11 => RETURN[resetIFUCacheStateMachine, "resetIFUCacheStateMachine"]; 12 => RETURN[notResetIFUCache, "notResetIFUCache"]; 13 => RETURN[ifuBreakpointEnabled, "ifuBreakpointEnabled"]; 14 => RETURN[resetEUCacheStateMachine, "resetEUCacheStateMachine"]; 15 => RETURN[notResetEUCache, "notResetEUCache"]; 16 => RETURN[euBreakpointEnabled, "euBreakpointEnabled"]; 17 => RETURN[iopIntToDragon, "iopIntToDragon"]; 18 => RETURN[mesaIntToDragon, "mesaIntToDragon"]; 19 => RETURN[notResetCounter, "notResetCounter"]; ENDCASE => RETURN[resetDragon, NIL]; }; ReadStatusBits: PUBLIC ClickProc = { which: SoftcardOps.StatusBit; name: ROPE; val: BOOL; [which, name] _ SelectStatusBit[]; IF name = NIL THEN RETURN; val _ SoftcardOps.ReadStatusBit[which]; tsOut.PutF[" %g is %g\n", IO.rope[name], IO.bool[val] ]; }; ResetStatusBits: PUBLIC ClickProc = { which: SoftcardOps.StatusBit; name: ROPE; prev: BOOL; [which, name] _ SelectStatusBit[]; IF name = NIL THEN RETURN; IF which = dOutIFU OR which = dOutEU OR which = phaseA THEN tsOut.PutF["Cannot reset %g\n", IO.rope[name] ] ELSE { prev _ SoftcardOps.ResetStatusBit[which]; tsOut.PutF[" %g has been reset: previous value was %g\n", IO.rope[name], IO.bool[prev] ]; }; }; statusBitList: LIST OF ROPE = LIST[ "dOutIFU", "dOutEU", "phaseA", "periodicIntToDragon", "notMemoryError", "euBkptReached", "ifuBkptReached", "mapError"]; SelectStatusBit: PROC RETURNS[SoftcardOps.StatusBit, ROPE] = { which: INT = PopUpSelection.Request[ header: "StatusBit", choice: statusBitList]; SELECT which FROM 1 => RETURN[dOutIFU, "dOutIFU"]; 2 => RETURN[dOutEU, "dOutEU"]; 3 => RETURN[phaseA, "phaseA"]; 4 => RETURN[periodicIntToDragon, "periodicIntToDragon"]; 5 => RETURN[notMemoryError, "notMemoryError"]; 6 => RETURN[euBkptReached, "euBkptReached"]; 7 => RETURN[ifuBkptReached, "ifuBkptReached"]; 8 => RETURN[mapError, "mapError"]; ENDCASE => RETURN[dOutIFU, NIL]; }; <> BuildMiscButtons: PUBLIC PROC[topViewer, sibx: Viewer, tsLogFile: ROPE] = { y: INTEGER; sib: Viewer _ sibx; <> sib _ Buttons.Create[ info: [ name: " ResetBoard ", parent: topViewer, wx: 3, wy: sib.wy + sib.wh + 2, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: ResetProc ]; sib _ Buttons.Create[ info: [ name: " ReadClock ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: ReadClockProc ]; sib _ Buttons.Create[ info: [ name: " EUPBusData ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: EUPBusDataProc ]; sib _ Buttons.Create[ info: [ name: " IFUPBusData ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: IFUPBusDataProc ]; sib _ Buttons.Create[ info: [ name: " EUPBusCmd ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: EUPBusCmdProc ]; sib _ Buttons.Create[ info: [ name: " IFUPBusCmd ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: IFUPBusCmdProc ]; <> sib _ Buttons.Create[ info: [ name: " ResetEUCacheStateMachine ", parent: topViewer, wx: 3, wy: sib.wy + sib.wh + 2, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: ResetEUCacheStateProc ]; sib _ Buttons.Create[ info: [ name: " ResetIFUCacheStateMachine ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: ResetIFUCacheStateProc ]; sib _ Buttons.Create[ info: [ name: " ResetCounter ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: ResetCounterProc ]; <> sib _ Buttons.Create[ info: [ name: " DisableEUCache ", parent: topViewer, wx: 3, wy: sib.wy + sib.wh + 2, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: DisableEUCacheProc ]; sib _ Buttons.Create[ info: [ name: " DisableIFUCache ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: DisableIFUCacheProc ]; sib _ Buttons.Create[ info: [ name: " FlushEUCache ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: FlushEUCacheProc ]; sib _ Buttons.Create[ info: [ name: " FlushIFUCache ", parent: topViewer, wx: sib.wx+sib.ww+5, wy: sib.wy, wh: entryHeight, border: TRUE, scrollable: FALSE], proc: FlushIFUCacheProc ]; <> sib _ Rules.Create[ info: [parent: topViewer, wy: sib.wy+sib.wh+1, ww: topViewer.ww, wh: 2]]; Containers.ChildXBound[topViewer, sib]; y _ sib.wy+sib.wh+4; tsViewer _ TypeScript.Create[ info: [parent: topViewer, ww: sib.cw, wy: y, wh: topViewer.ch - y, border: FALSE] ]; Containers.ChildYBound[topViewer, tsViewer]; Containers.ChildXBound[topViewer, tsViewer]; tsOut _ ViewerIO.CreateViewerStreams[NIL, tsViewer, tsLogFile, FALSE].out; FS.SetKeep[tsLogFile, 6]; tsOut.PutF["\tTypescript on file: %g\n", IO.rope[tsLogFile]]; tsOut.Flush[]; }; ResetProc: ClickProc = { tsOut.PutRope[" Not yet implemented - ResetDragon\n"] }; ReadClockProc: ClickProc = { val: LONG CARDINAL = SoftcardOps.ReadClock[]; tsOut.PutF[" Current clock reading is: %xH\n", IO.card[val] ]; }; EUPBusDataProc: ClickProc = { val: LONG CARDINAL = SoftcardOps.ReadEUPBusData[]; tsOut.PutF[" EUPBusData: %xH\n", IO.card[val] ]; }; IFUPBusDataProc: ClickProc = { val: LONG CARDINAL = SoftcardOps.ReadIFUPBusData[]; tsOut.PutF[" IFUPBusData: %xH\n", IO.card[val] ]; }; EUPBusCmdProc: ClickProc = { val: SoftcardOps.EUPBusCmd = SoftcardOps.ReadEUCmd[]; tsOut.PutF[" EUPBusCmd: [userMode: %g, unspecifiedAsYet: %xH]\n", IO.bool[val.userMode], IO.int[val.unspecifiedAsYet] ]; }; IFUPBusCmdProc: ClickProc = { val: SoftcardOps.IFUPBusCmd = SoftcardOps.ReadIFUCmd[]; tsOut.PutF[" IFUPBusCmd: %g\n", IO.rope[IF val = noAccess THEN "noAccess" ELSE "access"] ]; }; ResetEUCacheStateProc: ClickProc = { SoftcardOps.ResetEUCacheStateMachine[]; tsOut.PutRope[" ResetEUCacheStateMachine has been done\n"]; }; ResetIFUCacheStateProc: ClickProc = { SoftcardOps.ResetIFUCacheStateMachine[]; tsOut.PutRope[" ResetIFUCacheStateMachine has been done\n"]; }; ResetCounterProc: ClickProc = { SoftcardOps.ResetCounter[]; tsOut.PutRope[" ResetCounter has been done\n"]; }; DisableEUCacheProc: ClickProc = { SoftcardOps.DisableEUCache[]; tsOut.PutRope[" DisableEUCache has been done\n"]; }; DisableIFUCacheProc: ClickProc = { SoftcardOps.DisableIFUCache[]; tsOut.PutRope[" DisableIFUCache has been done\n"]; }; FlushEUCacheProc: ClickProc = { SoftcardOps.FlushEUCache[]; tsOut.PutRope[" FlushEUCache has been done\n"]; }; FlushIFUCacheProc: ClickProc = { SoftcardOps.FlushIFUCache[]; tsOut.PutRope[" FlushIFUCache has been done\n"]; }; END.