changeset 313:c9f8cfcdc5c2

fix ppu mail box waiting (mainMem allocate)
author kono@localhost.localdomain
date Tue, 09 Jun 2009 00:10:36 +0900
parents 57530cb7f7d1
children 2ddf79a7c5fb
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/SpeThreads.cc TaskManager/kernel/schedule/Scheduler.cc example/mainMem/spe/Hello.cc
diffstat 4 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Mon Jun 08 23:19:11 2009 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Jun 09 00:10:36 2009 +0900
@@ -5,6 +5,7 @@
 #include "CellBufferManager.h"
 #include "PpeScheduler.h"
 #include "types.h"
+// #define _PPE_DEBUG
 #include "error.h"
 
 CellTaskManagerImpl::~CellTaskManagerImpl(void)
--- a/TaskManager/Cell/SpeThreads.cc	Mon Jun 08 23:19:11 2009 +0900
+++ b/TaskManager/Cell/SpeThreads.cc	Tue Jun 09 00:10:36 2009 +0900
@@ -119,13 +119,16 @@
 int
 SpeThreads::get_mail(int speid, int count, unsigned int* ret)
 {   
-    while(spe_out_mbox_status(spe_ctx[speid]) < count);    
     return spe_out_mbox_read(spe_ctx[speid], ret, count);    
 }
 
 int
 SpeThreads::check_mail(int speid, int count, unsigned int* ret)
 {
+/* 
+ *  spe_out_mbox_status return only 1, waiting for multiple length
+ *  does not work.
+ */
     if (spe_out_mbox_status(spe_ctx[speid]) >= count) {    
 	return spe_out_mbox_read(spe_ctx[speid], ret, count);   
     } else {
--- a/TaskManager/kernel/schedule/Scheduler.cc	Mon Jun 08 23:19:11 2009 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Tue Jun 09 00:10:36 2009 +0900
@@ -4,6 +4,11 @@
 #include "SchedNop.h"
 #include "error.h"
 
+/*
+ * Edit kernel/schedule/xx.cc, Cell/spe/xx.cc will be over writen by this.
+ * Do not edit Cell/spe/xx.cc unless there is no kernel/schedule/xx.cc files.
+ */
+
 Scheduler::TaskObject task_list[MAX_TASK_OBJECT];
 
 Scheduler::~Scheduler(void)
--- a/example/mainMem/spe/Hello.cc	Mon Jun 08 23:19:11 2009 +0900
+++ b/example/mainMem/spe/Hello.cc	Tue Jun 09 00:10:36 2009 +0900
@@ -12,24 +12,31 @@
 Hello::run(void *rbuf, void *wbuf)
 {
     int task_id = get_param(0);
-    int *ptr = smanager->allocate(SIZE);
+    int *ptr = 0;
+#if 1
+    ptr = (int*)smanager->allocate(SIZE);
 
-    smanager->mainMem_alloc(0, sizeof(PolygonPack));
+    smanager->mainMem_alloc(0, SIZE);
 
     int i;
     for(i=0;i<4096;i++) {
 	ptr[i] = i;
     }
+#endif
 
+    void *next = 0;
+#if 1
     smanager->mainMem_wait();
-    void *next = (void *)smanager->mainMem_get(0);
+    next = (void *)smanager->mainMem_get(0);
 
     smanager->dma_wait(PP_STORE);
     smanager->dma_store(ptr, (uint32)next,
 		SIZE, PP_STORE);
+#endif
 
 
-    printf("[%d] Main Mem %0x len %d\n", task_id, (int*)next,SIZE);
+    fprintf(stderr,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*));
+    fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE);
 
     return 0;
 }