From dafc85637aa93ad28c1fd066e35899787ee00db0 Mon Sep 17 00:00:00 2001 From: Berin Martini Date: Thu, 29 Oct 2015 01:03:17 +0000 Subject: [PATCH] New function in library 'axis_memory_offset' This function takes as argument an offset indexed from zero and returns a usage pointer corresponding to the offset from the start of the CMA region. Thus an argument offset of zero would give the pointer to the start of the CMA region. --- lib/interface.c | 7 +++++++ lib/interface.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/lib/interface.c b/lib/interface.c index fea24c2..782b341 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -183,6 +183,13 @@ unsigned int axis_memory_addr(void *ptr) return (mem_start + ((unsigned int)ptr) - ((unsigned int)mem)); } +void *axis_memory_offset(unsigned int offset) +{ + assert(offset < MEM_SIZE); + + return &mem[offset]; +} + unsigned int axis_stream_length(const int length, const int byte_nb) { assert(length); diff --git a/lib/interface.h b/lib/interface.h index cc6bc28..58a4d47 100644 --- a/lib/interface.h +++ b/lib/interface.h @@ -37,6 +37,8 @@ extern "C" { unsigned int axis_memory_addr(void *ptr); + void *axis_memory_offset(unsigned int offset); + unsigned int axis_stream_length(const int length, const int byte_nb); #ifdef __cplusplus