Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/schedule/SchedTaskBase.h @ 1213:a49c02dffe6f draft
DMA connector reogranization
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Jul 2011 13:25:30 +0900 |
parents | 801d57ae1e29 |
children | ff721740df6b |
rev | line source |
---|---|
42 | 1 #ifndef INCLUDED_SCHED_TASK_BASE |
2 #define INCLUDED_SCHED_TASK_BASE | |
3 | |
301
7f991471d43f
remove deprecated source. not work.
tkaito@localhost.localdomain
parents:
109
diff
changeset
|
4 #include "base.h" |
1142
801d57ae1e29
cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents:
1102
diff
changeset
|
5 //#include <stdio.h> |
797
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
6 #include <stdlib.h> |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
7 |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
799
diff
changeset
|
8 class TaskManagerImpl; |
42 | 9 class Scheduler; |
916
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
10 class MemorySegment; |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
11 class MemList; |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
918
diff
changeset
|
12 class HTask; |
42 | 13 |
14 class SchedTaskBase { | |
15 public: | |
16 /* constructor */ | |
776
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
17 // void *called ; // for debug |
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
18 SchedTaskBase() { |
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
19 // called = __builtin_return_address(1); |
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
20 } |
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
21 virtual ~SchedTaskBase() {} |
42 | 22 |
109 | 23 BASE_NEW_DELETE(SchedTaskBase); |
24 | |
42 | 25 // noaction in default |
798 | 26 // virtual void load() {} |
776
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
27 virtual void read() {} |
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
28 virtual void exec() {} |
922c0133c61c
heap corruption in TaskArray1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
713
diff
changeset
|
29 virtual void write() {} |
799 | 30 virtual SchedTaskBase* next(Scheduler *, SchedTaskBase*) {return 0;} |
42 | 31 |
1102 | 32 virtual void setup_outputData() {}; |
33 | |
42 | 34 /* functions */ |
799 | 35 virtual void* get_output(void *buff, int index) { return 0; } |
798 | 36 virtual void* get_input(void *buff, int index) { return 0;} |
37 virtual memaddr get_param(int index) { return 0;} | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
799
diff
changeset
|
38 virtual int read_size() { return 0;} |
916
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
39 virtual int printf(const char * format, ...) {return 0;}; |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
40 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
41 virtual memaddr get_inputAddr(int index) {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
42 virtual memaddr get_outputAddr(int index) {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
43 virtual int get_inputSize(int index) {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
44 virtual int get_outputSize(int index) {return 0;} |
1102 | 45 virtual void set_outputSize(int index, int size) {}; |
916
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
46 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
47 virtual int get_cpuid() {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
48 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
49 virtual void* global_alloc(int id, int size) {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
50 virtual void* global_get(int id) {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
51 virtual void global_set(int id, void *addr) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
52 virtual void global_free(int id) {} |
918
e66a08b5cd83
add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
916
diff
changeset
|
53 virtual MemList* createMemList(int size, int count) {return 0;} |
916
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
54 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
55 virtual void mainMem_alloc(int id, int size) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
56 virtual void mainMem_wait() {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
57 virtual memaddr mainMem_get(int id) {return 0; } |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
58 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
59 virtual MemorySegment * get_segment(memaddr addr, MemList *m) {return 0; } |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
60 virtual void put_segment(MemorySegment *s) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
61 virtual void wait_segment(MemorySegment *s) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
62 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
63 virtual void *allocate(int size) {return 0; } |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
64 virtual void free_(void *p) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
65 // virtual void polling(); |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
66 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
67 /* これは禁止するべき */ |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
68 virtual void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
69 virtual void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
70 virtual void dma_wait(uint32 mask) {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
71 |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
72 virtual void show_dma_wait() {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
73 virtual void start_profile() {} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
74 virtual void* allocate(int size,int align) {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
75 virtual Scheduler* get_scheduler() {return 0;} |
deed1449a5f4
make SchedTask API virtual (for relocation)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
76 virtual long get_random() {return 0;} |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
918
diff
changeset
|
77 virtual void free_htask(HTask *h) {} |
798 | 78 |
708 | 79 /* variables */ |
80 | |
797
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
81 // SchedTask は、すべて同じ大きさであるべきなので、継承するクラスには、 |
798 | 82 // 変数を置かない。ここに、すべて置く。virtual も含めて。 |
797
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
83 |
708 | 84 // Task を実行するスケジューラ自身 |
85 Scheduler *scheduler; | |
800
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
799
diff
changeset
|
86 // Task を作成管理するマネージャー |
54f0180cea0f
run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
799
diff
changeset
|
87 TaskManagerImpl *manager; |
1213
a49c02dffe6f
DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1142
diff
changeset
|
88 DmaManager* connector; |
708 | 89 |
90 SimpleTaskPtr task; | |
797
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
91 TaskPtr atask; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
92 SchedTaskBase *savedTask; |
708 | 93 |
94 // 現在スケジューラが実行している TaskList と、このタスクに対応する Task | |
95 TaskListPtr list; | |
96 // Task の、Tasklist での位置。(task = &list[cur_index-1]) | |
97 int cur_index; | |
98 | |
970
1a4849b2acad
change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
99 int tag; |
1a4849b2acad
change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
941
diff
changeset
|
100 |
797
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
101 memaddr params_addr; |
888
b6c45005a3bc
call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
800
diff
changeset
|
102 memaddr waiter; |
890
a5ccf763fc3f
minor fix. possible schedTaskArray overrun
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
889
diff
changeset
|
103 Task *array; |
797
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
104 |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
105 /** |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
106 * read データ、write 用のバッファ |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
107 * readbuf には タスク登録時に設定した入力データが入っている。 |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
108 * writebuf にデータを描き込んでおくと、 |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
109 * タスク登録時に設定した出力先に書き込む |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
110 */ |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
111 void *readbuf; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
112 void *writebuf; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
113 |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
114 /* system call */ |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
115 |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
116 FILE *stdout_; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
117 FILE *stderr_; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
118 FILE *stdin_; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
119 |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
120 // Task Array しか使わないが、たいした大きさではないのでいいか... |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
121 ListData inListData; |
1db779ac0268
SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
776
diff
changeset
|
122 ListData outListData; |
708 | 123 |
899 | 124 } ; |
42 | 125 |
126 #endif |