Mercurial > hg > Game > Cerium
view TaskManager/kernel/schedule/SchedTaskList.cc @ 688:77c89477daa8 draft
on going...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 06 Dec 2009 18:53:46 +0900 |
parents | 94d82f2c842f |
children | ec6c897448ca |
line wrap: on
line source
#include <stdlib.h> #include <string.h> #include "SchedTaskList.h" #include "SchedTask.h" #include "SchedNop2Ready.h" #include "DmaManager.h" #include "error.h" /** * SchedTaskList を返す * * @param[in] next_list 次の実行する TaskList のアドレス * @param[in] next_list がメインメモリのアドレスか、 * SPE で生成されたアドレスかのフラグ * SPE で生成されている場合、DMA の必要は無い * 0: メインメモリ, 1: SPE */ SchedTaskList* createSchedTaskList(memaddr next_list, Scheduler* scheduler, int renew_flag) { SchedTaskList* sched = new SchedTaskList(next_list, scheduler); return sched; } SchedTaskList::SchedTaskList(memaddr addr, Scheduler *sched) { params_addr = addr; list = NULL; scheduler = sched; } void SchedTaskList::read() { __debug("[SchedTaskList:%s]\n", __FUNCTION__); list = scheduler->get_curListBuf(); scheduler->dma_load(list, params_addr, sizeof(TaskList), DMA_READ_TASKLIST); } SchedTaskBase* SchedTaskList::next(Scheduler *scheduler, SchedTaskBase *p) { SchedTaskBase *nextSched; __debug("[SchedTaskList:%s]\n", __FUNCTION__); scheduler->dma_wait(DMA_READ_TASKLIST); if (list->length < 1) { nextSched = new SchedNop2Ready(scheduler); } else { #ifdef SIMPLE_TASK SimpleTaskPtr nextTask = &list->tasks[0]; #else TaskPtr nextTask = &list->tasks[0]; #endif nextSched = createSchedTask(scheduler, nextTask); ((SchedTask*)nextSched)->init(list, nextTask, 1, scheduler); } return nextSched; } /* end */