Mercurial > hg > Members > kono > Cerium
annotate include/TaskManager/SchedTask.h @ 247:0098b5ff0d11
change example
author | aaa |
---|---|
date | Mon, 01 Jun 2009 19:33:09 +0900 |
parents | fe2cc32cd94d |
children | 58fd16298954 81b25e5d5379 |
rev | line source |
---|---|
42 | 1 #ifndef INCLUDED_SCHED_TASK |
2 #define INCLUDED_SCHED_TASK | |
3 | |
109 | 4 #ifndef INCLUDED_BASE_H_ |
5 # include "base.h" | |
6 #endif | |
7 | |
42 | 8 #ifndef INCLUDED_SCHEDULER |
9 # include "Scheduler.h" | |
10 #endif | |
11 | |
12 #ifndef INCLUDED_SCHED_TASK_BASE | |
13 # include "SchedTaskBase.h" | |
14 #endif | |
15 | |
109 | 16 #ifndef INCLUDED_LIST_DATA |
17 # include "ListData.h" | |
18 #endif | |
19 | |
20 #ifndef INCLUDED_TASK_GROUP | |
21 # include "TaskGroup.h" | |
22 #endif | |
23 | |
24 | |
42 | 25 class SchedTask : public SchedTaskBase { |
26 public: | |
109 | 27 /* constructor */ |
184 | 28 SchedTask(void); |
109 | 29 ~SchedTask(void); |
88 | 30 |
109 | 31 BASE_NEW_DELETE(SchedTask); |
42 | 32 |
33 /* variables */ | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
34 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
35 // Task ¹Ԥ륹塼鼫 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
36 Scheduler *__scheduler; |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
37 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
38 // ߥ塼餬¹ԤƤ TaskList ȡΥб Task |
109 | 39 TaskListPtr __list; |
40 TaskPtr __task; | |
41 | |
42 // read/write Ѥ ListData | |
43 ListDataPtr __inListData; | |
44 ListDataPtr __outListData; | |
42 | 45 |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
46 /** |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
47 * read ǡwrite ѤΥХåե |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
48 * readbuf ˤ ϿꤷϥǡäƤ롣 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
49 * writebuf ˥ǡǤȡ |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
50 * Ͽꤷ˽ |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
51 */ |
109 | 52 void *__readbuf; |
53 void *__writebuf; | |
54 | |
184 | 55 // Task ΡTasklist Ǥΰ֡(task = &list[cur_index-1]) |
56 int __cur_index; | |
57 | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
58 // 줿Υ롼 |
109 | 59 TaskGroup *__taskGroup; |
60 | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
61 // Υ줿ο |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
62 int __renew_flag; |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
63 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
64 // Υ SPE 줿ݤ 1: Yes, 0: No |
109 | 65 int __flag_renewTask; |
42 | 66 |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
67 // ᥤ¦줿Τ |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
68 // SPE 줿ΤˤäơǡΰѤäƤ롣 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
69 // Τ if (__flag_renewTask) ϢȯΤϤ褯ʤΤ |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
70 // ؿݥǻäƤ |
184 | 71 void (SchedTask::*ex_init)(void); |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
72 void (SchedTask::*ex_read)(void); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
73 void (SchedTask::*ex_exec)(void); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
74 void (SchedTask::*ex_write)(void); |
184 | 75 SchedTaskBase* (SchedTask::*ex_next)(void); |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
76 |
42 | 77 /* functions */ |
184 | 78 void __setRenew(void); |
79 void __init__(TaskListPtr _list, TaskPtr _task, int index, | |
80 ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc); | |
109 | 81 |
42 | 82 // override |
83 void read(void); | |
84 void exec(void); | |
85 void write(void); | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
86 SchedTaskBase* next(Scheduler *, SchedTaskBase *); |
82 | 87 |
109 | 88 // 桼Ѿ |
89 // 줾ΥбҤ | |
82 | 90 virtual int run(void* r, void *w) { return 0; } |
109 | 91 |
212 | 92 int (SchedTask::*run_func)(void* r, void *w); |
93 | |
184 | 94 //--- System API --- |
95 SchedTask* get_nextTask(TaskListPtr list); | |
96 | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
97 /** |
184 | 98 * PPE 줿Ф |
99 * __init__, read,exec,write,next °(?) | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
100 */ |
184 | 101 void ex_init_normal(void); |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
102 void ex_read_normal(void); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
103 void ex_exec_normal(void); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
104 void ex_write_normal(void); |
184 | 105 SchedTaskBase* ex_next_normal(void); |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
106 |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
107 /** |
184 | 108 * SPE 줿Ф |
109 * __inti__, ead,exec,write,next °(?) | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
110 */ |
184 | 111 void ex_init_renew(void); |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
112 void ex_read_renew(void); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
113 void ex_exec_renew(void); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
114 void ex_write_renew(void); |
184 | 115 SchedTaskBase* ex_next_renew(void); |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
116 |
184 | 117 |
118 //--- User API --- | |
194 | 119 int get_cpuid(void); |
120 | |
109 | 121 void* get_input(void *buff, int index); |
122 void* get_output(void *buff, int index); | |
182
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
123 uint32 get_inputAddr(int index); |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
124 uint32 get_outputAddr(int index); |
184 | 125 int get_inputSize(int index); |
126 int get_outputSize(int index); | |
109 | 127 int get_param(int index); |
128 | |
129 TaskPtr create_task(int cmd); | |
130 void wait_task(TaskPtr waitTask); | |
131 | |
132 void* global_alloc(int id, int size); | |
133 void* global_get(int id); | |
134 void global_free(int id); | |
135 | |
136 void mainMem_alloc(int id, int size); | |
137 void mainMem_wait(void); | |
138 void* mainMem_get(int id); | |
139 | |
140 void *allocate(int size); | |
141 | |
142 void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); | |
143 void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask); | |
144 void dma_wait(uint32 mask); | |
145 | |
146 class STaskManager { | |
147 public: | |
148 STaskManager(SchedTask *_t) { | |
149 outer = _t; | |
150 } | |
151 | |
152 BASE_NEW_DELETE(STaskManager); | |
153 | |
154 SchedTask *outer; | |
155 | |
194 | 156 int get_cpuid(void) { |
157 return outer->get_cpuid(); | |
158 } | |
159 | |
109 | 160 void* get_input(int index) { |
161 return outer->get_input(outer->__readbuf, index); | |
162 } | |
163 | |
164 void* get_output(int index) { | |
165 return outer->get_output(outer->__writebuf, index); | |
166 } | |
167 | |
182
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
168 uint32 get_inputAddr(int index) { |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
169 return outer->get_inputAddr(index); |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
170 } |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
171 |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
172 uint32 get_outputAddr(int index) { |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
173 return outer->get_outputAddr(index); |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
174 } |
df3cfc04e796
add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
180
diff
changeset
|
175 |
184 | 176 uint32 get_inputSize(int index) { |
177 return outer->get_inputSize(index); | |
178 } | |
179 | |
180 uint32 get_outputSize(int index) { | |
181 return outer->get_outputSize(index); | |
182 } | |
183 | |
109 | 184 int get_param(int index) { |
185 return outer->get_param(index); | |
186 } | |
187 | |
188 TaskPtr create_task(int cmd) { | |
189 return outer->create_task(cmd); | |
190 } | |
191 | |
192 void wait_task(TaskPtr waitTask) { | |
193 outer->wait_task(waitTask); | |
194 } | |
195 | |
196 void* global_alloc(int id, int size) { | |
197 return outer->global_alloc(id, size); | |
198 } | |
199 | |
200 void* global_get(int id) { | |
201 return outer->global_get(id); | |
202 } | |
203 | |
204 void global_free(int id) { | |
205 outer->global_free(id); | |
206 } | |
207 | |
208 void mainMem_alloc(int id, int size) { | |
209 outer->mainMem_alloc(id, size); | |
210 } | |
211 | |
212 void mainMem_wait(void) { | |
213 outer->mainMem_wait(); | |
214 } | |
215 | |
216 void* mainMem_get(int id) { | |
217 return outer->mainMem_get(id); | |
218 } | |
219 | |
220 void *allocate(int size) { | |
221 return outer->allocate(size); | |
222 } | |
223 | |
224 void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) { | |
225 outer->dma_load(buf, addr, size, mask); | |
226 } | |
227 | |
228 void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) { | |
229 outer->dma_store(buf, addr, size, mask); | |
230 } | |
231 | |
232 void dma_wait(uint32 mask) { | |
233 outer->dma_wait(mask); | |
234 } | |
235 }; | |
236 | |
237 STaskManager *smanager; | |
42 | 238 }; |
239 | |
184 | 240 const int SCHED_TASK_NORMAL = 0; |
241 const int SCHED_TASK_RENEW = 1; | |
242 | |
42 | 243 #endif |
109 | 244 |
184 | 245 extern SchedTask* createSchedTask(TaskPtr); |