OpenMP Runtime
Classes | Defines | Functions | Variables
tomp_dsp_heap.c File Reference

Thread safe, coherency aware dynamic memory management routines. More...

#include <stdlib.h>
#include <string.h>
#include "tomp_util.h"
#include "tomp_dsp_heap_api.h"
Include dependency graph for tomp_dsp_heap.c:

Classes

struct  PACKET
struct  tomp_DspHeap
struct  tomp_DspLocalHeap

Defines

#define LARGE_TYPE   long double
#define MIN_BLOCK   (sizeof(LARGE_TYPE))
#define BLOCK_OVERHEAD   MIN_BLOCK
#define BLOCK_USED   1
#define BLOCK_MASK   (MIN_BLOCK-1)
#define NUM_GLOBAL_HEAPS   (2) /* 1 in MSMC, 1 in DDR */

Functions

static void inv_packet_list (PACKET *heap, size_t heap_size)
 Invalidate packet list.
static void acquire_lock_and_inv (PACKET *heap, size_t heap_size)
static void inv_and_release_lock (PACKET *heap, size_t heap_size)
static void minsert (ti_omp_dsp_heap_idx, PACKET *)
static void mremove (ti_omp_dsp_heap_idx, PACKET *)
_CODE_ACCESS void __ti_dsp_heap_init (ti_omp_dsp_heap_idx idx, char *ptr, int size)
_CODE_ACCESS void tomp_dsp_heap_init (ti_omp_dsp_heap_idx idx, char *ptr, int size)
_CODE_ACCESS void * __ti_dsp_malloc (ti_omp_dsp_heap_idx idx, int size)
_CODE_ACCESS void * __ti_dsp_calloc (ti_omp_dsp_heap_idx idx, int num, int size)
_CODE_ACCESS void * __ti_dsp_realloc (ti_omp_dsp_heap_idx idx, void *packet, int size)
_CODE_ACCESS void __ti_dsp_free (ti_omp_dsp_heap_idx idx, void *packet)
_CODE_ACCESS void * __ti_dsp_memalign (ti_omp_dsp_heap_idx idx, int alignment, int size)
far void __heap_init_l2 (void *ptr, size_t size)
 Heap Initialization function.
far void * __malloc_l2 (size_t size)
 Malloc.

Variables

tomp_DspHeap __ti_dsp_heap [NUM_GLOBAL_HEAPS]
static tomp_DspLocalHeap dsp_local_heap

Detailed Description

Thread safe, coherency aware dynamic memory management routines.

Following changes to make malloc/free thread-safe and support coherency on C66x Keystone architectures:


Function Documentation

far void __heap_init_l2 ( void *  ptr,
size_t  size 
)

Heap Initialization function.

ptr must be aligned to a 64b boundary

far void* __malloc_l2 ( size_t  size)

Malloc.

Return addresses are aligned on 64bit boundaries

static void inv_packet_list ( PACKET heap,
size_t  heap_size 
) [inline, static]

Invalidate packet list.

For every PACKET in on the heap (i.e. allocated and free packets), invalidate the cache line the PACKET resides on. In the OMP runtime, heap must be write-through, so there is no need to writeback.

 All Classes Files Functions Variables Typedefs Enumerations Defines