Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/ppe/HTask.cc @ 713:97adb3fe85c6 draft
remove SIMPLE_TASK conditional
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 16 Dec 2009 15:27:46 +0900 |
parents | ec6c897448ca |
children | 1b225972ae88 |
rev | line source |
---|---|
109 | 1 #include "HTask.h" |
2 #include "ListData.h" | |
3 #include "TaskManagerImpl.h" | |
704
ec6c897448ca
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
700
diff
changeset
|
4 #include "strings.h" |
109 | 5 |
6 | |
293 | 7 /*! |
297 | 8 manager->set_task_depend(task1, task2); // task2 は task1 の終了を待つ |
293 | 9 |
297 | 10 ってやるより |
293 | 11 |
12 task2->set_depend(task1); | |
13 | |
297 | 14 ってやったほうがわかりやすいよねー的な話し合いで |
15 下のようなAPIを作りました | |
293 | 16 */ |
17 | |
109 | 18 void |
19 HTask::spawn(void) | |
20 { | |
21 mimpl->spawn_task(this); | |
22 } | |
23 | |
293 | 24 /*! |
297 | 25 @brief この Task が待ち合わせする Task を指定する |
26 @param[in] master この Task が終了待ち合わせをする相手の Task | |
293 | 27 |
297 | 28 繰り返し使用する事で複数の Task を待ち合わせする事ができる。 |
293 | 29 |
297 | 30 wait_for している Task の入力バッファにこの Task から書き込みできる機能があると良い |
293 | 31 */ |
32 | |
109 | 33 void |
293 | 34 HTask::wait_for(HTaskPtr master) |
109 | 35 { |
36 mimpl->set_task_depend(master, this); | |
37 } | |
38 | |
547 | 39 void |
40 HTask::set_cpu(CPU_TYPE type) | |
41 { | |
109 | 42 mimpl->set_task_cpu(this, type); |
547 | 43 } |
44 | |
45 void | |
550 | 46 HTask::set_post(PostFunction func,void *arg1, void *arg2) |
547 | 47 { |
109 | 48 this->post_func = func; |
550 | 49 this->post_arg1 = arg1; |
50 this->post_arg2 = arg2; | |
547 | 51 } |
52 | |
687
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
53 |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
54 Task * |
700 | 55 HTask::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData) |
687
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
56 { |
700 | 57 r_size = Task::calc_size(num_param, num_inData, num_outData)*num_task; |
58 rbuf = (memaddr) mimpl->allocate(r_size); | |
704
ec6c897448ca
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
700
diff
changeset
|
59 bzero(rbuf,r_size); |
700 | 60 Task *task = (Task*)rbuf; |
61 task->init(id, num_param,num_inData,num_outData); | |
62 // task->print(); | |
63 return task; // first task | |
64 } | |
689
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
65 |
700 | 66 Task * |
67 HTask::next_task_array(int id, Task *t) | |
68 { | |
69 Task *first = (Task*)rbuf; | |
70 if (t==0) { | |
71 // first->print(); | |
72 return first; | |
73 } | |
74 | |
75 Task *next = t->next(); | |
76 next->init(id, first->param_count, first->inData_count, first->outData_count); | |
77 if ((memaddr)next - (memaddr)rbuf > r_size) | |
78 printf("too many task array used.\n"); | |
79 return next; | |
687
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
80 } |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
81 |
689
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
82 void |
700 | 83 HTask::spawn_task_array(Task * last) |
689
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
84 { |
700 | 85 int size = (memaddr)last - rbuf; |
86 if (size!= r_size) { | |
87 printf("spawn task array size differ size 0x%x r_size 0x%x\n", | |
88 size, r_size); | |
689
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
89 } |
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
90 } |
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
91 |
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
92 |
687
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
93 |
547 | 94 /* end */ |