changeset 64:a481d648278a

fc-loadtool: "quick program" command implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 28 Jun 2013 04:49:09 +0000
parents cc1d2413991a
children a7da6648a7f8
files loadtools/ltflash.c
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/ltflash.c	Thu Jun 27 23:22:25 2013 +0000
+++ b/loadtools/ltflash.c	Fri Jun 28 04:49:09 2013 +0000
@@ -247,6 +247,40 @@
 	return(0);
 }
 
+flashcmd_quickprog(argc, argv, bank)
+	char **argv;
+{
+	char *targv[4], targ_base[10];
+	int stat;
+
+	if (argc != 4) {
+inv:		fprintf(stderr, "usage: %s %s hex-offset hex-data-string\n",
+			argv[0], argv[1]);
+		return(-1);
+	}
+	sprintf(targ_base, "%lx", (u_long) flash_bank_info[bank].base_addr);
+	targv[0] = "AMFB";
+	targv[1] = targ_base;
+	targv[2] = 0;
+	tpinterf_make_cmd(targv);
+	if (tpinterf_send_cmd() < 0)
+		return(-1);
+	stat = tpinterf_pass_output(1);
+	if (stat)
+		return(stat);
+	targv[0] = "AMFW";
+	targv[1] = argv[2];
+	targv[2] = argv[3];
+	targv[3] = 0;
+	if (tpinterf_make_cmd(targv) < 0) {
+		fprintf(stderr, "error: unable to form AMFW target command\n");
+		return(-1);
+	}
+	if (tpinterf_send_cmd() < 0)
+		return(-1);
+	return tpinterf_pass_output(1);
+}
+
 extern int flashcmd_erase();
 extern int flashcmd_sectors();
 
@@ -259,6 +293,7 @@
 	{"dump2srec", flashcmd_dump2file},
 	{"erase", flashcmd_erase},
 	{"info", flashcmd_info},
+	{"quickprog", flashcmd_quickprog},
 	{"sectors", flashcmd_sectors},
 	{0, 0}
 };