Thank you for your comments:
The PIC24E series requires 1 instruction after writing to SR before interrupts are actually disabled.
To ensure correctness I have added an __asm volatile( “NOP” ) after the write to the SR.
The following all relate to saving/restoring stuff in _T1Interrupt and depend on how “always correct” it should be.
The DC flag is not saved/restored in _T1Interrupt.
This is probably in the technically correct, but who cares category
Let me know if you think it is an issue.
In the non-DSP PICs the PSV flag (in CORCON) is not saved/restored
I could not find any example of Microchip bothering to save/set this in any examples
I think this was discussed some years ago (the PIC24 ports are quite old now) and it was decided to leave it like this. I can’t quite remember the rationale now, but it will be in the archive somewhere.
In the dsPICs the PSV flag (in CORCON) and MODCON are not saved/restored
If the DSP instructions are actually used MODCON needs to be saved restored and if the functions in libdsp are called then the PSV flag needs to be saved/restored and set to 1 in the interrupt
Likewise I think these were discussed at the same time regarding how far to go in making the DSP functionality thread safe. I will need to look up the discussion and re-familiarise myself with the architecture to comment fully.
Regards.