#ifndef __LG_XAA_H #define __LG_XAA_H /* * XAA acceleration for CL-GD546x -- The Laugna family * * lg_xaa.h * * (c) 1996,1998 Corin Anderson. * corina@the4cs.com * Tukwila, WA * * This header file draws much from the file cir_blitLG.h in version 3.3.3 * of XFree86. */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.h,v 1.1 1998/11/22 10:37:21 dawes Exp $ */ /* This header file defines the necessary structures, contstants, and variables for using the bitBLT engine on a Laguna family graphics accelerator. */ enum { /* Offsets into MMIO space for bitBLT regs */ STATUS = 0x0400, OP0_opRDRAM = 0x0520, OP1_opRDRAM = 0x0540, OP2_opRDRAM = 0x0560, OP0_opMRDRAM = 0x0524, OP1_opMRDRAM = 0x0544, OP2_opMRDRAM = 0x0564, OP0_opSRAM = 0x0528, OP1_opSRAM = 0x0548, OP2_opSRAM = 0x0568, OP1_opMSRAM = 0x054A, OP2_opMSRAM = 0x056A, DRAWDEF = 0x0584, BLTDEF = 0x0586, BLTEXT_EX = 0x0700, MBLTEXT_EX = 0x0720, MONOQW = 0x0588, QFREE = 0x0404, PATOFF = 0x052A, HOSTDATA = 0x0800, OP_opBGCOLOR = 0x05E4, OP_opFGCOLOR = 0x05E0, bltCONTROL = 0x0402, BITMASK = 0x05E8 }; enum { HOSTDATASIZE = 2048 }; /* The HOSTDATA port is 2048 BYTES */ enum { /* OR these together to form a bitBLT mode */ HOST2SCR = 0x1120, /* CPU/Screen transfer modes */ SCR2HOST = 0x2010, HOST2PAT = 0x1102, HOST2SRAM2 = 0x6020, /* CPU to SRAM2 transfer */ SCR2SCR = 0x1110, /* Screen/Screen transfers */ COLORSRC = 0x0000, /* Source is color data */ MONOSRC = 0x0040, /* Source is mono data (color expansion) */ COLORTRANS = 0x0001, /* Transparent screen/screen transfer */ MONOTRANS = 0x0005, /* Transparent screen/screen color expansion */ COLORFILL = 0x0070, /* Solid color fill mode */ SRAM1SCR2SCR = 0x1180, /* Pattern fill, source from SRAM1 */ PAT2SCR = 0x1109, /* Pattern/Screen transfers */ COLORPAT = 0x0000, /* Pattern is color data */ MONOPAT = 0x0004, /* Pattern is mono data (color expansion) */ SRAM2PAT2SCR = 0x1108, /* SRAM2 is pattern source */ PATeqSRC = 0x0800, /* The Pattern and Source operands are the same */ /* Advice from Corey: don't ever try to use this option! 8) There's a documented bug with it on the '62, and, well, I have empirical evidence that either the bug's still around, even in the '64 and the '65. It's a performance option, anyway, so not using it should be okay. */ BLITUP = 0x8000 /* The blit is proceeding from bottom to top */ }; enum { /* Select transparency compare */ TRANSBG = 0x0100, TRANSFG = 0x0300, TRANSEQ = 0x0100, TRANSNE = 0x0300, TRANSNONE = 0x0000 }; #define LgREADY() \ ((*(volatile CARD8 *)(pLg->IOBase + STATUS) & 0x07) == 0x00) #define LgSETROP(rop) \ *(CARD16 *)(pLg->IOBase + DRAWDEF) = (rop); #define LgSETTRANSPARENCY(trans) \ *(CARD16 *)(pLg->IOBase + DRAWDEF) = \ (trans) | (*(volatile CARD16 *)(pLg->IOBase + DRAWDEF) & 0x00FF); #define LgSETMODE(mode) \ *(CARD16 *)(pLg->IOBase + BLTDEF) = (mode); #define LgSETDSTXY(X, Y) \ *(CARD32 *)(pLg->IOBase + OP0_opRDRAM) = (((Y) << 16) | (X)); #define LgSETSRCXY(X, Y) \ *(CARD32 *)(pLg->IOBase + OP1_opRDRAM) = (((Y) << 16) | (X)); #define LgSETPATXY(X, Y) \ *(CARD32 *)(pLg->IOBase + OP2_opRDRAM) = (((Y) << 16) | (X)); #define LgSETTRANSMASK(X, Y) LgSETPATXY(X, Y) #define LgSETSRAMDST(offset) \ *(CARD16 *)(pLg->IOBase + OP0_opSRAM) = (offset); #define LgSETSRAM1OFFSET(offset) \ *(CARD16 *)(pLg->IOBase + OP2_opSRAM) = (offset); #define LgSETSRAM2OFFSET(offset) \ *(CARD16 *)(pLg->IOBase + OP2_opSRAM) = (offset); #define LgSETMSRAM1OFFSET(offset) \ *(CARD16 *)(pLg->IOBase + OP1_opMSRAM) = (offset); #define LgSETMSRAM2OFFSET(offset) \ *(CARD16 *)(pLg->IOBase + OP2_opMSRAM) = (offset); #define LgSETMDSTXY(X, Y) \ *(CARD32 *)(pLg->IOBase + OP0_opMRDRAM) = (((Y) << 16) | (X)); #define LgSETMSRCXY(X, Y) \ *(CARD32 *)(pLg->IOBase + OP1_opMRDRAM) = (((Y) << 16) | (X)); #define LgSETMPATXY(X, Y) \ *(CARD32 *)(pLg->IOBase + OP2_opMRDRAM) = (((Y) << 16) | (X)); #define LgSETMTRANSMASK(X, Y) LgSETMPATXY(X, Y) #define LgSETPHASE0(phase) \ *(CARD32 *)(pLg->IOBase + OP0_opRDRAM) = (phase); #define LgSETPHASE1(phase) \ *(CARD32 *)(pLg->IOBase + OP1_opRDRAM) = (phase); #define LgSETPHASE2(phase) \ *(CARD32 *)(pLg->IOBase + OP2_opRDRAM) = (phase); #define LgSETMPHASE0(phase) \ *(CARD32 *)(pLg->IOBase + OP0_opMRDRAM) = (phase); #define LgSETMPHASE1(phase) \ *(CARD32 *)(pLg->IOBase + OP1_opMRDRAM) = (phase); #define LgSETEXTENTS(width, height) \ *(CARD32 *)(pLg->IOBase + BLTEXT_EX) = (((height) << 16)|(width)); #if 0 #define LgSETMEXTENTS(width, height) \ *(CARD32 *)(pLg->IOBase + MBLTEXT_EX) = (((height) << 16)|(width)); #else /* For monochrome (byte) blits, we need to set how many QWORDs of data encompass the X extent. Write this piece of data into MONOQW. */ #define LgSETMEXTENTS(width, height) \ { \ *(CARD16 *)(pLg->IOBase + MONOQW) = ((width + 7) >> 3); \ *(CARD32 *)(pLg->IOBase + MBLTEXT_EX) = \ (((height) << 16)|(width)); \ } #define LgSETMEXTENTSNOMONOQW(width, height) \ *(CARD32 *)(pLg->IOBase + MBLTEXT_EX) = (((height) << 16)|(width)); /* *(CARD16 *)(pLg->IOBase + MBLTEXT_EX) = height; *(CARD16 *)(pLg->IOBase + MBLTEXT_EX + 2) = width; */ #endif #define LgHOSTDATAWRITE(data) \ *(CARD32 *)(pLg->IOBase + HOSTDATA) = (data); #define LgHOSTDATAREAD() \ (*(CARD32 *)(pLg->IOBase + HOSTDATA)) #define LgSETBACKGROUND(color) \ *(CARD32 *)(pLg->IOBase + OP_opBGCOLOR) = (color); #define LgSETFOREGROUND(color) \ *(CARD32 *)(pLg->IOBase + OP_opFGCOLOR) = (color); #define LgSETPATOFF(xoff, yoff) \ *(CARD16 *)(pLg->IOBase + PATOFF) = (((yoff) << 8) | (xoff)); #define LgSETSWIZZLE() \ *(CARD16 *)(pLg->IOBase + bltCONTROL) |= 0x0400; #define LgCLEARSWIZZLE() \ *(CARD16 *)(pLg->IOBase + bltCONTROL) &= ~0x0400; #define LgSETBITMASK(m) \ *(unsigned int *)(pLg->IOBase + BITMASK) = m; #endif /* __LG_XAA_H */