Mercurial > hg > Members > kono > Cerium
annotate TaskManager/kernel/schedule/SchedTask.cc @ 421:cd77224d4224
Code load implementation... (not yet tested)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 24 Sep 2009 16:04:23 +0900 |
parents | 8611780d479f |
children | 95c0457a7d31 |
rev | line source |
---|---|
308 | 1 #include <stdlib.h> |
2 #include <string.h> | |
42 | 3 #include "SchedTask.h" |
308 | 4 #include "SchedTaskList.h" |
5 #include "SchedNop2Ready.h" | |
6 #include "DmaManager.h" | |
7 #include "error.h" | |
8 #include "TaskManager.h" | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
9 |
308 | 10 extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT]; |
11 | |
373 | 12 //#define NO_PIPELINE |
308 | 13 |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
14 /** |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
15 Task Object を作る |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
16 code loading ならば、loading の終了を待つ |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
17 */ |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
18 |
308 | 19 SchedTask * |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
20 createSchedTask(Scheduler *scheduler, TaskPtr task) |
302 | 21 { |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
22 task_list[task->command].wait(scheduler,task->command); |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
23 return task_list[task->command].creator(scheduler); |
308 | 24 } |
25 | |
373 | 26 |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
27 /** |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
28 code load を始める。既に get_segment hash に入っていれば何もしない。 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
29 最初の一回は SchedTaskList:: next から呼ばれる。 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
30 この段階では、SchedTask object は、まだ作られてない。 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
31 */ |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
32 void |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
33 loadSchedTask(Scheduler *scheduler,TaskPtr task) |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
34 { |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
35 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
|
36 } |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
37 |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
38 |
308 | 39 SchedTask::SchedTask() |
40 { | |
41 __list = NULL; | |
42 __task = NULL; | |
43 __inListData = NULL; | |
44 __outListData = NULL; | |
45 __readbuf = NULL; | |
46 __writebuf = NULL; | |
47 __scheduler = NULL; | |
48 __taskGroup = NULL; | |
49 __renew_flag = 0; | |
50 __cur_index = 0; | |
51 __flag_renewTask = SCHED_TASK_NORMAL; | |
373 | 52 |
308 | 53 ex_init = &SchedTask::ex_init_normal; |
54 ex_read = &SchedTask::ex_read_normal; | |
55 ex_exec = &SchedTask::ex_exec_normal; | |
56 ex_write = &SchedTask::ex_write_normal; | |
57 ex_next = &SchedTask::ex_next_normal; | |
58 | |
59 run_func = &SchedTask::run; | |
373 | 60 run_func1 = &SchedTask::run; |
308 | 61 } |
62 | |
63 /** | |
64 * dma_store の wait を行う | |
65 * このタスクが RenewTask だった場合、 | |
66 * __inListData や __outListData は | |
67 * Scheduler の持つ、使い回しの buffer ではなく | |
68 * 新たに allocate されたものなので、ここで free する | |
69 */ | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
70 SchedTask::~SchedTask() |
308 | 71 { |
72 if (__flag_renewTask == SCHED_TASK_RENEW) { | |
373 | 73 free(__inListData); |
308 | 74 free(__outListData); |
373 | 75 |
76 /** | |
77 * __list != NULL の場合、 | |
78 * この Task が __list の最後の Task になるので (SchedTask::next 参照) | |
79 * このタイミングで __list を解放する | |
80 * (free に渡されるアドレスが正しいものとなる)。 | |
81 * それ以外の Task では当然解放しない。 | |
82 * __list == NULL なので、free に渡しても無問題 | |
83 */ | |
84 free(__list); | |
308 | 85 } |
86 | |
321 | 87 |
308 | 88 } |
89 | |
373 | 90 /** |
308 | 91 * このタスクを Renew Task とし、それに応じた関数をセットする |
92 */ | |
93 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
94 SchedTask::__setRenew() |
308 | 95 { |
96 __flag_renewTask = SCHED_TASK_RENEW; | |
97 | |
98 ex_init = &SchedTask::ex_init_renew; | |
99 ex_read = &SchedTask::ex_read_renew; | |
100 ex_exec = &SchedTask::ex_exec_renew; | |
373 | 101 ex_write = &SchedTask::ex_write_renew; |
308 | 102 ex_next = &SchedTask::ex_next_renew; |
103 } | |
104 | |
105 void | |
106 SchedTask::__init__(TaskListPtr _list, TaskPtr _task, int index, | |
373 | 107 ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc) |
308 | 108 { |
109 __list = _list; | |
110 __task = _task; | |
111 __inListData = rbuf; | |
112 __outListData = wbuf; | |
113 __scheduler = sc; | |
114 __cur_index = index; | |
115 | |
116 __scheduler->mainMem_wait(); | |
117 | |
118 (this->*ex_init)(); | |
119 } | |
120 | |
121 /** | |
122 * PPE 内で生成されたタスクの ex_init() | |
123 */ | |
124 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
125 SchedTask::ex_init_normal() |
308 | 126 { |
127 __scheduler->dma_load(__inListData, (uint32)__task->inData, | |
373 | 128 sizeof(ListData), DMA_READ_IN_LIST); |
308 | 129 __scheduler->dma_load(__outListData, (uint32)__task->outData, |
373 | 130 sizeof(ListData), DMA_READ_OUT_LIST); |
308 | 131 #if defined(NO_PIPELINE) |
132 __scheduler->dma_wait(DMA_READ_IN_LIST); | |
133 __scheduler->dma_wait(DMA_READ_OUT_LIST); | |
134 #endif | |
373 | 135 |
308 | 136 __taskGroup = new TaskGroup; |
137 __taskGroup->command = __task->self; | |
138 } | |
139 | |
140 /** | |
141 * SPE 内で生成されたタスクの ex_init() | |
142 * 各データは SPE 内の create_task 時に生成もしくは引き継がれているので | |
143 * ex_init_normal() と違い、ここでは値を渡すだけ | |
144 */ | |
145 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
146 SchedTask::ex_init_renew() |
308 | 147 { |
148 __inListData = __task->inData; | |
149 __outListData = __task->outData; | |
373 | 150 __taskGroup = (TaskGroupPtr)__task->self; |
308 | 151 } |
152 | |
153 /** | |
154 * [Todo] | |
155 * データの読み込み場所を readbuf ではなく、 | |
156 * ユーザ自身で決めれるようになるといいかもしれない。 | |
157 * | |
158 * # TaskManager が勝手に消すことなく、 | |
159 * # ユーザが SPE 上に持ち続けることができるため。 | |
160 * # もちろん管理はユーザに任せるわけだ。 | |
161 */ | |
162 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
163 SchedTask::read() |
373 | 164 { |
308 | 165 __debug("[SchedTask:%s]\n", __FUNCTION__); |
166 | |
167 #if !defined(NO_PIPELINE) | |
168 __scheduler->dma_wait(DMA_READ_IN_LIST); | |
169 __scheduler->dma_wait(DMA_READ_OUT_LIST); | |
170 #endif | |
171 | |
172 __writebuf = __scheduler->allocate(__outListData->size); | |
373 | 173 |
308 | 174 // 読むデータが一つもなければ無視 |
175 if (__inListData->length == 0) return; | |
176 | |
177 // load Input Data | |
178 __readbuf = __scheduler->allocate(__inListData->size); | |
179 __scheduler->dma_loadList(__inListData, __readbuf, DMA_READ); | |
180 | |
181 #if defined(NO_PIPELINE) | |
182 __scheduler->dma_wait(DMA_READ); | |
183 #endif | |
184 | |
185 (this->*ex_read)(); | |
186 } | |
187 | |
188 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
189 SchedTask::exec() |
308 | 190 { |
191 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
192 | |
193 #if !defined(NO_PIPELINE) | |
194 __scheduler->dma_wait(DMA_READ); | |
195 #endif | |
196 | |
197 //run(__readbuf, __writebuf); | |
198 (this->*run_func)(__readbuf, __writebuf); | |
316 | 199 (this->*run_func1)(this, __readbuf, __writebuf); |
308 | 200 |
201 free(__readbuf); | |
202 | |
203 if (__taskGroup->status() != 0) { | |
373 | 204 __task->self = __taskGroup->command; |
205 delete __taskGroup; | |
206 __taskGroup = NULL; | |
308 | 207 } |
208 | |
209 | |
210 // 書き込む領域がなければ無視 | |
211 if (__outListData->length > 0) { | |
373 | 212 __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); |
308 | 213 |
214 #if defined(NO_PIPELINE) | |
373 | 215 __scheduler->dma_wait(DMA_WRITE); |
216 free(__writebuf); | |
308 | 217 #endif |
218 } | |
219 | |
220 (this->*ex_exec)(); | |
221 } | |
222 | |
223 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
224 SchedTask::write() |
308 | 225 { |
226 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
373 | 227 |
308 | 228 #if !defined(NO_PIPELINE) |
229 __scheduler->dma_wait(DMA_WRITE); | |
230 free(__writebuf); | |
231 #endif | |
232 | |
233 if (__task->self == MY_SPE_NOP) return; | |
234 | |
235 (this->*ex_write)(); | |
236 } | |
237 | |
238 /** | |
239 * PPE 内で生成されたタスクの ex_read() | |
240 */ | |
241 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
242 SchedTask::ex_read_normal() |
308 | 243 { |
244 } | |
245 | |
246 /** | |
247 * SPE 内で生成されたタスクの ex_read() | |
248 */ | |
249 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
250 SchedTask::ex_read_renew() |
308 | 251 { |
252 } | |
253 | |
254 /** | |
255 * PPE 内で生成されたタスクの ex_exec() | |
256 */ | |
257 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
258 SchedTask::ex_exec_normal() |
308 | 259 { |
260 } | |
261 | |
262 /** | |
263 * SPE 内で生成されたタスクの ex_exec() | |
264 */ | |
265 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
266 SchedTask::ex_exec_renew() |
308 | 267 { |
268 } | |
269 | |
270 | |
271 | |
272 /** | |
273 * PPE 内で生成されたタスクの ex_write() | |
373 | 274 * |
308 | 275 * このタスク内で新たにタスクが生成され、 |
276 * 且つそのタスクの終了を待つ必要がある場合、 | |
277 * PPE に終了したことは知らせない(command は送信しない) | |
278 */ | |
279 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
280 SchedTask::ex_write_normal() |
308 | 281 { |
282 /** | |
283 * このタスク内で新たにタスクが生成されなかった | |
284 * or 生成されたが、そのタスクの終了を待つ必要は無い | |
285 */ | |
286 if (__renew_flag == 0) { | |
373 | 287 __scheduler->mail_write(__task->self); |
308 | 288 } |
302 | 289 } |
290 | |
308 | 291 /** |
292 * SPE 内で生成されたタスクの ex_write() | |
293 * | |
294 * A <- 親タスク | |
295 * | \ | |
296 * B C <- SPE 内で生成されたタスク | |
297 * | |
298 * A は SPE 内で B, C を生成したとする。 | |
299 * B と C が終了したら、A が PPE に送るはずだったコマンドが | |
300 * 子タスクに引き継がれているので、最後に実行された子タスクが | |
301 * PPE に mail 送信する。 | |
302 */ | |
303 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
304 SchedTask::ex_write_renew() |
308 | 305 { |
306 uint32 cmd; | |
373 | 307 |
308 | 308 __taskGroup->remove(__task); |
373 | 309 cmd = __taskGroup->status(); |
308 | 310 |
311 // タスク内で作られた全てのタスクが終了した | |
312 if (cmd != 0) { | |
373 | 313 delete __taskGroup; |
314 __scheduler->mail_write(cmd); | |
308 | 315 } |
316 } | |
373 | 317 |
308 | 318 SchedTaskBase* |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
319 SchedTask::next(Scheduler *scheduler, SchedTaskBase *p) |
308 | 320 { |
321 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
322 | |
323 delete p; | |
324 | |
325 return (this->*ex_next)(); | |
326 } | |
327 | |
328 SchedTaskBase* | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
329 SchedTask::ex_next_normal() |
308 | 330 { |
331 if (__cur_index < __list->length) { | |
373 | 332 SchedTaskBase *nextSched; |
333 | |
334 nextSched = __scheduler->get_nextRenewTaskList(); | |
308 | 335 |
373 | 336 // RenewTask がある |
337 if (nextSched) { | |
338 __scheduler->set_backupTaskList(__list); | |
339 __scheduler->set_backupTaskListIndex(__cur_index); | |
340 return nextSched; | |
341 } else { | |
342 TaskPtr nextTask = &__list->tasks[__cur_index++]; | |
421
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
343 if (__cur_index < __list->length) { |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
344 // load next task |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
345 loadSchedTask(__scheduler, &__list->tasks[__cur_index]); |
cd77224d4224
Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
403
diff
changeset
|
346 } |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
347 nextSched = createSchedTask(__scheduler, nextTask); |
373 | 348 ((SchedTask*)nextSched)->__init__(__list, nextTask, __cur_index, |
349 __scheduler->get_curReadBuf(), | |
350 __scheduler->get_curWriteBuf(), | |
351 __scheduler); | |
352 return nextSched; | |
353 } | |
308 | 354 } else { |
373 | 355 uint32 nextList = (uint32)__list->next; |
356 | |
357 if (nextList == 0) { | |
358 return new SchedNop2Ready(__scheduler); | |
359 } else { | |
360 return createSchedTaskList(nextList, __scheduler, | |
361 SCHED_TASKLIST_NORMAL); | |
362 } | |
308 | 363 } |
364 } | |
365 | |
366 /** | |
367 * | |
368 */ | |
369 SchedTaskBase* | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
370 SchedTask::ex_next_renew() |
308 | 371 { |
372 TaskPtr nextTask; | |
373 SchedTask *nextSched; | |
374 | |
375 if (__cur_index < __list->length) { | |
373 | 376 nextTask = &__list->tasks[__cur_index++]; |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
377 nextSched = createSchedTask(__scheduler, nextTask); |
308 | 378 |
373 | 379 // RenewTaskList を実行中なので |
380 nextSched->__setRenew(); | |
381 nextSched->__init__(__list, nextTask, __cur_index, | |
382 __scheduler->get_curReadBuf(), | |
383 __scheduler->get_curWriteBuf(), | |
384 __scheduler); | |
308 | 385 |
373 | 386 /** |
387 * この理由は SchedTask:~SchedTask() で | |
388 */ | |
389 __list = NULL; | |
390 return nextSched; | |
308 | 391 } else { |
373 | 392 SchedTaskBase *nextList; |
393 | |
394 nextList = __scheduler->get_nextRenewTaskList(); | |
395 | |
396 if (nextList) { | |
397 return nextList; | |
398 } else { | |
399 TaskListPtr nextList = __scheduler->get_backupTaskList(); | |
400 | |
401 // 中断した TaskList がある | |
402 if (nextList) { | |
403 __cur_index = __scheduler->get_backupTaskListIndex(); | |
308 | 404 |
373 | 405 nextTask = &nextList->tasks[__cur_index++]; |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
406 nextSched = createSchedTask(__scheduler, nextTask); |
373 | 407 |
408 nextSched->__init__(nextList, nextTask, __cur_index, | |
409 __scheduler->get_curReadBuf(), | |
410 __scheduler->get_curWriteBuf(), | |
411 __scheduler); | |
412 return nextSched; | |
413 } else { | |
414 return new SchedNop2Ready(__scheduler); | |
415 } | |
416 } | |
308 | 417 } |
418 } | |
419 | |
420 int | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
421 SchedTask::get_cpuid() |
308 | 422 { |
423 return __scheduler->id; | |
424 } | |
425 | |
426 /** | |
427 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 | |
428 * buffer から対応するデータを返す。 | |
429 */ | |
430 void* | |
431 SchedTask::get_input(void *buff, int index) | |
432 { | |
433 if (buff != NULL) { | |
373 | 434 return (void*)((int)buff + __inListData->bound[index]); |
308 | 435 } else { |
373 | 436 return NULL; |
308 | 437 } |
438 } | |
439 | |
440 /** | |
441 * get_input(index) のアドレスを返す | |
442 */ | |
443 uint32 | |
444 SchedTask::get_inputAddr(int index) | |
445 { | |
446 return __inListData->element[index].addr; | |
447 } | |
448 | |
449 /** | |
450 * get_input(index) のサイズを返す | |
451 */ | |
452 int | |
453 SchedTask::get_inputSize(int index) | |
454 { | |
455 return __inListData->element[index].size; | |
456 } | |
457 | |
458 /** | |
459 * write buffer の領域を返す。 | |
460 */ | |
461 void* | |
462 SchedTask::get_output(void *buff, int index) | |
463 { | |
464 if (buff != NULL) { | |
373 | 465 return (void*)((int)buff + __outListData->bound[index]); |
308 | 466 } else { |
373 | 467 return NULL; |
308 | 468 } |
469 } | |
470 | |
471 /** | |
472 * get_output(index) のアドレスを返す | |
473 */ | |
474 uint32 | |
475 SchedTask::get_outputAddr(int index) | |
476 { | |
477 return __outListData->element[index].addr; | |
478 } | |
479 | |
480 /** | |
481 * get_output(index) のサイズを返す | |
482 */ | |
483 int | |
484 SchedTask::get_outputSize(int index) | |
485 { | |
486 return __outListData->element[index].size; | |
487 } | |
488 | |
489 int | |
490 SchedTask::get_param(int index) | |
491 { | |
492 return __task->param[index]; | |
493 } | |
494 | |
495 TaskPtr | |
496 SchedTask::create_task(int cmd) | |
497 { | |
498 TaskListPtr taskList = __scheduler->get_renewListBuf(); | |
499 TaskPtr p = &taskList->tasks[taskList->length++]; | |
500 p->command = cmd; | |
501 | |
502 p->inData = (ListData*)__scheduler->allocate(sizeof(ListData)); | |
503 p->outData = (ListData*)__scheduler->allocate(sizeof(ListData)); | |
504 | |
505 p->inData->clear(); | |
506 p->outData->clear(); | |
507 | |
508 p->self = MY_SPE_NOP; | |
509 p->param_size = 0; | |
510 | |
511 return p; | |
512 } | |
513 | |
514 /** | |
515 * 生成したタスクが終了してから、メインスケジューラ(PPE) に | |
516 * タスクが終了した旨を知らせる。 | |
517 * | |
518 * @param[in] waitTask タスク内で生成したタスク | |
519 */ | |
520 void | |
521 SchedTask::wait_task(TaskPtr waitTask) | |
522 { | |
523 waitTask->self = (uint32)__taskGroup; | |
524 | |
525 __scheduler->add_groupTask(__taskGroup, waitTask); | |
526 | |
527 __renew_flag++; | |
528 } | |
529 | |
530 void* | |
531 SchedTask::global_alloc(int id, int size) { | |
532 return __scheduler->global_alloc(id, size); | |
533 } | |
534 | |
535 void* | |
536 SchedTask::global_get(int id) { | |
537 return __scheduler->global_get(id); | |
538 } | |
539 | |
540 void | |
373 | 541 SchedTask::global_set(int id, void *addr) { |
542 __scheduler->global_set(id, addr); | |
543 } | |
544 | |
545 void | |
308 | 546 SchedTask::global_free(int id) { |
547 __scheduler->global_free(id); | |
548 } | |
549 | |
373 | 550 MemList* |
551 SchedTask::createMemList(int size, int count) { | |
552 return __scheduler->createMemList(size, count); | |
553 } | |
554 | |
308 | 555 void |
556 SchedTask::mainMem_alloc(int id, int size) { | |
557 __scheduler->mainMem_alloc(id, size); | |
558 } | |
559 | |
560 void | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
561 SchedTask::mainMem_wait() { |
308 | 562 __scheduler->mainMem_wait(); |
563 } | |
564 | |
565 void* | |
566 SchedTask::mainMem_get(int id) { | |
567 return __scheduler->mainMem_get(id); | |
568 } | |
569 | |
570 void* | |
571 SchedTask::allocate(int size) { | |
572 return __scheduler->allocate(size); | |
573 } | |
574 | |
575 void | |
576 SchedTask::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) { | |
577 __scheduler->dma_load(buf, addr, size, mask); | |
578 } | |
579 | |
580 void | |
581 SchedTask::dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) { | |
582 __scheduler->dma_store(buf, addr, size, mask); | |
583 } | |
584 | |
585 void | |
586 SchedTask::dma_wait(uint32 mask) { | |
587 __scheduler->dma_wait(mask); | |
588 } | |
589 | |
334
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
590 void |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
591 SchedTask::show_dma_wait() { |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
592 __scheduler->show_dma_wait(); |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
593 } |
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
321
diff
changeset
|
594 |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
595 MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) { |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
596 return __scheduler->get_segment(addr,m); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
597 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
598 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
599 void SchedTask::put_segment(MemorySegment *s) { |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
600 __scheduler->put_segment(s); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
601 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
602 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
603 void SchedTask::wait_segment(MemorySegment *s) { |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
604 __scheduler->wait_segment(s); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
605 } |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
606 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
607 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
608 |
308 | 609 /* end */ |