Hi abubaha,
I have manged to get this working (or at least on my setup) What you'll need to do is change 3 sections within the altera_ro_zipfs.c file.
static alt_u32 read_word(alt_u8* current_ptr)
{
if (ALTERA_RO_ZIPFS_BASE == EPCS_FLASH_CONTROLLER_BASE)
{
alt_u32 RetValue;
alt_u32 Offset = (current_ptr - ALTERA_RO_ZIPFS_BASE);
alt_flash_dev *dev = alt_flash_open_dev("/dev/epcs_flash_controller\0");
//Do EPCS Flash Read
alt_epcs_flash_read(dev, Offset, (void*)&RetValue, 4);
alt_flash_close_dev(dev);
return RetValue;
}
else
{
As before
}
Same as above for the read_half_word (only replace the 4 with 2 for length)
int alt_ro_zipfs_read(alt_fd* fd, char* ptr, int len)
{
...
if (ALTERA_RO_ZIPFS_BASE == EPCS_FLASH_CONTROLLER_BASE)
{
alt_u32 RetValue;
alt_u32 Offset = (current - ALTERA_RO_ZIPFS_BASE);
alt_flash_dev *fdev = alt_flash_open_dev("/dev/epcs_flash_controller\0");
//Do EPCS Flash Read
alt_epcs_flash_read(fdev, Offset, (void*)current, amount_to_copy);
alt_flash_close_dev(fdev);
}
memcpy(ptr, current, amount_to_copy);
The code isnt very pretty at the minute as it should use the# defines from system.h etc. As far as i can make out the EPCS is not a memory mapped peripheral and as such you have to do the reading. I would really like to know if there is a better way to do this. It appears that normally it just dereferences the pointer to get the data. Perhaps one of the Gurus could better explain. (I'd really like to know if this is just a hack or legit!!!)
Either way the answer is yes you can and the above works for me....
Cheers
Tim