其实在microwindows的LCD部份与按键类似.
回到 ebrmain.c 中 main() 函数中.
int main() { GR_EVENT event; if (GrOpen() < 0) { fprintf (stderr, "GrOpen failed"); return 0; } ...
...
...
return 0; }
|
LCD 的初始化也是在GrOpen() 中实现的.
GrOpen->GsInitialize->GdOpenScreen
GdOpenScreen 在 src/engine/devopen.c 中定义.
现在分析一下 GdOpenScreen() 这个函数
/** * Open low level graphics driver. * * @return The screen drawing surface. */ PSD GdOpenScreen(void) { PSD psd; MWPALENTRY * stdpal; MWSCREENINFO sinfo;
psd = scrdev.Open(&scrdev); if (!psd) return NULL; ...
... } |
GrOpen->GsInitialize->GdOpenScreen->scrdev.Open
首先调用 scrdev.Open 进行初始化操作, scrdev 初始化在 src/drivers/scr_fb.c 文件中, 对 open, close, getscreeninfo, ...,ShowWindow, SaveImage等函数进行初始化操作.
GrOpen->GsInitialize->GdOpenScreen->scrdev.Open->Open
/* local functions*/ /* init framebuffer*/ static PSD open(PSD psd) { psd->xres = psd->xvirtres = WIDTH; psd->yres = psd->yvirtres = HEIGHT; psd->planes = PLANES; psd->bpp = BITCOUNT; psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp); // colors count psd->linelen = psd->xvirtres; psd->addr = bmpdata; psd->size = MEMSIZE; psd->pixtype = MWPF_TRUECOLOR888; memset(psd->addr,0x00,psd->size); psd->portrait = MWPORTRAIT_NONE; /* !EMBEDDEDPLANET*/ psd->flags = PSF_SCREEN | PSF_HAVEBLIT; if (psd->bpp == 16) psd->flags |= PSF_HAVEOP_COPY; status = 2; open_panel(); return psd; /* success*/ }
|
在 open 函数里对 LCD的一些参数进行了配置.
GrOpen->GsInitialize->GdOpenScreen->scrdev.Open->Open->open_panel
void open_panel() { pio_fd = open ("/dev/fb0", O_RDONLY | O_NONBLOCK); }
|
open_panel 只是打开一个设备文件.
阅读(1499) | 评论(0) | 转发(0) |