X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Fload.c;h=fab30fe894318a9308bc7cb41e948b9b6d229879;hb=9b2e892eb6e30913ee8ca95f1a360d61785d0912;hp=4597ec5618da2df839af0703541f3ce6087a7bb0;hpb=a8d052b5004b3180b9d28567922acd1b62f9cb15;p=oweals%2Fu-boot.git diff --git a/cmd/load.c b/cmd/load.c index 4597ec5618..fab30fe894 100644 --- a/cmd/load.c +++ b/cmd/load.c @@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2000-2004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -11,9 +10,14 @@ #include #include #include +#include +#include +#include +#include #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -50,11 +54,11 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc, load_baudrate = current_baudrate = gd->baudrate; #endif - if (((env_echo = getenv("loads_echo")) != NULL) && (*env_echo == '1')) { + env_echo = env_get("loads_echo"); + if (env_echo && *env_echo == '1') do_echo = 1; - } else { + else do_echo = 0; - } #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE if (argc >= 2) { @@ -106,7 +110,7 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc, rcode = 1; } else { printf("## Start Addr = 0x%08lX\n", addr); - load_addr = addr; + image_load_addr = addr; } #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE @@ -182,7 +186,7 @@ static ulong load_serial(long offset) start_addr, end_addr, size, size ); flush_cache(start_addr, size); - setenv_hex("filesize", size); + env_set_hex("filesize", size); return (addr); case SREC_START: break; @@ -427,9 +431,9 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc, offset = CONFIG_SYS_LOAD_ADDR; /* pre-set offset from $loadaddr */ - if ((s = getenv("loadaddr")) != NULL) { + s = env_get("loadaddr"); + if (s) offset = simple_strtoul(s, NULL, 16); - } load_baudrate = current_baudrate = gd->baudrate; @@ -482,12 +486,12 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc, addr = load_serial_bin(offset); if (addr == ~0) { - load_addr = 0; + image_load_addr = 0; printf("## Binary (kermit) download aborted\n"); rcode = 1; } else { printf("## Start Addr = 0x%08lX\n", addr); - load_addr = addr; + image_load_addr = addr; } } if (load_baudrate != current_baudrate) { @@ -529,7 +533,7 @@ static ulong load_serial_bin(ulong offset) flush_cache(offset, size); printf("## Total Size = 0x%08x = %d Bytes\n", size, size); - setenv_hex("filesize", size); + env_set_hex("filesize", size); return offset; } @@ -978,7 +982,7 @@ static ulong load_serial_ymodem(ulong offset, int mode) rc = flash_write((char *) ymodemBuf, store_addr, res); if (rc != 0) { - flash_perror (rc); + flash_perror(rc); return (~0); } } else @@ -1000,7 +1004,7 @@ static ulong load_serial_ymodem(ulong offset, int mode) flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN)); printf("## Total Size = 0x%08x = %d Bytes\n", size, size); - setenv_hex("filesize", size); + env_set_hex("filesize", size); return offset; }