This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: is cyg_io_read atomic process
- From: Andrew Lunn <andrew at lunn dot ch>
- To: steve smith <mister dot steve dot smith at gmail dot com>
- Cc: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 10 Mar 2005 09:29:19 +0100
- Subject: Re: [ECOS] is cyg_io_read atomic process
- References: <3096899505030918237a6be9d@mail.gmail.com>
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