[Cbe-oss-dev] [patch 1/4] MARS: Header file cleanups

Geoff Levand geoffrey.levand at am.sony.com
Sun Aug 24 12:50:28 EST 2008


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

Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
 include/common/mars/mars_debug.h                 |    8 --------
 include/common/mars/mars_error.h                 |    8 --------
 include/common/mars/mars_kernel_types.h          |    8 --------
 include/common/mars/mars_mutex_types.h           |    8 --------
 include/common/mars/mars_task_barrier_types.h    |    8 --------
 include/common/mars/mars_task_event_flag_types.h |    8 --------
 include/common/mars/mars_task_queue_types.h      |    8 --------
 include/common/mars/mars_task_semaphore_types.h  |    8 --------
 include/common/mars/mars_task_types.h            |    8 --------
 include/common/mars/mars_workload_types.h        |    8 --------
 include/host/mars/mars.h                         |   14 +++++++-------
 include/host/mars/mars_atomic.h                  |   10 +++++-----
 include/host/mars/mars_elf.h                     |    8 ++++----
 include/host/mars/mars_mutex.h                   |    4 ++--
 include/host/mars/mars_task.h                    |   20 ++++++++++----------
 include/host/mars/mars_task_barrier.h            |    8 ++++----
 include/host/mars/mars_task_event_flag.h         |    8 ++++----
 include/host/mars/mars_task_queue.h              |    8 ++++----
 include/host/mars/mars_task_semaphore.h          |    8 ++++----
 include/host/mars/mars_task_signal.h             |    4 ++--
 include/host/mars/mars_timer.h                   |   10 +++++-----
 include/host/mars/mars_workload_queue.h          |    4 ++--
 include/mpu/mars/mars.h                          |   14 +++-----------
 include/mpu/mars/mars_atomic.h                   |   10 +++++-----
 include/mpu/mars/mars_dma.h                      |   10 +++++-----
 include/mpu/mars/mars_kernel.h                   |   23 ++++++++++++-----------
 include/mpu/mars/mars_mutex.h                    |    4 ++--
 include/mpu/mars/mars_syscalls.h                 |    4 ++--
 include/mpu/mars/mars_task.h                     |   14 +++++++-------
 include/mpu/mars/mars_task_barrier.h             |    4 ++--
 include/mpu/mars/mars_task_event_flag.h          |    4 ++--
 include/mpu/mars/mars_task_queue.h               |    4 ++--
 include/mpu/mars/mars_task_semaphore.h           |    4 ++--
 include/mpu/mars/mars_task_signal.h              |    4 ++--
 include/mpu/mars/mars_timer.h                    |   18 +++++++++++-------
 src/host/lib/Makefile.am                         |    4 ++--
 src/host/lib/mars.c                              |   10 +++++-----
 src/host/lib/mars_elf.c                          |    6 +++---
 src/host/lib/mars_mutex.c                        |    8 ++++----
 src/host/lib/mars_task.c                         |   12 ++++++------
 src/host/lib/mars_task_barrier.c                 |    8 ++++----
 src/host/lib/mars_task_event_flag.c              |   12 ++++++------
 src/host/lib/mars_task_queue.c                   |   12 ++++++------
 src/host/lib/mars_task_semaphore.c               |    8 ++++----
 src/host/lib/mars_task_signal.c                  |    8 ++++----
 src/host/lib/mars_workload_queue.c               |    8 ++++----
 src/mpu/kernel/Makefile.am                       |    4 ++--
 src/mpu/kernel/mars_kernel.c                     |    8 ++++----
 src/mpu/kernel/mars_kernel_registers.c           |    2 +-
 src/mpu/kernel/mars_kernel_scheduler.c           |    2 +-
 src/mpu/kernel/mars_kernel_syscalls.c            |    2 +-
 src/mpu/kernel/mars_kernel_task.c                |    2 +-
 src/mpu/kernel/mars_kernel_workload.c            |    2 +-
 src/mpu/lib/Makefile.am                          |    4 ++--
 src/mpu/lib/mars_mutex.c                         |   10 +++++-----
 src/mpu/lib/mars_syscalls.c                      |    4 ++--
 src/mpu/lib/mars_task.c                          |   10 +++++-----
 src/mpu/lib/mars_task_barrier.c                  |   12 ++++++------
 src/mpu/lib/mars_task_event_flag.c               |   12 ++++++------
 src/mpu/lib/mars_task_queue.c                    |   14 +++++++-------
 src/mpu/lib/mars_task_semaphore.c                |   12 ++++++------
 src/mpu/lib/mars_task_signal.c                   |   10 +++++-----
 62 files changed, 213 insertions(+), 296 deletions(-)

