diff -Naur u-boot/common/cmd_bmp.c u-boot-paub/common/cmd_bmp.c --- u-boot/common/cmd_bmp.c 2003-07-01 23:07:07.000000000 +0200 +++ u-boot-paub/common/cmd_bmp.c 2004-03-11 16:48:01.000000000 +0100 @@ -32,7 +32,7 @@ #if (CONFIG_COMMANDS & CFG_CMD_BMP) static int bmp_info (ulong addr); -static int bmp_display (ulong addr); +static int bmp_display (ulong addr, int x, int y); /* * Subroutine: do_bmp @@ -47,6 +47,7 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { ulong addr; + int x = 0, y = 0; switch (argc) { case 2: /* use load_addr as default address */ @@ -55,6 +56,11 @@ case 3: /* use argument */ addr = simple_strtoul(argv[2], NULL, 16); break; + case 5: + addr = simple_strtoul(argv[2], NULL, 16); + x = simple_strtoul(argv[3], NULL, 10); + y = simple_strtoul(argv[4], NULL, 10); + break; default: printf ("Usage:\n%s\n", cmdtp->usage); return 1; @@ -66,7 +72,7 @@ if (strncmp(argv[1],"info",1) == 0) { return (bmp_info(addr)); } else if (strncmp(argv[1],"display",1) == 0) { - return (bmp_display(addr)); + return (bmp_display(addr, x, y)); } else { printf ("Usage:\n%s\n", cmdtp->usage); return 1; @@ -74,10 +80,10 @@ } U_BOOT_CMD( - bmp, 3, 1, do_bmp, + bmp, 5, 1, do_bmp, "bmp - manipulate BMP image data\n", - "info - display image info\n" - "bmp display - display image\n" + "info - display image info\n" + "bmp display [x y] - display image at x,y\n" ); /* @@ -115,11 +121,17 @@ * Return: None * */ -static int bmp_display(ulong addr) +static int bmp_display(ulong addr, int x, int y) { - extern int lcd_display_bitmap (ulong); +#ifdef CONFIG_LCD + extern int lcd_display_bitmap (ulong, int, int); - return (lcd_display_bitmap (addr)); + return (lcd_display_bitmap (addr, x, y)); +#endif +#ifdef CONFIG_VIDEO + extern int video_display_bitmap (ulong, int, int); + return (video_display_bitmap (addr, x, y)); +#endif } #endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */ diff -Naur u-boot/cpu/mpc8xx/lcd.c u-boot-paub/cpu/mpc8xx/lcd.c --- u-boot/cpu/mpc8xx/lcd.c 2003-11-25 17:55:19.000000000 +0100 +++ u-boot-paub/cpu/mpc8xx/lcd.c 2004-03-11 16:51:36.000000000 +0100 @@ -1205,7 +1205,7 @@ * Display the BMP file located at address bmp_image. * Only uncompressed */ -int lcd_display_bitmap(ulong bmp_image) +int lcd_display_bitmap(ulong bmp_image, int x, int y) { volatile immap_t *immr = (immap_t *) CFG_IMMR; volatile cpm8xx_t *cp = &(immr->im_cpm); @@ -1277,16 +1277,14 @@ } padded_line = (width&0x3) ? ((width&~0x3)+4) : (width); - if (width>panel_info.vl_col) - width = panel_info.vl_col; - if (height>panel_info.vl_row) - height = panel_info.vl_row; + if ((x + width)>panel_info.vl_col) + width = panel_info.vl_col - x; + if ((y + height)>panel_info.vl_row) + height = panel_info.vl_row - y; bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset); - fb = (uchar *) - (lcd_base + - (((height>=panel_info.vl_row) ? panel_info.vl_row : height)-1) - * lcd_line_length); + fb = (uchar *) (lcd_base + + (y + height - 1) * lcd_line_length + x); for (i = 0; i < height; ++i) { WATCHDOG_RESET(); for (j = 0; j < width ; j++) @@ -1317,7 +1315,7 @@ if ((s = getenv("splashimage")) != NULL) { addr = simple_strtoul(s, NULL, 16); - if (lcd_display_bitmap (addr) == 0) { + if (lcd_display_bitmap (addr, 0, 0) == 0) { return ((void *)lcd_base); } } diff -Naur u-boot/drivers/cfb_console.c u-boot-paub/drivers/cfb_console.c --- u-boot/drivers/cfb_console.c 2003-06-27 23:32:37.000000000 +0200 +++ u-boot-paub/drivers/cfb_console.c 2004-03-11 16:33:13.000000000 +0100 @@ -127,7 +127,6 @@ #define VIDEO_HW_RECTFILL #define VIDEO_HW_BITBLT #endif - /*****************************************************************************/ /* Include video_fb.h after definitions of VIDEO_HW_RECTFILL etc */ /*****************************************************************************/ @@ -168,6 +167,11 @@ #endif +#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN) +#include +#include +#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */ + /*****************************************************************************/ /* Cursor definition: */ /* CONFIG_CONSOLE_CURSOR: Uses a timer function (see drivers/i8042.c) to */ @@ -691,6 +695,269 @@ /*****************************************************************************/ +#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN) + +#define FILL_8BIT_332RGB(r,g,b) \ + { \ + *fb = ((r>>5)<<5) | ((g>>5)<<2) | (b>>6); \ + fb ++; \ + } + +#define FILL_15BIT_555RGB(r,g,b) \ + { \ + *(unsigned short *)fb = SWAP16((unsigned short)(((r>>3)<<10) | ((g>>3)<<5) | (b>>3))); \ + fb += 2; \ + } + +#define FILL_16BIT_565RGB(r,g,b) \ + { \ + *(unsigned short *)fb = SWAP16((unsigned short)((((r)>>3)<<11) | (((g)>>2)<<5) | ((b)>>3))); \ + fb += 2; \ + } + +#define FILL_32BIT_X888RGB(r,g,b) \ + { \ + *(unsigned long *)fb = SWAP32((unsigned long)(((r<<16) | (g<<8) | b))); \ + fb += 4; \ + } + +#ifdef VIDEO_FB_LITTLE_ENDIAN +#define FILL_24BIT_888RGB(r,g,b) \ + { \ + fb[0] = b; \ + fb[1] = g; \ + fb[2] = r; \ + fb += 3; \ + } + +#else +#define FILL_24BIT_888RGB(r,g,b) \ + { \ + fb[0] = r; \ + fb[1] = g; \ + fb[2] = b; \ + fb += 3; \ + } +#endif + + +/* + * Display the BMP file located at address bmp_image. + * Only uncompressed + */ +int video_display_bitmap(ulong bmp_image, int x, int y) +{ + ushort xcount, ycount; + uchar *fb; + bmp_image_t *bmp=(bmp_image_t *)bmp_image; + uchar *bmap; + ushort padded_line; + unsigned long width, height, bpp; + unsigned colors; + unsigned long compression; + bmp_color_table_entry_t cte; + + WATCHDOG_RESET(); + + if (!((bmp->header.signature[0]=='B') && + (bmp->header.signature[1]=='M'))) { + printf ("Error: no valid bmp image at %lx\n", bmp_image); + return 1; + } + + width = le32_to_cpu (bmp->header.width); + height = le32_to_cpu (bmp->header.height); + bpp = le16_to_cpu (bmp->header.bit_count); + colors = le32_to_cpu (bmp->header.colors_used); + compression = le32_to_cpu (bmp->header.compression); + + debug ("Display-bmp: %d x %d with %d colors\n", + width, height, colors); + + if (compression!=BMP_BI_RGB) { + printf ("Error: compression type %ld not supported\n", + compression); + return 1; + } + + padded_line = (((width * bpp + 7) / 8) + 3) & ~0x3; + + if ((x + width) > VIDEO_VISIBLE_COLS) + width = VIDEO_VISIBLE_COLS - x; + if ((y + height) > VIDEO_VISIBLE_ROWS) + height = VIDEO_VISIBLE_ROWS - y; + + bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset); + fb = (uchar *)(video_fb_address + + ((y + height - 1) * VIDEO_COLS * VIDEO_PIXEL_SIZE) + + x * VIDEO_PIXEL_SIZE); + + /* We handle only 8bpp or 24 bpp bitmap */ + switch (le16_to_cpu(bmp->header.bit_count)) { + case 8: + padded_line -= width; + if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) { + /* Copy colormap */ + for (xcount = 0; xcount < colors; ++xcount) { + cte = bmp->color_table[xcount]; + video_set_lut (xcount, cte.red, cte.green, cte.blue); + } + } + ycount = height; + switch (VIDEO_DATA_FORMAT) { + case GDF__8BIT_INDEX: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + *fb ++ = *bmap ++; + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF__8BIT_332RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + cte = bmp->color_table [*bmap ++]; + FILL_8BIT_332RGB (cte.red, cte.green, cte.blue); + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_15BIT_555RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + cte = bmp->color_table [*bmap ++]; + FILL_15BIT_555RGB (cte.red, cte.green, cte.blue); + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_16BIT_565RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + cte = bmp->color_table [*bmap ++]; + FILL_16BIT_565RGB (cte.red, cte.green, cte.blue); + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_32BIT_X888RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + cte = bmp->color_table [*bmap ++]; + FILL_32BIT_X888RGB (cte.red, cte.green, cte.blue); + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_24BIT_888RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + cte = bmp->color_table [*bmap ++]; + FILL_24BIT_888RGB (cte.red, cte.green, cte.blue); + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + } + break; + case 24: + padded_line -= 3 * width; + ycount = height; + switch (VIDEO_DATA_FORMAT) { + case GDF__8BIT_332RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + FILL_8BIT_332RGB (bmap [2], bmap [1], bmap [0]); + bmap += 3; + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_15BIT_555RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + FILL_15BIT_555RGB (bmap [2], bmap [1], bmap [0]); + bmap += 3; + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_16BIT_565RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + FILL_16BIT_565RGB (bmap [2], bmap [1], bmap [0]); + bmap += 3; + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_32BIT_X888RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + FILL_32BIT_X888RGB (bmap [2], bmap [1], bmap [0]); + bmap += 3; + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + case GDF_24BIT_888RGB: + while (ycount--) { + WATCHDOG_RESET(); + xcount = width; + while (xcount --) { + FILL_24BIT_888RGB (bmap [2], bmap [1], bmap [0]); + bmap += 3; + } + bmap += padded_line; + fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE; + } + break; + default : + printf ("Error: 24 bits/pixel bitmap incompatible with current video mode\n"); + break; + } + break; + default: + printf ("Error: %d bit/pixel bitmaps not supported by U-Boot\n", + le16_to_cpu(bmp->header.bit_count)); + break; + } + return (0); +} +#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */ + +/*****************************************************************************/ + #ifdef CONFIG_VIDEO_LOGO void logo_plot (void *screen, int width, int x, int y) { @@ -792,6 +1059,20 @@ char info[128]; extern char version_string; +#ifdef CONFIG_SPLASH_SCREEN + char *s; + ulong addr; + + if ((s = getenv("splashimage")) != NULL) { + addr = simple_strtoul(s, NULL, 16); + + if (video_display_bitmap (addr, 0, 0) == 0) { + return ((void *)(video_fb_address)); + } + } +#endif /* CONFIG_SPLASH_SCREEN */ + + logo_plot (video_fb_address, VIDEO_COLS, 0, 0); sprintf(info, " %s", &version_string); diff -Naur u-boot/include/configs/IceCube.h u-boot-paub/include/configs/IceCube.h --- u-boot/include/configs/IceCube.h 2004-02-27 09:20:55.000000000 +0100 +++ u-boot-paub/include/configs/IceCube.h 2004-03-11 17:42:57.000000000 +0100 @@ -50,6 +50,24 @@ #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } +/* Video config - use SMI LynxEM+ evaluation board on PCI */ +#if 1 +#define CONFIG_VIDEO +#define CONFIG_CFB_CONSOLE +#define VIDEO_KBD_INIT_FCT (simple_strtol (getenv("console"), NULL, 10)) +#define VIDEO_TSTC_FCT serial_tstc +#define VIDEO_GETC_FCT serial_getc + +#define CONFIG_VIDEO_SMI_LYNXEM + +#define CONFIG_VIDEO_LOGO +#define CONFIG_VIDEO_BMP_LOGO +#undef CONFIG_CONSOLE_EXTRA_INFO + +#define CONFIG_SPLASH_SCREEN +#define CFG_CONSOLE_IS_IN_ENV +#endif + #ifdef CONFIG_MPC5200 /* MPC5100 PCI is not supported yet. */ /* * PCI Mapping: @@ -68,6 +86,9 @@ #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS #define CONFIG_PCI_IO_SIZE 0x01000000 +/* IO access for the LynxEM+ */ +#define CFG_ISA_IO (pci_mem_base + CONFIG_PCI_IO_BUS - CONFIG_PCI_MEM_BUS) + #define CONFIG_NET_MULTI 1 #define CONFIG_EEPRO100 1 #define CFG_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */ @@ -89,7 +110,6 @@ #if 1 #define CONFIG_USB_OHCI #define ADD_USB_CMD CFG_CMD_USB | CFG_CMD_FAT -#define CONFIG_DOS_PARTITION #define CONFIG_USB_STORAGE #else #define ADD_USB_CMD 0 @@ -103,6 +123,7 @@ CFG_CMD_FAT | \ CFG_CMD_I2C | \ CFG_CMD_IDE | \ + CFG_CMD_BMP | \ ADD_PCI_CMD | \ ADD_USB_CMD) @@ -183,7 +204,7 @@ #define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x30000 + 0x800000) #endif #if defined(CFG_LOWBOOT16) -#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x30000) +#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x80000) #endif #endif /* CFG_LOWBOOT */ #define CFG_MAX_FLASH_BANKS 2 /* max num of memory banks */