/*
* Serial up- and download support
*/
-#include <common.h>
#include <command.h>
#include <console.h>
#include <cpu_func.h>
} else
#endif
{
+ void *dst;
+
ret = lmb_reserve(&lmb, store_addr, binlen);
if (ret) {
printf("\nCannot overwrite reserved area (%08lx..%08lx)\n",
store_addr, store_addr + binlen);
return ret;
}
- memcpy((char *)(store_addr), binbuf, binlen);
+ dst = map_sysmem(store_addr, binlen);
+ memcpy(dst, binbuf, binlen);
+ unmap_sysmem(dst);
lmb_free(&lmb, store_addr, binlen);
}
if ((store_addr) < start_addr)
static int read_record(char *buf, ulong len)
{
char *p;
- char c;
+ int c;
--len; /* always leave room for terminating '\0' byte */
if(write_record(SREC3_START)) /* write the header */
return (-1);
do {
- if(count) { /* collect hex data in the buffer */
- c = *(volatile uchar*)(address + reclen); /* get one byte */
- checksum += c; /* accumulate checksum */
+ volatile uchar *src;
+
+ src = map_sysmem(address, count);
+ if (count) { /* collect hex data in the buffer */
+ c = src[reclen]; /* get one byte */
+ checksum += c; /* accumulate checksum */
data[2*reclen] = hex[(c>>4)&0x0f];
data[2*reclen+1] = hex[c & 0x0f];
data[2*reclen+2] = '\0';
++reclen;
--count;
}
+ unmap_sysmem((void *)src);
if(reclen == SREC_BYTES_PER_RECORD || count == 0) {
/* enough data collected for one record: dump it */
if(reclen) { /* build & write a data record: */
#endif
-
#if defined(CONFIG_CMD_LOADB)
/*
* loadb command (load binary) included
static int k_recv(void);
static ulong load_serial_bin(ulong offset);
-
static char his_eol; /* character he needs at end of packet */
static int his_pad_count; /* number of pad chars he needs */
static char his_pad_char; /* pad chars he needs */
return rcode;
}
-
static ulong load_serial_bin(ulong offset)
{
int size, i;
s1_sendpacket(a_b);
}
-
static void (*os_data_init)(void);
static void (*os_data_char)(char new_char);
static int os_data_state, os_data_state_saved;
os_data_char = bin_data_char;
}
-
/* k_data_* simply handles the kermit escape translations */
static int k_data_escape, k_data_escape_saved;
static void k_data_init(void)
/* k_recv receives a OS Open image file over kermit line */
static int k_recv(void)
{
- char new_char;
+ int new_char;
char k_state, k_state_saved;
int sum;
int done;
xyzModem_stream_terminate(false, &getcxmodem);
xyzModem_stream_close(&err);
-
flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN));
printf("## Total Size = 0x%08x = %d Bytes\n", size, size);
* SAVES always requires LOADS support, but not vice versa
*/
-
#if defined(CONFIG_CMD_SAVES)
#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
U_BOOT_CMD(
#endif /* CONFIG_CMD_SAVES */
#endif /* CONFIG_CMD_LOADS */
-
#if defined(CONFIG_CMD_LOADB)
U_BOOT_CMD(
loadb, 3, 0, do_load_serial_bin,