changeset 1417:70f461442b0f draft

null DMA clean up
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 19 Feb 2012 21:01:06 +0900
parents 88d1b95e5f8d
children ff721740df6b
files TaskManager/Cell/spe/CellDmaManager.cc TaskManager/Cell/spe/CellDmaManager.h TaskManager/Fifo/FifoDmaManager.cc TaskManager/Fifo/FifoDmaManager.h TaskManager/Fifo/ReferencedDmaManager.cc TaskManager/Fifo/ReferencedDmaManager.h TaskManager/kernel/schedule/DmaManager.h TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTaskArray.cc TaskManager/kernel/schedule/SchedTaskArrayLoad.cc TaskManager/kernel/schedule/SchedTaskList.cc TaskManager/kernel/schedule/Scheduler.cc
diffstat 12 files changed, 214 insertions(+), 215 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -14,22 +14,23 @@
  * @param[in] size Size of Load Data
  * @param[in] mask DMA tag
 */
-void *CellDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
+void *CellDmaManager::dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask)
 {
-  
-    if ((unsigned long)addr&0xf) {
-      //s->printf("dma_load is not aligned. addr = 0x%lx, size = %d\n",
-      //     (unsigned long)addr, size);
-      return buf;
-    }
-  
+    void *buf = 0;
     if (size == 0) return buf;
-    if (s) buf = s->manager->allocate(size);
-
+    buf = s->manager->allocate(size);
     mfc_get((volatile void *)buf, addr, size, mask, 0, 0);
     return buf;
 }
 
+void *CellDmaManager::dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask)
+{
+    if (size == 0) return buf;
+    mfc_get((volatile void *)buf, addr, size, mask, 0, 0);
+    return buf;
+}
+
+
 void *
 CellDmaManager::get_writebuf(Scheduler *s,memaddr addr, uint32 size)
 {
@@ -49,35 +50,17 @@
 {
     if (size == 0) return buf;
     mfc_put((volatile void *)buf, addr, size, mask, 0, 0);
-	return buf; 
+    return buf; 
 }
 
 void CellDmaManager::dma_wait(uint32 mask)
 {
-
     (this->*start_dmawait_profile)();
     mfc_write_tag_mask(1 << mask);
     mfc_write_tag_update_all();
     mfc_read_tag_status();
     __asm__ __volatile__("   sync");
     (this->*end_dmawait_profile)(&global_wait_time);
-  
-}
-
-void CellDmaManager::dma_wait(uint32 mask, int cmd)
-{
-
-    unsigned long long wait = 0;
-
-    (this->*start_dmawait_profile)();
-    mfc_write_tag_mask(1 << mask);
-    mfc_write_tag_update_all();
-    mfc_read_tag_status();
-    __asm__ __volatile__("   sync");
-    (this->*end_dmawait_profile)(&wait);
-
-    global_wait_time += wait;
-
 }
 
 #ifndef MAIL_QUEUE
@@ -135,7 +118,7 @@
 void CellDmaManager::mail_write_finish_list(memaddr data)
 {
 
-  unsigned long long wait = 0;
+    unsigned long long wait = 0;
 
     while (mail_queue->count()) {
       (this->*start_dmawait_profile)();
@@ -197,10 +180,9 @@
 
 
 
-void *CellDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask)
+void *CellDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask)
 {
-    buff = s->manager->allocate(list->size);
-
+    void *buff = s->manager->allocate(list->size);
     mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length,
 	     mask, 0, 0);
     return buff;
--- a/TaskManager/Cell/spe/CellDmaManager.h	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.h	Sun Feb 19 21:01:06 2012 +0900
@@ -36,6 +36,7 @@
 
     /* functions */
     void *dma_load(Scheduler *s,void *buf, memaddr addr, uint32 size, uint32 mask);
+    void *dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask);
     void *dma_store(Scheduler *s,void *buf, memaddr addr, uint32 size, uint32 mask);
 
     void *get_writebuf(Scheduler *s, memaddr addr, uint32 size);
@@ -54,7 +55,7 @@
     void mail_write_finish_list(memaddr data);
     memaddr mail_read();
     memaddr task_list_mail_read();
-    void *dma_loadList(Scheduler *s,ListDataPtr list, void *buff, uint32 mask);
+    void *dma_loadList(Scheduler *s,ListDataPtr list, uint32 mask);
     void dma_storeList(ListDataPtr, void *buff, uint32 mask);
     uint32 get_tag();
     void bound(ListData *);
