Question regarding ns16550

Daniel Gutson daniel.gutson at tallertechnologies.com
Thu Oct 23 16:12:31 UTC 2014


On Thu, Oct 23, 2014 at 5:47 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> Hello Daniel,

Hi Sebastian,

>
> 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.


>
> On 21/10/14 19:32, Daniel Gutson wrote:
>>
>> 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  : sebastian.huber at embedded-brains.de
> 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



More information about the devel mailing list