annotate TaskManager/kernel/schedule/SchedTask.cc @ 220:305ac1897c50 draft

fix
author gongo@localhost.localdomain
date Mon, 09 Feb 2009 21:58:45 +0900
parents b56fb6ac2fc4
children a314d8cd2082
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
1 #include <stdlib.h>
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
2 #include <string.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
3 #include "SchedTask.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
4 #include "SchedTaskList.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
5 #include "SchedNop2Ready.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
6 #include "DmaManager.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
7 #include "error.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
8 #include "TaskManager.h"
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
9
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
10 extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT];
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
11
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
12 SchedTask*
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
13 createSchedTask(TaskPtr task)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
14 {
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
15 return task_list[task->command]();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
16 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
17
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
18 SchedTask::SchedTask(void)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
19 {
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
20 __list = NULL;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
21 __task = NULL;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
22 __inListData = NULL;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
23 __outListData = NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
24 __readbuf = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
25 __writebuf = NULL;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
26 __scheduler = NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
27 __taskGroup = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
28 __renew_flag = 0;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
29 __cur_index = 0;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
30 __flag_renewTask = SCHED_TASK_NORMAL;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
31
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
32 ex_init = &SchedTask::ex_init_normal;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
33 ex_read = &SchedTask::ex_read_normal;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
34 ex_exec = &SchedTask::ex_exec_normal;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
35 ex_write = &SchedTask::ex_write_normal;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
36 ex_next = &SchedTask::ex_next_normal;
220
gongo@localhost.localdomain
parents: 194
diff changeset
37
gongo@localhost.localdomain
parents: 194
diff changeset
38 run_func = &SchedTask::run;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
39 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
40
220
gongo@localhost.localdomain
parents: 194
diff changeset
41 /**
gongo@localhost.localdomain
parents: 194
diff changeset
42 * dma_store の wait を行う
gongo@localhost.localdomain
parents: 194
diff changeset
43 * このタスクが RenewTask だった場合、
gongo@localhost.localdomain
parents: 194
diff changeset
44 * __inListData や __outListData は
gongo@localhost.localdomain
parents: 194
diff changeset
45 * Scheduler の持つ、使い回しの buffer ではなく
gongo@localhost.localdomain
parents: 194
diff changeset
46 * 新たに allocate されたものなので、ここで free する
gongo@localhost.localdomain
parents: 194
diff changeset
47 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
48 SchedTask::~SchedTask(void)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
49 {
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
50 if (__flag_renewTask == SCHED_TASK_RENEW) {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
51 free(__inListData);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
52 free(__outListData);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
53
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
54 /**
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
55 * __list != NULL の場合、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
56 * この Task が __list の最後の Task になるので (SchedTask::next 参照)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
57 * このタイミングで __list を解放する
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
58 * (free に渡されるアドレスが正しいものとなる)。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
59 * それ以外の Task では当然解放しない。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
60 * __list == NULL なので、free に渡しても無問題
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
61 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
62 free(__list);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
63 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
64
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
65 delete smanager;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
66 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
67
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
68 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
69 * このタスクを Renew Task とし、それに応じた関数をセットする
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
70 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
71 void
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
72 SchedTask::__setRenew(void)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
73 {
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
74 __flag_renewTask = SCHED_TASK_RENEW;
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
75
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
76 ex_init = &SchedTask::ex_init_renew;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
77 ex_read = &SchedTask::ex_read_renew;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
78 ex_exec = &SchedTask::ex_exec_renew;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
79 ex_write = &SchedTask::ex_write_renew;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
80 ex_next = &SchedTask::ex_next_renew;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
81 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
82
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
83 void
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
84 SchedTask::__init__(TaskListPtr _list, TaskPtr _task, int index,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
85 ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
86 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
87 __list = _list;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
88 __task = _task;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
89 __inListData = rbuf;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
90 __outListData = wbuf;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
91 __scheduler = sc;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
92 __cur_index = index;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
93
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
94 smanager = new STaskManager(this);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
95
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
96 __scheduler->mainMem_wait();
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
97
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
98 (this->*ex_init)();
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
99 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
100
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
101 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
102 * PPE 内で生成されたタスクの ex_init()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
103 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
104 void
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
105 SchedTask::ex_init_normal(void)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
106 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
107 __scheduler->dma_load(__inListData, (uint32)__task->inData,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
108 sizeof(ListData), DMA_READ_IN_LIST);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
109 __scheduler->dma_load(__outListData, (uint32)__task->outData,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
110 sizeof(ListData), DMA_READ_OUT_LIST);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
111
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
112 __taskGroup = new TaskGroup;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
113 __taskGroup->command = __task->self;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
114 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
115
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
116 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
117 * SPE 内で生成されたタスクの ex_init()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
118 * 各データは SPE 内の create_task 時に生成もしくは引き継がれているので
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
119 * ex_init_normal() と違い、ここでは値を渡すだけ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
120 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
121 void
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
122 SchedTask::ex_init_renew(void)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
123 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
124 __inListData = __task->inData;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
125 __outListData = __task->outData;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
126 __taskGroup = (TaskGroupPtr)__task->self;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
127 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
128
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
129 /**
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
130 * [Todo]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
131 * データの読み込み場所を readbuf ではなく、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
132 * ユーザ自身で決めれるようになるといいかもしれない。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
133 *
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
134 * # TaskManager が勝手に消すことなく、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
135 * # ユーザが SPE 上に持ち続けることができるため。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
136 * # もちろん管理はユーザに任せるわけだ。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
137 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
138 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
139 SchedTask::read(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
140 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
141 __debug("[SchedTask:%s]\n", __FUNCTION__);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
142
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
143 // wait for load inListData
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
144 __scheduler->dma_wait(DMA_READ_IN_LIST);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
145
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
146 // 読むデータが一つもなければ無視
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
147 if (__inListData->length < 1 || __inListData->size == 0) return;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
148
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
149 // load Input Data
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
150 __readbuf = __scheduler->allocate(__inListData->size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
151 __scheduler->dma_loadList(__inListData, __readbuf, DMA_READ);
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
152
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
153 (this->*ex_read)();
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
154 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
155
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
156 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
157 SchedTask::exec(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
158 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
159 __debug("[SchedTask:%s]\n", __FUNCTION__);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
160
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
161 // wait for load outListData
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
162 __scheduler->dma_wait(DMA_READ_OUT_LIST);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
163 __writebuf = __scheduler->allocate(__outListData->size);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
164
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
165 __debug(" task->command = %d\n", __task->command);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
166 __debug(" task->in_size = %d\n", __task->in_size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
167 __debug(" task->in_addr = 0x%x\n", __task->in_addr);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
168 __debug(" task->out_addr = 0x%x\n", __task->out_addr);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
169 __debug(" list->next = 0x%x\n", (unsigned int)__list->next);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
170 __debug(" list->length = 0x%x\n", (unsigned int)__list->length);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
171
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
172 __scheduler->dma_wait(DMA_READ);
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
173
220
gongo@localhost.localdomain
parents: 194
diff changeset
174 //run(__readbuf, __writebuf);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
175
220
gongo@localhost.localdomain
parents: 194
diff changeset
176 (this->*run_func)(__readbuf, __writebuf);
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
177 free(__readbuf);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
178
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
179 if (__taskGroup->status() != 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
180 __task->self = __taskGroup->command;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
181 delete __taskGroup;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
182 __taskGroup = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
183 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
184
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
185 (this->*ex_exec)();
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
186 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
187
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
188 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
189 SchedTask::write(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
190 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
191 __debug("[SchedTask:%s]\n", __FUNCTION__);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
192
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
193
220
gongo@localhost.localdomain
parents: 194
diff changeset
194 // 書き込む領域がなければ無視
gongo@localhost.localdomain
parents: 194
diff changeset
195 if (__outListData->size > 0 || __outListData->length > 0) {
gongo@localhost.localdomain
parents: 194
diff changeset
196 __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE);
gongo@localhost.localdomain
parents: 194
diff changeset
197 }
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
198 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
199
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
200 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
201 * PPE 内で生成されたタスクの ex_read()
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
202 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
203 void
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
204 SchedTask::ex_read_normal(void)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
205 {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
206 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
207
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
208 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
209 * SPE 内で生成されたタスクの ex_read()
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
210 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
211 void
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
212 SchedTask::ex_read_renew(void)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
213 {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
214 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
215
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
216 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
217 * PPE 内で生成されたタスクの ex_exec()
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
218 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
219 void
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
220 SchedTask::ex_exec_normal(void)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
221 {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
222 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
223
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
224 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
225 * SPE 内で生成されたタスクの ex_exec()
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
226 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
227 void
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
228 SchedTask::ex_exec_renew(void)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
229 {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
230 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
231
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
232
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
233
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
234 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
235 * PPE 内で生成されたタスクの ex_write()
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
236 *
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
237 * このタスク内で新たにタスクが生成され、
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
238 * 且つそのタスクの終了を待つ必要がある場合、
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
239 * PPE に終了したことは知らせない(command は送信しない)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
240 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
241 void
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
242 SchedTask::ex_write_normal(void)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
243 {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
244 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
245 * このタスク内で新たにタスクが生成されなかった
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
246 * or 生成されたが、そのタスクの終了を待つ必要は無い
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
247 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
248 if (__renew_flag == 0) {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
249 __scheduler->mail_write(__task->self);
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
250 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
251 }
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
252
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
253 /**
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
254 * SPE 内で生成されたタスクの ex_write()
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
255 *
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
256 * A <- 親タスク
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
257 * | \
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
258 * B C <- SPE 内で生成されたタスク
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
259 *
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
260 * A は SPE 内で B, C を生成したとする。
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
261 * B と C が終了したら、A が PPE に送るはずだったコマンドが
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
262 * 子タスクに引き継がれているので、最後に実行された子タスクが
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
263 * PPE に mail 送信する。
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
264 */
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
265 void
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
266 SchedTask::ex_write_renew(void)
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
267 {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
268 uint32 cmd;
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
269
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
270 __taskGroup->remove(__task);
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
271 cmd = __taskGroup->status();
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
272
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
273 // タスク内で作られた全てのタスクが終了した
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
274 if (cmd != 0) {
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
275 delete __taskGroup;
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
276 __scheduler->mail_write(cmd);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
277 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
278 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
279
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
280 SchedTaskBase*
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
281 SchedTask::next(Scheduler *m, SchedTaskBase *p)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
282 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
283 __debug("[SchedTask:%s]\n", __FUNCTION__);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
284
220
gongo@localhost.localdomain
parents: 194
diff changeset
285 __scheduler->dma_wait(DMA_WRITE);
gongo@localhost.localdomain
parents: 194
diff changeset
286 free(__writebuf);
gongo@localhost.localdomain
parents: 194
diff changeset
287
gongo@localhost.localdomain
parents: 194
diff changeset
288 (this->*ex_write)();
gongo@localhost.localdomain
parents: 194
diff changeset
289
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
290 delete p;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
291
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
292 return (this->*ex_next)();
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
293 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
294
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
295 SchedTaskBase*
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
296 SchedTask::ex_next_normal(void)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
297 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
298 if (__cur_index < __list->length) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
299 SchedTaskBase *nextSched;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
300
187
gongo@localhost.localdomain
parents: 184
diff changeset
301 nextSched = __scheduler->get_nextRenewTaskList();
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
302
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
303 // RenewTask がある
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
304 if (nextSched) {
187
gongo@localhost.localdomain
parents: 184
diff changeset
305 __scheduler->set_backupTaskList(__list);
gongo@localhost.localdomain
parents: 184
diff changeset
306 __scheduler->set_backupTaskListIndex(__cur_index);
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
307 return nextSched;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
308 } else {
187
gongo@localhost.localdomain
parents: 184
diff changeset
309 TaskPtr nextTask = &__list->tasks[__cur_index++];
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
310 nextSched = createSchedTask(nextTask);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
311 ((SchedTask*)nextSched)->__init__(__list, nextTask, __cur_index,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
312 __scheduler->get_curReadBuf(),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
313 __scheduler->get_curWriteBuf(),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
314 __scheduler);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
315 return nextSched;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
316 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
317 } else {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
318 uint32 nextList = (uint32)__list->next;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
319
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
320 if (nextList == 0) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
321 return new SchedNop2Ready(__scheduler);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
322 } else {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
323 return createSchedTaskList(nextList, __scheduler,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
324 SCHED_TASKLIST_NORMAL);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
325 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
326 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
327 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
328
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
329 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
330 *
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
331 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
332 SchedTaskBase*
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
333 SchedTask::ex_next_renew(void)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
334 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
335 TaskPtr nextTask;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
336 SchedTask *nextSched;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
337
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
338 if (__cur_index < __list->length) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
339 nextTask = &__list->tasks[__cur_index++];
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
340 nextSched = createSchedTask(nextTask);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
341
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
342 // RenewTaskList を実行中なので
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
343 nextSched->__setRenew();
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
344 nextSched->__init__(__list, nextTask, __cur_index,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
345 __scheduler->get_curReadBuf(),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
346 __scheduler->get_curWriteBuf(),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
347 __scheduler);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
348
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
349 /**
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
350 * この理由は SchedTask:~SchedTask() で
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
351 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
352 __list = NULL;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
353 return nextSched;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
354 } else {
187
gongo@localhost.localdomain
parents: 184
diff changeset
355 SchedTaskBase *nextList;
gongo@localhost.localdomain
parents: 184
diff changeset
356
gongo@localhost.localdomain
parents: 184
diff changeset
357 nextList = __scheduler->get_nextRenewTaskList();
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
358
187
gongo@localhost.localdomain
parents: 184
diff changeset
359 if (nextList) {
gongo@localhost.localdomain
parents: 184
diff changeset
360 return nextList;
gongo@localhost.localdomain
parents: 184
diff changeset
361 } else {
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
362 TaskListPtr nextList = __scheduler->get_backupTaskList();
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
363
187
gongo@localhost.localdomain
parents: 184
diff changeset
364 // 中断した TaskList がある
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
365 if (nextList) {
187
gongo@localhost.localdomain
parents: 184
diff changeset
366 __cur_index = __scheduler->get_backupTaskListIndex();
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
367
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
368 nextTask = &nextList->tasks[__cur_index++];
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
369 nextSched = createSchedTask(nextTask);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
370
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
371 nextSched->__init__(nextList, nextTask, __cur_index,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
372 __scheduler->get_curReadBuf(),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
373 __scheduler->get_curWriteBuf(),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
374 __scheduler);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
375 return nextSched;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
376 } else {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
377 return new SchedNop2Ready(__scheduler);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
378 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
379 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
380 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
381 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
382
194
gongo@localhost.localdomain
parents: 187
diff changeset
383 int
gongo@localhost.localdomain
parents: 187
diff changeset
384 SchedTask::get_cpuid(void)
gongo@localhost.localdomain
parents: 187
diff changeset
385 {
gongo@localhost.localdomain
parents: 187
diff changeset
386 return __scheduler->id;
gongo@localhost.localdomain
parents: 187
diff changeset
387 }
gongo@localhost.localdomain
parents: 187
diff changeset
388
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
389 /**
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
390 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
391 * buffer から対応するデータを返す。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
392 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
393 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
394 SchedTask::get_input(void *buff, int index)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
395 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
396 if (buff != NULL) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
397 return (void*)((int)buff + __inListData->bound[index]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
398 } else {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
399 return NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
400 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
401 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
402
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
403 /**
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
404 * get_input(index) のアドレスを返す
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
405 */
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
406 uint32
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
407 SchedTask::get_inputAddr(int index)
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
408 {
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
409 return __inListData->element[index].addr;
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
410 }
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
411
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
412 /**
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
413 * get_input(index) のサイズを返す
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
414 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
415 int
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
416 SchedTask::get_inputSize(int index)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
417 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
418 return __inListData->element[index].size;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
419 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
420
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
421 /**
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
422 * write buffer の領域を返す。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
423 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
424 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
425 SchedTask::get_output(void *buff, int index)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
426 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
427 if (buff != NULL) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
428 return (void*)((int)buff + __outListData->bound[index]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
429 } else {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
430 return NULL;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
431 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
432 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
433
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
434 /**
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
435 * get_output(index) のアドレスを返す
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
436 */
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
437 uint32
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
438 SchedTask::get_outputAddr(int index)
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
439 {
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
440 return __outListData->element[index].addr;
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
441 }
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
442
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
443 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
444 * get_output(index) のサイズを返す
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
445 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
446 int
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
447 SchedTask::get_outputSize(int index)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
448 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
449 return __outListData->element[index].size;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
450 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
451
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
452 int
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
453 SchedTask::get_param(int index)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
454 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
455 return __task->param[index];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
456 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
457
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
458 TaskPtr
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
459 SchedTask::create_task(int cmd)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
460 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
461 TaskListPtr taskList = __scheduler->get_renewListBuf();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
462 TaskPtr p = &taskList->tasks[taskList->length++];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
463 p->command = cmd;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
464
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
465 p->inData = (ListData*)__scheduler->allocate(sizeof(ListData));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
466 p->outData = (ListData*)__scheduler->allocate(sizeof(ListData));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
467
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
468 p->inData->clear();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
469 p->outData->clear();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
470
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
471 p->self = MY_SPE_NOP;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
472 p->param_size = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
473
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
474 return p;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
475 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
476
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
477 /**
180
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
478 * 生成したタスクが終了してから、メインスケジューラ(PPE) に
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
479 * タスクが終了した旨を知らせる。
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
480 *
e3b7776b1420 fix 荅潟 TaskManager/Changelogtest_render/Changelog
gongo@localhost.localdomain
parents: 109
diff changeset
481 * @param[in] waitTask タスク内で生成したタスク
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
482 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
483 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
484 SchedTask::wait_task(TaskPtr waitTask)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
485 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
486 waitTask->self = (uint32)__taskGroup;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
487
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
488 __scheduler->add_groupTask(__taskGroup, waitTask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
489
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
490 __renew_flag++;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
491 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
492
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
493 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
494 SchedTask::global_alloc(int id, int size) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
495 return __scheduler->global_alloc(id, size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
496 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
497
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
498 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
499 SchedTask::global_get(int id) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
500 return __scheduler->global_get(id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
501 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
502
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
503 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
504 SchedTask::global_free(int id) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
505 __scheduler->global_free(id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
506 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
507
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
508 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
509 SchedTask::mainMem_alloc(int id, int size) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
510 __scheduler->mainMem_alloc(id, size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
511 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
512
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
513 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
514 SchedTask::mainMem_wait(void) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
515 __scheduler->mainMem_wait();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
516 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
517
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
518 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
519 SchedTask::mainMem_get(int id) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
520 return __scheduler->mainMem_get(id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
521 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
522
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
523 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
524 SchedTask::allocate(int size) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
525 return __scheduler->allocate(size);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
526 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
527
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
528 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
529 SchedTask::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
530 __scheduler->dma_load(buf, addr, size, mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
531 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
532
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
533 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
534 SchedTask::dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
535 __scheduler->dma_store(buf, addr, size, mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
536 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
537
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
538 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
539 SchedTask::dma_wait(uint32 mask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
540 __scheduler->dma_wait(mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
541 }