Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/schedule/SchedTask.cc @ 1175:d7486d6a5e37 draft
minor change
author | Yutaka_Kinjyo |
---|---|
date | Tue, 07 Jun 2011 17:55:20 +0900 |
parents | cce350bed940 |
children | a49c02dffe6f |
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
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
12 #include <stdarg.h> |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
13 |
703 | 14 #include "SchedTaskArray.h" |
688 | 15 #define Task SimpleTask |
16 #define TaskPtr SimpleTaskPtr | |
17 | |
698
72b2da99e875
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 | |
423
609758f9f350
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
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
24 list = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
25 task = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
26 readbuf = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
27 writebuf = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
28 scheduler = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
29 cur_index = 0; |
466
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
30 this->stdout_ = stdout; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
31 this->stderr_ = stderr; |
c73aff02db67
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
e2f29e912d0b
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
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
44 list = _list; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
45 task = _task; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
46 scheduler = sc; |
5f4ffff2c2aa
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
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
50 // scheduler->mainMem_wait(); // これはなんで? |
54f0180cea0f
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
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
53 #ifdef TASK_LIST_MAIL |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
54 if (list) |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
55 waiter = (memaddr) list->waiter; |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
56 #else |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
57 if (task) |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
58 waiter = (memaddr) task->self; |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
59 #endif |
b6c45005a3bc
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
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
64 void |
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
65 SchedTask::read() |
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
66 { |
538 | 67 __debug("[SchedTask:%s]\n", __FUNCTION__); |
68 | |
69 // object creation をSchedTask生成時にやらないので、 | |
70 // exec の直前のread で十分に間に合う | |
704
ec6c897448ca
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
703
diff
changeset
|
71 loadSchedTask(scheduler, task->command); |
713
97adb3fe85c6
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
54f0180cea0f
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); |
538 | 78 |
567 | 79 |
502
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
80 } |
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
81 |
1099
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
82 void |
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
83 SchedTask::setup_outputData() |
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
84 { |
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
85 writebuf = manager->allocate(task->w_size); |
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
86 } |
308 | 87 |
88 void | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
89 SchedTask::exec() |
308 | 90 { |
871
d30617ef4b20
fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
833
diff
changeset
|
91 task_list[task->command].wait(scheduler,task->command); |
895
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
888
diff
changeset
|
92 TaskObjectRun run = task_list[task->command].run; |
699 | 93 if (task->w_size > 0) { |
1099
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
94 setup_outputData(); |
699 | 95 } |
972 | 96 scheduler->dma_wait(DMA_READ + this->tag); |
895
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
888
diff
changeset
|
97 run(this, readbuf, writebuf); |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
98 free(readbuf); |
308 | 99 |
547 | 100 // 書き込む領域がなければ無視 |
713
97adb3fe85c6
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
708
diff
changeset
|
101 |
635
c56f6847fb87
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
102 if (task->w_size > 0) { |
637 | 103 scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_WRITE); |
635
c56f6847fb87
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
104 } |
308 | 105 } |
106 | |
107 void | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
108 SchedTask::write() |
308 | 109 { |
110 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
373 | 111 |
567 | 112 scheduler->dma_wait(DMA_WRITE); |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
113 free(writebuf); |
888
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
114 #ifdef TASK_LIST_MAIL |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
115 if (!(cur_index < list->length) ) |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
116 scheduler->mail_write(waiter); |
1007 | 117 |
1009 | 118 #else |
1007 | 119 |
1009 | 120 #ifdef MAIL_QUEUE |
1007 | 121 scheduler->mail_write_queue(waiter); |
888
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
122 #else |
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
123 scheduler->mail_write(waiter); |
830 | 124 #endif |
1009 | 125 #endif |
308 | 126 } |
127 | |
128 SchedTaskBase* | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
129 SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) |
308 | 130 { |
131 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
132 | |
567 | 133 if (cur_index < list->length) { |
619 | 134 // Task List が残っているので、次を準備 |
567 | 135 |
888
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
871
diff
changeset
|
136 TaskPtr nextTask = &list->tasks[cur_index]; |
1015 | 137 |
708 | 138 SchedTask *nextSched = new SchedTask(); |
972 | 139 nextSched->init(list, nextTask, cur_index+1, scheduler, this->tag^1); |
717
dfb3518d8694
TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
140 // この時点で、TaskList は down load が済んでないことがある |
dfb3518d8694
TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
141 // 最初のTaskの種類に関しては、別な情報で渡す方が良い |
dfb3518d8694
TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
142 // あるいはTaskListの最初には、TaskArray1/TaskArray を置かない? |
713
97adb3fe85c6
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
708
diff
changeset
|
143 |
703 | 144 if (nextTask->command==TaskArray1) { |
145 // compatibility | |
146 return new SchedTaskArray(scheduler, nextSched); | |
147 } | |
695 | 148 if (nextTask->command==TaskArray) { |
149 // Start Task Array | |
970
1a4849b2acad
change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
945
diff
changeset
|
150 int dma_tag_switch = 0; |
1a4849b2acad
change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
945
diff
changeset
|
151 return new SchedTaskArrayLoad(scheduler, nextSched, dma_tag_switch); |
695 | 152 } |
619 | 153 return nextSched; |
308 | 154 } else { |
603
57ec231bc8ac
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
155 memaddr nextList = (memaddr)list->next; |
567 | 156 if (nextList == 0) { |
619 | 157 // もう何もする必要がない |
1015 | 158 |
567 | 159 return new SchedNop2Ready(scheduler); |
160 } else { | |
619 | 161 // 新しいリストに取り掛かる |
972 | 162 int dma_tag_switch = 0; |
163 return new SchedTaskList(nextList, scheduler, dma_tag_switch); | |
567 | 164 } |
308 | 165 } |
166 } | |
167 | |
168 | |
169 int | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
170 SchedTask::get_cpuid() |
308 | 171 { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
172 return scheduler->id; |
308 | 173 } |
174 | |
708 | 175 void SchedTask::free_(void *p) { |
176 scheduler->free_(p); | |
177 } | |
178 | |
945
9ed1c4a877ca
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 /** |
9ed1c4a877ca
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 * SimpleTask has one parameter , one input, one output |
9ed1c4a877ca
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 */ |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
182 |
945
9ed1c4a877ca
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 void* SchedTask::get_input(void *buff, int index) { return readbuf; } |
9ed1c4a877ca
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_inputAddr(int index) { return task->rbuf; } |
9ed1c4a877ca
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
|
185 int SchedTask::get_inputSize(int index) {return task->r_size; } |
9ed1c4a877ca
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
|
186 void* SchedTask::get_output(void *buff, int index) {return writebuf; } |
9ed1c4a877ca
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
|
187 memaddr SchedTask::get_outputAddr(int index) { return task->wbuf; } |
9ed1c4a877ca
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
|
188 int SchedTask::get_outputSize(int index) { return task->w_size; } |
1099
3b3b535baa51
add resize wbuff example.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1015
diff
changeset
|
189 void SchedTask::set_outputSize(int index, int size){task->w_size = size;} |
945
9ed1c4a877ca
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
|
190 memaddr SchedTask::get_param(int index) { return task->param; } |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
191 |
308 | 192 |
193 void* | |
194 SchedTask::global_alloc(int id, int size) { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
195 return scheduler->global_alloc(id, size); |
308 | 196 } |
197 | |
198 void* | |
199 SchedTask::global_get(int id) { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
200 return scheduler->global_get(id); |
308 | 201 } |
202 | |
203 void | |
373 | 204 SchedTask::global_set(int id, void *addr) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
205 scheduler->global_set(id, addr); |
373 | 206 } |
207 | |
208 void | |
308 | 209 SchedTask::global_free(int id) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
210 scheduler->global_free(id); |
308 | 211 } |
212 | |
373 | 213 MemList* |
214 SchedTask::createMemList(int size, int count) { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
215 return scheduler->createMemList(size, count); |
373 | 216 } |
217 | |
308 | 218 void |
219 SchedTask::mainMem_alloc(int id, int size) { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
220 scheduler->mainMem_alloc(id, size); |
308 | 221 } |
222 | |
223 void | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
224 SchedTask::mainMem_wait() { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
225 scheduler->mainMem_wait(); |
308 | 226 } |
227 | |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
228 memaddr |
308 | 229 SchedTask::mainMem_get(int id) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
230 return scheduler->mainMem_get(id); |
308 | 231 } |
232 | |
467
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
466
diff
changeset
|
233 |
308 | 234 void |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
235 SchedTask::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
236 scheduler->dma_load(buf, addr, size, mask); |
308 | 237 } |
238 | |
239 void | |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
240 SchedTask::dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
241 scheduler->dma_store(buf, addr, size, mask); |
308 | 242 } |
243 | |
244 void | |
245 SchedTask::dma_wait(uint32 mask) { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
246 scheduler->dma_wait(mask); |
308 | 247 } |
248 | |
334
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
249 void |
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
250 SchedTask::show_dma_wait() { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
251 scheduler->show_dma_wait(); |
334
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
252 } |
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
253 |
1124 | 254 |
674
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
255 long |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
256 SchedTask::get_random() { |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
257 return scheduler->get_random(); |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
258 } |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
259 |
672 | 260 void |
261 SchedTask::start_profile() { | |
262 scheduler->start_profile(); | |
263 } | |
264 | |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
265 MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
266 return scheduler->get_segment(addr,m); |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
267 } |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
268 |
1173 | 269 MemorySegment * SchedTask::get_free_segment(memaddr addr, MemList *m) { |
270 return scheduler->get_free_segment(addr,m); | |
271 } | |
272 | |
1175 | 273 void SchedTask::overwrite_segment(MemorySegment *s, memaddr addr) { |
274 return scheduler->overwrite_segment(s,addr); | |
275 } | |
276 | |
1173 | 277 |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
278 void SchedTask::put_segment(MemorySegment *s) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
279 scheduler->put_segment(s); |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
280 } |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
281 |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
282 void SchedTask::wait_segment(MemorySegment *s) { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
283 scheduler->wait_segment(s); |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
284 } |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
285 |
917
fa21f48ba580
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
286 uint32 SchedTask::get_tag() { |
fa21f48ba580
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
287 return scheduler->get_tag(); |
fa21f48ba580
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
288 } |
fa21f48ba580
add get_tag ( no one use it though )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
897
diff
changeset
|
289 |
619 | 290 |
634 | 291 HTaskPtr |
292 SchedTask::create_task(int cmd) | |
619 | 293 { |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
294 return manager->create_task(cmd, __builtin_return_address(0)); |
619 | 295 } |
296 | |
634 | 297 HTaskPtr |
298 SchedTask::create_task(int cmd, memaddr r, long rs, memaddr w, long ws) | |
299 { | |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
300 return manager->create_task(cmd,r,rs,w,ws, __builtin_return_address(0)); |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
301 } |
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
302 |
801 | 303 HTaskPtr |
304 SchedTask::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData) | |
305 { | |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
306 return manager->create_task_array(id, num_task, num_param, num_inData, num_outData, __builtin_return_address(0)); |
801 | 307 } |
308 | |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
309 void SchedTask::free_htask(HTask *p) { |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
310 #if !defined(__SPU__) |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
311 manager->free_htask(p); |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
312 #endif |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
313 } |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
917
diff
changeset
|
314 |
634 | 315 |
619 | 316 void SchedTask::set_task_depend(HTaskPtr master, HTaskPtr slave) |
317 { | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
318 manager->set_task_depend(master, slave); |
619 | 319 } |
320 | |
321 void SchedTask::spawn_task(HTaskPtr t) | |
322 { | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
323 manager->spawn_task(t); |
619 | 324 } |
325 | |
326 void SchedTask::set_task_cpu(HTaskPtr t, CPU_TYPE cpu) | |
327 { | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
328 manager->set_task_cpu(t, cpu); |
619 | 329 } |
330 | |
331 void* SchedTask::allocate(int size) | |
332 { | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
333 return manager->allocate(size) ; |
619 | 334 } |
335 | |
336 void* SchedTask::allocate(int size,int align) | |
337 { | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
777
diff
changeset
|
338 return manager->allocate(size,align) ; |
619 | 339 } |
340 | |
833
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
341 void SchedTask::polling() |
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
342 { |
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
343 manager->polling(); |
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
344 } |
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
345 |
619 | 346 Scheduler* SchedTask::get_scheduler() |
347 { | |
348 return scheduler; | |
349 } | |
350 | |
466
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
351 /* system call */ |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
352 |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
353 int |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
354 SchedTask::printf(const char * format, ...) |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
355 { |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
356 va_list ap; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
357 va_start(ap,format); |
743 | 358 int ret= scheduler->vprintf0(format, ap); |
466
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
359 va_end(ap); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
360 return ret; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
361 } |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
362 |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
363 |
308 | 364 /* end */ |