Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/schedule/SchedTask.cc @ 708:d41c62201b1e draft
cleean up SchedTasks.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Dec 2009 10:49:30 +0900 |
parents | b2b4a1243961 |
children | 97adb3fe85c6 |
rev | line source |
---|---|
308 | 1 #include <stdlib.h> |
2 #include <string.h> | |
42 | 3 #include "SchedTask.h" |
695 | 4 #include "SysFunc.h" |
308 | 5 #include "SchedTaskList.h" |
695 | 6 #include "SchedTaskArrayLoad.h" |
308 | 7 #include "SchedNop2Ready.h" |
8 #include "DmaManager.h" | |
9 #include "error.h" | |
10 #include "TaskManager.h" | |
466
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
11 #include <stdarg.h> |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
12 |
688 | 13 #ifdef SIMPLE_TASK |
703 | 14 #include "SchedTaskArray.h" |
688 | 15 #define Task SimpleTask |
16 #define TaskPtr SimpleTaskPtr | |
17 #endif | |
18 | |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
19 extern TaskObject task_list[MAX_TASK_OBJECT]; |
308 | 20 |
21 | |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
22 #if 0 |
423
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
23 /** |
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
24 code load を始める。既に get_segment hash に入っていれば何もしない。 |
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
25 */ |
695 | 26 extern void |
423
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
27 loadSchedTask(Scheduler *scheduler,TaskPtr task) |
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
28 { |
439 | 29 // fprintf(stderr,"loadSchedTask %d\n",task->command); |
423
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
30 task_list[task->command].load(scheduler,task->command); |
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
31 } |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
32 #endif |
423
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
33 |
609758f9f350
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
34 |
308 | 35 SchedTask::SchedTask() |
36 { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
37 list = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
38 task = NULL; |
634 | 39 #ifndef SIMPLE_TASK |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
40 inListData = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
41 outListData = NULL; |
634 | 42 #endif |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
43 readbuf = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
44 writebuf = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
45 scheduler = NULL; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
46 cur_index = 0; |
466
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
47 this->stdout_ = stdout; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
48 this->stderr_ = stderr; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
49 this->stdin_ = stdin; |
373 | 50 |
567 | 51 |
308 | 52 } |
53 | |
54 /** | |
55 * dma_store の wait を行う | |
56 */ | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
57 SchedTask::~SchedTask() |
308 | 58 { |
59 } | |
60 | |
61 | |
62 void | |
708 | 63 SchedTask::init(TaskListPtr _list, TaskPtr _task, int index, Scheduler* sc) |
308 | 64 { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
65 list = _list; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
66 task = _task; |
634 | 67 #ifndef SIMPLE_TASK |
567 | 68 inListData = &_task->inData; |
69 outListData = &_task->outData; | |
634 | 70 #endif |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
71 scheduler = sc; |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
72 cur_index = index; |
567 | 73 |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
74 scheduler->mainMem_wait(); |
308 | 75 |
567 | 76 } |
77 | |
308 | 78 |
502
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
79 void |
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
80 SchedTask::read() |
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
81 { |
538 | 82 __debug("[SchedTask:%s]\n", __FUNCTION__); |
83 | |
84 // object creation をSchedTask生成時にやらないので、 | |
85 // exec の直前のread で十分に間に合う | |
704
ec6c897448ca
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
703
diff
changeset
|
86 loadSchedTask(scheduler, task->command); |
634 | 87 #ifdef SIMPLE_TASK |
88 // 読むデータが一つもなければ無視 | |
89 if (task->r_size == 0) return; | |
90 // load Input Data | |
91 readbuf = scheduler->allocate(task->r_size); | |
92 scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ); | |
93 #else | |
538 | 94 |
95 // 読むデータが一つもなければ無視 | |
567 | 96 if (inListData->length == 0) return; |
538 | 97 |
98 // load Input Data | |
567 | 99 readbuf = scheduler->allocate(inListData->size); |
100 scheduler->dma_loadList(inListData, readbuf, DMA_READ); | |
634 | 101 #endif |
538 | 102 |
567 | 103 |
502
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
104 } |
fdc3e30de9d3
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
105 |
308 | 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::exec() |
308 | 109 { |
110 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
111 | |
699 | 112 #ifdef SIMPLE_TASK |
113 if (task->w_size > 0) { | |
114 writebuf = scheduler->allocate(task->w_size); | |
115 } | |
116 #else | |
117 if (outListData->length > 0) { | |
118 writebuf = scheduler->allocate(outListData->size); | |
119 } | |
120 #endif | |
567 | 121 scheduler->dma_wait(DMA_READ); |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
122 task_list[task->command].wait(scheduler,task->command); |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
123 task_list[task->command].run(this, readbuf, writebuf); |
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
124 free(readbuf); |
308 | 125 |
547 | 126 // 書き込む領域がなければ無視 |
634 | 127 #ifdef SIMPLE_TASK |
635
c56f6847fb87
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
128 if (task->w_size > 0) { |
695 | 129 writebuf = scheduler->allocate(task->w_size); |
637 | 130 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
|
131 } |
c56f6847fb87
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
132 #else |
567 | 133 if (outListData->length > 0) { |
695 | 134 writebuf = scheduler->allocate(outListData->size); |
567 | 135 scheduler->dma_storeList(outListData, writebuf, DMA_WRITE); |
308 | 136 } |
634 | 137 #endif |
308 | 138 } |
139 | |
140 void | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
141 SchedTask::write() |
308 | 142 { |
143 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
373 | 144 |
567 | 145 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
|
146 free(writebuf); |
567 | 147 |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
148 scheduler->mail_write((memaddr)task->self); |
308 | 149 } |
150 | |
151 SchedTaskBase* | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
152 SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) |
308 | 153 { |
154 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
155 | |
567 | 156 if (cur_index < list->length) { |
619 | 157 // Task List が残っているので、次を準備 |
567 | 158 |
619 | 159 TaskPtr nextTask = &list->tasks[cur_index++]; |
708 | 160 SchedTask *nextSched = new SchedTask(); |
161 nextSched->init(list, nextTask, cur_index, scheduler); | |
703 | 162 #ifdef SIMPLE_TASK |
163 if (nextTask->command==TaskArray1) { | |
164 // compatibility | |
165 return new SchedTaskArray(scheduler, nextSched); | |
166 } | |
695 | 167 if (nextTask->command==TaskArray) { |
168 // Start Task Array | |
708 | 169 return new SchedTaskArrayLoad(scheduler, nextSched); |
695 | 170 } |
703 | 171 #endif |
619 | 172 return nextSched; |
308 | 173 } else { |
603
57ec231bc8ac
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
174 memaddr nextList = (memaddr)list->next; |
567 | 175 if (nextList == 0) { |
619 | 176 // もう何もする必要がない |
567 | 177 return new SchedNop2Ready(scheduler); |
178 } else { | |
619 | 179 // 新しいリストに取り掛かる |
708 | 180 return new SchedTaskList(nextList, scheduler); |
567 | 181 } |
308 | 182 } |
183 } | |
184 | |
185 | |
186 int | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
187 SchedTask::get_cpuid() |
308 | 188 { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
189 return scheduler->id; |
308 | 190 } |
191 | |
708 | 192 void SchedTask::free_(void *p) { |
193 scheduler->free_(p); | |
194 } | |
195 | |
643 | 196 #ifndef SIMPLE_TASK |
567 | 197 /** |
198 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 | |
199 * buffer から対応するデータを返す。 | |
200 */ | |
201 void* | |
202 SchedTask::get_input(void *buff, int index) | |
203 { | |
204 if (buff != NULL) { | |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
205 return (void*)((char*)buff + inListData->bound[index]); |
567 | 206 } else { |
207 return NULL; | |
208 } | |
209 } | |
210 | |
211 /** | |
212 * get_input(index) のアドレスを返す | |
213 */ | |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
214 memaddr |
567 | 215 SchedTask::get_inputAddr(int index) |
216 { | |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
217 #ifdef __CERIUM_CELL__ |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
218 return (memaddr)inListData->element[index].addr; |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
219 #else |
567 | 220 return inListData->element[index].addr; |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
221 #endif |
567 | 222 } |
223 | |
224 /** | |
225 * get_input(index) のサイズを返す | |
226 */ | |
227 int | |
228 SchedTask::get_inputSize(int index) | |
229 { | |
230 return inListData->element[index].size; | |
231 } | |
232 | |
233 /** | |
234 * write buffer の領域を返す。 | |
235 */ | |
236 void* | |
237 SchedTask::get_output(void *buff, int index) | |
238 { | |
239 if (buff != NULL) { | |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
240 return (void*)((char *)buff + outListData->bound[index]); |
567 | 241 } else { |
242 return NULL; | |
243 } | |
244 } | |
245 | |
246 /** | |
247 * get_output(index) のアドレスを返す | |
248 */ | |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
249 memaddr |
567 | 250 SchedTask::get_outputAddr(int index) |
251 { | |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
252 #ifdef __CERIUM_CELL__ |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
253 return (memaddr)outListData->element[index].addr; |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
254 #else |
567 | 255 return outListData->element[index].addr; |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
256 #endif |
567 | 257 } |
258 | |
259 /** | |
260 * get_output(index) のサイズを返す | |
261 */ | |
262 int | |
263 SchedTask::get_outputSize(int index) | |
264 { | |
265 return outListData->element[index].size; | |
266 } | |
308 | 267 |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
268 memaddr |
308 | 269 SchedTask::get_param(int index) |
270 { | |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
271 return task->param[index]; |
643 | 272 } |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
273 |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
274 #else |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
275 |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
276 void* SchedTask::get_input(void *buff, int index) { |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
277 printf("Cannot use inData in SimpleTask use TaskArray\n"); |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
278 return NULL; } |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
704
diff
changeset
|
279 memaddr SchedTask::get_inputAddr(int index) { return 0; } |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
280 int SchedTask::get_inputSize(int index) {return 0; } |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
281 void* SchedTask::get_output(void *buff, int index) {return 0; } |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
704
diff
changeset
|
282 memaddr SchedTask::get_outputAddr(int index) { return 0; } |
698
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
283 int SchedTask::get_outputSize(int index) { return 0; } |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
284 memaddr SchedTask::get_param(int index) { return 0; } |
72b2da99e875
no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
695
diff
changeset
|
285 |
634 | 286 #endif |
308 | 287 |
288 void* | |
289 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
|
290 return scheduler->global_alloc(id, size); |
308 | 291 } |
292 | |
293 void* | |
294 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
|
295 return scheduler->global_get(id); |
308 | 296 } |
297 | |
298 void | |
373 | 299 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
|
300 scheduler->global_set(id, addr); |
373 | 301 } |
302 | |
303 void | |
308 | 304 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
|
305 scheduler->global_free(id); |
308 | 306 } |
307 | |
373 | 308 MemList* |
309 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
|
310 return scheduler->createMemList(size, count); |
373 | 311 } |
312 | |
308 | 313 void |
314 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
|
315 scheduler->mainMem_alloc(id, size); |
308 | 316 } |
317 | |
318 void | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
319 SchedTask::mainMem_wait() { |
483
5f4ffff2c2aa
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
320 scheduler->mainMem_wait(); |
308 | 321 } |
322 | |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
323 memaddr |
308 | 324 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
|
325 return scheduler->mainMem_get(id); |
308 | 326 } |
327 | |
467
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
466
diff
changeset
|
328 |
308 | 329 void |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
330 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
|
331 scheduler->dma_load(buf, addr, size, mask); |
308 | 332 } |
333 | |
334 void | |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
335 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
|
336 scheduler->dma_store(buf, addr, size, mask); |
308 | 337 } |
338 | |
339 void | |
340 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
|
341 scheduler->dma_wait(mask); |
308 | 342 } |
343 | |
334
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
344 void |
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
345 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
|
346 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
|
347 } |
7bc5cbc5fe04
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
348 |
674
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
349 long |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
350 SchedTask::get_random() { |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
351 return scheduler->get_random(); |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
352 } |
07351a5a51c9
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
353 |
672 | 354 void |
355 SchedTask::start_profile() { | |
356 scheduler->start_profile(); | |
357 } | |
358 | |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
359 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
|
360 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
|
361 } |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
362 |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
363 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
|
364 scheduler->put_segment(s); |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
365 } |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
366 |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
367 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
|
368 scheduler->wait_segment(s); |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
369 } |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
370 |
619 | 371 |
634 | 372 HTaskPtr |
373 SchedTask::create_task(int cmd) | |
619 | 374 { |
375 return scheduler->create_task(cmd); | |
376 } | |
377 | |
634 | 378 HTaskPtr |
379 SchedTask::create_task(int cmd, memaddr r, long rs, memaddr w, long ws) | |
380 { | |
381 return scheduler->create_task(cmd,r,rs,w,ws); | |
382 } | |
383 | |
384 | |
619 | 385 void SchedTask::set_task_depend(HTaskPtr master, HTaskPtr slave) |
386 { | |
387 scheduler->set_task_depend(master, slave); | |
388 } | |
389 | |
390 void SchedTask::spawn_task(HTaskPtr t) | |
391 { | |
392 scheduler->spawn_task(t); | |
393 } | |
394 | |
395 void SchedTask::set_task_cpu(HTaskPtr t, CPU_TYPE cpu) | |
396 { | |
397 scheduler->set_task_cpu(t, cpu); | |
398 } | |
399 | |
400 void* SchedTask::allocate(int size) | |
401 { | |
402 return scheduler->allocate(size) ; | |
403 } | |
404 | |
405 void* SchedTask::allocate(int size,int align) | |
406 { | |
407 return scheduler->allocate(size,align) ; | |
408 } | |
409 | |
410 Scheduler* SchedTask::get_scheduler() | |
411 { | |
412 return scheduler; | |
413 } | |
414 | |
466
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
415 /* system call */ |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
416 |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
417 int |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
418 SchedTask::fprintf(FILE * stream, const char * format, ...) |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
419 { |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
420 va_list ap; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
421 va_start(ap,format); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
422 int ret = vfprintf(stream,format, ap); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
423 va_end(ap); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
424 return ret; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
425 } |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
426 |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
427 int |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
428 SchedTask::printf(const char * format, ...) |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
429 { |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
430 va_list ap; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
431 va_start(ap,format); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
432 int ret= vfprintf(stdout,format, ap); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
433 va_end(ap); |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
434 return ret; |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
435 } |
c73aff02db67
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
436 |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
437 |
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
438 |
308 | 439 /* end */ |