vxworks_i386.c

来自「mini gui 1.6.8 lib and source」· C语言 代码 · 共 115 行

C
115
字号
/***  $Id: vxworks_i386.c,v 1.7 2005/04/29 07:21:29 xwyan Exp $**  **  vxworks_i386.c: A subdriver of CommonLCD NEWGAL engine for VxWorks on i386.****  Copyright (C) 2003 ~ 2005 Feynman Software.*//*** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "common.h"#ifdef _NEWGAL_ENGINE_COMMLCD#if defined (__VXWORKS__) && defined (__TARGET_VXI386__)#include "minigui.h"#include "newgal.h"#include "sysvideo.h"#include "pixels_c.h"#include "commlcd.h"#include <ugl/uglugi.h>#include <ugl/uglinfo.h>#include <ugl/ugl.h>static UGL_DEVICE_ID devId;UGL_GC_ID gc;    static int a_init (void){    if (uglInitialize() == UGL_STATUS_ERROR)        return 1;        return 0; }static int a_getinfo (struct lcd_info *li){    UGL_MODE_INFO modeInfo;        /* Obtain display device identifier */    devId = (UGL_DEVICE_ID) uglRegistryFind (UGL_DISPLAY_TYPE,                      0, 0, 0)->id;       /* Create a graphics context */    gc = uglGcCreate (devId);    #ifndef _VESA_SUPPORT    uglInfo (devId, UGL_MODE_INFO_REQ, &modeInfo);    li->type = FB_PSEUDO_RGB332;#else    uglPcBiosInfo (devId, UGL_MODE_INFO_REQ, &modeInfo);    li->type = FB_TRUE_RGB565;#endif    li->height = modeInfo.height;    li->width = modeInfo.width;    li->fb = modeInfo.fbAddress;    li->bpp = modeInfo.colorDepth;    li->rlen = (li->bpp*li->width + 7) / 8;    return 0;}#ifndef _VESA_SUPPORT    static int a_setclut (int firstcolor, int ncolors, GAL_Color *colors){    int i;       UGL_ARGB argb [256];    if (ncolors > 256) ncolors = 256;        for (i = 0; i < ncolors; i++)        argb [i] = UGL_MAKE_RGB (colors[i].r, colors[i].g, colors[i].b);        uglClutSet (devId, firstcolor, argb, ncolors);    return 1;}#endifstruct lcd_ops __mg_commlcd_ops = {        a_init,        a_getinfo,        NULL,    #ifndef _VESA_SUPPORT            a_setclut    #else        NULL    #endif};#endif /* __VXWORKS__ && __TARGET_VXI386__ */#endif /* _NEWGAL_ENGINE_COMMLCD */

⌨️ 快捷键说明

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