Mercurial > hg > Members > kono > Cerium
comparison TaskManager/kernel/schedule/SchedTask.cc @ 506:1d4a8a86f26b
code_load in read()
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Oct 2009 02:50:01 +0900 |
parents | 36b323130b1b |
children | 125a72948e44 |
comparison
equal
deleted
inserted
replaced
505:22e8eba8ad5e | 506:1d4a8a86f26b |
---|---|
151 } | 151 } |
152 | 152 |
153 void | 153 void |
154 SchedTask::read() | 154 SchedTask::read() |
155 { | 155 { |
156 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
157 | |
158 #if 0 | |
159 #if !defined(NO_PIPELINE) | |
160 scheduler->dma_wait(DMA_READ_IN_LIST); | |
161 scheduler->dma_wait(DMA_READ_OUT_LIST); | |
162 #endif | |
163 #endif | |
164 // object creation をSchedTask生成時にやらないので、 | |
165 // exec の直前のread で十分に間に合う | |
166 if (cur_index < list->length) { | |
167 // load next task | |
168 loadSchedTask(scheduler, &list->tasks[cur_index]); | |
169 } | |
170 | |
171 writebuf = scheduler->allocate(outListData->size); | |
172 | |
173 // 読むデータが一つもなければ無視 | |
174 if (inListData->length == 0) return; | |
175 | |
176 // load Input Data | |
177 readbuf = scheduler->allocate(inListData->size); | |
178 scheduler->dma_loadList(inListData, readbuf, DMA_READ); | |
179 | |
180 #if defined(NO_PIPELINE) | |
181 scheduler->dma_wait(DMA_READ); | |
182 #endif | |
183 | |
156 (this->*ex_read)(); | 184 (this->*ex_read)(); |
157 } | 185 } |
158 | 186 |
159 /** | 187 /** |
160 * PPE 内で生成されたタスクの ex_read() | 188 * PPE 内で生成されたタスクの ex_read() |
168 * # もちろん管理はユーザに任せるわけだ。 | 196 * # もちろん管理はユーザに任せるわけだ。 |
169 */ | 197 */ |
170 void | 198 void |
171 SchedTask::ex_read_normal() | 199 SchedTask::ex_read_normal() |
172 { | 200 { |
173 __debug("[SchedTask:%s]\n", __FUNCTION__); | |
174 | |
175 #if 0 | |
176 #if !defined(NO_PIPELINE) | |
177 scheduler->dma_wait(DMA_READ_IN_LIST); | |
178 scheduler->dma_wait(DMA_READ_OUT_LIST); | |
179 #endif | |
180 #endif | |
181 | |
182 writebuf = scheduler->allocate(outListData->size); | |
183 | |
184 // 読むデータが一つもなければ無視 | |
185 if (inListData->length == 0) return; | |
186 | |
187 // load Input Data | |
188 readbuf = scheduler->allocate(inListData->size); | |
189 scheduler->dma_loadList(inListData, readbuf, DMA_READ); | |
190 | |
191 #if defined(NO_PIPELINE) | |
192 scheduler->dma_wait(DMA_READ); | |
193 #endif | |
194 | |
195 } | 201 } |
196 | 202 |
197 void | 203 void |
198 SchedTask::exec() | 204 SchedTask::exec() |
199 { | 205 { |
340 scheduler->set_backupTaskList(list); | 346 scheduler->set_backupTaskList(list); |
341 scheduler->set_backupTaskListIndex(cur_index); | 347 scheduler->set_backupTaskListIndex(cur_index); |
342 return nextSched; | 348 return nextSched; |
343 } else { | 349 } else { |
344 TaskPtr nextTask = &list->tasks[cur_index++]; | 350 TaskPtr nextTask = &list->tasks[cur_index++]; |
345 if (cur_index < list->length) { | |
346 // load next task | |
347 loadSchedTask(scheduler, &list->tasks[cur_index]); | |
348 } | |
349 nextSched = createSchedTask(scheduler, nextTask); | 351 nextSched = createSchedTask(scheduler, nextTask); |
350 ((SchedTask*)nextSched)->init(list, nextTask, cur_index, | 352 ((SchedTask*)nextSched)->init(list, nextTask, cur_index, |
351 // scheduler->get_curReadBuf(), | 353 // scheduler->get_curReadBuf(), |
352 // scheduler->get_curWriteBuf(), | 354 // scheduler->get_curWriteBuf(), |
353 scheduler); | 355 scheduler); |
374 TaskPtr nextTask; | 376 TaskPtr nextTask; |
375 SchedTask *nextSched; | 377 SchedTask *nextSched; |
376 | 378 |
377 if (cur_index < list->length) { | 379 if (cur_index < list->length) { |
378 nextTask = &list->tasks[cur_index++]; | 380 nextTask = &list->tasks[cur_index++]; |
379 if (cur_index < list->length) { | |
380 // load next task | |
381 loadSchedTask(scheduler, &list->tasks[cur_index]); | |
382 } | |
383 nextSched = createSchedTask(scheduler, nextTask); | 381 nextSched = createSchedTask(scheduler, nextTask); |
384 | 382 |
385 // RenewTaskList を実行中なので | 383 // RenewTaskList を実行中なので |
386 nextSched->setRenew(); | 384 nextSched->setRenew(); |
387 nextSched->init(list, nextTask, cur_index, | 385 nextSched->init(list, nextTask, cur_index, |
407 // 中断した TaskList がある | 405 // 中断した TaskList がある |
408 if (nextList) { | 406 if (nextList) { |
409 cur_index = scheduler->get_backupTaskListIndex(); | 407 cur_index = scheduler->get_backupTaskListIndex(); |
410 | 408 |
411 nextTask = &nextList->tasks[cur_index++]; | 409 nextTask = &nextList->tasks[cur_index++]; |
412 if (cur_index < list->length) { | |
413 // load next task | |
414 loadSchedTask(scheduler, &list->tasks[cur_index]); | |
415 } | |
416 nextSched = createSchedTask(scheduler, nextTask); | 410 nextSched = createSchedTask(scheduler, nextTask); |
417 | 411 |
418 nextSched->init(nextList, nextTask, cur_index, | 412 nextSched->init(nextList, nextTask, cur_index, |
419 // scheduler->get_curReadBuf(), | 413 // scheduler->get_curReadBuf(), |
420 // scheduler->get_curWriteBuf(), | 414 // scheduler->get_curWriteBuf(), |