annotate TaskManager/kernel/schedule/SchedTaskArray.cc @ 708:d41c62201b1e draft

cleean up SchedTasks.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Dec 2009 10:49:30 +0900
parents b2b4a1243961
children 97adb3fe85c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "SchedTaskArray.h"
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
2 #include "Scheduler.h"
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
706
b2b4a1243961 no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
4 #ifdef SIMPLE_TASK
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
699
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
6 SchedTaskArray::SchedTaskArray(Scheduler *s, SchedTaskBase *savedTask_, Task *curTask_, Task *_array)
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 {
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 savedTask = savedTask_;
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
9 atask = curTask_;
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 array = _array;
699
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
11 scheduler = s;
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
13 inListData.bound = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
14 inListData.size = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
15 inListData.length = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
16 inListData.element = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
17 outListData.bound = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
18 outListData.size = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
19 outListData.length = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
20 outListData.element = 0;
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
21 }
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
22
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
23 /**
703
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
24 Constructor for old Task with ListData
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
25 next TaskList entry contains Task object.
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
26 savedTask->rbuf is 0, it has only one Task.
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
27 */
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
28
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
29 SchedTaskArray::SchedTaskArray(Scheduler *s, SchedTaskBase *savedTask_)
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
30 {
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
31 savedTask = savedTask_;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
32 scheduler = s;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
33
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
34 inListData.bound = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
35 inListData.size = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
36 inListData.length = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
37 inListData.element = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
38 outListData.bound = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
39 outListData.size = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
40 outListData.length = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
41 outListData.element = 0;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
42
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
43 atask = (TaskPtr)&savedTask->list->tasks[savedTask->cur_index];
704
ec6c897448ca Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
44 array = 0;
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
45 savedTask->cur_index += (atask->size()+sizeof(SimpleTask))/sizeof(SimpleTask);
703
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
46
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
47 }
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
48
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 701
diff changeset
49 /**
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
50 */
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
51 SchedTaskArray::~SchedTaskArray()
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
52 {
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
53 }
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
54
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
55 /**
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
56 * DMA buffer offset in rbuf
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
57 */
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
58 static void
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
59 bound(ListData *list)
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
60 {
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
61 ListElement *elm = list->element;
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
62 int *bound = list->bound;
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
63 int offset=0;
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
64 for(int i=0;i<list->length;i++) {
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
65 bound[i] = offset;
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
66 offset += elm[i].size;
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
67 }
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
70 /**
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
71 * Task data / code read
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
72 */
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 void
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 SchedTaskArray::read()
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 {
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 // object creation をSchedTaskArray生成時にやらないので、
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 // exec の直前のread で十分に間に合う
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
79 loadSchedTask(scheduler, atask->command);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 // 読むデータが一つもなければ無視
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
82 if (atask->inData_count == 0) return;
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
83
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
84 inListData.length = atask->inData_count;
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
85 inListData.size = atask->inData_total_size();
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
86 inListData.element = atask->inData(0);
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
87 inListData.bound = (int*)scheduler->allocate(inListData.length*sizeof(int));
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 // load Input Data
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
90 readbuf = scheduler->allocate(inListData.size);
701
44095db8cb61 Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
91 // inListData.print();
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
92 scheduler->dma_loadList(&inListData, readbuf, DMA_READ);
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
93 bound(&inListData);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
97 /**
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
98 * Wait read data and execute task
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
99 * Start write DMA
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
100 */
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 void
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 SchedTaskArray::exec()
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 {
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
105 if (atask->outData_count > 0) {
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
106 outListData.length = atask->outData_count;
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
107 outListData.size = atask->outData_total_size();
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
108 outListData.element = atask->outData(0);
699
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
109 outListData.bound = (int*)scheduler->allocate(outListData.length*sizeof(int));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
110 bound(&outListData);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
111
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
112 writebuf = scheduler->allocate(outListData.size);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
113 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 698
diff changeset
114
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 scheduler->dma_wait(DMA_READ);
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
116 task_list[atask->command].wait(scheduler,atask->command);
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
117 task_list[atask->command].run(this, readbuf, writebuf);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 free(readbuf);
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 // 書き込む領域がなければ無視
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
120
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
121 // User 側で作る方法が必要...
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
122
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
123 if (atask->outData_count > 0) {
701
44095db8cb61 Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
124 // outListData.print();
696
715bbf0955b5 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
125 scheduler->dma_storeList(&outListData, writebuf, DMA_WRITE);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
129 /**
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
130 * Wait write DMA
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
131 * send finish mail
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
132 */
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 void
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 SchedTaskArray::write()
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 {
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 scheduler->dma_wait(DMA_WRITE);
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 free(writebuf);
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
139 free(inListData.bound);
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
140 free(outListData.bound);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 // このTaskArrayは終り。終了を知らせる。
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
143 if (!array || atask->next() >= last()) {
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
144 SchedTask *s = (SchedTask *)savedTask;
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
145 scheduler->mail_write((memaddr)s->task->self);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 free(array);
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 Task *SchedTaskArray::last()
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 {
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
153 SchedTask *s = (SchedTask *)savedTask;
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
154 return (Task*)(((char*)array)+ s->read_size());
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
156
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 SchedTaskBase*
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
158 SchedTaskArray::next(Scheduler *scheduler, SchedTaskBase *p)
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 {
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
161 Task *next = atask->next();
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
162 if (next < last()) {
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 // Task List が残っているので、次を準備
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
164 return new SchedTaskArray(scheduler, savedTask, next, array);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 } else {
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 // このTaskArrayは終り。save していた Task の次を返す。
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 // savedTask の read/exec は実行されない (command = TaskArray)
697
4b6242d03512 TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 696
diff changeset
168 return savedTask->next(scheduler, savedTask);
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 }
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
174 /**
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
175 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
176 * buffer から対応するデータを返す。
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
177 */
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
178 void*
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
179 SchedTaskArray::get_input(void *buff, int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
180 {
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
181 return (void*)((char*)readbuf + inListData.bound[index]);
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
182 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
183
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
184 /**
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
185 * get_input(index) のアドレスを返す
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
186 */
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
187 memaddr
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
188 SchedTaskArray::get_inputAddr(int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
189 {
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
190 #ifdef __CERIUM_CELL__
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
191 return (memaddr)inListData.element[index].addr;
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
192 #else
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
193 return inListData.element[index].addr;
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
194 #endif
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
195 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
196
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
197 /**
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
198 * get_input(index) のサイズを返す
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
199 */
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
200 int
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
201 SchedTaskArray::get_inputSize(int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
202 {
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
203 return inListData.element[index].size;
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
204 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
205
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
206 /**
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
207 * write buffer の領域を返す。
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
208 */
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
209 void*
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
210 SchedTaskArray::get_output(void *buff, int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
211 {
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
212 return (void*)((char *)writebuf + outListData.bound[index]);
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
213 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
214
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
215 /**
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
216 * get_output(index) のアドレスを返す
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
217 */
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
218 memaddr
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
219 SchedTaskArray::get_outputAddr(int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
220 {
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
221 #ifdef __CERIUM_CELL__
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
222 return (memaddr)outListData.element[index].addr;
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
223 #else
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
224 return outListData.element[index].addr;
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
225 #endif
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
226 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
227
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
228 /**
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
229 * get_output(index) のサイズを返す
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
230 */
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
231 int
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
232 SchedTaskArray::get_outputSize(int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
233 {
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
234 return outListData.element[index].size;
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
235 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
236
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
237 memaddr
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
238 SchedTaskArray::get_param(int index)
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
239 {
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 706
diff changeset
240 return *atask->param(index);
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
241 }
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
242
706
b2b4a1243961 no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
243 #endif
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 697
diff changeset
244
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 /* end */