annotate TaskManager/kernel/schedule/SchedTask.h @ 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
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
1 #ifndef INCLUDED_SCHED_TASK
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
2 #define INCLUDED_SCHED_TASK
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
3
466
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
4 #include <stdio.h>
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
5 #include <stdlib.h>
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
6 #include "base.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
7 #include "Scheduler.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
8 #include "SchedTaskBase.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
9 #include "ListData.h"
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
10 #include "TaskGroup.h"
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
11 #include "MemList.h"
518
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
12 #include "HTask.h"
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
13
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
14 class SchedTask : public SchedTaskBase {
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
15 public:
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
16 /* constructor */
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
17 SchedTask();
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
18 virtual ~SchedTask();
88
504899860e66 *** empty log message ***
gongo
parents: 82
diff changeset
19
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
20 BASE_NEW_DELETE(SchedTask);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
21
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
22 private:
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
23 /* variables */
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
24
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
25 // Task を実行するスケジューラ自身
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
26 Scheduler *scheduler;
395
8c5fa57128cb chain on SPE
game@localhost.localdomain
parents: 387
diff changeset
27
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
28 // 現在スケジューラが実行している TaskList と、このタスクに対応する Task
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
29 TaskListPtr list;
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
30 TaskPtr task;
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
31
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
32 /**
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
33 * read データ、write 用のバッファ
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
34 * readbuf には タスク登録時に設定した入力データが入っている。
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
35 * writebuf にデータを描き込んでおくと、
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
36 * タスク登録時に設定した出力先に書き込む
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
37 */
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
38 int rsize;
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
39 void *readbuf;
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
40 int wsize;
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
41 void *writebuf;
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
42
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
43 // Task の、Tasklist での位置。(task = &list[cur_index-1])
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
44 int cur_index;
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
45
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
46 /* functions */
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
47
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
48 // override
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
49 void read();
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
50 void exec();
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
51 void write();
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
52 SchedTaskBase* next(Scheduler *, SchedTaskBase *);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
53
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
54 // タスクの処理は、task_list に登録された C の関数によっておこなう
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
55
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
56 //--- System API ---
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
57 SchedTask* get_nextTask(TaskListPtr list);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
58
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
59
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
60 public:
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
61 /* functions */
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
62
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
63 void spwan(HTask *task);
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
64
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
65 void init(TaskListPtr _list, TaskPtr _task, int index,
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
66 // ListDataPtr rbuf, ListDataPtr wbuf,
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
67 Scheduler* sc);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
68
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
69 //--- User API ---
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
70 int get_cpuid();
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
71
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
72 void* get_input(void *buff, int index);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
73 void* get_output(void *buff, int index);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
74 uint32 get_inputAddr(int index);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
75 uint32 get_outputAddr(int index);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
76 // 書き出しを追加する API がない...
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
77 int get_inputSize(int index);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
78 int get_outputSize(int index);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
79 int get_param(int index);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
80
518
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
81 void set_post(PostFunction func,void *read, void *write);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
82
519
5c76db2a07fa continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 518
diff changeset
83 HTaskPtr create_task(int cmd);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
84
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
85 void* global_alloc(int id, int size);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
86 void* global_get(int id);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
87 void global_set(int id, void *addr);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
88 void global_free(int id);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
89 MemList* createMemList(int size, int count);
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
90
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
91 void mainMem_alloc(int id, int size);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
92 void mainMem_wait();
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
93 void* mainMem_get(int id);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
94
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
95 MemorySegment * get_segment(memaddr addr, MemList *m);
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
96 uint32 get_tag();
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
97 void put_segment(MemorySegment *s);
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
98 void wait_segment(MemorySegment *s);
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
99
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
100
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
101
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
102 void *allocate(int size);
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
103 void free_(void *p) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
104 scheduler->free_(p);
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
105 }
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
106
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
107 /* これは禁止するべき */
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
108 void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
109 void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask);
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
110 void dma_wait(uint32 mask);
334
20f2459041cb [in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents: 316
diff changeset
111 void show_dma_wait();
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
112
310
c59d8927c4d1 remove smanager
e065746@localhost.localdomain
parents: 308
diff changeset
113 /*!
c59d8927c4d1 remove smanager
e065746@localhost.localdomain
parents: 308
diff changeset
114 SPU用の get_input, get_output
c59d8927c4d1 remove smanager
e065746@localhost.localdomain
parents: 308
diff changeset
115 */
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
116
310
c59d8927c4d1 remove smanager
e065746@localhost.localdomain
parents: 308
diff changeset
117 void* get_input(int index) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
118 return get_input(readbuf, index);
310
c59d8927c4d1 remove smanager
e065746@localhost.localdomain
parents: 308
diff changeset
119 }
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
120
310
c59d8927c4d1 remove smanager
e065746@localhost.localdomain
parents: 308
diff changeset
121 void* get_output(int index) {
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
122 return get_output(writebuf, index);
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 366
diff changeset
123 }
466
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
124
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
125 /* system call */
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
126
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
127 FILE *stdout_;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
128 FILE *stderr_;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
129 FILE *stdin_;
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
130 int fprintf(FILE * stream, const char * format, ...);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
131 int printf(const char * format, ...);
4fa8760e18c2 prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
132
302
b0d37afab06a working on macosx
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 301
diff changeset
133 };
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
134
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
135
403
8611780d479f clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
136 extern SchedTask* createSchedTask(Scheduler *,TaskPtr);
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
137 extern void loadSchedTask(Scheduler *scheduler,TaskPtr task);
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
138
302
b0d37afab06a working on macosx
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 301
diff changeset
139
b0d37afab06a working on macosx
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 301
diff changeset
140 #endif
308
2ac66db4dd11 remove SchedTaskImpl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 306
diff changeset
141