[En-Nut-Discussion] Proposal: Extending the USART(AVR) driver to support DMA-style read functionality
Clemens Kirchgatterer
c.kirchgatterer at amatic.com
Tue Apr 13 11:45:38 CEST 2004
Matthias Ringwald <mringwal at inf.ethz.ch> wrote:
> On 13.04.2004, at 07:23, Clemens Kirchgatterer wrote:
>
> >> 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.
> >> it should be clear that this is not very efficient... :)
> >
> > you will only receive just one byte under low load and then it just
> > does not matter if there are some cycles wasted for each iteration.
> > this is the way it is under posix also. sounds like "premature
> > optimization" to me. ;-)
>
> ok, that one is correct.
>
> what about my other case: the thread that processes the uart packets
> has a high priority but there are other tasks, too?
> then every byte will be received seperately leaving no time to lower
> priority threads.
i don't think so, because we do not have preemtive multitasking.
if your low priority thread gets sheduled in the first place, you have
all time you need.
i could be a problem, when you hook the cpu for a very long time after
read() has returned, then there might be the next byte allready waiting
in the buffer and then the sheduler might call you right again. i dunno
if this is possible with the nutos sheduler implementation. anyway IMHO
the sheduler should take care about such possiblilities.
> I do see, that the question would be if the uart thread should have
> the highest priority..
serial io is usually not very time consuming, thus your second low
priority thread should get sheduled at some point in time, i think.
maybe any of the nutos experts could comment on this?
regards ...
clemens
More information about the En-Nut-Discussion
mailing list