Forum Discussion
Altera_Forum
Honored Contributor
19 years ago --- Quote Start --- originally posted by hippo@Nov 7 2006, 12:47 AM look in include/asm (ie, asm-nios2nommu) /system.h
use,
local_irq_save(x) // to disable global irq
then,
local_irq_restore(x) // to enable/restore global irq
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19239)
--- quote end ---
--- Quote End --- Thank you, hippo! F.Y.I. Use the macro COMPARE_AND_SWAP in stead of the function compare_and_swap. E.g. static inline int __compare_and_swap(volatile int *p, int old_val, int new_val) { int result; unsigned long int_context; /* save int. and disable all interrupts */ local_irq_save(int_context); result = compare_and_swap((volatile long*)p, old_val, new_val); /* re-enable interrupt */ local_irq_restore(int_context); return result; } # define COMPARE_AND_SWAP(addr, old_val, new_val) __compare_and_swap(addr, old_val, new_val) http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif