annotate TaskManager/kernel/schedule/Scheduler.cc @ 313:c9f8cfcdc5c2

fix ppu mail box waiting (mainMem allocate)
author kono@localhost.localdomain
date Tue, 09 Jun 2009 00:10:36 +0900
parents bcb81858aa62
children b89ba1d96fff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
70a0ac46133e *** empty log message ***
gongo
parents: 42
diff changeset
1 #include <stdio.h>
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
2 #include <stdlib.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
3 #include "Scheduler.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
4 #include "SchedNop.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
5 #include "error.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
6
313
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
7 /*
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
8 * Edit kernel/schedule/xx.cc, Cell/spe/xx.cc will be over writen by this.
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
9 * Do not edit Cell/spe/xx.cc unless there is no kernel/schedule/xx.cc files.
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
10 */
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
11
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
12 Scheduler::TaskObject task_list[MAX_TASK_OBJECT];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
13
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
14 Scheduler::~Scheduler(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
15 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
16 delete connector;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
17 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
18
301
bcb81858aa62 remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
19 /*! @brief speTaskの入出力のパイプラインバッファを確保する
bcb81858aa62 remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
20 */
bcb81858aa62 remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
21
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
22 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
23 Scheduler::init(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
24 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
25 init_impl();
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
26
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
27 for (int i = 0; i < 2; i++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
28 buff_taskList[i] = (TaskListPtr)allocate(sizeof(TaskList));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
29 buff_inListData[i] = (ListDataPtr)allocate(sizeof(ListData));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
30 buff_outListData[i] = (ListDataPtr)allocate(sizeof(ListData));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
31 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
32
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
33 buffFlag_taskList = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
34 buffFlag_inListData = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
35 buffFlag_outListData = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
36 flag_renewTaskList = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
37
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
38 // bzero でもいいけど
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
39 for (int i = 0; i < MAX_GLOBAL_AREA; i++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
40 globalList[i] = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
41 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
42
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
43 for (int i = 0; i < MAX_MAINMEM_AREA; i++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
44 mainMemList[i] = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
45 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
46
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
47
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
48 taskGroup = new TaskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
49 renewTop_taskList = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
50 renewCur_taskList = NULL;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
51 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
52
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
53 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
54 Scheduler::run(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
55 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
56 SchedTaskBase* taskTmp;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
57
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
58 task1 = new SchedNop();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
59 task2 = new SchedNop();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
60 task3 = new SchedNop();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
61
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
62 // main loop
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
63 do {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
64 __debug("----------\n");
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
65 task3->write();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
66 task2->exec();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
67 task1->read();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
68
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
69 taskTmp = task3;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
70 task3 = task2;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
71 task2 = task1;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
72 task1 = task1->next(this, taskTmp);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
73 } while (task1);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
74
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
75 delete task3;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
76 delete task2;
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
77 }
48
70a0ac46133e *** empty log message ***
gongo
parents: 42
diff changeset
78
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
79
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
80 void
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
81 Scheduler::finish(void)
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
82 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
83 free(buff_taskList[0]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
84 free(buff_taskList[1]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
85 free(buff_inListData[0]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
86 free(buff_inListData[1]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
87 free(buff_outListData[0]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
88 free(buff_outListData[1]);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
89 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
90
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
91 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
92 * あらかじめ memory allocte してある TaskList の領域を
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
93 * パイプラインの各処理が交代して使う。
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
94 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
95 TaskListPtr
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
96 Scheduler::get_curListBuf(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
97 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
98 buffFlag_taskList ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
99
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
100 return buff_taskList[buffFlag_taskList];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
101 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
102
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
103
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
104 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
105 * あらかじめ memory allocte してある ListData の領域を
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
106 * パイプラインの各処理が交代して使う。
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
107 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
108 ListDataPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
109 Scheduler::get_curWriteBuf(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
110 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
111 buffFlag_outListData ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
112 return buff_outListData[buffFlag_outListData];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
113 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
114
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
115
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
116 ListDataPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
117 Scheduler::get_curReadBuf(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
118 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
119 buffFlag_inListData ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
120 return buff_inListData[buffFlag_inListData];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
121 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
122
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
123 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
124 * タスク内で生成されたタスクを格納する TaskList を取得する
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
125 * 現在格納に使っている TaskList (renewCur_taskList) が使えるならそれを返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
126 * もしそうでないなら、新しく TaskList を allocate してそれを返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
127 * コード中で renewCur_taskList が NULL になるのは
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
128 * - プログラム開始時
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
129 * - タスク内生成タスクがある TaskList の実行を新しく始める (Nop2Ready 参照)
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
130 * 以上の場合です
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
131 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
132 TaskListPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
133 Scheduler::get_renewListBuf(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
134 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
135 if (renewCur_taskList && renewCur_taskList->length < TASK_MAX_SIZE) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
136 return renewCur_taskList;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
137 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
138 TaskListPtr newList = (TaskListPtr)allocate(sizeof(TaskList));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
139 newList->length = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
140 newList->next = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
141 renewTop_taskList = TaskList::append(renewTop_taskList, newList);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
142 renewCur_taskList = newList;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
143 return newList;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
144 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
145 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
146
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
147 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
148 * 次に実行する Renew Task List を返す
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
149 *
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
150 * @param[in] curList 現在実行中の TaskList
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
151 * 中断して RenewTaskList を行うため
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
152 * バックアップを取っておく
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
153 * @return next RenewTaskList
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
154 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
155 SchedTaskList*
187
gongo@localhost.localdomain
parents: 184
diff changeset
156 Scheduler::get_nextRenewTaskList(void)
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
157 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
158 if (renewTop_taskList) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
159 TaskListPtr list = renewTop_taskList;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
160 renewTop_taskList = renewTop_taskList->next;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
161 renewCur_taskList = NULL;
233
gongo@localhost.localdomain
parents: 187
diff changeset
162
187
gongo@localhost.localdomain
parents: 184
diff changeset
163 list->next = NULL;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
164 SchedTaskList *sched
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
165 = createSchedTaskList((uint32)list, this, SCHED_TASKLIST_RENEW);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
166 return sched;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
167 } else {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
168 return NULL;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
169 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
170 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
171
187
gongo@localhost.localdomain
parents: 184
diff changeset
172 void
gongo@localhost.localdomain
parents: 184
diff changeset
173 Scheduler::set_backupTaskList(TaskListPtr cur_taskList)
gongo@localhost.localdomain
parents: 184
diff changeset
174 {
gongo@localhost.localdomain
parents: 184
diff changeset
175 bak_curTaskList = cur_taskList;
gongo@localhost.localdomain
parents: 184
diff changeset
176 }
gongo@localhost.localdomain
parents: 184
diff changeset
177
gongo@localhost.localdomain
parents: 184
diff changeset
178 void
gongo@localhost.localdomain
parents: 184
diff changeset
179 Scheduler::set_backupTaskListIndex(int cur_index)
gongo@localhost.localdomain
parents: 184
diff changeset
180 {
gongo@localhost.localdomain
parents: 184
diff changeset
181 bakIndex_taskList = cur_index;
gongo@localhost.localdomain
parents: 184
diff changeset
182 }
gongo@localhost.localdomain
parents: 184
diff changeset
183
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
184 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
185 * RenewTaskList 実行前に中断した TaskList を返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
186 * NULL の場合、中断した TaskList は無い。
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
187 *
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
188 * @return TaskList
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
189 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
190 TaskListPtr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
191 Scheduler::get_backupTaskList(void)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
192 {
187
gongo@localhost.localdomain
parents: 184
diff changeset
193 TaskListPtr ret = bak_curTaskList;
gongo@localhost.localdomain
parents: 184
diff changeset
194
gongo@localhost.localdomain
parents: 184
diff changeset
195 bak_curTaskList = NULL;
gongo@localhost.localdomain
parents: 184
diff changeset
196 return ret;
gongo@localhost.localdomain
parents: 184
diff changeset
197 }
gongo@localhost.localdomain
parents: 184
diff changeset
198
gongo@localhost.localdomain
parents: 184
diff changeset
199 int
gongo@localhost.localdomain
parents: 184
diff changeset
200 Scheduler::get_backupTaskListIndex(void)
gongo@localhost.localdomain
parents: 184
diff changeset
201 {
gongo@localhost.localdomain
parents: 184
diff changeset
202 int ret = bakIndex_taskList;
gongo@localhost.localdomain
parents: 184
diff changeset
203
gongo@localhost.localdomain
parents: 184
diff changeset
204 bakIndex_taskList = 0;
gongo@localhost.localdomain
parents: 184
diff changeset
205 return ret;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
206 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
207
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
208 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
209 Scheduler::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
210 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
211 connector->dma_load(buf, addr, size, mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
212 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
213
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
214 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
215 Scheduler::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
216 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
217 connector->dma_store(buf, addr, size, mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
218 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
219
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
220 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
221 Scheduler::dma_wait(uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
222 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
223 connector->dma_wait(mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
224 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
225
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
226 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
227 Scheduler::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
228 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
229 connector->dma_loadList(list, buff, mask);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
230 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
231
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
232
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
233 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
234 Scheduler::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
235 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
236 return connector->dma_storeList(list, buff, mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
237 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
238
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
239 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
240 Scheduler::mail_write(uint32 data)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
241 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
242 connector->mail_write(data);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
243 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
244
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
245 uint32
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
246 Scheduler::mail_read(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
247 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
248 return connector->mail_read();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
249 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
250
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
251 TaskGroupPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
252 Scheduler::set_groupTask(uint32 command)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
253 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
254 TaskGroupPtr ret = taskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
255
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
256 reload_groupTask();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
257
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
258 ret->command = command;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
259 return ret;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
260 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
261
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
262 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
263 Scheduler::add_groupTask(TaskGroupPtr group, TaskPtr task)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
264 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
265 group->add(task);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
266 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
267
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
268 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
269 Scheduler::remove_groupTask(TaskGroupPtr group, TaskPtr task)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
270 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
271 group->remove(task);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
272 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
273
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
274 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
275 Scheduler::reload_groupTask(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
276 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
277 taskGroup = new TaskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
278 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
279
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
280 uint32
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
281 Scheduler::status_groupTask(TaskGroupPtr group)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
282 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
283 return group->status();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
284 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
285
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
286 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
287 Scheduler::global_alloc(int id, int size)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
288 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
289 globalList[id] = allocate(size);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
290 return globalList[id];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
291 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
292
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
293 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
294 Scheduler::global_get(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
295 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
296 return globalList[id];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
297 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
298
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
299 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
300 Scheduler::global_free(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
301 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
302 free(globalList[id]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
303 globalList[id] = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
304 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
305
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
306 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
307 * mainMem_alloc で確保したメインメモリの領域アドレスを返す。
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
308 * これは Fifo, Cell で共通
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
309 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
310 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
311 Scheduler::mainMem_get(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
312 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
313 return mainMemList[id];
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
314 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
315
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
316
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
317 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
318 * 本当は Scheduler クラスに入れるべきなんだろうか。。。
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
319 * なんか手抜きの感がある
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
320 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
321 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
322 register_task(int cmd, Scheduler::TaskObject task)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
323 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
324 task_list[cmd] = task;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
325 }