vUSBInterruptHandler:
portSAVE_CONTEXT
jal USBDeviceTasks
nop
portRESTORE_CONTEXT
.end vUSBInterruptHandler
of course with the interrupt mapped in the .C file like this:
#pragma interrupt vUSBInterruptHandler ipl3 vector 45
In the actual C that is called (in this case, the Microchip USB device ISR-not-as-an-ISR function
USBDeviceTasks
), there is no special coding until we do the enqueue.. where we record if a high priority task is waiting.
Here’s where it gets interesting. At the end of that C function, we of course add:
portEND_SWITCHING_ISR( xSwitchRequired );
Now, is that really correct? we’re calling the yield but we have’t “unwrapped” in the assembly wrapper the portRESTORE_CONTEXT, so we’re yielding whilst the stack is switched to the system stack.
Are there any issues there? We seem to be getting some odd behaviour when we take this approach and we’re trying to ensure we understand the proper flow so as not to chase ghosts.
ThanksThe Serious Team