Xenomai real time driver and normal linux driver mutual exclusion

Wolfgang Denk wd at denx.de
Mon Mar 12 10:46:49 EST 2007


In message <20070311215705.59806.qmail at web63001.mail.re1.yahoo.com> you wrote:
>
> I have an I2C bus, some devices should be controlled by a normal
> linux driver but an ADC and a DAC on this bus should be controlled by
> a real time xenomai driver because, after a READ from the DAC I have
> to write to the ADC every 500 usec. I tried to use the normal linux
> driver from a xenomai real time user mode task but reading DAC, doing
> some computations, and writing to the ADC takes more than 500 usec. I

And what makes you think that a real-time driver would be any faster?
Real-time does not mean speed,  it  means  reliable  and  predictable
deadlines.

Do some basic calculations. You have a ADC plus  a  DAC,  that's  two
devices.  You  need  to  read and write both? Assume the read needs 2
bytes addressing and returns 4 bytes of data, and the write  needs  6
bytes, too. That's 12 bytes per device, or 24 bytes in total.
How fast is your I2C bus? 400 kHz?
2 devices * 12 bytes * 8 Bit / 400 kHz = 480 usec.

And you got 500 usec in total? On a 8xx? Arghhhh...

And this does not include *any* delays caused by your ADC and DAC, it
does  not  include  any  latencies  and  time  needed  for  interrupt
processing  (assume  50...100  usec  on a 8xx - or more), it does not
consider that you probably have to transfer more bytes, etc.

In short: this looks much like a "can't be done" situation.

> thought to write both a RTDM driver for my 8xx I2C controller and a
> normal linux driver, but, how may I serialize access to the 8xx I2C
> controller from these drivers?

That would just slow down things even more.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The greatest threat towards future is indifference.



More information about the Linuxppc-embedded mailing list