Mercurial > hg > Members > kono > Cerium
diff TaskManager/kernel/schedule/SchedTask.cc @ 713:f725c6455d19
remove SIMPLE_TASK conditional
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 16 Dec 2009 15:27:46 +0900 |
parents | 56487849ea2d |
children | 4c12f679a0fa |
line wrap: on
line diff
--- a/TaskManager/kernel/schedule/SchedTask.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Wed Dec 16 15:27:46 2009 +0900 @@ -10,36 +10,18 @@ #include "TaskManager.h" #include <stdarg.h> -#ifdef SIMPLE_TASK #include "SchedTaskArray.h" #define Task SimpleTask #define TaskPtr SimpleTaskPtr -#endif extern TaskObject task_list[MAX_TASK_OBJECT]; -#if 0 -/** - code load を始める。既に get_segment hash に入っていれば何もしない。 - */ -extern void -loadSchedTask(Scheduler *scheduler,TaskPtr task) -{ -// fprintf(stderr,"loadSchedTask %d\n",task->command); - task_list[task->command].load(scheduler,task->command); -} -#endif - SchedTask::SchedTask() { list = NULL; task = NULL; -#ifndef SIMPLE_TASK - inListData = NULL; - outListData = NULL; -#endif readbuf = NULL; writebuf = NULL; scheduler = NULL; @@ -64,10 +46,6 @@ { list = _list; task = _task; -#ifndef SIMPLE_TASK - inListData = &_task->inData; - outListData = &_task->outData; -#endif scheduler = sc; cur_index = index; @@ -84,21 +62,12 @@ // object creation をSchedTask生成時にやらないので、 // exec の直前のread で十分に間に合う loadSchedTask(scheduler, task->command); -#ifdef SIMPLE_TASK + // 読むデータが一つもなければ無視 if (task->r_size == 0) return; // load Input Data readbuf = scheduler->allocate(task->r_size); scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ); -#else - - // 読むデータが一つもなければ無視 - if (inListData->length == 0) return; - - // load Input Data - readbuf = scheduler->allocate(inListData->size); - scheduler->dma_loadList(inListData, readbuf, DMA_READ); -#endif } @@ -109,32 +78,20 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); -#ifdef SIMPLE_TASK if (task->w_size > 0) { writebuf = scheduler->allocate(task->w_size); } -#else - if (outListData->length > 0) { - writebuf = scheduler->allocate(outListData->size); - } -#endif scheduler->dma_wait(DMA_READ); task_list[task->command].wait(scheduler,task->command); task_list[task->command].run(this, readbuf, writebuf); free(readbuf); // 書き込む領域がなければ無視 -#ifdef SIMPLE_TASK + if (task->w_size > 0) { writebuf = scheduler->allocate(task->w_size); scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_WRITE); } -#else - if (outListData->length > 0) { - writebuf = scheduler->allocate(outListData->size); - scheduler->dma_storeList(outListData, writebuf, DMA_WRITE); - } -#endif } void @@ -159,7 +116,7 @@ TaskPtr nextTask = &list->tasks[cur_index++]; SchedTask *nextSched = new SchedTask(); nextSched->init(list, nextTask, cur_index, scheduler); -#ifdef SIMPLE_TASK + if (nextTask->command==TaskArray1) { // compatibility return new SchedTaskArray(scheduler, nextSched); @@ -168,7 +125,6 @@ // Start Task Array return new SchedTaskArrayLoad(scheduler, nextSched); } -#endif return nextSched; } else { memaddr nextList = (memaddr)list->next; @@ -193,85 +149,6 @@ scheduler->free_(p); } -#ifndef SIMPLE_TASK -/** - * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 - * buffer から対応するデータを返す。 - */ -void* -SchedTask::get_input(void *buff, int index) -{ - if (buff != NULL) { - return (void*)((char*)buff + inListData->bound[index]); - } else { - return NULL; - } -} - -/** - * get_input(index) のアドレスを返す - */ -memaddr -SchedTask::get_inputAddr(int index) -{ -#ifdef __CERIUM_CELL__ - return (memaddr)inListData->element[index].addr; -#else - return inListData->element[index].addr; -#endif -} - -/** - * get_input(index) のサイズを返す - */ -int -SchedTask::get_inputSize(int index) -{ - return inListData->element[index].size; -} - -/** - * write buffer の領域を返す。 - */ -void* -SchedTask::get_output(void *buff, int index) -{ - if (buff != NULL) { - return (void*)((char *)buff + outListData->bound[index]); - } else { - return NULL; - } -} - -/** - * get_output(index) のアドレスを返す - */ -memaddr -SchedTask::get_outputAddr(int index) -{ -#ifdef __CERIUM_CELL__ - return (memaddr)outListData->element[index].addr; -#else - return outListData->element[index].addr; -#endif -} - -/** - * get_output(index) のサイズを返す - */ -int -SchedTask::get_outputSize(int index) -{ - return outListData->element[index].size; -} - -memaddr -SchedTask::get_param(int index) -{ - return task->param[index]; -} - -#else void* SchedTask::get_input(void *buff, int index) { printf("Cannot use inData in SimpleTask use TaskArray\n"); @@ -283,7 +160,6 @@ int SchedTask::get_outputSize(int index) { return 0; } memaddr SchedTask::get_param(int index) { return 0; } -#endif void* SchedTask::global_alloc(int id, int size) {