* management pages of http://www.FreeRTOS.org for more information.\r
*/\r
#include <stdlib.h>\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
+/* 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
-#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
+#include "FreeRTOS.h"\r
+#include "task.h"\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
\r
/* Ensure that blocks are always aligned to the required number of bytes. */\r
#if portBYTE_ALIGNMENT != 1\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
#endif\r
\r