}\r
/*-----------------------------------------------------------*/\r
\r
-void vPortYield( void )\r
-{\r
-unsigned portLONG ulStatus;\r
-\r
- SetCoreSW0();\r
-\r
- /* Unmask all interrupts. */\r
- ulStatus = _CP0_GET_STATUS();\r
- ulStatus &= ~portALL_IPL_BITS;\r
- _CP0_SET_STATUS( ulStatus );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
void vPortIncrementTick( void )\r
{\r
unsigned portBASE_TYPE uxSavedStatus;\r
#include <sys/asm.h>\r
#include "ISR_Support.h"\r
\r
-#define portEXC_CODE_MASK ( 0x1f << 2 )\r
\r
.set nomips16\r
.set noreorder\r
la sp, xISRStackTop\r
lw sp, (sp)\r
\r
- /* Increment and save the nesting count in case this gets preempted. */\r
+ /* Set the nesting count. */\r
la k0, uxInterruptNesting\r
- lw s6, (k0)\r
- addiu s6, s6, 1\r
+ addiu s6, zero, 1\r
sw s6, 0(k0)\r
\r
/* s6 holds the EPC value, this is saved with the rest of the context\r
/* Protect access to the k registers, and others. */\r
di\r
\r
- /* Decrement the nesting count. */\r
+ /* Set nesting back to zero. As the lowest priority interrupt this\r
+ interrupt cannot have nested. */\r
la k0, uxInterruptNesting\r
- lw k1, (k0)\r
- addiu k1, k1, -1\r
- sw k1, 0(k0)\r
+ sw zero, 0(k0)\r
\r
/* Switch back to use the real stack pointer. */\r
add sp, zero, s5\r
/* Restore the real s5 value. */\r
lw s5, 40(sp)\r
\r
- /* If the critical nesting is not zero and a yield is not pended\r
- then set status as if within a critical section. */\r
+ /* Pop the status and epc values. */\r
lw k1, portSTATUS_STACK_LOCATION(sp)\r
lw k0, portEPC_STACK_LOCATION(sp)\r
\r
/* Critical section management. */\r
#define portIPL_SHIFT ( 10 )\r
#define portALL_IPL_BITS ( 0x3f << portIPL_SHIFT )\r
+#define portSW0_BIT ( 0x01 << 8 )\r
\r
#define portDISABLE_INTERRUPTS() \\r
{ \\r
/*-----------------------------------------------------------*/\r
\r
/* Task utilities. */\r
-extern void vPortYield( void );\r
-#define portYIELD() vPortYield()\r
\r
-#define portNOP() asm volatile ( "nop" )\r
+#define portYIELD() \\r
+{ \\r
+unsigned portLONG ulStatus; \\r
+ \\r
+ /* Unmask all interrupts. */ \\r
+ ulStatus = _CP0_GET_CAUSE(); \\r
+ ulStatus |= portSW0_BIT; \\r
+ _CP0_SET_CAUSE( ulStatus ); \\r
+}\r
+\r
+\r
+#define portNOP() asm volatile ( "nop" )\r
\r
/*-----------------------------------------------------------*/\r
\r