DIRECTORY Basics USING [ BITAND, HighHalf, LowHalf, DoubleShiftRight], DoveInputOutput USING [ Peek, Poke ], SparcSoftcard, SparcSoftcardOps; SparcSoftcardOpsImpl: PROGRAM IMPORTS Basics, DoveInputOutput EXPORTS SparcSoftcardOps ~ { OPEN SparcSoftcard; PeekAtByteAd: PROC [byteAd: CARD32] RETURNS [content: CARD16] ~ { wordAd: CARD32 _ Basics.DoubleShiftRight[[lc [byteAd]], 1].lc; -- /2 content _ DoveInputOutput.Peek[wordAd]; }; PokeAtByteAd: PROC [byteAd: CARD32, content: CARD16] ~ { wordAd: CARD32 _ Basics.DoubleShiftRight[[lc [byteAd]], 1].lc; -- /2 DoveInputOutput.Poke[wordAd, content]; }; ControlBitWrite: PUBLIC PROC [ byteAddress: CARD32, polarity: Polarity, value: BOOL ] ~ { SELECT TRUE FROM (polarity=ActiveLow) AND value => PokeAtByteAd[byteAddress, 0]; (polarity=ActiveLow) AND (NOT value) => PokeAtByteAd[byteAddress, commandBitMask]; (polarity=ActiveHigh) AND value => PokeAtByteAd[byteAddress, commandBitMask]; (polarity=ActiveHigh) AND (NOT value) => PokeAtByteAd[byteAddress, 0]; ENDCASE; }; ControlBitRead: PUBLIC PROC [ byteAddress: CARD32, polarity: Polarity ] RETURNS [ value: BOOL ] ~ { read: CARD16 ~ Basics.BITAND[commandBitMask, PeekAtByteAd[byteAddress]]; SELECT TRUE FROM ( ( polarity = ActiveLow ) AND ( read = 0) ) => { value _ TRUE }; ( ( polarity = ActiveLow ) AND ( read # 0) ) => { value _ FALSE }; ( ( polarity = ActiveHigh ) AND ( read = 0) ) => { value _ FALSE }; ( ( polarity = ActiveHigh ) AND ( read # 0) ) => { value _ TRUE }; ENDCASE; }; SparcReset: PUBLIC PROC ~ { ControlBitWrite[sparcResetRegisterByte, sparcResetPolarity, TRUE]; ResetSparcToIOPInt[]; ResetSparcToMesaInt[]; ResetSparcToSparcInt[]; ResetIOPToSparcInt[]; ResetMesaToSparcInt[]; }; SparcResetAndStart: PUBLIC PROC ~ { ControlBitWrite[sparcResetRegisterByte, sparcResetPolarity, TRUE]; ControlBitWrite[sparcResetRegisterByte, sparcResetPolarity, FALSE]; ResetSparcToIOPInt[]; ResetSparcToMesaInt[]; ResetSparcToSparcInt[]; ResetIOPToSparcInt[]; ResetMesaToSparcInt[]; }; TestSparcError: PUBLIC PROC RETURNS [ error: BOOLEAN ] ~ { error _ ControlBitRead[sparcErrorRegisterByte, sparcErrorPolarity]; }; SparcCacheDisable: PUBLIC PROC ~ { ControlBitWrite[sparcCacheEnableRegisterByte, sparcCacheEnablePolarity, FALSE]; }; SetSparcToIOPInt: PUBLIC PROC ~ { ControlBitWrite[sparcToIOPIntRegisterByte, sparcToIOPIntPolarity, TRUE]; }; ResetSparcToIOPInt: PUBLIC PROC ~ { ControlBitWrite[sparcToIOPIntRegisterByte, sparcToIOPIntPolarity, FALSE]; }; SetSparcToMesaInt: PUBLIC PROC ~ { ControlBitWrite[sparcToMesaIntRegisterByte, sparcToMesaIntPolarity, TRUE]; }; ResetSparcToMesaInt: PUBLIC PROC ~ { ControlBitWrite[sparcToMesaIntRegisterByte, sparcToMesaIntPolarity, FALSE]; }; SetSparcToSparcInt: PUBLIC PROC ~ { ControlBitWrite[sparcToSparcIntRegisterByte, sparcToSparcIntPolarity, TRUE]; }; ResetSparcToSparcInt: PUBLIC PROC ~ { ControlBitWrite[sparcToSparcIntRegisterByte, sparcToSparcIntPolarity, FALSE]; }; SetIOPToSparcInt: PUBLIC PROC ~ { ControlBitWrite[iOPToSparcIntRegisterByte, iOPToSparcIntPolarity, TRUE]; }; ResetIOPToSparcInt: PUBLIC PROC ~ { ControlBitWrite[iOPToSparcIntRegisterByte, iOPToSparcIntPolarity, FALSE]; }; SetMesaToSparcInt: PUBLIC PROC ~ { ControlBitWrite[mesaToSparcIntRegisterByte, mesaToSparcIntPolarity, TRUE]; }; ResetMesaToSparcInt: PUBLIC PROC ~ { ControlBitWrite[mesaToSparcIntRegisterByte, mesaToSparcIntPolarity, FALSE]; }; SetSparcAbortInt: PUBLIC PROC ~ { ControlBitWrite[sparcAbortIntRegisterByte, sparcAbortIntPolarity, TRUE]; }; ResetSparcAbortInt: PUBLIC PROC ~ { ControlBitWrite[sparcAbortIntRegisterByte, sparcAbortIntPolarity, FALSE]; }; EnableInt: PUBLIC PROC ~ { ControlBitWrite[enableIntRegisterByte, enableIntPolarity, TRUE]; }; DisableInt: PUBLIC PROC ~ { ControlBitWrite[enableIntRegisterByte, enableIntPolarity, FALSE]; }; DMAState: TYPE = SparcSoftcardOps.DMAState; SetDMAState: PUBLIC PROC [dMAState: DMAState] ~ { IF dMAState = active THEN ControlBitWrite[dMAActiveRegisterByte, dMAActivePolarity, TRUE] ELSE ControlBitWrite[dMAActiveRegisterByte, dMAActivePolarity, FALSE]; }; DMAMode: TYPE = SparcSoftcardOps.DMAMode; SetDMAMode: PUBLIC PROC [dMAMode: DMAMode]~ { SELECT dMAMode FROM = printer => { ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, FALSE]; ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, FALSE]; }; = display => { ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, FALSE]; ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, TRUE]; }; = versatecOneShot => { ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, TRUE]; ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, FALSE]; }; = versatecStream => { ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, TRUE]; ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, TRUE]; }; ENDCASE; }; DMAAddressRegisterLoad: PUBLIC PROC [ byteAddress: CARD32 ] ~ { address: CARD32 _ Basics.DoubleShiftRight[[lc [byteAddress]], 3].lc; -- /8 PokeAtByteAd[dMAAddressRegisterHighByte, Basics.HighHalf[address]]; PokeAtByteAd[dMAAddressRegisterLowByte, Basics.LowHalf[address]]; }; VersatecMode: TYPE = SparcSoftcardOps.VersatecMode; SetVersatecMode: PUBLIC PROC [versatecMode: VersatecMode] ~ { IF ( versatecMode = print OR versatecMode = SPPPrint ) THEN { ControlBitWrite[versatecPrintRegisterByte, versatecPrintPolarity, TRUE]; } ELSE { ControlBitWrite[versatecPrintRegisterByte, versatecPrintPolarity, FALSE]; }; IF ( versatecMode = SPPPrint OR versatecMode = SPPPlot ) THEN { ControlBitWrite[versatecSPPRegisterByte, versatecSPPPolarity, TRUE]; } ELSE { ControlBitWrite[versatecSPPRegisterByte, versatecSPPPolarity, FALSE]; }; }; VersatecRCommand: TYPE = SparcSoftcardOps.VersatecRCommand; SendVersatecRCommand: PUBLIC PROC [versatecRCommand: VersatecRCommand] RETURNS [ ok: BOOLEAN ]~ { byteAddress: CARD32; SELECT versatecRCommand FROM = CLEAR => byteAddress _ SparcSoftcard.versatecClearByte; = RESET => byteAddress _ SparcSoftcard.versatecResetByte; = RLTER => byteAddress _ SparcSoftcard.versatecRLTERByte; = RFFED => byteAddress _ SparcSoftcard.versatecRFFEDByte; = REOTR => byteAddress _ SparcSoftcard.versatecREOTRByte; ENDCASE; [] _ PeekAtByteAd[byteAddress]; }; VersatecCommandTermin: PUBLIC PROC [] RETURNS [terminated: BOOLEAN] ~ { terminated _ ControlBitRead[pVEndRegisterByte, pVEndPolarity]; }; }. ,SparcSoftcardOpsImpl.Mesa Copyright Σ 1988 by Xerox Corporation. All rights reserved. Christophe Cuenod, October 18, 1988 9:26:44 am PDT Bill Jackson (bj) April 19, 1988 3:34:37 am PDT Christian Le Cocq October 31, 1988 9:33:59 am PST Test for the presence of a Sparc softcard and initialize the map properly for the CP and the IOP. Daybreak range [1.5 thru 3.5 Mbytes] is mapped onto [0 thru 2.0 Mbytes] of the Sparc softcard. Utilities IF ((byteAddress MOD 8) # 7) THEN ERROR; If error here the address for the control bit is false. IF ((byteAddress MOD 8) # 7) THEN ERROR; If error here the address for the control bit is false. Sparc Operations Cache Operations Interrupt Operations DMA Operations Versatec Operations Reading the correct location sends the command VersatecSendOneByte: PUBLIC PROC [ byteAddress: CARD32 ] RETURNS [ ok: BOOLEAN ] ~ { SetDMAState[inactive]; SetDMAMode[versatecOneShot]; DMAAddressRegisterLoad[byteAddress]; SetDMAState[active]; WHILE NOT VersatecCommandTermin[] DO ENDLOOP; SetDMAState[inactive]; }; Memory configuration Κn˜code•Mark outsideHeaderšœ™Kšœ<™K˜K˜—šœ˜Kšœ8œ˜>Kšœ8œ˜?K˜K˜—šœ˜Kšœ8œ˜>Kšœ8œ˜>K˜—Kšœ˜—˜K˜—K˜—šžœœœœ˜?Kšœ œ6 ˜JKšœC˜CKšœA˜AK˜K˜——šŸ™Kšœœ!˜3K˜šžœœœ"˜>šœœœ˜=KšœBœ˜HK˜—šœ˜KšœBœ˜IK˜—šœœœ˜?Kšœ>œ˜DK˜—šœ˜Kšœ>œ˜EK˜—K˜K˜—Kšœœ%˜;K˜š žœœœ'œœ˜bK™.Kšœ œ˜šœ˜Kšœœ3˜:Kšœœ3˜:Kšœœ3˜:Kšœœ3˜:Kšœœ3˜:Kšœ˜—Kšœ˜˜K˜—K˜—š žœœœœœ˜GKšœ>˜>K˜—K˜š žœœœœœœ™TKšœ™Kšœ™Kšœ$™$Kšœ™šœœ™$Kšœ™—Kšœ™K™K™——LšŸ™K˜Kšœ˜K˜——…—Δ%^