Am Mittwoch, den 07.04.2010, 13:31 +0200 schrieb Philippe De Muyter:
> On Tue, Apr 06, 2010 at 10:45:51AM +1200, Gavin Lambert wrote:
> > Quoth Andrew Kohlsmith:
> > > > I would hate to try and do it from software with an interrupt.
> > > > Yuck.
> > > 
> > > It's not that bad. :-)  IRQ on transmit holding or shift register
> > > empty (ideally the latter). If you have only a THRE type interrupt
> > 
> > > then you have to set a timer for 1 word time (usually 9 bits) and 
> > > after that timer, disable the transmitter. Of course when you go 
> > > to send data again you have to make sure you turn on the 
> > > transmitter.
> > 
> > We've gone that route, for a master device (ie. other hardware will
> > start transmitting back on the half-duplex channel almost
> > immediately after the end of transmission) and had no end of trouble
> > with getting the interrupt processed in time to avoid corrupting the
> > reply.  And this was on a board that wasn't even running an OS, so
> > demands were relatively light.  Sure, it worked fine *most* of the
> > time, but that's not good enough. :)  (Of course, it also had a
> > pretty low-spec CPU, which didn't help.)
> > 
> > We eventually switched to a UART that had hardware control of that
> 
> I have just discovered that there are now 'standard' linux ioctls to
> work with rs485 lines : TIOCGRS485 & TIOCSRS485.
> 
> (see 
> http://git.kernel.org/?p=linux/kernel/git/gerg/m68knommu.git;a=commitdiff;h=c26c56c0f40e200e61d1390629c806f6adaffbcc)
> 
> Of course, not all hardware drivers implement them.
> 
> And also, I do not know how to use them.
> 
> Philippe

I found this example that seems to use those new ioctls:

http://foxlx.acmesystems.it/?id=28

If you look into this example, it doesn't look promising because RTS is
released by a call from userspace after sending. I can't see much
advantage over using tcdrain() and releasing RTS afterwards, if tx_empty
is implemented correctly by the serial driver.

-Erwin

_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to