[En-Nut-Discussion] Proposal: Extending the USART(AVR) driver to support DMA-style read functionality

Harald Kipp harald.kipp at egnite.de
Thu Apr 15 20:26:40 CEST 2004


Hi Matthias,

sorry for not immediately responding.

[...]
>for every received byte, the thread would wake up,
>get its one byte, figure out that the packet is not finished
>call read and be put to sleep again.

Right, but the good thing is, if there's something else to do,
more bytes will be collected. But in general I agree.

[...]
>a/my solution:
>
>I would like to add an ioctl call that changes the semantic
>of read from
>[current]: at least one byte is read or timeout occured to
>[new:] all bytes are read or timeout occured.
>(if timeout occured, the return value [nr of read bytes]
>would be lower then the count value)

Many RS232 drivers support two timeouts, the one for the
first character, which may be long or infinite. And a second
timeout after the first byte had been received. This would
also solve situations, where you do not know the length
of the telegram in advance.

[...]
>the benefit of this is:
>reducing the number of read calls reduces the nr of thread
>switches, which leads to savings in processing power depending
>on the cpu load and the packet size.

Agreed.

Harald




More information about the En-Nut-Discussion mailing list