annotate TaskManager/kernel/ppe/HTask.cc @ 689:ecf63089f5bb draft

Task Array generation worked.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 06 Dec 2009 23:03:28 +0900
parents 77c89477daa8
children 4b6242d03512
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include "HTask.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include "ListData.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include "TaskManagerImpl.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
6 /*!
297
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
7 manager->set_task_depend(task1, task2); // task2 は task1 の終了を待つ
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
8
297
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
9 ってやるより
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
10
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
11 task2->set_depend(task1);
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
12
297
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
13 ってやったほうがわかりやすいよねー的な話し合いで
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
14 下のようなAPIを作りました
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
15 */
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
16
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 HTask::spawn(void)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20 mimpl->spawn_task(this);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
23 /*!
297
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
24 @brief この Task が待ち合わせする Task を指定する
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
25 @param[in] master この Task が終了待ち合わせをする相手の Task
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
26
297
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
27 繰り返し使用する事で複数の Task を待ち合わせする事ができる。
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
28
297
54725883131b start task config
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
29 wait_for している Task の入力バッファにこの Task から書き込みできる機能があると良い
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
30 */
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
31
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 void
293
da8edd0735f2 add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
33 HTask::wait_for(HTaskPtr master)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 mimpl->set_task_depend(master, this);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
38 void
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
39 HTask::set_cpu(CPU_TYPE type)
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
40 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 mimpl->set_task_cpu(this, type);
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
42 }
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
43
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
44 void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
45 HTask::set_post(PostFunction func,void *arg1, void *arg2)
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
46 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 this->post_func = func;
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
48 this->post_arg1 = arg1;
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
49 this->post_arg2 = arg2;
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
50 }
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
51
687
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
52 #ifdef SIMPLE_TASK
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 *
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
55 HTask::create_task_array(int task_id, int pos)
687
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
56 {
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
57 Task *task = (Task*)((memaddr)rbuf + pos);
687
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
58 task->set_task_id(task_id);
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
59 task-> param_size = 0;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
60 task-> inData_size = 0;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
61 task-> outData_size = 0;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
62 task-> inData_offset = 0;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
63 task-> outData_offset = 0;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
64
687
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
65 return task;
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
66 }
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
67
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
68 void
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
69 HTask::spawn_task_array(int pos)
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
70 {
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
71 if (pos!= r_size) {
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
72 printf("spawn task array size differ pos 0x%x r_size 0x%x\n",
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
73 pos, r_size);
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
74 }
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
75 }
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
76
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 688
diff changeset
77
687
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
78 #endif
25afcd4ae380 test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
79
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
80 /* end */