FreeCalypso > hg > freecalypso-tools
changeset 542:b95b251b33eb
dspdump: bigdump command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 28 Oct 2019 20:42:06 +0000 |
parents | a58563d16e1d |
children | 947c6a443a9c |
files | target-utils/dspdump/Makefile target-utils/dspdump/cmdtab.c target-utils/dspdump/dumpops.c target-utils/dspdump/mandump.c |
diffstat | 4 files changed, 100 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/target-utils/dspdump/Makefile Mon Oct 28 08:36:50 2019 +0000 +++ b/target-utils/dspdump/Makefile Mon Oct 28 20:42:06 2019 +0000 @@ -5,7 +5,7 @@ OBJCOPY=arm-elf-objcopy PROG= dspdump -OBJS= crt0.o cmdtab.o dspops.o dumpagent.o main.o mandump.o +OBJS= crt0.o cmdtab.o dspops.o dumpagent.o dumpops.o main.o LIBS= ../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a \ ../libc/libc.a LIBGCC= `${CC} -print-file-name=libgcc.a`
--- a/target-utils/dspdump/cmdtab.c Mon Oct 28 08:36:50 2019 +0000 +++ b/target-utils/dspdump/cmdtab.c Mon Oct 28 20:42:06 2019 +0000 @@ -2,6 +2,7 @@ extern void cmd_abbr(); extern void cmd_abbw(); +extern void cmd_bigdump(); extern void cmd_dump(); extern void cmd_jump(); extern void cmd_r8(); @@ -20,6 +21,7 @@ {"abbpage2", abb_unlock_page2}, {"abbr", cmd_abbr}, {"abbw", cmd_abbw}, + {"bigdump", cmd_bigdump}, {"dump", cmd_dump}, {"jump", cmd_jump}, {"poweroff", abb_power_off},
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/target-utils/dspdump/dumpops.c Mon Oct 28 20:42:06 2019 +0000 @@ -0,0 +1,97 @@ +#include <sys/types.h> +#include "types.h" +#include "leadapi.h" + +void +cmd_dump(argbulk) + char *argbulk; +{ + char *argv[4]; + u_long mode, addr, len; + int rc; + volatile u16 *api; + unsigned n; + + if (parse_args(argbulk, 3, 3, argv, 0) < 0) + return; + if (parse_hexarg(argv[0], 4, &mode) < 0) { + printf("ERROR: mode must be a valid 16-bit hex value\n"); + return; + } + if (parse_hexarg(argv[1], 8, &addr) < 0) { + printf("ERROR: addr must be a valid 32-bit hex value\n"); + return; + } + if (parse_hexarg(argv[2], 4, &len) < 0) { + printf("ERROR: len must be a valid 16-bit hex value\n"); + return; + } + rc = boot_dsp_dump_agent(); + if (rc < 0) + return; /* error msg already printed */ + rc = dsp_read_op((u16)mode, (u32)addr, (u16)len); + if (rc < 0) { + printf("ERROR: DSP timeout on read operation\n"); + return; + } + api = (volatile u16 *) APIF_ADDR; + for (n = 0; n < len; n++) + printf("%04X\n", *api++); +} + +dump_large_section(mode, addr, len) + u16 mode; + u32 addr, len; +{ + u32 chunk, remain; + volatile u16 *api; + int rc; + + for (remain = len; remain; remain -= chunk) { + chunk = remain; + if (chunk > MAX_BLOCK_SIZE) + chunk = MAX_BLOCK_SIZE; + rc = dsp_read_op(mode, addr, chunk); + if (rc < 0) { + printf("ERROR: DSP timeout on read operation\n"); + return(rc); + } + api = (volatile u16 *) APIF_ADDR; + for (; chunk; chunk--) { + if (!(addr & 0xF)) + printf("%05x : ", addr); + printf("%04x%c", *api++, ((addr&15)==15)?'\n':' '); + addr++; + } + } + putchar('\n'); + return(0); +} + +void +cmd_bigdump(argbulk) + char *argbulk; +{ + char *argv[4]; + u_long mode, addr, len; + int rc; + + if (parse_args(argbulk, 3, 3, argv, 0) < 0) + return; + if (parse_hexarg(argv[0], 4, &mode) < 0) { + printf("ERROR: mode must be a valid 16-bit hex value\n"); + return; + } + if (parse_hexarg(argv[1], 8, &addr) < 0) { + printf("ERROR: addr must be a valid 32-bit hex value\n"); + return; + } + if (parse_hexarg(argv[2], 8, &len) < 0) { + printf("ERROR: len must be a valid 32-bit hex value\n"); + return; + } + rc = boot_dsp_dump_agent(); + if (rc < 0) + return; /* error msg already printed */ + dump_large_section((u16)mode, (u32)addr, (u32)len); +}
--- a/target-utils/dspdump/mandump.c Mon Oct 28 08:36:50 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* manual dump command */ - -#include <sys/types.h> -#include "types.h" -#include "leadapi.h" - -void -cmd_dump(argbulk) - char *argbulk; -{ - char *argv[4]; - u_long mode, addr, len; - int rc; - volatile u16 *api; - unsigned n; - - if (parse_args(argbulk, 3, 3, argv, 0) < 0) - return; - if (parse_hexarg(argv[0], 4, &mode) < 0) { - printf("ERROR: mode must be a valid 16-bit hex value\n"); - return; - } - if (parse_hexarg(argv[1], 8, &addr) < 0) { - printf("ERROR: addr must be a valid 32-bit hex value\n"); - return; - } - if (parse_hexarg(argv[2], 4, &len) < 0) { - printf("ERROR: len must be a valid 16-bit hex value\n"); - return; - } - rc = boot_dsp_dump_agent(); - if (rc < 0) - return; /* error msg already printed */ - rc = dsp_read_op((u16)mode, (u32)addr, (u16)len); - if (rc < 0) { - printf("ERROR: DSP timeout on read operation\n"); - return; - } - api = (volatile u16 *) APIF_ADDR; - for (n = 0; n < len; n++) - printf("%04X\n", *api++); -}