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