Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/schedule/SchedTaskList.cc @ 403:e2f29e912d0b draft
clean up and add more info on task_list
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 23 Sep 2009 12:04:29 +0900 |
parents | a314d8cd2082 |
children | 609758f9f350 |
rev | line source |
---|---|
109 | 1 #include <stdlib.h> |
2 #include <string.h> | |
42 | 3 #include "SchedTaskList.h" |
4 #include "SchedTask.h" | |
5 #include "SchedNop2Ready.h" | |
6 #include "DmaManager.h" | |
7 #include "error.h" | |
8 | |
184 | 9 /** |
10 * SchedTaskList を返す | |
11 * | |
12 * @param[in] next_list 次の実行する TaskList のアドレス | |
13 * @param[in] next_list がメインメモリのアドレスか、 | |
14 * SPE で生成されたアドレスかのフラグ | |
15 * SPE で生成されている場合、DMA の必要は無い | |
16 * 0: メインメモリ, 1: SPE | |
17 */ | |
18 SchedTaskList* | |
19 createSchedTaskList(uint32 next_list, Scheduler* scheduler, int renew_flag) | |
20 { | |
21 SchedTaskList* sched = new SchedTaskList(next_list, scheduler); | |
22 sched->flag_renewTaskList = renew_flag; | |
23 return sched; | |
24 } | |
25 | |
109 | 26 SchedTaskList::SchedTaskList(unsigned int addr, Scheduler *sched) |
42 | 27 { |
28 params_addr = addr; | |
184 | 29 list = NULL; |
109 | 30 scheduler = sched; |
31 | |
32 flag_renewTaskList = 0; | |
42 | 33 } |
34 | |
109 | 35 |
42 | 36 void |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
37 SchedTaskList::read() |
42 | 38 { |
39 __debug("[SchedTaskList:%s]\n", __FUNCTION__); | |
40 | |
184 | 41 if (flag_renewTaskList == SCHED_TASKLIST_NORMAL) { |
42 list = scheduler->get_curListBuf(); | |
43 scheduler->dma_load(list, params_addr, | |
44 sizeof(TaskList), DMA_READ_TASKLIST); | |
109 | 45 } else { |
46 list = (TaskListPtr)params_addr; | |
47 } | |
42 | 48 } |
49 | |
50 SchedTaskBase* | |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
51 SchedTaskList::next(Scheduler *scheduler, SchedTaskBase *p) |
42 | 52 { |
184 | 53 SchedTaskBase *nextSched; |
54 | |
42 | 55 __debug("[SchedTaskList:%s]\n", __FUNCTION__); |
56 | |
57 delete p; | |
58 | |
233 | 59 scheduler->dma_wait(DMA_READ_TASKLIST); |
60 | |
42 | 61 if (list->length < 1) { |
184 | 62 nextSched = new SchedNop2Ready(scheduler); |
63 | |
64 if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { | |
65 free(list); | |
66 } | |
67 | |
42 | 68 } else { |
184 | 69 TaskPtr nextTask = &list->tasks[0]; |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
70 nextSched = createSchedTask(scheduler, nextTask); |
184 | 71 |
72 if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { | |
73 ((SchedTask*)nextSched)->__setRenew(); | |
74 } | |
75 | |
76 ((SchedTask*)nextSched)->__init__(list, nextTask, 1, | |
77 scheduler->get_curReadBuf(), | |
78 scheduler->get_curWriteBuf(), | |
79 scheduler); | |
42 | 80 } |
184 | 81 |
82 return nextSched; | |
42 | 83 } |
88 | 84 |
403
e2f29e912d0b
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
85 /* end */ |