#include "lenval.h"
#include "ports.h"
-
-extern const unsigned char fpgadata[];
-extern int filesize;
-
+const unsigned char *xsvfdata;
/*============================================================================
* XSVF #define
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 );
return( iErrorCode );
}
U_BOOT_CMD(
- cpld, 1, 1, do_cpld,
- "Program onboard CPLD",
- NULL
+ cpld, 2, 1, do_cpld,
+ "program onboard CPLD",
+ "<xsvf-addr>"
);
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)
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;
}
}