Patchwork MARS: Header files cleanup

login
register
mail settings
Submitter Yuji Mano
Date Sept. 11, 2008, 7:35 p.m.
Message ID <48C972E9.1000507@am.sony.com>
Download mbox | patch
Permalink /patch/247/
State New
Delegated to: Yuji Mano
Headers show

Comments

Yuji Mano - Sept. 11, 2008, 7:35 p.m.
From: Geoff Levand <geoffrey.levand@am.sony.com>

Cleanup header files:
 o Adjust scope of C linkage specifiers.
 o Remove unneeded C linkage specifiers.
 o Use system include path for installed headers.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Kazunori Asayama <asayama@sm.sony.co.jp>

Patch

--- a/include/common/mars/mars_debug.h
+++ b/include/common/mars/mars_debug.h
@@ -42,10 +42,6 @@ 
  * \brief MARS Debug Macros
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdio.h>
 
 #define MARS_DEBUG_ENABLE_PRINT		0
@@ -296,8 +292,4 @@  extern "C" {
 #define MARS_TIMER_STOP(id)
 #endif
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_error.h
+++ b/include/common/mars/mars_error.h
@@ -43,10 +43,6 @@ 
  * \brief MARS Error Values
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 /**
  * \brief MARS error values
  *
@@ -68,8 +64,4 @@  enum {
 	MARS_ERROR_BUSY		/**< operation returned due to being busy */
 };
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_kernel_types.h
+++ b/include/common/mars/mars_kernel_types.h
@@ -38,10 +38,6 @@ 
 #ifndef MARS_KERNEL_TYPES_H
 #define MARS_KERNEL_TYPES_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 #define MARS_KERNEL_PARAMS_ALIGN	128
