1
0
mirror of https://github.com/marqs85/ossc.git synced 2026-04-21 05:16:31 +00:00

move bitswap inside epcq_controller driver

This commit is contained in:
marqs
2018-10-09 23:16:37 +03:00
parent 9777fe8e66
commit 055a794b5e
11 changed files with 7437 additions and 7315 deletions
+2 -15
View File
@@ -49,9 +49,6 @@ int read_flash(alt_u32 offset, alt_u32 length, alt_u8 *dstbuf)
if (retval != 0)
return -FLASH_READ_ERROR;
for (i=0; i<length; i++)
dstbuf[i] = bitswap8(dstbuf[i]);
return 0;
}
@@ -69,10 +66,6 @@ int write_flash_page(alt_u8 *pagedata, alt_u32 length, alt_u32 pagenum)
}
}
// Bit-reverse bytes for flash
for (i=0; i<length; i++)
pagedata[i] = bitswap8(pagedata[i]);
retval = alt_epcq_controller_write_block(&epcq_controller_dev->dev, (pagenum/PAGES_PER_SECTOR)*PAGES_PER_SECTOR*PAGESIZE, pagenum*PAGESIZE, pagedata, length);
if (retval != 0) {
@@ -83,7 +76,7 @@ int write_flash_page(alt_u8 *pagedata, alt_u32 length, alt_u32 pagenum)
return 0;
}
int write_flash(alt_u8 *buf, alt_u32 length, alt_u32 pagenum, alt_u8 *tmpbuf)
int write_flash(alt_u8 *buf, alt_u32 length, alt_u32 pagenum)
{
int retval;
alt_u32 bytes_to_w;
@@ -91,13 +84,7 @@ int write_flash(alt_u8 *buf, alt_u32 length, alt_u32 pagenum, alt_u8 *tmpbuf)
while (length > 0) {
bytes_to_w = (length > PAGESIZE) ? PAGESIZE : length;
// Use a temporary buffer if one was given.
// This is to avoid the original buffer from
// being overwritten by write_flash_page().
if (tmpbuf)
memcpy(tmpbuf, buf, bytes_to_w);
retval = write_flash_page(tmpbuf ? tmpbuf : buf, bytes_to_w, pagenum);
retval = write_flash_page(buf, bytes_to_w, pagenum);
if (retval != 0)
return retval;
+1 -1
View File
@@ -44,7 +44,7 @@ int read_flash(alt_u32 offset, alt_u32 length, alt_u8 *dstbuf);
int write_flash_page(alt_u8 *pagedata, alt_u32 length, alt_u32 pagenum);
int write_flash(alt_u8 *buf, alt_u32 length, alt_u32 pagenum, alt_u8 *tmpbuf);
int write_flash(alt_u8 *buf, alt_u32 length, alt_u32 pagenum);
int verify_flash(alt_u32 offset, alt_u32 length, alt_u32 golden_crc, alt_u8 *tmpbuf);
+1 -1
View File
@@ -51,7 +51,7 @@ int copy_sd_to_flash(alt_u32 sd_blknum, alt_u32 flash_pagenum, alt_u32 length, a
return -retval;
}
retval = write_flash(tmpbuf, bytes_to_rw, flash_pagenum, NULL);
retval = write_flash(tmpbuf, bytes_to_rw, flash_pagenum);
if (retval != 0)
return retval;
+1 -1
View File
@@ -25,6 +25,6 @@
#include "sd_io.h"
int check_sdcard(alt_u8 *databuf);
int copy_sd_to_flash(alt_u32 sd_offset, alt_u32 flash_offset, alt_u32 length, alt_u8 *tmpbuf);
int copy_sd_to_flash(alt_u32 sd_blknum, alt_u32 flash_pagenum, alt_u32 length, alt_u8 *tmpbuf);
#endif /* SDCARD_H_ */