R_RTOS  0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture
R_RTOS_memMngr.h File Reference
#include "R_RTOS_inc.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  memMngrHead
 Contains the full information about the memory block. More...
 
struct  memBlckhead
 Contains the only the flag information about the memory block. More...
 

Macros

#define malloc   rMalloc
 Redefine malloc to rMalloc in order not to have to alter the already existing code.
 
#define calloc   rCalloc
 Redefine calloc to rCalloc in order not to have to alter the already existing code.
 
#define realloc   rRealloc
 Redefine realloc to rRealloc in order not to have to alter the already existing code.
 
#define free   rFree
 Redefine free to rFree in order not to have to alter the already existing code.
 
#define BIGGEST_BLCK   ((BlckSize)0x100u)
 Size of the biggest possible buddy. More...
 
#define BIGGEST_BLCK_MSK   ((BlckSize)(BIGGEST_BLCK - (BlckSize)1u))
 Mask for blocks bigger than BIGGER_BLCK. More...
 
#define SMALLEST_BLCK   ((BlckSize)0x8u)
 Size of the smallest possible buddy. More...
 
#define SMALLER_BLCK_MSK   ((BlckSize)(SMALLEST_BLCK - (BlckSize)1u))
 Mask for blocks smaller than SMALLEST_BLCK. More...
 
#define SMALLER_BLCK_DIVISOR   (MemIndex)(0x3u)
 Bit shifts needed for a division through SMALLEST_BLCK. More...
 
#define CACHE_SIZE   ((uint8_t)0x10u)
 Size of the object cache. More...
 

Typedefs

typedef uint16_t BlckSize
 Size of a block of memory.
 
typedef uint8_t MemPoolID
 8Bit ID value of a memory pool.
 
typedef uint16_t MemFlags
 16Bit flag value.
 
typedef void * stdPtr
 Simple void pointer. More...
 
typedef uint16_t MemIndex
 Used for indexing memory blocks.
 
typedef struct memMngrHead MemMngrHead
 memMngrHead
 
typedef struct memBlckhead MemBlckHead
 memBlckhead
 

Functions

RetCode initMEM (void)
 Initialize the memory manager. More...
 
void * rMalloc (MemSize desiredSize)
 Allocate a block of memory satisfying the desiredSize property. More...
 
void * rCalloc (const MemSize desiredSize)
 
void * rRealloc (void *ptrToExistingMem, MemSize desiredSize)
 Allocate a block of memory satisfying the desiredSize property. More...
 
void rFree (void *pToBeFreed)
 The provided block of memory will be added to the memory block cache. More...
 
void rFullyFree (MemMngrHead *blckToFullyFree)
 Free a block of memory previously allocated with either rMalloc, rCalloc or rRealloc. More...
 
RetCode memMngr_CreateMemPool (const MemSize sizeOfElements, const uint8_t elements, MemPoolID *const memPoolID)
 Creates a memory pool with the given MemPoolID. More...
 
RetCode memMngr_DeleteMemPool (const MemPoolID memPoolID)
 Delete a previously created memory pool linked to the provided MemPoolID. More...
 
RetCode memMngr_MemPoolMalloc (void **ptrToMem, const MemPoolID memPoolID)
 Allocate an element from the memory pool specified by the provided MemPoolID. More...
 
RetCode memMngr_MemPoolFree (void *ptrToMem, const MemPoolID memPoolID)
 Free a previously allocated block of memory from a memory pool and put it back into the memory pool. More...
 

Detailed Description