Discussion:
Question regarding ns16550
Daniel Gutson
2014-10-21 17:32:13 UTC
Permalink
Hi,

in the writing interrupt mode (ns16550_write_support_int), we have

for (i = 0; i < out; ++i) {
set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}

Shouldn't we check, before writing to the register for the iterations
after the first one,
whether the character entered in the FIFO? (otherwise I think the
'for' loop could iterate
so fast that the device had no time to process the character)

In such a case, something like


for (i = 0; i < out; ++i) {

/* Wait for transmitter holding register to be empty */
do {
status = get( port, NS16550_LINE_STATUS);
} while ((status & SP_LSR_THOLD) == 0);

set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}

would be better?

Thanks,

Daniel.
--
Daniel F. Gutson
Chief Engineering Officer, SPD


San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina


Phone: +54 351 4217888 / +54 351 4218211

Skype: dgutson
Sebastian Huber
2014-10-23 08:47:37 UTC
Permalink
Hello Daniel,

I never notice a problem with this driver. It should only write to the FIFO in
case it is completely empty. Did you observe problems?
Post by Daniel Gutson
Hi,
in the writing interrupt mode (ns16550_write_support_int), we have
for (i = 0; i < out; ++i) {
set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}
Shouldn't we check, before writing to the register for the iterations
after the first one,
whether the character entered in the FIFO? (otherwise I think the
'for' loop could iterate
so fast that the device had no time to process the character)
In such a case, something like
for (i = 0; i < out; ++i) {
/* Wait for transmitter holding register to be empty */
do {
status = get( port, NS16550_LINE_STATUS);
} while ((status & SP_LSR_THOLD) == 0);
set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}
would be better?
Thanks,
Daniel.
--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : ***@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Daniel Gutson
2014-10-23 16:12:31 UTC
Permalink
On Thu, Oct 23, 2014 at 5:47 AM, Sebastian Huber
Post by Sebastian Huber
Hello Daniel,
Hi Sebastian,
Post by Sebastian Huber
I never notice a problem with this driver. It should only write to the FIFO
in case it is completely empty. Did you observe problems?
no, I didn't (actually I found this while looking for a serial bug
which turned out to be due
to a different cause).
However, I notice that this isn't like what the polling write does (of
course I'm not talking
about the polling/interrput difference, but when writing byte-per-byte
to the FIFO, I think
both methods should do the same).
IOW, what happens if the 'for' loop is too fast for the device? Will
the latter be able to
put the char in the FIFO and be ready for the next one? Isn't
SP_LSR_THOLD exactly
to tell whether the device' FIFO is ready to accept the next byte?
Writing to the FIFO when it's completely empty is not the problem I
see since it is
guaranteed by the interrupt. My concern is different: it's whether the
FIFO is filled too fast
for the device.
Post by Sebastian Huber
Post by Daniel Gutson
Hi,
in the writing interrupt mode (ns16550_write_support_int), we have
for (i = 0; i < out; ++i) {
set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}
Shouldn't we check, before writing to the register for the iterations
after the first one,
whether the character entered in the FIFO? (otherwise I think the
'for' loop could iterate
so fast that the device had no time to process the character)
In such a case, something like
for (i = 0; i < out; ++i) {
/* Wait for transmitter holding register to be empty */
do {
status = get( port, NS16550_LINE_STATUS);
} while ((status & SP_LSR_THOLD) == 0);
set( port, NS16550_TRANSMIT_BUFFER, buf [i]);
}
would be better?
Thanks,
Daniel.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
--
Daniel F. Gutson
Chief Engineering Officer, SPD


San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina


Phone: +54 351 4217888 / +54 351 4218211

Skype: dgutson
Sebastian Huber
2014-10-24 05:33:57 UTC
Permalink
Post by Daniel Gutson
On Thu, Oct 23, 2014 at 5:47 AM, Sebastian Huber
Post by Sebastian Huber
Hello Daniel,
Hi Sebastian,
Post by Sebastian Huber
I never notice a problem with this driver. It should only write to the FIFO
in case it is completely empty. Did you observe problems?
no, I didn't (actually I found this while looking for a serial bug
which turned out to be due
to a different cause).
However, I notice that this isn't like what the polling write does (of
course I'm not talking
about the polling/interrput difference, but when writing byte-per-byte
to the FIFO, I think
both methods should do the same).
IOW, what happens if the 'for' loop is too fast for the device? Will
the latter be able to
put the char in the FIFO and be ready for the next one? Isn't
SP_LSR_THOLD exactly
to tell whether the device' FIFO is ready to accept the next byte?
Writing to the FIFO when it's completely empty is not the problem I
see since it is
guaranteed by the interrupt. My concern is different: it's whether the
FIFO is filled too fast
for the device.
Its not clear to me from the documentation if this is really necessary. I
never noticed problems on several targets with this driver.
--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : ***@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Loading...