changeset 1213:a49c02dffe6f draft

DMA connector reogranization
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 22 Jul 2011 13:25:30 +0900
parents 4fc9a9a6089d
children 44d9b08519e0
files TaskManager/Cell/spe/CellDmaManager.cc TaskManager/Cell/spe/CellDmaManager.h TaskManager/Cell/spe/CellScheduler.cc TaskManager/Fifo/FifoDmaManager.cc TaskManager/Fifo/FifoDmaManager.h TaskManager/kernel/schedule/DmaManager.h TaskManager/kernel/schedule/SchedMail.cc TaskManager/kernel/schedule/SchedNop2Ready.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/SchedTaskArray.cc TaskManager/kernel/schedule/SchedTaskArrayLoad.cc TaskManager/kernel/schedule/SchedTaskBase.h TaskManager/kernel/schedule/SchedTaskList.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h
diffstat 16 files changed, 165 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -14,7 +14,7 @@
  * @param[in] size Size of Load Data
  * @param[in] mask DMA tag
 */
-void CellDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask)
+void *CellDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
 {
   
     if ((unsigned long)addr&0xf) {
@@ -24,8 +24,17 @@
     }
   
     if (size == 0) return ;
+    if (s) buf = s->allocate(size);
+
     mfc_get((volatile void *)buf, addr, size, mask, 0, 0);
+    return buf;
+}
 
+void *
+CellDmaManager::get_writebuf(Scheduler *s,memaddr addr, uint32 size)
+{
+    void *b = s->allocaet(size);
+    return b;
 }
 
 /**
@@ -186,10 +195,13 @@
 
 
 
-void CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
+void *CellDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask)
 {
+    buff = s->allocate(list->size);
+
     mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length,
 	     mask, 0, 0);
+    return buff;
 }
 
 void CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
@@ -198,6 +210,14 @@
 	     mask, 0, 0);
 }
 
+void *
+CellDmaManager::get_writebuf(Scheduler *s,ListDataPtr addr, uint32 size)
+{
+    void *b = s->allocate(addr->size);
+    return b;
+}
+
+
 
 CellDmaManager::CellDmaManager() 
 {
@@ -334,5 +354,29 @@
     alloc_flag = 0;
 }
 
+uint32
+CellDmaManager::get_tag()
+{
+    static int tag = 16;
+    tag ++;
+    tag &= 0x0f;
+    return tag+16;
+}
+
+/**
+ *  DMA buffer offset in rbuf
+ */
+void
+CellDmaManager::bound(ListData *list)
+{
+    ListElement *elm = list->element;
+    int *bound = list->bound;
+    int offset=0;
+    for(int i=0;i<list->length;i++) {
+        bound[i] = offset;
+        offset += elm[i].size;
+    }
+}
+
 
 /* end */
--- a/TaskManager/Cell/spe/CellDmaManager.h	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.h	Fri Jul 22 13:25:30 2011 +0900
@@ -34,8 +34,11 @@
     int task_list_read_count;
 
     /* functions */
-    void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask);
-    void dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
+    void dma_load(Scheduler *s,void *buf, memaddr addr, uint32 size, uint32 mask);
+    void dma_store(Scheduler *s,void *buf, memaddr addr, uint32 size, uint32 mask);
+
+    void *get_writebuf(Schduler *s, memaddr addr, uint32 size) ;
+
     void dma_wait(uint32 mask) ;
     void dma_wait(uint32 mask, int cmd) ;
     void (CellDmaManager::*start_dmawait_profile)();
@@ -51,8 +54,12 @@
     void mail_write_finish_list(memaddr data);
     memaddr mail_read();
     memaddr task_list_mail_read();
-    void dma_loadList(ListDataPtr list, void *buff, uint32 mask);
+    void dma_loadList(Scheduler *s,ListDataPtr list, void *buff, uint32 mask);
     void dma_storeList(ListDataPtr, void *buff, uint32 mask);
+    uint32 get_tag();
+    void bound(ListData *);
+    void *get_writebuf(Scheduler *s, ListDataPtr, uint32 size) ;
+
 
     private:
 
--- a/TaskManager/Cell/spe/CellScheduler.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/Cell/spe/CellScheduler.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -56,24 +56,6 @@
     }    
 }
 
