This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: is cyg_io_read atomic process


On Wed, Mar 09, 2005 at 06:23:32PM -0800, steve smith wrote:
> if I do cyg_io_read in a lower priority thread, and once the
> cyg_io_read starts reading the buffer will it get preempted in the
> middle of the reading by a higher priority thread(which has become
> ready to execute) OR an interrupt? or is it an atomic process?
> I am using a AT91R40006 micro, with the hardware serial driver for the
> cyg_io_read.
> thanks.

Interrupts can happen. 

There are multiple buffers involved. eg the hardware itself will have
a buffer and the driver keeps a buffer of charactors which have been
received but not yet read by a thread. This buffer has a mutex so
preventing two readers reading the buffer at once.

DSR are also locked when performing the copy from the buffer into the
readers buffer. This will in effect stop context switches since they
are triggered from DSRs, but this is just during the read from the
buffer.

If you are doing a read and there are no charactors to read, it then
blocks and a context switch can happen, but thats obvious....

        Andrew



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]