--- a/TaskManager/Fifo/FifoDmaManager.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -7,23 +7,41 @@
 #include "gettime.h"
 
 void *
-FifoDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
+FifoDmaManager::dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask)
+{
+    void *buf = 0;
+    if (size == 0) return buf;
+
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
+
+    buf = s->manager->allocate(size);
+    memcpy(buf, (void*)addr, size);
+
+    (this->*end_dmawait_profile)(&wait);
+    global_load_time += wait;
+    dma_load_time += wait;
+
+    return buf;
+}
+
+void *
+FifoDmaManager::dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask)
 {
     if (size == 0) return buf;
 
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
-    if (s) buf = s->manager->allocate(size);
     memcpy(buf, (void*)addr, size);
 
-        (this->*end_dmawait_profile)(&wait);
-        global_load_time += wait;
-        dma_load_time += wait;
-
+    (this->*end_dmawait_profile)(&wait);
+    global_load_time += wait;
+    dma_load_time += wait;
     return buf;
 }
 
+
 void *
 FifoDmaManager::get_writebuf(Scheduler *s,memaddr addr, uint32 size) 
 {
@@ -36,14 +54,14 @@
 {
     if (size == 0) return buf;
 
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
-        memcpy((void*)addr, buf, size);
+    memcpy((void*)addr, buf, size);
 
-        (this->*end_dmawait_profile)(&wait);
-        global_store_time += wait;
-        dma_store_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_store_time += wait;
+    dma_store_time += wait;
 
     return buf;
 }
@@ -58,15 +76,15 @@
 
 
 void *
-FifoDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask)
+FifoDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask)
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
     int list_size = list->length;
     long bound;
 
-    buff = s->manager->allocate(list->size);
+    void *buff = s->manager->allocate(list->size);
     bound = (long)(buff);
 
     for (int i = 0; i < list_size; i++) {
@@ -75,26 +93,18 @@
         bound += elm->size;
     }
 
-        (this->*end_dmawait_profile)(&wait);
-        global_load_time += wait;
-        dma_loadList_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_load_time += wait;
+    dma_loadList_time += wait;
 
     return buff;
 }
 
-
-void *
-FifoDmaManager::get_writebuf(Scheduler *s,ListDataPtr addr, uint32 size) 
-{
-    void *b = s->manager->allocate(addr->size);
-    return b;
-}
-
 void
 FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
     int list_size = list->length;
     memaddr bound;
@@ -107,96 +117,96 @@
         bound += elm->size;
     }
 
-        (this->*end_dmawait_profile)(&wait);
-        global_store_time += wait;
-        dma_storeList_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_store_time += wait;
+    dma_storeList_time += wait;
 }
 
 void
 FifoDmaManager::mail_write(memaddr data)
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
     mail_queue1->send(data);
 
-        (this->*end_dmawait_profile)(&wait);
-        global_mail_time += wait;
-        mail_write_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_mail_time += wait;
+    mail_write_time += wait;
 }
 
 void
 FifoDmaManager::mail_write_finish_list(memaddr data)
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
     mail_queue1->send(data);
 
-        (this->*end_dmawait_profile)(&wait);
-        global_mail_time += wait;
-        mail_write_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_mail_time += wait;
+    mail_write_time += wait;
 }
 
 memaddr
 FifoDmaManager::mail_read()
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
-        memaddr data;
-        data = mail_queue2->recv();
+    memaddr data;
+    data = mail_queue2->recv();
 
-        (this->*end_dmawait_profile)(&wait);
-        global_mail_time += wait;
-        mail_read_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_mail_time += wait;
+    mail_read_time += wait;
 
-        return data;
+    return data;
 }
 
 memaddr
 FifoDmaManager::task_list_mail_read()
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
-        memaddr data;
-        data = mail_queue2->recv();
+    memaddr data;
+    data = mail_queue2->recv();
 
-        (this->*end_dmawait_profile)(&wait);
-        global_mail_time += wait;
-        mail_read_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_mail_time += wait;
+    mail_read_time += wait;
 
-        return data;
+    return data;
 }
 
 void
 FifoDmaManager::mail_write_from_host(memaddr data)
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
-        mail_queue2->send(data);
+    mail_queue2->send(data);
 
