aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_load.c
diff options
context:
space:
mode:
authorAngus Ainslie2013-06-26 16:54:24 -0600
committerTom Rini2013-08-16 13:45:15 -0400
commit6e66bd55917bee1a37ae6387ae1d480aaad0102d (patch)
tree9ddfecdd4dd42dcab55d08c5b58505364be07abc /common/cmd_load.c
parent120694bd714498cdd6245f0deb7091db7d1cdbf3 (diff)
Enable xmodem support
This is a trivial patch that just enables xmodem downloads using the existing ymodem framework. Signed-off-by: Angus Ainslie <angus@akkea.ca>
Diffstat (limited to 'common/cmd_load.c')
-rw-r--r--common/cmd_load.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/common/cmd_load.c b/common/cmd_load.c
index 0ce949683e2..f6e522cbb34 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -18,7 +18,7 @@
DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_CMD_LOADB)
-static ulong load_serial_ymodem(ulong offset);
+static ulong load_serial_ymodem(ulong offset, int mode);
#endif
#if defined(CONFIG_CMD_LOADS)
@@ -462,7 +462,15 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
offset,
load_baudrate);
- addr = load_serial_ymodem(offset);
+ addr = load_serial_ymodem(offset, xyzModem_ymodem);
+
+ } else if (strcmp(argv[0],"loadx")==0) {
+ printf("## Ready for binary (xmodem) download "
+ "to 0x%08lX at %d bps...\n",
+ offset,
+ load_baudrate);
+
+ addr = load_serial_ymodem(offset, xyzModem_xmodem);
} else {
@@ -942,7 +950,7 @@ static int getcxmodem(void) {
return (getc());
return -1;
}
-static ulong load_serial_ymodem(ulong offset)
+static ulong load_serial_ymodem(ulong offset, int mode)
{
int size;
int err;
@@ -953,7 +961,7 @@ static ulong load_serial_ymodem(ulong offset)
ulong addr = 0;
size = 0;
- info.mode = xyzModem_ymodem;
+ info.mode = mode;
res = xyzModem_stream_open(&info, &err);
if (!res) {
@@ -1056,6 +1064,14 @@ U_BOOT_CMD(
);
U_BOOT_CMD(
+ loadx, 3, 0, do_load_serial_bin,
+ "load binary file over serial line (xmodem mode)",
+ "[ off ] [ baud ]\n"
+ " - load binary file over serial line"
+ " with offset 'off' and baudrate 'baud'"
+);
+
+U_BOOT_CMD(
loady, 3, 0, do_load_serial_bin,
"load binary file over serial line (ymodem mode)",
"[ off ] [ baud ]\n"