We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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) ;
Just a comment if you use inline, you should add two NOP's after disabling interrupts to allow for pipeline delays on the C167.
You can find more information here: http://www.keil.com/support/man/docs/c166/c166_xf_interrupts.htm