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
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_BASE
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
2 #define INCLUDED_SCHED_TASK_BASE
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
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
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
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
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
13
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
14 class SchedTaskBase {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
15 public:
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
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
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
22
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 42
diff changeset
23 BASE_NEW_DELETE(SchedTaskBase);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 42
diff changeset
24
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
25 // noaction in default
798
2d919c3201f2 virtual clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
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
4a0022cd23fc add forgotten virutal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 798
diff changeset
30 virtual SchedTaskBase* next(Scheduler *, SchedTaskBase*) {return 0;}
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
31
1102
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
32 virtual void setup_outputData() {};
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
33
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
34 /* functions */
799
4a0022cd23fc add forgotten virutal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 798
diff changeset
35 virtual void* get_output(void *buff, int index) { return 0; }
798
2d919c3201f2 virtual clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
36 virtual void* get_input(void *buff, int index) { return 0;}
2d919c3201f2 virtual clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
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
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
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
2d919c3201f2 virtual clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
78
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
79 /* variables */
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
80
797
1db779ac0268 SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 776
diff changeset
81 // SchedTask は、すべて同じ大きさであるべきなので、継承するクラスには、
798
2d919c3201f2 virtual clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
82 // 変数を置かない。ここに、すべて置く。virtual も含めて。
797
1db779ac0268 SchedTask instance variable clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 776
diff changeset
83
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
84 // Task を実行するスケジューラ自身
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
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
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
89
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
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
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
93
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
94 // 現在スケジューラが実行している TaskList と、このタスクに対応する Task
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
95 TaskListPtr list;
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
96 // Task の、Tasklist での位置。(task = &list[cur_index-1])
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
97 int cur_index;
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
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
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
123
899
1b9418af3127 minor fix..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 895
diff changeset
124 } ;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
125
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
126 #endif