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

📄 ude506ind8.c

📁 atmel9200 vxworks bsp
💻 C
📖 第 1 页 / 共 3 页
字号:
    {    return( uglGenericClutGet( (UGL_UGI_DRIVER *) pDriver, startIndex,                                pColors, numColors) );    }/******************************************************************************* uglEpson8BitClutSet - set a color lookup table entry** Set an entry in the clut  ***/UGL_LOCAL UGL_STATUS uglEpson8BitClutSet    (    UGL_DEVICE_ID   pDriver,     UGL_ORD         startIndex,    UGL_ARGB      * pColors,    UGL_SIZE        numColors    )    {    UGL_UINT8  i;    UGL_STATUS status;    status = uglGenericClutSet( (UGL_UGI_DRIVER *)pDriver, startIndex, pColors, numColors );    uglWriteByte( (UGL_UINT8 *) ( LUT_MODE_REG + pciBaseAddress ), 0x00 ); /* set LUT mode */    if ( status == UGL_STATUS_OK )        {        uglWriteByte( (UGL_UINT8 *)( LUT_ADDRESS_REG + pciBaseAddress ), startIndex );         for (i = 0; i < numColors; i++)            {            uglWriteByte( (UGL_UINT8 *)( LUT_DATA_REG + pciBaseAddress ), ( UGL_RGB_RED   ( pColors[i] ) ) );            uglWriteByte( (UGL_UINT8 *)( LUT_DATA_REG + pciBaseAddress ), ( UGL_RGB_GREEN ( pColors[i] ) ) );            uglWriteByte( (UGL_UINT8 *)( LUT_DATA_REG + pciBaseAddress ), ( UGL_RGB_BLUE  ( pColors[i] ) ) );            }        }    return( status );    }#ifdef EPSON_ACCEL_BITMAP/******************************************************************************* uglEpson8BitFrameToFrameBitBlit - Perfoem a frambe buffer to frame buffer blt****/UGL_LOCAL void uglEpson8BitFrameToFrameBitBlit     (    UGL_UGI_DRIVER * pDriver,     UGL_UINT8      * pSourceData,    UGL_RECT       * pSourceRect,    UGL_ORD          sourceStride,    UGL_UINT8      * 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(*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 );    /* 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 ), 0x00); /* 8bpp */    /* 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 uglEpson8BitMemoryToFrameColorBitBlit     (    UGL_UGI_DRIVER * pDriver,     UGL_UINT8      * pSourceData,    UGL_RECT       * pSourceRect,    UGL_ORD          sourceStride,    UGL_UINT8      * 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 ), 0x00 ); /*  8bpp  */    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)/2;            }        }    }/******************************************************************************* uglEpson8BitBitmapBlt - Hardware BitBLT.****/UGL_LOCAL UGL_STATUS uglEpson8BitBitmapBlt    (    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;            UGL_UINT8    *pSourceData;            UGL_UINT8    *pDestData = UGL_NULL;            UGL_ORD       sourceStride;            UGL_ORD       destStride;            int           sourceFirstPixelIndex;            int           destFirstPixelIndex;            int           xStart, xEnd, xIncrement;            int           yStart, yEnd, yIncrement;            /* Set up source image address and stride */            if (UGL_DISPLAY_ID == (UGL_DDB_ID)pSrcDdb)                pSrcDdb = (UGL_GEN_DDB *)pDriver->pDrawPage->pDdb;            pSourceData = (UGL_UINT8 *)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_UINT8 *)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 or source and		destination don't overlap */                xStart = 0;                xEnd = UGL_RECT_WIDTH(destRect);                xIncrement = 1;                }            else                {                /* Same DDB and source left of destination and overlapping*/                xStart = UGL_RECT_WIDTH(destRect) - 1;                xEnd = -1;                xIncrement = -1;                }            if (pSrcDdb != pDstDdb || srcRect.top >= destRect.top)                {                /* Different DDBs or source below destination */                yStart = srcRect.top;                yEnd = srcRect.bottom + 1;                yIncrement = 1;                }            else                {                /* Same DDB and source above destination */                yStart = srcRect.bottom;                yEnd = srcRect.top - 1;                yIncrement = -1;                sourceFirstPixelIndex += sourceStride *                                         (UGL_RECT_HEIGHT(destRect) - 1);                sourceStride = -sourceStride;                destFirstPixelIndex += destStride *                                       (UGL_RECT_HEIGHT(destRect) - 1);                destStride = -destStride;                }            pSourceData = (UGL_UINT8 *)pSourceData + sourceFirstPixelIndex;            pDestData = (UGL_UINT8 *)pDestData + destFirstPixelIndex;            /* wait for graphics processor */	    if ( pDriver->gpBusy == UGL_TRUE )	       if ( UGL_STATUS_OK != (*pDriver->gpWait) (pDriver) )		  return( UGL_STATUS_ERROR );	    if ( pDriver->gpBusy == UGL_TRUE)               if ( UGL_STATUS_OK != (*pDriver->gpWait) (pDriver) )		  return(UGL_STATUS_ERROR );            if ( UGL_DISPLAY_ID == (UGL_DDB *)pSrcDdb && 		 UGL_DISPLAY_ID == (UGL_DDB *)pDstDdb )               uglEpson8BitFrameToFrameBitBlit( devId, pSourceData, &srcRect,                                                sourceStride, pDestData, &destRect,                                                destStride);	    else if ( ( ( UGL_EPSON_DDB * ) pSrcDdb )->vram == UGL_TRUE &&		      ( ( UGL_EPSON_DDB * ) pDstDdb )->vram == UGL_TRUE)                    uglEpson8BitFrameToFrameBitBlit( devId, pSourceData, &srcRect,                                                     sourceStride, pDestData, &destRect,                                                     destStride );	    else if ( ( ( UGL_EPSON_DDB *)pSrcDdb)->vram == UGL_TRUE &&		      UGL_DISPLAY_ID == (UGL_DDB *)pDstDdb )                    uglEpson8BitFrameToFrameBitBlit( devId, pSourceData, &srcRect,                                                     sourceStride, pDestData, &destRect,                                                     destStride );	    else if ( ( ( UGL_EPSON_DDB *)pDstDdb )->vram == UGL_TRUE &&		      UGL_DISPLAY_ID == (UGL_DDB *)pSrcDdb  )                    uglEpson8BitFrameToFrameBitBlit(devId, pSourceData, &srcRect,                                             sourceStride, pDestData, &destRect,                                             destStride);	    else                    uglEpson8BitMemoryToFrameColorBitBlit( devId, pSourceData,                                                            &srcRect, sourceStride,                                                            pDestData, &destRect,                                                            destStride  );            }        if (destDdbId != UGL_DEFAULT_ID)             break;        } while (uglClipListSortedGet (gc, &clipRect, &pRegionRect, bltDir) ==                  UGL_STATUS_OK );    return (UGL_STATUS_OK);    }/******************************************************************************* uglEpson8BitBitmapCreate - Create a bitmap for use in rendering images.****/UGL_LOCAL UGL_DDB *uglEpson8BitBitmapCreate    (    UGL_UGI_DRIVER       * pDriver,	/* device context */    UGL_DIB              * pDib,  	/* DIB to use for creation of a bitmap */    UGL_DIB_CREATE_MODE    createMode, 	/* control bitmap initialization  */    UGL_UINT32             initValue,    /* value to initialize DDB */    UGL_MEM_POOL_ID        poolId        /* memory pool to contain bitmap */    )    {    UGL_GENERIC_DRIVER   * pGenDriver = (UGL_GENERIC_DRIVER *)pDriver;    UGL_EPSON_DDB        * pEpsonDdb  = UGL_NULL;    UGL_GEN_DDB          * pDdb       = UGL_NULL;    UINT32                 imageSize  = 0;    UGL_RECT               srcRect;    UGL_POINT              dstPt;    UGL_BOOL               vram;    UGL_INT16              stride;    /* Reconcile memory pool */    if (poolId == UGL_VIDEO_MEM_POOL_ID)        {        if (pGenDriver->videoMemPoolId == UGL_NULL)            return( UGL_NULL );        poolId = pGenDriver->videoMemPoolId;	vram = UGL_TRUE;        }

⌨️ 快捷键说明

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