; Comatos.inc - Constant definitions for COMATOS Operating System ; Copyright 1999 Benjamin M. Greenblatt (10/18/99) ; OS Base Addresses and sizes .equ OSBase =0x60 .equ OSBlockSize =0x10 .equ PCBBase =OSBase+OSBlockSize .equ PCBSize =0x10 .equ PCBTotal =0x80 .equ USRBase =OSBase+OSBlockSize+PCBTotal ; General OS State Fields .equ OSStatus =0x00 ; General OS status register .equ OSNumTasks =0x01 ; Number of tasks running .equ OSCurrentTask =0x02 ; Current task running .equ OSReturnVal =0x03 ; Return value of last exiting task .equ OSTimeoutH =0x04 ; Ticks left until system .equ OSTimeoutL =0x05 ; times out (fatal error) .equ OSMaxTimeoutH =0x06 ; Maximum ticks allowed to a task .equ OSMaxTimeoutL =0x07 ; before timeout .equ OSGlobalTime3 =0x08 ; Global system time .equ OSGlobalTime2 =0x09 ; (maximum is about 49 days) .equ OSGlobalTime1 =0x0a .equ OSGlobalTime0 =0x0b .equ OSCurrPCBH =0x0c ; Pointer to PCB of the current task .equ OSCurrPCBL =0x0d ; saves us a little grief later on .equ OSUARTCharCnt =0x0e ; Number of characters for UART to send .equ OSUARTTemp =0x0f ; Temporary storage for UART ; Process Control Block Fields .equ PCBEntryPtrH =0x00 ; Starting point of the code .equ PCBEntryPtrL =0x01 .equ PCBTimeoutVal =0x02 ; Maximum number of ticks before task is ready .equ PCBCurrentTime =0x03 ; Number of ticks until task is ready to run .equ PCBMessMask =0x04 ; Indicates which tasks we are waiting on .equ PCBMessSrc =0x05 ; Incidates which tasks have sent messages .equ PCBAck =0x06 ; Acknowledge bits .equ PCBState =0x07 ; State register for passing data between ; successive runs of the task .equ PCBMessageBase =0x08 ; Base address of message mailboxes ; Bit assignments in OS Status .equ t0ms =0 ; Timer 0 ISR 1/2 or full millisecond .equ txdone =1 ; UART TX done ; Timer 0 and UART Constants .equ startVal =0x06 ; Timer 0 count start value (need 250 ticks, not 256) .equ TimerMask =0x02 ; Turns on Timer0 interrupt globally .equ Timer0Clk =0x02 ; Clock divider of 8 .equ baud96 =25 ;9600 baud constant for 4Mhz crystal ; NOTE: Timer 0 interrupt MUST BE ENABLED. If you must modify the TIMSK ; register, be sure not to clear the TOIE0 bit! ; Characters and useful constants .equ CRLF =13 .equ ascii0 =0x30 ; Debugger Constants .equ OSRegDumpFlag =252 .equ OSTimeoutCrash =251 .equ OSPCDumpFlag =250 .equ OSNoTasksFlag =249 .equ OSBadCode =248 .equ OSNoDebug =0 .equ OSDebug =1 ; Register definitions .def OSTempH =r16 .def OSTempL =r17 .def OST0Num =r16 .def OSScdC =r19 .def OSScdNum =r20 .def OSTempG =r18 .def OSAddrRegH =r29 .def OSAddrRegL =r28 .def OSDumpReg =r27