--- 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_FLAG_NONE			0x0
@@ -56,8 +52,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>
 
 /**
@@ -94,8 +90,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>
 
 /**
@@ -159,8 +155,4 @@ struct mars_task_context {
 	uint8_t pad[24];		/* 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 */
@@ -104,8 +100,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,14 +44,10 @@
  * \brief [host] MARS API
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <pthread.h>
-#include "mars/mars_error.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_task.h"
+#include <mars_error.h>
+#include <mars_mutex.h>
+#include <mars_task.h>
 
 /**
  * \ingroup group_mars_context
@@ -89,6 +85,10 @@ struct mars_context {
 	unsigned int mpu_context_count;
 };
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 /**
  * \ingroup group_mars_context
  * \brief [host] Initializes a single MARS context.
--- a/include/host/mars/mars_atomic.h
+++ b/include/host/mars/mars_atomic.h
@@ -38,15 +38,15 @@
 #ifndef MARS_ATOMIC_H
 #define MARS_ATOMIC_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <ppu_intrinsics.h>
-#include "mars/mars_debug.h"
+#include "mars_debug.h"
 
 #define MARS_ATOMIC_ALIGNMENT_MASK	0x7f
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 static inline int atomic_get(void *addr)
 {
 	MARS_ASSERT(((uintptr_t)addr & MARS_ATOMIC_ALIGNMENT_MASK) == 0);
--- a/include/host/mars/mars_elf.h
+++ b/include/host/mars/mars_elf.h
@@ -38,14 +38,14 @@
 #ifndef MARS_ELF_H
 #define MARS_ELF_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
 
 #define MARS_ELF_VADDR		0x10000
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 int mars_elf_parse(const void *elf_image, uint64_t *exec, uint32_t *exec_size,
 			uint32_t *bss_size, uint32_t *vaddr, uint32_t *entry);
 
--- 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_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,16 +44,12 @@
  * \brief [host] MARS Task API
  */
 
-#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"
+#include <mars_task_barrier.h>
+#include <mars_task_event_flag.h>
+#include <mars_task_queue.h>
+#include <mars_task_semaphore.h>
+#include <mars_task_signal.h>
+#include <mars_task_types.h>
 
 struct mars_context;
 struct mars_exec_context;
@@ -74,6 +70,10 @@ struct mars_task_params {
 	uint32_t context_save_size;
 };
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 /**
  * \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_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_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_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_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_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,12 +43,8 @@
  * \brief [host] MARS Timer API
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <sys/time.h>
-#include "mars/mars_debug.h"
+#include "mars_debug.h"
 
 /*
  * \ingroup group_mars_timer
@@ -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_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_add(struct mars_workload_queue *queue, uint16_t *id,
--- 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_error.h>
+#include <mars_mutex.h>
+#include <mars_task.h>
 
 #endif
--- a/include/mpu/mars/mars_atomic.h
+++ b/include/mpu/mars/mars_atomic.h
@@ -38,15 +38,15 @@
 #ifndef MARS_ATOMIC_H
 #define MARS_ATOMIC_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <spu_mfcio.h>
-#include "mars/mars_debug.h"
+#include "mars_debug.h"
 
 #define MARS_ATOMIC_ALIGNMENT_MASK	0x7f
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 static inline void atomic_event_setup(void)
 {
 	/* clear phantom events and set event mask */
--- a/include/mpu/mars/mars_dma.h
+++ b/include/mpu/mars/mars_dma.h
@@ -44,12 +44,8 @@
  * \brief [MPU] MARS DMA API
  */
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <spu_mfcio.h>
-#include "mars/mars_debug.h"
+#include "mars_debug.h"
 
 #define MARS_DMA_TAG		31	/* dma tag reserved for MARS */
 #define MARS_DMA_TAG_MAX	31	/* dma tag 0~31 */
