This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is this code interrupt safe?

Hi all,
I check the assembly and I think that the call to

interrupt_safe_assign_ulong

(see below) is indeed interrupt safe but I am not sure (I am refering to the use of the static variable 's_long' as a parameter). Can you help me?

Thanks in advance

static unsigned long s_long ;

void store_and_disable_interrupts(unsigned short *a_interrupts)
{
        *a_interrupts = IEN ;
        IEN = 0 ;
}

void restore_interrupts(unsigned short a_interrupts)
{
        IEN = a_interrupts ;
}

void interrupt_safe_assign_ulong(unsigned long *a_target, const unsigned long *a_source)
{
        unsigned short  l_interrupts ;

        store_and_disable_interrupts(&l_interrupts) ;
        *a_target = *a_source ;
        restore_interrupts(l_interrupts) ;
}
.
.
.
interrupt_safe_assign_ulong(&l_long, &s_long) ;

Parents Reply Children
No data