]> git.ipfire.org Git - thirdparty/u-boot.git/blame - cmd/bmp.c
mmc: sdhci: Correct ADMA_DESC_LEN to 12
[thirdparty/u-boot.git] / cmd / bmp.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
059ae173
WD
2/*
3 * (C) Copyright 2002
b37c7e5e 4 * Detlev Zundel, DENX Software Engineering, dzu@denx.de.
059ae173
WD
5 */
6
7/*
8 * BMP handling routines
9 */
10
11#include <common.h>
059ae173 12#include <command.h>
8e8ccfe1 13#include <image.h>
72b335e9 14#include <mapmem.h>
ff8fb56b 15#include <splash.h>
f674f7cf 16#include <video.h>
58182b2d 17#include <stdlib.h>
43ef1c38 18
09140113
SG
19static int do_bmp_info(struct cmd_tbl *cmdtp, int flag, int argc,
20 char *const argv[])
9acd4f0e
FM
21{
22 ulong addr;
43ef1c38 23
9acd4f0e 24 switch (argc) {
bb872dd9
SG
25 case 1: /* use image_load_addr as default address */
26 addr = image_load_addr;
9acd4f0e
FM
27 break;
28 case 2: /* use argument */
7e5f460e 29 addr = hextoul(argv[1], NULL);
9acd4f0e
FM
30 break;
31 default:
4c12eeb8 32 return CMD_RET_USAGE;
9acd4f0e
FM
33 }
34
35 return (bmp_info(addr));
36}
37
09140113
SG
38static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc,
39 char *const argv[])
059ae173
WD
40{
41 ulong addr;
4b248f3f 42 int x = 0, y = 0;
059ae173 43
ff8fb56b
AG
44 splash_get_pos(&x, &y);
45
059ae173 46 switch (argc) {
bb872dd9
SG
47 case 1: /* use image_load_addr as default address */
48 addr = image_load_addr;
059ae173 49 break;
9acd4f0e 50 case 2: /* use argument */
7e5f460e 51 addr = hextoul(argv[1], NULL);
059ae173 52 break;
9acd4f0e 53 case 4:
7e5f460e 54 addr = hextoul(argv[1], NULL);
b0fcedb7
PD
55 if (!strcmp(argv[2], "m"))
56 x = BMP_ALIGN_CENTER;
57 else
0b1284eb 58 x = dectoul(argv[2], NULL);
b0fcedb7
PD
59 if (!strcmp(argv[3], "m"))
60 y = BMP_ALIGN_CENTER;
61 else
0b1284eb 62 y = dectoul(argv[3], NULL);
93e14596 63 break;
059ae173 64 default:
4c12eeb8 65 return CMD_RET_USAGE;
059ae173
WD
66 }
67
58182b2d 68 return (bmp_display(addr, x, y));
9acd4f0e
FM
69}
70
09140113 71static struct cmd_tbl cmd_bmp_sub[] = {
9acd4f0e
FM
72 U_BOOT_CMD_MKENT(info, 3, 0, do_bmp_info, "", ""),
73 U_BOOT_CMD_MKENT(display, 5, 0, do_bmp_display, "", ""),
74};
75
09140113 76static int do_bmp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
9acd4f0e 77{
09140113 78 struct cmd_tbl *c;
9acd4f0e
FM
79
80 /* Strip off leading 'bmp' command argument */
81 argc--;
82 argv++;
83
84 c = find_cmd_tbl(argv[0], &cmd_bmp_sub[0], ARRAY_SIZE(cmd_bmp_sub));
85
47e26b1b 86 if (c)
9acd4f0e 87 return c->cmd(cmdtp, flag, argc, argv);
47e26b1b 88 else
4c12eeb8 89 return CMD_RET_USAGE;
059ae173
WD
90}
91
0d498393 92U_BOOT_CMD(
4b248f3f 93 bmp, 5, 1, do_bmp,
2fb2604d 94 "manipulate BMP image data",
4b248f3f 95 "info <imageAddr> - display image info\n"
a89c33db 96 "bmp display <imageAddr> [x y] - display image at x,y"
b0fce99b 97);