Mercurial > hg > Members > kono > Cerium
view TaskManager/Cell/spe/SchedTask.cc @ 88:504899860e66
*** empty log message ***
author | gongo |
---|---|
date | Wed, 27 Feb 2008 17:16:29 +0900 |
parents | b03a4d3565c0 |
children | 5c194c71eca8 |
line wrap: on
line source
#include "SchedTask.h" #include "SchedTaskList.h" #include "SchedNop2Ready.h" #include "DmaManager.h" #include "error.h" #include "TaskManager.h" extern SchedTask::TaskObject task_list[16]; SchedTask* CreateSchedTask(TaskListPtr taskList, void *readbuf, void *writebuf, DmaManager* dma) { TaskPtr task = &taskList->tasks[--taskList->length]; return task_list[task->command](taskList, task, readbuf, writebuf, dma); } SchedTask::SchedTask(TaskListPtr _list, TaskPtr _task, void *rbuf, void *wbuf, DmaManager* cn) : list(_list), task(_task), readbuf(rbuf), writebuf(wbuf), connector(cn) {} void SchedTask::read(void) { __debug("[SchedTask:%s]\n", __FUNCTION__); connector->dma_load(readbuf, task->in_addr, task->in_size, DMA_READ); } void SchedTask::exec(void) { __debug("[SchedTask:%s]\n", __FUNCTION__); connector->dma_wait(DMA_READ); __debug(" task->command = %d\n", task->command); __debug(" task->in_size = %d\n", task->in_size); __debug(" task->in_addr = 0x%x\n", task->in_addr); __debug(" task->out_addr = 0x%x\n", task->out_addr); __debug(" list->next = 0x%x\n", (unsigned int)list->next); __debug(" list->length = 0x%x\n", (unsigned int)list->length); task->in_size = run(readbuf, writebuf); connector->dma_store(writebuf, task->out_addr, task->in_size, DMA_WRITE); } void SchedTask::write(void) { __debug("[SchedTask:%s]\n", __FUNCTION__); connector->dma_wait(DMA_WRITE); connector->mail_write((unsigned int)task->self); } SchedTaskBase* SchedTask::next(Scheduler *m, SchedTaskBase *p) { __debug("[SchedTask:%s]\n", __FUNCTION__); delete p; // ここ直さねば。どうやって if 文消そう? // オブジェクト増やせばいいのかな if (list->length == 0) { if (list->next == 0) { return new SchedNop2Ready(connector); } else { return new SchedTaskList((unsigned int)list->next, m->get_curListBuf(), connector); } } else { return CreateSchedTask(list, m->get_curReadBuf(), m->get_curWriteBuf(), connector); } }