mirror of
https://github.com/marqs85/ossc.git
synced 2026-04-20 13:16:50 +00:00
update epcq_controller_mod to epcq_controller2
This commit is contained in:
@@ -35,7 +35,7 @@ int init_flash()
|
||||
extern alt_llist alt_flash_dev_list;
|
||||
epcq_dev = (alt_flash_dev*)alt_flash_dev_list.next;
|
||||
#else
|
||||
epcq_dev = alt_flash_open_dev(EPCQ_CONTROLLER_0_AVL_MEM_NAME);
|
||||
epcq_dev = alt_flash_open_dev(EPCQ_CONTROLLER2_0_AVL_MEM_NAME);
|
||||
#endif
|
||||
|
||||
if (epcq_dev == NULL)
|
||||
@@ -46,14 +46,16 @@ int init_flash()
|
||||
|
||||
int verify_flash(alt_u32 offset, alt_u32 length, alt_u32 golden_crc, alt_u8 *tmpbuf)
|
||||
{
|
||||
alt_u32 crcval=0, i, bytes_to_read;
|
||||
alt_u32 crcval=0, i, j, bytes_to_read;
|
||||
int retval;
|
||||
|
||||
for (i=0; i<length; i=i+PAGESIZE) {
|
||||
bytes_to_read = ((length-i < PAGESIZE) ? (length-i) : PAGESIZE);
|
||||
|
||||
//retval = read_flash(i, bytes_to_read, tmpbuf);
|
||||
retval = alt_epcq_controller_read(epcq_dev, offset+i, tmpbuf, bytes_to_read);
|
||||
retval = alt_epcq_controller2_read(epcq_dev, offset+i, tmpbuf, bytes_to_read);
|
||||
for (j=0; j<bytes_to_read; j++)
|
||||
tmpbuf[j] = bitswap8(tmpbuf[j]);
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sysconfig.h"
|
||||
#include "altera_epcq_controller_mod.h"
|
||||
#include "altera_epcq_controller2.h"
|
||||
|
||||
// EPCS16 pagesize is 256 bytes
|
||||
// Flash is split 50-50 to FW and userdata, 1MB each
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <string.h>
|
||||
#include "sdcard.h"
|
||||
#include "flash.h"
|
||||
#include "lcd.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern alt_flash_dev *epcq_dev;
|
||||
|
||||
@@ -42,7 +42,7 @@ int check_sdcard(alt_u8 *databuf)
|
||||
int copy_sd_to_flash(alt_u32 sd_blknum, alt_u32 flash_pagenum, alt_u32 length, alt_u8 *tmpbuf)
|
||||
{
|
||||
SDRESULTS res;
|
||||
int retval;
|
||||
int retval, i;
|
||||
alt_u32 bytes_to_rw;
|
||||
|
||||
while (length > 0) {
|
||||
@@ -54,12 +54,14 @@ int copy_sd_to_flash(alt_u32 sd_blknum, alt_u32 flash_pagenum, alt_u32 length, a
|
||||
}
|
||||
|
||||
if ((flash_pagenum % PAGES_PER_SECTOR) == 0) {
|
||||
retval = alt_epcq_controller_erase_block(epcq_dev, flash_pagenum*PAGESIZE);
|
||||
retval = alt_epcq_controller2_erase_block(epcq_dev, flash_pagenum*PAGESIZE);
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = alt_epcq_controller_write_block(epcq_dev, ((flash_pagenum/PAGES_PER_SECTOR)*SECTORSIZE), flash_pagenum*PAGESIZE, tmpbuf, bytes_to_rw);
|
||||
for (i=0; i<bytes_to_rw; i++)
|
||||
tmpbuf[i] = bitswap8(tmpbuf[i]);
|
||||
retval = alt_epcq_controller2_write_block(epcq_dev, ((flash_pagenum/PAGES_PER_SECTOR)*SECTORSIZE), flash_pagenum*PAGESIZE, tmpbuf, bytes_to_rw);
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
|
||||
@@ -74,12 +76,14 @@ int copy_sd_to_flash(alt_u32 sd_blknum, alt_u32 flash_pagenum, alt_u32 length, a
|
||||
int copy_flash_to_sd(alt_u32 flash_pagenum, alt_u32 sd_blknum, alt_u32 length, alt_u8 *tmpbuf)
|
||||
{
|
||||
SDRESULTS res;
|
||||
int retval;
|
||||
int retval, i;
|
||||
alt_u32 bytes_to_rw;
|
||||
|
||||
while (length > 0) {
|
||||
bytes_to_rw = (length < SD_BLK_SIZE) ? length : SD_BLK_SIZE;
|
||||
retval = alt_epcq_controller_read(epcq_dev, flash_pagenum*PAGESIZE, tmpbuf, bytes_to_rw);
|
||||
retval = alt_epcq_controller2_read(epcq_dev, flash_pagenum*PAGESIZE, tmpbuf, bytes_to_rw);
|
||||
for (i=0; i<bytes_to_rw; i++)
|
||||
tmpbuf[i] = bitswap8(tmpbuf[i]);
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user