tfKernelSheapCreate

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


ttUser32Bit * tfKernelSheapCreate (ttUser32Bit * pageSizePtr);


Function Description

This call is RTOS specific.

Normally, the Treck simple heap is implemented as a static array. However, you can dynamically allocate it by defining the macro TM_DYNAMIC_CREATE_SHEAP in your <trsystem.h> file, in which case you implement tfKernelSheapCreate() to perform the allocation.

The total size of the simple heap allocated by this function is expected to be TM_SHEAP_SIZE. Treck will call this function TM_SHEAP_NUM_PAGE times, passing in a pointer to the page size to be allocated on each call. The page size is initially calculated to be TM_SHEAP_SIZE / TM_SHEAP_NUM_PAGE, but can be changed by setting *pageSizePtr on the first call to this function.

Allocations must start on a 32-bit address boundary.


Parameters

  • pageSizePtr
    A pointer to a variable containing the page size. On the first call to this function, you may set the page size to be used for all subsequent calls.


Returns

  • ttUser32Bit *
    A pointer to the beginning of a contiguous memory block for use in the Treck simple heap. This address must be 32-bit aligned.


Table of Contents >> Programmer's Reference