static int video_show_board_logo_info(void) { ulong dram_size, nand_size; int i; u32 len = 0; char buf[255]; char *corp = "2017 Microchip Technology Inc.\n"; char temp[32]; struct udevice *dev, *con; const char *s; vidinfo_t logo_info; int ret; get_microchip_logo_info(&logo_info); len += sprintf(&buf[len], "%s\n", U_BOOT_VERSION); memcpy(&buf[len], corp, strlen(corp)); len += strlen(corp); len += sprintf(&buf[len], "%s CPU at %s MHz\n", get_cpu_name(), strmhz(temp, get_cpu_clk_rate())); dram_size = 0; for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) dram_size += gd->bd->bi_dram[i].size; nand_size = 0; #ifdef CONFIG_NAND_ATMEL for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) nand_size += nand_info[i]->size; #endif len += sprintf(&buf[len], "%ld MB SDRAM, %ld MB NAND\n", dram_size >> 20, nand_size >> 20); ret = uclass_get_device(UCLASS_VIDEO, 0, &dev); if (ret) return ret; ret = video_bmp_display(dev, logo_info.logo_addr, logo_info.logo_x_offset, logo_info.logo_y_offset, false); if (ret) return ret; ret = uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con); if (ret) return ret; vidconsole_position_cursor(con, 0, logo_info.logo_height); for (s = buf, i = 0; i < len; s++, i++) vidconsole_put_char(con, *s); return 0; }
/* Test drawing a compressed bitmap file */ static int dm_test_video_bmp_comp(struct unit_test_state *uts) { struct udevice *dev; ulong addr; ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(read_file(uts, "tools/logos/denx-comp.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(1368, compress_frame_buffer(dev)); return 0; }
/* * Subroutine: bmp_display * * Description: Display bmp file located in memory * * Inputs: addr address of the bmp file * * Return: None * */ int bmp_display(ulong addr, int x, int y) { #ifdef CONFIG_DM_VIDEO struct udevice *dev; #endif int ret; struct bmp_image *bmp = map_sysmem(addr, 0); void *bmp_alloc_addr = NULL; unsigned long len; if (!((bmp->header.signature[0]=='B') && (bmp->header.signature[1]=='M'))) bmp = gunzip_bmp(addr, &len, &bmp_alloc_addr); if (!bmp) { printf("There is no valid bmp file at the given address\n"); return 1; } addr = map_to_sysmem(bmp); #ifdef CONFIG_DM_VIDEO ret = uclass_first_device(UCLASS_VIDEO, &dev); if (!ret) { if (!dev) ret = -ENODEV; if (!ret) { bool align = false; # ifdef CONFIG_SPLASH_SCREEN_ALIGN align = true; # endif /* CONFIG_SPLASH_SCREEN_ALIGN */ ret = video_bmp_display(dev, addr, x, y, align); } } #elif defined(CONFIG_LCD) ret = lcd_display_bitmap(addr, x, y); #elif defined(CONFIG_VIDEO) ret = video_display_bitmap(addr, x, y); #else # error bmp_display() requires CONFIG_LCD or CONFIG_VIDEO #endif if (bmp_alloc_addr) free(bmp_alloc_addr); return ret ? CMD_RET_FAILURE : 0; }