\r
This file is part of the FreeRTOS distribution.\r
\r
- FreeRTOS is free software; you can redistribute it and/or modify it under \r
- the terms of the GNU General Public License (version 2) as published by the \r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
Free Software Foundation and modified by the FreeRTOS exception.\r
**NOTE** The exception to the GPL is included to allow you to distribute a\r
- combined work that includes FreeRTOS without being obliged to provide the \r
- source code for proprietary components outside of the FreeRTOS kernel. \r
- Alternative commercial license and support terms are also available upon \r
- request. See the licensing section of http://www.FreeRTOS.org for full \r
+ combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ Alternative commercial license and support terms are also available upon\r
+ request. See the licensing section of http://www.FreeRTOS.org for full\r
license details.\r
\r
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
\r
\r
***************************************************************************\r
- * *\r
- * Looking for a quick start? Then check out the FreeRTOS eBook! *\r
- * See http://www.FreeRTOS.org/Documentation for details *\r
- * *\r
+ * *\r
+ * Looking for a quick start? Then check out the FreeRTOS eBook! *\r
+ * See http://www.FreeRTOS.org/Documentation for details *\r
+ * *\r
***************************************************************************\r
\r
1 tab == 4 spaces!\r
*/\r
#include <stdlib.h>\r
\r
+/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining\r
+all the API functions to use the MPU wrappers. That should only be done when\r
+task.h is included from an application file. */\r
+#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
+\r
#include "FreeRTOS.h"\r
#include "task.h"\r
\r
-/* Setup the correct byte alignment mask for the defined byte alignment. */\r
-\r
-#if portBYTE_ALIGNMENT == 8\r
- #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0007 )\r
-#endif\r
-\r
-#if portBYTE_ALIGNMENT == 4\r
- #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0003 )\r
-#endif\r
-\r
-#if portBYTE_ALIGNMENT == 2\r
- #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0001 )\r
-#endif\r
-\r
-#if portBYTE_ALIGNMENT == 1\r
- #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0000 )\r
-#endif\r
-\r
-#ifndef heapBYTE_ALIGNMENT_MASK\r
- #error "Invalid portBYTE_ALIGNMENT definition"\r
-#endif\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
\r
/* Allocate the memory for the heap. The struct is used to force byte\r
alignment without using any non-portable code. */\r
volatile portDOUBLE dDummy;\r
#else\r
volatile unsigned portLONG ulDummy;\r
- #endif \r
+ #endif\r
unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];\r
} xHeap;\r
\r
xWantedSize += heapSTRUCT_SIZE;\r
\r
/* Ensure that blocks are always aligned to the required number of bytes. */\r
- if( xWantedSize & heapBYTE_ALIGNMENT_MASK )\r
+ if( xWantedSize & portBYTE_ALIGNMENT_MASK )\r
{\r
/* Byte alignment required. */\r
- xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) );\r
+ xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );\r
}\r
}\r
\r
following the number of bytes requested. The void cast is\r
used to prevent byte alignment warnings from the compiler. */\r
pxNewBlockLink = ( void * ) ( ( ( unsigned portCHAR * ) pxBlock ) + xWantedSize );\r
- \r
+\r
/* Calculate the sizes of two blocks split from the single\r
block. */\r
- pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize; \r
- pxBlock->xBlockSize = xWantedSize; \r
- \r
+ pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;\r
+ pxBlock->xBlockSize = xWantedSize;\r
+\r
/* Insert the new block into the list of free blocks. */\r
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );\r
}\r
}\r
}\r
#endif\r
- \r
+\r
return pvReturn;\r
}\r
/*-----------------------------------------------------------*/\r
pxLink = ( void * ) puc;\r
\r
vTaskSuspendAll();\r
- { \r
+ {\r
/* Add this block to the list of free blocks. */\r
prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) );\r
}\r