Re: Safe way to write interrupt driven circular buffer tx rx?
- From: Stefan Reuther <stefan.news@xxxxxxxx>
- Date: Wed, 29 Aug 2007 18:54:38 +0200
cs_posting@xxxxxxxxxxx wrote:
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.
You can avoid that interrupt disable by using head and tail variables
instead of head and count. The interrupt would then modify only the head
(and read the tail to check for overflow), the interruptible process
would modify only the tail (and read the head to check whether anything
is in the buffer).
Stefan
.
- Follow-Ups:
- Re: Safe way to write interrupt driven circular buffer tx rx?
- From: Dave Hansen
- Re: Safe way to write interrupt driven circular buffer tx rx?
- References:
- Prev by Date: Re: Safe way to write interrupt driven circular buffer tx rx?
- 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):