--- /dev/null
+/*\r
+ FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS.org is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section \r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ licensing and training services.\r
+*/\r
+\r
+/* When switching out a task, if the task tag contains a buffer address then\r
+save the flop context into the buffer. */\r
+#define traceTASK_SWITCHED_OUT() \\r
+ if( pxCurrentTCB->pxTaskTag != NULL ) \\r
+ { \\r
+ extern void vPortSaveFPURegisters( void * ); \\r
+ vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \\r
+ }\r
+\r
+/* When switching in a task, if the task tag contains a buffer address then\r
+load the flop context from the buffer. */\r
+#define traceTASK_SWITCHED_IN() \\r
+ if( pxCurrentTCB->pxTaskTag != NULL ) \\r
+ { \\r
+ extern void vPortRestoreFPURegisters( void * ); \\r
+ vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \\r
+ }\r
+\r
#define portCRITICAL_INTERRUPT_ENABLE ( 1UL << 17UL )\r
#define portEXTERNAL_INTERRUPT_ENABLE ( 1UL << 15UL )\r
#define portMACHINE_CHECK_ENABLE ( 1UL << 12UL )\r
-#define portINITIAL_MSR ( portCRITICAL_INTERRUPT_ENABLE | portEXTERNAL_INTERRUPT_ENABLE | portMACHINE_CHECK_ENABLE )\r
+\r
+#if configUSE_FPU == 1\r
+ #define portAPU_PRESENT ( 1UL << 25UL )\r
+ #define portFCM_FPU_PRESENT ( 1UL << 13UL )\r
+#else\r
+ #define portAPU_PRESENT ( 0UL )\r
+ #define portFCM_FPU_PRESENT ( 0UL )\r
+#endif\r
+\r
+#define portINITIAL_MSR ( portCRITICAL_INTERRUPT_ENABLE | portEXTERNAL_INTERRUPT_ENABLE | portMACHINE_CHECK_ENABLE | portAPU_PRESENT | portFCM_FPU_PRESENT )\r
\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS.org is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section \r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ licensing and training services.\r
+*/\r
+\r
#include "FreeRTOSConfig.h"\r
\r
.extern pxCurrentTCB\r
.global vPortYield\r
.global vPortTickISR\r
.global vPortISRWrapper\r
+ .global vPortSaveFPURegisters\r
+ .global vPortRestoreFPURegisters\r
\r
.set BChainField, 0\r
.set NextLRField, BChainField + 4\r
bl vPortISRHandler\r
portRESTORE_STACK_POINTER_AND_LR\r
blr\r
+\r
+#if configUSE_FPU == 1\r
+\r
+vPortSaveFPURegisters:\r
+\r
+ /* Enable APU and mark FPU as present. */\r
+ mfmsr r0\r
+ xor r30, r30, r30\r
+ oris r30, r30, 512\r
+ ori r30, r30, 8192\r
+ or r0, r0, r30\r
+ mtmsr r0\r
+\r
+ /* Buffer address is in r3. Save each flop register into an offset from\r
+ this buffer address. */\r
+ stfs f0, 0(r3)\r
+ stfs f1, 4(r3)\r
+ stfs f2, 8(r3)\r
+ stfs f3, 12(r3)\r
+ stfs f4, 16(r3)\r
+ stfs f5, 20(r3)\r
+ stfs f6, 24(r3)\r
+ stfs f7, 28(r3)\r
+ stfs f8, 32(r3)\r
+ stfs f9, 36(r3)\r
+ stfs f10, 40(r3)\r
+ stfs f11, 44(r3)\r
+ stfs f12, 48(r3)\r
+ stfs f13, 52(r3)\r
+ stfs f14, 56(r3)\r
+ stfs f15, 60(r3)\r
+ stfs f16, 64(r3)\r
+ stfs f17, 68(r3)\r
+ stfs f18, 72(r3)\r
+ stfs f19, 76(r3)\r
+ stfs f20, 80(r3)\r
+ stfs f21, 84(r3)\r
+ stfs f22, 88(r3)\r
+ stfs f23, 92(r3)\r
+ stfs f24, 96(r3)\r
+ stfs f25, 100(r3)\r
+ stfs f26, 104(r3)\r
+ stfs f27, 108(r3)\r
+ stfs f28, 112(r3)\r
+ stfs f29, 116(r3)\r
+ stfs f30, 120(r3)\r
+ stfs f31, 124(r3)\r
+ \r
+ /* Also save the FPSCR. */\r
+ mffs f31\r
+ stfs f31, 128(r3)\r
+\r
+ blr\r
+\r
+#endif /* configUSE_FPU. */\r
+\r
+\r
+#if configUSE_FPU == 1\r
+\r
+vPortRestoreFPURegisters:\r
+\r
+ /* Enable APU and mark FPU as present. */\r
+ mfmsr r0\r
+ xor r30, r30, r30\r
+ oris r30, r30, 512\r
+ ori r30, r30, 8192\r
+ or r0, r0, r30\r
+ mtmsr r0\r
+\r
+\r
+ /* Buffer address is in r3. Restore each flop register from an offset\r
+ into this buffer. \r
+ \r
+ First the FPSCR. */\r
+ lfs f31, 128(r3)\r
+ mtfsf f31, 7\r
+\r
+ lfs f0, 0(r3)\r
+ lfs f1, 4(r3)\r
+ lfs f2, 8(r3)\r
+ lfs f3, 12(r3)\r
+ lfs f4, 16(r3)\r
+ lfs f5, 20(r3)\r
+ lfs f6, 24(r3)\r
+ lfs f7, 28(r3)\r
+ lfs f8, 32(r3)\r
+ lfs f9, 36(r3)\r
+ lfs f10, 40(r3)\r
+ lfs f11, 44(r3)\r
+ lfs f12, 48(r3)\r
+ lfs f13, 52(r3)\r
+ lfs f14, 56(r3)\r
+ lfs f15, 60(r3)\r
+ lfs f16, 64(r3)\r
+ lfs f17, 68(r3)\r
+ lfs f18, 72(r3)\r
+ lfs f19, 76(r3)\r
+ lfs f20, 80(r3)\r
+ lfs f21, 84(r3)\r
+ lfs f22, 88(r3)\r
+ lfs f23, 92(r3)\r
+ lfs f24, 96(r3)\r
+ lfs f25, 100(r3)\r
+ lfs f26, 104(r3)\r
+ lfs f27, 108(r3)\r
+ lfs f28, 112(r3)\r
+ lfs f29, 116(r3)\r
+ lfs f30, 120(r3)\r
+ lfs f31, 124(r3)\r
+\r
+ blr\r
+\r
+#endif /* configUSE_FPU. */\r
+\r
+\r
#define portSTACK_GROWTH ( -1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
#define portNOP() asm volatile ( "NOP" )\r
+\r
+/* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */\r
+#define portNO_FLOP_REGISTERS_TO_SAVE ( 32 + 1 )\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* Task function macros as described on the FreeRTOS.org WEB site. */\r