SoftcardToolUtilsImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Willie-Sue, February 18, 1987 9:15:32 pm PST
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];
};
builds the miscellaneous buttons - sib is the last button created
BuildMiscButtons: PUBLIC PROC[topViewer, sibx: Viewer, tsLogFile: ROPE] = {
y: INTEGER;
sib: Viewer ← sibx;
line 1 of miscellaneous buttons
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 ];
line 2 of miscellaneous
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 ];
line 8 of Buttons - miscellaneous
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 ];
the rest of the viewer - typescript
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.