[Cbe-oss-dev] [PATCH 24/28]MARS/task: module mutex api
Yuji Mano
yuji.mano at am.sony.com
Fri Feb 6 13:33:04 EST 2009
This updates the task module API to provide wrappers into the mutex kernel
syscalls.
Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
task/src/mpu/lib/task_barrier.c | 1 -
task/src/mpu/lib/task_event_flag.c | 1 -
task/src/mpu/lib/task_queue.c | 1 -
task/src/mpu/lib/task_semaphore.c | 1 -
task/src/mpu/module/task_module.c | 15 ++++++++++++++-
task/src/mpu/module/task_module.h | 18 ++++++++++++++++++
6 files changed, 32 insertions(+), 5 deletions(-)
--- a/task/src/mpu/lib/task_barrier.c
+++ b/task/src/mpu/lib/task_barrier.c
@@ -38,7 +38,6 @@
#include "config.h"
#include <mars/error.h>
-#include <mars/mutex.h>
#include "mars/task_barrier.h"
#include "mars/task_types.h"
--- a/task/src/mpu/lib/task_event_flag.c
+++ b/task/src/mpu/lib/task_event_flag.c
@@ -41,7 +41,6 @@
#include "config.h"
#include <mars/error.h>
-#include <mars/mutex.h>
#include "mars/task_event_flag.h"
#include "mars/task_types.h"
--- a/task/src/mpu/lib/task_queue.c
+++ b/task/src/mpu/lib/task_queue.c
@@ -42,7 +42,6 @@
#include <mars/dma.h>
#include <mars/error.h>
-#include <mars/mutex.h>
#include "mars/task_types.h"
#include "mars/task_queue.h"
--- a/task/src/mpu/lib/task_semaphore.c
+++ b/task/src/mpu/lib/task_semaphore.c
@@ -41,7 +41,6 @@
#include "config.h"
#include <mars/error.h>
-#include <mars/mutex.h>
#include "mars/task_types.h"
#include "mars/task_semaphore.h"
--- a/task/src/mpu/module/task_module.c
+++ b/task/src/mpu/module/task_module.c
@@ -431,6 +431,16 @@ static int task_signal_try_wait(void)
return mars_module_workload_signal_reset();
}
+static int mutex_lock_get(uint64_t mutex_ea, struct mars_mutex *mutex)
+{
+ return mars_module_mutex_lock_get(mutex_ea, mutex);
+}
+
+static int mutex_unlock_put(uint64_t mutex_ea, struct mars_mutex *mutex)
+{
+ return mars_module_mutex_unlock_put(mutex_ea, mutex);
+}
+
static struct mars_task_module_syscalls task_module_syscalls =
{
get_ticks,
@@ -446,7 +456,10 @@ static struct mars_task_module_syscalls
task_signal_host,
task_signal_send,
task_signal_wait,
- task_signal_try_wait
+ task_signal_try_wait,
+
+ mutex_lock_get,
+ mutex_unlock_put
};
static void context_start(void)
--- a/task/src/mpu/module/task_module.h
+++ b/task/src/mpu/module/task_module.h
@@ -41,6 +41,7 @@
#include <stdint.h>
#include <unistd.h>
+#include "mars/mutex_types.h"
#include "mars/task_types.h"
#include "task_internal_types.h"
@@ -63,6 +64,11 @@ struct mars_task_module_syscalls {
int (*signal_send)(uint16_t workload_id);
int (*signal_wait)(void *heap);
int (*signal_try_wait)(void);
+
+ int (*mutex_lock_get)(uint64_t mutex_ea,
+ struct mars_mutex *mutex);
+ int (*mutex_unlock_put)(uint64_t mutex_ea,
+ struct mars_mutex *mutex);
};
#if defined(__cplusplus)
@@ -145,6 +151,18 @@ static inline int mars_task_module_signa
return (*mars_task_module_syscalls->signal_try_wait)();
}
+static inline int mars_mutex_lock_get(uint64_t mutex_ea,
+ struct mars_mutex *mutex)
+{
+ return (*mars_task_module_syscalls->mutex_lock_get)(mutex_ea, mutex);
+}
+
+static inline int mars_mutex_unlock_put(uint64_t mutex_ea,
+ struct mars_mutex *mutex)
+{
+ return (*mars_task_module_syscalls->mutex_unlock_put)(mutex_ea, mutex);
+}
+
#if defined(__cplusplus)
}
#endif
More information about the cbe-oss-dev
mailing list