uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heap_2.c File Reference
#include <stdlib.h>
#include "FreeRTOS.h"
#include "task.h"

Go to the source code of this file.

Classes

union  xRTOS_HEAP
 
struct  A_BLOCK_LINK
 

Macros

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
 
#define heapMINIMUM_BLOCK_SIZE   ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) )
 
#define prvInsertBlockIntoFreeList(pxBlockToInsert)
 
#define prvHeapInit()
 

Typedefs

typedef struct A_BLOCK_LINK xBlockLink
 

Functions

void * pvPortMalloc (size_t xWantedSize)
 
void vPortFree (void *pv)
 
size_t xPortGetFreeHeapSize (void)
 
void vPortInitialiseBlocks (void)
 

Macro Definition Documentation

#define heapMINIMUM_BLOCK_SIZE   ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) )

Definition at line 96 of file heap_2.c.

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE

Definition at line 67 of file heap_2.c.

#define prvHeapInit ( )
Value:
{ \
xBlockLink *pxFirstFreeBlock; \
\
/* xStart is used to hold a pointer to the first item in the list of free */ \
/* blocks. The void cast is used to prevent compiler warnings. */ \
xStart.pxNextFreeBlock = ( void * ) xHeap.ucHeap; \
xStart.xBlockSize = ( size_t ) 0; \
\
/* xEnd is used to mark the end of the list of free blocks. */ \
xEnd.xBlockSize = configTOTAL_HEAP_SIZE; \
xEnd.pxNextFreeBlock = NULL; \
\
/* To start with there is a single free block that is sized to take up the \
entire heap space. */ \
pxFirstFreeBlock = ( void * ) xHeap.ucHeap; \
pxFirstFreeBlock->xBlockSize = configTOTAL_HEAP_SIZE; \
pxFirstFreeBlock->pxNextFreeBlock = &xEnd; \
}

Definition at line 133 of file heap_2.c.

#define prvInsertBlockIntoFreeList (   pxBlockToInsert)
Value:
{ \
xBlockLink *pxIterator; \
size_t xBlockSize; \
\
xBlockSize = pxBlockToInsert->xBlockSize; \
\
/* Iterate through the list until a block is found that has a larger size */ \
/* than the block we are inserting. */ \
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock->xBlockSize < xBlockSize; pxIterator = pxIterator->pxNextFreeBlock ) \
{ \
/* There is nothing to do here - just iterate to the correct position. */ \
} \
\
/* Update the list to include the block being inserted in the correct */ \
/* position. */ \
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock; \
pxIterator->pxNextFreeBlock = pxBlockToInsert; \
}

Definition at line 112 of file heap_2.c.

Typedef Documentation

typedef struct A_BLOCK_LINK xBlockLink

Function Documentation

void* pvPortMalloc ( size_t  xWantedSize)

Definition at line 154 of file heap_2.c.

void vPortFree ( void *  pv)

Definition at line 244 of file heap_2.c.

void vPortInitialiseBlocks ( void  )

Definition at line 275 of file heap_2.c.

size_t xPortGetFreeHeapSize ( void  )

Definition at line 269 of file heap_2.c.