Using mmap with an sychronous stream

Questions and discussions about the Xillybus IP core and drivers

Using mmap with an sychronous stream

Postby Guest » Wed Sep 20, 2017 1:50 pm

Hi,

I'm wondering if mmap can be used on a synchronous stream. Lets say I have an 8-bit wide synchronous stream and I want to store pointers to given set of byte values that correspond to a 100 byte array of data on my FPGA.

Code: Select all
int fd, pagesize;
char *fpga_data;

// Open device and mmap
pagesize = getpagesize();
int fd = open("/dev/xillybus_sync8", O_RDWR);
fpga_data = mmap((caddr_t)0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, pagesize);

// Mess with data
*(fpga_data + 10) = 0x22;



Is this possible? Will this mess with the synchronization guarantees that read()/write() provide for synchronous streams?

Thank you.
Guest
 

Re: Using mmap with an sychronous stream

Postby support » Wed Sep 20, 2017 5:08 pm

Hello,

mmap() isn't supported by Xillybus' driver. Actually, it's not clear to me why you would like to do that.

The closest thing available is seekable streams.

Regards,
Eli
support
 
Posts: 482
Joined: Tue Apr 24, 2012 3:46 pm

Re: Using mmap with an sychronous stream

Postby Guest » Wed Sep 20, 2017 10:00 pm

Hi Eli,

Thanks for your answer. I'm asking because I want to know in what ways I can treat the file descriptors produced by a call to open. As to why -- its more convenient to change the value of defreferenced pointers than to call write in some cases. However, calling write is perfectly acceptable :).

Best,

Jon
Guest
 


Return to Xillybus