Mercurial > hg > Members > kono > Cerium
view TaskManager/kernel/spe/SpeTask.cc @ 31:6a77b5e755ab
*** empty log message ***
author | gongo |
---|---|
date | Tue, 12 Feb 2008 13:56:54 +0900 |
parents | 41ccd4b38184 |
children |
line wrap: on
line source
#include <stdio.h> #include "SpeTask.h" #include "SpeTaskList.h" #include "SpeNop2Ready.h" #include "DmaManager.h" #include "error.h" #include "TaskManager.h" #include "SymTable.h" SymTable *TaskManager::symtb; SpeTask::SpeTask(TaskListPtr _list, TaskPtr _task, void *rbuf, void *wbuf, DmaManager* cn) { list = _list; task = _task; readbuf = rbuf; writebuf = wbuf; connector = cn; } void SpeTask::read(void) { __debug("[SpeTask:%s]\n", __FUNCTION__); //task = &list->tasks[--list->length]; connector->dma_load(readbuf, task->in_addr, task->in_size, DMA_READ); } void SpeTask::exec(void) { __debug("[SpeTask:%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 SpeTask::write(void) { __debug("[SpeTask:%s]\n", __FUNCTION__); connector->dma_wait(DMA_WRITE); connector->mail_write((unsigned int)task->self); } SpeTaskBase* SpeTask::next(SpeManager *m, SpeTaskBase *p) { __debug("[SpeTask:%s]\n", __FUNCTION__); delete p; // ここ直さねば。どうやって if 文消そう? // オブジェクト増やせばいいのかな if (list->length == 0) { if (list->next == 0) { return new SpeNop2Ready(connector); } else { return new SpeTaskList((unsigned int)list->next, m->get_curListBuf(), connector); } } else { //return new SpeTask(list, m->get_curReadBuf(), //m->get_curWriteBuf(), connector); // 本当は、ここで task->command に対応する、 // SpeTask を継承する class を作ればいい。。。はず return new SpeTask(list, &list->tasks[--list->length], m->get_curReadBuf(), m->get_curWriteBuf(), connector); } } #if 0 SpeTask createSpeTask(TaskListPtr list, void *rbuf, void *wbuf, DmaManager *cn) { TaskPtr task; task = &list->tasks[--list->length]; } #endif