@@ -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,18 +38,14 @@
 #ifndef MARS_KERNEL_H
 #define MARS_KERNEL_H
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
 #include <stdint.h>
-#include "mars/mars_dma.h"
-#include "mars/mars_timer.h"
-#include "mars/mars_atomic.h"
-#include "mars/mars_error.h"
-#include "mars/mars_kernel_types.h"
-#include "mars/mars_workload_types.h"
-#include "mars/mars_task_types.h"
+#include "mars_dma.h"
+#include "mars_timer.h"
+#include "mars_atomic.h"
+#include "mars_error.h"
+#include "mars_kernel_types.h"
+#include "mars_workload_types.h"
+#include "mars_task_types.h"
 
 #define MARS_KERNEL_STATUS_BUSY		0x0
 #define MARS_KERNEL_STATUS_IDLE		0x1
@@ -75,6 +71,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_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_task_barrier.h>
+#include <mars_task_event_flag.h>
+#include <mars_task_queue.h>
+#include <mars_task_semaphore.h>
+#include <mars_task_signal.h>
+#include <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_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_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_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_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_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,14 +43,8 @@
  * \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;
+#include "mars_debug.h"
 
 /*
  * \ingroup group_mars_timer
@@ -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
--- a/src/host/lib/Makefile.am
+++ b/src/host/lib/Makefile.am
@@ -41,8 +41,8 @@ MAINTAINERCLEANFILES = Makefile.in
 lib_LTLIBRARIES = libmars.la
 
 libmars_la_CPPFLAGS = \
-	-I$(srcdir)/../../../include/host \
-	-I$(srcdir)/../../../include/common
+	-I$(srcdir)/../../../include/host/mars \
+	-I$(srcdir)/../../../include/common/mars
 
 libmars_la_CFLAGS = \
 	$(HOST_FLAGS)
--- a/src/host/lib/mars.c
+++ b/src/host/lib/mars.c
@@ -40,11 +40,11 @@
 #include <pthread.h>
 #include <libspe2.h>
 
-#include "mars/mars.h"
-#include "mars/mars_workload_queue.h"
-#include "mars/mars_kernel_types.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars.h"
+#include "mars_workload_queue.h"
+#include "mars_kernel_types.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 extern struct spe_program_handle mars_kernel_entry;
 
--- a/src/host/lib/mars_elf.c
+++ b/src/host/lib/mars_elf.c
@@ -37,9 +37,9 @@
 
 #include <elf.h>
 
-#include "mars/mars_elf.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_elf.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_elf_parse(const void *elf_image, uint64_t *exec, uint32_t *exec_size,
 			uint32_t *bss_size, uint32_t *vaddr, uint32_t *entry)
--- a/src/host/lib/mars_mutex.c
+++ b/src/host/lib/mars_mutex.c
@@ -35,10 +35,10 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_mutex.h"
-#include "mars/mars_atomic.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_mutex.h"
+#include "mars_atomic.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_mutex_initialize(struct mars_mutex *mutex)
 {
--- a/src/host/lib/mars_task.c
+++ b/src/host/lib/mars_task.c
@@ -38,12 +38,12 @@
 #include <string.h>
 #include <malloc.h>
 
-#include "mars/mars_task.h"
-#include "mars/mars_workload_queue.h"
-#include "mars/mars.h"
-#include "mars/mars_elf.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task.h"
+#include "mars_workload_queue.h"
+#include "mars.h"
+#include "mars_elf.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_initialize(struct mars_context *mars,
 			struct mars_task_id *id,
--- a/src/host/lib/mars_task_barrier.c
+++ b/src/host/lib/mars_task_barrier.c
@@ -35,10 +35,10 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_task_barrier.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_barrier.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_barrier_initialize(struct mars_context *mars,
 				struct mars_task_barrier *barrier,
--- a/src/host/lib/mars_task_event_flag.c
+++ b/src/host/lib/mars_task_event_flag.c
@@ -37,12 +37,12 @@
 
 #include <sched.h>
 
-#include "mars/mars_task_event_flag.h"
-#include "mars/mars_workload_queue.h"
-#include "mars/mars.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_event_flag.h"
+#include "mars_workload_queue.h"
+#include "mars.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_event_flag_initialize(struct mars_context *mars,
 				struct mars_task_event_flag *event_flag,
--- a/src/host/lib/mars_task_queue.c
+++ b/src/host/lib/mars_task_queue.c
@@ -37,12 +37,12 @@
 
 #include <sched.h>
 
-#include "mars/mars_task_queue.h"
-#include "mars/mars_workload_queue.h"
-#include "mars/mars.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_queue.h"
+#include "mars_workload_queue.h"
+#include "mars.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_queue_initialize(struct mars_context *mars,
 				struct mars_task_queue *queue,
--- a/src/host/lib/mars_task_semaphore.c
+++ b/src/host/lib/mars_task_semaphore.c
@@ -37,10 +37,10 @@
 
 #include <stdlib.h>
 
-#include "mars/mars_task_semaphore.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_semaphore.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_semaphore_initialize(struct mars_context *mars,
 				struct mars_task_semaphore *semaphore,
--- a/src/host/lib/mars_task_signal.c
+++ b/src/host/lib/mars_task_signal.c
@@ -35,10 +35,10 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_task_signal.h"
-#include "mars/mars.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_signal.h"
+#include "mars.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_signal_send(struct mars_task_id *id)
 {
--- a/src/host/lib/mars_workload_queue.c
+++ b/src/host/lib/mars_workload_queue.c
@@ -39,10 +39,10 @@
 #include <unistd.h>
 #include <string.h>
 
-#include "mars/mars_workload_queue.h"
-#include "mars/mars_kernel_types.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_workload_queue.h"
+#include "mars_kernel_types.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int workload_queue_initialize(struct mars_workload_queue *queue)
 {
--- a/src/mpu/kernel/Makefile.am
+++ b/src/mpu/kernel/Makefile.am
@@ -41,8 +41,8 @@ MAINTAINERCLEANFILES = Makefile.in
 noinst_PROGRAMS = mars_kernel mars_kernel.eo
 
 mars_kernel_CPPFLAGS = \
-	-I$(srcdir)/../../../include/mpu \
-	-I$(srcdir)/../../../include/common
+	-I$(srcdir)/../../../include/mpu/mars \
+	-I$(srcdir)/../../../include/common/mars
 
 mars_kernel_CFLAGS = \
 	-Wall \
--- a/src/mpu/kernel/mars_kernel.c
+++ b/src/mpu/kernel/mars_kernel.c
@@ -37,10 +37,10 @@
 
 #include <stdlib.h>
 
-#include "mars/mars_kernel.h"
-#include "mars/mars_dma.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_kernel.h"
+#include "mars_dma.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 struct mars_kernel_params kernel_params;
 
--- a/src/mpu/kernel/mars_kernel_registers.c
+++ b/src/mpu/kernel/mars_kernel_registers.c
@@ -35,7 +35,7 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_kernel.h"
+#include "mars_kernel.h"
 
 void registers_save(void)
 {
--- a/src/mpu/kernel/mars_kernel_scheduler.c
+++ b/src/mpu/kernel/mars_kernel_scheduler.c
@@ -35,7 +35,7 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_kernel.h"
+#include "mars_kernel.h"
 
 #define MARS_WORKLOAD_RESERVED_NONE	0
 #define MARS_WORKLOAD_RESERVED		1
--- a/src/mpu/kernel/mars_kernel_syscalls.c
+++ b/src/mpu/kernel/mars_kernel_syscalls.c
@@ -35,7 +35,7 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_kernel.h"
+#include "mars_kernel.h"
 
 struct mars_kernel_syscalls kernel_syscalls;
 
--- a/src/mpu/kernel/mars_kernel_task.c
+++ b/src/mpu/kernel/mars_kernel_task.c
@@ -36,7 +36,7 @@
  */
 
 #include <string.h>
