if (mmc_legacy_init(dev) != 0) {
puts("No MMC card found\n");
- return 1;
+ return CMD_RET_FAILURE;
}
curr_device = dev;
if (argc == 2) {
if (curr_device < 0) {
puts("No MMC device available\n");
- return 1;
+ return CMD_RET_FAILURE;
}
} else if (argc == 3) {
dev = (int)simple_strtoul(argv[2], NULL, 10);
#ifdef CONFIG_SYS_MMC_SET_DEV
if (mmc_set_dev(dev) != 0)
- return 1;
+ return CMD_RET_FAILURE;
#endif
curr_device = dev;
} else {
return CMD_RET_USAGE;
}
- return 0;
+ return CMD_RET_SUCCESS;
}
U_BOOT_CMD(
curr_device = 0;
else {
puts("No MMC device available\n");
- return 1;
+ return CMD_RET_FAILURE;
}
}
mmc_init(mmc);
print_mmcinfo(mmc);
- return 0;
+ return CMD_RET_SUCCESS;
} else {
printf("no mmc device at slot %x\n", curr_device);
- return 1;
+ return CMD_RET_FAILURE;
}
}
err = mmc_boot_part_access(mmc, ack, part_num, access);
if ((err == 0) && (access != 0)) {
- printf("\t\t\t!!!Notice!!!\n");
+ printf("Notice!\n");
- printf("!You must close EMMC boot Partition");
- printf("after all images are written\n");
-
- printf("!EMMC boot partition has continuity");
- printf("at image writing time.\n");
-
- printf("!So, do not close the boot partition");
- printf("before all images are written.\n");
- return 0;
+ printf("You must close EMMC boot Partition after all images are written\n");
+ printf("EMMC boot partition has continuity at image writing time.\n");
+ printf("So, do not close the boot partition before all images are written.\n");
+ return CMD_RET_SUCCESS;
} else if ((err == 0) && (access == 0))
- return 0;
+ return CMD_RET_SUCCESS;
else if ((err != 0) && (access != 0)) {
printf("EMMC boot partition-%d OPEN Failed.\n", part_num);
- return 1;
+ return CMD_RET_FAILURE;
} else {
printf("EMMC boot partition-%d CLOSE Failed.\n", part_num);
- return 1;
+ return CMD_RET_FAILURE;
}
}
#endif
curr_device = 0;
else {
puts("No MMC device available\n");
- return 1;
+ return CMD_RET_FAILURE;
}
}
mmc = find_mmc_device(curr_device);
if (!mmc) {
printf("no mmc device at slot %x\n", curr_device);
- return 1;
+ return CMD_RET_FAILURE;
}
mmc->has_init = 0;
if (mmc_init(mmc))
- return 1;
+ return CMD_RET_FAILURE;
else
- return 0;
+ return CMD_RET_SUCCESS;
} else if (strncmp(argv[1], "part", 4) == 0) {
block_dev_desc_t *mmc_dev;
struct mmc *mmc;
mmc = find_mmc_device(curr_device);
if (!mmc) {
printf("no mmc device at slot %x\n", curr_device);
- return 1;
+ return CMD_RET_FAILURE;
}
mmc_init(mmc);
mmc_dev = mmc_get_dev(curr_device);
if (mmc_dev != NULL &&
mmc_dev->type != DEV_TYPE_UNKNOWN) {
print_part(mmc_dev);
- return 0;
+ return CMD_RET_SUCCESS;
}
puts("get mmc type error!\n");
- return 1;
+ return CMD_RET_FAILURE;
} else if (strcmp(argv[1], "list") == 0) {
if (argc != 2)
return CMD_RET_USAGE;
print_mmc_devices('\n');
- return 0;
+ return CMD_RET_SUCCESS;
} else if (strcmp(argv[1], "dev") == 0) {
int dev, part = -1;
struct mmc *mmc;
if (part > PART_ACCESS_MASK) {
printf("#part_num shouldn't be larger"
" than %d\n", PART_ACCESS_MASK);
- return 1;
+ return CMD_RET_FAILURE;
}
} else
return CMD_RET_USAGE;
mmc = find_mmc_device(dev);
if (!mmc) {
printf("no mmc device at slot %x\n", dev);
- return 1;
+ return CMD_RET_FAILURE;
}
mmc_init(mmc);
int ret;
if (mmc->part_config == MMCPART_NOAVAILABLE) {
printf("Card doesn't support part_switch\n");
- return 1;
+ return CMD_RET_FAILURE;
}
if (part != mmc->part_num) {
printf("mmc%d(part %d) is current device\n",
curr_device, mmc->part_num);
- return 0;
+ return CMD_RET_SUCCESS;
#ifdef CONFIG_SUPPORT_EMMC_BOOT
} else if ((strcmp(argv[1], "open") == 0) ||
(strcmp(argv[1], "close") == 0)) {
mmc = find_mmc_device(dev);
if (!mmc) {
printf("no mmc device at slot %x\n", dev);
- return 1;
+ return CMD_RET_FAILURE;
}
if (IS_SD(mmc)) {
printf("SD device cannot be opened/closed\n");
- return 1;
+ return CMD_RET_FAILURE;
}
if ((part_num <= 0) || (part_num > MMC_NUM_BOOT_PARTITION)) {
printf("Invalid boot partition number:\n");
printf("Boot partition number cannot be <= 0\n");
printf("EMMC44 supports only 2 boot partitions\n");
- return 1;
+ return CMD_RET_FAILURE;
}
if (strcmp(argv[1], "open") == 0)
} else if (strcmp(argv[1], "bootpart") == 0) {
int dev;
+
+ if (argc != 5)
+ return CMD_RET_USAGE;
+
dev = simple_strtoul(argv[2], NULL, 10);
u32 bootsize = simple_strtoul(argv[3], NULL, 10);
struct mmc *mmc = find_mmc_device(dev);
if (!mmc) {
printf("no mmc device at slot %x\n", dev);
- return 1;
+ return CMD_RET_FAILURE;
}
if (IS_SD(mmc)) {
printf("It is not a EMMC device\n");
- return 1;
+ return CMD_RET_FAILURE;
}
if (0 == mmc_boot_partition_size_change(mmc,
bootsize, rpmbsize)) {
printf("EMMC boot partition Size %d MB\n", bootsize);
printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
- return 0;
+ return CMD_RET_SUCCESS;
} else {
printf("EMMC boot partition Size change Failed.\n");
- return 1;
+ return CMD_RET_FAILURE;
}
#endif /* CONFIG_SUPPORT_EMMC_BOOT */
}
if (!mmc) {
printf("no mmc device at slot %x\n", curr_device);
- return 1;
+ return CMD_RET_FAILURE;
}
printf("\nMMC %s: dev # %d, block # %d, count %d ... ",
if ((state == MMC_WRITE || state == MMC_ERASE)) {
if (mmc_getwp(mmc) == 1) {
printf("Error: card is write protected!\n");
- return 1;
+ return CMD_RET_FAILURE;
}
}
#endif
#endif /* CONFIG_BMP_16BPP */
+static inline bmp_color_table_entry_t *get_color_table(bmp_image_t *bmp)
+{
+ bmp_header_t *bh = &bmp->header;
+ return (void *)bmp + offsetof(bmp_header_t, size) + bh->size;
+}
+
int lcd_display_bitmap(ulong bmp_image, int x, int y)
{
#if !defined(CONFIG_MCC200)
unsigned long pwidth = panel_info.vl_col;
unsigned long long colors;
unsigned bpix, bmp_bpix;
+ bmp_color_table_entry_t *cte;
if (!bmp || !(bmp->header.signature[0] == 'B' &&
bmp->header.signature[1] == 'M')) {
debug("Display-bmp: %lu x %lu with %llu colors\n",
width, height, colors);
+ cte = get_color_table(bmp);
#if !defined(CONFIG_MCC200)
/* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
if (bmp_bpix == 8) {
/* Set color map */
for (i = 0; i < colors; ++i) {
- bmp_color_table_entry_t cte = bmp->color_table[i];
#if !defined(CONFIG_ATMEL_LCD)
ushort colreg =
- ( ((cte.red) << 8) & 0xf800) |
- ( ((cte.green) << 3) & 0x07e0) |
- ( ((cte.blue) >> 3) & 0x001f) ;
+ ( ((cte[i].red) << 8) & 0xf800) |
+ ( ((cte[i].green) << 3) & 0x07e0) |
+ ( ((cte[i].blue) >> 3) & 0x001f) ;
#ifdef CONFIG_SYS_INVERT_COLORS
*cmap = 0xffff - colreg;
#else
cmap++;
#endif
#else /* CONFIG_ATMEL_LCD */
- lcd_setcolreg(i, cte.red, cte.green, cte.blue);
+ lcd_setcolreg(i, cte[i].red, cte[i].green, cte[i].blue);
#endif
}
}
int i = *bmap++;
fb[3] = 0; /* T */
- fb[0] = bmp->color_table[i].blue;
- fb[1] = bmp->color_table[i].green;
- fb[2] = bmp->color_table[i].red;
+ fb[0] = cte[i].blue;
+ fb[1] = cte[i].green;
+ fb[2] = cte[i].red;
fb += sizeof(uint32_t) / sizeof(*fb);
} else if (bpix == 16) {
*(uint16_t *)fb = cmap_base[*(bmap++)];