diff mbox

[v2,18/18] Split out platform-specific part of odp_timer.h

Message ID 1403027720-9738-19-git-send-email-taras.kondratiuk@linaro.org
State RFC
Headers show

Commit Message

Taras Kondratiuk June 17, 2014, 5:55 p.m. UTC
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 include/odp_timer.h                             |   10 +++---
 platform/linux-generic/include/plat/odp_timer.h |   39 +++++++++++++++++++++++
 2 files changed, 44 insertions(+), 5 deletions(-)
 create mode 100644 platform/linux-generic/include/plat/odp_timer.h

Comments

Ola Liljedahl June 17, 2014, 10:07 p.m. UTC | #1
Why not just define the global ODP types in the platform-specific header
file directly? What is gained from this indirection through plat_/PLAT_
types and macros?

-- Ola



On 17 June 2014 18:55, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:

> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>  include/odp_timer.h                             |   10 +++---
>  platform/linux-generic/include/plat/odp_timer.h |   39
> +++++++++++++++++++++++
>  2 files changed, 44 insertions(+), 5 deletions(-)
>  create mode 100644 platform/linux-generic/include/plat/odp_timer.h
>
> diff --git a/include/odp_timer.h b/include/odp_timer.h
> index 80babd1..417bf4a 100644
> --- a/include/odp_timer.h
> +++ b/include/odp_timer.h
> @@ -22,24 +22,24 @@ extern "C" {
>  #include <odp_buffer.h>
>  #include <odp_buffer_pool.h>
>  #include <odp_queue.h>
> -
> +#include <plat/odp_timer.h>
>
>  /**
>  * ODP timer handle
>  */
> -typedef uint32_t odp_timer_t;
> +typedef plat_odp_timer_t odp_timer_t;
>
>  /** Invalid timer */
> -#define ODP_TIMER_INVALID 0
> +#define ODP_TIMER_INVALID PLAT_ODP_TIMER_INVALID
>
>
>  /**
>  * ODP timeout handle
>  */
> -typedef odp_buffer_t odp_timer_tmo_t;
> +typedef plat_odp_timer_tmo_t odp_timer_tmo_t;
>
>  /** Invalid timeout */
> -#define ODP_TIMER_TMO_INVALID 0
> +#define ODP_TIMER_TMO_INVALID PLAT_ODP_TIMER_TMO_INVALID
>
>
>  /**
> diff --git a/platform/linux-generic/include/plat/odp_timer.h
> b/platform/linux-generic/include/plat/odp_timer.h
> new file mode 100644
> index 0000000..072608c
> --- /dev/null
> +++ b/platform/linux-generic/include/plat/odp_timer.h
> @@ -0,0 +1,39 @@
> +/* Copyright (c) 2013, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP timer
> + */
> +
> +#ifndef ODP_TIMER_H_
> +#error This file should be included only into corresponding top level
> header
> +#else
> +
> +#include <odp_std_types.h>
> +#include <odp_buffer.h>
> +
> +
> +/**
> +* ODP timer handle
> +*/
> +typedef uint32_t plat_odp_timer_t;
> +
> +/** Invalid timer */
> +#define PLAT_ODP_TIMER_INVALID 0
> +
> +
> +/**
> +* ODP timeout handle
> +*/
> +typedef odp_buffer_t plat_odp_timer_tmo_t;
> +
> +/** Invalid timeout */
> +#define PLAT_ODP_TIMER_TMO_INVALID 0
> +
> +#endif
> --
> 1.7.9.5
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
vkamensky June 17, 2014, 10:30 p.m. UTC | #2
On 17 June 2014 15:07, Ola Liljedahl <ola.liljedahl@linaro.org> wrote:
> Why not just define the global ODP types in the platform-specific header
> file directly? What is gained from this indirection through plat_/PLAT_
> types and macros?

What header file odp app should include if needs
for example ODP_TIMER_INVALID value? Arrangement is that
it is odp_timer.h - it is public ABI.

plat/odp_timer.h should not be ever included directly - you can
see there guard inside that checks that file included only through
odp_timer.h

Thanks,
Victor

> -- Ola
>
>
>
> On 17 June 2014 18:55, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
>>
>> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
>> ---
>>  include/odp_timer.h                             |   10 +++---
>>  platform/linux-generic/include/plat/odp_timer.h |   39
>> +++++++++++++++++++++++
>>  2 files changed, 44 insertions(+), 5 deletions(-)
>>  create mode 100644 platform/linux-generic/include/plat/odp_timer.h
>>
>> diff --git a/include/odp_timer.h b/include/odp_timer.h
>> index 80babd1..417bf4a 100644
>> --- a/include/odp_timer.h
>> +++ b/include/odp_timer.h
>> @@ -22,24 +22,24 @@ extern "C" {
>>  #include <odp_buffer.h>
>>  #include <odp_buffer_pool.h>
>>  #include <odp_queue.h>
>> -
>> +#include <plat/odp_timer.h>
>>
>>  /**
>>  * ODP timer handle
>>  */
>> -typedef uint32_t odp_timer_t;
>> +typedef plat_odp_timer_t odp_timer_t;
>>
>>  /** Invalid timer */
>> -#define ODP_TIMER_INVALID 0
>> +#define ODP_TIMER_INVALID PLAT_ODP_TIMER_INVALID
>>
>>
>>  /**
>>  * ODP timeout handle
>>  */
>> -typedef odp_buffer_t odp_timer_tmo_t;
>> +typedef plat_odp_timer_tmo_t odp_timer_tmo_t;
>>
>>  /** Invalid timeout */
>> -#define ODP_TIMER_TMO_INVALID 0
>> +#define ODP_TIMER_TMO_INVALID PLAT_ODP_TIMER_TMO_INVALID
>>
>>
>>  /**
>> diff --git a/platform/linux-generic/include/plat/odp_timer.h
>> b/platform/linux-generic/include/plat/odp_timer.h
>> new file mode 100644
>> index 0000000..072608c
>> --- /dev/null
>> +++ b/platform/linux-generic/include/plat/odp_timer.h
>> @@ -0,0 +1,39 @@
>> +/* Copyright (c) 2013, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +
>> +/**
>> + * @file
>> + *
>> + * ODP timer
>> + */
>> +
>> +#ifndef ODP_TIMER_H_
>> +#error This file should be included only into corresponding top level
>> header
>> +#else
>> +
>> +#include <odp_std_types.h>
>> +#include <odp_buffer.h>
>> +
>> +
>> +/**
>> +* ODP timer handle
>> +*/
>> +typedef uint32_t plat_odp_timer_t;
>> +
>> +/** Invalid timer */
>> +#define PLAT_ODP_TIMER_INVALID 0
>> +
>> +
>> +/**
>> +* ODP timeout handle
>> +*/
>> +typedef odp_buffer_t plat_odp_timer_tmo_t;
>> +
>> +/** Invalid timeout */
>> +#define PLAT_ODP_TIMER_TMO_INVALID 0
>> +
>> +#endif
>> --
>> 1.7.9.5
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/include/odp_timer.h b/include/odp_timer.h
index 80babd1..417bf4a 100644
--- a/include/odp_timer.h
+++ b/include/odp_timer.h
@@ -22,24 +22,24 @@  extern "C" {
 #include <odp_buffer.h>
 #include <odp_buffer_pool.h>
 #include <odp_queue.h>
-
+#include <plat/odp_timer.h>
 
 /**
 * ODP timer handle
 */
-typedef uint32_t odp_timer_t;
+typedef plat_odp_timer_t odp_timer_t;
 
 /** Invalid timer */
-#define ODP_TIMER_INVALID 0
+#define ODP_TIMER_INVALID PLAT_ODP_TIMER_INVALID
 
 
 /**
 * ODP timeout handle
 */
-typedef odp_buffer_t odp_timer_tmo_t;
+typedef plat_odp_timer_tmo_t odp_timer_tmo_t;
 
 /** Invalid timeout */
-#define ODP_TIMER_TMO_INVALID 0
+#define ODP_TIMER_TMO_INVALID PLAT_ODP_TIMER_TMO_INVALID
 
 
 /**
diff --git a/platform/linux-generic/include/plat/odp_timer.h b/platform/linux-generic/include/plat/odp_timer.h
new file mode 100644
index 0000000..072608c
--- /dev/null
+++ b/platform/linux-generic/include/plat/odp_timer.h
@@ -0,0 +1,39 @@ 
+/* Copyright (c) 2013, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP timer
+ */
+
+#ifndef ODP_TIMER_H_
+#error This file should be included only into corresponding top level header
+#else
+
+#include <odp_std_types.h>
+#include <odp_buffer.h>
+
+
+/**
+* ODP timer handle
+*/
+typedef uint32_t plat_odp_timer_t;
+
+/** Invalid timer */
+#define PLAT_ODP_TIMER_INVALID 0
+
+
+/**
+* ODP timeout handle
+*/
+typedef odp_buffer_t plat_odp_timer_tmo_t;
+
+/** Invalid timeout */
+#define PLAT_ODP_TIMER_TMO_INVALID 0
+
+#endif