Page 1 of 1

Using mmap with an sychronous stream

PostPosted:
by Guest
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.

Re: Using mmap with an sychronous stream

PostPosted:
by support
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

Re: Using mmap with an sychronous stream

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

Best,

Jon