Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Nested enable/disable interrupt problem !!!

2006-05-14 by vlads4377

Hi,

Nested enable/disable interrupt problem !!!

f_1 ()
{ 
   __disable_interrupt()

   f_2 ();
A:
   __enablea_interrupt()
}

f_2 ()
{
      __disable_interrupt()

      __enable_interrupt()
}

The problem is that at point A: f_1() assumes that interrupts are 
disabled, but f_2() already enabled the interrupts.

Optional solution is something like this:

f_2 ()
{
    char int_ret = 0;
    int_ret =  disable_interrupt()

    enable_interrupt( int_ret )
}
int_ret holds interrupt status (CPSR interrupt bit) before the 
disable operation.

enable_interrupt( int_ret ) enables the interrupt just in case that 
int_ret == "interrupt was enabled"

1. Does any body has asm source for this solution ?.
2. Any better solution ?

Regards

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.