changeset 643:bffdede05f1e

minor fix.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 21 Nov 2009 10:57:37 +0900
parents 000a3bd205d1
children 5e1a477fcaec
files TaskManager/Fifo/FifoDmaManager.cc TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/kernel/ppe/HTaskInfo.cc TaskManager/kernel/ppe/MailManager.cc TaskManager/kernel/ppe/MailManager.h TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h example/Simple/Makefile.def
diffstat 8 files changed, 30 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Fifo/FifoDmaManager.cc	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.cc	Sat Nov 21 10:57:37 2009 +0900
@@ -31,9 +31,9 @@
     mail_sendQueue
 	= MailManager::append_mailQueue(mail_sendQueue,
 					mailManager->create(data));
-#if 0
+#if 1
     if (MailManager::length(mail_sendQueue)== -1) {
-       fprintf(stderr,"Mail Queue Error\n");
+       fprintf(stderr,"Mail Queue Error %s\n",__FUNCTION__);
        exit(1);
     }
 #endif
@@ -74,31 +74,6 @@
     }
 }
 
-#if 0
-void*
-FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
-{
-    void **buffList;
-    int bound;
-
-    dma_wait(mask);
-
-    if (list->length == 1) {
-	return buff;
-    }
-
-    bound = (int)buff;
-    buffList = (void**)malloc(list->length);
-    buffList[0] = (void*)bound;
-
-    for (int i = 1; i < list->length; i++) {
-	bound += list->element[i-1].size;
-	buffList[i] = (void*)(bound);
-    }
-
-    return (void*)buffList;
-}
-#endif
 
 void
 FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
@@ -114,3 +89,5 @@
 	bound += elm->size;
     }    
 }
+
+/* end */
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc	Sat Nov 21 10:57:37 2009 +0900
@@ -175,9 +175,9 @@
 	mainScheduler->run();
     }
     out_mail_list = mainScheduler->recv_mailList();
-#if 0
+#if 1
     if (MailManager::length(out_mail_list )==-1) {
-	fprintf(stderr, "Error on mail list\n");
+	fprintf(stderr, "Error on mail list %s\n",__FUNCTION__);
 	exit(0);
     }
 #endif
--- a/TaskManager/kernel/ppe/HTaskInfo.cc	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/kernel/ppe/HTaskInfo.cc	Sat Nov 21 10:57:37 2009 +0900
@@ -84,8 +84,8 @@
 HTaskPtr 
 HTaskInfo::create(int cmd, memaddr rbuf, int rs, memaddr wbuf, int ws)
 {
+#ifdef SIMPLE_TASK
     HTaskPtr task = create(cmd);
-#ifdef SIMPLE_TASK
     task->set_input(rbuf, rs);
     task->set_output(wbuf, ws);
     return task;
--- a/TaskManager/kernel/ppe/MailManager.cc	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/kernel/ppe/MailManager.cc	Sat Nov 21 10:57:37 2009 +0900
@@ -59,6 +59,10 @@
 void
 MailManager::free(MailQueuePtr q)
 {
+    if (MailManager::find(q,freeMailQueue)) {
+	fprintf(stderr,"double free %s\n",__FUNCTION__);
+	return;
+    }
     q->next = freeMailQueue;
     freeMailQueue = q;
 }
@@ -118,4 +122,16 @@
     return i;
 }
 
+int
+MailManager::find(MailQueuePtr q,MailQueuePtr list)
+{
+    MailQueuePtr p = list;
+    while(p) {
+	if (p==q)
+	    return -1; 
+        p = p->next;
+    }
+    return 0;
+}
+
 /* end */
--- a/TaskManager/kernel/ppe/MailManager.h	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/kernel/ppe/MailManager.h	Sat Nov 21 10:57:37 2009 +0900
@@ -20,6 +20,7 @@
     void free(MailQueuePtr q);
     static MailQueuePtr append_mailQueue(MailQueuePtr list, MailQueuePtr q);
     static int length(MailQueuePtr list);
+    static int find(MailQueuePtr q,MailQueuePtr list);
 
 private:
     /* variables */
--- a/TaskManager/kernel/schedule/SchedTask.cc	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Sat Nov 21 10:57:37 2009 +0900
@@ -181,6 +181,7 @@
     return scheduler->id;
 }
 
+#ifndef SIMPLE_TASK
 /**
  * task->add_inData で与えられた順番に対応する index (0〜n-1) で、
  * buffer から対応するデータを返す。
@@ -255,13 +256,9 @@
 memaddr
 SchedTask::get_param(int index)
 {
-#ifdef SIMPLE_TASK
-    return param[index];
-#else
     return task->param[index];
+}
 #endif
-}
-
 
 void*
 SchedTask::global_alloc(int id, int size) {
--- a/TaskManager/kernel/schedule/SchedTask.h	Sat Nov 21 10:12:25 2009 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.h	Sat Nov 21 10:57:37 2009 +0900
@@ -122,7 +122,7 @@
     /*!
       SPU用の get_input, get_output
      */
-
+#ifndef SIMPLE_TASK
     void* get_input(int index) {
       return get_input(readbuf, index);
     }
@@ -130,6 +130,7 @@
     void* get_output(int index) {
       return get_output(writebuf, index);
     }
+#endif
 
     // user
     HTaskPtr create_task(int cmd);
--- a/example/Simple/Makefile.def	Sat Nov 21 10:12:25 2009 +0900
+++ b/example/Simple/Makefile.def	Sat Nov 21 10:57:37 2009 +0900
@@ -5,8 +5,8 @@
 # ex  linux/ps3
 CERIUM = ../../../Cerium
 
-# SIMPLE_TASK=-DSIMPLE_TASK
-SIMPLE_TASK=
+SIMPLE_TASK=-DSIMPLE_TASK
+# SIMPLE_TASK=
 
 CC      = g++
 CFLAGS  = -g -Wall -O9 $(SIMPLE_TASK)