Using mmap with an sychronous stream

Questions and discussions about the Xillybus IP core and drivers

Using mmap with an sychronous stream

Postby Guest »


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.

Re: Using mmap with an sychronous stream

Postby support »


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.

Posts: 777

Re: Using mmap with an sychronous stream

Postby Guest »

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 :).



Return to Xillybus