#define portFLOP_REGISTERS_TO_STORE ( 18 )\r
#define portFLOP_STORAGE_SIZE ( portFLOP_REGISTERS_TO_STORE * 4 )\r
\r
+/* Tasks should start with interrupts enabled, therefore PSW is set with U,I,PM \r
+flags set and IPL clear. */\r
+#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00130000 )\r
+#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 )\r
+\r
+\r
/*-----------------------------------------------------------*/\r
\r
/*\r
*/\r
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
{\r
+ /* R0 is not included as it is the stack pointer. */\r
+ \r
+ *pxTopOfStack = 0xdeadbeef;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = portINITIAL_PSW;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0xffffffff; /* r15. */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0xeeeeeeee;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0xdddddddd;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0xcccccccc;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0xbbbbbbbb;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0xaaaaaaaa;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x99999999;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x88888888;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x77777777;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x66666666;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x55555555;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x44444444;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x33333333;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x22222222;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = portINITIAL_FPSW;\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x12345678; /* Accumulator. */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = 0x87654321; /* Accumulator. */\r
+\r
return pxTopOfStack;\r
}\r
/*-----------------------------------------------------------*/\r
}\r
/*-----------------------------------------------------------*/\r
\r
-portBASE_TYPE xPortUsesFloatingPoint( xTaskHandle xTask )\r
-{\r
-unsigned long *pulFlopBuffer;\r
-portBASE_TYPE xReturn;\r
-extern void * volatile pxCurrentTCB;\r
-\r
- /* This function tells the kernel that the task referenced by xTask is\r
- going to use the floating point registers and therefore requires the\r
- floating point registers saved as part of its context. */\r
-\r
- /* Passing NULL as xTask is used to indicate that the calling task is the\r
- subject task - so pxCurrentTCB is the task handle. */\r
- if( xTask == NULL )\r
- {\r
- xTask = ( xTaskHandle ) pxCurrentTCB;\r
- }\r
-\r
- /* Allocate a buffer large enough to hold all the flop registers. */\r
- pulFlopBuffer = ( unsigned long * ) pvPortMalloc( portFLOP_STORAGE_SIZE );\r
- \r
- if( pulFlopBuffer != NULL )\r
- {\r
- /* Start with the registers in a benign state. */\r
- memset( ( void * ) pulFlopBuffer, 0x00, portFLOP_STORAGE_SIZE );\r
- \r
- /* The first thing to get saved in the buffer is the FPSCR value -\r
- initialise this to the current FPSCR value. */\r
-//_RB_ *pulFlopBuffer = get_fpscr();\r
- \r
- /* Use the task tag to point to the flop buffer. Pass pointer to just \r
- above the buffer because the flop save routine uses a pre-decrement. */\r
- vTaskSetApplicationTaskTag( xTask, ( void * ) ( pulFlopBuffer + portFLOP_REGISTERS_TO_STORE ) ); \r
- xReturn = pdPASS;\r
- }\r
- else\r
- {\r
- xReturn = pdFAIL;\r
- }\r
- \r
- return xReturn;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vPortSaveFlopRegisters( void *pvBuffer )\r
-{\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vPortRestoreFlopRegisters( void *pvBuffer )\r
-{\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
extern void vTaskSwitchContext( void );\r
#define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) vTaskSwitchContext()\r
\r
-/* \r
- * This function tells the kernel that the task referenced by xTask is going to \r
- * use the floating point registers and therefore requires the floating point \r
- * registers saved as part of its context. \r
- */\r
-portBASE_TYPE xPortUsesFloatingPoint( void* xTask );\r
-\r
-/*\r
- * The flop save and restore functions are defined in portasm.src and called by\r
- * the trace "task switched in" and "trace task switched out" macros. \r
- */\r
-void vPortSaveFlopRegisters( void *pulBuffer );\r
-void vPortRestoreFlopRegisters( void *pulBuffer );\r
-\r
-/*\r
- * pxTaskTag is used to point to the buffer into which the floating point \r
- * context should be saved. If pxTaskTag is NULL then the task does not use\r
- * a floating point context.\r
- */\r
-#define traceTASK_SWITCHED_OUT() if( pxCurrentTCB->pxTaskTag != NULL ) vPortSaveFlopRegisters( pxCurrentTCB->pxTaskTag )\r
-#define traceTASK_SWITCHED_IN() if( pxCurrentTCB->pxTaskTag != NULL ) vPortRestoreFlopRegisters( pxCurrentTCB->pxTaskTag )\r
-\r
/*\r
* These macros should be called directly, but through the taskENTER_CRITICAL()\r
* and taskEXIT_CRITICAL() macros.\r