Lines Matching +full:- +full:- +full:check
5 * SPDX-License-Identifier: MIT
60 #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
68 /* Check if multiplying a and b will result in overflow. */
71 /* Check if adding a and b will result in overflow. */
72 #define heapADD_WILL_OVERFLOW( a, b ) ( ( a ) > ( heapSIZE_MAX - ( b ) ) )
78 …BLOCK_ALLOCATED_BITMASK ( ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 ) )
80 #define heapBLOCK_IS_ALLOCATED( pxBlock ) ( ( ( pxBlock->xBlockSize ) & heapBLOCK_ALLOCATED_…
81 #define heapALLOCATE_BLOCK( pxBlock ) ( ( pxBlock->xBlockSize ) |= heapBLOCK_ALLOCATED_B…
82 #define heapFREE_BLOCK( pxBlock ) ( ( pxBlock->xBlockSize ) &= ~heapBLOCK_ALLOCATED_…
84 /*-----------------------------------------------------------*/
90 * heap - probably so it can be placed in a special segment or address. */
106 static const uint16_t heapSTRUCT_SIZE = ( ( sizeof( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & …
116 /*-----------------------------------------------------------*/
123 /*-----------------------------------------------------------*/
128 * Insert a block into the list of free blocks - which is ordered by size of
137 …xBlockSize = pxBlockToInsert->xBlockSize; …
141 …for( pxIterator = &xStart; pxIterator->pxNextFreeBlock->xBlockSize < xBlockSize; pxIterator = pxIt…
143 …/* There is nothing to do here - just iterate to the correct position. */ …
148 …pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock; …
149 …pxIterator->pxNextFreeBlock = pxBlockToInsert; …
151 /*-----------------------------------------------------------*/
177 …xAdditionalRequiredSize = heapSTRUCT_SIZE + portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMEN… in pvPortMalloc()
189 /* Check the block size we are trying to allocate is not so large that the in pvPortMalloc()
191 * structure is used to determine who owns the block - the application or in pvPortMalloc()
197 /* Blocks are stored in byte order - traverse the list from the start in pvPortMalloc()
202 … while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) in pvPortMalloc()
205 pxBlock = pxBlock->pxNextFreeBlock; in pvPortMalloc()
211 /* Return the memory space - jumping over the BlockLink_t structure in pvPortMalloc()
213 … pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE ); in pvPortMalloc()
217 pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock; in pvPortMalloc()
220 if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) in pvPortMalloc()
229 pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize; in pvPortMalloc()
230 pxBlock->xBlockSize = xWantedSize; in pvPortMalloc()
236 xFreeBytesRemaining -= pxBlock->xBlockSize; in pvPortMalloc()
238 /* The block is being returned - it is allocated and owned in pvPortMalloc()
241 pxBlock->pxNextFreeBlock = NULL; in pvPortMalloc()
261 /*-----------------------------------------------------------*/
272 puc -= heapSTRUCT_SIZE; in vPortFree()
279 configASSERT( pxLink->pxNextFreeBlock == NULL ); in vPortFree()
283 if( pxLink->pxNextFreeBlock == NULL ) in vPortFree()
285 /* The block is being returned to the heap - it is no longer in vPortFree()
290 … ( void ) memset( puc + heapSTRUCT_SIZE, 0, pxLink->xBlockSize - heapSTRUCT_SIZE ); in vPortFree()
298 xFreeBytesRemaining += pxLink->xBlockSize; in vPortFree()
299 traceFREE( pv, pxLink->xBlockSize ); in vPortFree()
306 /*-----------------------------------------------------------*/
312 /*-----------------------------------------------------------*/
318 /*-----------------------------------------------------------*/
337 /*-----------------------------------------------------------*/
345 …pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) & ucHeap[ portBYTE_ALIGNMENT - 1 ] ) … in prvHeapInit()
359 pxFirstFreeBlock->xBlockSize = configADJUSTED_HEAP_SIZE; in prvHeapInit()
360 pxFirstFreeBlock->pxNextFreeBlock = &xEnd; in prvHeapInit()
362 /*-----------------------------------------------------------*/