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