summaryrefslogtreecommitdiff
path: root/common/cmd_fpga.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2005-01-09 18:21:42 +0000
committerwdenk <wdenk>2005-01-09 18:21:42 +0000
commita562e1bd9d8e10ea2e51d08e66d35a6e1795153b (patch)
tree225a386c4a9b200dc9d97c22cec7b019d62312fd /common/cmd_fpga.c
parent30ce5ab043db0b34838ad2d294561992bdb5236a (diff)
Patch by Florian Schlote, 08 Sep 2004:
Add support for SenTec-COBRA5272-board (Coldfire).
Diffstat (limited to 'common/cmd_fpga.c')
-rw-r--r--common/cmd_fpga.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 7c762bab92..d50cede3b5 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -80,11 +80,11 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
return FPGA_FAIL;
}
- length = (*dataptr << 8) + *(dataptr+1);
+ length = (*dataptr << 8) + *(dataptr+1);
dataptr+=2;
for(i=0;i<length;i++)
buffer[i]=*dataptr++;
-
+
buffer[length-5]='\0'; /* remove filename extension */
PRINTF(__FUNCTION__ ": design name = \"%s\".\n",buffer);
@@ -93,18 +93,18 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
printf(__FUNCTION__ ": Part number identifier not recognized in bitstream.\n");
return FPGA_FAIL;
}
-
+
length = (*dataptr << 8) + *(dataptr+1); dataptr+=2;
- for(i=0;i<length;i++)
+ for(i=0;i<length;i++)
buffer[i]=*dataptr++;
PRINTF(__FUNCTION__ ": part number = \"%s\".\n",buffer);
-
+
/* get date (identifier, length, string) */
if (*dataptr++ != 0x63) {
printf(__FUNCTION__ ": Date identifier not recognized in bitstream.\n");
return FPGA_FAIL;
}
-
+
length = (*dataptr << 8) + *(dataptr+1); dataptr+=2;
for(i=0;i<length;i++)
buffer[i]=*dataptr++;
@@ -115,12 +115,12 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
printf(__FUNCTION__ ": Time identifier not recognized in bitstream.\n");
return FPGA_FAIL;
}
-
+
length = (*dataptr << 8) + *(dataptr+1); dataptr+=2;
for(i=0;i<length;i++)
buffer[i]=*dataptr++;
PRINTF(__FUNCTION__ ": time = \"%s\".\n",buffer);
-
+
/* get fpga data length (identifier, length) */
if (*dataptr++ != 0x65) {
printf(__FUNCTION__ ": Data length identifier not recognized in bitstream.\n");
@@ -129,20 +129,20 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
swapsize = ((long)*dataptr<<24) + ((long)*(dataptr+1)<<16) + ((long)*(dataptr+2)<<8) + (long)*(dataptr+3);
dataptr+=4;
PRINTF(__FUNCTION__ ": bytes in bitstream = %d.\n",swapsize);
-
+
/* check consistency of length obtained */
if (swapsize >= size) {
printf(__FUNCTION__ ": Could not find right length of data in bitstream.\n");
return FPGA_FAIL;
}
-
+
/* allocate memory */
swapdata = (char *)malloc(swapsize);
if (swapdata == NULL) {
printf(__FUNCTION__ ": Could not allocate %d bytes memory !\n",swapsize);
return FPGA_FAIL;
}
-
+
/* read data into memory and swap bits */
ptr = swapdata;
for (i = 0; i < swapsize; i++) {