-/*
-    dma channel を返す
-    本来、SPU用に閉じているはず。ユーザが明示的に使うことはない。
-    良くわからないが、ある分だけcounterで廻せば良い。しかし、
-    そのためには、全部で、get_tag()する必要があるはず。
-
- */
-
-// #define TEX_LOAD1      0
-// #define TEX_LOAD2      1
-
-uint32
-CellScheduler::get_tag()
-{
-    static int count = 0;
-    return (count++ % 8)+16;
-}
-
 
 
 /* end */
--- a/TaskManager/Fifo/FifoDmaManager.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -2,19 +2,31 @@
 #include <stdlib.h>
 #include <string.h>
 #include "FifoDmaManager.h"
+#include "Scheduler.h"
+#include "TaskManagerImpl.h"
 
-void
-FifoDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask)
+void *
+FifoDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
 {
-    if (size == 0) return;
+    if (size == 0) return buf;
+    if (s) buf = s->manager->allocate(size);
     memcpy(buf, (void*)addr, size);
+    return buf;
 }
 
-void
+void *
+FifoDmaManager::get_writebuf(Scheduler *s,memaddr addr, uint32 size) 
+{
+    void *b = s->manager->allocate(size);
+    return b;
+}
+
+void *
 FifoDmaManager::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask)
 {
-    if (size == 0) return;
+    if (size == 0) return buf;
     memcpy((void*)addr, buf, size);
+    return buf;
 }
 
 /**
@@ -26,12 +38,13 @@
 }
 
 
-void
-FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
+void *
+FifoDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask)
 {
     int list_size = list->length;
     long bound;
 
+    buff = s->manager->allocate(list->size);
     bound = (long)(buff);
 
     for (int i = 0; i < list_size; i++) {
@@ -39,9 +52,17 @@
 	memcpy((void*)bound, (void*)elm->addr, elm->size);
 	bound += elm->size;
     }
+    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)
 {
@@ -57,4 +78,28 @@
     }
 }
 
+uint32
+FifoDmaManager::get_tag()
+{
+    static int tag = 16;
+    tag ++;
+    tag &= 0x0f;
+    return tag+16;
+}
+
+/**
+ *  DMA buffer offset in rbuf
+ */
+void
+FifoDmaManager::bound(ListData *list)
+{
+    ListElement *elm = list->element;
+    int *bound = list->bound;
+    int offset=0;
+    for(int i=0;i<list->length;i++) {
+        bound[i] = offset;
+        offset += elm[i].size;
+    }
+}
+
 /* end */
--- a/TaskManager/Fifo/FifoDmaManager.h	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.h	Fri Jul 22 13:25:30 2011 +0900
@@ -35,9 +35,11 @@
     }
 
     /* functions */
-    void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask);
-    void dma_store(void *buf, memaddr addr, uint32 size, uint32 mask);
+    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) ;
+
 
     void mail_write(memaddr data) { mail_queue1->send(data); }
     void mail_write_queue(memaddr data) { mail_queue1->send(data); }
@@ -49,8 +51,12 @@
     memaddr mail_read_from_host() { return mail_queue1->recv(); }
     int has_mail_from_host() { return mail_queue1->count(); }
 
-    void dma_loadList(ListDataPtr list, void *buff, uint32 mask);
+    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) ;
+
+    uint32 get_tag();
+    void bound(ListData *);
 
 };
 
--- a/TaskManager/kernel/schedule/DmaManager.h	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/DmaManager.h	Fri Jul 22 13:25:30 2011 +0900
@@ -23,8 +23,9 @@
     BASE_NEW_DELETE(DmaManager);
 
     // API for DMA transfer
-    virtual void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) {}
-    virtual void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) {}
+    virtual void *dma_load(Scheduler *s, 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 *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) {}
@@ -38,8 +39,11 @@
     virtual memaddr task_list_mail_read() { return 0; }
     
     // API for MFC list DMA transfer
-    virtual void dma_loadList(ListDataPtr list, void *,uint32 mask) {}
+    virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *,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;}
+    virtual void bound(ListData *) {}
 };
 
 #endif
