Forum Discussion
Altera_Forum
Honored Contributor
21 years agoAbout host file system
I used the altera host file system to open a file .mp3,, is this a legal operation or not?
if it is legal then why [[FILE *hostfile =fopen ("/mnt/host/song.mp3","rb");]] return NULL!! can any one tell me the exact syntax to access the file and where exactly should the mp3 file"song.mp3" exist? thanks15 Replies
- Altera_Forum
Honored Contributor
@xiaban
Could you please tell me exactly how did you manage to read a file from the PC and store it on the onchip memory? Could you share some code please too? Thanks - Altera_Forum
Honored Contributor
Host file system read data from PC to buffer, and I read data from buffer and write to on-chip memory.
- Altera_Forum
Honored Contributor
thanks for ur fast answer ..
1. but doesn't this only work in debug mode ..? i need to transfer the image to onchip .. and when its done let my own verilog modules handle the processing .. 2. is this correct? void* ptr = (void*) On_chip_base_address then i use fread to write to on_chip? i am new to this, could you please share some code which handles reading /writing? - Altera_Forum
Honored Contributor
Yes ,it works only in debug mode.
Some codes as following: fread(buffer,1, 1, fp_bin); //read IOWR(MEMORY_BASE,0,buffer[0]); //write - Altera_Forum
Honored Contributor
Thanks .. :)
but it seems that my code seems stuck at fopen for no obvious reason .. the host file based system is enabled .. the file is "/mnt/host/filename.bmp" and placed in the same directory as the main c file .. in debug .. fp always returns null