Annotation of ntddk/src/video/displays/jz484/mips/jaguars.s, revision 1.1

1.1     ! root        1: /*++
        !             2: 
        !             3: Copyright (c) 1992  Microsoft Corporation
        !             4: 
        !             5: Module Name:
        !             6: 
        !             7:    Jaguar.s
        !             8: 
        !             9: Abstract:
        !            10: 
        !            11:    This module contains the Jaguar specific routines for the GDI driver.
        !            12: 
        !            13: Environment:
        !            14: 
        !            15:     User mode.
        !            16: 
        !            17: Revision History:
        !            18: 
        !            19: --*/
        !            20: 
        !            21: #include "kxmips.h"
        !            22: 
        !            23: #define  FG_COLOR    0x48
        !            24: #define  BG_COLOR    0x50
        !            25: #define  USED_ENTRIES    0x20
        !            26: 
        !            27: #define FifoSize    16
        !            28: 
        !            29: .globl FifoRegs     // extern PJAGUAR_FIFO FifoRegs;
        !            30: .globl Jaguar       // extern PJAGUAR_REGISTERS Jaguar;
        !            31: .globl FreeEntries
        !            32: .data
        !            33: 
        !            34: FifoRegs:
        !            35: .word    0
        !            36: Jaguar:
        !            37: .word    0
        !            38: FreeEntries:
        !            39: .byte 0             // UCHAR FreeEntries = 0;
        !            40: 
        !            41: 
        !            42: .text
        !            43: 
        !            44: 
        !            45: /*++
        !            46: VOID
        !            47: FifoWrite(
        !            48:     IN ULONG DstAdr,
        !            49:     IN ULONG SrcAdr,
        !            50:     IN ULONG XYCmd
        !            51:     )
        !            52: 
        !            53: 
        !            54: Routine Description:
        !            55: 
        !            56:     This routine writes a command to the jaguar fifo.
        !            57: 
        !            58: Arguments:
        !            59: 
        !            60:     DstAdr  -  Src Address to write to the SrcAdr FIFO register
        !            61:     SrcAdr     Dst Address to write to the DstAdr FIFO register
        !            62:     XYCmd      XYCmd value to write to the XYCmd FIFO register
        !            63: 
        !            64: Return Value:
        !            65: 
        !            66:     NONE
        !            67: 
        !            68: {
        !            69:     while (FreeEntries == 0) {
        !            70:         UsedEntries = READ_REGISTER_UCHAR(&Jaguar->FifoUsedEntries.Byte);
        !            71:         FreeEntries = FifoSize - UsedEntries;
        !            72:     }
        !            73: 
        !            74:     WRITE_REGISTER_ULONG(&FifoRegs->DstAddr.Long,DstAdr);
        !            75:     WRITE_REGISTER_ULONG(&FifoRegs->SrcAddr.Long,SrcAdr);
        !            76:     WRITE_REGISTER_ULONG(&FifoRegs->XYCmd.Long,XYCmd);
        !            77: 
        !            78:     FreeEntries--;
        !            79: }
        !            80: --*/
        !            81:     LEAF_ENTRY(FifoWrite)
        !            82: 
        !            83:     lbu     t0,FreeEntries          // get number of Free Entries
        !            84:     lw      t1,FifoRegs             // get base of Fifo
        !            85:     bne     t0,zero,Write           // if Free Entries go to write
        !            86:     lw      t2,Jaguar               // load base of Jaguar
        !            87: Poll:
        !            88:     lbu     t3,USED_ENTRIES(t2)     // read used entries
        !            89:     li      t4,FifoSize             // Compute free entries
        !            90:     subu    t0,t4,t3                // if none is free
        !            91:     beq     t0,zero,Poll            // keep polling.
        !            92: 
        !            93: Write:
        !            94:     sw      a0,0x0(t1)              // Write command to fifo
        !            95:     sw      a1,0x8(t1)              //
        !            96:     sw      a2,0x10(t1)             //
        !            97:     addiu   t0,t0,-1                // update free entries.
        !            98:     sb      t0,FreeEntries          //
        !            99:     j       ra
        !           100:     .end
        !           101: 
        !           102: 
        !           103: /*++
        !           104: VOID
        !           105: WaitForJaguarIdle(
        !           106: )
        !           107: 
        !           108: 
        !           109: Routine Description:
        !           110: 
        !           111:     This routine must wait for the FIFO to drain.
        !           112:     This routine is called to make sure the accelerator
        !           113:     has completed all pending commands and the GDI engine can
        !           114:     do the operations the driver does not support.
        !           115: 
        !           116: Arguments:
        !           117: 
        !           118:     None.
        !           119: 
        !           120: Return Value:
        !           121: 
        !           122:     It returns when the FIFO is empty.
        !           123: 
        !           124: {
        !           125: 
        !           126:     if (FreeEntries != FifoSize) {
        !           127:         while (READ_REGISTER_UCHAR(&Jaguar->FifoUsedEntries.Byte) != 0) {
        !           128:         }
        !           129:         FreeEntries =  FifoSize;
        !           130:     }
        !           131: }
        !           132: --*/
        !           133: 
        !           134:     LEAF_ENTRY(WaitForJaguarIdle)
        !           135:     lbu     t2,FreeEntries          // read free entries
        !           136:     li      t3,FifoSize             // if the number of FreeEntries is
        !           137:     beq     t2,t3,10f               // the FifoSize then it's empty
        !           138:     lw      t0,Jaguar
        !           139: Loop:
        !           140:     lbu     t1,USED_ENTRIES(t0)     // read used entries
        !           141:     bne     t1,zero,Loop
        !           142: 
        !           143:     sb      t3,FreeEntries          // when we exit jaguar is idle -> we have
        !           144:                                     // FifoSize free entries
        !           145: 10:
        !           146:     j       ra
        !           147:     .end
        !           148: 
        !           149: /*++
        !           150: VOID
        !           151: DevSetFgColor(
        !           152:     IN ULONG Color
        !           153:     )
        !           154: 
        !           155: 
        !           156: Routine Description:
        !           157: 
        !           158:     This routine sets the Jaguar Foreground color register with the given
        !           159:     color. It first waits for the accelerator to be idle to ensure that
        !           160:     the color register is not changed while it's being used.
        !           161: 
        !           162: 
        !           163: Arguments:
        !           164: 
        !           165:     Color.
        !           166: 
        !           167: Return Value:
        !           168: 
        !           169:     None.
        !           170: 
        !           171: {
        !           172:     if (FreeEntries != FifoSize) {
        !           173:         while (READ_REGISTER_UCHAR(&Jaguar->FifoUsedEntries.Byte) != 0) {
        !           174:         }
        !           175:         FreeEntries =  FifoSize;
        !           176:     }
        !           177:     WRITE_REGISTER_ULONG(&Jaguar->ForegroundColor.Long,Color);
        !           178: }
        !           179: --*/
        !           180: 
        !           181:     LEAF_ENTRY(DevSetFgColor)
        !           182:     lbu     t2,FreeEntries          // read free entries
        !           183:     li      t3,FifoSize             // if the number of FreeEntries is
        !           184:     lw      t0,Jaguar
        !           185:     beq     t2,t3,10f               // the FifoSize then it's empty
        !           186: 
        !           187: LoopFg:
        !           188:     lbu     t1,USED_ENTRIES(t0)     // read used entries
        !           189:     bne     t1,zero,LoopFg
        !           190: 
        !           191:     sb      t3,FreeEntries          // when we exit jaguar is idle -> we have
        !           192:                                     // FifoSize free entries
        !           193: 10:
        !           194:     sw      a0,FG_COLOR(t0)         // write foreground color
        !           195:     j       ra
        !           196:     .end
        !           197: 
        !           198: 
        !           199: 
        !           200: /*++
        !           201: VOID
        !           202: DevSetBgColor(
        !           203:     IN ULONG Color
        !           204:     )
        !           205: 
        !           206: 
        !           207: Routine Description:
        !           208: 
        !           209:     This routine sets the Jaguar Background color register with the given
        !           210:     color. The accelerator must be idle to ensure that the color register
        !           211:     is not changed while it's being used.
        !           212: 
        !           213: 
        !           214: Arguments:
        !           215: 
        !           216:     Color.
        !           217: 
        !           218: Return Value:
        !           219: 
        !           220:     None.
        !           221: 
        !           222: {
        !           223:     if (FreeEntries != FifoSize) {
        !           224:         while (READ_REGISTER_UCHAR(&Jaguar->FifoUsedEntries.Byte) != 0) {
        !           225:         }
        !           226:         FreeEntries =  FifoSize;
        !           227:     }
        !           228:     WRITE_REGISTER_ULONG(&Jaguar->BackgroundColor.Long,Color);
        !           229: }
        !           230: --*/
        !           231: 
        !           232:     LEAF_ENTRY(DevSetBgColor)
        !           233:     lbu     t2,FreeEntries              // read free entries
        !           234:     li      t3,FifoSize                 // if the number of FreeEntries is
        !           235:     lw      t0,Jaguar
        !           236:     beq     t2,t3,10f                   // the FifoSize then it's empty
        !           237: 
        !           238: LoopBg:
        !           239:     lbu     t1,USED_ENTRIES(t0)         // read used entries
        !           240:     bne     t1,zero,LoopBg
        !           241: 
        !           242:     sb      t3,FreeEntries              // when we exit jaguar is idle -> we have
        !           243:                                         // FifoSize free entries
        !           244: 10:
        !           245:     sw      a0,BG_COLOR(t0)             // write foreground color
        !           246:     j       ra
        !           247:     .end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.