SysLink API Reference  2.21.03.11
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Typedefs
IHeap.h File Reference

Detailed Description

Defines Heap based memory allocator.

Heap implementation that manages fixed size buffers that can be used in a multiprocessor system with shared memory.

The Heap manager provides functions to allocate and free storage from a heap of type Heap which inherits from IHeap. Heap manages a single fixed-size buffer, split into equally sized allocable blocks.

The Heap manager is intended as a very fast memory manager which can only allocate blocks of a single size. It is ideal for managing a heap that is only used for allocating a single type of object, or for objects that have very similar sizes.

This module is instance based. Each instance requires shared memory (for the buffers and other internal state). This is specified via the sharedAddr parameter to the create. The proper sharedAddrSize parameter can be determined via the sharedMemReq call. Note: the parameters to this function must be the same that will used to create the instance.

The Heap module uses a NameServer instance to store instance information when an instance is created and the name parameter is non-NULL. If a name is supplied, it must be unique for all Heap instances.

The create initializes the shared memory as needed. The shared memory must be initialized to 0 before the Heap instance is created or opened.

Once an instance is created, an open can be performed. The open is used to gain access to the same Heap instance. Generally an instance is created on one processor and opened on the other processor(s).

The open returns a Heap instance handle like the create, however the open does not modify the shared memory.

There are two options when opening the instance: -Supply the same name as specified in the create. The Heap module queries the NameServer to get the needed information. -Supply the same sharedAddr value as specified in the create.

If the open is called before the instance is created, open returns NULL.

Constraints: -Align parameter must be a power of 2. -The buffer passed to dynamically create a Heap must be aligned according to the alignment parameter, and must be large enough to account for the actual block size after it has been rounded up to a multiple of the alignment.

#include <ti/syslink/utils/MemoryDefs.h>
#include <ti/syslink/utils/Trace.h>
Include dependency graph for IHeap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IHeap_Object_tag
 Structure for the Handle for the Heap. More...

Typedefs

typedef struct IHeap_Object_tag IHeap_Object
 Forward declaration of structure defining object for the Heap module.
typedef IHeap_ObjectIHeap_Handle
 Handle for the Heap Buf.
typedef Ptr(* IHeap_allocFxn )(IHeap_Handle handle, SizeT size, SizeT align)
 Type for function pointer to allocate a memory block.
typedef Void(* IHeap_freeFxn )(IHeap_Handle handle, Ptr block, SizeT size)
 Type for function pointer to free a memory block.
typedef Void(* IHeap_getStatsFxn )(IHeap_Handle handle, Memory_Stats *stats)
 Type for function pointer to get memory related statistics.
typedef Bool(* IHeap_isBlockingFxn )(IHeap_Handle handle)
typedef Ptr(* IHeap_getKnlHandleFxn )(IHeap_Handle handle)
 Type for function pointer to get handle to kernel object.

Typedef Documentation

Forward declaration of structure defining object for the Heap module.

Handle for the Heap Buf.

typedef Ptr(* IHeap_allocFxn)(IHeap_Handle handle, SizeT size, SizeT align)

Type for function pointer to allocate a memory block.

typedef Void(* IHeap_freeFxn)(IHeap_Handle handle, Ptr block, SizeT size)

Type for function pointer to free a memory block.

typedef Void(* IHeap_getStatsFxn)(IHeap_Handle handle, Memory_Stats *stats)

Type for function pointer to get memory related statistics.

typedef Bool(* IHeap_isBlockingFxn)(IHeap_Handle handle)
typedef Ptr(* IHeap_getKnlHandleFxn)(IHeap_Handle handle)

Type for function pointer to get handle to kernel object.

Copyright 2014, Texas Instruments Incorporated