Skip to content
Snippets Groups Projects
cmd_load.c 26.5 KiB
Newer Older
		    if (addr2info(store_addr)) {
			int rc;

			rc = flash_write((char *)ymodemBuf,store_addr,res);
			if (rc != 0) {
				flash_perror (rc);
				return (~0);
			}
		    } else
#endif
		    {
			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;
}

Wolfgang Denk's avatar
Wolfgang Denk committed
#endif	/* CFG_CMD_LOADB */

/* -------------------------------------------------------------------- */

#if (CONFIG_COMMANDS & CFG_CMD_LOADS)

#ifdef	CFG_LOADS_BAUD_CHANGE
U_BOOT_CMD(
	loads, 3, 0,	do_load_serial,
Wolfgang Denk's avatar
Wolfgang Denk committed
	"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,
Wolfgang Denk's avatar
Wolfgang Denk committed
	"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
 */


#if (CONFIG_COMMANDS & CFG_CMD_SAVES)
#ifdef	CFG_LOADS_BAUD_CHANGE
U_BOOT_CMD(
	saves, 4, 0,	do_save_serial,
Wolfgang Denk's avatar
Wolfgang Denk committed
	"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,
Wolfgang Denk's avatar
Wolfgang Denk committed
	"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 */


#if (CONFIG_COMMANDS & CFG_CMD_LOADB)
U_BOOT_CMD(
	loadb, 3, 0,	do_load_serial_bin,
Wolfgang Denk's avatar
Wolfgang Denk committed
	"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"
);

Wolfgang Denk's avatar
Wolfgang Denk committed
#endif	/* CFG_CMD_LOADB */

/* -------------------------------------------------------------------- */

#if (CONFIG_COMMANDS & CFG_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;
}

/* -------------------------------------------------------------------- */

	hwflow, 2, 0,	do_hwflow,
Wolfgang Denk's avatar
Wolfgang Denk committed
	"hwflow  - turn the harwdare flow control on/off\n",
	"[on|off]\n - change RTS/CTS hardware flow control over serial line\n"
Wolfgang Denk's avatar
Wolfgang Denk committed
);

#endif /* CFG_CMD_HWFLOW */