Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHi.
I found this in system.h : /* * dcfifo_de_top_0 configuration * */ # define DCFIFO_DE_TOP_0_NAME "/dev/dcfifo_de_top_0" # define DCFIFO_DE_TOP_0_TYPE "dcfifo_de_top" # define DCFIFO_DE_TOP_0_BASE 0x00400000 # define DCFIFO_DE_TOP_0_SPAN 4 # define DCFIFO_DE_TOP_0_TERMINATED_PORTS "" # define ALT_MODULE_CLASS_dcfifo_de_top_0 dcfifo_de_top This corresponds to my custom SOPC component. So, I tried this: I modified the DE2_NET project main function (from Altera DE2_NET development board) by adding this following code: unsigned int i; FILE* fp; char buffer[10] = {0}; fp = fopen("/dev/dcfifo_de_top_0", "r"); if (fp == NULL) { printf ("\nCannot open file"); exit (1); } fread (buffer, 10, 1, fp); fclose (fp); for(i=0; i<sizeof(buffer); i++) { printf("\nbuffer[%d] = %d", i, buffer[i]); } I build the project, but when I run it, console show this: Cannot open the file. So, it seems that fp keeps on pointing to NULL (because cannot open the file). The question is: Am I doing anything bad?? Thanks again!!!!