AnsweredAssumed Answered

When to save ASTAT on a non-timer, non-IRQ interrupt

Question asked by AlexKates on Mar 12, 2010
Latest reply on Mar 15, 2010 by AlexKates

I see from the documentation that if I have a non-timer, non-IRQ ISR (on a SHARC ADSP-21369), that I need to save my ASTAT to prevent problems. And indeed, some irregular problems have been resolved by doing this.


I'm wondering, though, *when exactly* to save the ASTAT. In my interrupt IVT, I'm switching to alternate (MODE1) registers in the db of a Jump (db) to keep it atomic, and switching back in the db of rti(db). In both cases, the second db item is a nop.


However, currently, I am saving ASTAT after the jump, and restoring it before the jump. So it's:






    jump my_interrupt_function (db);    
    bit set MODE1 SRRFL | SRRFH | SRD1L | SRD1H | SRD2L | SRD2H; /* Enable all alternate registers. */
    nop;                            /* 1 nop required after switching "r" computation registers. */





     dm(old_ASTAT) = ASTAT;


         [lots of code involving registers, eq, ne, sz, etc]




    bit clr MODE1 SRRFL | SRRFH | SRD1L | SRD1H | SRD2L | SRD2H;     // NOTE: Disable all alt. registers.



Should I be saving ASTAT before changing register sets and after changing back? Maybe in the db?


Also: ASTAT restore causes a stall -- should I be adding a nop; after saving and/or restoring?