@@ -53,8 +49,4 @@  struct mars_kernel_params {
 	uint64_t workload_queue_ea;
 } __attribute__((aligned(MARS_KERNEL_PARAMS_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_mutex_types.h
+++ b/include/common/mars/mars_mutex_types.h
@@ -44,10 +44,6 @@ 
  * \brief MARS Mutex Types
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 /**
@@ -95,8 +91,4 @@  struct mars_mutex {
 	uint8_t pad[124];
 } __attribute__((aligned(MARS_MUTEX_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_task_barrier_types.h
+++ b/include/common/mars/mars_task_barrier_types.h
@@ -44,10 +44,6 @@ 
  * \brief MARS Task Barrier Types
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 /**
@@ -97,8 +93,4 @@  struct mars_task_barrier {
 	uint64_t mars_context_ea;
 } __attribute__((aligned(MARS_TASK_BARRIER_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_task_event_flag_types.h
+++ b/include/common/mars/mars_task_event_flag_types.h
@@ -44,10 +44,6 @@ 
  * \brief MARS Task Event Flag Types
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 /**
@@ -139,8 +135,4 @@  struct mars_task_event_flag {
 	uint64_t mars_context_ea;
 } __attribute__((aligned(MARS_TASK_EVENT_FLAG_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_task_queue_types.h
+++ b/include/common/mars/mars_task_queue_types.h
@@ -44,10 +44,6 @@ 
  * \brief MARS Task Queue Types
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 /**
@@ -156,8 +152,4 @@  struct mars_task_queue {
 	uint64_t mars_context_ea;
 } __attribute__((aligned(MARS_TASK_QUEUE_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_task_semaphore_types.h
+++ b/include/common/mars/mars_task_semaphore_types.h
@@ -44,10 +44,6 @@ 
  * \brief MARS Task Semaphore Types
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 /**
@@ -93,8 +89,4 @@  struct mars_task_semaphore {
 	uint64_t mars_context_ea;
 } __attribute__((aligned(MARS_TASK_SEMAPHORE_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_task_types.h
+++ b/include/common/mars/mars_task_types.h
@@ -44,10 +44,6 @@ 
  * \brief MARS Task Types
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 /**
@@ -166,8 +162,4 @@  struct mars_task_context {
 	uint8_t pad[20];		/* padding */
 } __attribute__((aligned(MARS_TASK_CONTEXT_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/common/mars/mars_workload_types.h
+++ b/include/common/mars/mars_workload_types.h
@@ -38,10 +38,6 @@ 
 #ifndef MARS_WORKLOAD_TYPES_H
 #define MARS_WORKLOAD_TYPES_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 #define MARS_WORKLOAD_ID_NONE			0xffff	/* workload id none */
@@ -147,8 +143,4 @@  struct mars_workload_queue {
 	struct mars_workload_context context[MARS_WORKLOAD_MAX];
 } __attribute__((aligned(MARS_WORKLOAD_QUEUE_ALIGN)));
 
-#if defined(__cplusplus)
-}
-#endif
-
 #endif
--- a/include/host/mars/mars.h
+++ b/include/host/mars/mars.h
@@ -44,9 +44,9 @@ 
  * \brief [host] MARS API
  */
 
-#include "mars/mars_context.h"
-#include "mars/mars_error.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_task.h"
+#include <mars/mars_context.h>
+#include <mars/mars_error.h>
+#include <mars/mars_mutex.h>
+#include <mars/mars_task.h>
 
 #endif
--- a/include/host/mars/mars_mutex.h
+++ b/include/host/mars/mars_mutex.h
@@ -44,12 +44,12 @@ 
  * \brief [host] MARS Mutex API
  */
 
+#include <mars/mars_mutex_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_mutex_types.h"
-
 /**
  * \ingroup group_mars_mutex
  * \brief [host] Initializes a mutex.
--- a/include/host/mars/mars_task.h
+++ b/include/host/mars/mars_task.h
@@ -44,18 +44,18 @@ 
  * \brief [host] MARS Task API
  */
 
+#include <mars/mars_task_barrier.h>
+#include <mars/mars_task_event_flag.h>
+#include <mars/mars_task_queue.h>
+#include <mars/mars_task_semaphore.h>
+#include <mars/mars_task_signal.h>
+#include <mars/mars_task_types.h>
+
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_barrier.h"
-#include "mars/mars_task_event_flag.h"
-#include "mars/mars_task_queue.h"
-#include "mars/mars_task_semaphore.h"
-#include "mars/mars_task_signal.h"
-#include "mars/mars_task_types.h"
-
-
 /**
  * \ingroup group_mars_task
  * \brief [host] Initializes a MARS task.
--- a/include/host/mars/mars_task_barrier.h
+++ b/include/host/mars/mars_task_barrier.h
@@ -44,14 +44,14 @@ 
  * \brief [host] MARS Task Barrier API
  */
 
+#include <mars/mars_task_barrier_types.h>
+
+struct mars_context;
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_barrier_types.h"
-
-struct mars_context;
-
 /**
  * \ingroup group_mars_task_barrier
  * \brief [host] Initializes a task barrier.
--- a/include/host/mars/mars_task_event_flag.h
+++ b/include/host/mars/mars_task_event_flag.h
@@ -44,14 +44,14 @@ 
  * \brief [host] MARS Task Event Flag API
  */
 
+#include <mars/mars_task_event_flag_types.h>
+
+struct mars_context;
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_event_flag_types.h"
-
-struct mars_context;
-
 /**
  * \ingroup group_mars_task_event_flag
  * \brief [host] Initializes a task event flag.
--- a/include/host/mars/mars_task_queue.h
+++ b/include/host/mars/mars_task_queue.h
@@ -44,14 +44,14 @@ 
  * \brief [host] MARS Task Queue Flag API
  */
 
+#include <mars/mars_task_queue_types.h>
+
+struct mars_context;
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_queue_types.h"
-
-struct mars_context;
-
 /**
  * \ingroup group_mars_task_queue
  * \brief [host] Initializes a task queue.
--- a/include/host/mars/mars_task_semaphore.h
+++ b/include/host/mars/mars_task_semaphore.h
@@ -44,14 +44,14 @@ 
  * \brief [host] MARS Task Semaphore API
  */
 
+#include <mars/mars_task_semaphore_types.h>
+
+struct mars_context;
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_semaphore_types.h"
-
-struct mars_context;
-
 /**
  * \ingroup group_mars_task_semaphore
  * \brief [host] Initializes a task semaphore.
--- a/include/host/mars/mars_task_signal.h
+++ b/include/host/mars/mars_task_signal.h
@@ -44,12 +44,12 @@ 
  * \brief [host] MARS Task Signal API
  */
 
+#include <mars/mars_task_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_types.h"
-
 /**
  * \ingroup group_mars_task_signal
  * \brief [host] Sends a signal to the specified task.
--- a/include/host/mars/mars_timer.h
+++ b/include/host/mars/mars_timer.h
@@ -43,10 +43,6 @@ 
  * \brief [host] MARS Timer API
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <sys/time.h>
 #include "mars/mars_debug.h"
 
@@ -69,6 +65,10 @@  struct mars_timer {
 	unsigned long long end;		/**< internal - stop time */
 };
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 /*
  * \ingroup group_mars_timer
  * \brief Starts the timer
--- a/include/host/mars/mars_workload_queue.h
+++ b/include/host/mars/mars_workload_queue.h
@@ -38,12 +38,12 @@ 
 #ifndef MARS_WORKLOAD_QUEUE_H
 #define MARS_WORKLOAD_QUEUE_H
 
+#include "mars/mars_workload_types.h"
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_workload_types.h"
-
 int workload_queue_initialize(struct mars_workload_queue *queue);
 int workload_queue_finalize(struct mars_workload_queue *queue);
 int workload_queue_exit(struct mars_workload_queue *queue);
--- a/include/mpu/mars/mars.h
+++ b/include/mpu/mars/mars.h
@@ -44,16 +44,8 @@ 
  * \brief [MPU] MARS API
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#include "mars/mars_error.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_task.h"
-
-#if defined(__cplusplus)
-}
-#endif
+#include <mars/mars_error.h>
+#include <mars/mars_mutex.h>
+#include <mars/mars_task.h>
 
 #endif
--- a/include/mpu/mars/mars_dma.h
+++ b/include/mpu/mars/mars_dma.h
@@ -44,10 +44,6 @@ 
  * \brief [MPU] MARS DMA API
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <spu_mfcio.h>
 #include "mars/mars_debug.h"
 
@@ -57,6 +53,10 @@  extern "C" {
 #define MARS_DMA_SIZE_MASK	0xf	/* dma 16 byte size mask */
 #define MARS_DMA_SIZE_MAX	16384	/* dma single tranfer size max 16KB */
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 /* size max 16 KB */
 static inline unsigned int _list_init(mfc_list_element_t *list,
 				unsigned int size, unsigned int eal)
--- a/include/mpu/mars/mars_kernel.h
+++ b/include/mpu/mars/mars_kernel.h
@@ -38,10 +38,6 @@ 
 #ifndef MARS_KERNEL_H
 #define MARS_KERNEL_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 #include "mars/mars_dma.h"
@@ -78,6 +74,11 @@  struct mars_kernel_syscalls {
 };
 
 typedef void (*mars_entry)(void *workload_args, void *kernel_syscalls);
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 void mars_reentry(void);
 
 /* kernel scheduler function */
--- a/include/mpu/mars/mars_mutex.h
+++ b/include/mpu/mars/mars_mutex.h
@@ -44,12 +44,12 @@ 
  * \brief [MPU] MARS Mutex API
  */
 
+#include <mars/mars_mutex_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_mutex_types.h"
-
 /**
  * \ingroup group_mars_mutex
  * \brief [MPU] Initializes a mutex.
--- a/include/mpu/mars/mars_syscalls.h
+++ b/include/mpu/mars/mars_syscalls.h
@@ -38,12 +38,12 @@ 
 #ifndef MARS_SYSCALLS_H
 #define MARS_SYSCALLS_H
 
+#include <stdint.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include <stdint.h>
-
 uint64_t mars_get_mars_context_ea(void);
 uint32_t mars_get_kernel_id(void);
 uint16_t mars_get_workload_id(void);
--- a/include/mpu/mars/mars_task.h
+++ b/include/mpu/mars/mars_task.h
@@ -44,17 +44,17 @@ 
  * \brief [MPU] MARS Task API
  */
 
+#include <mars/mars_task_barrier.h>
+#include <mars/mars_task_event_flag.h>
+#include <mars/mars_task_queue.h>
+#include <mars/mars_task_semaphore.h>
+#include <mars/mars_task_signal.h>
+#include <mars/mars_task_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_barrier.h"
-#include "mars/mars_task_event_flag.h"
-#include "mars/mars_task_queue.h"
-#include "mars/mars_task_semaphore.h"
-#include "mars/mars_task_signal.h"
-#include "mars/mars_task_types.h"
-
 /**
  * \ingroup group_mars_task
  * \brief [MPU] Entry point for task.
--- a/include/mpu/mars/mars_task_barrier.h
+++ b/include/mpu/mars/mars_task_barrier.h
@@ -44,12 +44,12 @@ 
  * \brief [MPU] MARS Task Barrier API
  */
 
+#include <mars/mars_task_barrier_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_barrier_types.h"
-
 /**
  * \ingroup group_mars_task_barrier
  * \brief [MPU] Initializes a task barrier.
--- a/include/mpu/mars/mars_task_event_flag.h
+++ b/include/mpu/mars/mars_task_event_flag.h
@@ -44,12 +44,12 @@ 
  * \brief [MPU] MARS Task Event Flag API
  */
 
+#include <mars/mars_task_event_flag_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_event_flag_types.h"
-
 /**
  * \ingroup group_mars_task_event_flag
  * \brief [MPU] Initializes a task event flag.
--- a/include/mpu/mars/mars_task_queue.h
+++ b/include/mpu/mars/mars_task_queue.h
@@ -44,12 +44,12 @@ 
  * \brief [MPU] MARS Task Queue API
  */
 
+#include <mars/mars_task_queue_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_queue_types.h"
-
 /**
  * \ingroup group_mars_task_queue
  * \brief [MPU] Initializes a task queue.
--- a/include/mpu/mars/mars_task_semaphore.h
+++ b/include/mpu/mars/mars_task_semaphore.h
@@ -44,12 +44,12 @@ 
  * \brief [MPU] MARS Task Semaphore API
  */
 
+#include <mars/mars_task_semaphore_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_semaphore_types.h"
-
 /**
  * \ingroup group_mars_task_semaphore
  * \brief [MPU] Initializes a task semaphore.
--- a/include/mpu/mars/mars_task_signal.h
+++ b/include/mpu/mars/mars_task_signal.h
@@ -44,12 +44,12 @@ 
  * \brief [MPU] MARS Task Signal API
  */
 
+#include <mars/mars_task_types.h>
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#include "mars/mars_task_types.h"
-
 /**
  * \ingroup group_mars_task_signal
  * \brief [MPU] Sends a signal to the specified task.
--- a/include/mpu/mars/mars_timer.h
+++ b/include/mpu/mars/mars_timer.h
@@ -43,15 +43,9 @@ 
  * \brief MARS Timer API [MPU]
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <spu_intrinsics.h>
 #include "mars/mars_debug.h"
 
-static const unsigned int mars_timebase = 79800000;
-
 /*
  * \ingroup group_mars_timer
  * \brief MARS timer structure
@@ -71,6 +65,12 @@  struct mars_timer {
 	unsigned int end;	/**< internal - stop time */
 };
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+static const unsigned int mars_timebase = 79800000;
+
 /*
  * \ingroup group_mars_timer
  * \brief Starts the timer
@@ -116,4 +116,8 @@  static inline void mars_timer_stop(struc
 	timer->us = timer->s * 1.0e6;
 }
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif