Skip to contentSkip to conversation

RTDM : invocation of _rt or _nrt

Xenomai-help Perrine Martignoni 2 participants 2 messages Jul 9, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

Currently, I'm writing some drivers with RTDM and I ask me a few questions. If I have two different functions associated to open_rt and open_nrt for instance, how can I call one or the other ?
I tried and when I call rt_dev_open, it takes the open_nrt by default (it seems).

#1 lore raw
Quoted 7 lines · Perrine Martignoni

Hello,

Currently, I'm writing some drivers with RTDM and I ask me a few questions. If I have two different functions associated to open_rt and open_nrt for instance, how can I call one or the other ?
I tried and when I call rt_dev_open, it takes the open_nrt by default (it seems).

The _rt-variants of RTDM handlers are taken if the caller runs in primary mode, i.e. over a Xenomai thread and without previously switching to Linux for some syscall.

Generally, you don't need to worry about _rt handlers for open/socket/close. Most initialisation and cleanup work requires Linux context anyway. Thus, providing only a _nrt handler is the right thing to do. Moreover, I'm considering to remove open_rt/socket_rt/close_rt for one of the next RTDM revisions to simplify things and to avoid confusion like this. So if you see a real need for device opening/closing in hard RT context, speak up loudly soon. :)

Things are different, e.g., when looking at ioctl_rt/nrt. There is a fair amount of reasonable use cases where you need handlers for both context to address different caller contexts with different code (e.g. to fail via -ENOSYS if the other context is required and let Xenomai then switch the caller over to the right context automatically).

Hope that clarified things. If not, don't hesitate to ask again.

Jan