拉床厂家
免费服务热线

Free service

hotline

010-00000000
拉床厂家
热门搜索:
技术资讯
当前位置:首页 > 技术资讯

eCosGUIforSynthetic的研究软件编程OS万芳

发布时间:2020-02-14 11:38:02 阅读: 来源:拉床厂家

eCos GUI for Synthetic 的研究 - 软件编程/OS - 电子工程网

系统默认的microwindows有比较多的bug,本人把自己的patch放出了,给大家一起学习。diff -r 418d34334c77 packages/services/gfx/mw/current/cdl/microwindows.cdl--- a/packages/services/gfx/mw/current/cdl/microwindows.cdl Thu Apr 01 13:17:10 2010 +0000+++ b/packages/services/gfx/mw/current/cdl/microwindows.cdl Fri Apr 23 14:41:29 2010 +0800@@ -199,6 +199,66 @@ } + # ecos Linux synth drivers+ cdl_component CYGPKG_MICROWINDOWS_SYNTH {+ display Build MicroWindows for synthetic target + flavor none+ active_if (CYGPKG_HAL_SYNTH !CYGBLD_MICROWINDOWS_VNC_DRIVERS)+ description \+ This option builds the drivers for the synthetic target.The synthetic+ then provides a virtual screen. ++ compile \+ drivers/scr_synth_ecos.c\+ drivers/kbd_null.c\+ drivers/mou_null.c+ requires CYGPKG_IO_FRAMEBUF+ requires CYGBLD_MICROWINDOWS_ECOS+ requires CYGBLD_MICROWINDOWS_NANOWM+ requires CYGBLD_MICROWINDOWS_NANOX_DEMOS+ requires !CYGBLD_MICROWINDOWS_ARM_DRIVERS+ cdl_option CYGIMP_MICROWINDOWS_TRUECOLOR0888 {+ display Assume 32 bits per pixel, RGB == 0888 + implementsCYGINT_MICROWINDOWS_SYNTH_DRIVER+ default_value 1+ requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR332 ) }+ }+ cdl_option CYGIMP_MICROWINDOWS_TRUECOLOR565 {+ display Assume 16 bits per pixel, RGB == 565 + implementsCYGINT_MICROWINDOWS_SYNTH_DRIVER+ default_value 0+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ) }+ requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR332 ) }+ }+ cdl_option CYGIMP_MICROWINDOWS_TRUECOLOR555 {+ display Assume 16 bits per pixel, RGB == 555 + implementsCYGINT_MICROWINDOWS_SYNTH_DRIVER+ default_value 0+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ) }+ requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR332 ) }+ }+ cdl_option CYGIMP_MICROWINDOWS_TRUECOLOR332 {+ display Assume 8 bits per pixel, RGB == 332 + implementsCYGINT_MICROWINDOWS_SYNTH_DRIVER+ default_value 0+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555 ) }+ requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR332 ) }+ }+ cdl_interface CYGINT_MICROWINDOWS_SYNTH_DRIVER {+ display Number of active synthic graphics drivers + requires { CYGINT_MICROWINDOWS_SYNTH_DRIVER == 1 }+ }+ }+ cdl_component CYGPKG_MICROWINDOWS_PC { display Build options for PC hardware flavor none@@ -255,7 +315,7 @@ default_value 0 compile drivers/scr_bios.c drivers/vgainit.c drivers/vgaplan4.c drivers/memplan4.c requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_PALETTE ) }- requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ) }+ requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ) } } cdl_interface CYGINT_MICROWINDOWS_PC_DRIVER {@@ -313,6 +373,14 @@ compile demos/nanox/ntetris.c compile -library=libextras.a ecos/ntetris_thread.c }++ cdl_option CYGBLD_MICROWINDOWS_NANOX_DEMOS_DEMO {+ display Include 'demo' demo + default_value 0+ no_define+ compile demos/nanox/demo.c+ compile -library=libextras.a ecos/demo_thread.c+ } } cdl_component CYGPKG_MICROWINDOWS_OPTIONS {diff -r 418d34334c77 packages/services/gfx/mw/current/src/demos/nanowm/wlist.c--- a/packages/services/gfx/mw/current/src/demos/nanowm/wlist.c Thu Apr 01 13:17:10 2010 +0000+++ b/packages/services/gfx/mw/current/src/demos/nanowm/wlist.c Fri Apr 23 14:41:29 2010 +0800@@ -13,7 +13,7 @@ #include nanowm.h -static win *windows = NULL;+/*static*/ win *windows = NULL; /** Find the windowlist entry for the specified window ID and return a pointerdiff -r 418d34334c77 packages/services/gfx/mw/current/src/demos/nanox/demo.c--- a/packages/services/gfx/mw/current/src/demos/nanox/demo.c Thu Apr 01 13:17:10 2010 +0000+++ b/packages/services/gfx/mw/current/src/demos/nanox/demo.c Fri Apr 23 14:41:29 2010 +0800@@ -6,10 +6,15 @@ #define MWINCLUDECOLORS #include nano-X.h + #if DOS_TURBOC unsigned _stklen = 32768; #endif +#if defined(MSDOS) || defined(__ECOS)+#include fcntl.h +#endif+ /** Definitions to make it easy to define cursors*/@@ -47,7 +52,7 @@ void do_buttonup(GR_EVENT_BUTTON *bp); void do_motion(GR_EVENT_MOUSE *mp); void do_keystroke(GR_EVENT_KEYSTROKE *kp);-void do_exposure(GR_EVENT_EXPOSURE *ep);+static void do_exposure(GR_EVENT_EXPOSURE *ep); void do_focusin(GR_EVENT_GENERAL *gp); void do_focusout(GR_EVENT_GENERAL *gp); void do_enter(GR_EVENT_GENERAL *gp);@@ -56,8 +61,13 @@ /* routine to handle errors */ void errorcatcher(GR_EVENT *ep); +#ifdef __ECOS int-main(int argc,char **argv)+demo_main(int argc, char **argv)+#else+int+main(int argc, char **argv)+#endif { GR_EVENT event; /* current event */ GR_BITMAP bitmap1fg[7]; /* bitmaps for first cursor */@@ -73,8 +83,14 @@ GrReqShmCmds(655360); GrGetScreenInfo( si);+#ifdef __ECOS+/* 240x320 screen*/+COLS = si.cols - 10;+ROWS = si.rows - 40;+#else COLS = si.cols - 40; ROWS = si.rows - 80;+#endif /* print error, but don't exit*/ GrSetErrorHandler(errorcatcher);@@ -375,7 +391,7 @@ /** Here when an exposure event occurs.*/-void+static void do_exposure(GR_EVENT_EXPOSURE *ep) { GR_POINT points[3];diff -r 418d34334c77 packages/services/gfx/mw/current/src/drivers/scr_synth_ecos.c--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/packages/services/gfx/mw/current/src/drivers/scr_synth_ecos.c Fri Apr 23 14:41:29 2010 +0800@@ -0,0 +1,444 @@+//==========================================================================+//+// scr_synth_ecos.c+//+//+//+//==========================================================================+// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.+//+// eCos 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 or (at your option) any later +// version. +//+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA. +//+// As a special exception, if other files instantiate templates or use +// macros or inline functions from this file, or you compile this file +// and link it with other works to produce a work based on this file, +// this file does not by itself cause the resulting work to be covered by +// the GNU General Public License. However the source code for this file +// must still be made available in accordance with section (3) of the GNU +// General Public License v2. +//+// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//==========================================================================+//#####DESCRIPTIONBEGIN####+//+// Author(s): Ricky Wu rickleaf.wu@gmail.com +// Contributors:+// Date: 2010-04-16+// Purpose:+// Description:Microwindows screen driver for synth server on eCos+//+//####DESCRIPTIONEND####+//+//========================================================================*/++++#define _GNU_SOURCE 1++#include pkgconf/system.h ++#include assert.h +#include fcntl.h +#include limits.h +#include cyg/hal/drv_api.h +#include cyg/infra/diag.h +#include cyg/io/io.h +#include cyg/io/framebuf.h +#include stdarg.h +#include stdio.h +#include stdlib.h +#include sys/stat.h +#include sys/time.h +#include sys/types.h +#include unistd.h +#include device.h +#include genfont.h +#include genmem.h +++static cyg_ucount32 colours[16];+/* In genmem.c*/+MWBOOLset_subdriver(PSD psd, PSUBDRIVER subdriver, MWBOOL init);++/* Prototypes for driver functions */+static int synth_init(PSD psd);+static PSDsynth_open(PSD psd);+static void synth_close(PSD psd);+static void synth_getscreeninfo(PSD psd,PMWSCREENINFO psi);+static void synth_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);+static MWPIXELVAL synth_readpixel(PSD psd,MWCOORD x, MWCOORD y);+static void synth_drawhorizline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);+static void synth_drawvertline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);+static void synth_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c);+static void synth_blit(PSD , MWCOORD, MWCOORD, MWCOORD, MWCOORD, PSD, MWCOORD, MWCOORD, long);+static void synth_stretchblit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD dstw,+ MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy,+ MWCOORD srcw, MWCOORD srch, long op);+static void synth_drawarea(PSD psd, driver_gc_t *gc, int op);+MWBOOL synth_mapmemgc(PSD, MWCOORD, MWCOORD, int, int, int, int, void *);+++#define FRAMEBUF cyg_synth_fb0++#define BLACK cyg_fb_make_colour( FRAMEBUF, 0, 0, 0)+#define WHITE cyg_fb_make_colour( FRAMEBUF, 255, 255, 255)+#define RED cyg_fb_make_colour( FRAMEBUF, 255, 0, 0)+#define GREEN cyg_fb_make_colour( FRAMEBUF, 0, 255, 0)+#define BLUE cyg_fb_make_colour( FRAMEBUF, 0, 0, 255)+#define YELLOW cyg_fb_make_colour( FRAMEBUF, 255, 255,80)++++SCREENDEVICE scrdev = {+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,+ synth_open,+ synth_close,+ synth_getscreeninfo,+ NULL,+ synth_drawpixel, /* DrawPixel subdriver*/+ synth_readpixel, /* ReadPixel subdriver*/+ synth_drawhorizline, /* DrawHorzLine subdriver*/+ synth_drawvertline,/* DrawVertLine subdriver*/+ synth_fillrect, /* FillRect subdriver*/+ gen_fonts,+ synth_blit, /* Blit subdriver*/+ NULL, /* PreSelect*/+ NULL, /* DrawArea subdriver*/+ NULL, /* SetIOPermissions*/+ gen_allocatememgc,+ synth_mapmemgc,+ gen_freememgc,+ synth_stretchblit, /* StretchBlit subdriver*/+ NULL /* SetPortrait*/+};++SUBDRIVER synth_subdriver = {+ synth_init,+ synth_drawpixel,+ synth_readpixel,+ synth_drawhorizline,+ synth_drawvertline,+ synth_fillrect,+ synth_blit,+ synth_drawarea,+ synth_stretchblit+};++/* Static variables*/+static int status; /* 0=never inited, 1=once inited, 2=inited. */+//static synth_frame_format_t *frame_format;++/* Calc linelen and mmap size, return 0 on fail*/+static int synth_init(PSD psd)+{+ if (!psd- size)+ {+ psd- size = psd- yres * psd- xres * psd- bpp / 8;+ /* convert linelen from byte to pixel len for bpp 16, 24, 32*/+ psd- linelen = psd- xres;+ }++ return 1;+}++static cyg_fb_colour CMWtofb(cyg_fb* fb,MWPIXELVAL c)+{+ if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_8BPP_TRUE_332)+ {+ return cyg_fb_make_colour(fb, (c 0xe0) (3+2), (c 0x1c) 2, (c 0x03));+ }+ else if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_16BPP_TRUE_555)+ {+ return cyg_fb_make_colour(fb, (c 0x7c00) (5+5), (c 0x03e0) 5, (c 0x001f));+ }+ else if(CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_16BPP_TRUE_565)+ {+ return cyg_fb_make_colour(fb, (c 0xf800) (6+5), (c 0x07e0) 5, (c 0x001f));+ }+ else if(CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_32BPP_TRUE_0888)+ {+ return cyg_fb_make_colour(fb, (c 0xFF0000) (8+8), (c 0x00ff00) 8, (c 0x0000ff));+ }+}++static MWPIXELVAL CFBtoMW(cyg_fb* fb,cyg_fb_colour fb_colour)+{+ cyg_ucount8 r,g,b;+ MWPIXELVAL mMWPIXELVAL=0;+ cyg_fb_break_colour(fb,fb_colour, r, g, + if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_8BPP_TRUE_332)+ {+ mMWPIXELVAL|=r;+ mMWPIXELVAL =3;+ mMWPIXELVAL|=g;+ mMWPIXELVAL =2;+ mMWPIXELVAL|=b;+ return mMWPIXELVAL;+ }+ else if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_16BPP_TRUE_555)+ {+ mMWPIXELVAL|=r;+ mMWPIXELVAL =5;+ mMWPIXELVAL|=g;+ mMWPIXELVAL =5;+ mMWPIXELVAL|=b;+ return mMWPIXELVAL;+ }+ else if(CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_16BPP_TRUE_565)+ {+ mMWPIXELVAL|=r;+ mMWPIXELVAL =6;+ mMWPIXELVAL|=g;+ mMWPIXELVAL =5;+ mMWPIXELVAL|=b;+ return mMWPIXELVAL;+ }+ else if(CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_32BPP_TRUE_0888)+ {+ mMWPIXELVAL|=r;+ mMWPIXELVAL =8;+ mMWPIXELVAL|=g;+ mMWPIXELVAL =8;+ mMWPIXELVAL|=b;+ return mMWPIXELVAL;+ }+ +}++/* Initialise the synth framebuffer */+static PSD synth_open(PSD psd)+{+ /* Get frame format details */+ cyg_fb_on( FRAMEBUF);++ psd- xres = psd- xvirtres = CYG_FB_fb0_WIDTH;+ psd- yres = psd- yvirtres = CYG_FB_fb0_HEIGHT;+ psd- portrait = MWPORTRAIT_NONE;+ psd- planes = 1;/* Should probably find out what this means */+++ if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_8BPP_TRUE_332)+ {+ psd- bpp = 8;+ psd- ncolors = 0xFF + 1;+ psd- pixtype = MWPF_TRUECOLOR332;+ }+ else if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_16BPP_TRUE_555)+ {+ psd- bpp = 16;+ psd- ncolors = 0x7FFF + 1;+ psd- pixtype = MWPF_TRUECOLOR555;+ }+ else if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_16BPP_TRUE_565)+ {+ psd- bpp = 16;+ psd- ncolors = 0xFFFF + 1;+ psd- pixtype = MWPF_TRUECOLOR565;+ }+ else if (CYG_FB_fb0_FORMAT==CYG_FB_FORMAT_32BPP_TRUE_0888)+ {+ psd- bpp = 32;+ psd- ncolors = 0xFFFFFF + 1;+ psd- pixtype = MWPF_TRUECOLOR0888;+ }+ else+ {+ EPRINTF( Unsupported display type\n + goto fail;+ }++ psd- linelen = CYG_FB_fb0_WIDTH * psd- bpp / 8;;/* What is linelen?- linelen in bytes for now...*/+ psd- size = psd- xres * psd- yres * psd- bpp / 8;+ psd- flags = PSF_SCREEN | PSF_HAVEBLIT;+ psd- addr = CYG_FB_fb0_BASE;/* Test */+// psd- addr = NULL;/* We do not want MW to access the frame buffer directly */+++ /* We always use our own subdriver */+ psd- orgsubdriver = synth_subdriver;+++ status = 2;+ return psd; /* success*/++ fail:+ return NULL;+}+++/* Close framebuffer*/+static void synth_close(PSD psd)+{+ EPRINTF( %s - NOT IMPLEMENTED\n , __FUNCTION__);+}+++static void synth_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)+{+ cyg_fb_write_pixel( FRAMEBUF,x, y, CMWtofb( FRAMEBUF,c));+ cyg_fb_synch( FRAMEBUF,0);+}+++static MWPIXELVAL synth_readpixel(PSD psd, MWCOORD x, MWCOORD y)+{+ return CFBtoMW( FRAMEBUF,cyg_fb_read_pixel( FRAMEBUF,x,y));+}+++static void synth_drawhorizline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)+{+ cyg_fb_write_hline( FRAMEBUF,x1, y,x2-x1+1, CMWtofb( FRAMEBUF,c));+ cyg_fb_synch( FRAMEBUF,0);+}+++static void synth_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)+{+ cyg_fb_write_vline( FRAMEBUF,x, y1, y2-y1+1, CMWtofb( FRAMEBUF,c));+ cyg_fb_synch( FRAMEBUF,0);++}+复制代码

性感美女照

美女性感照片

情感故事

美女旗袍照