diff TaskManager/Cell/spe/CellDmaManager.cc @ 1009:c67379f9d411

not yet....
author yutaka@localhost.localdomain
date Thu, 28 Oct 2010 13:00:51 +0900
parents 18a548c337cb
children 44b2c4cb539d
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Thu Oct 28 08:43:38 2010 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Thu Oct 28 13:00:51 2010 +0900
@@ -6,6 +6,8 @@
 
 unsigned long long alloc_flag = 0;
 
+QueueInfo<MailQueue> *MailPool = new QueueInfo<MailQueue>() ;
+
 /**
  * DMA Load
  *
@@ -88,21 +90,24 @@
 void CellDmaManager::mail_write_queue(memaddr data)
 {
     (this->*start_dmawait_profile)();
-    if (0 == spu_readchcnt(SPU_WrOutMbox)) {
-      if (mail_queue.empty()) {
+    if (0 != spu_readchcnt(SPU_WrOutMbox)) {
+      if (mail_queue->empty()) {
           spu_write_out_mbox((uint32)data);
       } else {
-	  MailQueuePtr mail = mail_queue.getFirst();
+	  MailQueuePtr mail = mail_queue->poll();
+	  if (mail == NULL) {
+	    printf("あっるえぇー、おっかっしぃぞぉー\n");
+	  }
 	  spu_write_out_mbox((uint32)mail->data);
-	  mail_queue.free_(mail);
-	  mail = mail_queue.create();
+	  mail_queue->free_(mail);
+	  mail = mail_queue->create();
 	  mail->data = data;
-	  mail_queue.addLast(mail);
+	  mail_queue->addLast(mail);
       }
     } else {
-        MailQueuePtr mail = mail_queue.create();
+        MailQueuePtr mail = mail_queue->create();
 	mail->data = data;
-	mail_queue.addLast(mail);
+	mail_queue->addLast(mail);
     }
     (this->*end_dmawait_profile)(&global_mail_time);
 }
@@ -113,13 +118,14 @@
 
     (this->*start_dmawait_profile)();
 
-    while (!mail_queue.empty()) {
-      MailQueuePtr mail = mail_queue.getFirst();
+    while (!mail_queue->empty()) {
+      MailQueuePtr mail = mail_queue->poll();
       spu_write_out_mbox((uint32)mail->data);
-      mail_queue.free_(mail);
+      mail_queue->free_(mail);
     }
 
     spu_write_out_mbox((uint32)data);
+    //mail_queue.freePool();
 
     (this->*end_dmawait_profile)(&global_mail_time);
 }
@@ -152,6 +158,9 @@
 
 CellDmaManager::CellDmaManager() 
 {
+
+  mail_queue = new QueueInfo<MailQueue>(MailPool);
+
     stop_profile();
 }
 void