移植ucgui到linux上成功

Author:DriverMonkey

Contact inforation:196568501(qq)

mail:[email protected]

phone:13410905075


关键修改代码记录:

修改点1:

注:为了使ucgui 适配 32 bit per pixsel 

typedef union {
  U32  aColorIndex8[2];
  U32 aColorIndex16[2];
} LCD_COLORINDEX_UNION;

关键修改点2:

注:此处修改主要是为适配linuxframbuffer

struct fb_var_screeninfo g_vinfo;
int g_fbfd, g_fbsize;
unsigned char *g_fbbuf;
void init_dummy_driver(void)
{
/* Open video memory */
if ((g_fbfd = open("/dev/fb0", O_RDWR)) < 0) {
 exit(1);
}
/* Get variable display parameters */
if (ioctl(g_fbfd, FBIOGET_VSCREENINFO, &g_vinfo)) {
 printf("Bad vscreeninfo ioctl/n");
 exit(2);
}
/* Size of frame buffer */
g_fbsize = g_vinfo.xres*g_vinfo.yres*(g_vinfo.bits_per_pixel/8);
/* Map video memory */
if ((g_fbbuf = mmap(0, g_fbsize, PROT_READ | PROT_WRITE,
 MAP_SHARED, g_fbfd, 0)) == (void *) -1) {
 exit(3);
}
}
void deinit_dummy_drivr(void)
{
munmap(g_fbbuf, g_fbsize);
close(g_fbfd);
}


关键修改点3:

注:使ucgui 适配 32 bit per pixsel 

#define I16   signed int    /*   signed 16 bits. */
#define U16 unsigned int    /* unsigned 16 bits. */


源码下载链接:http://download.csdn.net/detail/peng654321/4752110

你可能感兴趣的:(移植ucgui到linux上成功)