- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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, ®ions, &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.Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can pick up the macro EPCS_NAME (something like that) from your system.h

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page