-#include "mars/mars_kernel.h"
+#include "mars_kernel.h"
 
 extern void *process_stack;
 
--- a/src/mpu/kernel/mars_kernel_workload.c
+++ b/src/mpu/kernel/mars_kernel_workload.c
@@ -35,7 +35,7 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_kernel.h"
+#include "mars_kernel.h"
 
 extern struct mars_workload_queue_header queue_header;
 extern struct mars_workload_queue_block queue_block;
--- a/src/mpu/lib/Makefile.am
+++ b/src/mpu/lib/Makefile.am
@@ -41,8 +41,8 @@ MAINTAINERCLEANFILES = Makefile.in
 lib_LIBRARIES = libmars.a
 
 libmars_a_CPPFLAGS = \
-	-I$(srcdir)/../../../include/mpu \
-	-I$(srcdir)/../../../include/common
+	-I$(srcdir)/../../../include/mpu/mars \
+	-I$(srcdir)/../../../include/common/mars
 
 libmars_a_CFLAGS = \
 	-Wall \
--- a/src/mpu/lib/mars_mutex.c
+++ b/src/mpu/lib/mars_mutex.c
@@ -35,11 +35,11 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_mutex.h"
-#include "mars/mars_atomic.h"
-#include "mars/mars_dma.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_mutex.h"
+#include "mars_atomic.h"
+#include "mars_dma.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 static struct mars_mutex mutex;
 
