;Copyright (C) 1984, 1985 by Xerox Corporation. All rights reserved. ;-- stored as [Igor]<WMicro>Dove>OpieDefs.asm ;-- created on 20-Nov-84 17:04:39 ;-- This file contains non-hardware related definitions which are of interest ;-- only to Opie. ; ;-- last edited by: ;-- JPM 2-Aug-85 16:23:28 :Added eePromStackFlagOffset ;-- JPM 6-Jul-85 12:17:16 :Added stackFlagOffset, waitStackFlagOffset ;-- JPM 24-Jun-85 10:57:14 :Added nilHandlerID, WriteMap, dontTrustEEPROM ;-- JPM 20-Jun-85 16:50:10 :Added LoadHandlerAndOpieSegments ;-- JPM 20-Jun-85 12:56:56 :Added offsetToPrevState ;-- JPM 18-Jun-85 13:20:14 :Added IOPE queue types ;-- JPM 23-May-85 12:24:58 :Reordered task status constants ;-- JPM 20-May-85 14:39:10 :Added LoadHandlerSegment, LoadOpieSegment, CallIRETproc ;-- JPM 17-May-85 13:03:34 :Added SegmentAndOffset, WorkMaskConditionPtr, ICStatusBits; re-added NullTCBPtr ;-- JPM 16-May-85 14:43:31 :Added opieHandlerID ;-- JPM 14-May-85 13:01:02 :Opie redesign ;-- KEK 2-Mar-85 19:00:29 :added NullTCBPtr ;-- VXS 27-Nov-84 11:47:39 :change DW SIZE to DB size in IOPEFCB definition ;-- VXS 20-Nov-84 17:10:23 :Creation $NOGEN ;Opie's "handler ID" (of course, Opie's not really a handler) opieHandlerID EQU 0 ;nil handler ID (for delineating end of queues) nilHandlerID EQU 0FFH ;constant for Opie to represent Null TCB (when no task is running) NullTCBPtr EQU -1 ;IOPE queue types systemQueueType EQU 1 timerQueueType EQU 2 ;IOPE task states. runningStateMask EQU 08H ;task is running waitStateMask EQU 04H ;task is waiting interruptStateMask EQU 04H ;task is at interrupt level jamStateMask EQU 02H ;task jammed, or jam at next wait restartStateMask EQU 01H ;restart at next wait offsetToPrevState EQU 4 ;each state takes 4 bits interruptState EQU runningStateMask+interruptStateMask prevStateinterrupt EQU (interruptState SHL offsetToPrevState) interruptWaitJamState EQU interruptState+jamStateMask prevStateinterruptWaitJam EQU (interruptWaitJamState SHL offsetToPrevState) interruptWaitRestartState EQU interruptState+restartStateMask prevStateinterruptWaitRestart EQU (interruptWaitRestartState SHL offsetToPrevState) jammedState EQU jamStateMask prevStatejammed EQU (jammedState SHL offsetToPrevState) systemState EQU runningStateMask prevStatesystem EQU (systemState SHL offsetToPrevState) systemWaitJamState EQU systemState+jamStateMask prevStatesystemWaitJam EQU (systemWaitJamState SHL offsetToPrevState) systemWaitRestartState EQU systemState+restartStateMask prevStatesystemWaitRestart EQU (systemWaitRestartState SHL offsetToPrevState) waitForConditionState EQU waitStateMask+2 prevStatewaitForCondition EQU (waitForConditionState SHL offsetToPrevState) waitForInterruptState EQU waitStateMask+3 prevStatewaitForInterrupt EQU (waitForInterruptState SHL offsetToPrevState) waitForSystemState EQU waitStateMask prevStatewaitForSystem EQU (waitForSystemState SHL offsetToPrevState) waitForTimeState EQU waitStateMask+1 prevStatewaitForTime EQU (waitForTimeState SHL offsetToPrevState) unInitializedState EQU 00H prevStateunInitialized EQU (unInitializedState SHL offsetToPrevState) ;----------------------- ;Interrupt Context status bits ICStatusBits RECORD ICTaskWaiting: 1, ICTimed: 1, ICActive: 1, & ICUnexpected: 1, ICUnused: 4 = 0 ;----------------------- ;Preboot switch values dontTrustEEPROM EQU 8000H ;----------------------- ;Macro used to load segment register (DS/ES) for a handler ID in AX. ; Target register and an available index register (BX/BP/SI/DI) are specified. %*DEFINE (LoadHandlerSegment (segReg, workReg)) ( $SAVE $GENONLY MOV %workReg, IOPELocalRAM MOV %segReg, %workReg L%segReg %workReg, %segReg:IORSegmentTableAddress SHL AX, 2 ADD %workReg, AX MOV %segReg, %segReg:[%workReg].ioRegionSegment $RESTORE ) ;----------------------- ;Macro used to load segment register (DS/ES) with Opie's IORegion segment. ; Target register and an available work register are specified. %*DEFINE (LoadOpieSegment (segReg, workReg)) ( $SAVE $GENONLY MOV %workReg, IOPELocalRAM MOV %segReg, %workReg MOV %segReg, %segReg:IOROpieSegmentAddress $RESTORE ) ;----------------------- ;Macro used to load segment register DS for a handler ID in AX, and segment register ES ; with Opie's IORegion segment. An available index register (BX/BP/SI/DI) is specified. ; If stackReg is non-nil, load the handler's stack segment into that register. %*DEFINE (LoadHandlerAndOpieSegments (workReg, stackReg)) ( $SAVE $GENONLY MOV %workReg, IOPELocalRAM MOV DS, %workReg MOV ES, DS:IOROpieSegmentAddress LDS %workReg, DS:IORSegmentTableAddress SHL AX, 2 ADD %workReg, AX %IF (%NES (%stackReg,%())) THEN ( MOV %stackReg, DS:[%workReg].stackSegment ) FI MOV DS, DS:[%workReg].ioRegionSegment $RESTORE ) ;----------------------- ;Macro used to setup general map register for a task. ; Designed for minimum overhead if no map register is setup. ;Destroys AL, DX nilMapData EQU 0FFH ;make it illegal data. %*DEFINE (WriteMap (mapReg)) ( $SAVE $GENONLY %IF (%EQS (%mapReg,DX)) THEN ( ADD DX, daybreakMapIOAddressBase OUT DX, AL SUB DX, daybreakMapIOAddressBase ) ELSE ( MOV DX, daybreakMapIOAddressBase+%mapReg OUT DX, AL ) FI $RESTORE ) ;----------------------- ;Macro used to call a proc that returns via IRET. ; (Pushes flags and CS onto stack.) %*DEFINE (CallIRETproc (proc)) ( $SAVE $GENONLY PUSHF PUSH CS CALL NEAR PTR %proc $RESTORE ) ;------------------------- ;Interrupt controller definition ControllerBlock STRUC interruptSlaveEOIPort DW ? interruptPendingPort DW ? interruptMaskPort DW ? ControllerBlock ENDS sizeOfCB EQU (SIZE ControllerBlock) ; in bytes! ;------------------------- ;Opie queue definition IOPEQueue STRUC handlerIDforHead DB ? handlerIDforTail DB ? linkPtrforHead DW ? linkPtrforTail DW ? IOPEQueue ENDS ;------------------------- ;Segment entry definition (in table: one entry per handler) SegmentEntry STRUC ioRegionSegment DW ? stackSegment DW ? SegmentEntry ENDS ;------------------------- ;Time-of-day format definition timeOfDayFormat STRUC lowWord DW ? highWord DW ? timeOfDayFormat ENDS ;------------------------- ;Address segment & offset format definition SegmentAndOffset STRUC offsetValue DW ? segmentValue DW ? SegmentAndOffset ENDS ;------------------------- ;constants for adjusting flags on stack stackFlagOffset EQU 2 + (SIZE SegmentAndOffset) ;seg-reg, IP, CS waitStackFlagOffset EQU 4 + (SIZE SegmentAndOffset) ;map reg, seg-reg, IP, CS eePromStackFlagOffset EQU 4 + (SIZE SegmentAndOffset) ;BP, DS, IP, CS ;------------------------- ;Work mask condition ptr format definition WorkMaskConditionPtr RECORD workMaskHandlerID: 7, workMaskConditionOffset: 9