Mercurial > hg > Members > kono > Cerium
annotate TaskManager/kernel/schedule/SchedTask.h @ 629:8843edf37c0e
Cell 64 bit tried, but not yet worked.
Cell's list DMA is 32bit.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Nov 2009 13:32:58 +0900 |
parents | 60aa3f241b10 |
children | 0558abba673c |
rev | line source |
---|---|
42 | 1 #ifndef INCLUDED_SCHED_TASK |
2 #define INCLUDED_SCHED_TASK | |
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 | 6 #include "base.h" |
7 #include "Scheduler.h" | |
8 #include "SchedTaskBase.h" | |
9 #include "ListData.h" | |
619 | 10 #include "HTask.h" |
373 | 11 #include "MemList.h" |
109 | 12 |
308 | 13 class SchedTask : public SchedTaskBase { |
14 public: | |
109 | 15 /* constructor */ |
308 | 16 SchedTask(); |
17 virtual ~SchedTask(); | |
88 | 18 |
109 | 19 BASE_NEW_DELETE(SchedTask); |
42 | 20 |
308 | 21 private: |
22 /* variables */ | |
23 | |
24 // Task を実行するスケジューラ自身 | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
25 Scheduler *scheduler; |
395 | 26 |
308 | 27 // 現在スケジューラが実行している TaskList と、このタスクに対応する Task |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
28 TaskListPtr list; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
29 TaskPtr task; |
308 | 30 |
567 | 31 // read/write 用の ListData |
32 ListDataPtr inListData; | |
33 ListDataPtr outListData; | |
34 | |
308 | 35 /** |
36 * read データ、write 用のバッファ | |
37 * readbuf には タスク登録時に設定した入力データが入っている。 | |
38 * writebuf にデータを描き込んでおくと、 | |
39 * タスク登録時に設定した出力先に書き込む | |
40 */ | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
41 void *readbuf; |
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
42 void *writebuf; |
308 | 43 |
44 // 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
|
45 int cur_index; |
308 | 46 |
47 /* functions */ | |
48 | |
49 // override | |
50 void read(); | |
51 void exec(); | |
52 void write(); | |
53 SchedTaskBase* next(Scheduler *, SchedTaskBase *); | |
54 | |
464
01b321c86747
task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
463
diff
changeset
|
55 // タスクの処理は、task_list に登録された C の関数によっておこなう |
308 | 56 |
57 //--- System API --- | |
58 SchedTask* get_nextTask(TaskListPtr list); | |
373 | 59 |
308 | 60 |
61 public: | |
62 /* functions */ | |
63 | |
483
0b933bef0328
renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
64 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
|
65 // ListDataPtr rbuf, ListDataPtr wbuf, |
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
483
diff
changeset
|
66 Scheduler* sc); |
308 | 67 |
68 //--- User API --- | |
69 int get_cpuid(); | |
70 | |
71 void* get_input(void *buff, int index); | |
72 void* get_output(void *buff, int index); | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
73 memaddr get_inputAddr(int index); |
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
74 memaddr get_outputAddr(int index); |
506 | 75 // 書き出しを追加する API がない... |
308 | 76 int get_inputSize(int index); |
77 int get_outputSize(int index); | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
78 memaddr get_param(int index); |
308 | 79 |
506 | 80 |
308 | 81 |
82 void* global_alloc(int id, int size); | |
83 void* global_get(int id); | |
373 | 84 void global_set(int id, void *addr); |
308 | 85 void global_free(int id); |
373 | 86 MemList* createMemList(int size, int count); |
308 | 87 |
88 void mainMem_alloc(int id, int size); | |
89 void mainMem_wait(); | |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
625
diff
changeset
|
90 memaddr mainMem_get(int id); |
308 | 91 |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
92 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
|
93 uint32 get_tag(); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
94 void put_segment(MemorySegment *s); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
95 void wait_segment(MemorySegment *s); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
96 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
97 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
98 |
308 | 99 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
|
100 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
|
101 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
|
102 } |
308 | 103 |
506 | 104 /* これは禁止するべき */ |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
105 void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask); |
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
106 void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask); |
308 | 107 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
|
108 void show_dma_wait(); |
373 | 109 |
310 | 110 /*! |
111 SPU用の get_input, get_output | |
112 */ | |
308 | 113 |
310 | 114 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
|
115 return get_input(readbuf, index); |
310 | 116 } |
373 | 117 |
310 | 118 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
|
119 return get_output(writebuf, index); |
373 | 120 } |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
121 |
619 | 122 // user |
123 HTaskPtr create_task(int cmd); | |
124 void set_task_depend(HTaskPtr master, HTaskPtr slave); | |
125 void spawn_task(HTaskPtr); | |
126 void set_task_cpu(HTaskPtr, CPU_TYPE); | |
127 void* allocate(int size,int align); | |
128 Scheduler* get_scheduler(); | |
129 | |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
130 /* system call */ |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
131 |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
132 FILE *stdout_; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
133 FILE *stderr_; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
134 FILE *stdin_; |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
135 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
|
136 int printf(const char * format, ...); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
137 |
302 | 138 }; |
109 | 139 |
567 | 140 const int SCHED_TASK_NORMAL = 0; |
141 const int SCHED_TASK_RENEW = 1; | |
308 | 142 |
403
8611780d479f
clean up and add more info on task_list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
395
diff
changeset
|
143 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
|
144 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
|
145 |
302 | 146 |
147 #endif | |
308 | 148 |