--- a/src/mpu/lib/mars_syscalls.c
+++ b/src/mpu/lib/mars_syscalls.c
@@ -35,8 +35,8 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_syscalls.h"
-#include "mars/mars_kernel.h"
+#include "mars_syscalls.h"
+#include "mars_kernel.h"
 
 struct mars_kernel_syscalls *mars_kernel_syscalls;
 
--- a/src/mpu/lib/mars_task.c
+++ b/src/mpu/lib/mars_task.c
@@ -35,11 +35,11 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_task.h"
-#include "mars/mars_task_types.h"
-#include "mars/mars_syscalls.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task.h"
+#include "mars_task_types.h"
+#include "mars_syscalls.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 void mars_task_exit(void)
 {
--- a/src/mpu/lib/mars_task_barrier.c
+++ b/src/mpu/lib/mars_task_barrier.c
@@ -35,12 +35,12 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_task_barrier.h"
-#include "mars/mars_task_types.h"
-#include "mars/mars_syscalls.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_barrier.h"
+#include "mars_task_types.h"
+#include "mars_syscalls.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 static struct mars_task_barrier barrier;
 
--- a/src/mpu/lib/mars_task_event_flag.c
+++ b/src/mpu/lib/mars_task_event_flag.c
@@ -37,12 +37,12 @@
 
 #include <string.h>
 
-#include "mars/mars_task_event_flag.h"
-#include "mars/mars_task_types.h"
-#include "mars/mars_syscalls.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_event_flag.h"
+#include "mars_task_types.h"
+#include "mars_syscalls.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 static struct mars_task_event_flag event_flag;
 
--- a/src/mpu/lib/mars_task_queue.c
+++ b/src/mpu/lib/mars_task_queue.c
@@ -37,13 +37,13 @@
 
 #include <string.h>
 
-#include "mars/mars_task_queue.h"
-#include "mars/mars_task_types.h"
-#include "mars/mars_syscalls.h"
-#include "mars/mars_dma.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_queue.h"
+#include "mars_task_types.h"
+#include "mars_syscalls.h"
+#include "mars_dma.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 static struct mars_task_queue queue;
 
--- a/src/mpu/lib/mars_task_semaphore.c
+++ b/src/mpu/lib/mars_task_semaphore.c
@@ -38,12 +38,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "mars/mars_task_semaphore.h"
-#include "mars/mars_task_types.h"
-#include "mars/mars_syscalls.h"
-#include "mars/mars_mutex.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_semaphore.h"
+#include "mars_task_types.h"
+#include "mars_syscalls.h"
+#include "mars_mutex.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 static struct mars_task_semaphore semaphore;
 
--- a/src/mpu/lib/mars_task_signal.c
+++ b/src/mpu/lib/mars_task_signal.c
@@ -35,11 +35,11 @@
  * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
  */
 
-#include "mars/mars_task_signal.h"
-#include "mars/mars_task_types.h"
-#include "mars/mars_syscalls.h"
-#include "mars/mars_error.h"
-#include "mars/mars_debug.h"
+#include "mars_task_signal.h"
+#include "mars_task_types.h"
+#include "mars_syscalls.h"
+#include "mars_error.h"
+#include "mars_debug.h"
 
 int mars_task_signal_send(struct mars_task_id *id)
 {





More information about the cbe-oss-dev mailing list