歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

成功移植ucGUI到Linux上

移植ucGUI到Linux上成功,做點記錄。

關鍵修改代碼記錄:

修改點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. */

Copyright © Linux教程網 All Rights Reserved