Mercurial > hg > Game > Cerium
view TaskManager/kernel/schedule/SchedTask.cc @ 42:aa11038dbdc1
*** empty log message ***
author | gongo |
---|---|
date | Thu, 14 Feb 2008 18:27:37 +0900 |
parents | |
children | 70a0ac46133e |
line wrap: on
line source
#include "SchedTask.h" #include "SchedTaskList.h" #include "SchedNop2Ready.h" #include "DmaManager.h" #include "error.h" #include "TaskManager.h" #include "SymTable.h" SymTable *TaskManager::symtb; 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__); //task = &list->tasks[--list->length]; 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); // obsolute // task->in_size = func_list[task->command](writebuf, readbuf); // ごちゃごちゃしてるな // 最初から void* じゃなくて 関数ポインタ としていれるべきか? int (*func)(void*, void*) = (int (*)(void*,void*))TaskManager::get_address(task->command); task->in_size = func(writebuf, readbuf); 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 new SchedTask(list, m->get_curReadBuf(), //m->get_curWriteBuf(), connector); // 本当は、ここで task->command に対応する、 // SchedTask を継承する class を作ればいい。。。はず return new SchedTask(list, &list->tasks[--list->length], m->get_curReadBuf(), m->get_curWriteBuf(), connector); } } #if 0 SchedTask createSchedTask(TaskListPtr list, void *rbuf, void *wbuf, DmaManager *cn) { TaskPtr task; task = &list->tasks[--list->length]; } #endif