Mercurial > hg > Game > Cerium
view TaskManager/kernel/ppe/Task.h @ 686:6e42b20f6198 draft
TaskArray structure
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 06 Dec 2009 16:41:10 +0900 |
parents | ecf7e09b1fe8 |
children | 25afcd4ae380 |
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 Task { public: // variables int size; 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); memaddr param(int index) { memaddr p = (memaddr)data->data; return p + sizeof(memaddr)*index; } memaddr inData(int index) { memaddr p = (memaddr)data + (sizeof(memaddr)*index); return p + sizeof(ListElement)*index; } memaddr outData(int index) { memaddr p = inData(inData_size); return p + sizeof(ListEelement)* 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); int set_param_t(int index, memaddr param) { memaddr *p = (memaddr*)param(index); *p = param; } int size() { return outData(outData_size)-(memaddr)data; } // #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