Petr Cervenka wrote:
> The problem was in my calling "RT" task. I forgot to switch the new
> created task to PRIMARY MODE, because I didn't know it's neccessary.

As Philippe said, it isn't usually required - with exceptions. Let me
first sketch the standard situation: You registered a read_rt handler
with your device, but no read_nrt. If your application now calls
rt_dev_read (or just read() for the POSIX skin) from the "wrong"
context, RTDM will detect the missing _nrt handler and trigger an
automatic switch to primary mode (and vice versa). So, no need for
manual switching in the standard case.

But if you had registered handlers for both contexts, RTDM will always
invoke the one for your current mode. This means your _nrt handler must
handle this mode correctly! This "sticky" behaviour was invented to
allow providing services both with and without strict determinism. RT
handler may allocate required resources from pre-allocated but limited
pools, NRT handlers are free to use Linux services for this. This is
used in practice e.g. by the 16550A driver or RTnet.

It may appear a bit tricky for IOCTL handlers to implement this scheme,
as the actual service demultiplexing happens inside the handler, and
there might be some IOCTLs exclusively for RT and some only for NRT. In
this case, just reject wrong context invocations by returning -ENOSYS.
RTDM will then re-invoke the service after toggling the context. See the
IOCTL handling of the timerbench driver as example.

> I still have same problems with porting the driver, but I think I can
> handle them myself.
> Thanks for your help.
> Petr Cervenka
> 

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to