Hello again,
When one doesn't get replies to his questions, it may be either because: i)
they are too obvious (RTFM), ii) too difficult, iii) there is little
information and it makes the checking in one's system impossible, or iv) they
haven't been correctly explained. It may also be that the help demander is not
being polite.
As i have received no answer, I will assume I haven't explained my problem
correctly and will give myself a second chance ;) The following lines will just
rewrite my question, since I haven't been able to find any new clue:
I'm porting a PCI driver to a RTDM, using Xenomai version 2.4.7 and Linux
2.6.27, from the ELinOS 5.0 distribution.
I want to allow a RT task to access the PCI memory directly, by calling the
rtdm_iomap_to_user() function just after mlockall and rt_dev_open, and before
rt_task_shadow. The function returns me a correct value, but then I cannot
access the PCI registers by using that address. The mmap seems not to be
correct. The values I get:
Driver:
xen_mydriver->location = pci_resource_start(dev,0); --> 0x20000000
xen_mydriver->base_address = ioremap(xen_mydriver->location,
xen_mydriver->mem_size); --> 0xe0a00000
*(unsigned short*)(my_context->base_address + 0x100) = 0xAAAA; --> It
works
RT task:
rtdm_iomap_to_user(user_info,my_context->location, 300,
PROT_READ|PROT_WRITE, &new_iomap, NULL, NULL); --> 0xb5f6f000
virt_to_phys(new_iomap) --> 0xf5f6f000
*(unsigned short*)(new_iomap + 0x100) = 0xAAAA; --> It doesn't work
(either in the driver or in the RT task)
Hope this time I'll get some clue. I promise I won't send this question again
without any new information.
Anyway, thanks for your time. Best regards,
Asier
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Asier Tamayo
> Sent: Thursday, April 14, 2011 11:38 AM
> To: Jan Kiszka
> Cc: [email protected]
> Subject: Re: [Xenomai-help] FW: rtdm_iomap_to_user() I-pipe error
>
>
> Hello Jan,
>
> First of all, thanks for your quick answer.
>
> Yes, you're completely right. My user application called
> rt_dev_ioctl, which eventually called rtdm_iomap_to_user,
> after rt_task_shadow. Now, I call it just after mlockall and
> rt_dev_open, and before rt_task_shadow. The
> rtdm_iomap_to_user function now seems to be working
> correctly, and dmesg no longer shows the previous errors. [By
> the way, it could be interesting to add a
> rtdm_in_rt_context() check in the rtdm_iomap_to_user
> function, which would return an error if in RT]
>
> However, when I later try to write to the device, nothing is
> written. The mmap seems not to be correct. The following
> lines may show the problem:
> rtdm_printk("location %lx --> base %p --> iomap_to_user
> %p --> virt_to_phys %lx \n",
> my_context->location, my_context->base_address,
> new_iomap, virt_to_phys(new_iomap));
>
> gives the following result:
> location 20000000 -> base e0a00000 --> iomap_to_user
> b5f6f000 --> virt_to_phys f5f6f000
>
> where the variables are:
> [unsigned long] xen_mydriver->location =
> pci_resource_start(dev,0);
> [void __iomem*] xen_mydriver->base_address =
> ioremap(xen_mydriver->location, xen_mydriver->mem_size);
> [void __iomem*] new_iomap
> rtdm_iomap_to_user(user_info,my_context->location, 300,
> PROT_READ|PROT_WRITE, &new_iomap, NULL, NULL);
>
> If I execute in my RTDM driver:
> *(unsigned short*)(my_context->base_address + 0x100) = 0xAAAA;
>
> I can see that the address is written. However, if I execute
> (either in the driver or from the RT task):
> *(unsigned short*)(new_iomap + 0x100) = 0xAAAA;
> It doesn't work.
>
> Does anybody know what is wrong? I'm sure I must be missing
> something important, but I can't see what.
>
>
> Best regards,
>
> Asier
>
>
>
> > -----Original Message-----
> > From: Jan Kiszka [mailto:[email protected]]
> > Sent: Thursday, April 14, 2011 9:34 AM
> > To: Asier Tamayo
> > Cc: [email protected]
> > Subject: Re: FW: rtdm_iomap_to_user() I-pipe error
> >
> >
> > On 2011-04-14 08:14, Asier Tamayo wrote:
> > >
> > > Hello,
> > >
> > > I'm porting a PCI driver to a RTDM. Until now, I have
> > successfully done most of the job.
> > >
> > > I'm using Xenomai version 2.4.7 and Linux 2.6.27, from the
> > ELinOS 5.0 distribution.
> > >
> > > My problem appears with the rtdm_iomap_to_user() function.
> > I want to allow a RT task to access the PCI memory directly,
> > via mmap. As the RTDM has no mmap() function, I'm trying to
> > use rtdm_iomap_to_user, but it always gives me the following error:
> > >
> > > I-pipe: Detected illicit call from domain 'Xenomai'
> > > into a service reserved for domain 'Linux' and below.
> >
> > This is also documented: rtdm_iomap_to_user is not supposed
> > to be called
> > from RT task context. This means your driver should only
> call it from
> > handlers registered for *_nrt entry points.
> >
> > Jan
> >
> > --
> > Siemens AG, Corporate Technology, CT T DE IT 1
> > Corporate Competence Center Embedded Linux
> >
>
> _______________________________________________
> Xenomai-help mailing list
> [email protected]
> https://mail.gna.org/listinfo/xenomai-help
>
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help