--- a/TaskManager/kernel/schedule/SchedMail.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedMail.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -7,7 +7,7 @@
 SchedMail::next(Scheduler *scheduler, SchedTaskBase *p)
 {
     
-   params_addr = scheduler->task_list_mail_read();
+   params_addr = connector->task_list_mail_read();
 
     __debug("[SchedMail:%s]\n", __FUNCTION__);
 
--- a/TaskManager/kernel/schedule/SchedNop2Ready.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedNop2Ready.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -22,9 +22,9 @@
     __debug("[SchedNop2Ready:%s]\n", __FUNCTION__);
 
 #ifdef MAIL_QUEUE
-    scheduler->mail_write_finish_list((memaddr)MY_SPE_STATUS_READY);
+    connector->mail_write_finish_list((memaddr)MY_SPE_STATUS_READY);
 #else
-    scheduler->mail_write((memaddr)MY_SPE_STATUS_READY);
+    connector->mail_write((memaddr)MY_SPE_STATUS_READY);
 #endif
 
 
--- a/TaskManager/kernel/schedule/SchedTask.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -49,6 +49,7 @@
 
     // scheduler->mainMem_wait();   // これはなんで?
     manager = sc->manager;
+    connector = sc->connector;
 
 #ifdef TASK_LIST_MAIL
     if (list)
@@ -73,8 +74,7 @@
     // 読むデータが一つもなければ無視
     if (task->r_size == 0) return;
     // load Input Data
-    readbuf = manager->allocate(task->r_size);
-    scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ + this->tag);
+    readbuf = connector->dma_load(scheduler, readbuf, task->rbuf,task->r_size, DMA_READ + this->tag);
 
 
 }
@@ -82,7 +82,7 @@
 void
 SchedTask::setup_outputData()
 {
-    writebuf = manager->allocate(task->w_size);
+    writebuf = connector->get_writebuf(scheduler, task->wbuf, task->w_size);
 }
 
 void
@@ -93,14 +93,14 @@
     if (task->w_size > 0) {
 	setup_outputData();
     }
-    scheduler->dma_wait(DMA_READ + this->tag);
+    connector->dma_wait(DMA_READ + this->tag);
     run(this, readbuf, writebuf);
     free(readbuf);
 
     // 書き込む領域がなければ無視
 
     if (task->w_size > 0) {
-	scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_WRITE);
+	connector->dma_store(writebuf, task->wbuf,task->w_size, DMA_WRITE);
     }
 }
 
@@ -109,18 +109,18 @@
 {
     __debug("[SchedTask:%s]\n", __FUNCTION__);
 
-    scheduler->dma_wait(DMA_WRITE);
+    connector->dma_wait(DMA_WRITE);
     free(writebuf);
 #ifdef TASK_LIST_MAIL
     if (!(cur_index < list->length) )
-	scheduler->mail_write(waiter);
+	connector->mail_write(waiter);
 
 #else
 
 #ifdef MAIL_QUEUE
-    scheduler->mail_write_queue(waiter);
+    connector->mail_write_queue(waiter);
 #else
-    scheduler->mail_write(waiter);
+    connector->mail_write(waiter);
 #endif
 #endif
 }
@@ -233,22 +233,22 @@
 
 void
 SchedTask::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) {
-    scheduler->dma_load(buf, addr, size, mask);
+    connector->dma_load(scheduler,buf, addr, size, mask);
 }
 
 void
 SchedTask::dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) {
-    scheduler->dma_store(buf, addr, size, mask);
+    connector->dma_store(buf, addr, size, mask);
 }
 
 void
 SchedTask::dma_wait(uint32 mask) {
-    scheduler->dma_wait(mask);
+    connector->dma_wait(mask);
 }
 
 void
 SchedTask::show_dma_wait() {
-    scheduler->show_dma_wait();
+    connector->show_dma_wait(scheduler, scheduler->id);
 }
 
 
@@ -259,7 +259,7 @@
 
 void
 SchedTask::start_profile() {
-    scheduler->start_profile();
+    connector->start_profile();
 }
 
 MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) {
@@ -283,10 +283,6 @@
     scheduler->wait_segment(s);
 }
 
-uint32 SchedTask::get_tag() {
-    return scheduler->get_tag();
-}
-
 
 HTaskPtr
 SchedTask::create_task(int cmd)
--- a/TaskManager/kernel/schedule/SchedTask.h	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.h	Fri Jul 22 13:25:30 2011 +0900
@@ -67,7 +67,7 @@
     MemorySegment * get_segment(memaddr addr, MemList *m);
     MemorySegment * get_free_segment(memaddr addr, MemList *m);
     void overwrite_segment(MemorySegment *s, memaddr addr);
-    uint32 get_tag();
+    // uint32 get_tag();
     void put_segment(MemorySegment *s);
     void wait_segment(MemorySegment *s);
 
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskArray.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -64,6 +64,7 @@
 {
 }
 
+#if 0
 /**
  *  DMA buffer offset in rbuf
  */
@@ -78,6 +79,7 @@
 	offset += elm[i].size;
     }
 }
