annotate TaskManager/kernel/ppe/HTask.h @ 787:5df90e02e34f

fix Bulk
author yutaka@localhost.localdomain
date Sat, 24 Apr 2010 17:25:46 +0900
parents c42cab5ad4c3
children 821ab210cafa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #ifndef INCLUDED_HTASK
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #define INCLUDED_HTASK
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3
307
7075842aa155 clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
4 #include "base.h"
7075842aa155 clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
5 #include "types.h"
7075842aa155 clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
6 #include "Task.h"
7075842aa155 clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 293
diff changeset
7 #include "TaskQueueInfo.h"
787
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
8 #include <stdio.h>
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 class TaskManagerImpl;
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 499
diff changeset
11 class SchedTask;
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 499
diff changeset
12
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
13 typedef void (*PostFunction)(SchedTask *s, void *read, void *write);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14
293
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
15 /*!
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
16 @class
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
17
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
18 @brief
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
19
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
20 Cerium の Task で、spawn() でキューに格納されて順次実行される。
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
21 cpu の指定があれば並列に実行される。
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
22 特定の Task を待ち合わせる事が可能。
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
23 Task の入出力は dma などで copy される。
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
24 */
683
9a6cb2439593 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 682
diff changeset
25
9a6cb2439593 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 682
diff changeset
26 #include "SimpleTask.h"
9a6cb2439593 on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 682
diff changeset
27
641
0692b08f1cd6 Regression on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
28 class HTask : public SimpleTask {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 public:
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 BASE_NEW_DELETE(HTask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31
479
5bda98b0b56d Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 397
diff changeset
32 TaskQueueInfo *wait_me; // List of task waiting for me
5bda98b0b56d Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 397
diff changeset
33 TaskQueueInfo *wait_i; // List of task for which I am waiting
518
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
34 PostFunction post_func;
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 499
diff changeset
35 void *post_arg1;
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 499
diff changeset
36 void *post_arg2;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 CPU_TYPE cpu_type;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38 TaskManagerImpl *mimpl;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39
498
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 480
diff changeset
40 HTask *waiter;
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 480
diff changeset
41 HTask *next;
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 480
diff changeset
42 HTask *prev;
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 480
diff changeset
43
684
458a1ad91427 Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 683
diff changeset
44 void spawn();
293
9f4f99d459aa add wait_for document
e065746@localhost.localdomain
parents: 109
diff changeset
45 void wait_for(HTask *);
397
a4f690f44842 delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
46 void set_cpu(CPU_TYPE type);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 499
diff changeset
47 void set_post(PostFunction func, void *read, void *write);
700
d3afc8777daa fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 684
diff changeset
48 Task *create_task_array(int task_id, int num_task, int num_param, int num_inData, int num_outData);
d3afc8777daa fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 684
diff changeset
49 Task *next_task_array(int task_id, Task *t);
d3afc8777daa fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 684
diff changeset
50 void spawn_task_array(Task *t);
703
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
51
714
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
52
713
f725c6455d19 remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
53 private:
703
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
54
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
55 int param_index;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
56 int in_index;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
57 int out_index;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
58
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
59 // compatibility
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
60 public: // functions
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
61 void add_inData_t(memaddr addr, int size) {
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
62 Task *t = (Task*)rbuf;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
63 t->set_inData_t(in_index++, addr,size);
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
64 }
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
65 void add_outData_t(memaddr addr, int size) {
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
66 Task *t = (Task*)rbuf;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
67 t->set_outData_t(out_index++, addr,size);
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
68 }
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
69 void set_inData_t(int index, memaddr addr, int size) {
787
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
70 if ((unsigned long)addr&0xf) {
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
71 printf("inData is not aligned. command = %d, index = %d, addr = 0x%lx, size = %d\n",
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
72 command, index, (unsigned long)addr, size);
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
73 }
703
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
74 Task *t = (Task*)rbuf;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
75 t->set_inData_t(index, addr,size);
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
76 }
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
77 void set_outData_t(int index, memaddr addr, int size) {
787
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
78 if ((unsigned long)addr&0xf) {
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
79 printf("inData is not aligned. command = %d, index = %d, addr = 0x%lx, size = %d\n",
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
80 command, index, (unsigned long)addr, size);
5df90e02e34f fix Bulk
yutaka@localhost.localdomain
parents: 714
diff changeset
81 }
703
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
82 Task *t = (Task*)rbuf;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
83 t->set_inData_t(index, addr,size);
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
84 }
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
85 void add_param_t(memaddr param) {
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
86 Task *t = (Task*)rbuf;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
87 t->set_param_t(param_index++, param);
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
88 }
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
89 void set_param_t(int index, memaddr param) {
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
90 Task *t = (Task*)rbuf;
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
91 t->set_param_t(index, param);
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
92 }
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
93
714
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
94 void init(int cmd) {
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
95 next = prev = NULL;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
96 waiter = NULL;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
97
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
98 command = cmd;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
99 param_index = 0;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
100 in_index = 0;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
101 out_index = 0;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
102 self = (memaddr) this;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
103
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
104 post_func = NULL;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
105 mimpl = NULL;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
106 cpu_type = CPU_PPE;
c42cab5ad4c3 HTask fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 713
diff changeset
107 }
703
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
108 #define add_param(param) add_param_t((memaddr)(param))
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
109 #define set_param(index,param) set_param_t(index, (memaddr) (param))
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
110
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
111 #define add_inData(addr, size) \
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
112 add_inData_t((memaddr)(addr), (size));
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
113 #define add_outData(addr, size) \
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
114 add_outData_t((memaddr)(addr), (size));
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
115
61b59376aec5 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 700
diff changeset
116
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
117 };
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
118
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
119 typedef HTask* HTaskPtr;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
120
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
121 #endif