Hello!<br>I have a problem writing application using uio subsystem.<br>As described at <a href="http://www.kernel.org/doc/htmldocs/uio-howto.html#uio_pci_generic">http://www.kernel.org/doc/htmldocs/uio-howto.html#uio_pci_generic</a>, I bind my device to uio. Files in /sys/class/uio/uio0/ appears, dmesg say no problems.<br>
But when I trying to mmap regions of device file /sys/class/uio/uio0/.../mapX not created.<br>A mmap part of code:<br><br>uint32_t UioMap(int devnum, int map_num)<br>{<br> char *u = (char *) calloc(64, 1);<br> sprintf(u, "/sys/class/uio/uio%d/device/resource%d", devnum, map_num);<br>
int fd = open(u, O_RDONLY); <br> if(fd < 0)<br> {<br> fprintf(stderr,"Error on open!\n");<br> return NULL;<br> }<br> else fprintf(stderr,"fd = %d\n", fd);<br> void* map_addr = mmap(NULL,<br>
0x800000,<br> PROT_READ,<br> MAP_SHARED,<br> fd,<br> map_num * getpagesize());<br> if(map_addr == MAP_FAILED)<br> {<br> perror("mmap");<br> }<br>
free(u);<br> return (uint32_t *) map_addr;<br>}<br clear="all"><br>Is there any examples of usage uio_pci_generic in realworld?<br><br>-- <br>Dmitriy<br>