From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Remove bit swapping in Xilinx Spartan bitfile loading
Date: Mon, 12 Nov 2007 18:19:01 +0100 [thread overview]
Message-ID: <11948879421135-git-send-email-matthias.fuchs@esd-electronics.com> (raw)
In-Reply-To: <1194887941159-git-send-email-matthias.fuchs@esd-electronics.com>
This patch removes the unnecessary bit swapping when
booting .bit files with the 'fpga loadb' command.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
common/cmd_fpga.c | 37 +------------------------------------
1 files changed, 1 insertions(+), 36 deletions(-)
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 3affeba..6ede031 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -62,12 +62,9 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
{
#if defined(CONFIG_FPGA_XILINX)
unsigned int length;
- unsigned char* swapdata;
unsigned int swapsize;
char buffer[80];
- unsigned char *ptr;
unsigned char *dataptr;
- unsigned char data;
unsigned int i;
int rc;
@@ -145,39 +142,7 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
dataptr+=4;
printf(" bytes in bitstream = %d\n", swapsize);
- /* check consistency of length obtained */
- if (swapsize >= size) {
- printf("%s: Could not find right length of data in bitstream\n",
- __FUNCTION__);
- return FPGA_FAIL;
- }
-
- /* allocate memory */
- swapdata = (unsigned char *)malloc(swapsize);
- if (swapdata == NULL) {
- printf("%s: Could not allocate %d bytes memory !\n",
- __FUNCTION__, swapsize);
- return FPGA_FAIL;
- }
-
- /* read data into memory and swap bits */
- ptr = swapdata;
- for (i = 0; i < swapsize; i++) {
- data = 0x00;
- data |= (*dataptr & 0x01) << 7;
- data |= (*dataptr & 0x02) << 5;
- data |= (*dataptr & 0x04) << 3;
- data |= (*dataptr & 0x08) << 1;
- data |= (*dataptr & 0x10) >> 1;
- data |= (*dataptr & 0x20) >> 3;
- data |= (*dataptr & 0x40) >> 5;
- data |= (*dataptr & 0x80) >> 7;
- *ptr++ = data;
- dataptr++;
- }
-
- rc = fpga_load(dev, swapdata, swapsize);
- free(swapdata);
+ rc = fpga_load(dev, dataptr, swapsize);
return rc;
#else
printf("Bitstream support only for Xilinx devices\n");
--
1.5.3
prev parent reply other threads:[~2007-11-12 17:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 17:18 [U-Boot-Users] [PATCH] Improve configuration of FPGA subsystem Matthias Fuchs
2007-11-12 17:18 ` [U-Boot-Users] [PATCH] Add pre and post configuration callbacks for Spartan FPGAs Matthias Fuchs
2007-11-12 17:18 ` [U-Boot-Users] [PATCH] Add new Xilinx Spartan FPGA types Matthias Fuchs
2007-11-12 17:19 ` [U-Boot-Users] [PATCH] Fix MSB check in Xilinx Spartan slave serial mode Matthias Fuchs
2007-11-12 17:19 ` Matthias Fuchs [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11948879421135-git-send-email-matthias.fuchs@esd-electronics.com \
--to=matthias.fuchs@esd-electronics.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.