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