[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] generic queue library for AVR GCC?
From: |
gouy yann |
Subject: |
Re: [avr-gcc-list] generic queue library for AVR GCC? |
Date: |
Thu, 11 Nov 2004 23:34:03 +0100 (CET) |
I'm using it with a preemptible multi-tasks kernel of
my own and I've never notice any problem.
I have taken care the tests and modifications of the
number of elements in the fifo to be done in the right
sequence, up to now it seems sufficient for reading
and writing characters from the USART or for
inter-tasks communication.
bye.
Yann
--- Geoffrey Wossum <address@hidden> a écrit :
> On Thursday 11 November 2004 1:32 pm, gouy yann
> wrote:
>
> > here is my implementation of a fifo.
> > I hope this will help you.
>
> I took a quick look at these routines. I noticed
> that they lack any type of
> "critical section" around where the queue data and
> pointers are modified.
> Calling these routines as-is from an ISR context and
> from a non-ISR context
> might result in race conditions and odd,
> intermittent behavior.
>
> Here's my critical section routines. The enter just
> pushes the global
> interrupt state and then disables interrupts, the
> exit pops the interrupt
> state. Observant list readers might note an uncanny
> resemblance to NutOS's
> critical section code...
>
> extern inline void utos_enter_cs(void)
> {
> asm volatile(
> "in __tmp_reg__, __SREG__" "\n\t"
> "push __tmp_reg__" "\n\t"
> "cli" "\n\t"
> );
> }
>
> extern inline void utos_exit_cs(void)
> {
> asm volatile(
> "pop __tmp_reg__" "\n\t"
> "out __SREG__, __tmp_reg__" "\n\t"
> );
> }
>
> Since these routines push and pop from the stack,
> you have to be careful to
> balance them within a function. I'll leave where to
> insert them into the
> code as an exercise to the reader ;)
>
> Maybe lack of critical sections is the problem with
> the original posters code?
>
> ---
> Geoffrey Wossum
> Long Range Systems - http://www.pager.net
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
>
=====
Vous manquez despace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour
dialoguer instantanément avec vos amis. A télécharger gratuitement sur
http://fr.messenger.yahoo.com
- [avr-gcc-list] generic queue library for AVR GCC?, David Morrison, 2004/11/11
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/11
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Ned Konz, 2004/11/11
- Re: [avr-gcc-list] generic queue library for AVR GCC?, gouy yann, 2004/11/11
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Bruce D. Lightner, 2004/11/15
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/15
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Bruce D. Lightner, 2004/11/15
- Re: [avr-gcc-list] generic queue library for AVR GCC?, E. Weddington, 2004/11/15
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Richard Urwin, 2004/11/16
- Re: [avr-gcc-list] generic queue library for AVR GCC?, gouy yann, 2004/11/16
- Re: [avr-gcc-list] generic queue library for AVR GCC?, Bjarne Laursen, 2004/11/16
- Re: [avr-gcc-list] generic queue library for AVR GCC?, David Brown, 2004/11/16