Hi,

According to page 651
https://xenomai.org/documentation/xenomai-3/pdf/xeno3prm.pdf


This will make such region accessible via the mapper device using the following 
sequence of code, via
the default ->mmap() handler from the UDD core:
int fd, fdm;
void *p;
fd = open("/dev/foocard", O_RDWR);
fdm = open("/dev/foocard,mapper@2", O_RDWR);
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, 0, fdm, 0);


I have several questions:

1)      It looks like the 4th argument of mmap (the one to the left of "fdm") 
needs to be either MAP_SHARED or MAP_PRIVATE

2)      The "@" character right after "mapper" is not valid (ie. there should 
be no "@" character at all)

3)      /dev/foocard should be /dev/rtdm/foocard

here's my real question:

Assuming all 3 of the above is valid from user space, and on the kernel space, 
I followed the ex. to create memory region, etc. such that I do see my device

# ls -l dev/rtdm
crw-------    1 root     root      252,   0 Jan  1 00:00 autotune
crw-------    1 root     root      247,   0 Jan  1 00:00 eeprom
crw-------    1 root     root      246,   0 Jan  1 00:00 eeprom,mapper0
crw-------    1 root     root      254,   0 Jan  1 00:00 memdev-private
crw-------    1 root     root      254,   1 Jan  1 00:00 memdev-shared
crw-------    1 root     root      253,   0 Jan  1 00:00 memdev-sys
crw-------    1 root     root      249,   0 Jan  1 00:00 mmio
crw-------    1 root     root      248,   0 Jan  1 00:00 mmio,mapper0
crw-------    1 root     root      248,   1 Jan  1 00:00 mmio,mapper1
crw-------    1 root     root      248,   2 Jan  1 00:00 mmio,mapper2
crw-------    1 root     root      248,   3 Jan  1 00:00 mmio,mapper3
crw-------    1 root     root      248,   4 Jan  1 00:00 mmio,mapper4
crw-------    1 root     root      250,   0 Jan  1 00:00 switchtest
crw-------    1 root     root      251,   0 Jan  1 00:00 timerbench


like /dev/rtdm/eeprom and /dev/rtdm/eeprom,mapper0  etc. I don't see my kernel 
hook ever gets called


static struct udd_device eeprom = {
              .device_flags = RTDM_NAMED_DEVICE,
              .device_name = "eeprom",
              .ops = {
                             .close = phong_scs750_close,
                             .open = phong_scs750_open,
                             .mmap = phong_scs750_mmap,
              }

By that, I mean phong_scs750_open, phong_scs750_mmap never gets invoked.  
mmap() from user space returns -1 with errno value of 19 (ENODEV).  Any advise?

Phong.
Notice: This e-mail and any files transmitted with it may contain Data Device 
Corporation's privileged and proprietary information. It is intended solely for 
the use of the individual or entity to whom it is addressed. If you are not the 
named recipient of this transmission, any disclosure, copying, distribution or 
reliance on the contents of this message is prohibited. If you received this 
e-mail in error, please destroy it and any attached files and notify me 
immediately.
_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai

Reply via email to