Mercurial > hg > Members > kono > Cerium
annotate TaskManager/kernel/schedule/SchedTask.cc @ 695:cbcf0182635e
TaskArray on going...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 12 Dec 2009 17:38:30 +0900 |
parents | 9a6cb2439593 |
children | dcaa40ec963d |
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
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
11 #include <stdarg.h> |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
12 |
683 | 13 #ifdef SIMPLE_TASK |
14 #define Task SimpleTask | |
15 #define TaskPtr SimpleTaskPtr | |
16 #endif | |
17 | |
308 | 18 extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT]; |
19 | |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
20 /** |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
21 Task Object を作る |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
22 */ |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
23 |
439 | 24 |
308 | 25 SchedTask * |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
26 createSchedTask(Scheduler *scheduler, TaskPtr task) |
302 | 27 { |
464
01b321c86747
task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
463
diff
changeset
|
28 return new SchedTask(); |
308 | 29 } |
30 | |
373 | 31 |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
32 /** |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
33 code load を始める。既に get_segment hash に入っていれば何もしない。 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
34 最初の一回は SchedTaskList:: next から呼ばれる。 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
35 この段階では、SchedTask object は、まだ作られてない。 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
36 */ |
695 | 37 extern void |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
38 loadSchedTask(Scheduler *scheduler,TaskPtr task) |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
39 { |
439 | 40 // fprintf(stderr,"loadSchedTask %d\n",task->command); |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
41 task_list[task->command].load(scheduler,task->command); |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
42 } |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
43 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
44 |
308 | 45 SchedTask::SchedTask() |
46 { | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
47 list = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
48 task = NULL; |
634 | 49 #ifndef SIMPLE_TASK |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
50 inListData = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
51 outListData = NULL; |
634 | 52 #endif |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
53 readbuf = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
54 writebuf = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
55 scheduler = NULL; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
56 cur_index = 0; |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
57 this->stdout_ = stdout; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
58 this->stderr_ = stderr; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
59 this->stdin_ = stdin; |
373 | 60 |
567 | 61 |
308 | 62 } |
63 | |
64 /** | |
65 * dma_store の wait を行う | |
66 */ | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
67 SchedTask::~SchedTask() |
308 | 68 { |
69 } | |
70 | |
71 | |
72 void | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
73 SchedTask::init(TaskListPtr _list, TaskPtr _task, int index, |
567 | 74 // ListDataPtr rbuf, ListDataPtr wbuf, |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
499
diff
changeset
|
75 Scheduler* sc) |
308 | 76 { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
77 list = _list; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
78 task = _task; |
634 | 79 #ifndef SIMPLE_TASK |
567 | 80 inListData = &_task->inData; |
81 outListData = &_task->outData; | |
634 | 82 #endif |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
83 scheduler = sc; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
84 cur_index = index; |
567 | 85 |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
86 scheduler->mainMem_wait(); |
308 | 87 |
567 | 88 } |
89 | |
308 | 90 |
502
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
91 void |
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
92 SchedTask::read() |
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
93 { |
506 | 94 __debug("[SchedTask:%s]\n", __FUNCTION__); |
95 | |
96 // object creation をSchedTask生成時にやらないので、 | |
97 // exec の直前のread で十分に間に合う | |
567 | 98 if (cur_index < list->length) { |
99 // load next task | |
100 loadSchedTask(scheduler, &list->tasks[cur_index]); | |
101 } | |
634 | 102 #ifdef SIMPLE_TASK |
103 // 読むデータが一つもなければ無視 | |
104 if (task->r_size == 0) return; | |
105 // load Input Data | |
106 readbuf = scheduler->allocate(task->r_size); | |
107 scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ); | |
108 #else | |
506 | 109 |
110 // 読むデータが一つもなければ無視 | |
567 | 111 if (inListData->length == 0) return; |
506 | 112 |
113 // load Input Data | |
567 | 114 readbuf = scheduler->allocate(inListData->size); |
115 scheduler->dma_loadList(inListData, readbuf, DMA_READ); | |
634 | 116 #endif |
506 | 117 |
567 | 118 |
502
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
119 } |
36b323130b1b
Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
501
diff
changeset
|
120 |
308 | 121 |
122 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
123 SchedTask::exec() |
308 | 124 { |
125 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
126 | |
567 | 127 scheduler->dma_wait(DMA_READ); |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
128 task_list[task->command].wait(scheduler,task->command); |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
129 task_list[task->command].run(this, readbuf, writebuf); |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
130 free(readbuf); |
308 | 131 |
519 | 132 // 書き込む領域がなければ無視 |
634 | 133 #ifdef SIMPLE_TASK |
635
8cc609285bbe
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
134 if (task->w_size > 0) { |
695 | 135 writebuf = scheduler->allocate(task->w_size); |
637 | 136 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
|
137 } |
8cc609285bbe
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
138 #else |
567 | 139 if (outListData->length > 0) { |
695 | 140 writebuf = scheduler->allocate(outListData->size); |
567 | 141 scheduler->dma_storeList(outListData, writebuf, DMA_WRITE); |
308 | 142 } |
634 | 143 #endif |
308 | 144 } |
145 | |
146 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
147 SchedTask::write() |
308 | 148 { |
149 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
373 | 150 |
567 | 151 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
|
152 free(writebuf); |
567 | 153 |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
154 scheduler->mail_write((memaddr)task->self); |
308 | 155 } |
156 | |
157 | |
158 SchedTaskBase* | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
159 SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) |
308 | 160 { |
161 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
162 | |
567 | 163 if (cur_index < list->length) { |
619 | 164 // Task List が残っているので、次を準備 |
567 | 165 |
619 | 166 TaskPtr nextTask = &list->tasks[cur_index++]; |
167 SchedTaskBase *nextSched = createSchedTask(scheduler, nextTask); | |
168 // この up cast は汚い... | |
169 ((SchedTask*)nextSched)->init(list, nextTask, cur_index, | |
170 scheduler); | |
695 | 171 if (nextTask->command==TaskArray) { |
172 // Start Task Array | |
173 return (SchedTaskBase*)(new SchedTaskArrayLoad(nextSched)); | |
174 } | |
175 | |
619 | 176 return nextSched; |
308 | 177 } else { |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
178 memaddr nextList = (memaddr)list->next; |
567 | 179 if (nextList == 0) { |
619 | 180 // もう何もする必要がない |
567 | 181 return new SchedNop2Ready(scheduler); |
182 } else { | |
619 | 183 // 新しいリストに取り掛かる |
634 | 184 return createSchedTaskList(nextList, scheduler, 0); |
567 | 185 } |
308 | 186 } |
187 } | |
188 | |
189 | |
190 int | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
191 SchedTask::get_cpuid() |
308 | 192 { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
193 return scheduler->id; |
308 | 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) { | |
629
8843edf37c0e
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
60aa3f241b10
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 { | |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
217 #ifdef __CERIUM_CELL__ |
8843edf37c0e
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; |
8843edf37c0e
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; |
629
8843edf37c0e
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) { | |
629
8843edf37c0e
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
60aa3f241b10
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 { | |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
252 #ifdef __CERIUM_CELL__ |
8843edf37c0e
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; |
8843edf37c0e
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; |
629
8843edf37c0e
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
60aa3f241b10
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
0b933bef0328
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 } |
634 | 273 #endif |
308 | 274 |
275 void* | |
276 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
|
277 return scheduler->global_alloc(id, size); |
308 | 278 } |
279 | |
280 void* | |
281 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
|
282 return scheduler->global_get(id); |
308 | 283 } |
284 | |
285 void | |
373 | 286 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
|
287 scheduler->global_set(id, addr); |
373 | 288 } |
289 | |
290 void | |
308 | 291 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
|
292 scheduler->global_free(id); |
308 | 293 } |
294 | |
373 | 295 MemList* |
296 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
|
297 return scheduler->createMemList(size, count); |
373 | 298 } |
299 | |
308 | 300 void |
301 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
|
302 scheduler->mainMem_alloc(id, size); |
308 | 303 } |
304 | |
305 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
306 SchedTask::mainMem_wait() { |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
468
diff
changeset
|
307 scheduler->mainMem_wait(); |
308 | 308 } |
309 | |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
310 memaddr |
308 | 311 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
|
312 return scheduler->mainMem_get(id); |
308 | 313 } |
314 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
466
diff
changeset
|
315 |
308 | 316 void |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
317 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
|
318 scheduler->dma_load(buf, addr, size, mask); |
308 | 319 } |
320 | |
321 void | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
322 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
|
323 scheduler->dma_store(buf, addr, size, mask); |
308 | 324 } |
325 | |
326 void | |
327 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
|
328 scheduler->dma_wait(mask); |
308 | 329 } |
330 | |
334
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
331 void |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
332 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
|
333 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
|
334 } |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
335 |
674
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
336 long |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
337 SchedTask::get_random() { |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
338 return scheduler->get_random(); |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
339 } |
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
340 |
672 | 341 void |
342 SchedTask::start_profile() { | |
343 scheduler->start_profile(); | |
344 } | |
345 | |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
346 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
|
347 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
|
348 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
349 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
350 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
|
351 scheduler->put_segment(s); |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
352 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
353 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
354 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
|
355 scheduler->wait_segment(s); |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
356 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
357 |
619 | 358 |
634 | 359 HTaskPtr |
360 SchedTask::create_task(int cmd) | |
619 | 361 { |
362 return scheduler->create_task(cmd); | |
363 } | |
364 | |
634 | 365 HTaskPtr |
366 SchedTask::create_task(int cmd, memaddr r, long rs, memaddr w, long ws) | |
367 { | |
368 return scheduler->create_task(cmd,r,rs,w,ws); | |
369 } | |
370 | |
371 | |
619 | 372 void SchedTask::set_task_depend(HTaskPtr master, HTaskPtr slave) |
373 { | |
374 scheduler->set_task_depend(master, slave); | |
375 } | |
376 | |
377 void SchedTask::spawn_task(HTaskPtr t) | |
378 { | |
379 scheduler->spawn_task(t); | |
380 } | |
381 | |
382 void SchedTask::set_task_cpu(HTaskPtr t, CPU_TYPE cpu) | |
383 { | |
384 scheduler->set_task_cpu(t, cpu); | |
385 } | |
386 | |
387 void* SchedTask::allocate(int size) | |
388 { | |
389 return scheduler->allocate(size) ; | |
390 } | |
391 | |
392 void* SchedTask::allocate(int size,int align) | |
393 { | |
394 return scheduler->allocate(size,align) ; | |
395 } | |
396 | |
397 Scheduler* SchedTask::get_scheduler() | |
398 { | |
399 return scheduler; | |
400 } | |
401 | |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
402 /* system call */ |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
403 |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
404 int |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
405 SchedTask::fprintf(FILE * stream, const char * format, ...) |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
406 { |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
407 va_list ap; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
408 va_start(ap,format); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
409 int ret = vfprintf(stream,format, ap); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
410 va_end(ap); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
411 return ret; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
412 } |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
413 |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
414 int |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
415 SchedTask::printf(const char * format, ...) |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
416 { |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
417 va_list ap; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
418 va_start(ap,format); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
419 int ret= vfprintf(stdout,format, ap); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
420 va_end(ap); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
421 return ret; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
422 } |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
423 |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
424 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
425 |
308 | 426 /* end */ |