⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ude506direct.c

📁 atmel9200 vxworks bsp
💻 C
📖 第 1 页 / 共 3 页
字号:
            modeInfo->width = pDriver->pMode->width;            modeInfo->height = pDriver->pMode->height;            modeInfo->colorDepth = pDriver->pMode->colorDepth;            modeInfo->clutSize = 0;            modeInfo->colorModel = UGL_DIRECT;            modeInfo->colorFormat = UGL_RGB565;            modeInfo->fbAddress = pGenDriver->fbAddress;            modeInfo->displayMemAvail = 0;	    modeInfo->flags = UGL_MODE_PAGING_ENABLED;	    }	    break;	case UGL_EXT_INFO_REQ:	    {#ifdef INCLUDE_UGL_JPEG	    UGL_EXT_INFO * extInfo = (UGL_EXT_INFO *)info;	    int version;	    if (strcmp(extInfo->name, UGL_EXT_JPEG_NAME) == 0)		{		extInfo->pExt = (void *)uglGenJpegInit (			       pDriver, &version);		extInfo->version = version;		}	    else#endif /* INCLUDE_UGL_JPEG */		return (UGL_STATUS_ERROR);	    }	    break;	default:	    return( UGL_STATUS_ERROR );        }    return( UGL_STATUS_OK );    }/******************************************************************************* uglEpsonGpWait - Epson device driver graphics processor wait** Wait for the graphics processor to become idle  ** RETURNS: UGL_STATUS_OK when requested function was completed*   satisfactory; otherwise UGL_STATUS_ERROR* */UGL_LOCAL UGL_STATUS uglEpsonGpWait    (    UGL_GENERIC_DRIVER * pDriver    )    {    UGL_UINT8  regData = 0;    while (1)        {        regData = *(volatile unsigned short *) ( BITBLT_CTRL0 + pciBaseAddress);        if (0 == (regData & 0x80))            break;        }        pDriver->gpBusy = UGL_FALSE;        return( UGL_STATUS_OK );    }#ifdef EPSON_ACCEL_BITMAP/******************************************************************************* uglEpson8BitFrameToFrameBitBlit - Perfoem a frambe buffer to frame buffer blt*** */UGL_LOCAL void uglEpson16BitFrameToFrameBitBlit     (    UGL_UGI_DRIVER * pDriver,     UGL_UINT16     * pSourceData,    UGL_RECT       * pSourceRect,    UGL_ORD          sourceStride,    UGL_UINT16     * pDestData,     UGL_RECT       * pDestRect,    UGL_ORD          destStride    )    {    UGL_GENERIC_DRIVER  * pGenDriver = (UGL_GENERIC_DRIVER *)pDriver;    UGL_UINT16            overLapType = 0;    UGL_UINT16            width;    UGL_UINT16            height;    UGL_UINT16            phase=0;    UGL_UINT16            screenStride = pDriver->pMode->width * BYTES_PER_PIXEL;    UGL_UINT16          * sourceAddr = (UGL_UINT16 *) pSourceData;     UGL_UINT16          * destAddr   = (UGL_UINT16 *) pDestData;    /* program the Source Address Register */    phase = (UGL_UINT32)sourceAddr & 1;    uglWriteByte( ( BITBLT_SRCE_ADDRESS_REG0 + pciBaseAddress ), phase );     uglWriteByte( ( BITBLT_SRCE_ADDRESS_REG1 + pciBaseAddress ), 0 );     uglWriteByte( ( BITBLT_SRCE_ADDRESS_REG2 + pciBaseAddress ), 0 );     /* program the Destination Address Register */    uglWriteByte( ( BITBLT_DEST_ADDRESS_REG0 + pciBaseAddress ), ( UGL_UINT32)destAddr         );    uglWriteByte( ( BITBLT_DEST_ADDRESS_REG1 + pciBaseAddress ), ( (UGL_UINT32)destAddr) >> 8  );     uglWriteByte( ( BITBLT_DEST_ADDRESS_REG2 + pciBaseAddress ), ( (UGL_UINT32)destAddr) >> 16 );     /* program the Width and Height Register */    height = UGL_RECT_HEIGHT(*pSourceRect);     width  = UGL_RECT_WIDTH(*pSourceRect);    uglWriteByte( ( BITBLT_WIDTH_REG0  + pciBaseAddress ), width  - 1  );    uglWriteByte( ( BITBLT_WIDTH_REG1  + pciBaseAddress ), (width  - 1)>>8  );    uglWriteByte( ( BITBLT_HEIGHT_REG0 + pciBaseAddress ), height - 1 );    uglWriteByte( ( BITBLT_HEIGHT_REG1 + pciBaseAddress ), (height - 1)>>8 );    /* program the Memory Address Offset Register */    uglWriteByte( ( BITBLT_MEM_OFF0 + pciBaseAddress ), screenStride/2);     uglWriteByte( ( BITBLT_MEM_OFF1 + pciBaseAddress ), (screenStride/2)>>8);    /* color depth select */    uglWriteByte( ( BITBLT_CTRL1 + pciBaseAddress ), 0x01); /* 16bpp */    /* move BitBLT */    if (overLapType==0x2 || overLapType==0x3)       uglWriteByte( ( BITBLT_OP + pciBaseAddress ), 0x03); /* negative direction */      else       uglWriteByte( ( BITBLT_OP + pciBaseAddress ), 0x02); /* positive direction */     uglWriteByte( ( BITBLT_ROP + pciBaseAddress ),   0x0C ); /* ROP */    /*  Wait for blt engine ready */    uglEpsonGpWait(pGenDriver);    /* Engage the blt engine */    uglWriteByte( ( BITBLT_CTRL0 + pciBaseAddress ), 0x80);     }/******************************************************************************* uglEpson8BitMemoryToFrameColorBitBlit - Source in system memory, destination in video memory.*** */UGL_LOCAL void uglEpson16BitMemoryToFrameColorBitBlit     (    UGL_UGI_DRIVER * pDriver,     UGL_UINT16     * pSourceData,    UGL_RECT       * pSourceRect,    UGL_ORD          sourceStride,    UGL_UINT16     * pDestData,     UGL_RECT       * pDestRect,    UGL_ORD          destStride    )    {    UGL_UINT16            width;    UGL_UINT16            height;    UGL_UINT16            screenStride = pDriver->pMode->width * BYTES_PER_PIXEL;    UGL_UINT16            nWords, byte100, nTotalWords, nFIFO=0, phase=0, j;    UGL_GENERIC_DRIVER  * pGenDriver = (UGL_GENERIC_DRIVER *)pDriver;    UGL_UINT16          * w16;    volatile UGL_UINT16 * bltAddress = (UGL_UINT16 *) (pciBaseAddress + 0x100000);    UGL_UINT16          * sourceAddr = (UGL_UINT16 *) pSourceData;     UGL_UINT16          * destAddr   = (UGL_UINT16 *) pDestData;    uglWriteByte( ( BITBLT_DEST_ADDRESS_REG0 + pciBaseAddress ),   (UGL_UINT32) destAddr         );    uglWriteByte( ( BITBLT_DEST_ADDRESS_REG1 + pciBaseAddress ), ( (UGL_UINT32) destAddr ) >> 8  );     uglWriteByte( ( BITBLT_DEST_ADDRESS_REG2 + pciBaseAddress ), ( (UGL_UINT32) destAddr ) >> 16 );     phase = (UGL_UINT32)sourceAddr & 1;    uglWriteByte( ( BITBLT_SRCE_ADDRESS_REG0 + pciBaseAddress ), phase );     uglWriteByte( ( BITBLT_SRCE_ADDRESS_REG1 + pciBaseAddress ), 0 );     uglWriteByte( ( BITBLT_SRCE_ADDRESS_REG2 + pciBaseAddress ), 0 ); 		    /* program the Destination Width and Height Register */    height = UGL_RECT_HEIGHT(*pDestRect);     width  = UGL_RECT_WIDTH(*pDestRect);    uglWriteByte( ( BITBLT_WIDTH_REG0  + pciBaseAddress ),  width  - 1       );    uglWriteByte( ( BITBLT_WIDTH_REG1  + pciBaseAddress ), (width  - 1) >> 8 );    uglWriteByte( ( BITBLT_HEIGHT_REG0 + pciBaseAddress ),  height - 1       );    uglWriteByte( ( BITBLT_HEIGHT_REG1 + pciBaseAddress ), (height - 1) >> 8 );    uglWriteByte( ( BITBLT_MEM_OFF0 + pciBaseAddress ),  screenStride/2    );     uglWriteByte( ( BITBLT_MEM_OFF1 + pciBaseAddress ), (screenStride/2)>>8);    uglWriteByte( ( BITBLT_CTRL1 + pciBaseAddress ), 0x01 ); /*  16bpp */    uglWriteByte( ( BITBLT_OP    + pciBaseAddress ), 0x00 ); /*  write BLT */    uglWriteByte( ( BITBLT_ROP   + pciBaseAddress ), 0x0C ); /*  ROP */    nWords = phase + ((width-phase)*BYTES_PER_PIXEL + 1)/2;    nTotalWords = nWords * height;    /* Wait for blt engine ready */    uglEpsonGpWait(pGenDriver);    /* Engage the blt engine */    uglWriteByte( ( BITBLT_CTRL0 + pciBaseAddress ), 0x80);     /* Word aligned */    w16 = (UGL_UINT16 *)( ((UGL_UINT32)sourceAddr & 0xFFFFFFFE) );    while (nTotalWords > 0)        {        /* read the FIFO status */	  uglReadByte( ( BITBLT_CTRL0 + pciBaseAddress ), byte100);	  if ((byte100 & 0x70) == 0x0)		        nFIFO = 16;          else if ((byte100 & 0x70) == 0x40) 	        nFIFO = 8;          else if ((byte100 & 0x70) == 0x60) 		nFIFO = 1;          else if ((byte100 & 0x70) == 0x70)                nFIFO = 0;          for (j = 0; j < nFIFO && nWords > 0; j++, nWords--, nTotalWords--)              *bltAddress = *w16++;          if ( nWords == 0 )            {             nWords = phase + ((width-phase)*BYTES_PER_PIXEL + 1)/2;             w16 = w16 + sourceStride - width;              }        }    }/******************************************************************************* uglEpson8BitBitmapBlt - Hardware BitBLT.*** */UGL_LOCAL UGL_STATUS uglEpson16BitBitmapBlt    (    UGL_UGI_DRIVER * devId,    UGL_DDB_ID       srcDdbId,    UGL_RECT       * pSourceRect,    UGL_DDB_ID       destDdbId,    UGL_POINT      * pDestPoint    )    {    UGL_GENERIC_DRIVER * pDriver = (UGL_GENERIC_DRIVER *)devId;    UGL_GC_ID gc = pDriver->gc;    UGL_RECT clipRect;    const UGL_RECT * pRegionRect = UGL_NULL;    UGL_BLT_DIR bltDir = 0;    if (srcDdbId == UGL_DEFAULT_ID)        UGL_RECT_MOVE (*pSourceRect, gc->viewPort.left, gc->viewPort.top);    if (destDdbId == UGL_DEFAULT_ID)        {        UGL_POINT_MOVE (*pDestPoint, gc->viewPort.left, gc->viewPort.top);        if (pDestPoint->x > pSourceRect->left)            bltDir |= UGL_BLT_RIGHT;        if (pDestPoint->y > pSourceRect->top)            bltDir |= UGL_BLT_DOWN;        if (uglClipListSortedGet (gc, &clipRect, &pRegionRect, bltDir) != UGL_STATUS_OK)            return (UGL_STATUS_OK);        }    do        {        UGL_GEN_DDB * pSrcDdb = (UGL_GEN_DDB *)srcDdbId;        UGL_GEN_DDB * pDstDdb = (UGL_GEN_DDB *)destDdbId;        UGL_RECT srcRect = *pSourceRect;        UGL_POINT dstPoint = *pDestPoint;        /* Clip the source/destination points */        if (UGL_TRUE == uglGenericClipDdbToDdb (devId, &clipRect,                                 (UGL_BMAP_ID *)&pSrcDdb,  &srcRect,                                 (UGL_BMAP_ID *)&pDstDdb, &dstPoint))            {            UGL_RECT destRect;            int xStart, xEnd, xIncrement;            int yStart, yEnd, yIncrement;            UGL_UINT16 * pSourceData;            UGL_UINT16 * pDestData;            int sourceStride, sourceFirstPixelIndex;            int destStride, destFirstPixelIndex;            /* Set up source image address and stride */            if (UGL_DISPLAY_ID == (UGL_DDB_ID)pSrcDdb)                pSrcDdb = (UGL_GEN_DDB *)pDriver->pDrawPage->pDdb;            pSourceData = (UGL_UINT16 *)pSrcDdb->image;            sourceStride = pSrcDdb->stride;            /* Set up destination image address and stride */            if (UGL_DISPLAY_ID == (UGL_DDB_ID)pDstDdb)                pDstDdb = (UGL_GEN_DDB *)pDriver->pDrawPage->pDdb;            pDestData = (UGL_UINT16 *)pDstDdb->image;            destStride = pDstDdb->stride;            /* Compute the destination rectangle */            destRect.left = dstPoint.x;            destRect.top = dstPoint.y;            UGL_RECT_SIZE_TO (destRect, UGL_RECT_WIDTH(srcRect),                               UGL_RECT_HEIGHT(srcRect));            sourceFirstPixelIndex = (srcRect.top * sourceStride) +                                      srcRect.left;            destFirstPixelIndex = (destRect.top * destStride) + destRect.left;            /* Set up to handle overlapping */            if (pSrcDdb != pDstDdb || srcRect.top != destRect.top ||                srcRect.left >= destRect.left ||                 srcRect.left + sourceStride < destRect.left)                {                /* Different DDBs or source right of destination */                xStart = 0;                xEnd = UGL_RECT_WIDTH(destRect);                xIncrement = 1;                }            else                {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -