Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/spe/SchedTaskList.cc @ 217:897aeb144569
fix
author | gongo@localhost.localdomain |
---|---|
date | Wed, 04 Feb 2009 22:50:42 +0900 |
parents | 907bda4a1a14 |
children | 2b114977852d |
rev | line source |
---|---|
109 | 1 #include <stdlib.h> |
2 #include <string.h> | |
81 | 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) |
81 | 27 { |
28 params_addr = addr; | |
184 | 29 list = NULL; |
109 | 30 scheduler = sched; |
31 | |
32 flag_renewTaskList = 0; | |
81 | 33 } |
34 | |
109 | 35 |
81 | 36 void |
37 SchedTaskList::read(void) | |
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, | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
44 sizeof(TaskList), DMA_READ_TASKLIST); |
109 | 45 scheduler->dma_wait(DMA_READ_TASKLIST); |
46 } else { | |
47 list = (TaskListPtr)params_addr; | |
48 } | |
81 | 49 } |
50 | |
51 SchedTaskBase* | |
52 SchedTaskList::next(Scheduler *m, SchedTaskBase *p) | |
53 { | |
184 | 54 SchedTaskBase *nextSched; |
55 | |
81 | 56 __debug("[SchedTaskList:%s]\n", __FUNCTION__); |
57 | |
58 delete p; | |
59 | |
60 if (list->length < 1) { | |
184 | 61 nextSched = new SchedNop2Ready(scheduler); |
62 | |
63 if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { | |
64 free(list); | |
65 } | |
66 | |
81 | 67 } else { |
184 | 68 TaskPtr nextTask = &list->tasks[0]; |
69 nextSched = createSchedTask(nextTask); | |
70 | |
71 if (flag_renewTaskList == SCHED_TASKLIST_RENEW) { | |
72 ((SchedTask*)nextSched)->__setRenew(); | |
73 } | |
74 | |
75 ((SchedTask*)nextSched)->__init__(list, nextTask, 1, | |
76 scheduler->get_curReadBuf(), | |
77 scheduler->get_curWriteBuf(), | |
78 scheduler); | |
81 | 79 } |
184 | 80 |
81 return nextSched; | |
81 | 82 } |
83 |