[Cbe-oss-dev] [PATCH 16/17]MARS/samples: Host api use ea

Yuji Mano yuji.mano at am.sony.com
Wed Nov 26 14:40:46 EST 2008


From: Kazunori Asayama <asayama at sm.sony.co.jp>

Fix samples to use uint64_t to hold MARS objects

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 samples/barrier/host.c    |    4 ++--
 samples/event_flag/host.c |   14 +++++++-------
 samples/grayscale/host.c  |    8 ++++----
 samples/mutex/host.c      |    4 ++--
 samples/queue/host.c      |   14 +++++++-------
 samples/semaphore/host.c  |    4 ++--
 6 files changed, 24 insertions(+), 24 deletions(-)

--- a/samples/barrier/host.c
+++ b/samples/barrier/host.c
@@ -43,7 +43,7 @@ extern struct spe_program_handle mpu_tas
 static struct mars_context *mars_ctx;
 static struct mars_task_id task_id[NUM_TASKS];
 static struct mars_task_args task_args;
-static struct mars_task_barrier *barrier;
+static uint64_t barrier;
 
 int main(void)
 {
@@ -74,7 +74,7 @@ int main(void)
 			return 1;
 		}
 
-		task_args.type.u64[0] = mars_ptr_to_ea(barrier);
+		task_args.type.u64[0] = barrier;
 		task_args.type.u64[1] = i;
 		ret = mars_task_schedule(&task_id[i], &task_args, 0);
 		if (ret) {
--- a/samples/event_flag/host.c
+++ b/samples/event_flag/host.c
@@ -58,9 +58,9 @@ static struct mars_context *mars_ctx;
 static struct mars_task_id task1_id;
 static struct mars_task_id task2_id;
 static struct mars_task_args task_args;
-static struct mars_task_event_flag *host_to_mpu;
-static struct mars_task_event_flag *mpu_to_host;
-static struct mars_task_event_flag *mpu_to_mpu;
+static uint64_t host_to_mpu;
+static uint64_t mpu_to_host;
+static uint64_t mpu_to_mpu;
 
 int main(void)
 {
@@ -112,16 +112,16 @@ int main(void)
 		return 1;
 	}
 
-	task_args.type.u64[0] = mars_ptr_to_ea(host_to_mpu);
-	task_args.type.u64[1] = mars_ptr_to_ea(mpu_to_mpu);
+	task_args.type.u64[0] = host_to_mpu;
+	task_args.type.u64[1] = mpu_to_mpu;
 	ret = mars_task_schedule(&task1_id, &task_args, 0);
 	if (ret) {
 		printf("MARS task 1 schedule failed! (%d)\n", ret);
 		return 1;
 	}
 
-	task_args.type.u64[0] = mars_ptr_to_ea(mpu_to_mpu);
-	task_args.type.u64[1] = mars_ptr_to_ea(mpu_to_host);
+	task_args.type.u64[0] = mpu_to_mpu;
+	task_args.type.u64[1] = mpu_to_host;
 	ret = mars_task_schedule(&task2_id, &task_args, 0);
 	if (ret) {
 		printf("MARS task 2 schedule failed! (%d)\n", ret);
--- a/samples/grayscale/host.c
+++ b/samples/grayscale/host.c
@@ -87,8 +87,8 @@ static struct mars_context *mars_ctx;
 static struct mars_task_id task1_id;
 static struct mars_task_id task2_id[NUM_TASKS] __attribute__((aligned(16)));
 static struct mars_task_args task_args;
-static struct mars_task_event_flag *event;
-static struct mars_task_queue *queue;
+static uint64_t event;
+static uint64_t queue;
 
 static grayscale_params_t grayscale_params __attribute__((aligned(16)));
 
@@ -138,8 +138,8 @@ void rgb2y(unsigned char *src, unsigned 
 	}
 
 	grayscale_params.ea_task_id = mars_ptr_to_ea(&task2_id);
-	grayscale_params.ea_event   = mars_ptr_to_ea(event);
-	grayscale_params.ea_queue   = mars_ptr_to_ea(queue);
+	grayscale_params.ea_event   = event;
+	grayscale_params.ea_queue   = queue;
 	grayscale_params.ea_src     = mars_ptr_to_ea(src);
 	grayscale_params.ea_dst     = mars_ptr_to_ea(dst);
 	grayscale_params.num        = num;
--- a/samples/mutex/host.c
+++ b/samples/mutex/host.c
@@ -49,7 +49,7 @@ extern struct spe_program_handle mpu_tas
 static struct mars_context *mars_ctx;
 static struct mars_task_id task_id[NUM_TASKS];
 static struct mars_task_args task_args;
-static struct mars_mutex *mutex;
+static uint64_t mutex;
 static pthread_t thread_id[NUM_TASKS];
 static uint32_t shared_resource __attribute__((aligned(16)));
 
@@ -114,7 +114,7 @@ int main(void)
 			return 1;
 		}
 
-		task_args.type.u64[0] = mars_ptr_to_ea(mutex);
+		task_args.type.u64[0] = mutex;
 		task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
 		ret = mars_task_schedule(&task_id[i], &task_args, 0);
 		if (ret) {
--- a/samples/queue/host.c
+++ b/samples/queue/host.c
@@ -74,9 +74,9 @@ static struct mars_context *mars_ctx;
 static struct mars_task_id task1_id[NUM_TASKS];
 static struct mars_task_id task2_id[NUM_TASKS];
 static struct mars_task_args task_args;
-static struct mars_task_queue *host_to_mpu;
-static struct mars_task_queue *mpu_to_host;
-static struct mars_task_queue *mpu_to_mpu;
+static uint64_t host_to_mpu;
+static uint64_t mpu_to_host;
+static uint64_t mpu_to_mpu;
 
 int main(void)
 {
@@ -134,8 +134,8 @@ int main(void)
 			return 1;
 		}
 
-		task_args.type.u64[0] = mars_ptr_to_ea(host_to_mpu);
-		task_args.type.u64[1] = mars_ptr_to_ea(mpu_to_mpu);
+		task_args.type.u64[0] = host_to_mpu;
+		task_args.type.u64[1] = mpu_to_mpu;
 		task_args.type.u32[4] = NUM_ENTRIES;
 		ret = mars_task_schedule(&task1_id[i], &task_args, 0);
 		if (ret) {
@@ -143,8 +143,8 @@ int main(void)
 			return 1;
 		}
 
-		task_args.type.u64[0] = mars_ptr_to_ea(mpu_to_mpu);
-		task_args.type.u64[1] = mars_ptr_to_ea(mpu_to_host);
+		task_args.type.u64[0] = mpu_to_mpu;
+		task_args.type.u64[1] = mpu_to_host;
 		task_args.type.u32[4] = NUM_ENTRIES;
 		ret = mars_task_schedule(&task2_id[i], &task_args, 0);
 		if (ret) {
--- a/samples/semaphore/host.c
+++ b/samples/semaphore/host.c
@@ -49,7 +49,7 @@ extern struct spe_program_handle mpu_tas
 static struct mars_context *mars_ctx;
 static struct mars_task_id task_id[NUM_TASKS];
 static struct mars_task_args task_args;
-static struct mars_task_semaphore *semaphore;
+static uint64_t semaphore;
 
 int main(void)
 {
@@ -86,7 +86,7 @@ int main(void)
 			return 1;
 		}
 
-		task_args.type.u64[0] = mars_ptr_to_ea(semaphore);
+		task_args.type.u64[0] = semaphore;
 		task_args.type.u64[1] = mars_ptr_to_ea(&shared_resource);
 		ret = mars_task_schedule(&task_id[i], &task_args, 0);
 		if (ret) {





More information about the cbe-oss-dev mailing list