-        (this->*end_dmawait_profile)(&wait);
-        global_mail_time += wait;
-        mail_write_from_host_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_mail_time += wait;
+    mail_write_from_host_time += wait;
 }
 
 memaddr 
 FifoDmaManager::mail_read_from_host() 
 {
-        unsigned long long wait = 0;
-        (this->*start_dmawait_profile)();
+    unsigned long long wait = 0;
+    (this->*start_dmawait_profile)();
 
-        memaddr data;
-        data = mail_queue1->recv();
+    memaddr data;
+    data = mail_queue1->recv();
 
-        (this->*end_dmawait_profile)(&wait);
-        global_mail_time += wait;
-        mail_read_from_host_time += wait;
+    (this->*end_dmawait_profile)(&wait);
+    global_mail_time += wait;
+    mail_read_from_host_time += wait;
 
-        return data;
+    return data;
 }
 
 int 
@@ -208,47 +218,47 @@
 void
 FifoDmaManager::start_profile()
 {
-        global_busy_time = 0;
-        global_load_time = 0;
-        global_store_time = 0;
-        global_mail_time = 0;
-        dma_load_time = 0;
-        dma_store_time = 0;
-        dma_loadList_time = 0;
-        dma_storeList_time = 0;
-        mail_read_time = 0;
-        mail_write_time = 0;
-        mail_read_from_host_time = 0;
-        mail_write_from_host_time = 0;
+    global_busy_time = 0;
+    global_load_time = 0;
+    global_store_time = 0;
+    global_mail_time = 0;
+    dma_load_time = 0;
+    dma_store_time = 0;
+    dma_loadList_time = 0;
+    dma_storeList_time = 0;
+    mail_read_time = 0;
+    mail_write_time = 0;
+    mail_read_from_host_time = 0;
+    mail_write_from_host_time = 0;
 
-        start_dmawait_profile = &FifoDmaManager::do_start_dmawait_profile;
-        end_dmawait_profile = &FifoDmaManager::do_end_dmawait_profile;
+    start_dmawait_profile = &FifoDmaManager::do_start_dmawait_profile;
+    end_dmawait_profile = &FifoDmaManager::do_end_dmawait_profile;
 
-        stop_time = gettime();
+    stop_time = gettime();
 }
 
 void
 FifoDmaManager::stop_profile()
 {
-        start_time = gettime();
-        global_busy_time += start_time - stop_time;
+    start_time = gettime();
+    global_busy_time += start_time - stop_time;
 
-        start_dmawait_profile = &FifoDmaManager::null_start_dmawait_profile;
-        end_dmawait_profile = &FifoDmaManager::null_end_dmawait_profile;
+    start_dmawait_profile = &FifoDmaManager::null_start_dmawait_profile;
+    end_dmawait_profile = &FifoDmaManager::null_end_dmawait_profile;
 }
 
 void
 FifoDmaManager::do_start_dmawait_profile()
 {
-        start_time = gettime();
-        global_busy_time += start_time - stop_time;
+    start_time = gettime();
+    global_busy_time += start_time - stop_time;
 }
 
 void
 FifoDmaManager::do_end_dmawait_profile(unsigned long long *counter)
 {
-        stop_time = gettime();
-        *counter += stop_time - start_time;
+    stop_time = gettime();
+    *counter += stop_time - start_time;
 }
 
 void FifoDmaManager::null_start_dmawait_profile() {}
