Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

Store the data on the EPCS4!!

Altera_Forum
Honored Contributor II
1,300 Views

Hello ,I want to keep the data to the EPCS4,following is the process:# include <stdio.h># include <unistd.h># include "system.h"# include "alt_types.h"# include "sys/alt_flash.h" # include "sys/alt_flash_dev.h"# include "altera_avalon_epcs_flash_controller.h" 

alt_u8 epcsbuf[32]="123456789"; 

int ret_code,i; 

int number_of_regions; 

alt_flash_fd* my_epcs; 

flash_region* regions; 

int main (void) __attribute__ ((weak, alias ("alt_main"))); 

int alt_main(void) 

my_epcs = alt_flash_open_dev("/dev/epcs_flash_controller"); 

ret_code = alt_epcs_flash_get_info (my_epcs, &regions, &number_of_regions); 

if(my_epcs)  

 

ret_code = alt_epcs_flash_erase_block(my_epcs, 0x70000); 

ret_code = alt_epcs_flash_write(my_epcs, 0x70000, epcsbuf, 10);  

for(i=0;i<10;i++) 

epcsbuf[i]=0; 

 

ret_code = alt_epcs_flash_read(my_epcs, 0x70000, epcsbuf, 10);  

 

}  

while(1) 

return 0; 

 

 

Why is red part of the function return value is 0?And the address of the EPCS4 is absolutely correct.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
576 Views

What about the name? Are you sure that the controller name is /dev/epcs_flash_controller ? You can look for it in your system.h

0 Kudos
Altera_Forum
Honored Contributor II
576 Views

you can pick up the macro EPCS_NAME (something like that) from your system.h

0 Kudos
Reply