Skip to contentSkip to conversation

Calling comedi from a RT task

Xenomai-help Patrick Gräbel 3 participants 5 messages Dec 2, 2008 – Dec 4, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I am using Xenomai 2.3.1 and comedi with driver "ni_pcimio". I am able to create a RT task that triggers each msec. But calling the comedi API kicks me out of RT as indicated by /proc/xenomai/stat (column MSW). The modules loaded are:

comedi_fc 3584 1 ni_pcimio
kcomedilib 20868 0
comedi 33248 6 ni_pcimio, ni_tio, comedi_fc, mite, 8255, kcomedilib
licModule 44272 1 kcomedilib

The comedi modules are from a 2.6.20-14-ipipe/comedi/driver directory. How do I use the comedi API so that the task will stay realtime? What do I have to check?

#1 lore raw
Quoted 7 lines · Patrick Gräbel

Hi,

I am using Xenomai 2.3.1 and comedi with driver "ni_pcimio". I am able to create a RT task that triggers each msec. But calling the comedi API kicks me out of RT as indicated by /proc/xenomai/stat (column MSW). The modules loaded are:

Quoted 8 lines

comedi_fc 3584 1 ni_pcimio
kcomedilib 20868 0
comedi 33248 6 ni_pcimio, ni_tio, comedi_fc, mite, 8255, kcomedilib
licModule 44272 1 kcomedilib

The comedi modules are from a 2.6.20-14-ipipe/comedi/driver directory. How do I use the comedi API so that the task will stay realtime? What do I have to check?

You should have a look at the RT-capable comedi stack that currently only lives in Xenomai SVN trunk. How to get your device supported by that stack, ie. how to port the existing driver to RT-comedi, that's something Alexis can tell you more about. And/or have a look at the fake and loop drivers that are already included.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 ES-OS
Corporate Competence Center Embedded Linux
#2 lore raw

Hi,

Quoted 11 lines
Quoted 11 lines

I am using Xenomai 2.3.1 and comedi with driver "ni_pcimio". I am able to create a RT task that triggers each msec. But calling the comedi API kicks me out of RT as indicated by /proc/xenomai/stat (column MSW). The modules loaded are:

comedi_fc 3584 1 ni_pcimio
kcomedilib 20868 0
comedi 33248 6 ni_pcimio, ni_tio, comedi_fc, mite, 8255, kcomedilib
licModule 44272 1 kcomedilib

Quoted 8 lines
Quoted 3 lines

The comedi modules are from a 2.6.20-14-ipipe/comedi/driver directory. How do I use the comedi API so that the task will stay realtime? What do I have to check?

You should have a look at the RT-capable comedi stack that currently only lives in Xenomai SVN trunk. How to get your device supported by that stack, ie. how to port the existing driver to RT-comedi, that's something Alexis can tell you more about.

If you consider porting the ni_pcimio driver to the RTDM version of Comedi, please tell me; I am trying to do the same thing. You could save my time or I could save yours ;). Anyway, your help would be very valuable as I have no acquisition card...

Quoted 2 lines

And/or have a look at the fake
and loop drivers that are already included.

You can also have a look at the doxygen documentation available in the SVN trunk. The section "Comedi API -> Driver API" (driverfacilities) should help you.

Quoted 1 line

Jan

#3 lore raw

Hi!

At the moment I have not much time to look into the APIs, but we have some cards to test with: NI 6220, Adv 1751 and Adv 1720 (and maybe more). Of course I would test drivers for you, if there are any prototypes.

What's the effort on porting? Is there much to do or do I have to programm a driver from scratch? How do I have to imagine the structure of the whole project?

Xenomai ------------> Comedi API -> driver (e. g. ni_pcimio)

        |
        ---> RTDM --> Comedi RT API (part of Xenomai) -> RT driver

Is the Comedi API that is part of the Xenomai hierachy a Real Time substitute for the Comedi API of the original Comedi project? So porting is only a litte more than a simple recompile?

Is this correct? I would welcome any comments on this.

Greetings
Patrick Graebel

Signature · 8 lines
Universität Kassel
Fachbereich Elektrotechnik/Informatik
Fachgebiet Fahrzeugsysteme und Grundlagen der Elektrotechnik
Wilhelmshöher Allee 73
34121 Kassel

E-Mail: [email protected], Telefon: 0561 804-6264
GnuPG Fingerprint: 65B0 6282 5934 E2DC ADEB 6C2C CCEE 55FA 2C63 4E5C
#4 lore raw

Hi,

Quoted 8 lines

At the moment I have not much time to look into the APIs, but we have some cards to test with: NI 6220, Adv 1751 and Adv 1720 (and maybe more). Of course I would test drivers for you, if there are any prototypes.

What's the effort on porting? Is there much to do or do I have to programm a driver from scratch? How do I have to imagine the structure of the whole project?

The principles remain the same (subdevices, channels, ranges, commands, instructions, etc.). However, there are some differences in both APIs:
- the driver API has evolved a little bit (subdevice registration and asynchronous buffer access);
- the comedilib API has been reworked, the comedilib features range has been gathered into a smaller set of functions.

Consequently, integrating a driver from the original comedi framework into Xenomai's Comedi implies some slight modifications in the driver source. However, the whole module should not be rewritten.

And, converting your current program(s) into full RT application(s) is not a difficult task. You will have to update the Comedi functions calls. Ex.:
- comedi_data_read(), comedi_data_read_hint(), comedi_data_read_delayed() become comedi_sync_read()
- comedi_dio_read(), etc. => comedi_sync_read() too
- etc.

Quoted 3 lines

Xenomai ------------> Comedi API -> driver (e. g. ni_pcimio)

        ---> RTDM --> Comedi RT API (part of Xenomai) -> RT driver

On kernel side:
Xenomai nucleus <- RTDM skin <- comedi layer <- comedi driver

On user side:
RTDM user skin (Xeno syscalls) <- Comedilib library <- your user process

Quoted 3 lines

Is the Comedi API that is part of the Xenomai hierachy a Real Time substitute for the Comedi API of the original Comedi project? So porting is only a litte more than a simple recompile?

The comedi API available in Xenomai is not just a real-time substitute. The new comedi core fully relies on RTDM services; then, even an NRT task can use the new comedi framework.

Quoted 2 lines

Is this correct? I would welcome any comments on this.

Alexis.