Jan Kiszka wrote:
> Doyle, Alan wrote:
>> Hi,
>>
>> I have an application where I need to read four contiguous memory mapped
>> data registers in response to an interrupt. As its real time critical I
>> intend to implement the read in Xenomai. Having read and processed the
>> data it later needs to be passed to a Linux domain application, I am
>> hoping to use a Posix message queue for this purpose.
>>
>> I seem to have two options as to how to implement this, I could register
>> the interrupt in a Xenomai user space thread and mmap the data registers
>> so that on receiving the interrupt the registers could be read.
>> Alternatively I could write a Xenomai RTDM driver to read the registers
>> on interrupt and use the driver read call from the Xenomai user space
>> thread to access register data. In each case the data would then be
>> passed to the Linux domain via a message to a Posix queue - after some
>> further processing that is not real time critical.
>>
>> Could you enlighten me as to the pros and cons of each approach, I am
>> particularly unclear as to the implications of using mmap in the Xenomai
>> domain and what if any affect it might have on the real time
>> responsiveness (I understand mmap() to be a call back into the Linux
>> kernel rather than to the Xenomai nucleus).
> 
> To call mmap from real-time code is actually a generic issue. If you
> look at the design of other time-critical, though not hard-RT drivers
> like video4linux, they also try to avoid mmap'ing on demand. Instead one
> should set up mappings ahead-of-time during device initialisation. Use
> rings of premapped buffers that cycle between the driver and the
> application.

One thing I forgot to mention: likely you want to have a look at
rtdm_mmap_to_user() for this purpose.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to