diff target-utils/dspdump/mandump.c @ 540:27b5526ba1a8

dspdump target program written, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Oct 2019 08:19:33 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/dspdump/mandump.c	Mon Oct 28 08:19:33 2019 +0000
@@ -0,0 +1,42 @@
+/* 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++);
+}