Remove the portBYTE_ALIGNMENT_MASK definitions as they are now in the common portable.h file.

pull/4/head
Richard Barry 16 years ago
parent ad441634f0
commit b7da8d7a1b

@ -54,30 +54,16 @@
* management pages of http://www.FreeRTOS.org for more information. * management pages of http://www.FreeRTOS.org for more information.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include "FreeRTOS.h"
#include "task.h"
/* Setup the correct byte alignment mask for the defined byte alignment. */
#if portBYTE_ALIGNMENT == 8
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0007 )
#endif
#if portBYTE_ALIGNMENT == 4 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0003 ) all the API functions to use the MPU wrappers. That should only be done when
#endif task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if portBYTE_ALIGNMENT == 2 #include "FreeRTOS.h"
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0001 ) #include "task.h"
#endif
#if portBYTE_ALIGNMENT == 1
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0000 )
#endif
#ifndef heapBYTE_ALIGNMENT_MASK #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#error "Invalid portBYTE_ALIGNMENT definition"
#endif
/* Allocate the memory for the heap. The struct is used to force byte /* Allocate the memory for the heap. The struct is used to force byte
alignment without using any non-portable code. */ alignment without using any non-portable code. */
@ -100,10 +86,10 @@ void *pvReturn = NULL;
/* Ensure that blocks are always aligned to the required number of bytes. */ /* Ensure that blocks are always aligned to the required number of bytes. */
#if portBYTE_ALIGNMENT != 1 #if portBYTE_ALIGNMENT != 1
if( xWantedSize & heapBYTE_ALIGNMENT_MASK ) if( xWantedSize & portBYTE_ALIGNMENT_MASK )
{ {
/* Byte alignment required. */ /* Byte alignment required. */
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) ); xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
} }
#endif #endif

@ -55,30 +55,15 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers. That should only be done when
task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
/* Setup the correct byte alignment mask for the defined byte alignment. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if portBYTE_ALIGNMENT == 8
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0007 )
#endif
#if portBYTE_ALIGNMENT == 4
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0003 )
#endif
#if portBYTE_ALIGNMENT == 2
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0001 )
#endif
#if portBYTE_ALIGNMENT == 1
#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0000 )
#endif
#ifndef heapBYTE_ALIGNMENT_MASK
#error "Invalid portBYTE_ALIGNMENT definition"
#endif
/* Allocate the memory for the heap. The struct is used to force byte /* Allocate the memory for the heap. The struct is used to force byte
alignment without using any non-portable code. */ alignment without using any non-portable code. */
@ -179,10 +164,10 @@ void *pvReturn = NULL;
xWantedSize += heapSTRUCT_SIZE; xWantedSize += heapSTRUCT_SIZE;
/* Ensure that blocks are always aligned to the required number of bytes. */ /* Ensure that blocks are always aligned to the required number of bytes. */
if( xWantedSize & heapBYTE_ALIGNMENT_MASK ) if( xWantedSize & portBYTE_ALIGNMENT_MASK )
{ {
/* Byte alignment required. */ /* Byte alignment required. */
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) ); xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
} }
} }

@ -59,9 +59,16 @@
#include <stdlib.h> #include <stdlib.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers. That should only be done when
task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void *pvPortMalloc( size_t xWantedSize ) void *pvPortMalloc( size_t xWantedSize )

Loading…
Cancel
Save