2008-11-07 05:02:49     Xenomai and user application

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-11-07 05:02:49     Xenomai and user application

Daniele Pagani (ITALY)

Message: 64819   

 

Sorry for probabily stupid questions,

 

I'm writing an application using Xenomai api rt_dev_read and so on:

 

1) Can I use them (these functions) with any char device driver?

 

2) what is the path for #include rtdm.h ?

 

Blackfin Stamp Bf 537 - uClinux-dist-2008R1.5-RC3

 

Regards,

 

Daniele.

 

 

TranslateQuoteReplyEditDelete

 

 

2008-11-07 07:25:55     Re: Xenomai and user application

Yi Li (CHINA)

Message: 64828   

 

1) yes.

 

2) In user application, include <rtdm/rtdm.h> (Assume you have install the headers and library correctly).

 

In fact, you can find examples by the author of RTDM in /user/xenomai/xenomai-2.4.0/examples/rtdm.

 

-Yi

QuoteReplyEditDelete

 

 

2008-11-07 07:48:47     Re: Xenomai and user application

Yi Li (CHINA)

Message: 64831   

 

1) Sorry, should be NO. The driver should be written according to RTDM API (define struct rtdm_device and implement related function calls).

 

Depending on the context when calling rt_dev_read() (in RT context or Non-RT) context), the call will finally invoke read_rt() or read_nrt() defined in struct rtdm_device.ops.

 

-Yi

QuoteReplyEditDelete

 

 

2008-11-07 08:09:02     Re: Xenomai and user application

Daniele Pagani (ITALY)

Message: 64834   

 

Dear Yi,

 

I select Xenomai in menuconfig, according to http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:adeos

 

Then, I've not problem during compilation.

 

Anyway, I need to add -I/mnt/uClinux-dist-2008R1.5-RC3/linux-2.6.x/include/xenomai/rtdm/ ...

 

in order to use

 

#include <rtdm.h>

 

so I think that I've not the right PATH (how could I repair it?)

 

I've also the same problem with library, of course.

 

Then, I want to use the sport driver; so I suppose that I can use rt_dev_open and so on...

 

So, if I understand, I can use these functions only if I've developed the driver according to RT?

 

Sorry, but I'm a little confused.

 

Best regards,

 

Daniele.

TranslateQuoteReplyEditDelete

 

 

2008-11-07 10:38:25     Re: Xenomai and user application

Yi Li (CHINA)

Message: 64842   

 

Daniele,

 

For the include path and library path:

 

If looking at user/xenomai/Makefile, you can find:

 

$(MAKE) -C build-$(VER) install DESTDIR=$(STAGEDIR)

 

Here we install the xenomai headers and library in the $(STAGEDIR) (i.e uclinux-dist/staging). You can choose your DESTDIR and build/install xenomai of cause.

 

To develop kernel drivers, yes, you need to use headers in linux-2.6.x/include/xenomai.

 

And yes, system calls like rt_dev_read() finally calls into your RT driver, where you defined your read_nrt() and/or read_rt() funtions. If rt_dev_read() is called in RT context, read_rt() will be call, otherwise read_nrt().

 

The difficulty to write a RT driver is that, e.g, if you want to implement read_rt(), you need to make sure every functions in read_rt() (e.g, kmalloc()..) can safely be called in Read Time context, that is, the execution path is predictable. The functions cannot sleep in  normal  Linux domain,  the function cannot damage shared resources used by other Linux threads.

 

You may refer to: /user/xenomai/xenomai-2.4.0/ksrc/drivers/serial/1655A.c. This is a real-world serial driver written in RTDM.

 

I'd suggest you ask questions on the xenomai mailing list, since there are many experts there.

 

-Yi

QuoteReplyEditDelete

 

 

2008-11-07 10:48:47     Re: Xenomai and user application

Daniele Pagani (ITALY)

Message: 64843   

 

Dear Yi,

 

thank you very much for your support.

 

Regards,

 

Daniele.

Attachments

    Outcomes