@@ -257,48 +267,48 @@
 void
 FifoDmaManager::show_dma_wait(Scheduler *s, int cpu)
 {
-        unsigned long long all_time = global_busy_time + global_load_time + 
-                                global_store_time + global_mail_time;
+    unsigned long long all_time = global_busy_time + global_load_time + 
+                            global_store_time + global_mail_time;
 
-        double busy = ((double)global_busy_time)/((double)all_time)*100.0;
-        double load = ((double)global_load_time)/((double)all_time)*100.0;
-        double store = ((double)global_store_time)/((double)all_time)*100.0;
-        double mail = ((double)global_mail_time)/((double)all_time)*100.0;
-        double read = ((double)mail_read_time)/((double)all_time)*100.0;
-        double write = ((double)mail_write_time)/((double)all_time)*100.0;
-        double read_from_host = ((double)mail_read_from_host_time)/((double)all_time)*100.0;
-        double write_from_host = ((double)mail_write_from_host_time)/((double)all_time)*100.0;
+    double busy = ((double)global_busy_time)/((double)all_time)*100.0;
+    double load = ((double)global_load_time)/((double)all_time)*100.0;
+    double store = ((double)global_store_time)/((double)all_time)*100.0;
+    double mail = ((double)global_mail_time)/((double)all_time)*100.0;
+    double read = ((double)mail_read_time)/((double)all_time)*100.0;
+    double write = ((double)mail_write_time)/((double)all_time)*100.0;
+    double read_from_host = ((double)mail_read_from_host_time)/((double)all_time)*100.0;
+    double write_from_host = ((double)mail_write_from_host_time)/((double)all_time)*100.0;
 
 
-        s->printf("cpu%d:\n busy_time = %lld(%.3g%%)\n"
-                        " load_time = %lld(%.3g%%), "
-                        " store_time = %lld(%.3g%%), "
-                        " mail_time = %lld(%.3g%%) \n"
-                        " mail_read_time = %lld(%.3g%%), "
-                        " mail_write_time = %lld(%.3g%%)\n"
-                        " mail_read_from_host_time = %lld(%.3g%%), "
-                        " mail_write_from_host_time = %lld(%.3g%%)\n"
-                        ,cpu, global_busy_time, busy, 
-                        global_load_time, load,
-                        global_store_time, store,
-                        global_mail_time, mail,
-                        mail_read_time, read,
-                        mail_write_time, write,
-                        mail_read_from_host_time, read_from_host,
-                        mail_write_from_host_time, write_from_host);
+    s->printf("cpu%d:\n busy_time = %lld(%.3g%%)\n"
+        " load_time = %lld(%.3g%%), "
+        " store_time = %lld(%.3g%%), "
+        " mail_time = %lld(%.3g%%) \n"
+        " mail_read_time = %lld(%.3g%%), "
+        " mail_write_time = %lld(%.3g%%)\n"
+        " mail_read_from_host_time = %lld(%.3g%%), "
+        " mail_write_from_host_time = %lld(%.3g%%)\n"
+        ,cpu, global_busy_time, busy, 
+        global_load_time, load,
+        global_store_time, store,
+        global_mail_time, mail,
+        mail_read_time, read,
+        mail_write_time, write,
+        mail_read_from_host_time, read_from_host,
+        mail_write_from_host_time, write_from_host);
 
-        global_busy_time = 0;
-        global_load_time = 0;
-        global_store_time = 0;
-        global_mail_time = 0;
-        dma_load_time = 0;
-        dma_store_time = 0;
-        dma_loadList_time = 0;
-        dma_storeList_time = 0;
-        mail_read_time = 0;
-        mail_write_time = 0;
-        mail_read_from_host_time = 0;
-        mail_write_from_host_time = 0;
+    global_busy_time = 0;
+    global_load_time = 0;
+    global_store_time = 0;
+    global_mail_time = 0;
+    dma_load_time = 0;
+    dma_store_time = 0;
+    dma_loadList_time = 0;
+    dma_storeList_time = 0;
+    mail_read_time = 0;
+    mail_write_time = 0;
+    mail_read_from_host_time = 0;
+    mail_write_from_host_time = 0;
 }
 
 uint32
--- a/TaskManager/Fifo/FifoDmaManager.h	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.h	Sun Feb 19 21:01:06 2012 +0900
@@ -22,14 +22,14 @@
 
     FifoDmaManager() {
 #ifdef __CERIUM_PARALLEL__
-    		mail_queue1 = new SynchronizedMailManager();
-    		mail_queue2 = new SynchronizedMailManager();
+        mail_queue1 = new SynchronizedMailManager();
+        mail_queue2 = new SynchronizedMailManager();
 #else
-    		mail_queue1 = new MailManager();
-    		mail_queue2 = new MailManager();
+        mail_queue1 = new MailManager();
+        mail_queue2 = new MailManager();
 #endif
-			start_dmawait_profile = &FifoDmaManager::null_start_dmawait_profile;
-			end_dmawait_profile = &FifoDmaManager::null_end_dmawait_profile;
+        start_dmawait_profile = &FifoDmaManager::null_start_dmawait_profile;
+        end_dmawait_profile = &FifoDmaManager::null_end_dmawait_profile;
     }
 
     ~FifoDmaManager() {
@@ -39,22 +39,23 @@
 
 	/* variables */
 protected:
-	unsigned long long start_time, stop_time;
-	unsigned long long global_busy_time, global_load_time, global_store_time, global_mail_time;
-	unsigned long long dma_load_time, dma_store_time, dma_loadList_time, dma_storeList_time;
-	unsigned long long mail_read_time, mail_write_time;
-	unsigned long long mail_read_from_host_time, mail_write_from_host_time;
+    unsigned long long start_time, stop_time;
+    unsigned long long global_busy_time, global_load_time, global_store_time, global_mail_time;
+    unsigned long long dma_load_time, dma_store_time, dma_loadList_time, dma_storeList_time;
+    unsigned long long mail_read_time, mail_write_time;
+    unsigned long long mail_read_from_host_time, mail_write_from_host_time;
 
     /* functions */
 public:
-    virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask);
-    void *dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
-    void dma_wait(uint32 mask) ;
-    void *get_writebuf(Scheduler *s, memaddr addr, uint32 size) ;
+    virtual void *dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask);
+    virtual void *dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask);
+    virtual void *dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
+    virtual void dma_wait(uint32 mask) ;
+    virtual void *get_writebuf(Scheduler *s, memaddr addr, uint32 size) ;
     void (FifoDmaManager::*start_dmawait_profile)();
     void (FifoDmaManager::*end_dmawait_profile)(unsigned long long *counter);
