SCS,
I tried that first, but was having issues with ISR's disabling interrupts.
Anyway, I revisited disabling interrupts and tested exhaustively and seems fine now.
So Thanks!
Here are some NiosI macros if anyone is interested.
BTW, is there a doc with all the asm syntax? I'd like to assign stat as the return value.
# define get_status_reg(stat)
{
unsigned int status;
asm("rdctl %0" : "=r" (status));
stat = status;
}
# define disable_interrupts()
asm("PFX 8" );
asm("WRCTL %g0");
# define enable_interrupts()
asm("PFX 9" );
asm("WRCTL %g0");
# define interrupts_enabled(stat)
{
unsigned int status;
asm("rdctl %0" : "=r" (status));
stat = status & 0x8000;
}