Date: Wed, 16 Jul 2014 15:16:24 +0200 From: =?utf-8?q?Petr_Cervenka?= References: <20140716101817.B27E20C2@centrum.cz>, <53C64339.6060608@xenomai.org> <53C64535.7040607@xenomai.org> In-Reply-To: <53C64535.7040607@xenomai.org> MIME-Version: 1.0 Message-Id: <20140716151624.A55388E5@centrum.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Xenomai] =?utf-8?q?Library_calls_in_real-time_thread?= List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?q?Philippe_Gerum?= , Xenomai >On 07/16/2014 11:17 AM, Philippe Gerum wrote: >> On 07/16/2014 10:18 AM, Petr Cervenka wrote: >>> Hello I have a problem with EtherCAT slave device. >>> It was supplied with a small driver (including sources), which uses uio and a library (without sources). >>> The library consists of some initialization and configuration functions. >>> It also includes one blocking function which represents "state machine" of the device. This function blocks until another stopping function is called. >>> During configuration, there is a possibility to pass some pointers to user defined callback functions. So everything is controlled from those callbacks. >>> The blocking function is called from xenomai real-time thread and I don't expect that the library creates another. >>> My problem is occasional high latencies of those callback, probably because of system calls in the library which switch it to the secondary mode. >>> I would like to know what are the possibilities to make it hard real-time. >>> I could probably port the device driver and uio driver to rtdm. But what has to be done with the library? I'm in contact with its developers, so I could suggest them to make necessary changes. >> >> Basically, the real-time sensitive part of the library should refrain >> from calling any glibc service that might entail a regular linux syscall >> at some point, except those which can be mapped to a corresponding >> Xenomai service, such as RTDM entry points. For a character device, this >> means open, read, write, ioctl, close... would be ok typically. >> Thank you. I didn't know, that there are such possibilities. I have seen the .../lib/posix.wrappers file. Does it mean that all those functions from that file have wrapped in pthread_rt? I already know that the EtherCAT library contains: select usleep (wrap it to use clock_nanosleep?) mmap putchar gettimeofday and of course some of those mentioned by you before. Which of them are already real-time? > >In the particular case of mmap() which is not wrapped by RTDM over >Xenomai 2.x and which the regular uio driver provides support for, you >would probably need to wrap this symbol yourself, routing requests to >your RTDM-based uio driver via a dedicated ioctl() call. > I understand. Something about it was already discussed for example here: http://www.xenomai.org/pipermail/xenomai/2013-March/027926.html Petr