io-char problem.

Hi all,

I am confronted to a lack of documentation regarding the io-char serial
interface.
Every driver that uses io-char (linking with it) have to define a tto()
function to
handle various messages like TTO_DATA corresponding to some char data
that the driver have to send, TTO_CTRL corresponding to some settings for
a specific serial line ( baud rate, … ), … This functions IS called
directly
by the NTO interface io-char.

As i am developping a driver for a serial card i have to implement such a
function.
But i have some problems with the meaning of one specific type of message.

Some of the TTO_CTRL sub-messages, that the driver has to handle
correspond to “Start a Drop Line”, “End a DropLine”, “Start a Break”, …

In order to “Start a Break”, io-char calls the user defined function tto()
with the argument TTO_CTRL and with a sub-argument (representing
the exact control demand).

This sub argument is either _CTL_BRK_CHG for a Break demand (either
start or end), _CTL_DTR_CHG for a DropLine argument, …

To know if you have to End or Start a demand io-char logically “or”
this previous macro with another macro : _CTL_DTR, _CTL_BRK, …

My problem is that i do not understand the meaning of these latter macros.
Do they correspond to a End demand or a Start demand ?

When io-char calls tto() like this :

tto(dev, TTO_CTRL, _CTL_BRK_CHG | 0);

does it correspond to a “Start Break” demand ?

and :

tto(dev, TTO_CTRL, _CTL_BRK_CHG | _CTL_BRK);

correspond to a “End Break” ?

Or is it the contrary ?

One specific io-char file messes me up : “timer.c”. Here is the code :

// Output and Control timers
if(dev->un.tmrs) {
// End a break.
if(dev->un.s.brk_tmr && --dev->un.s.brk_tmr == 0) {
tto(dev, TTO_CTRL, _CTL_BRK_CHG | 0);
}

// End a dropline.
if(dev->un.s.dtr_tmr && --dev->un.s.dtr_tmr == 0) {
tto(dev, TTO_CTRL, _CTL_DTR_CHG | _CTL_DTR);
}

// End a spare timed event.
if(dev->un.s.spare_tmr && --dev->un.s.spare_tmr == 0) {
tto(dev, TTO_CTRL, _CTL_TIMED_CHG | 0);
if (dev->flags & EVENT_DRAIN)
check_drain(ctp, dev);
}

// Work around bug in some parts which loose transmit interrupts.
if(dev->un.s.tx_tmr && --dev->un.s.tx_tmr == 0) {
tto(dev, TTO_DATA, 0);
}
}


io-char calls tto(). But in two cases ( “End a break” and “End a spare
time” )
to achieve a END demand the logical “or” is made with a zero value
although in the other case the END demand is made with a macro ( _CTL_DTR )
!!
It does not seem logical …

Do you see my point ?


thank you very much for your answer …


Alexandre Abreu