Mercurial > hg > Members > kono > Cerium
view TaskManager/kernel/ppe/HTask.h @ 714:c42cab5ad4c3
HTask fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 16 Dec 2009 15:31:54 +0900 |
parents | f725c6455d19 |
children | 5df90e02e34f |
line wrap: on
line source
#ifndef INCLUDED_HTASK #define INCLUDED_HTASK #include "base.h" #include "types.h" #include "Task.h" #include "TaskQueueInfo.h" class TaskManagerImpl; class SchedTask; typedef void (*PostFunction)(SchedTask *s, void *read, void *write); /*! @class @brief Cerium の Task で、spawn() でキューに格納されて順次実行される。 cpu の指定があれば並列に実行される。 特定の Task を待ち合わせる事が可能。 Task の入出力は dma などで copy される。 */ #include "SimpleTask.h" class HTask : public SimpleTask { public: BASE_NEW_DELETE(HTask); TaskQueueInfo *wait_me; // List of task waiting for me TaskQueueInfo *wait_i; // List of task for which I am waiting PostFunction post_func; void *post_arg1; void *post_arg2; CPU_TYPE cpu_type; TaskManagerImpl *mimpl; HTask *waiter; HTask *next; HTask *prev; void spawn(); void wait_for(HTask *); void set_cpu(CPU_TYPE type); void set_post(PostFunction func, void *read, void *write); 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); private: int param_index; int in_index; int out_index; // 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); } void init(int cmd) { next = prev = NULL; waiter = NULL; command = cmd; param_index = 0; in_index = 0; out_index = 0; self = (memaddr) this; post_func = NULL; mimpl = NULL; cpu_type = CPU_PPE; } #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)); }; typedef HTask* HTaskPtr; #endif