-	void start_profile();
-	void stop_profile();
+    void start_profile();
+    void stop_profile();
 
     void show_dma_wait(Scheduler *s, int cpu);
 
@@ -67,18 +68,17 @@
     memaddr mail_read_from_host();
     int has_mail_from_host();
 
-    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask);
-    void dma_storeList(ListDataPtr, void *buff, uint32 mask);
-    void *get_writebuf(Scheduler *s, ListDataPtr, uint32 size) ;
+    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask);
+    virtual void dma_storeList(ListDataPtr, void *buff, uint32 mask);
 
     uint32 get_tag();
-    void bound(ListData *);
+    virtual void bound(ListData *);
 
 private:
-	void do_start_dmawait_profile();
-	void do_end_dmawait_profile(unsigned long long *counter);
-	void null_start_dmawait_profile();
-	void null_end_dmawait_profile(unsigned long long *counter);
+    void do_start_dmawait_profile();
+    void do_end_dmawait_profile(unsigned long long *counter);
+    void null_start_dmawait_profile();
+    void null_end_dmawait_profile(unsigned long long *counter);
 
 };
 
--- a/TaskManager/Fifo/ReferencedDmaManager.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/Fifo/ReferencedDmaManager.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -3,16 +3,23 @@
 #include "TaskManagerImpl.h"
 
 void *
-ReferencedDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
+ReferencedDmaManager::dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask)
 {
     return (void*)addr;
 }
 
 void *
-ReferencedDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask)
+ReferencedDmaManager::dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask)
+{
+    return (void*)addr;
+}
+
+
+void *
+ReferencedDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask)
 {
     ListElementPtr elm = &list->element[0];
-    return (void*)elm->addr; 
+    return (void*)elm->addr; // ==readbuf
 }
 
 void
--- a/TaskManager/Fifo/ReferencedDmaManager.h	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/Fifo/ReferencedDmaManager.h	Sun Feb 19 21:01:06 2012 +0900
@@ -7,8 +7,9 @@
 
 public:
 	/* functions */
-    virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask);
-    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask);
+    virtual void *dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask);
+    virtual void *dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask);
+    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask);
     virtual void *dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
     virtual void dma_storeList(ListDataPtr list, void *buff, uint32 mask);
     virtual void *get_writebuf(Scheduler *s,memaddr addr, uint32 size);
--- a/TaskManager/kernel/schedule/DmaManager.h	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/kernel/schedule/DmaManager.h	Sun Feb 19 21:01:06 2012 +0900
@@ -23,12 +23,12 @@
     BASE_NEW_DELETE(DmaManager);
 
     // API for DMA transfer
-    virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask) { return 0; }
+    virtual void *dma_load(Scheduler *s, memaddr addr, uint32 size, uint32 mask) { return 0; }
+    virtual void *dma_load1(void *buf, memaddr addr, uint32 size, uint32 mask) { return 0; }
     virtual void *dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) { return 0; }
     virtual void free_(void *buf) { free(buf); }
     virtual void *get_writebuf(Scheduler *s, memaddr addr, uint32 size) { return 0; }
     virtual void dma_wait(uint32 mask) {}
-    virtual void dma_wait(uint32 mask, int cmd) {}
     virtual void show_dma_wait(Scheduler *s, int cpu) {}
     virtual void start_profile() {}
 
@@ -39,7 +39,7 @@
     virtual memaddr task_list_mail_read() { return 0; }
     
     // API for MFC list DMA transfer
-    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *,uint32 mask) { return 0; }
+    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask) { return 0; }
     virtual void dma_storeList(ListDataPtr, void *buff, uint32 mask) {}
     virtual void *get_writebuf(Scheduler *s, ListDataPtr, uint32 size) { return 0; }
     virtual uint32 get_tag() { return 0;}
