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

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to