Newer
Older
while ((res =
xyzModem_stream_read (ymodemBuf, 1024, &err)) > 0) {
store_addr = addr + offset;
size += res;
addr += res;
#ifndef CFG_NO_FLASH
if (addr2info (store_addr)) {
int rc;
rc = flash_write ((char *) ymodemBuf,
store_addr, res);
if (rc != 0) {
flash_perror (rc);
return (~0);
}
} else
{
memcpy ((char *) (store_addr), ymodemBuf,
res);
}
}
} else {
printf ("%s\n", xyzModem_error (err));
xyzModem_stream_close (&err);
xyzModem_stream_terminate (false, &getcxmodem);
flush_cache (offset, size);
printf ("## Total Size = 0x%08x = %d Bytes\n", size, size);
sprintf (buf, "%X", size);
setenv ("filesize", buf);
return offset;
}
#endif /* CFG_CMD_LOADB */
/* -------------------------------------------------------------------- */
Jon Loeliger
committed
#if (CONFIG_COMMANDS & CFG_CMD_LOADS) || defined(CONFIG_CMD_LOADS)
U_BOOT_CMD(
loads, 3, 0, do_load_serial,
"loads - load S-Record file over serial line\n",
"[ off ] [ baud ]\n"
" - load S-Record file over serial line"
" with offset 'off' and baudrate 'baud'\n"
);
#else /* ! CFG_LOADS_BAUD_CHANGE */
U_BOOT_CMD(
loads, 2, 0, do_load_serial,
"loads - load S-Record file over serial line\n",
"[ off ]\n"
" - load S-Record file over serial line with offset 'off'\n"
);
#endif /* CFG_LOADS_BAUD_CHANGE */
/*
* SAVES always requires LOADS support, but not vice versa
*/
Jon Loeliger
committed
#if (CONFIG_COMMANDS & CFG_CMD_SAVES) || defined(CONFIG_CMD_SAVES)
U_BOOT_CMD(
saves, 4, 0, do_save_serial,
"saves - save S-Record file over serial line\n",
"[ off ] [size] [ baud ]\n"
" - save S-Record file over serial line"
" with offset 'off', size 'size' and baudrate 'baud'\n"
);
#else /* ! CFG_LOADS_BAUD_CHANGE */
U_BOOT_CMD(
saves, 3, 0, do_save_serial,
"saves - save S-Record file over serial line\n",
"[ off ] [size]\n"
" - save S-Record file over serial line with offset 'off' and size 'size'\n"
);
#endif /* CFG_LOADS_BAUD_CHANGE */
#endif /* CFG_CMD_SAVES */
#endif /* CFG_CMD_LOADS */
Jon Loeliger
committed
#if (CONFIG_COMMANDS & CFG_CMD_LOADB) || defined(CONFIG_CMD_LOADB)
U_BOOT_CMD(
loadb, 3, 0, do_load_serial_bin,
"loadb - load binary file over serial line (kermit mode)\n",
"[ off ] [ baud ]\n"
" - load binary file over serial line"
" with offset 'off' and baudrate 'baud'\n"
);
U_BOOT_CMD(
loady, 3, 0, do_load_serial_bin,
"loady - load binary file over serial line (ymodem mode)\n",
"[ off ] [ baud ]\n"
" - load binary file over serial line"
" with offset 'off' and baudrate 'baud'\n"
);
#endif /* CFG_CMD_LOADB */
/* -------------------------------------------------------------------- */
Jon Loeliger
committed
#if (CONFIG_COMMANDS & CFG_CMD_HWFLOW) || defined(CONFIG_CMD_HWFLOW)
int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
extern int hwflow_onoff(int);
if (argc == 2) {
if (strcmp(argv[1], "off") == 0)
hwflow_onoff(-1);
else
if (strcmp(argv[1], "on") == 0)
hwflow_onoff(1);
else
printf("Usage: %s\n", cmdtp->usage);
}
printf("RTS/CTS hardware flow control: %s\n", hwflow_onoff(0) ? "on" : "off");
return 0;
}
/* -------------------------------------------------------------------- */
"[on|off]\n - change RTS/CTS hardware flow control over serial line\n"