Re: Safe way to write interrupt driven circular buffer tx rx?
- From: "David T. Ashley" <dta@xxxxxxxx>
- Date: Wed, 29 Aug 2007 12:35:28 -0400
<cs_posting@xxxxxxxxxxx> wrote in message
news:1188395695.412412.51620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Aug 29, 8:21 am, "Sven" <S...@xxxxxxx> wrote:
Can someone point out source code for a safe circular buffer receiver
transmitter? It's for sending and receiving bytes via RS232.
What I do is let the interrupt process freely modify the buffer count
& head variables.
The interruptible process modifies the buffer variables in only one
small block of code, which is bracketed with interrupt disable &
enable instructions.
Just be aware that the critical section protocol depends on the "design
rules" for the entire embedded project.
The most common set of design rules is that for critical sections,
interrupts are disabled and enabled. The assumption is that the critical
sections will be short enough that they won't introduce any real-time
difficulties with the invocation of ISRs.
However, in some rare cases, someone may decide that a critical section
should block only interrupts of a certain type, but allow others. The
"design rules" might call for manipulating the only the SCI hardware to
implement the critical section, and only to prevent SCI interrupts.
The DI()/EI() protocol is not universally applicable, but it is nearly so.
Dave.
--
David T. Ashley (dta@xxxxxxxx)
http://www.e3ft.com (Consulting Home Page)
http://www.dtashley.com (Personal Home Page)
http://gpl.e3ft.com (GPL Publications and Projects)
.
- References:
- Prev by Date: Re: Any Russian Programmer...
- Next by Date: Re: Safe way to write interrupt driven circular buffer tx rx?
- Previous by thread: Re: Safe way to write interrupt driven circular buffer tx rx?
- Next by thread: Re: Safe way to write interrupt driven circular buffer tx rx?
- Index(es):
Relevant Pages
|