/*\r
- FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+ FreeRTOS V8.2.2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
\r
/* Block sizes must not get too small. */\r
-#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize * 2 ) )\r
+#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize << 1 ) )\r
\r
/* Assumes 8bit bytes! */\r
#define heapBITS_PER_BYTE ( ( size_t ) 8 )\r
\r
/* The size of the structure placed at the beginning of each allocated memory\r
block must by correctly byte aligned. */\r
-static const size_t xHeapStructSize = ( ( sizeof( BlockLink_t ) + ( ( ( size_t ) portBYTE_ALIGNMENT_MASK ) - ( size_t ) 1 ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK ) );\r
+static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );\r
\r
/* Create a couple of list links to mark the start and end of the list. */\r
static BlockLink_t xStart, *pxEnd = NULL;\r
cast is used to prevent byte alignment warnings from the\r
compiler. */\r
pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize );\r
- configASSERT( ( ( ( uint32_t ) pxNewBlockLink ) & portBYTE_ALIGNMENT_MASK ) == 0 );\r
+ configASSERT( ( ( ( size_t ) pxNewBlockLink ) & portBYTE_ALIGNMENT_MASK ) == 0 );\r
\r
/* Calculate the sizes of two blocks split from the\r
single block. */\r
pxBlock->xBlockSize = xWantedSize;\r
\r
/* Insert the new block into the list of free blocks. */\r
- prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );\r
+ prvInsertBlockIntoFreeList( pxNewBlockLink );\r
}\r
else\r
{\r
{\r
BlockLink_t *pxFirstFreeBlock;\r
uint8_t *pucAlignedHeap;\r
-uint32_t ulAddress;\r
+size_t uxAddress;\r
size_t xTotalHeapSize = configTOTAL_HEAP_SIZE;\r
\r
/* Ensure the heap starts on a correctly aligned boundary. */\r
- ulAddress = ( uint32_t ) ucHeap;\r
+ uxAddress = ( size_t ) ucHeap;\r
\r
- if( ( ulAddress & portBYTE_ALIGNMENT_MASK ) != 0 )\r
+ if( ( uxAddress & portBYTE_ALIGNMENT_MASK ) != 0 )\r
{\r
- ulAddress += ( portBYTE_ALIGNMENT - 1 );\r
- ulAddress &= ~( ( uint32_t ) portBYTE_ALIGNMENT_MASK );\r
- xTotalHeapSize -= ulAddress - ( uint32_t ) ucHeap;\r
+ uxAddress += ( portBYTE_ALIGNMENT - 1 );\r
+ uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );\r
+ xTotalHeapSize -= uxAddress - ( size_t ) ucHeap;\r
}\r
\r
- pucAlignedHeap = ( uint8_t * ) ulAddress;\r
+ pucAlignedHeap = ( uint8_t * ) uxAddress;\r
\r
/* xStart is used to hold a pointer to the first item in the list of free\r
blocks. The void cast is used to prevent compiler warnings. */\r
\r
/* pxEnd is used to mark the end of the list of free blocks and is inserted\r
at the end of the heap space. */\r
- ulAddress = ( ( uint32_t ) pucAlignedHeap ) + xTotalHeapSize;\r
- ulAddress -= xHeapStructSize;\r
- ulAddress &= ~( ( uint32_t ) portBYTE_ALIGNMENT_MASK );\r
- pxEnd = ( void * ) ulAddress;\r
+ uxAddress = ( ( size_t ) pucAlignedHeap ) + xTotalHeapSize;\r
+ uxAddress -= xHeapStructSize;\r
+ uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );\r
+ pxEnd = ( void * ) uxAddress;\r
pxEnd->xBlockSize = 0;\r
pxEnd->pxNextFreeBlock = NULL;\r
\r
/* To start with there is a single free block that is sized to take up the\r
entire heap space, minus the space taken by pxEnd. */\r
pxFirstFreeBlock = ( void * ) pucAlignedHeap;\r
- pxFirstFreeBlock->xBlockSize = ulAddress - ( uint32_t ) pxFirstFreeBlock;\r
+ pxFirstFreeBlock->xBlockSize = uxAddress - ( size_t ) pxFirstFreeBlock;\r
pxFirstFreeBlock->pxNextFreeBlock = pxEnd;\r
\r
/* Only one block exists - and it covers the entire usable heap space. */\r