All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean McGranaghan <smm@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] Best way to port device driver to RTAI/fusion
Date: Thu, 13 Oct 2005 10:28:16 -0400	[thread overview]
Message-ID: <434E6F00.9090805@domain.hid> (raw)

Hello all,

My name is Sean McGranaghan, I am a software engineer working in 
Rochester, NY. USA. I have recently been tasked with porting a standard 
Linux driver to the RTAI/fusion environment. I have RTAI/fusion 0.8.3 up 
and running with a 2.6.13 kernel. I have a couple general questions, 
followed by my specific problem. I apologize for the length of this post 
in advance, this is my first foray into RTAI/fusion. Please direct this 
message as appropriate.

When a realtime RTAI native or LXRT task performs io using a vanilla 
Linux driver, does it retain its realtime scheduling priority via the 
nucleaus scheduler or is the task demoted to the non-realtime domain 
i.e. the Linux scheduler? Assume the vanilla Linux driver uses 
wake_up_interruptible() to wake Linux tasks.

Is there a standard approach to making a driver "realtime"? I would 
assume replacing the interrupt handling, synchronization and task 
scheduling calls with RTAI/fusion equivalents would be the approach to 
take. How does this affect the file operations interface in Linux? 
(open(), close(), read(), write(), ioctl() etc.) Is this driver still 
usable by non-realtime Linux tasks?

My specific problem is to make an existing Linux driver "realtime". 
(Vague requirement I know.) The driver is for an ISA CAN bus card. The 
card contains two CAN controllers using two irqs. My first step was to 
try and get the irq handling under nucleus control. I replaced 
request_irq() and related Linux irq calls with rt_intr_create() and 
such. I was then going to look at replacing the Linux 
spin_lock_irqsave()/spin_unlock_irqrestore() and wake_interruptble() 
calls if needed. I am currently having problems with the first step.

I test the driver with a loopback cable between the two channels. In the 
pure Linux driver I send and receive datagrams with no problem. I 
receive a transmit complete interrupt immediatly followed by a message 
received interrupt for each datagram sent. When I replace the interrupt 
handling with RTAI/fusion calls I seem to be missing the receive 
interrupt. I have looked at the CAN controller register contents and 
they are consistant between the vanilla driver and realtime driver. I am 
currently trying to look at the 8259 PIC controller register contents to 
see how the interrupt handling differs. I suspect that the mixing of 
nucleaus interrupt handling and Linux spin locks (irq save/restore) is 
fouling up the PIC, but I can't prove this yet. Is there any benefit to 
moving the interrupt handling to the realtime domain?

Any help is greatly appreciated.

Thanks,
Sean McGranaghan




             reply	other threads:[~2005-10-13 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 14:28 Sean McGranaghan [this message]
2005-10-13 14:50 ` [Xenomai-help] Best way to port device driver to RTAI/fusion Jan Kiszka
2005-10-13 15:05 ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=434E6F00.9090805@domain.hid \
    --to=smm@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.