Skip to contentSkip to conversation

newbie question

Xenomai-help Daniele Lugli 3 participants 4 messages Mar 16, 2006

lore
Share & tools
lore
#0 lore raw

Hello all,
I am new to xenomai although I have already used rtai.
I see that xenomai has a user mode which looks equivalent to rtai's lxrt.
What about calling real-time functions implemented in a module (rtai_lxrt call, rt_fun_entry table and so on)? Thank you,
Daniele Lugli

#1 lore raw
Quoted 8 lines · Daniele Lugli

Hello all,
I am new to xenomai although I have already used rtai.
I see that xenomai has a user mode which looks equivalent to rtai's lxrt.
What about calling real-time functions implemented in a module (rtai_lxrt call, rt_fun_entry table and so on)? Thank you,
Daniele Lugli

Have a look at the way a simple skin does it, e.g. ksrc/skins/uvm.

The UVM module exports a set of 12 syscalls, from __uvm_thread_shadow to __uvm_timer_tsc, as declared in include/asm-uvm/syscalls.h.

To do that, the module registers as a Xenomai skin by calling the xnshadow_register_interface() service, during its initialization phase. Some of the parameters for this function are the address and the number of entries of the module's syscall table.

The table is made of tuples, { <syscall-entry-addr> , <syscall-mode> }
The syscall mode bits define the operations Xenomai will do to 1) check that the caller is in the proper context for calling, 2) possibly switch the caller's mode so that the operation can be properly carried out. Switching refers to whether the caller must run over the real-time thread context (we call it "primary" mode), or may or should run over Linux directly (i.e. "secondary" mode). A terse explanation of the various syscall mode bits is available in include/asm-generic/syscall.h (i.e. __xn_exec_lostage and friends). Messing with the mode bits is the first and likely only cause of strange failures; be careful when setting them.

In order to issue the syscalls from user-space that will end up calling the routines listed in the syscall table, you will need to use the XENOMAI_SKINCALL macros available from include/asm-*/syscall.h depending on your arch. Have a look at src/skins/uvm/uvm.c to get an example of implementation. Before those syscalls could be invoked, your user-space program must bind to the registered skin in kernel space, which means getting back its internal id, so that such id could be specified in subsequent syscalls. This work is done in src/skins/uvm/init.c; intelligent paste/copy of that file will lead you rather easily to something working. Make sure to properly differentiate XENOMAI_SYSCALL and XENOMAI_SKINCALL. The former runs internal Xenomai syscalls setting up the environment for your application; the latter refers to the syscalls you added by mean of registering a new skin module.

There is no much more documentation than that for now, I'm afraid.

HTH,

Signature · 1 line
Philippe.
#2 lore raw
Quoted 11 lines · Philippe Gerum
Quoted 9 lines · Daniele Lugli

Hello all,
I am new to xenomai although I have already used rtai.
I see that xenomai has a user mode which looks equivalent to rtai's lxrt. What about calling real-time functions implemented in a module (rtai_lxrt call, rt_fun_entry table and so on)?
Thank you,
Daniele Lugli

Quoted 2 lines

Have a look at the way a simple skin does it, e.g. ksrc/skins/uvm. [...]

But before going this way, first consider what kind of functions you exported so far via rt_fun_entry. If it was a driver API, you should better have a look at RTDM now.

Actually, most additional APIs exported via that LXRT interface were driver-related. But this led to rather chaotic API situation with incompatible driver interfaces. Moreover, the often used automatic LXRT mapping of arguments that describe large buffers was quite inefficient (additional copy step). That is now different with both the skin and the RTDM way under Xenomai (no automatic copying, the skin or the driver has to take care natively).

Jan

#3 lore raw
Quoted 14 lines · Jan Kiszka
Quoted 12 lines · Philippe Gerum
Quoted 9 lines · Daniele Lugli

Hello all,
I am new to xenomai although I have already used rtai.
I see that xenomai has a user mode which looks equivalent to rtai's lxrt. What about calling real-time functions implemented in a module (rtai_lxrt call, rt_fun_entry table and so on)?
Thank you,
Daniele Lugli

Quoted 8 lines
Quoted 2 lines

Have a look at the way a simple skin does it, e.g. ksrc/skins/uvm. [...]

But before going this way, first consider what kind of functions you exported so far via rt_fun_entry. If it was a driver API, you should better have a look at RTDM now.

Yep. To be precise, RTDM is a particular skin in Xenomai terminology, that aims at providing a consistent interface and behaviour for writing real-time device drivers for Xenomai, so that at some point in time, we will hopefully have something resembling a standardized device driver factory. RTDM support is particularly well integrated with Xeno's POSIX real-time interface in user-space for instance.

Signature · 1 line
Philippe.