comparison TaskManager/kernel/schedule/SchedTaskArray.cc @ 698:dcaa40ec963d

no compile error for Task Array
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 13 Dec 2009 20:14:18 +0900
parents 257ad1a518e3
children 7e937a1cd121
comparison
equal deleted inserted replaced
697:257ad1a518e3 698:dcaa40ec963d
1 #include "SchedTaskArray.h" 1 #include "SchedTaskArray.h"
2 #include "SchedTask.h" 2 #include "Scheduler.h"
3 3
4 extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT];
5 4
6 SchedTaskArray::SchedTaskArray(SchedTaskBase *savedTask_, Task *curTask_, Task *_array) 5 SchedTaskArray::SchedTaskArray(SchedTaskBase *savedTask_, Task *curTask_, Task *_array)
7 { 6 {
8 savedTask = savedTask_; 7 savedTask = savedTask_;
9 task = curTask_; 8 task = curTask_;
42 { 41 {
43 __debug("[SchedTaskArrayArray:%s]\n", __FUNCTION__); 42 __debug("[SchedTaskArrayArray:%s]\n", __FUNCTION__);
44 43
45 // object creation をSchedTaskArray生成時にやらないので、 44 // object creation をSchedTaskArray生成時にやらないので、
46 // exec の直前のread で十分に間に合う 45 // exec の直前のread で十分に間に合う
47 loadSchedTask(scheduler, task); 46 loadSchedTask(scheduler, task->command);
48 47
49 // 読むデータが一つもなければ無視 48 // 読むデータが一つもなければ無視
50 if (task->inData_count == 0) return; 49 if (task->inData_count == 0) return;
51 50
52 inListData.length = task->inData_count; 51 inListData.length = task->inData_count;
92 { 91 {
93 __debug("[SchedTaskArrayArray:%s]\n", __FUNCTION__); 92 __debug("[SchedTaskArrayArray:%s]\n", __FUNCTION__);
94 93
95 scheduler->dma_wait(DMA_WRITE); 94 scheduler->dma_wait(DMA_WRITE);
96 free(writebuf); 95 free(writebuf);
96 free(inListData.bound);
97 free(outListData.bound);
97 98
98 // このTaskArrayは終り。終了を知らせる。 99 // このTaskArrayは終り。終了を知らせる。
99 if (task->next() >= last()) { 100 if (task->next() >= last()) {
100 SchedTask *s = (SchedTask *)savedTask; 101 SchedTask *s = (SchedTask *)savedTask;
101 scheduler->mail_write((memaddr)s->task->self); 102 scheduler->mail_write((memaddr)s->task->self);
126 } 127 }
127 } 128 }
128 129
129 130
130 131
132 /**
133 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、
134 * buffer から対応するデータを返す。
135 */
136 void*
137 SchedTaskArray::get_input(void *buff, int index)
138 {
139 return (void*)((char*)readbuf + inListData.bound[index]);
140 }
141
142 /**
143 * get_input(index) のアドレスを返す
144 */
145 memaddr
146 SchedTaskArray::get_inputAddr(int index)
147 {
148 #ifdef __CERIUM_CELL__
149 return (memaddr)inListData.element[index].addr;
150 #else
151 return inListData.element[index].addr;
152 #endif
153 }
154
155 /**
156 * get_input(index) のサイズを返す
157 */
158 int
159 SchedTaskArray::get_inputSize(int index)
160 {
161 return inListData.element[index].size;
162 }
163
164 /**
165 * write buffer の領域を返す。
166 */
167 void*
168 SchedTaskArray::get_output(void *buff, int index)
169 {
170 return (void*)((char *)writebuf + outListData.bound[index]);
171 }
172
173 /**
174 * get_output(index) のアドレスを返す
175 */
176 memaddr
177 SchedTaskArray::get_outputAddr(int index)
178 {
179 #ifdef __CERIUM_CELL__
180 return (memaddr)outListData.element[index].addr;
181 #else
182 return outListData.element[index].addr;
183 #endif
184 }
185
186 /**
187 * get_output(index) のサイズを返す
188 */
189 int
190 SchedTaskArray::get_outputSize(int index)
191 {
192 return outListData.element[index].size;
193 }
194
195 memaddr
196 SchedTaskArray::get_param(int index)
197 {
198 memaddr *param = (memaddr*)task->param(index);
199 return *param;
200 }
201
202
131 /* end */ 203 /* end */