aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMike Holmes <mike.holmes@linaro.org>2014-12-04 15:25:15 -0500
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-12-05 10:19:19 +0300
commit724a13aabdb129adbca5aa94a48607ed52ad07c0 (patch)
treec184cb313e1e0b6c8199427790291d41518b9531 /platform
parenta11a59d367601a962548179fd05e413716aa20e0 (diff)
api: odp_align: move internal macros
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/api/odp_align.h50
-rw-r--r--platform/linux-generic/include/odp_align_internal.h100
-rw-r--r--platform/linux-generic/include/odp_packet_io_internal.h1
-rw-r--r--platform/linux-generic/include/odp_queue_internal.h1
-rw-r--r--platform/linux-generic/odp_buffer_pool.c1
-rw-r--r--platform/linux-generic/odp_packet_socket.c1
-rw-r--r--platform/linux-generic/odp_ring.c1
-rw-r--r--platform/linux-generic/odp_shared_memory.c1
8 files changed, 106 insertions, 50 deletions
diff --git a/platform/linux-generic/include/api/odp_align.h b/platform/linux-generic/include/api/odp_align.h
index eb5f724ca..6ec5a0a7e 100644
--- a/platform/linux-generic/include/api/odp_align.h
+++ b/platform/linux-generic/include/api/odp_align.h
@@ -84,12 +84,6 @@ extern "C" {
* Round up
*/
-/**
- * @internal
- * Round up 'x' to alignment 'align'
- */
-#define ODP_ALIGN_ROUNDUP(x, align)\
- ((align) * (((x) + align - 1) / (align)))
/**
* @internal
@@ -98,12 +92,6 @@ extern "C" {
#define ODP_ALIGN_ROUNDUP_PTR(x, align)\
((void *)ODP_ALIGN_ROUNDUP((uintptr_t)(x), (uintptr_t)(align)))
-/**
- * @internal
- * Round up 'x' to cache line size alignment
- */
-#define ODP_CACHE_LINE_SIZE_ROUNDUP(x)\
- ODP_ALIGN_ROUNDUP(x, ODP_CACHE_LINE_SIZE)
/**
* @internal
@@ -112,24 +100,12 @@ extern "C" {
#define ODP_CACHE_LINE_SIZE_ROUNDUP_PTR(x)\
((void *)ODP_CACHE_LINE_SIZE_ROUNDUP((uintptr_t)(x)))
-/**
- * @internal
- * Round up 'x' to page size alignment
- */
-#define ODP_PAGE_SIZE_ROUNDUP(x)\
- ODP_ALIGN_ROUNDUP(x, ODP_PAGE_SIZE)
/*
* Round down
*/
-/**
- * @internal
- * Round down 'x' to 'align' alignment, which is a power of two
- */
-#define ODP_ALIGN_ROUNDDOWN_POWER_2(x, align)\
- ((x) & (~((align) - 1)))
/**
* @internal
@@ -138,12 +114,6 @@ extern "C" {
#define ODP_ALIGN_ROUNDDOWN_PTR_POWER_2(x, align)\
((void *)ODP_ALIGN_ROUNDDOWN_POWER_2((uintptr_t)(x), (uintptr_t)(align)))
-/**
- * @internal
- * Round down 'x' to cache line size alignment
- */
-#define ODP_CACHE_LINE_SIZE_ROUNDDOWN(x)\
- ODP_ALIGN_ROUNDDOWN_POWER_2(x, ODP_CACHE_LINE_SIZE)
/**
* @internal
@@ -159,26 +129,6 @@ extern "C" {
/** Defines type/struct/variable to be page size aligned */
#define ODP_ALIGNED_PAGE ODP_ALIGNED(ODP_PAGE_SIZE)
-
-
-/*
- * Check align
- */
-
-/**
- * @internal
- * Check if pointer 'x' is aligned to 'align', which is a power of two
- */
-#define ODP_ALIGNED_CHECK_POWER_2(x, align)\
- ((((uintptr_t)(x)) & (((uintptr_t)(align))-1)) == 0)
-
-/**
- * @internal
- * Check if value is a power of two
- */
-#define ODP_VAL_IS_POWER_2(x) ((((x)-1) & (x)) == 0)
-
-
/**
* @}
*/
diff --git a/platform/linux-generic/include/odp_align_internal.h b/platform/linux-generic/include/odp_align_internal.h
new file mode 100644
index 000000000..498a7a9e8
--- /dev/null
+++ b/platform/linux-generic/include/odp_align_internal.h
@@ -0,0 +1,100 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP internal alignments
+ */
+
+#ifndef ODP_ALIGN_INTERNAL_H_
+#define ODP_ALIGN_INTERNAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_align.h>
+
+/** @addtogroup odp_compiler_optim
+ * @{
+ */
+
+/*
+ * Round up
+ */
+
+/**
+ * @internal
+ * Round up 'x' to alignment 'align'
+ */
+#define ODP_ALIGN_ROUNDUP(x, align)\
+ ((align) * (((x) + align - 1) / (align)))
+
+/**
+ * @internal
+ * Round up pointer 'x' to alignment 'align'
+ */
+#define ODP_ALIGN_ROUNDUP_PTR(x, align)\
+ ((void *)ODP_ALIGN_ROUNDUP((uintptr_t)(x), (uintptr_t)(align)))
+
+/**
+ * @internal
+ * Round up 'x' to cache line size alignment
+ */
+#define ODP_CACHE_LINE_SIZE_ROUNDUP(x)\
+ ODP_ALIGN_ROUNDUP(x, ODP_CACHE_LINE_SIZE)
+
+/**
+ * @internal
+ * Round up 'x' to page size alignment
+ */
+#define ODP_PAGE_SIZE_ROUNDUP(x)\
+ ODP_ALIGN_ROUNDUP(x, ODP_PAGE_SIZE)
+
+/*
+ * Round down
+ */
+
+/**
+ * @internal
+ * Round down 'x' to 'align' alignment, which is a power of two
+ */
+#define ODP_ALIGN_ROUNDDOWN_POWER_2(x, align)\
+ ((x) & (~((align) - 1)))
+/**
+ * @internal
+ * Round down 'x' to cache line size alignment
+ */
+#define ODP_CACHE_LINE_SIZE_ROUNDDOWN(x)\
+ ODP_ALIGN_ROUNDDOWN_POWER_2(x, ODP_CACHE_LINE_SIZE)
+
+/*
+ * Check align
+ */
+
+/**
+ * @internal
+ * Check if pointer 'x' is aligned to 'align', which is a power of two
+ */
+#define ODP_ALIGNED_CHECK_POWER_2(x, align)\
+ ((((uintptr_t)(x)) & (((uintptr_t)(align))-1)) == 0)
+
+/**
+ * @internal
+ * Check if value is a power of two
+ */
+#define ODP_VAL_IS_POWER_2(x) ((((x)-1) & (x)) == 0)
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 0bc1e2197..7819dc7c1 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -20,6 +20,7 @@ extern "C" {
#include <odp_spinlock.h>
#include <odp_packet_socket.h>
+#include <odp_align_internal.h>
#include <linux/if.h>
diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h
index 8b6c517ce..1254763ba 100644
--- a/platform/linux-generic/include/odp_queue_internal.h
+++ b/platform/linux-generic/include/odp_queue_internal.h
@@ -20,6 +20,7 @@ extern "C" {
#include <odp_queue.h>
#include <odp_buffer_internal.h>
+#include <odp_align_internal.h>
#include <odp_packet_io.h>
#include <odp_align.h>
diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index 6a0a6b2de..250da8185 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -10,6 +10,7 @@
#include <odp_buffer_internal.h>
#include <odp_packet_internal.h>
#include <odp_timer_internal.h>
+#include <odp_align_internal.h>
#include <odp_shared_memory.h>
#include <odp_align.h>
#include <odp_internal.h>
diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c
index 68983eb33..1468340d0 100644
--- a/platform/linux-generic/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
@@ -36,6 +36,7 @@
#include <odp_packet_socket.h>
#include <odp_packet_internal.h>
+#include <odp_align_internal.h>
#include <odp_hints.h>
#include <odph_eth.h>
diff --git a/platform/linux-generic/odp_ring.c b/platform/linux-generic/odp_ring.c
index 1d3130a61..2b4e0a6af 100644
--- a/platform/linux-generic/odp_ring.c
+++ b/platform/linux-generic/odp_ring.c
@@ -72,6 +72,7 @@
#include <odp_shared_memory.h>
#include <odp_internal.h>
#include <odp_spin_internal.h>
+#include <odp_align_internal.h>
#include <odp_spinlock.h>
#include <odp_align.h>
#include <sys/mman.h>
diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index 4bcf73e92..abf6da355 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -11,6 +11,7 @@
#include <odp_system_info.h>
#include <odp_debug.h>
#include <odp_debug_internal.h>
+#include <odp_align_internal.h>
#include <unistd.h>
#include <sys/mman.h>