Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/ppe/HTask.h @ 1479:163220e54cc0 draft
remove hard code for TaskLog
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Jul 2012 17:15:15 +0900 |
parents | b158873485f6 |
children | a7895ab4d0e3 |
rev | line source |
---|---|
109 | 1 #ifndef INCLUDED_HTASK |
2 #define INCLUDED_HTASK | |
3 | |
307 | 4 #include "base.h" |
5 #include "types.h" | |
6 #include "Task.h" | |
1462
8cf62aea798f
HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1425
diff
changeset
|
7 #include "TaskList.h" |
955 | 8 #include "TaskQueue.h" |
9 #include "QueueInfo.h" | |
1423
515a0f15b5d2
add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
1412
diff
changeset
|
10 #include "TaskLog.h" |
1142
801d57ae1e29
cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents:
1110
diff
changeset
|
11 //#include <stdio.h> |
109 | 12 |
13 class TaskManagerImpl; | |
539 | 14 class SchedTask; |
15 | |
547 | 16 typedef void (*PostFunction)(SchedTask *s, void *read, void *write); |
109 | 17 |
956
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
18 extern QueueInfo<TaskQueue>* taskQueuePool; |
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
19 |
293 | 20 /*! |
21 @class | |
22 | |
23 @brief | |
24 | |
25 Cerium の Task で、spawn() でキューに格納されて順次実行される。 | |
26 cpu の指定があれば並列に実行される。 | |
27 特定の Task を待ち合わせる事が可能。 | |
28 Task の入出力は dma などで copy される。 | |
29 */ | |
688 | 30 |
31 #include "SimpleTask.h" | |
32 | |
641
0605f27ba7d9
Regression on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
634
diff
changeset
|
33 class HTask : public SimpleTask { |
109 | 34 public: |
35 BASE_NEW_DELETE(HTask); | |
36 | |
955 | 37 QueueInfo<TaskQueue> *wait_me; // List of task waiting for me |
38 QueueInfo<TaskQueue> *wait_i; // List of task for which I am waiting | |
546 | 39 PostFunction post_func; |
539 | 40 void *post_arg1; |
41 void *post_arg2; | |
109 | 42 CPU_TYPE cpu_type; |
43 TaskManagerImpl *mimpl; | |
1466 | 44 TaskPtr last; |
109 | 45 |
1479
163220e54cc0
remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
1474
diff
changeset
|
46 int export_task_log; |
1423
515a0f15b5d2
add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
1412
diff
changeset
|
47 TaskLog *tasklog; |
515a0f15b5d2
add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
1412
diff
changeset
|
48 |
498
bce667ff20b9
double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
480
diff
changeset
|
49 HTask *waiter; |
bce667ff20b9
double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
480
diff
changeset
|
50 HTask *next; |
bce667ff20b9
double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
480
diff
changeset
|
51 HTask *prev; |
bce667ff20b9
double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
480
diff
changeset
|
52 |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
53 struct { |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
54 unsigned no_auto_free:1; // bit 0 auto free flag (0 .. auto, 1 manual) |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
55 } flag; |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
56 |
689
ecf63089f5bb
Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
688
diff
changeset
|
57 void spawn(); |
293 | 58 void wait_for(HTask *); |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
366
diff
changeset
|
59 void set_cpu(CPU_TYPE type); |
539 | 60 void set_post(PostFunction func, void *read, void *write); |
700 | 61 Task *create_task_array(int task_id, int num_task, int num_param, int num_inData, int num_outData); |
62 Task *next_task_array(int task_id, Task *t); | |
1425 | 63 Task *next_task_array(int id, Task *t, int param_count, int inData_count, int outData_count); |
700 | 64 void spawn_task_array(Task *t); |
703 | 65 |
955 | 66 HTask *init(int cmd, memaddr rbuf, int rs, memaddr wbuf, int ws) { |
67 init(cmd); | |
68 set_input(rbuf, rs); | |
69 set_output(wbuf, ws); | |
70 return this; | |
71 } | |
714 | 72 |
956
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
73 void initOnce() { |
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
74 wait_me = new QueueInfo<TaskQueue>(taskQueuePool); |
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
75 wait_i = new QueueInfo<TaskQueue>(taskQueuePool); |
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
76 } |
197b7e19a345
unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
955
diff
changeset
|
77 |
958 | 78 void freeOnce() { |
79 delete wait_me; | |
80 delete wait_i; | |
81 } | |
82 | |
713
97adb3fe85c6
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
703
diff
changeset
|
83 private: |
703 | 84 |
85 // compatibility | |
86 public: // functions | |
87 void set_inData_t(int index, memaddr addr, int size) { | |
949 | 88 #ifdef EARLY_TOUCH |
89 if ((unsigned long)addr&0xf) { | |
787 | 90 printf("inData is not aligned. command = %d, index = %d, addr = 0x%lx, size = %d\n", |
91 command, index, (unsigned long)addr, size); | |
92 } | |
949 | 93 char *p = (char *)addr; char b = *p; |
94 p = (char *)(addr+size-1); b += *p; | |
95 #endif | |
1462
8cf62aea798f
HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1425
diff
changeset
|
96 Task *t = ((TaskList*)rbuf)->tasks; |
703 | 97 t->set_inData_t(index, addr,size); |
98 } | |
99 void set_outData_t(int index, memaddr addr, int size) { | |
949 | 100 #ifdef EARLY_TOUCH |
101 if ((unsigned long)addr&0xf) { | |
787 | 102 printf("inData is not aligned. command = %d, index = %d, addr = 0x%lx, size = %d\n", |
103 command, index, (unsigned long)addr, size); | |
104 } | |
949 | 105 char *p = (char *)addr; char b = *p; |
106 p = (char *)(addr+size-1); b += *p; | |
107 #endif | |
1462
8cf62aea798f
HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1425
diff
changeset
|
108 Task *t = ((TaskList*)rbuf)->tasks; |
788 | 109 t->set_outData_t(index, addr,size); |
703 | 110 } |
111 void set_param_t(int index, memaddr param) { | |
1474 | 112 Task *t = ((TaskList*)rbuf)->tasks; |
113 t->set_param_t(index, param); | |
703 | 114 } |
115 | |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
116 void no_auto_free() { |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
117 flag.no_auto_free = 1; |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
118 } |
954 | 119 void auto_free() { |
120 flag.no_auto_free = 0; | |
121 } | |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
122 |
955 | 123 void init() { |
714 | 124 next = prev = NULL; |
125 waiter = NULL; | |
955 | 126 } |
714 | 127 |
955 | 128 void init(int cmd) { |
714 | 129 command = cmd; |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
130 flag.no_auto_free = 0; |
714 | 131 self = (memaddr) this; |
132 | |
133 post_func = NULL; | |
134 mimpl = NULL; | |
135 cpu_type = CPU_PPE; | |
1089 | 136 |
137 post_arg1 = NULL; | |
138 post_arg2 = NULL; | |
714 | 139 } |
703 | 140 #define set_param(index,param) set_param_t(index, (memaddr) (param)) |
141 | |
895
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
788
diff
changeset
|
142 } __attribute__ ((aligned (DEFAULT_ALIGNMENT))); |
109 | 143 |
144 typedef HTask* HTaskPtr; | |
145 | |
146 #endif |