Mercurial > hg > Game > Cerium
view TaskManager/kernel/schedule/SchedTaskList.cc @ 596:f1c2e11a2ef4 draft
add xdr_getpos
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 04 Nov 2009 22:52:06 +0900 |
parents | 3bc98f6d31ff |
children | 92b0d490e839 |
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(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 = NULL; scheduler = sched; flag_renewTaskList = 0; } void SchedTaskList::read() { __debug("[SchedTaskList:%s]\n", __FUNCTION__); if (flag_renewTaskList == SCHED_TASKLIST_NORMAL) { list = scheduler->get_curListBuf(); scheduler->dma_load(list, params_addr, sizeof(TaskList), DMA_READ_TASKLIST); } else { list = (TaskListPtr)params_addr; } } SchedTaskBase* SchedTaskList::next(Scheduler *scheduler, SchedTaskBase *p) { SchedTaskBase *nextSched; __debug("[SchedTaskList:%s]\n", __FUNCTION__); // delete p; scheduler->dma_wait(DMA_READ_TASKLIST); if (list->length < 1) { nextSched = new SchedNop2Ready(scheduler); if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { free(list); } } else { TaskPtr nextTask = &list->tasks[0]; nextSched = createSchedTask(scheduler, 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; } /* end */