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

📄 commlcd.c

📁 mini gui 1.6.8 lib and source
💻 C
字号:
/*** $Id: commlcd.c,v 1.1 2004/08/02 02:57:47 snig Exp $** ** commlcd.c: GAL driver for common lcd.** ** Copyright (C) 2004 Feynman Software.**** Create Date: 2003/07/04 by Wei Yongming*//*** 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 <stdarg.h>#include <unistd.h>#include "native.h"#ifdef _NATIVE_GAL_COMMLCD#include "fb.h"struct lcd_info {    short height, width;  // Pixels    short bpp;            // Depth (bits/pixel)    short type;    short rlen;           // Length of one raster line in bytes    void  *fb;            // Frame buffer};//FIXME#ifdef __ECOS__  #define drv_lcd_getinfo lcd_getinfo  #define drv_lcd_init()  lcd_init(16)#else  int drv_lcd_getinfo (struct lcd_info *li);  int drv_lcd_init (void);#endif/* init framebuffer*/static PSD fb_open(PSD psd){    struct lcd_info li;    PSUBDRIVER subdriver;    /* Initialize LCD screen */    drv_lcd_init ();    drv_lcd_getinfo (&li);    psd->planes = 1;    psd->xres = li.width;    psd->yres = li.height;    psd->bpp = li.bpp;    psd->linelen = li.rlen;    psd->ncolors = (psd->bpp >= 24) ? (1 << 24) : (1 << psd->bpp);    psd->addr = li.fb;    psd->gr_mode = MODE_SET;    psd->size = 0;                /* force subdriver init of size */    psd->flags = PSF_MEMORY;    //FIXME, for ucosii-s3c2410, this should not be set.    //shuld be returned by drv_lcd_getinfo ?    psd->flags |= PSF_MSBRIGHT; /* the most significant bit is right */    /* set pixel format*/    switch (psd->bpp) {        case 16:            psd->pixtype = PF_TRUECOLOR565;            break;        case 1:            psd->pixtype = PF_PALETTE;            break;        default:            fprintf(stderr, "GAL Common LCD engine: Unsupported FrameBuffer\n");            goto fail;    }    /* select a framebuffer subdriver based on planes and bpp*/    subdriver = select_fb_subdriver (psd);    if (!subdriver) {        fprintf(stderr,"GAL Common LCD engine: No driver for bpp %d\n", psd->bpp);        goto fail;    }    /*     * set and initialize subdriver into screen driver     * psd->size is calculated by subdriver init     */    if (!set_subdriver (psd, subdriver, TRUE)) {        fprintf(stderr,"GAL Common LCD engine: Driver initialize failed for bpp %d\n", psd->bpp);        goto fail;    }    return psd;fail:    return NULL;}/* close framebuffer*/static void fb_close (PSD psd){}static void fb_setpalette (PSD psd, int first, int count, GAL_Color *palette){}static void fb_getpalette (PSD psd, int first, int count, GAL_Color *palette){}SCREENDEVICE commlcd = {    0, 0, 0, 0, 0,     0, 0, 0, 0, 0,     0, 0, 0, 0, 0,     0, 0, 0, 0,     NULL, NULL,    fb_open,    fb_close,    fb_setpalette,    fb_getpalette,    native_gen_allocatememgc,    fb_mapmemgc,    native_gen_freememgc,    native_gen_clippoint,    native_gen_fillrect,    NULL,           /* DrawPixel subdriver */    NULL,           /* ReadPixel subdriver */    NULL,           /* DrawHLine subdriver */    NULL,           /* DrawVLine subdriver */    NULL,           /* Blit subdriver */    NULL,           /* PutBox subdriver */    NULL,           /* GetBox subdriver */    NULL,           /* PutBoxMask subdriver */    NULL,           /* CopyBox subdriver */    NULL            /* UpdateRect */};#endif /* _NATIVE_GAL_COMMLCD */

⌨️ 快捷键说明

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