diff options
| author | Timo Dritschler <timo.dritschler@kit.edu> | 2015-06-16 17:25:08 +0200 | 
|---|---|---|
| committer | Timo Dritschler <timo.dritschler@kit.edu> | 2015-06-16 17:25:08 +0200 | 
| commit | fa417b373e93903c8c41cdfd800a0311bc495e15 (patch) | |
| tree | e262fea43ded5eaf69b2cf98e4ccee9c05173cd4 | |
| parent | 9ea244a2a7a52495bf033dd9f1cca7c865baf200 (diff) | |
Highlights:
- KiroSb: Added kiro_sb_get_dma_pointer interface
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/kiro-sb.c | 24 | ||||
| -rw-r--r-- | src/kiro-sb.h | 25 | 
3 files changed, 41 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3de92ab..e2f38af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE)  set(TARNAME "kiro")  set(LIBKIRO_VERSION_MAJOR "1") -set(LIBKIRO_VERSION_MINOR "2") +set(LIBKIRO_VERSION_MINOR "3")  set(LIBKIRO_VERSION_PATCH "0")  set(LIBKIRO_VERSION_RELEASE "9")  set(LIBKIRO_VERSION_STRING "${LIBKIRO_VERSION_MAJOR}.${LIBKIRO_VERSION_MINOR}.${LIBKIRO_VERSION_PATCH}") diff --git a/src/kiro-sb.c b/src/kiro-sb.c index 6ec671c..3d6173f 100644 --- a/src/kiro-sb.c +++ b/src/kiro-sb.c @@ -274,15 +274,10 @@ kiro_sb_get_data (KiroSb *self)      KiroSbPrivate *priv = KIRO_SB_GET_PRIVATE (self);      struct KiroTrbInfo *header = kiro_trb_get_raw_buffer (priv->trb); -    switch (header->offset) { -        case 0: -            return kiro_trb_get_element (priv->trb, 0); -            break; -        case 1: -            return kiro_trb_get_element (priv->trb, 1); -            break; -        default: -            return kiro_trb_get_element (priv->trb, -1); +    if (header->offset > 0) { +        return kiro_trb_get_element (priv->trb, 1); +    } else { +        return kiro_trb_get_element (priv->trb, 0);      }  } @@ -310,6 +305,17 @@ kiro_sb_push_dma (KiroSb *self)      return kiro_trb_dma_push (priv->trb);  } +void * +kiro_sb_get_dma_pointer (KiroSb *self) +{ +    g_return_val_if_fail (self != NULL, NULL); + +    KiroSbPrivate *priv = KIRO_SB_GET_PRIVATE (self); +    g_return_val_if_fail (priv->initialized == 1, NULL); + +    return kiro_trb_get_element (priv->trb, -1); +} +  gboolean  kiro_sb_clone (KiroSb *self, const gchar* address, const gchar* port) diff --git a/src/kiro-sb.h b/src/kiro-sb.h index a2b8604..32f1a48 100644 --- a/src/kiro-sb.h +++ b/src/kiro-sb.h @@ -340,6 +340,31 @@ gboolean kiro_sb_push       (KiroSb *sb, void *data);   */  void* kiro_sb_push_dma      (KiroSb *sb); +/** + * kiro_sb_get_dma_pointer: + * @sb: (transfer none) The #KiroSb to get the data from + * + *   Returns a pointer where the next element will be stored. + *   This operation is only valid for a 'serving' #KiroSb. Calling this + *   function on a 'cloning' #KiroSb will allways return a %NULL pointer. + * + * Returns: (transfer none) (type gulong): + *   A pointer to the memory where the next element will be stored + * Note: + *   This function can be used to preemtively write data to the @sb without + *   advancing the internal buffer (no remote sync will occur).  It is the users + *   responsibility to ensure no more data is written to the pointed memory then + *   was specified with the initial call to kiro_sb_serve or returned by + *   kiro_sb_get_size.  Under no circumstances might the returned pointer be + *   freed by the user.  Once the element has been written, you can use + *   kiro_sb_push_dma() to advance the buffer, making the remote side aware of + *   the new element. + * See also: + *   kiro_sb_get_size, kiro_sb_serve + * + * Since: 1.3 + */ +void* kiro_sb_get_dma_pointer     (KiroSb *sb);  G_END_DECLS  | 
