Mercurial > hg > Game > Cerium
diff TaskManager/kernel/schedule/SchedTaskList.cc @ 184:a19d3ed4ce5b draft
fix
author | gongo@gendarme.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Tue, 06 Jan 2009 15:39:48 +0900 |
parents | 028ffc9c0375 |
children | a314d8cd2082 |
line wrap: on
line diff
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Tue Dec 23 16:27:07 2008 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Tue Jan 06 15:39:48 2009 +0900 @@ -6,10 +6,27 @@ #include "DmaManager.h" #include "error.h" +/** + * SchedTaskList を返す + * + * @param[in] next_list 次の実行する TaskList のアドレス + * @param[in] next_list がメインメモリのアドレスか、 + * SPE で生成されたアドレスかのフラグ + * SPE で生成されている場合、DMA の必要は無い + * 0: メインメモリ, 1: SPE + */ +SchedTaskList* +createSchedTaskList(uint32 next_list, Scheduler* scheduler, int renew_flag) +{ + SchedTaskList* sched = new SchedTaskList(next_list, scheduler); + sched->flag_renewTaskList = renew_flag; + return sched; +} + SchedTaskList::SchedTaskList(unsigned int addr, Scheduler *sched) { params_addr = addr; - list = sched->get_curListBuf(); + list = NULL; scheduler = sched; flag_renewTaskList = 0; @@ -21,32 +38,46 @@ { __debug("[SchedTaskList:%s]\n", __FUNCTION__); - if (flag_renewTaskList == 0) { - scheduler->dma_load(list,params_addr,sizeof(TaskList),DMA_READ_TASKLIST); + if (flag_renewTaskList == SCHED_TASKLIST_NORMAL) { + list = scheduler->get_curListBuf(); + scheduler->dma_load(list, params_addr, + sizeof(TaskList), DMA_READ_TASKLIST); scheduler->dma_wait(DMA_READ_TASKLIST); } else { list = (TaskListPtr)params_addr; } - - scheduler->curIndex_taskList = 0; - - scheduler->mainMem_wait(); } SchedTaskBase* SchedTaskList::next(Scheduler *m, SchedTaskBase *p) { + SchedTaskBase *nextSched; + __debug("[SchedTaskList:%s]\n", __FUNCTION__); delete p; if (list->length < 1) { - return new SchedNop2Ready(scheduler); + nextSched = new SchedNop2Ready(scheduler); + + if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { + free(list); + } + } else { - SchedTask* task = CreateSchedTask(list, m); - task->__flag_renewTask = this->flag_renewTaskList; - task->__init__(); - return task; + TaskPtr nextTask = &list->tasks[0]; + nextSched = createSchedTask(nextTask); + + if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { + ((SchedTask*)nextSched)->__setRenew(); + } + + ((SchedTask*)nextSched)->__init__(list, nextTask, 1, + scheduler->get_curReadBuf(), + scheduler->get_curWriteBuf(), + scheduler); } + + return nextSched; }