anonymous wrote on Sunday, December 24, 2006:
In order to have a single generic ISR dispatch routine, I have added a function to tasks.c that returns the priority of the highest priority ready task.
unsigned portBASE_TYPE TopPriority(void)
My generic dispatch routine captures this priority before dispatching to the proper ISR. When the ISR returns, it tests whether the highest priority has changed. If so, it calls for a context switch, else it doesn’t.
unsigned portBASE_TYPE prevTopPriority = TopPriority();
I wonder if anyone has any comments on issues/problems this may raise.
One point is that this subverts time slicing between tasks of equal priority. Using <= rather than < in the final test would be similar to time slicing, although not quite the same.