Mercurial > hg > Members > kono > Cerium
annotate TaskManager/kernel/schedule/SchedTask.cc @ 1015:80b18af207c2
debug mail timing.
author | yutaka@localhost.localdomain |
---|---|
date | Fri, 05 Nov 2010 22:25:33 +0900 |
parents | c67379f9d411 |
children |
rev | line source |
---|---|
736 | 1 |
308 | 2 #include <stdlib.h> |
3 #include <string.h> | |
42 | 4 #include "SchedTask.h" |
695 | 5 #include "SysFunc.h" |
308 | 6 #include "SchedTaskList.h" |
695 | 7 #include "SchedTaskArrayLoad.h" |
308 | 8 #include "SchedNop2Ready.h" |
9 #include "DmaManager.h" | |
10 #include "error.h" | |
11 #include "TaskManager.h" | |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
12 #include <stdarg.h> |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
13 |
703 | 14 #include "SchedTaskArray.h" |
683 | 15 #define Task SimpleTask |
16 #define TaskPtr SimpleTaskPtr | |
17 | |
698
dcaa40ec963d
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
18 extern TaskObject task_list[MAX_TASK_OBJECT]; |
308 | 19 |
20 | |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
21 |
308 | 22 SchedTask::SchedTask() |
23 { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
24 list = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
25 task = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
26 readbuf = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
27 writebuf = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
28 scheduler = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
29 cur_index = 0; |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
30 this->stdout_ = stdout; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
31 this->stderr_ = stderr; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
32 this->stdin_ = stdin; |
373 | 33 |
567 | 34 |
308 | 35 } |
36 | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
37 SchedTask::~SchedTask() |
308 | 38 { |
39 } | |
40 | |
41 void | |
972 | 42 SchedTask::init(TaskListPtr _list, TaskPtr _task, int index, Scheduler* sc, int tag) |
308 | 43 { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
44 list = _list; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
45 task = _task; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
46 scheduler = sc; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
47 cur_index = index; |
972 | 48 this->tag = tag; |
567 | 49 |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
50 // scheduler->mainMem_wait(); // これはなんで? |
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
51 manager = sc->manager; |
308 | 52 |
888
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
53 #ifdef TASK_LIST_MAIL |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
54 if (list) |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
55 waiter = (memaddr) list->waiter; |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
56 #else |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
57 if (task) |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
58 waiter = (memaddr) task->self; |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
59 #endif |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
60 |
567 | 61 } |
62 | |
308 | 63 |
502
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
64 void |
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
65 SchedTask::read() |
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
66 { |
506 | 67 __debug("[SchedTask:%s]\n", __FUNCTION__); |
68 | |
69 // object creation をSchedTask生成時にやらないので、 | |
70 // exec の直前のread で十分に間に合う | |
704
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
703
diff
changeset
|
71 loadSchedTask(scheduler, task->command); |
713
f725c6455d19
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
708
diff
changeset
|
72 |
634 | 73 // 読むデータが一つもなければ無視 |
74 if (task->r_size == 0) return; | |
75 // load Input Data | |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
76 readbuf = manager->allocate(task->r_size); |
972 | 77 scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ + this->tag); |
506 | 78 |
567 | 79 |
502
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
80 } |
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
81 |
308 | 82 |
83 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
84 SchedTask::exec() |
308 | 85 { |
871
ab3cd3aeacff
fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
832
diff
changeset
|
86 task_list[task->command].wait(scheduler,task->command); |
895
bed529c55eda
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
888
diff
changeset
|
87 TaskObjectRun run = task_list[task->command].run; |
699 | 88 if (task->w_size > 0) { |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
89 writebuf = manager->allocate(task->w_size); |
699 | 90 } |
972 | 91 scheduler->dma_wait(DMA_READ + this->tag); |
895
bed529c55eda
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
888
diff
changeset
|
92 run(this, readbuf, writebuf); |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
93 free(readbuf); |
308 | 94 |
519 | 95 // 書き込む領域がなければ無視 |
713
f725c6455d19
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
708
diff
changeset
|
96 |
635
8cc609285bbe
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
97 if (task->w_size > 0) { |
637 | 98 scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_WRITE); |
635
8cc609285bbe
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
99 } |
308 | 100 } |
101 | |
102 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
103 SchedTask::write() |
308 | 104 { |
105 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
373 | 106 |
567 | 107 scheduler->dma_wait(DMA_WRITE); |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
108 free(writebuf); |
888
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
109 #ifdef TASK_LIST_MAIL |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
110 if (!(cur_index < list->length) ) |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
111 scheduler->mail_write(waiter); |
1007 | 112 |
1009 | 113 #else |
1007 | 114 |
1009 | 115 #ifdef MAIL_QUEUE |
1007 | 116 scheduler->mail_write_queue(waiter); |
888
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
117 #else |
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
118 scheduler->mail_write(waiter); |
830 | 119 #endif |
1009 | 120 #endif |
308 | 121 } |
122 | |
123 SchedTaskBase* | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
124 SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) |
308 | 125 { |
126 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
127 | |
567 | 128 if (cur_index < list->length) { |
619 | 129 // Task List が残っているので、次を準備 |
567 | 130 |
888
586ed400413a
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
131 TaskPtr nextTask = &list->tasks[cur_index]; |
1015 | 132 |
708 | 133 SchedTask *nextSched = new SchedTask(); |
972 | 134 nextSched->init(list, nextTask, cur_index+1, scheduler, this->tag^1); |
717
4c12f679a0fa
TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
135 // この時点で、TaskList は down load が済んでないことがある |
4c12f679a0fa
TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
136 // 最初のTaskの種類に関しては、別な情報で渡す方が良い |
4c12f679a0fa
TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
137 // あるいはTaskListの最初には、TaskArray1/TaskArray を置かない? |
713
f725c6455d19
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
708
diff
changeset
|
138 |
703 | 139 if (nextTask->command==TaskArray1) { |
140 // compatibility | |
141 return new SchedTaskArray(scheduler, nextSched); | |
142 } | |
695 | 143 if (nextTask->command==TaskArray) { |
144 // Start Task Array | |
970
33630c6ff445
change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
945
diff
changeset
|
145 int dma_tag_switch = 0; |
33630c6ff445
change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
945
diff
changeset
|
146 return new SchedTaskArrayLoad(scheduler, nextSched, dma_tag_switch); |
695 | 147 } |
619 | 148 return nextSched; |
308 | 149 } else { |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
150 memaddr nextList = (memaddr)list->next; |
567 | 151 if (nextList == 0) { |
619 | 152 // もう何もする必要がない |
1015 | 153 |
567 | 154 return new SchedNop2Ready(scheduler); |
155 } else { | |
619 | 156 // 新しいリストに取り掛かる |
972 | 157 int dma_tag_switch = 0; |
158 return new SchedTaskList(nextList, scheduler, dma_tag_switch); | |
567 | 159 } |
308 | 160 } |
161 } | |
162 | |
163 | |
164 int | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
165 SchedTask::get_cpuid() |
308 | 166 { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
167 return scheduler->id; |
308 | 168 } |
169 | |
708 | 170 void SchedTask::free_(void *p) { |
171 scheduler->free_(p); | |
172 } | |
173 | |
945
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
174 /** |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
175 * SimpleTask has one parameter , one input, one output |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
176 */ |
698
dcaa40ec963d
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
177 |
945
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
178 void* SchedTask::get_input(void *buff, int index) { return readbuf; } |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
179 memaddr SchedTask::get_inputAddr(int index) { return task->rbuf; } |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
180 int SchedTask::get_inputSize(int index) {return task->r_size; } |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
181 void* SchedTask::get_output(void *buff, int index) {return writebuf; } |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
182 memaddr SchedTask::get_outputAddr(int index) { return task->wbuf; } |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
183 int SchedTask::get_outputSize(int index) { return task->w_size; } |
a9c7784e5dae
sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
184 memaddr SchedTask::get_param(int index) { return task->param; } |
698
dcaa40ec963d
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
185 |
308 | 186 |
187 void* | |
188 SchedTask::global_alloc(int id, int size) { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
189 return scheduler->global_alloc(id, size); |
308 | 190 } |
191 | |
192 void* | |
193 SchedTask::global_get(int id) { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
194 return scheduler->global_get(id); |
308 | 195 } |
196 | |
197 void | |
373 | 198 SchedTask::global_set(int id, void *addr) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
199 scheduler->global_set(id, addr); |
373 | 200 } |
201 | |
202 void | |
308 | 203 SchedTask::global_free(int id) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
204 scheduler->global_free(id); |
308 | 205 } |
206 | |
373 | 207 MemList* |
208 SchedTask::createMemList(int size, int count) { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
209 return scheduler->createMemList(size, count); |
373 | 210 } |
211 | |
308 | 212 void |
213 SchedTask::mainMem_alloc(int id, int size) { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
214 scheduler->mainMem_alloc(id, size); |
308 | 215 } |
216 | |
217 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
218 SchedTask::mainMem_wait() { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
219 scheduler->mainMem_wait(); |
308 | 220 } |
221 | |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
222 memaddr |
308 | 223 SchedTask::mainMem_get(int id) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
224 return scheduler->mainMem_get(id); |
308 | 225 } |
226 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
466
diff
changeset
|
227 |
308 | 228 void |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
229 SchedTask::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
230 scheduler->dma_load(buf, addr, size, mask); |
308 | 231 } |
232 | |
233 void | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
234 SchedTask::dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
235 scheduler->dma_store(buf, addr, size, mask); |
308 | 236 } |
237 | |
238 void | |
239 SchedTask::dma_wait(uint32 mask) { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
240 scheduler->dma_wait(mask); |
308 | 241 } |
242 | |
334
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
243 void |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
244 SchedTask::show_dma_wait() { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
245 scheduler->show_dma_wait(); |
334
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
246 } |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
247 |
674
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
248 long |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
249 SchedTask::get_random() { |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
250 return scheduler->get_random(); |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
251 } |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
252 |
672 | 253 void |
254 SchedTask::start_profile() { | |
255 scheduler->start_profile(); | |
256 } | |
257 | |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
258 MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
259 return scheduler->get_segment(addr,m); |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
260 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
261 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
262 void SchedTask::put_segment(MemorySegment *s) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
263 scheduler->put_segment(s); |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
264 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
265 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
266 void SchedTask::wait_segment(MemorySegment *s) { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
267 scheduler->wait_segment(s); |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
268 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
269 |
917
7f55c8727caa
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
270 uint32 SchedTask::get_tag() { |
7f55c8727caa
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
271 return scheduler->get_tag(); |
7f55c8727caa
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
272 } |
7f55c8727caa
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
273 |
619 | 274 |
634 | 275 HTaskPtr |
276 SchedTask::create_task(int cmd) | |
619 | 277 { |
897
ad95be23c794
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
278 return manager->create_task(cmd, __builtin_return_address(0)); |
619 | 279 } |
280 | |
634 | 281 HTaskPtr |
282 SchedTask::create_task(int cmd, memaddr r, long rs, memaddr w, long ws) | |
283 { | |
897
ad95be23c794
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
284 return manager->create_task(cmd,r,rs,w,ws, __builtin_return_address(0)); |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
285 } |
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
286 |
802 | 287 HTaskPtr |
288 SchedTask::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData) | |
289 { | |
897
ad95be23c794
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
290 return manager->create_task_array(id, num_task, num_param, num_inData, num_outData, __builtin_return_address(0)); |
802 | 291 } |
292 | |
941
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
293 void SchedTask::free_htask(HTask *p) { |
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
294 #if !defined(__SPU__) |
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
295 manager->free_htask(p); |
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
296 #endif |
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
297 } |
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
298 |
634 | 299 |
619 | 300 void SchedTask::set_task_depend(HTaskPtr master, HTaskPtr slave) |
301 { | |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
302 manager->set_task_depend(master, slave); |
619 | 303 } |
304 | |
305 void SchedTask::spawn_task(HTaskPtr t) | |
306 { | |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
307 manager->spawn_task(t); |
619 | 308 } |
309 | |
310 void SchedTask::set_task_cpu(HTaskPtr t, CPU_TYPE cpu) | |
311 { | |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
312 manager->set_task_cpu(t, cpu); |
619 | 313 } |
314 | |
315 void* SchedTask::allocate(int size) | |
316 { | |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
317 return manager->allocate(size) ; |
619 | 318 } |
319 | |
320 void* SchedTask::allocate(int size,int align) | |
321 { | |
800
2708c4a7bade
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
322 return manager->allocate(size,align) ; |
619 | 323 } |
324 | |
832
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
325 void SchedTask::polling() |
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
326 { |
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
327 manager->polling(); |
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
328 } |
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
329 |
619 | 330 Scheduler* SchedTask::get_scheduler() |
331 { | |
332 return scheduler; | |
333 } | |
334 | |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
335 /* system call */ |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
336 |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
337 int |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
338 SchedTask::printf(const char * format, ...) |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
339 { |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
340 va_list ap; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
341 va_start(ap,format); |
742 | 342 int ret= scheduler->vprintf0(format, ap); |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
343 va_end(ap); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
344 return ret; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
345 } |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
346 |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
347 |
308 | 348 /* end */ |