/********************************************************************* * * LCD_X_Config * * Purpose: * Called during the initialization process in order to set up the * display driver configuration. * */ void LCD_X_Config(void) { /********************************************************************************************************/ { lcd_info.fd = open("/dev/fb0", O_RDWR, 0666); if (lcd_info.fd < 0) { GUI_X_ErrorOut("emWin failed to open framebuffer device: \"/dev/fb0\", serious error\n"); /* * TODO: 出错处理 */ } ioctl(lcd_info.fd, FBIOGET_VSCREENINFO, &lcd_info.var); ioctl(lcd_info.fd, FBIOGET_FSCREENINFO, &lcd_info.fix); /* * TODO: 这两个值的设置 */ COLOR_CONVERSION = GUICC_M565; DISPLAY_DRIVER = GUIDRV_LIN_16; } /********************************************************************************************************/ // // At first initialize use of multiple buffers on demand // #if (NUM_BUFFERS > 1) GUI_MULTIBUF_Config(NUM_BUFFERS); #endif // // Set display driver and color conversion for 1st layer // GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0); // // Display driver configuration, required for Lin-driver // if (LCD_GetSwapXY()) { LCD_SetSizeEx (0, YSIZE_PHYS, XSIZE_PHYS); LCD_SetVSizeEx(0, YSIZE_VIRT, XSIZE_VIRT); } else { LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS); LCD_SetVSizeEx(0, XSIZE_VIRT, YSIZE_VIRT); } LCD_SetVRAMAddrEx(0, (void *)VRAM_ADDR); // // Set user palette data (only required if no fixed palette is used) // #if defined(PALETTE) LCD_SetLUTEx(0, PALETTE); #endif }
/********************************************************************* * * GUI_X_Config * * Purpose: * Called during the initialization process in order to set up the * available memory for the GUI. */ void GUI_X_Config(void) { // // Assign memory to emWin // void *ptr = kmalloc(GUI_NUMBYTES, GFP_KERNEL); if (ptr == NULL) { GUI_X_ErrorOut("emWin failed to alloc private memory, serious error\n"); /* * TODO: іцґнґ¦Ан */ } GUI_ALLOC_AssignMemory(ptr, GUI_NUMBYTES); GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE); // // Set default font // GUI_SetDefaultFont(GUI_FONT_6X8); }
/********************************************************************* * * GUI_ErrorOut */ void GUI_ErrorOut(const char *s) { GUI_X_ErrorOut(s); }