All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Problems using rtdm_iomap_to_user
@ 2008-05-15 21:30 Thomas.Debes
  2008-05-16 10:28 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas.Debes @ 2008-05-15 21:30 UTC (permalink / raw)
  To: xenomai

Hi,
 
we are currently implementing an RTDM driver for our PCI based fieldbus card running in a MPC5200 system (Xenomai 2.3.5/Kernel 2.4 PPC). In order to provide backward compatibility for existing applications (using an older Linux version of the driver) we need an ioctl to let those applications read/write to a mapped io memory. Therefore we used the following (incomplete)  piece of code :
 
void map_dpm_to_user(pcidev_t *pcidev,  rtdm_user_info_t *user_info,  void *arg)
 {
        unsigned long memaddr = 0, memlen = 0;
        unsigned char *dpm = NULL;

        /* Get start address and length of resource */
        memaddr = pci_resource_start(pcidev, 2);
        memlen = pci_resource_len(pcidev, 2);

        memaddr &= PCI_BASE_ADDRESS_IO_MASK;

        /* Request resource */
        request_mem_region(memaddr, memlen, NULL);

        /* Remap for direct access in kernel space */
        dpm = (unsigned char*)ioremap(memaddrmask, memlen);

        /* Map to user */
        rtdm_iomap_to_user(user_info, memaddr, memlen,
                         PROT_READ|PROT_WRITE, (void **)arg, NULL, NULL);
}
 
This code executes without errors but the application freezes on accessing the mapped memory. There was a similar question posted earlier (https://mail.gna.org/public/xenomai-core/2007-09/msg00030.html) but the suggested solution can not be used with a 2.4 kernel because phys_mem_access_prot was introduced with the kernel version 2.6 (afaik).  Can you confirm this problem? Are there any related patches in the current Xenomai version (2.4.x)?
 
Thanks
Thomas 

MAN Roland Druckmaschinen AG
Vorsitzender des Aufsichtsrates: Hanno C. Fiedler
Vorstand: Gerd Finkbeiner (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle    
Sitz der Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592    
USt-Ident-Nr. DE 250200933


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-16 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15 21:30 [Xenomai-help] Problems using rtdm_iomap_to_user Thomas.Debes
2008-05-16 10:28 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.