/************************************************************* * File: mon/copy.c * Purpose: Part of core Monitor * Author: Phil Bunce (pjb@carmel.com) * Revision History: * 970304 Start of revision history * 980406 Added blksz. */ #include Optdesc copy_opts[] = { {"[-f] from to siz","copy memory"}, {"from","source of copy"}, {"to","destination of copy"}, {"cnt","copy cnt bytes"}, {"-f","write to flash"}, {0}}; /************************************************************* * copy(ac,av) * the 'copy' command */ copy(ac,av) int ac; char *av[]; { ADDR from, to; int i,fflag,blksz,n; char buf[100]; U64 rv; if (!regChain) { printf("Target Description Driver not loaded\n"); return(1); } fflag = 0; for (i=1;ise; /* 980406 */ if (to&(blksz-1)) { printf("error: flash write must start on a %dKB boundary.\n", blksz/1024); return(1); } while(n-- > 0) writeFlash(to++, read_target(XT_MEM,from++,1)); return(0); #else printf("write to NVRAM not supported with this configuration.\n"); return(1); #endif } if (to < from) while(n-- > 0) write_target(XT_MEM,to++, read_target(XT_MEM,from++,1),1); else for (from += n,to += n;n-- > 0;) write_target(XT_MEM,--to, read_target(XT_MEM,--from,1),1); return(0); }