]> git.sur5r.net Git - freertos/commitdiff
Remove the portBYTE_ALIGNMENT_MASK definitions as they are now in the common portable...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 29 Sep 2009 20:07:44 +0000 (20:07 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 29 Sep 2009 20:07:44 +0000 (20:07 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@883 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/MemMang/heap_1.c
Source/portable/MemMang/heap_2.c
Source/portable/MemMang/heap_3.c

index 3289ff92cbe3046c82b61ebedfa6d551da36facc..0f4a38e7be727ae8cc8f6f5db5dd51617d32e9a1 100644 (file)
  * management pages of http://www.FreeRTOS.org for more information.\r
  */\r
 #include <stdlib.h>\r
  * 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
 \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
 \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
 \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
 /* 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
 \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
                {\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
                }\r
        #endif\r
 \r
index b8524a6558b2de375ee6aa871d2a462c34b0e722..a3808df1c8e469c2d84feb69e1299db78ccccf6d 100644 (file)
@@ -3,14 +3,14 @@
 \r
        This file is part of the FreeRTOS distribution.\r
 \r
 \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
        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
        license details.\r
 \r
        FreeRTOS is distributed in the hope that it will be useful,     but WITHOUT\r
 \r
 \r
        ***************************************************************************\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
 \r
        1 tab == 4 spaces!\r
  */\r
 #include <stdlib.h>\r
 \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
 #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
 \r
 /* Allocate the memory for the heap.  The struct is used to force byte\r
 alignment without using any non-portable code. */\r
@@ -88,7 +73,7 @@ static union xRTOS_HEAP
                volatile portDOUBLE dDummy;\r
        #else\r
                volatile unsigned portLONG ulDummy;\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
        unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];\r
 } xHeap;\r
 \r
@@ -179,10 +164,10 @@ void *pvReturn = NULL;
                        xWantedSize += heapSTRUCT_SIZE;\r
 \r
                        /* Ensure that blocks are always aligned to the required number of bytes. */\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
                        {\r
                                /* Byte alignment required. */\r
-                               xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) );\r
+                               xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );\r
                        }\r
                }\r
 \r
                        }\r
                }\r
 \r
@@ -216,12 +201,12 @@ void *pvReturn = NULL;
                                        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
                                        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
                                        /* 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
                                        /* Insert the new block into the list of free blocks. */\r
                                        prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );\r
                                }\r
@@ -239,7 +224,7 @@ void *pvReturn = NULL;
                }\r
        }\r
        #endif\r
                }\r
        }\r
        #endif\r
-       \r
+\r
        return pvReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
        return pvReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -259,7 +244,7 @@ xBlockLink *pxLink;
                pxLink = ( void * ) puc;\r
 \r
                vTaskSuspendAll();\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
                        /* Add this block to the list of free blocks. */\r
                        prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) );\r
                }\r
index f5ca6015125f319a59840d4787501f73aec59634..7ff08b648159900b32ec6b8a96ed84af5e7b04d7 100644 (file)
 \r
 #include <stdlib.h>\r
 \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
 #include "FreeRTOS.h"\r
 #include "task.h"\r
 \r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 void *pvPortMalloc( size_t xWantedSize )\r
 /*-----------------------------------------------------------*/\r
 \r
 void *pvPortMalloc( size_t xWantedSize )\r