Commit 6e66bd55917bee1a37ae6387ae1d480aaad0102d

Authored by Angus Ainslie
Committed by Tom Rini
1 parent 120694bd71

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>

Showing 1 changed file with 20 additions and 4 deletions Side-by-side Diff

... ... @@ -18,7 +18,7 @@
18 18 DECLARE_GLOBAL_DATA_PTR;
19 19  
20 20 #if defined(CONFIG_CMD_LOADB)
21   -static ulong load_serial_ymodem(ulong offset);
  21 +static ulong load_serial_ymodem(ulong offset, int mode);
22 22 #endif
23 23  
24 24 #if defined(CONFIG_CMD_LOADS)
25 25  
... ... @@ -462,8 +462,16 @@
462 462 offset,
463 463 load_baudrate);
464 464  
465   - addr = load_serial_ymodem(offset);
  465 + addr = load_serial_ymodem(offset, xyzModem_ymodem);
466 466  
  467 + } else if (strcmp(argv[0],"loadx")==0) {
  468 + printf("## Ready for binary (xmodem) download "
  469 + "to 0x%08lX at %d bps...\n",
  470 + offset,
  471 + load_baudrate);
  472 +
  473 + addr = load_serial_ymodem(offset, xyzModem_xmodem);
  474 +
467 475 } else {
468 476  
469 477 printf("## Ready for binary (kermit) download "
... ... @@ -942,7 +950,7 @@
942 950 return (getc());
943 951 return -1;
944 952 }
945   -static ulong load_serial_ymodem(ulong offset)
  953 +static ulong load_serial_ymodem(ulong offset, int mode)
946 954 {
947 955 int size;
948 956 int err;
... ... @@ -953,7 +961,7 @@
953 961 ulong addr = 0;
954 962  
955 963 size = 0;
956   - info.mode = xyzModem_ymodem;
  964 + info.mode = mode;
957 965 res = xyzModem_stream_open(&info, &err);
958 966 if (!res) {
959 967  
... ... @@ -1050,6 +1058,14 @@
1050 1058 U_BOOT_CMD(
1051 1059 loadb, 3, 0, do_load_serial_bin,
1052 1060 "load binary file over serial line (kermit mode)",
  1061 + "[ off ] [ baud ]\n"
  1062 + " - load binary file over serial line"
  1063 + " with offset 'off' and baudrate 'baud'"
  1064 +);
  1065 +
  1066 +U_BOOT_CMD(
  1067 + loadx, 3, 0, do_load_serial_bin,
  1068 + "load binary file over serial line (xmodem mode)",
1053 1069 "[ off ] [ baud ]\n"
1054 1070 " - load binary file over serial line"
1055 1071 " with offset 'off' and baudrate 'baud'"