annotate TaskManager/kernel/ppe/TaskManagerImpl.cc @ 831:b3c004fe6bc3 draft

CheckTaskList Mail working
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 25 May 2010 17:48:39 +0900
parents af2fb2e641eb
children 577bde5d0cec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
75f184d16fa5 *** empty log message ***
gongo
parents: 3
diff changeset
1 #include <stdio.h>
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
2 #include "TaskManagerImpl.h"
46
f154d9d07a42 *** empty log message ***
gongo
parents: 42
diff changeset
3 #include "types.h"
f154d9d07a42 *** empty log message ***
gongo
parents: 42
diff changeset
4 #include "error.h"
546
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
5 #include "SchedTask.h"
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
6 #include "Scheduler.h"
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
7 #include "SysTask.h"
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
8 #include "SysFunc.h"
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
9 #include <string.h>
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
10
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
11
220
gongo@localhost.localdomain
parents: 115
diff changeset
12 static HTaskPtr systask_start;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
13 static HTaskPtr systask_finish;
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
14
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
15 static void
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
16 noaction(SchedTask *s, void *read, void *write)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
17 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
18 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
19
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
20 TaskManagerImpl::TaskManagerImpl(int num)
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
21 : machineNum(num) {
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
22 activeTaskQueue = new HTaskInfo();
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
23 waitTaskQueue = new HTaskInfo();
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
24 htaskImpl = waitTaskQueue ; // any HTaskInfo
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
25 taskQueueImpl = new TaskQueueInfo();
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
26 }
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
27
220
gongo@localhost.localdomain
parents: 115
diff changeset
28 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
29 * 一番最初に PPE で実行される systask_start
220
gongo@localhost.localdomain
parents: 115
diff changeset
30 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
31 void
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
32 TaskManagerImpl::systask_init()
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
33 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
34 systask_register();
639
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
35 systask_start = create_task(StartTask,0,0,0,0);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
36 systask_finish = create_task(FinishTask,0,0,0,0);
220
gongo@localhost.localdomain
parents: 115
diff changeset
37
gongo@localhost.localdomain
parents: 115
diff changeset
38 systask_start->spawn();
gongo@localhost.localdomain
parents: 115
diff changeset
39
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
40 // すべての Task が FinishTask を wait_for すると、
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
41 // あらゆる Task が FinishTask の waiting task queue を操作する
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
42 // ことになる。それは、重すぎる。PPE/SPE Task が終了した時点で、
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
43 // TaskManager が実行する方が安い。
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
44 // append_waitTask(systask_finish);
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
45 }
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
46
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
47 HTaskPtr
636
aba1600e8f83 Cell Simple Task compiled. but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
48 TaskManagerImpl::create_task(int cmd,memaddr rbuf, long r_size, memaddr wbuf, long w_size)
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
49 {
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
50 HTaskPtr new_task;
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
51
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
52 new_task = htaskImpl->create(cmd, rbuf, r_size, wbuf, w_size);
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
53 new_task->post_func = noaction;
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
54 new_task->mimpl = this;
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
55
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
56 return new_task;
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
57 }
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
58
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
59 HTaskPtr
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
60 TaskManagerImpl::create_task(int cmd)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
61 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
62 HTaskPtr new_task;
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
63
703
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
64 // for compatibility
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
65 new_task = htaskImpl->create(TaskArray1);
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
66 new_task->post_func = noaction;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
67 new_task->mimpl = this;
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
68 new_task->create_task_array(cmd,1,8,8,8);
713
97adb3fe85c6 remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
69 // rbuf, r_size were set
704
ec6c897448ca Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
70 new_task->command = TaskArray1;
63
54355e641172 *** empty log message ***
gongo
parents: 58
diff changeset
71
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
72 return new_task;
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
73 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
74
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
75 HTaskPtr
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
76 TaskManagerImpl::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData)
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
77 {
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
78 HTaskPtr ta = create_task(TaskArray,0,0,0,0);
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
79 ta->create_task_array(id, num_task, num_param, num_inData, num_outData) ;
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
80 return ta;
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
81 }
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
82
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
83 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
84 * task の依存関係を設定
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
85 * master task が終わってから、slave task を実行するように
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
86 * master->wait_for(slave);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
87 */
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
88 void
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
89 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave)
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
90 {
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
91 TaskQueuePtr m, s;
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
92
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
93 m = taskQueueImpl->create(master);
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
94 s = taskQueueImpl->create(slave);
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
95
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
96 master->wait_me->addLast(s);
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
97 slave->wait_i->addLast(m);
481
f9ffcffb6d09 Double linked list modification done (tested on Mac OS X)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 480
diff changeset
98 s->waiter = m;
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
99 }
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
100
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
101 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
102 * タスクを実行可能キューまたは待機キューへ追加する。
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
103 * 依存関係が満たされていれば active, まだだったら wait へ。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
104 * task->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
105 */
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
106 void
18
0c9341da4522 *** empty log message ***
gongo
parents: 5
diff changeset
107 TaskManagerImpl::spawn_task(HTaskPtr task)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
108 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
109 // waiter // master
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
110 // waitee // slave
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
111 if (task->wait_i->empty()) {
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
112 append_activeTask(task);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
113 } else {
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
114 append_waitTask(task);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
115 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
116
635
c56f6847fb87 SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
117 // systask_finish->wait_for(task);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
118 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
119
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
120
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
121 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
122 * Task を実行可能キューに追加する
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
123 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
124 void
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
125 TaskManagerImpl::append_activeTask(HTaskPtr q)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
126 {
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
127 activeTaskQueue->addLast(q);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
128 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
129
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
130 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
131 * タスクが実行する CPU を選択する
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
132 *
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
133 * 現在は CPU_PPE, CPU_SPE, SPE_ANY, SPE_0, SPE_1, ..., SPE_5
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
134 * types.h に書いてます。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
135 */
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
136 void
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
137 TaskManagerImpl::set_task_cpu(HTaskPtr task, CPU_TYPE type)
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
138 {
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
139 if (machineNum==0)
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
140 task->cpu_type = CPU_PPE ;
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
141 else
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
142 task->cpu_type = type;
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
143 }
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
144
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
145 /**
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
146 * @brief 終了したタスクから依存の処理とか
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
147 * post_func() はこのタスクが終了したら実行する関数。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
148 *
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
149 * @param [task] 終了したタスク
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
150 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
151 void
647
7ba4ad4538b1 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 639
diff changeset
152 TaskManagerImpl::check_task_finish(HTaskPtr me, HTaskInfo *wait_queue)
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
153 {
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
154
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
155 while(TaskQueue *p = me->wait_me->poll()) {
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
156 HTaskPtr you = p->task;
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
157 TaskQueueInfo *wait_i = you->wait_i;
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
158 // 相手の wait queue から自分(を指しているTaskQueue)を削除
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
159 wait_i->remove(p->waiter);
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
160 // queue を free する
493
2a7a9f80b8e7 fix free conflict.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
161 wait_i->free_(p->waiter);
483
5f4ffff2c2aa renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 481
diff changeset
162
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
163 if (wait_i->empty()) {
647
7ba4ad4538b1 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 639
diff changeset
164 wait_queue->remove(you);
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
165 append_activeTask(you);
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
166 }
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
167
493
2a7a9f80b8e7 fix free conflict.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
168 wait_i->free_(p);
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
169 }
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
170
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
171 htaskImpl->free_(me);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
172 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
173
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
174 /**
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
175 * @brief 終了したタスクリストの依存の処理
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
176 * @param [task] 終了したタスク
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
177 */
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
178 void
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
179 TaskManagerImpl::check_task_list_finish(SchedTask *s, TaskListPtr list, HTaskInfo *wait_queue)
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
180 {
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
181 for(int i = 0;i<list->length;i++) {
831
b3c004fe6bc3 CheckTaskList Mail working
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
182 SimpleTaskPtr task = &list->tasks[i];
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
183 HTask *me = (HTask*)task->self;
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
184 me->post_func(s, me->post_arg1, me->post_arg2);
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
185 if (task->command==TaskArray1) {
831
b3c004fe6bc3 CheckTaskList Mail working
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
186 int next = ((task->r_size)/sizeof(SimpleTask))+1;
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
187 // assert(next<list->length);
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
188 i+=next;
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
189 }
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
190 check_task_finish(me, wait_queue);
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
191 }
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
192 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
193
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
194 /**
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
195 * @brief waitTaskqueue への挿入 。必須ではない。
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
196 * 現状では、dead lock 検出にしか使ってない
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
197 *
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
198 * @param [task] 終了したタスク
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
199 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
200 void
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
201 TaskManagerImpl::append_waitTask(HTaskPtr q)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
202 {
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
203 waitTaskQueue ->addLast(q);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
204 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
205
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
206 /**
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
207 @brief htask を DMA でCPUに渡すための TaskList に入れる (copy)
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
208 @param htask
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
209 @param taskList
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
210 TaskList は自動的に延長される
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
211 */
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
212 void
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
213 TaskManagerImpl::set_taskList(HTaskPtr htask, TaskListInfoPtr taskList) {
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
214 TaskListPtr list ;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
215 if ( taskList->empty() ) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
216 list = taskList->create();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
217 taskList->addLast(list);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
218 } else
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
219 list = taskList->getLast();
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
220 SimpleTaskPtr task = &list->tasks[list->length++];
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
221 if (htask->command==TaskArray1) {
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
222 // compatibility
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
223 int next = ((htask->r_size)/sizeof(SimpleTask))+1;
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
224 if (list->length+next>=TASK_MAX_SIZE) {
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
225 list->length--;
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
226 TaskListPtr newList = taskList->create();
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
227 taskList->addLast(newList);
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
228 list = newList;
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
229 task = &list->tasks[list->length++];
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
230 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
231 Task *array = (Task*)&list->tasks[list->length];
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
232 list->length += next;
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
233 if (list->length>=TASK_MAX_SIZE) {
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
234 perror("task array1 overflow\n");
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
235 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
236 memcpy(array, htask->rbuf, htask->r_size);
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
237 free(htask->rbuf);
831
b3c004fe6bc3 CheckTaskList Mail working
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
238 // htask->rbuf = 0; htask->r_size = 0; we need this...
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
239 *task = *(SimpleTask*)htask;
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
240 } else {
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
241 *task = *(SimpleTask*)htask;
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
242 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
243 if (list->length >= TASK_MAX_SIZE) {
809
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 807
diff changeset
244 TaskListPtr newList = taskList->create();
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
245 taskList->addLast(newList);
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
246 list = newList;
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
247 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
248 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
249
54
90523ccc4dff *** empty log message ***
gongo
parents: 50
diff changeset
250
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
251
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
252 /* end */