]> git.sur5r.net Git - freertos/blobdiff - Source/portable/MemMang/heap_1.c
Remove the portBYTE_ALIGNMENT_MASK definitions as they are now in the common portable...
[freertos] / Source / portable / MemMang / heap_1.c
index 3289ff92cbe3046c82b61ebedfa6d551da36facc..0f4a38e7be727ae8cc8f6f5db5dd51617d32e9a1 100644 (file)
  * 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
@@ -100,10 +86,10 @@ void *pvReturn = NULL;
 \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