+#endif
 
 
 /**
@@ -100,10 +102,9 @@
     inListData.bound = (int*)manager->allocate(inListData.length*sizeof(int));
 
     // load Input Data
-    readbuf = manager->allocate(inListData.size);
     // inListData.print();
-    scheduler->dma_loadList(&inListData, readbuf, (DMA_READ + this->tag));
-    bound(&inListData);
+    readbuf = connector->dma_loadList(scheduler, &inListData, readbuf, (DMA_READ + this->tag));
+    connector->bound(&inListData);
 
 }
 
@@ -117,10 +118,10 @@
     outListData.element = atask->outData(0);
     free(outListData.bound);
     outListData.bound = (int*)manager->allocate(outListData.length*sizeof(int));
-    bound(&outListData);
+    connector->bound(&outListData);
 
     free(writebuf);
-    writebuf = manager->allocate(outListData.size);
+    writebuf = connector->get_writebuf(scheduler, &outListData, outListData.size);
     //if (outListData.element == inListData.element ) {
     //   printf("bad %x\n",outListData.element);
     //}
@@ -138,7 +139,7 @@
     if (atask->outData_count > 0) {
 	setup_outputData();
     }
-    scheduler->dma_wait((DMA_READ + this->tag));
+    connector->dma_wait((DMA_READ + this->tag));
     run(this, get_input(readbuf, 0), get_output(writebuf, 0));
     free(readbuf);
     // 書き込む領域がなければ無視
@@ -147,7 +148,7 @@
 
     if (atask->outData_count > 0) {
 	// outListData.print();
-        scheduler->dma_storeList(&outListData, writebuf, DMA_WRITE);
+        connector->dma_storeList(&outListData, writebuf, DMA_WRITE);
     }
 }
 
@@ -159,7 +160,7 @@
 SchedTaskArray::write()
 {
 
-    scheduler->dma_wait(DMA_WRITE);
+    connector->dma_wait(DMA_WRITE);
     free(writebuf);
     free(inListData.bound);
     free(outListData.bound);
--- a/TaskManager/kernel/schedule/SchedTaskArrayLoad.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskArrayLoad.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -22,9 +22,8 @@
 {
     // if (task->r_size == 0) return; cannot happen...
     // load Task Array Data
-    readbuf = manager->allocate(task->r_size);
-    scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ);
-    scheduler->dma_wait(DMA_READ);
+    readbuf = connector->dma_load(scheduler, readbuf, task->rbuf,task->r_size, DMA_READ);
+    connector->dma_wait(DMA_READ);
 }
 
 void
--- a/TaskManager/kernel/schedule/SchedTaskBase.h	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskBase.h	Fri Jul 22 13:25:30 2011 +0900
@@ -57,7 +57,6 @@
     virtual memaddr mainMem_get(int id) {return 0; }
 
     virtual MemorySegment * get_segment(memaddr addr, MemList *m) {return 0; }
-    virtual uint32 get_tag() {return 0; }
     virtual void put_segment(MemorySegment *s) {}
     virtual void wait_segment(MemorySegment *s) {}
 
@@ -86,6 +85,7 @@
     Scheduler *scheduler;
     // Task を作成管理するマネージャー
     TaskManagerImpl *manager;
+    DmaManager* connector;
 
     SimpleTaskPtr task;
     TaskPtr atask;
--- a/TaskManager/kernel/schedule/SchedTaskList.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskList.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -26,7 +26,7 @@
     scheduler = sched;
     cur_index = 0;
     list = scheduler->get_curListBuf();
-    scheduler->dma_load(list, params_addr,
+    connector->dma_load(scheduler, list, params_addr,
                         sizeof(TaskList), DMA_READ_TASKLIST);
 
     this->tag = tag;
@@ -40,7 +40,7 @@
     // next() で TaskListの中身を見られてしまうので、
     // ここで DMA 待ちを行う
     __debug("[SchedTaskList:%s]\n", __FUNCTION__);
-    scheduler->dma_wait(DMA_READ_TASKLIST);
+    connector->dma_wait(DMA_READ_TASKLIST);
 }
 
 void
--- a/TaskManager/kernel/schedule/Scheduler.cc	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Fri Jul 22 13:25:30 2011 +0900
@@ -125,75 +125,6 @@
     return buff_taskList[buffFlag_taskList];
 }
 
-void
-Scheduler::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask)
-{
-    connector->dma_load(buf, addr, size, mask);
-}
-
-void
-Scheduler::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask)
-{
-    connector->dma_store(buf, addr, size, mask);
-}
-
-void
-Scheduler::dma_wait(uint32 mask)
-{
-  //printf("%d\n",mask);
-    connector->dma_wait(mask);
-}
-
-void
-Scheduler::dma_wait(uint32 mask, int cmd)
-{
-    connector->dma_wait(mask,cmd);
-}
-
-void
-Scheduler::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
-{
-    connector->dma_loadList(list, buff, mask);
-}
-
-
-void
-Scheduler::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
-{
-    return connector->dma_storeList(list, buff, mask);
-}
-
-void
-Scheduler::mail_write(memaddr data)
-{
-    connector->mail_write(data);
-}
-
-void
-Scheduler::mail_write_queue(memaddr data)
-{
-    connector->mail_write_queue(data);
-}
-
-void
-Scheduler::mail_write_finish_list(memaddr data)
-{
-    connector->mail_write_finish_list(data);
-}
-
-memaddr
-Scheduler::mail_read()
-{
-    return connector->mail_read();
-}
-
-memaddr
-Scheduler::task_list_mail_read()
-{
-    return connector->task_list_mail_read();
-}
-
-
 
 /*
     ここから下は、memory 以下にあるべき
@@ -411,9 +342,9 @@
 
     MemorySegment *s = m->getLast();
     m->moveToFirst(s);
-    s->tag = get_tag();
+    s->tag = connector->get_tag();
     s->address = addr;
-    dma_load(s->data, addr, s->size, s->tag);
+    s->data = connector->dma_load(0, s->data, addr, s->size, s->tag);
 
     return s;
 
@@ -445,7 +376,7 @@
 
     MemorySegment *s = m->getLast();
     m->moveToFirst(s);
-    s->tag = get_tag();
+    s->tag = connector->get_tag();
     s->address = addr;
 
     return s;
@@ -470,7 +401,7 @@
     }
 
     s->address = addr;
-    dma_load(s->data, addr, s->size, s->tag);
+    s->data = connector->dma_load(0, s->data, addr, s->size, s->tag);
 
 }
 
@@ -496,9 +427,8 @@
     m->moveToFirst(s);
 
     memaddr old_addr = s->address;
-    s->tag = get_tag();
-    dma_load(s->data, addr,
-                       size, s->tag);
+    s->tag = connector->get_tag();
+    s->data = connector->dma_load(0, s->data, addr, size, s->tag);
     /* 前のをhashから削除 */
     hash->remove(old_addr);
     /* 新しいaddress を登録 */
