Mercurial > hg > Members > kono > Cerium
changeset 703:61b59376aec5
compatibility
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Dec 2009 18:34:46 +0900 |
parents | 80666cb35f10 |
children | 6d497c098455 |
files | TaskManager/ChangeLog TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/kernel/ppe/HTask.h TaskManager/kernel/ppe/HTaskInfo.cc TaskManager/kernel/ppe/Task.h TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/SchedTaskArray.cc TaskManager/kernel/schedule/SchedTaskArray.h TaskManager/kernel/sys_task/SysTasks.h TaskManager/kernel/sys_task/TaskArray.cc TaskManager/kernel/sys_task/systask_register.cc example/basic/Makefile.def |
diffstat | 14 files changed, 136 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/ChangeLog Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/ChangeLog Mon Dec 14 18:34:46 2009 +0900 @@ -1,3 +1,12 @@ +2009-12-14 Shinji KONO <kono@ie.u-ryukyu.ac.jp> + + ようやっと動きました。SIMPLE_TASK でないのとの互換性 + を維持するべきか? 頑張れば出来ると思うけど... + + 方法は二つ。TaskList に無理矢理 Task を詰め込むか、 + 今までのHTaskを、TaskArray に読み変えるか。前者は変更が + 多い。後者は、wait_for が微妙。 + 2009-12-12 Shinji KONO <kono@ie.u-ryukyu.ac.jp> SchedTask::next で、TaskArray を認識して、そこで、
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Mon Dec 14 18:34:46 2009 +0900 @@ -7,6 +7,7 @@ #include "types.h" #include "error.h" #include "SchedNop.h" +#include "SysFunc.h" FifoTaskManagerImpl::~FifoTaskManagerImpl() { @@ -106,7 +107,26 @@ while (HTaskPtr htask = activeTaskQueue->poll()) { task = &list->tasks[list->length++]; #ifdef SIMPLE_TASK - *task = *(SimpleTask*)htask; + if (task->command==TaskArray1) { + // compatibility + int next = (task->r_size+sizeof(SimpleTask))/sizeof(SimpleTask); + if (list->length+next>=TASK_MAX_SIZE) { + list->length--; + TaskListPtr newList = taskListImpl->create(); + list_top = TaskListInfo::append(list_top, newList); + list = newList; + task = &list->tasks[list->length++]; + } + Task *array = (Task*)&list->tasks[list->length]; + list->length += next; + *task = *(SimpleTask*)htask; + memcpy(array, task->rbuf, task->r_size); + free(task->rbuf); + task->rbuf = 0; task->r_size = 0; + htask->rbuf = 0; htask->r_size = 0; + } else { + *task = *(SimpleTask*)htask; + } #else memcpy(task, (Task*)htask, sizeof(Task)); #endif
--- a/TaskManager/kernel/ppe/HTask.h Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Mon Dec 14 18:34:46 2009 +0900 @@ -52,7 +52,51 @@ Task *create_task_array(int task_id, int num_task, int num_param, int num_inData, int num_outData); Task *next_task_array(int task_id, Task *t); void spawn_task_array(Task *t); + + + int param_index; + int in_index; + int out_index; + + private: + +// compatibility + public: // functions + void add_inData_t(memaddr addr, int size) { + Task *t = (Task*)rbuf; + t->set_inData_t(in_index++, addr,size); + } + void add_outData_t(memaddr addr, int size) { + Task *t = (Task*)rbuf; + t->set_outData_t(out_index++, addr,size); + } + void set_inData_t(int index, memaddr addr, int size) { + Task *t = (Task*)rbuf; + t->set_inData_t(index, addr,size); + } + void set_outData_t(int index, memaddr addr, int size) { + Task *t = (Task*)rbuf; + t->set_inData_t(index, addr,size); + } + void add_param_t(memaddr param) { + Task *t = (Task*)rbuf; + t->set_param_t(param_index++, param); + } + void set_param_t(int index, memaddr param) { + Task *t = (Task*)rbuf; + t->set_param_t(index, param); + } + +#define add_param(param) add_param_t((memaddr)(param)) +#define set_param(index,param) set_param_t(index, (memaddr) (param)) + +#define add_inData(addr, size) \ + add_inData_t((memaddr)(addr), (size)); +#define add_outData(addr, size) \ + add_outData_t((memaddr)(addr), (size)); + #endif + }; typedef HTask* HTaskPtr;
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Mon Dec 14 18:34:46 2009 +0900 @@ -68,6 +68,10 @@ q->inData.clear(); q->outData.clear(); q->param_size = 0; +#else + q->param_index = 0; + q->in_index = 0; + q->out_index = 0; #endif q->self = (memaddr) q;
--- a/TaskManager/kernel/ppe/Task.h Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.h Mon Dec 14 18:34:46 2009 +0900 @@ -152,14 +152,8 @@ } -// #define add_param(param) add_param_t((memaddr)(param)) #define set_param(index,param) set_param_t(index, (memaddr) (param)) -// #define add_inData(addr, size) -// add_inData_t((memaddr)(addr), (size)); -// #define add_outData(addr, size) -// add_outData_t((memaddr)(addr), (size)); - #define set_inData(index, addr, size) \ set_inData_t(index, (memaddr)(addr), (size)); #define set_outData(index, addr, size) \
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Dec 14 18:34:46 2009 +0900 @@ -64,9 +64,19 @@ { HTaskPtr new_task; +#ifdef SIMPLE_TASK + // for compatibility + new_task = htaskImpl->create(TaskArray1); + new_task->post_func = noaction; + new_task->mimpl = this; + Task *task = new_task->create_task_array(cmd,1,8,8,8); + new_task->r_size = task->size(); + new_task->rbuf = (memaddr)task; +#else new_task = htaskImpl->create(cmd); new_task->post_func = noaction; new_task->mimpl = this; +#endif return new_task; }
--- a/TaskManager/kernel/schedule/SchedTask.cc Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Mon Dec 14 18:34:46 2009 +0900 @@ -11,6 +11,7 @@ #include <stdarg.h> #ifdef SIMPLE_TASK +#include "SchedTaskArray.h" #define Task SimpleTask #define TaskPtr SimpleTaskPtr #endif @@ -162,7 +163,6 @@ scheduler->mail_write((memaddr)task->self); } - SchedTaskBase* SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) { @@ -173,14 +173,17 @@ TaskPtr nextTask = &list->tasks[cur_index++]; SchedTaskBase *nextSched = createSchedTask(scheduler, nextTask); - // この up cast は汚い... - ((SchedTask*)nextSched)->init(list, nextTask, cur_index, - scheduler); + ((SchedTask*)nextSched)->init(list, nextTask, cur_index, scheduler); +#ifdef SIMPLE_TASK + if (nextTask->command==TaskArray1) { + // compatibility + return new SchedTaskArray(scheduler, nextSched); + } if (nextTask->command==TaskArray) { // Start Task Array return (SchedTaskBase*)(new SchedTaskArrayLoad(scheduler, nextSched)); } - +#endif return nextSched; } else { memaddr nextList = (memaddr)list->next;
--- a/TaskManager/kernel/schedule/SchedTask.h Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Mon Dec 14 18:34:46 2009 +0900 @@ -34,11 +34,13 @@ ListData outListData; #endif -private: /* variables */ // 現在スケジューラが実行している TaskList と、このタスクに対応する Task TaskListPtr list; + // Task の、Tasklist での位置。(task = &list[cur_index-1]) + int cur_index; +private: /** * read データ、write 用のバッファ @@ -49,8 +51,6 @@ void *readbuf; void *writebuf; - // Task の、Tasklist での位置。(task = &list[cur_index-1]) - int cur_index; /* functions */
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskArray.cc Mon Dec 14 18:34:46 2009 +0900 @@ -20,6 +20,32 @@ } /** + Constructor for old Task with ListData + next TaskList entry contains Task object. + savedTask->rbuf is 0, it has only one Task. + */ + +SchedTaskArray::SchedTaskArray(Scheduler *s, SchedTaskBase *savedTask_) +{ + savedTask = savedTask_; + SchedTask *sv = (SchedTask*)savedTask_; + scheduler = s; + + inListData.bound = 0; + inListData.size = 0; + inListData.length = 0; + inListData.element = 0; + outListData.bound = 0; + outListData.size = 0; + outListData.length = 0; + outListData.element = 0; + + array = task = (TaskPtr)&sv->list->tasks[sv->cur_index]; + sv->cur_index += (task->size())/sizeof(SimpleTask); + +} + +/** */ SchedTaskArray::~SchedTaskArray() {
--- a/TaskManager/kernel/schedule/SchedTaskArray.h Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskArray.h Mon Dec 14 18:34:46 2009 +0900 @@ -8,11 +8,15 @@ class SchedTaskArray : public SchedTask { public: + BASE_NEW_DELETE(SchedTaskArray); + /* constructor */ SchedTaskArray(Scheduler *s, SchedTaskBase *savedTask_, Task *task_, Task *array_); + /* constructor for old style task */ + SchedTaskArray(Scheduler *s, SchedTaskBase *savedTask_); + virtual ~SchedTaskArray(); - BASE_NEW_DELETE(SchedTaskArray); SchedTaskBase *savedTask; Task *array;
--- a/TaskManager/kernel/sys_task/SysTasks.h Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/sys_task/SysTasks.h Mon Dec 14 18:34:46 2009 +0900 @@ -1,6 +1,7 @@ StartTask, FinishTask, -TaskArray, ShowTime, StartProfile, #define Dummy StartTask +#define TaskArray (-1) +#define TaskArray1 (-2)
--- a/TaskManager/kernel/sys_task/TaskArray.cc Mon Dec 14 17:12:38 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#include "Finish.h" -#include "SysFunc.h" -#include "Scheduler.h" -#include "Task.h" - - -SchedDefineTask(TaskArray); - - -static int -run(SchedTask *s,void *rbuf, void *wbuf) -{ -#ifdef SIMPLE_TASK - -#ifdef TEST_TASK_ARRAY - Task *task = (Task *)rbuf; - Task *last = (Task*)(((char*)rbuf)+ s->read_size()); - - s->printf("last = %lx\n" ,(long) last); - while( task < last) { - s->printf(" task = %lx\n" ,(long) task); - task->print(); - task = task->next(); - } -#else - -#endif -#endif - return 0; -}
--- a/TaskManager/kernel/sys_task/systask_register.cc Mon Dec 14 17:12:38 2009 +0900 +++ b/TaskManager/kernel/sys_task/systask_register.cc Mon Dec 14 18:34:46 2009 +0900 @@ -3,12 +3,12 @@ SchedExternTask(StartTask); SchedExternTask(FinishTask); -SchedExternTask(TaskArray); +// SchedExternTask(TaskArray); void systask_register() { SchedRegister(StartTask); SchedRegister(FinishTask); - SchedRegister(TaskArray); +// SchedRegister(TaskArray); }