Skip to contentSkip to conversation

RTDM

Xenomai-help Patrick 2 participants 4 messages Sep 6, 2007 – Sep 8, 2007

lore
Share & tools
lore

Patrick

author
#0 lore raw

Hy,

I don't understand the difference between rtdm function and standard function. For exemple what is the diffrence between rtdm_printk and printk or rtdm_malloc and malloc ?

I am developping an RT driver so I must simply used only functions rtdm ?

Thank you for all explanation

Patrick

#1 lore raw
Quoted 4 lines · Patrick

Hy,

I don't understand the difference between rtdm function and standard function. For exemple what is the diffrence between rtdm_printk and printk

Technically? None these days (printk is provided RT-safe by Adeos/I-pipe), but it documents that the message may be printed from RT context. And who know if some future RTDM implementation may not have to differentiate internally again...

Quoted 2 lines

or rtdm_malloc
and malloc ?

You mean kmalloc (malloc is user space only)? rtdm_malloc provides memory from a dedicated pool (dedicated to Xenomai, excluding Linux) and uses a predictable allocator (as long as the memory usage pattern is predictable). kmalloc is non-deterministic, and is shared with the whole Linux kernel.

Quoted 2 lines

I am developping an RT driver so I must simply used only functions rtdm ?

Regarding the two services above: Depends on the context. If they run in non-RT driver cleanup or device instantiation context, you should continue to use standard Linux services. Just for usage from RT contexts (tasks, IRQ handlers (please don't allocate memory in the latter context, though...)) switch to those RTDM variants.

Jan

author
#2 lore raw

Jan Kiszka a écrit : Patrick wrote: Hy, I don't understand the difference between rtdm function and standard function. For exemple what is the diffrence between rtdm_printk and printk

#3 lore raw
Quoted 20 lines · Patrick
Quoted 18 lines · Jan Kiszka
Quoted 5 lines · Patrick

Hy,

I don't understand the difference between rtdm function and standard function. For exemple what is the diffrence between rtdm_printk and printk

Technically? None these days (printk is provided RT-safe by Adeos/I-pipe), but it documents that the message may be printed from RT context. And who know if some future RTDM implementation may not have to differentiate internally again...

Quoted 3 lines

or rtdm_malloc
and malloc ?

Quoted 8 lines
Quoted 6 lines

You mean kmalloc (malloc is user space only)? rtdm_malloc provides memory from a dedicated pool (dedicated to Xenomai, excluding Linux) and uses a predictable allocator (as long as the memory usage pattern is predictable). kmalloc is non-deterministic, and is shared with the whole Linux kernel.

Yes I use kmalloc... sorry
So kmalloc and rtdm_kmalloc is exactly the same ?

They share the same purpose, but details differ, just look at the function arguments...

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines

I am developping an RT driver so I must simply used only functions rtdm ?

Regarding the two services above: Depends on the context. If they run in non-RT driver cleanup or device instantiation context, you should continue to use standard Linux services. Just for usage from RT contexts (tasks, IRQ handlers (please don't allocate memory in the latter context, though...)) switch to those RTDM variants.

Quoted 4 lines
Quoted 3 lines

Jan

For IRQ handlers I use the rt_intr_ functions it's not right ? what is the difference between this functions and th rtdm_irq ?

Besides details, the main point is that you shall not mix APIs in your driver if you want to keep it portable to future RTDM environment.

Quoted 2 lines

Do you have an simple trivial exemple of rtdm driver with irq ?

We still need to add such a tutorial to the RTDM series. In the meantime, you could have a look at irqbench from the testsuite for a more simple scenario. But, of course, you can also dig inside the other RTDM drivers in-tree or beyond, they are just not that simple.

Jan