@@ -512,16 +442,6 @@
 
 
 
-
-uint32
-Scheduler::get_tag()
-{
-    static int tag = 16;
-    tag ++;
-    tag &= 0x0f;
-    return tag+16;
-}
-
 /*!
 
     Main Memory のSegmentを書き出す
@@ -539,9 +459,8 @@
 {
 
     if (s == NULL) return;
-    s->tag = get_tag();
-    dma_store(s->data, s->address,
-                       s->size, s->tag);
+    s->tag = connector->get_tag();
+    connector->dma_store(s->data, s->address, s->size, s->tag);
 }
 
 /*!
@@ -557,7 +476,7 @@
     // えーと、dma してない時には、skip しないとだめなんじゃないの?
 
     if (s == NULL) return;
-    if (s->tag) dma_wait(s->tag);
+    if (s->tag) connector->dma_wait(s->tag);
     s->tag = 0;
 }
 
--- a/TaskManager/kernel/schedule/Scheduler.h	Fri Jul 22 08:50:04 2011 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.h	Fri Jul 22 13:25:30 2011 +0900
@@ -115,26 +115,9 @@
 
     void allocate_code_segment(int size, int count,struct tbl *table);
 
-    virtual uint32 get_tag();
     void put_segment(MemorySegment *s);
     void wait_segment(MemorySegment *s);
 
-    /* DMA Transfer */
-    void dma_load(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 dma_wait(uint32 mask, int cmd);
-    void show_dma_wait() { connector->show_dma_wait(this, id); };
-    void show_hash_hit_ratio();
-    void start_profile() { connector->start_profile(); };
-    void mail_write(memaddr data);
-    void mail_write_queue(memaddr data);
-    void mail_write_finish_list(memaddr data);
-    memaddr mail_read();
-    memaddr task_list_mail_read();
-    void dma_loadList(ListDataPtr list, void *, uint32 mask);
-    void dma_storeList(ListDataPtr list, void *, uint32 mask);
-
     /* manager */
 
     void set_manager(TaskManagerImpl *m) {