惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - 高原

[转] 定义、注册和实现 GObject 类的子类 [转] GType 类型系统的功能 [转] Android FrameWork——Touch事件派发过程详解 [转] GObject对象系统 [转] GTYPE类型系统分析 VC里嵌汇编,获取寄存器的值 [转] 使用dbghelp获取调用堆栈--release下的调试方法学 [转] 探索Win32系统之窗口类(Window Classes in Win32) [转] 编译器开关参数集 [转] Nano-X的详细介绍 [转] 为MicroWindows添加透明绘图函数 [转] microwindows位图解析 [转] Microwindows及其中文化方法 [转] Nano-X显示系统的代码分析 [转] Nano-X图形引擎分析及其优化 [转] 使用 pq magic 分区出现 Error 983 报错信息的处理办法 [转] IncrediBuild 试用时间推迟的算法 [原创] MicroWindows学习笔记之底层消息的读取 [转载] Makefile详解
[原创] MicroWindows学习笔记之对底层设备的管理
高原 · 2010-04-11 · via 博客园 - 高原

MicroWindows对每个相关的设备提供了一个数据结构,并有一个全局的上下文设备对象,通过它来屏蔽与底层之间的联系,上层代码通过调用这个全局变量提供的方法来打开、关闭、读取这些设备。如果想将MicroWindows移植到其他的环境中,需要配置这个全局变量,并且实现相关的方法。MicroWindows对底层的屏蔽层(针对各个系统的驱动)放在\src\drivers中。

键盘

数据结构KBDDEVICE

/* Interface to Keyboard Device Driver*/

typedef struct _kbddevice {

       int  (*Open)(struct _kbddevice *pkd);

       void (*Close)(void);

       void (*GetModifierInfo)(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);

       int  (*Read)(MWKEY *buf,MWKEYMOD *modifiers,MWSCANCODE *scancode);

       int  (*Poll)(void);         /* not required if have select()*/

} KBDDEVICE;

所在文件:\include\Device.h

全局变量

KBDDEVICE kbddev = {

       NUL_Open,

       NUL_Close,

       NUL_GetModifierInfo,

       NUL_Read,

       NUL_Poll

};

所在文件:drivers\Kdb_null.c

默认都是空实现。

鼠标

数据结构MOUSEDEVICE

/* Interface to Mouse Device Driver*/

typedef struct _mousedevice {

       int    (*Open)(struct _mousedevice *);

       void   (*Close)(void);

       int    (*GetButtonInfo)(void);

       void   (*GetDefaultAccel)(int *pscale,int *pthresh);

       int    (*Read)(MWCOORD *dx,MWCOORD *dy,MWCOORD *dz,int *bp);

       int    (*Poll)(void);  /* not required if have select()*/

       int    flags;             /* raw, normal, transform flags*/

} MOUSEDEVICE;

所在文件:\include\Device.h

全局变量

MOUSEDEVICE mousedev = {

       NUL_Open,

       NUL_Close,

       NUL_GetButtonInfo,

       NUL_GetDefaultAccel,

       NUL_Read,

       NUL_Poll

};

所在文件:drivers\Mou_null.c

屏幕

数据结构SCREENDEVICE

/*

 * Interface to Screen Device Driver

 * This structure is also allocated for memory (offscreen) drawing and blitting.

 */

typedef struct _mwscreendevice {

       MWCOORD   xres;              /* X screen res (real) */

       MWCOORD   yres;              /* Y screen res (real) */

       MWCOORD   xvirtres;  /* X drawing res (will be flipped in portrait mode) */

       MWCOORD   yvirtres;  /* Y drawing res (will be flipped in portrait mode) */

       int    planes;       /* # planes*/

       int    bpp;          /* # bpp*/

       int    linelen;      /* line length in bytes for bpp 1,2,4,8*/

                            /* line length in pixels for bpp 16, 24, 32*/

       int    size;         /* size of memory allocated*/

       long ncolors;        /* # screen colors*/

       int    pixtype;      /* format of pixel value*/

       int    flags;        /* device flags*/

       void *     addr;     /* address of memory allocated (memdc or fb)*/

       PSD (*Open)(PSD psd);

       void (*Close)(PSD psd);

       void (*GetScreenInfo)(PSD psd,PMWSCREENINFO psi);

       void (*SetPalette)(PSD psd,int first,int count,MWPALENTRY *pal);

       void (*DrawPixel)(PSD psd,MWCOORD x,MWCOORD y,MWPIXELVAL c);

       MWPIXELVAL (*ReadPixel)(PSD psd,MWCOORD x,MWCOORD y);

       void (*DrawHorzLine)(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);

       void (*DrawVertLine)(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);

       void (*FillRect)(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c);

       PMWCOREFONT builtin_fonts;

       /* *void (*DrawText)(PSD psd,MWCOORD x,MWCOORD y,const MWUCHAR *str,

                     int count, MWPIXELVAL fg, PMWFONT pfont);***/

       void (*Blit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD w, MWCOORD h, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op);

       void (*PreSelect)(PSD psd);

       void (*DrawArea)(PSD psd, driver_gc_t *gc, int op);

       int    (*SetIOPermissions)(PSD psd);

       PSD (*AllocateMemGC)(PSD psd);

       MWBOOL (*MapMemGC)(PSD mempsd, MWCOORD w, MWCOORD h, int planes, int bpp, int linelen, int size, void *addr);

       void (*FreeMemGC)(PSD mempsd);

       void (*StretchBlit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD destw, MWCOORD desth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, MWCOORD srcw, MWCOORD srch, long op);

       void (*SetPortrait)(PSD psd,int portraitmode);

       int    portrait;   /* screen portrait mode*/

       PSUBDRIVER orgsubdriver; /* original subdriver for portrait modes*/

       void (*StretchBlitEx) (PSD dstpsd, PSD srcpsd, MWCOORD dest_x_start, MWCOORD dest_y_start, MWCOORD width, MWCOORD height, int x_denominator, int y_denominator, int src_x_fraction, int src_y_fraction, int x_step_fraction, int y_step_fraction, long op);

} SCREENDEVICE;

所在文件:\include\Device.h

全局变量

SCREENDEVICE   scrdev = {

       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,

       DBG_open,

       DBG_close,

       DBG_getscreeninfo,

       DBG_setpalette,

       DBG_drawpixel,

       DBG_readpixel,

       DBG_drawhline,

       DBG_drawvline,

       DBG_fillrect,

       gen_fonts,

       DBG_blit,

       NULL,                  /* PreSelect*/

       NULL,                  /* DrawArea subdriver*/

       NULL,                  /* SetIOPermissions*/

       gen_allocatememgc,

       NULL,                  /* MapMemGC*/

       NULL                   /* FreeMemGC*/

};

所在文件:drivers\Scr_debug.c