annotate TaskManager/kernel/schedule/SchedTask.cc @ 519:5c76db2a07fa

continue..
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 20 Oct 2009 20:34:47 +0900
parents 125a72948e44
children 47b61865ea8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
1 #include <stdlib.h>
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
2 #include <string.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
3 #include "SchedTask.h"
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
4 #include "SchedTaskList.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
5 #include "SchedNop2Ready.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
6 #include "DmaManager.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
7 #include "error.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
8 #include "TaskManager.h"
466
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
9 #include <stdarg.h>
180
5cde66c926b4 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 109
diff changeset
10
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
11 extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT];
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
12
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
13 /**
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
14 Task Object を作る
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
15 */
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
16
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
17
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
18 SchedTask *
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
19 createSchedTask(Scheduler *scheduler, TaskPtr task)
302
b0d37afab06a working on macosx
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 301
diff changeset
20 {
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
21 return new SchedTask();
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
22 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
23
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
24
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
25 /**
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
26 code load を始める。既に get_segment hash に入っていれば何もしない。
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
27 最初の一回は SchedTaskList:: next から呼ばれる。
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
28 この段階では、SchedTask object は、まだ作られてない。
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
29 */
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
30 void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
31 loadSchedTask(Scheduler *scheduler,TaskPtr task)
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
32 {
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
33 // fprintf(stderr,"loadSchedTask %d\n",task->command);
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
34 task_list[task->command].load(scheduler,task->command);
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
35 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
36
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
37
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
38 SchedTask::SchedTask()
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
39 {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
40 list = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
41 task = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
42 inListData = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
43 outListData = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
44 readbuf = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
45 writebuf = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
46 scheduler = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
47 taskGroup = NULL;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
48 renew_flag = 0;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
49 cur_index = 0;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
50 flag_renewTask = SCHED_TASK_NORMAL;
466
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
51 this->stdout_ = stdout;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
52 this->stderr_ = stderr;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
53 this->stdin_ = stdin;
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
54
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
55 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
56
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
57 /**
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
58 * dma_store の wait を行う
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
59 */
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
60 SchedTask::~SchedTask()
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
61 {
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
62 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
63
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
64
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
65 void
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
66 SchedTask::init(TaskListPtr _list, TaskPtr _task, int index,
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 499
diff changeset
67 Scheduler* sc)
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
68 {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
69 list = _list;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
70 task = _task;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
71 scheduler = sc;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
72 cur_index = index;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
73 scheduler->mainMem_wait();
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
74
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
75 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
76
502
36b323130b1b Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
77 void
36b323130b1b Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
78 SchedTask::read()
36b323130b1b Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
79 {
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
80 __debug("[SchedTask:%s]\n", __FUNCTION__);
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
81
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
82 // object creation をSchedTask生成時にやらないので、
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
83 // exec の直前のread で十分に間に合う
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
84 // next task の load
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
85 loadSchedTask(scheduler, &list->tasks[cur_index]);
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
86 writebuf = scheduler->allocate(wsize);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
87
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
88 // 読むデータが一つもなければ無視
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
89 if (rsize == 0) return;
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
90
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
91 // load Input Data
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
92 readbuf = scheduler->allocate(rsize);
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
93 read_tag = get_tag();
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
94 scheduler->dma_load(readbuf, rsize, read_tag);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 502
diff changeset
95
502
36b323130b1b Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
96 }
36b323130b1b Renew Task addInData (not yet worked).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
97
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
98
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
99 void
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
100 SchedTask::exec()
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
101 {
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
102 __debug("[SchedTask:%s]\n", __FUNCTION__);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
103
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
104 scheduler->dma_wait(read_tag);
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
105 task_list[task->command].wait(scheduler,task->command);
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
106 task_list[task->command].run(this, readbuf, writebuf);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
107
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
108 free(readbuf);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
109
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
110 // 書き込む領域がなければ無視
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
111 if (wsize->length > 0) {
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
112 write_tag = get_tag();
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
113 scheduler->dma_store(writebuf, wsize, write_tag);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
114 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
115 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
116
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
117 void
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
118 SchedTask::write()
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
119 {
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
120 __debug("[SchedTask:%s]\n", __FUNCTION__);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
121
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
122 scheduler->dma_wait(write_tag);
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
123 free(writebuf);
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
124 (*post_func)(this,0,0);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
125 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
126
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
127
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
128 SchedTaskBase*
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
129 SchedTask::next(Scheduler *scheduler, SchedTaskBase *p)
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
130 {
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
131 __debug("[SchedTask:%s]\n", __FUNCTION__);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
132
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
133 TaskPtr nextTask = (Task*)activeQueue.poll();
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
134 if (nextTask) {
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
135 SchedTask *nextSched = createSchedTask(scheduler, nextTask);
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
136 nextSched->init(list, nextTask, cur_index, scheduler);
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
137 return nextSched;
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
138 } else {
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
139 return new SchedNop2Ready(scheduler);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
140 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
141 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
142
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
143
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
144 int
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
145 SchedTask::get_cpuid()
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
146 {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
147 return scheduler->id;
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
148 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
149
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
150
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
151 int
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
152 SchedTask::get_param(int index)
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
153 {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
154 return task->param[index];
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
155 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
156
518
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
157 HTaskPtr
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
158 SchedTask::create_task(int cmd)
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
159 {
518
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
160 HTaskPtr htask = scheduler->create_task(cmd);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
161 return p;
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
162 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
163
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
164 /**
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
165 *
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
166 * @param[in] waitTask タスク内で生成したタスクの登録(spawn()に相当)
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
167 */
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
168 void
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
169 SchedTask::spawn(HTaskPtr task)
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
170 {
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
171 activeQueue.addFirst(task);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
172 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
173
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
174 void*
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
175 SchedTask::global_alloc(int id, int size) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
176 return scheduler->global_alloc(id, size);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
177 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
178
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
179 void*
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
180 SchedTask::global_get(int id) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
181 return scheduler->global_get(id);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
182 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
183
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
184 void
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
185 SchedTask::global_set(int id, void *addr) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
186 scheduler->global_set(id, addr);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
187 }
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
188
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
189 void
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
190 SchedTask::global_free(int id) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
191 scheduler->global_free(id);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
192 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
193
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
194 MemList*
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
195 SchedTask::createMemList(int size, int count) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
196 return scheduler->createMemList(size, count);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
197 }
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
198
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
199 void
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
200 SchedTask::mainMem_alloc(int id, int size) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
201 scheduler->mainMem_alloc(id, size);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
202 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
203
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
204 void
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
205 SchedTask::mainMem_wait() {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
206 scheduler->mainMem_wait();
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
207 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
208
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
209 void*
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
210 SchedTask::mainMem_get(int id) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
211 return scheduler->mainMem_get(id);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
212 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
213
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
214 void*
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
215 SchedTask::allocate(int size) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
216 return scheduler->allocate(size);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
217 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
218
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
219
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
220 void
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
221 SchedTask::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
222 scheduler->dma_load(buf, addr, size, mask);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
223 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
224
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
225 void
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
226 SchedTask::dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
227 scheduler->dma_store(buf, addr, size, mask);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
228 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
229
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
230 void
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
231 SchedTask::dma_wait(uint32 mask) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
232 scheduler->dma_wait(mask);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
233 }
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
234
334
20f2459041cb [in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents: 321
diff changeset
235 void
20f2459041cb [in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents: 321
diff changeset
236 SchedTask::show_dma_wait() {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
237 scheduler->show_dma_wait();
334
20f2459041cb [in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents: 321
diff changeset
238 }
20f2459041cb [in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents: 321
diff changeset
239
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
240 MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
241 return scheduler->get_segment(addr,m);
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
242 }
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
243
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
244 void SchedTask::put_segment(MemorySegment *s) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
245 scheduler->put_segment(s);
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
246 }
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
247
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
248 void SchedTask::wait_segment(MemorySegment *s) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
249 scheduler->wait_segment(s);
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
250 }
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
251
466
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
252 /* system call */
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
253
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
254 int
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
255 SchedTask::fprintf(FILE * stream, const char * format, ...)
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
256 {
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
257 va_list ap;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
258 va_start(ap,format);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
259 int ret = vfprintf(stream,format, ap);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
260 va_end(ap);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
261 return ret;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
262 }
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
263
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
264 int
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
265 SchedTask::printf(const char * format, ...)
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
266 {
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
267 va_list ap;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
268 va_start(ap,format);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
269 int ret= vfprintf(stdout,format, ap);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
270 va_end(ap);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
271 return ret;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
272 }
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
273
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
274
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
275
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 302
diff changeset
276 /* end */