aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@linaro.org>2014-06-24 17:05:46 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-06-26 21:41:29 +0400
commit9b8a4bbc3b230857a0d782fa25acf74f6b4e967d (patch)
treef7529e4edcca143f2e2e45ae42fa69349bb6b5ac /include
parent335cc6f1163a772077739f18c4ba8d85d7fbfc4c (diff)
Added timeout buffer type
Added 'timeout' and 'any' buffer types. Timer and buffer pool modifications to use those. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/odp_buffer.h8
-rw-r--r--include/odp_packet.h2
-rw-r--r--include/odp_timer.h31
3 files changed, 33 insertions, 8 deletions
diff --git a/include/odp_buffer.h b/include/odp_buffer.h
index d79e76da..b3d6f4aa 100644
--- a/include/odp_buffer.h
+++ b/include/odp_buffer.h
@@ -62,9 +62,11 @@ size_t odp_buffer_size(odp_buffer_t buf);
int odp_buffer_type(odp_buffer_t buf);
#define ODP_BUFFER_TYPE_INVALID (-1) /**< Buffer type invalid */
-#define ODP_BUFFER_TYPE_RAW 0 /**< Raw buffer */
-#define ODP_BUFFER_TYPE_PACKET 1 /**< Packet buffer */
-#define ODP_BUFFER_TYPE_TIMER 2 /**< Timer buffer */
+#define ODP_BUFFER_TYPE_ANY 0 /**< Buffer that can hold any other
+ buffer type */
+#define ODP_BUFFER_TYPE_RAW 1 /**< Raw buffer, no additional metadata */
+#define ODP_BUFFER_TYPE_PACKET 2 /**< Packet buffer */
+#define ODP_BUFFER_TYPE_TIMEOUT 3 /**< Timeout buffer */
/**
* Tests if buffer is part of a scatter/gather list
diff --git a/include/odp_packet.h b/include/odp_packet.h
index 932b0094..59759bb3 100644
--- a/include/odp_packet.h
+++ b/include/odp_packet.h
@@ -24,7 +24,7 @@ extern "C" {
/**
* ODP packet descriptor
*/
-typedef uint32_t odp_packet_t;
+typedef odp_buffer_t odp_packet_t;
/** Invalid packet */
#define ODP_PACKET_INVALID ODP_BUFFER_INVALID
diff --git a/include/odp_timer.h b/include/odp_timer.h
index 80babd1e..01db839d 100644
--- a/include/odp_timer.h
+++ b/include/odp_timer.h
@@ -25,8 +25,8 @@ extern "C" {
/**
-* ODP timer handle
-*/
+ * ODP timer handle
+ */
typedef uint32_t odp_timer_t;
/** Invalid timer */
@@ -34,8 +34,8 @@ typedef uint32_t odp_timer_t;
/**
-* ODP timeout handle
-*/
+ * ODP timeout handle
+ */
typedef odp_buffer_t odp_timer_tmo_t;
/** Invalid timeout */
@@ -43,6 +43,12 @@ typedef odp_buffer_t odp_timer_tmo_t;
/**
+ * Timeout notification
+ */
+typedef odp_buffer_t odp_timeout_t;
+
+
+/**
* Create a timer
*
* Creates a new timer with requested properties.
@@ -133,6 +139,23 @@ odp_timer_tmo_t odp_timer_absolute_tmo(odp_timer_t timer, uint64_t tmo_tick,
*/
int odp_timer_cancel_tmo(odp_timer_t timer, odp_timer_tmo_t tmo);
+/**
+ * Convert buffer handle to timeout handle
+ *
+ * @param buf Buffer handle
+ *
+ * @return Timeout buffer handle
+ */
+odp_timeout_t odp_timeout_from_buffer(odp_buffer_t buf);
+
+/**
+ * Return absolute timeout tick
+ *
+ * @param tmo Timeout buffer handle
+ *
+ * @return Absolute timeout tick
+ */
+uint64_t odp_timeout_tick(odp_timeout_t tmo);
#ifdef __cplusplus
}