Index: main.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/main.c,v retrieving revision 1.24 diff -b -p -r1.24 main.c *** main.c 2001/09/12 04:21:16 1.24 --- main.c 2001/10/17 13:53:02 *************** RedBoot_cmd("dump", *** 90,95 **** --- 90,110 ---- "-b [-l ]", do_dump ); + RedBoot_cmd("dumpl", + "Display (hex dump) a range of memory", + "-b [-l ]", + do_dumpl + ); + RedBoot_cmd("edit", + "Edit the contents of memory", + "-b -v [-s ]", + do_edit + ); + RedBoot_cmd("fill", + "Fill the contents of memory", + "-b -l -v ", + do_fill + ); RedBoot_cmd("cksum", "Compute a 32bit checksum [POSIX algorithm] for a range of memory", "-b -l ", *************** do_dump(int argc, char *argv[]) *** 428,433 **** --- 443,559 ---- diag_dump_buf((void *)base, len); _base = base + len; _len = len; + } + + void + do_dumpl(int argc, char *argv[]) + { + struct option_info opts[2]; + unsigned long base, len; + bool base_set, len_set; + static unsigned long _base, _len; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base, (bool *)&base_set, "base address"); + init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, + (void **)&len, (bool *)&len_set, "length"); + if (!scan_opts(argc, argv, 1, opts, 2, 0, 0, "")) { + return; + } + if (!base_set) { + if (_base == 0) { + diag_printf("Dump what [location]?\n"); + return; + } + base = _base; + if (!len_set) { + len = _len; + len_set = true; + } + } + if (!len_set) { + len = 32; + } + diag_dump_buf_long((void *)base, len); + _base = base + len; + _len = len; + } + + void + do_edit(int argc, char *argv[]) + { + struct option_info opts[3]; + unsigned long base, value, size; + bool base_set, value_set, size_set; + static unsigned long _base; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base, (bool *)&base_set, "base address"); + init_opts(&opts[1], 'v', true, OPTION_ARG_TYPE_NUM, + (void **)&value, (bool *)&value_set, "value"); + init_opts(&opts[2], 's', true, OPTION_ARG_TYPE_NUM, + (void **)&size, (bool *)&size_set, "size"); + if (!scan_opts(argc, argv, 1, opts, 3, 0, 0, "")) { + return; + } + + if (!base_set) { + if (_base == 0) { + diag_printf("Edit what [location]?\n"); + return; + } + base = _base; + } + + if (!value_set) { + diag_printf("Edit what [value]?\n"); + return; + } + if (!size_set) { + size = 4; + } + + diag_edit((void*)base, value, size); + _base += size; + } + + void + do_fill(int argc, char *argv[]) + { + struct option_info opts[3]; + unsigned long base, len, value; + bool base_set, len_set, value_set; + unsigned long i; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base, (bool *)&base_set, "base address"); + init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, + (void **)&len, (bool *)&len_set, "length"); + init_opts(&opts[2], 'v', true, OPTION_ARG_TYPE_NUM, + (void **)&value, (bool *)&value_set, "value"); + if (!scan_opts(argc, argv, 1, opts, 3, 0, 0, "")) { + return; + } + + if (!base_set) { + diag_printf("Fill what [location]?\n"); + return; + } + + if (!len_set) { + diag_printf("Fill what [length]?\n"); + return; + } + + if (!value_set) { + diag_printf("Fill what [value]?\n"); + return; + } + + for ( i = 0; i < len; i++ ) { + diag_edit((void*)base, value, 4); + base += sizeof(long); + } } void