* How to use uio_pci_generic driver.
@ 2012-03-19 11:00 Dmitriy Tochansky
0 siblings, 0 replies; only message in thread
From: Dmitriy Tochansky @ 2012-03-19 11:00 UTC (permalink / raw)
To: kernelnewbies
Hello!
I have a problem writing application using uio subsystem.
As described at
http://www.kernel.org/doc/htmldocs/uio-howto.html#uio_pci_generic, I bind
my device to uio. Files in /sys/class/uio/uio0/ appears, dmesg say no
problems.
But when I trying to mmap regions of device file
/sys/class/uio/uio0/.../mapX not created.
A mmap part of code:
uint32_t UioMap(int devnum, int map_num)
{
char *u = (char *) calloc(64, 1);
sprintf(u, "/sys/class/uio/uio%d/device/resource%d", devnum, map_num);
int fd = open(u, O_RDONLY);
if(fd < 0)
{
fprintf(stderr,"Error on open!\n");
return NULL;
}
else fprintf(stderr,"fd = %d\n", fd);
void* map_addr = mmap(NULL,
0x800000,
PROT_READ,
MAP_SHARED,
fd,
map_num * getpagesize());
if(map_addr == MAP_FAILED)
{
perror("mmap");
}
free(u);
return (uint32_t *) map_addr;
}
Is there any examples of usage uio_pci_generic in realworld?
--
Dmitriy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120319/2dc19abe/attachment.html
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-03-19 11:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-19 11:00 How to use uio_pci_generic driver Dmitriy Tochansky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).