# HG changeset patch # User Shinji KONO # Date 1342404100 -32400 # Node ID b158873485f66b2765e9c49274fb3abca577b648 # Parent 8ecdbe8fde1f4d41c9ddf69733cef183cac1a79c fix simple task diff -r 8ecdbe8fde1f -r b158873485f6 TaskManager/kernel/ppe/HTask.cc --- a/TaskManager/kernel/ppe/HTask.cc Mon Jul 16 09:12:55 2012 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Mon Jul 16 11:01:40 2012 +0900 @@ -91,8 +91,8 @@ rbuf = (memaddr)tl; bzero(tl->tasks,sizeof(Task)*TASK_MAX_SIZE); Task *task = tl->tasks; - task->init(id, num_param,num_inData,num_outData); - last = task->next(); + task->init(id, num_param,num_inData,num_outData); // next_task_array が呼ばれれば、これは不要 + last = task->next(); // return task; // first task } @@ -125,8 +125,10 @@ { TaskList *tl = (TaskList*)rbuf; if (t==0) { - tl->tasks->init(id, param_count, inData_count, outData_count); - return tl->tasks; + TaskPtr task = tl->tasks; + task->init(id, param_count, inData_count, outData_count); + last = task->next(); + return task; } Task *next = t->next(); if (next >= tl->last()) { @@ -140,6 +142,7 @@ rbuf = (memaddr)tl; } next->init(id, param_count, inData_count, outData_count); + last = next->next(); return next; } diff -r 8ecdbe8fde1f -r b158873485f6 TaskManager/kernel/ppe/HTask.h --- a/TaskManager/kernel/ppe/HTask.h Mon Jul 16 09:12:55 2012 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Mon Jul 16 11:01:40 2012 +0900 @@ -108,12 +108,8 @@ t->set_outData_t(index, addr,size); } void set_param_t(int index, memaddr param) { - if (command==TaskArray1) { - Task *t = ((TaskList*)rbuf)->tasks; - t->set_param_t(index, param); - } else { - this->param = param; - } + Task *t = ((TaskList*)rbuf)->tasks; + t->set_param_t(index, param); } void no_auto_free() { diff -r 8ecdbe8fde1f -r b158873485f6 TaskManager/kernel/ppe/TaskManagerImpl.cc --- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Jul 16 09:12:55 2012 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Jul 16 11:01:40 2012 +0900 @@ -61,13 +61,18 @@ HTaskPtr TaskManagerImpl::create_task(int cmd,memaddr rbuf, long r_size, memaddr wbuf, long w_size, void *from) { HTaskPtr new_task = htaskImpl->create(); - new_task->init(cmd, rbuf, r_size, wbuf, w_size); + new_task->init(cmd, rbuf, r_size, wbuf, w_size); // この引数はもう意味がない new_task->mimpl = this; - new_task->create_task_array(cmd, 1, 8, 8, 8) ; + new_task->command = TaskArray1; + new_task->create_task_array(cmd, 1, 8, 8, 8) ; // この引数はもう意味がない new_task->post_func = noaction; new_task->from = (memaddr)from; - TaskLog *tasklog = new TaskLog(); + Task *t = new_task->next_task_array(cmd,0,8,1,1); + t->set_inData(0,rbuf,r_size); + t->set_outData(0,wbuf,w_size); + + TaskLog *tasklog = new TaskLog(); // この hard code は、ひどい... state pattern で切れるようにしてよ。 tasklog->set_cmd(cmd); taskLogQueue->addLast(tasklog); new_task->tasklog = tasklog; @@ -78,7 +83,7 @@ printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", cmd, (unsigned long)rbuf, r_size); } - char *p = (char *)rbuf; char b = *p; + char *p = (char *)rbuf; char b = *p; // これはコンパイラが落としてしまうのではないか... p = (char *)(rbuf+r_size-1); b += *p; } if (wbuf) { @@ -108,6 +113,7 @@ // rbuf, r_size were set new_task->command = TaskArray1; new_task->from = (memaddr)from; + new_task->next_task_array(cmd,0,8,1,1); TaskLog *tasklog = new TaskLog(); tasklog->set_cmd(cmd); diff -r 8ecdbe8fde1f -r b158873485f6 TaskManager/kernel/schedule/SchedTask.cc --- a/TaskManager/kernel/schedule/SchedTask.cc Mon Jul 16 09:12:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Mon Jul 16 11:01:40 2012 +0900 @@ -220,6 +220,12 @@ return inListData.element[index].size; } +int +SchedTask::read_size() +{ + return get_inputSize(0); +} + /** * write buffer の領域を返す。 */ @@ -251,6 +257,13 @@ return outListData.element[index].size; } +int +SchedTask::write_size() +{ + return get_outputSize(0); +} + + void SchedTask::set_outputSize(int index, int size) { diff -r 8ecdbe8fde1f -r b158873485f6 TaskManager/kernel/schedule/SchedTask.h --- a/TaskManager/kernel/schedule/SchedTask.h Mon Jul 16 09:12:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Mon Jul 16 11:01:40 2012 +0900 @@ -38,9 +38,8 @@ Scheduler* sc, int tag); //--- User API --- - //int read_size() { return get_inputSize(0); } - //int write_size() { return task->w_size; } - //void set_write_size(int w) { task->w_size = w; } + int read_size() ; + int write_size(); void setup_outputData(); void* get_input(void *buff, int index); diff -r 8ecdbe8fde1f -r b158873485f6 example/Simple/ppe/Twice.cc --- a/example/Simple/ppe/Twice.cc Mon Jul 16 09:12:55 2012 +0900 +++ b/example/Simple/ppe/Twice.cc Mon Jul 16 11:01:40 2012 +0900 @@ -4,10 +4,10 @@ #include "Func.h" /* これは必須 */ -SchedDefineTask(Twice); +SchedDefineTask1(Twice, twice_run); static int -run(SchedTask *s,void *rbuf, void *wbuf) +twice_run(SchedTask *s,void *rbuf, void *wbuf) { int *i_data; int *o_data;