--- a/TaskManager/kernel/schedule/SchedTask.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -74,7 +74,7 @@
     // 読むデータが一つもなければ無視
     if (task->r_size == 0) return;
     // load Input Data
-    readbuf = connector->dma_load(scheduler, readbuf, task->rbuf,task->r_size, DMA_READ + this->tag);
+    readbuf = connector->dma_load(scheduler, task->rbuf,task->r_size, DMA_READ + this->tag);
 
 
 }
@@ -227,7 +227,7 @@
 
 void
 SchedTask::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) {
-    connector->dma_load(0,buf, addr, size, mask);
+    connector->dma_load1(buf, addr, size, mask); // direct DMA API (should be purged )
 }
 
 void
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskArray.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -88,7 +88,7 @@
 
     // load Input Data
     // inListData.print();
-    readbuf = connector->dma_loadList(scheduler, &inListData, readbuf, (DMA_READ + this->tag));
+    readbuf = connector->dma_loadList(scheduler, &inListData, (DMA_READ + this->tag));
     connector->bound(&inListData);
 
 }
@@ -104,7 +104,7 @@
     free(outListData.bound);
     outListData.bound = (int*)manager->allocate(outListData.length*sizeof(int));
     connector->bound(&outListData);
-    writebuf = connector->get_writebuf(scheduler, &outListData, outListData.size);
+    writebuf = connector->get_writebuf(scheduler, (memaddr)outListData.element[0].addr, outListData.size);
     //if (outListData.element == inListData.element ) {
     //   printf("bad %x\n",outListData.element);
     //}
@@ -120,15 +120,13 @@
     task_list[atask->command].wait(scheduler,atask->command);
     TaskObjectRun run = task_list[atask->command].run;
     if (atask->outData_count > 0) {
-	setup_outputData();
+	setup_outputData(); // we need write buffer before run()
     }
     connector->dma_wait((DMA_READ + this->tag));
     run(this, get_input(readbuf, 0), get_output(writebuf, 0));
     connector->free_(readbuf);
+    // User 側で作る方法が必要...
     // 書き込む領域がなければ無視
-
-    // User 側で作る方法が必要...
-
     if (atask->outData_count > 0) {
 	// outListData.print();
         connector->dma_storeList(&outListData, writebuf, DMA_WRITE);
--- a/TaskManager/kernel/schedule/SchedTaskArrayLoad.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskArrayLoad.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -23,7 +23,7 @@
 {
     // if (task->r_size == 0) return; cannot happen...
     // load Task Array Data
-    readbuf = connector->dma_load(scheduler, readbuf, task->rbuf,task->r_size, DMA_READ);
+    readbuf = connector->dma_load(scheduler, task->rbuf,task->r_size, DMA_READ);
     connector->dma_wait(DMA_READ);
 }
 
--- a/TaskManager/kernel/schedule/SchedTaskList.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskList.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -27,7 +27,7 @@
     cur_index = 0;
     list = scheduler->get_curListBuf();
     connector = scheduler->connector;
-    list = (TaskListPtr)connector->dma_load(0, list, params_addr,
+    list = (TaskListPtr)connector->dma_load1(list, params_addr,
                         sizeof(TaskList), DMA_READ_TASKLIST);
 
     this->tag = tag;
--- a/TaskManager/kernel/schedule/Scheduler.cc	Sun Feb 19 16:12:25 2012 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Sun Feb 19 21:01:06 2012 +0900
@@ -351,7 +351,7 @@
     m->moveToFirst(s);
     s->tag = connector->get_tag();
     s->address = addr;
-    s->data = connector->dma_load(0, s->data, addr, s->size, s->tag);
+    s->data = connector->dma_load1(s->data, addr, s->size, s->tag);
 
     return s;
 
@@ -408,7 +408,7 @@
     }
 
     s->address = addr;
-    s->data = connector->dma_load(0, s->data, addr, s->size, s->tag);
+    s->data = connector->dma_load1(s->data, addr, s->size, s->tag);
 
 }
 
@@ -435,7 +435,7 @@
 
     memaddr old_addr = s->address;
     s->tag = connector->get_tag();
-    s->data = connector->dma_load(0, s->data, addr, size, s->tag);
+    s->data = connector->dma_load1(s->data, addr, size, s->tag);
     /* 前のをhashから削除 */
     hash->remove(old_addr);
     /* 新しいaddress を登録 */