Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6705AC74A5B for ; Wed, 29 Mar 2023 10:33:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BCC9685D62; Wed, 29 Mar 2023 12:32:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="oO34QgP0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5A51586009; Wed, 29 Mar 2023 12:31:03 +0200 (CEST) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6C27E85E30 for ; Wed, 29 Mar 2023 12:30:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=n-jain1@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 32TAUZWK053174; Wed, 29 Mar 2023 05:30:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1680085835; bh=RkhXpmvG1RFI777tUp0V3Or7OH8IFMMgshlaPfnEAgo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oO34QgP0w77Jmw0nsdpQzS36hz+F1YEa9DpimK7Nx+aefETiF8s324HwQtGbdRzIV lLBO6bsKfbG41ZPxkHJgF2bxleAy/+i80ZYe/x4ShtyYhnpQ4KwfeU6jT5pkzeGqAV nBBRvYhgnsaXcKexeCKTAc0IFdpAx+I5cjLYZu4U= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 32TAUYHN050137 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 29 Mar 2023 05:30:34 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Wed, 29 Mar 2023 05:30:34 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Wed, 29 Mar 2023 05:30:34 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 32TAUXQ3061189; Wed, 29 Mar 2023 05:30:34 -0500 From: Nikhil M Jain To: , , CC: , , , Subject: [PATCH v3 08/15] cmd: bmp: Split bmp commands and functions Date: Wed, 29 Mar 2023 16:00:09 +0530 Message-ID: <20230329103016.69430-9-n-jain1@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230329103016.69430-1-n-jain1@ti.com> References: <20230329103016.69430-1-n-jain1@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean To enable splash screen at spl, need to compile cmd/bmp.c which also includes bmp commands, since SPL can't have commands split bmp.c into common/bmp.c which includes all bmp functions and cmd/bmp_cmd contains bmp commands. Add delclaration for bmp_info in video.h. Signed-off-by: Nikhil M Jain --- cmd/bmp_cmd.c | 98 +++++++++++++++++++++++++++++++++++++++ {cmd => common}/bmp.c | 104 +----------------------------------------- include/video.h | 7 +++ 3 files changed, 106 insertions(+), 103 deletions(-) create mode 100644 cmd/bmp_cmd.c rename {cmd => common}/bmp.c (62%) diff --git a/cmd/bmp_cmd.c b/cmd/bmp_cmd.c new file mode 100644 index 0000000000..735790fda7 --- /dev/null +++ b/cmd/bmp_cmd.c @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2002 + * Detlev Zundel, DENX Software Engineering, dzu@denx.de. + */ + +/* + * BMP handling routines + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +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 - display image info\n" + "bmp display [x y] - display image at x,y" +); diff --git a/cmd/bmp.c b/common/bmp.c similarity index 62% rename from cmd/bmp.c rename to common/bmp.c index 46d0d916e8..540d06e63f 100644 --- a/cmd/bmp.c +++ b/common/bmp.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -21,8 +20,6 @@ #include #include -static int bmp_info (ulong addr); - /* * Allocate and decompress a BMP image using gunzip(). * @@ -88,62 +85,6 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, } #endif -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, "", ""), -}; #ifdef CONFIG_NEEDS_MANUAL_RELOC void bmp_reloc(void) { @@ -151,50 +92,7 @@ void bmp_reloc(void) { } #endif -/* - * Subroutine: do_bmp - * - * Description: Handler for 'bmp' command.. - * - * Inputs: argv[1] contains the subcommand - * - * Return: None - * - */ -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 - display image info\n" - "bmp display [x y] - display image at x,y" -); - -/* - * Subroutine: bmp_info - * - * Description: Show information about bmp file in memory - * - * Inputs: addr address of the bmp file - * - * Return: None - * - */ -static int bmp_info(ulong addr) +int bmp_info(ulong addr) { struct bmp_image *bmp = (struct bmp_image *)map_sysmem(addr, 0); void *bmp_alloc_addr = NULL; diff --git a/include/video.h b/include/video.h index 3f67a93bc9..4b7e866c65 100644 --- a/include/video.h +++ b/include/video.h @@ -355,4 +355,11 @@ void *video_get_u_boot_logo(void); */ int bmp_display(ulong addr, int x, int y); +/* + * bmp_info() - Show information about bmp file + * + * @addr: address of bmp file + */ +int bmp_info(ulong addr); + #endif -- 2.34.1