Mercurial > hg > Game > Cerium
view TaskManager/kernel/schedule/SchedTaskList.cc @ 366:0251d06467de draft
rename include/TaskManager/* and add memory
author | aaa |
---|---|
date | Mon, 27 Jul 2009 15:51:18 +0900 |
parents | a314d8cd2082 |
children | e2f29e912d0b |
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(void) { __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 *m, 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(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; }