| 35 | |
| 36 | |
| 37 | === void _ctx_switch() === |
| 38 | This function performs a context switch between the running (calling) task and another runable task, using a round-robin sheduling policy between all tasks allocated to a given processor (static allocation). |
| 39 | It selects the next runable task to resume execution. |
| 40 | If the only runable task is the current task, return without context switch. |
| 41 | If there is no runable task, the scheduler switch to the default "idle" task. |
| 42 | The return address contained in $31 is saved in the current task context (in the ctx[31] slot), and the function actually returns to the address contained in the ctx[31] slot of the next task context. |
| 43 | |
| 44 | === void _ctx_eret() === |
| 45 | The address of this function is used to initialise the return address in the "idle" task context. |
| 46 | |
| 47 | === void _idle_task() === |
| 48 | This function is executed task when no other task can be executed. |