Mercurial > hg > Members > kono > Cerium
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 |
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" | |
10 #include "TaskGroup.h" | |
373 | 11 #include "MemList.h" |
518 | 12 #include "HTask.h" |
109 | 13 |
308 | 14 class SchedTask : public SchedTaskBase { |
15 public: | |
109 | 16 /* constructor */ |
308 | 17 SchedTask(); |
18 virtual ~SchedTask(); | |
88 | 19 |
109 | 20 BASE_NEW_DELETE(SchedTask); |
42 | 21 |
308 | 22 private: |
23 /* variables */ | |
24 | |
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 | 27 |
308 | 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 | 31 |
32 /** | |
33 * read データ、write 用のバッファ | |
34 * readbuf には タスク登録時に設定した入力データが入っている。 | |
35 * writebuf にデータを描き込んでおくと、 | |
36 * タスク登録時に設定した出力先に書き込む | |
37 */ | |
519 | 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 | 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 | 42 |
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 | 45 |
46 /* functions */ | |
47 | |
48 // override | |
49 void read(); | |
50 void exec(); | |
51 void write(); | |
52 SchedTaskBase* next(Scheduler *, SchedTaskBase *); | |
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 | 55 |
56 //--- System API --- | |
57 SchedTask* get_nextTask(TaskListPtr list); | |
373 | 58 |
308 | 59 |
60 public: | |
61 /* functions */ | |
62 | |
519 | 63 void spwan(HTask *task); |
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 | 68 |
69 //--- User API --- | |
70 int get_cpuid(); | |
71 | |
72 void* get_input(void *buff, int index); | |
73 void* get_output(void *buff, int index); | |
74 uint32 get_inputAddr(int index); | |
75 uint32 get_outputAddr(int index); | |
506 | 76 // 書き出しを追加する API がない... |
308 | 77 int get_inputSize(int index); |
78 int get_outputSize(int index); | |
79 int get_param(int index); | |
80 | |
518 | 81 void set_post(PostFunction func,void *read, void *write); |
506 | 82 |
519 | 83 HTaskPtr create_task(int cmd); |
308 | 84 |
85 void* global_alloc(int id, int size); | |
86 void* global_get(int id); | |
373 | 87 void global_set(int id, void *addr); |
308 | 88 void global_free(int id); |
373 | 89 MemList* createMemList(int size, int count); |
308 | 90 |
91 void mainMem_alloc(int id, int size); | |
92 void mainMem_wait(); | |
93 void* mainMem_get(int id); | |
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 | 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 | 106 |
506 | 107 /* これは禁止するべき */ |
308 | 108 void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); |
109 void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask); | |
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 | 112 |
310 | 113 /*! |
114 SPU用の get_input, get_output | |
115 */ | |
308 | 116 |
310 | 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 | 119 } |
373 | 120 |
310 | 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 | 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 | 133 }; |
109 | 134 |
308 | 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 | 139 |
140 #endif | |
308 | 141 |