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

📄 ude506direct.c

📁 atmel9200 vxworks bsp
💻 C
📖 第 1 页 / 共 3 页
字号:
/* ude506Direct.c - Epson graphics driver for 16 bit direct color *//* Copyright 2000 - 2001 Wind River Systems, Inc. All Rights Reserved *//* Copyright (c) 2000, 2001 Epson Research and Development, Inc. All Rights Reserved *//*modification history--------------------01h,20sep02,gav  Fix to SPR #81727.01g,12aug02,msr  Added support for sorted regions (SPR #75481).01f,01aug02,rfm  Removed Epson software cursor01e,06jun02,gav  Port to HAL API01d,13mar02,jlb  Fixed compile warnings01c,04jan02,jlb  Disable bitblt acceleration01b,27nov01,jlb  Added support for BSP API enabled processor01a,10nov01,jlb  written - based on work from Epson Research and Development, Inc.*//* DESCRIPTION This device driver, based on work from Epson, implements an 16 bit direct color device driver for the Epson S13506. *//* This file has configurable options, so include the config file */#include <ugl/driver/graphics/epson/s13506Cfg.h>/* Other includes */#include <string.h>#include <ugl/driver/graphics/common/udcHwAbsLayer.h>#include <drv/pci/pciConfigLib.h>#include <ugl/ext/common/uglext.h>#include <ugl/driver/ext/jpeg/udgenjpg.h>#include <ugl/uglugi.h>#include <ugl/uglmem.h>#include <ugl/driver/graphics/generic/udgen16.h>/* Acclerated bitmaps are not fully working */#undef EPSON_ACCEL_BITMAP/*dongliang*/#define REG_LCD_DATA									 0x30200000;/* Mode configurations */UGL_LOCAL ModeTable epsonModeTable[] ={   /* modexxx.dat files are generated  by 13506cfg.exe */   /* 13506cfg.exe is available at www.erd.epson.com   *//*   #include "mode640x480x60.dat"   #include "mode800x600x60.dat" */   #include "mode0.H"};UGL_LOCAL UINT32 pciBaseAddress;      /* Base address of board *//* Forward declarations */UGL_LOCAL UGL_STATUS      uglEpson16BitDevDestroy   ( UGL_DEVICE_ID devId );UGL_LOCAL UGL_STATUS      uglEpson16BitInfo         ( UGL_DEVICE_ID devId, UGL_INFO_REQ infoRequest,                                                       void *info );UGL_LOCAL UGL_STATUS      uglEpson16BitModeAvailGet ( UGL_UGI_DRIVER * pDriver, 				                      UGL_UINT32  * pNumModes, 				                      const UGL_MODE ** pModeArray );UGL_LOCAL UGL_STATUS      uglEpson16BitModeSet      ( UGL_UGI_DRIVER * pDriver, UGL_MODE * pMode );UGL_LOCAL UGL_STATUS      uglEpsonGpWait            ( UGL_GENERIC_DRIVER * pDriver );UGL_LOCAL UGL_STATUS      uglEpsonCreateModes       ( UGL_UGI_DRIVER * pDriver);#ifdef INCLUDE_UGL_DOUBLE_BUFFERINGUGL_LOCAL UGL_STATUS      uglEpsonPageDrawSet       ( UGL_UGI_DRIVER * pDriver,                                                      UGL_PAGE * pPage);#endif /* INCLUDE_UGL_DOUBLE_BUFFERING */#ifdef EPSON_ACCEL_BITMAPUGL_LOCAL UGL_STATUS      uglEpson16BitBitmapBlt    ( UGL_DEVICE_ID devId, UGL_DDB_ID srcDdbId,                                           UGL_RECT * pSourceRect, UGL_DDB_ID destDdbId,                                                      UGL_POINT * pDestPoint );#endif /* EPSON_ACCEL_BITMAP *//******************************************************************************* uglEpson13506_16BitDevCreate - create the Epson 13506 driver for 16 Bit *           * This routine creates a WindML graphics device for the Epson 13506 when * operated in the 16 bit direct color mode.   ** RETURNS: created device control structure when device was successfully*   created; otherwise UGL_NULL** ERRNO: N/A** SEE ALSO: uglEpson13506_16BitDevCreateDestroy()*/UGL_UGI_DRIVER * uglEpson13506_16BitDevCreate    (    UGL_UINT32 instance,    UGL_UINT32 notUsed0,	/* intLevel */    UGL_UINT32 notUsed1		/* intVector */    )    {    UGL_EPSON_DRIVER   * pEpsonDriver;    UGL_GENERIC_DRIVER * pGenDriver;    UGL_UGI_DRIVER     * pDriver = UGL_NULL;    UINT32 virtAdrs;    int size = 0;    int arg;    pEpsonDriver = (UGL_EPSON_DRIVER   *)uglSharedMemAlloc(sizeof(UGL_EPSON_DRIVER),UGL_MEM_CLEAR);    if (UGL_NULL != pEpsonDriver)        {        pGenDriver = (UGL_GENERIC_DRIVER *)pEpsonDriver;        pDriver    = (UGL_UGI_DRIVER *)pGenDriver;        if ((pGenDriver->pWmlDevice = uglGraphicsDevOpen(VENDOR_PCI_EPSON, DEVICE_ID_EPSON_13XXX, 0)) == UGL_NULL)	        {            uglSharedMemFree((char *)pEpsonDriver);            return (UGL_NULL);	        }        /* Save the base address */     pciBaseAddress =  (UINT32)pGenDriver->pWmlDevice->pPhysBaseAdrs0;   /*  pciBaseAddress = 0x30000000 ;  *//* bank2 */        /* Enable I/O and memory cycles */        arg = WINDML_IO_ENABLE | WINDML_MEM_ENABLE;    uglGraphicsDevControl(pGenDriver->pWmlDevice,WINDML_ACCESS_MODE_SET, &arg, sizeof(int));  /* dongliang  if (uglGraphicsDevAccessCheck (pGenDriver->pWmlDevice,                               WINDML_DEVICE_BASE_ADRS_0,                                 &size, UGL_GRAPHICS_NAME) == UGL_STATUS_ERROR)         {        uglSharedMemFree((char *)pEpsonDriver);        return (UGL_NULL);        }   */    /* Map physical memory to virtual */    uglGraphicsDevMap (pGenDriver->pWmlDevice,                        (UINT32) pGenDriver->pWmlDevice->pPhysBaseAdrs0,                        size, &virtAdrs); 	/* Initialize the driver (mandatory) */        uglUgiDevInit(pDriver);	/* Set Standard Driver API Functions */        pDriver->bitmapCreate		= uglGeneric16BitBitmapCreate;	pDriver->modeSet	          = uglEpson16BitModeSet;	pDriver->info                     = uglEpson16BitInfo; 	pDriver->modeAvailGet             = uglEpson16BitModeAvailGet;        pDriver->destroy                  = uglEpson16BitDevDestroy;	pDriver->cursorShow               = uglGenericCursorShow;	pDriver->cursorHide               = uglGenericCursorHide;	pDriver->cursorMove               = uglGenericCursorMove;        pDriver->bitmapBlt                = uglGeneric16BitBitmapBlt;        pDriver->bitmapDestroy	          = uglGeneric16BitBitmapDestroy;        pDriver->bitmapRead	          = uglGeneric16BitBitmapRead;        pDriver->bitmapWrite	          = uglGeneric16BitBitmapWrite;        pDriver->bitmapStretchBlt         = uglGeneric16BitBitmapStretchBlt;        pDriver->monoBitmapBlt            = uglGeneric16BitMonoBitmapBlt;        pDriver->monoBitmapCreate         = uglGeneric16BitMonoBitmapCreate;        pDriver->monoBitmapDestroy        = uglGeneric16BitMonoBitmapDestroy;        pDriver->monoBitmapRead           = uglGeneric16BitMonoBitmapRead;        pDriver->monoBitmapWrite          = uglGeneric16BitMonoBitmapWrite;        pDriver->monoBitmapStretchBlt     = uglGeneric16BitMonoBitmapStretchBlt;        pDriver->transBitmapBlt           = uglGeneric16BitTransBitmapBlt;        pDriver->transBitmapCreate        = uglGenericTransBitmapCreate;        pDriver->transBitmapDestroy       = uglGenericTransBitmapDestroy;        pDriver->transBitmapRead	  = uglGenericTransBitmapRead;        pDriver->transBitmapWrite	  = uglGenericTransBitmapWrite;        pDriver->transBitmapStretchBlt    = uglGenericTransBitmapStretchBlt;	pDriver->transBitmapCreateFromDdb = uglGenericTransBitmapCreateFromDdb;	pDriver->colorAlloc		  = uglGenericColorAllocDirect;	pDriver->colorFree		  = UGL_NULL;        pDriver->clutSet		  = UGL_NULL;	pDriver->clutGet		  = UGL_NULL;	pDriver->colorConvert             = uglGeneric16BitColorConvert;	pDriver->cursorBitmapCreate       = uglGenericCursorBitmapCreate;	pDriver->cursorBitmapDestroy      = uglGenericCursorBitmapDestroy;	pDriver->cursorInit               = uglGenericCursorInit;	pDriver->cursorDeinit             = uglGenericCursorDeinit;	pDriver->cursorImageGet           = uglGenericCursorImageGet;	pDriver->cursorImageSet           = uglGenericCursorImageSet;	pDriver->cursorPositionGet        = uglGenericCursorPositionGet;	pDriver->cursorOff                = uglGenericCursorOff;	pDriver->cursorOn                 = uglGenericCursorOn;	pDriver->ellipse                  = uglGenericEllipse;	pDriver->gcCopy                   = uglGenericGcCopy;	pDriver->gcCreate                 = uglGenericGcCreate;	pDriver->gcDestroy                = uglGenericGcDestroy;	pDriver->gcSet                    = uglGenericGcSet;	pDriver->line                     = uglGenericLine;        pDriver->pixelGet                 = uglGeneric16BitPixelGet;        pDriver->pixelSet                 = uglGeneric16BitPixelSet;	pDriver->polygon                  = uglGenericPolygon;	pDriver->rectangle                = uglGenericRectangle;	pDriver->memPoolCreate            = uglGenericMemPoolCreate;	pDriver->memPoolDestroy           = uglGenericMemPoolDestroy;#ifdef INCLUDE_UGL_DOUBLE_BUFFERING	pDriver->pageCopy                 = uglGenericPageCopy;	pDriver->pageCreate               = uglGenericPageCreate;        pDriver->pageDestroy              = uglGenericPageDestroy;	pDriver->pageDrawGet              = uglGenericPageDrawGet;	pDriver->pageDrawSet              = uglEpsonPageDrawSet;	pDriver->pageVisibleGet           = uglGenericPageVisibleGet;	pDriver->pageVisibleSet           = uglGenericPageVisibleSet;#endif /* INCLUDE_UGL_DOUBLE_BUFFERING */	/* Set Generic Driver Functions */        pGenDriver->bresenhamLine         = uglGeneric16BitBresenhamLine;        pGenDriver->fbPixelGet            = uglGeneric16BitFbPixelGet;        pGenDriver->fbPixelSet            = uglGeneric16BitFbPixelSet; 	pGenDriver->fill                  = uglGenericFill;	pGenDriver->hLine	          = uglGeneric16BitHLine;	pGenDriver->rectFill              = uglGenericRectFill;	pGenDriver->vLine                 = uglGeneric16BitVLine;	pGenDriver->gpWait                = uglEpsonGpWait;        /* Create the modes that are supported */        uglEpsonCreateModes(pDriver);        }    return (pDriver);    }/******************************************************************************* uglEpson16BitDevDestroy - shut down the Epson device driver** This routine shuts down the Epson driver.  It is called, via the * UGI device structure, by the 2D layer when the last UGL application * terminates.** RETURNS: UGL_STATUS_OK when device was successfully shut down;*       otherwise UGL_STATUS_ERROR** ERRNO: N/A***/UGL_LOCAL UGL_STATUS uglEpson16BitDevDestroy    (    UGL_UGI_DRIVER * pDriver    )    {    UGL_GENERIC_DRIVER * pGenDriver = (UGL_GENERIC_DRIVER *)pDriver;    UGL_EPSON_DRIVER * pEpsonDriver = (UGL_EPSON_DRIVER *)pDriver;    if (pDriver)        {	/* Clear the screen */	memset( pGenDriver->fbAddress, 0x0, pDriver->pMode->width * 	        pDriver->pMode->height * (pDriver->pMode->colorDepth / 8) );	/* Delete any extensions */	uglGenExtAllDelete( pDriver );	/* Deinitialize the driver (mandatory) */	uglUgiDevDeinit(pDriver);	UGL_FREE(pDriver->pPageZero->pDdb);	UGL_FREE(pDriver->pPageZero);        uglGraphicsDevClose(pGenDriver->pWmlDevice);        /* Free the driver */        UGL_FREE (pEpsonDriver->pModes);        uglSharedMemFree((char *)pDriver);	return (UGL_STATUS_OK);        }    return ( UGL_STATUS_ERROR );    }/******************************************************************************* uglEpson16BitInfo - Epson device driver info control** This routine provides information setting/getting for the Epson device* driver. The request specified by <infoRequest> is performed.  ** RETURNS: UGL_STATUS_OK when requested function was completed*   satisfactory; otherwise UGL_STATUS_ERROR** ERRNO: N/A***/UGL_LOCAL UGL_STATUS uglEpson16BitInfo    (    UGL_UGI_DRIVER * pDriver,    UGL_INFO_REQ     infoRequest,    void           * info    )    {    UGL_GENERIC_DRIVER *pGenDriver = (UGL_GENERIC_DRIVER *) pDriver;    if ( pDriver->pMode == UGL_NULL )         return( UGL_STATUS_ERROR );    switch (infoRequest)        {	case UGL_FB_INFO_REQ:	    {	    UGL_FB_INFO *fbInfo = (UGL_FB_INFO *)info;	    fbInfo->width       = pDriver->pMode->width;	    fbInfo->height      = pDriver->pMode->height;	    fbInfo->fbAddrs     = pGenDriver->fbAddress;	    fbInfo->dsMemAmount = 0;	    fbInfo->flags       = UGL_FB_PAGING_ENABLED;	    }	    break;	case UGL_COLOR_INFO_REQ:	    {	    UGL_COLOR_INFO *colorInfo = (UGL_COLOR_INFO *)info;	    colorInfo->cmodel         = UGL_CMODEL_DIRECT;	    colorInfo->cspace         = UGL_CSPACE_RGB;	    colorInfo->depth          = pDriver->pMode->colorDepth;	    colorInfo->clutSize       = 0;	    colorInfo->flags          = 0;	    }	    break;	case UGL_MODE_INFO_REQ:	    {	    UGL_MODE_INFO * modeInfo = (UGL_MODE_INFO *)info;

⌨️ 快捷键说明

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