[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Preemptable Interrupts

From: Grahame Kelly
Subject: [avr-gcc-list] Preemptable Interrupts
Date: Thu, 20 Feb 2003 16:25:04 +1100
User-agent: KMail/1.4.3

Hi Steve.

>> I'm trying to figure out how to make the SIG_UART_DATA and SIG_UART_RECV
>> signals preemptable.  I've got another interrupt that I want interrupt
>> the UART interrupts if it comes along.  I've also got other lower
>> priority interrupts that I don't want interrupting the UART interrupts.

Looking at your sample program, you don't have to disable lower priority
interrrupts as this is done automatically in hardware on AVR's. Take the
M16 chip for example. 

IntR    Function
4        Timer2 COMP
5        Timer2 OVF
6 ... 11
12   -  UART Rx Complete
13   -  UART - DATA
14   -  UART Tx Complete
15 ... 

Interrupts 0 ... 12 have higher priority over UART-DATA.
So, you don't have to disable any thing about #12 as they are 
automatically disabled by AVR internal h/w untill the AVR UART DATA
ISR returns. So, according to your code snippet you should only have to
disable the Timer2 interrupt.

Hence (assuming the only other activated interrupts below AVR UART DATA
is the Timer2 stuff );

    cbi(TIMSK, TOIE2); /* disable lower priority interrupt */
    sei(); /* turn interrupts back on */

    /* do stuff here, (minimal amount of code, of course) */

    sbi(TIMSK, TOIE2);

Hope this helps.
Cheers. Grahame

reply via email to

[Prev in Thread] Current Thread [Next in Thread]