maxim79 wrote on Thursday, April 24, 2008:
I have no implementation of taskYIELD_FROM_ISR for a SAM7X processor, but I’ll give you an idea how you can easily implement it on any ARM processor.
To yield from an ISR is a bit problematic because the ISR should return and leave the stack pointer & C.O. in the same state as before entering the ISR.
taskYIELD_FROM_ISR can be realized by raising a software interrupt in VIC. Choosing this implementation you should carefully use nested interrupts if at all. You can even use the same ISR as for the timer interrupt:
__asm void vPortTimerISR(void)
bl [C-function: if not SOFT interrupt -> call vTaskIncrementTick(), else clear SOFT interrupt]
To make the context switch a bit faster you can use separate ISRs:
- timer ISR: performs context switch, increments OS tick, clears timer interrupt
- software ISR: performs context switch, clears software interrupt
I hope it will help you