summaryrefslogtreecommitdiffstats
path: root/kiro-trb.c
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2014-04-30 16:34:59 +0200
committerTimo Dritschler <timo.dritschler@kit.edu>2014-04-30 16:39:01 +0200
commit18ae33837ee1451dddf265198b51ef3483e2029b (patch)
tree13b899cbd84dd82fd33c79b07131c5402f65a317 /kiro-trb.c
parent6b28a07e6bba885b3f33e7b81d3e76544f18ce07 (diff)
downloadkiro-18ae33837ee1451dddf265198b51ef3483e2029b.tar.gz
kiro-18ae33837ee1451dddf265198b51ef3483e2029b.tar.bz2
kiro-18ae33837ee1451dddf265198b51ef3483e2029b.tar.xz
kiro-18ae33837ee1451dddf265198b51ef3483e2029b.zip
Added documentation to KIRO TRB Header file
Diffstat (limited to 'kiro-trb.c')
-rw-r--r--kiro-trb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kiro-trb.c b/kiro-trb.c
index ff0291b..e81a4f7 100644
--- a/kiro-trb.c
+++ b/kiro-trb.c
@@ -211,9 +211,9 @@ void* kiro_trb_dma_push (KiroTrb *self)
{
KiroTrbPrivate* priv = KIRO_TRB_GET_PRIVATE(self);
if(priv->initialized != 1)
- return -1;
+ return NULL;
if((priv->current + priv->element_size) > (priv->mem + priv->buff_size))
- return -1;
+ return NULL;
void *mem_out = priv->current;
priv->current += priv->element_size;
if(priv->current >= priv->frame_top + (priv->element_size * priv->max_elements))
@@ -229,6 +229,8 @@ void* kiro_trb_dma_push (KiroTrb *self)
void kiro_trb_refresh (KiroTrb *self)
{
KiroTrbPrivate* priv = KIRO_TRB_GET_PRIVATE(self);
+ if(priv->initialized != 1)
+ return;
struct KiroTrbInfo *tmp = (struct KiroTrbInfo *)priv->mem;
priv->buff_size = tmp->buffer_size_bytes;
priv->element_size = tmp->element_size;
@@ -246,6 +248,7 @@ void kiro_trb_adopt (KiroTrb *self, void *buff_in)
if(priv->mem)
free(priv->mem);
priv->mem = buff_in;
+ priv->initialized = 1;
kiro_trb_refresh(self);
}
@@ -261,6 +264,7 @@ int kiro_trb_clone (KiroTrb *self, void *buff_in)
if(priv->mem)
free(priv->mem);
priv->mem = newmem;
+ priv->initialized = 1;
kiro_trb_refresh(self);
return 0;
}