Mercurial > hg > Game > Cerium
view TaskManager/kernel/ppe/Task.h @ 688:77c89477daa8 draft
on going...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 06 Dec 2009 18:53:46 +0900 |
parents | 25afcd4ae380 |
children | ecf63089f5bb |
line wrap: on
line source
#ifndef INCLUDED_TASK #define INCLUDED_TASK #include "base.h" #include "types.h" #include "ListData.h" #include "SimpleTask.h" #define MAX_PARAMS 8 #ifndef SIMPLE_TASK class Task : public SimpleTask { public: // variables BASE_NEW_DELETE(Task); int param_size; // 4 byte memaddr param[MAX_PARAMS]; // 4*MAX_PARAMS byte ListData inData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); ListData outData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); public: // functions int add_inData_t(memaddr addr, int size); // unsigned int ではなく 64bit int add_outData_t(memaddr addr, int size); // unsigned int ではなく 64bit int add_data(ListData &list, memaddr addr, int size); int add_param_t(memaddr param); // obsolete. do not use. int set_param_t(int index, memaddr 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)); }; #else class SchedTask; class Task { public: // variables int command; int param_size; int inData_size; int outData_size; void *data[] __attribute__ ((aligned (DEFAULT_ALIGNMENT))); // memaddr param[param_size]; // ListEelemnt inData[inData_size]; // ListElement outData[outData_size]; public: // functions // int add_inData_t(memaddr addr, int size); // int add_outData_t(memaddr addr, int size); void print(); memaddr param(int index) { memaddr p = (memaddr)data; return p + sizeof(memaddr)*index; } memaddr inData(int index) { return param(param_size) + sizeof(ListElement)*index; } memaddr outData(int index) { memaddr p = inData(inData_size); return p + sizeof(ListElement)* index; } void set_param_length(int i) { param_size = i; } void set_inData_length(int length) { inData_size = length; } void set_outData_length(int length) { outData_size = length; } void set_inData_t( int index, memaddr addr, int size); void set_outData_t(int index, memaddr addr, int size); void set_task_id(int id) { command = id; } void set_param_t(int index, memaddr param) { memaddr *p = (memaddr*)this->param(index); *p = param; } int size() { return outData(outData_size)-(memaddr)data; } static int count_size(int params, int ins, int outs) { int size = sizeof(memaddr)*params + sizeof(ListElement)*ins + sizeof(ListElement)*outs; return size; } // #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) \ set_outData_t(index, (memaddr)(addr), (size)); }; #endif typedef Task* TaskPtr; #endif