public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/6] esd/common: extend cpld command with address parameter
@ 2009-04-29  7:50 matthias.fuchs at esd.eu
  2009-04-29  7:50 ` [U-Boot] [PATCH 2/6] 4xx: Remove binary cpld bitstream from CMS700 board matthias.fuchs at esd.eu
  2009-05-04  8:10 ` [U-Boot] [PATCH 1/6] esd/common: extend cpld command with address parameter Stefan Roese
  0 siblings, 2 replies; 7+ messages in thread
From: matthias.fuchs at esd.eu @ 2009-04-29  7:50 UTC (permalink / raw)
  To: u-boot

From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>

This patch adds support for an address parameter to esd's
cpld command. This is in preparation to remove compiled-in
binary cpld (xsvf) bitstreams.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
---
 board/esd/common/xilinx_jtag/micro.c |   24 ++++++++++++++++--------
 board/esd/common/xilinx_jtag/ports.c |   10 ++++------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/board/esd/common/xilinx_jtag/micro.c b/board/esd/common/xilinx_jtag/micro.c
index 9b2cf90..37ac0cc 100644
--- a/board/esd/common/xilinx_jtag/micro.c
+++ b/board/esd/common/xilinx_jtag/micro.c
@@ -66,10 +66,7 @@
 #include "lenval.h"
 #include "ports.h"
 
-
-extern const unsigned char fpgadata[];
-extern int filesize;
-
+const unsigned char *xsvfdata;
 
 /*============================================================================
  * XSVF #define
@@ -1838,12 +1835,23 @@ int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	unsigned long duration;
 	unsigned long long startClock, endClock;
 
+	if (argc == 2)
+		xsvfdata = (unsigned char *)simple_strtoul(argv[1], NULL, 16);
+	else {
+#ifdef CONFIG_SYS_XSVF_DEFAULT_ADDR
+		xsvfdata = (unsigned char *)CONFIG_SYS_XSVF_DEFAULT_ADDR;
+#else
+		printf("Usage:\ncpld %s\n", cmdtp->help);
+		return -1;
+#endif
+	}
+
 	iErrorCode          = XSVF_ERRORCODE( XSVF_ERROR_NONE );
 	pzXsvfFileName      = 0;
 	xsvf_iDebugLevel    = 0;
 
 	printf("XSVF Player v%s, Xilinx, Inc.\n", XSVF_VERSION);
-	printf("XSVF Filesize = %d bytes\n", filesize);
+	printf("Reading XSVF data @ %p\n", xsvfdata);
 
 	/* Initialize the I/O.  SetPort initializes I/O on first call */
 	setPort( TMS, 1 );
@@ -1858,7 +1866,7 @@ int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	return( iErrorCode );
 }
 U_BOOT_CMD(
-	cpld,	1,	1,	do_cpld,
-	"Program onboard CPLD",
-	NULL
+	cpld,	2,	1,	do_cpld,
+	"program onboard CPLD",
+	"<xsvf-addr>"
 	);
diff --git a/board/esd/common/xilinx_jtag/ports.c b/board/esd/common/xilinx_jtag/ports.c
index ac0d7ac..f039d04 100644
--- a/board/esd/common/xilinx_jtag/ports.c
+++ b/board/esd/common/xilinx_jtag/ports.c
@@ -42,9 +42,7 @@ static int oldstate = 0;
 static int newstate = 0;
 static int readptr = 0;
 
-extern long filesize;
-extern const unsigned char fpgadata[];
-
+extern const unsigned char *xsvfdata;
 
 /* if in debugging mode, then just set the variables */
 void setPort(short p,short val)
@@ -86,10 +84,10 @@ void pulseClock(void)
 void readByte(unsigned char *data)
 {
 	/* pretend reading using a file */
-	*data = fpgadata[readptr++];
-	newstate = (100 * filepos++) / filesize;
+	*data = xsvfdata[readptr++];
+	newstate = filepos++ >> 10;
 	if (newstate != oldstate) {
-		printf("%4d\r\r\r\r", newstate);
+		printf("%4d kB\r\r\r\r", newstate);
 		oldstate = newstate;
 	}
 }
-- 
1.5.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-04  8:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-29  7:50 [U-Boot] [PATCH 1/6] esd/common: extend cpld command with address parameter matthias.fuchs at esd.eu
2009-04-29  7:50 ` [U-Boot] [PATCH 2/6] 4xx: Remove binary cpld bitstream from CMS700 board matthias.fuchs at esd.eu
2009-04-29  7:50   ` [U-Boot] [PATCH 3/6] 4xx: Remove binary cpld bitstream from PMC405 board matthias.fuchs at esd.eu
2009-04-29  7:50     ` [U-Boot] [PATCH 4/6] 4xx: Remove binary cpld bitstream from VOM405 board matthias.fuchs at esd.eu
2009-04-29  7:51       ` [U-Boot] [PATCH 5/6] 4xx: Remove binary cpld bitstream from DP405 board matthias.fuchs at esd.eu
2009-04-29  7:51         ` [U-Boot] [PATCH 6/6] 4xx: Add support for DP405 hardware variants matthias.fuchs at esd.eu
2009-05-04  8:10 ` [U-Boot] [PATCH 1/6] esd/common: extend cpld command with address parameter Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox