Mercurial > hg > Members > kono > Cerium
annotate TaskManager/kernel/schedule/SchedTaskList.cc @ 704:6d497c098455
Compatibility mode works.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Dec 2009 19:54:00 +0900 |
parents | 9a6cb2439593 |
children | 56487849ea2d |
rev | line source |
---|---|
109 | 1 #include <stdlib.h> |
2 #include <string.h> | |
42 | 3 #include "SchedTaskList.h" |
4 #include "SchedTask.h" | |
704
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
5 #include "SysFunc.h" |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
6 #include "SchedTaskArray.h" |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
7 #include "SchedTaskArrayLoad.h" |
42 | 8 #include "SchedNop2Ready.h" |
9 #include "DmaManager.h" | |
10 #include "error.h" | |
11 | |
184 | 12 /** |
13 * SchedTaskList を返す | |
14 * | |
15 * @param[in] next_list 次の実行する TaskList のアドレス | |
16 * @param[in] next_list がメインメモリのアドレスか、 | |
17 * SPE で生成されたアドレスかのフラグ | |
18 * SPE で生成されている場合、DMA の必要は無い | |
19 * 0: メインメモリ, 1: SPE | |
20 */ | |
21 SchedTaskList* | |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
22 createSchedTaskList(memaddr next_list, Scheduler* scheduler, int renew_flag) |
184 | 23 { |
24 SchedTaskList* sched = new SchedTaskList(next_list, scheduler); | |
25 return sched; | |
26 } | |
27 | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
28 SchedTaskList::SchedTaskList(memaddr addr, Scheduler *sched) |
42 | 29 { |
30 params_addr = addr; | |
184 | 31 list = NULL; |
109 | 32 scheduler = sched; |
33 | |
42 | 34 } |
35 | |
109 | 36 |
42 | 37 void |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
38 SchedTaskList::read() |
42 | 39 { |
40 __debug("[SchedTaskList:%s]\n", __FUNCTION__); | |
41 | |
184 | 42 list = scheduler->get_curListBuf(); |
43 scheduler->dma_load(list, params_addr, | |
44 sizeof(TaskList), DMA_READ_TASKLIST); | |
42 | 45 } |
46 | |
47 SchedTaskBase* | |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
48 SchedTaskList::next(Scheduler *scheduler, SchedTaskBase *p) |
42 | 49 { |
184 | 50 SchedTaskBase *nextSched; |
51 | |
42 | 52 __debug("[SchedTaskList:%s]\n", __FUNCTION__); |
53 | |
233 | 54 scheduler->dma_wait(DMA_READ_TASKLIST); |
42 | 55 if (list->length < 1) { |
184 | 56 nextSched = new SchedNop2Ready(scheduler); |
42 | 57 } else { |
683 | 58 #ifdef SIMPLE_TASK |
59 SimpleTaskPtr nextTask = &list->tasks[0]; | |
60 #else | |
184 | 61 TaskPtr nextTask = &list->tasks[0]; |
683 | 62 #endif |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
63 nextSched = createSchedTask(scheduler, nextTask); |
704
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
64 ((SchedTask*)nextSched)->init(list, nextTask, 1, scheduler); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
65 #ifdef SIMPLE_TASK |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
66 if (nextTask->command==TaskArray1) { |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
67 // compatibility |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
68 return new SchedTaskArray(scheduler, nextSched); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
69 } |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
70 if (nextTask->command==TaskArray) { |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
71 // Start Task Array |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
72 return (SchedTaskBase*)(new SchedTaskArrayLoad(scheduler, nextSched)); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
73 } |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
683
diff
changeset
|
74 #endif |
42 | 75 } |
184 | 76 |
77 return nextSched; | |
42 | 78 } |
88 | 79 |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
233
diff
changeset
|
80 /* end */ |