Mercurial > hg > Members > kono > Cerium
annotate TaskManager/kernel/schedule/SchedTask.h @ 941:0c11c2fd7e63
add no_auto_free flag on HTask
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 31 Jul 2010 17:50:38 +0900 |
parents | f4d7cf77ec3d |
children | d093d601fc14 |
rev | line source |
---|---|
42 | 1 #ifndef INCLUDED_SCHED_TASK |
2 #define INCLUDED_SCHED_TASK | |
3 | |
308 | 4 #include "base.h" |
5 #include "Scheduler.h" | |
6 #include "SchedTaskBase.h" | |
7 #include "ListData.h" | |
619 | 8 #include "HTask.h" |
373 | 9 #include "MemList.h" |
109 | 10 |
634 | 11 |
308 | 12 class SchedTask : public SchedTaskBase { |
13 public: | |
109 | 14 /* constructor */ |
308 | 15 SchedTask(); |
16 virtual ~SchedTask(); | |
88 | 17 |
109 | 18 BASE_NEW_DELETE(SchedTask); |
42 | 19 |
308 | 20 /* variables */ |
708 | 21 |
308 | 22 /* functions */ |
23 | |
24 // override | |
25 void read(); | |
26 void exec(); | |
27 void write(); | |
28 SchedTaskBase* next(Scheduler *, SchedTaskBase *); | |
29 | |
464
01b321c86747
task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
463
diff
changeset
|
30 // タスクの処理は、task_list に登録された C の関数によっておこなう |
308 | 31 |
32 public: | |
33 /* functions */ | |
34 | |
683 | 35 void init(TaskListPtr _list, SimpleTaskPtr _task, int index, |
36 Scheduler* sc); | |
308 | 37 |
38 //--- User API --- | |
634 | 39 int read_size() { return task->r_size; } |
40 int write_size() { return task->w_size; } | |
41 void set_write_size(int w) { task->w_size = w; } | |
713
f725c6455d19
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
708
diff
changeset
|
42 |
798 | 43 void* get_input(void *buff, int index); |
44 void* get_output(void *buff, int index); | |
45 memaddr get_param(int index); | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
46 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
|
47 memaddr get_outputAddr(int index); |
506 | 48 // 書き出しを追加する API がない... |
308 | 49 int get_inputSize(int index); |
50 int get_outputSize(int index); | |
641
0692b08f1cd6
Regression on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
635
diff
changeset
|
51 |
0692b08f1cd6
Regression on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
635
diff
changeset
|
52 int get_cpuid(); |
308 | 53 |
54 void* global_alloc(int id, int size); | |
55 void* global_get(int id); | |
373 | 56 void global_set(int id, void *addr); |
308 | 57 void global_free(int id); |
373 | 58 MemList* createMemList(int size, int count); |
308 | 59 |
60 void mainMem_alloc(int id, int size); | |
61 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
|
62 memaddr mainMem_get(int id); |
308 | 63 |
387
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
64 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
|
65 uint32 get_tag(); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
66 void put_segment(MemorySegment *s); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
67 void wait_segment(MemorySegment *s); |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
68 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
69 |
5e2d30bfbf23
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
70 |
308 | 71 void *allocate(int size); |
708 | 72 void free_(void *p) ; |
941
0c11c2fd7e63
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
932
diff
changeset
|
73 void free_htask(HTask *p) ; |
308 | 74 |
832
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
806
diff
changeset
|
75 void polling(); |
29094b48d966
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
806
diff
changeset
|
76 |
506 | 77 /* これは禁止するべき */ |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
619
diff
changeset
|
78 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
|
79 void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask); |
308 | 80 void dma_wait(uint32 mask); |
674
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
81 |
334
20f2459041cb
[in test_render] push L key , call show_dma_wait, but incomplete.
e065746@localhost.localdomain
parents:
316
diff
changeset
|
82 void show_dma_wait(); |
672 | 83 void start_profile(); |
373 | 84 |
674
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
85 |
310 | 86 /*! |
87 SPU用の get_input, get_output | |
88 */ | |
89 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
|
90 return get_input(readbuf, index); |
310 | 91 } |
373 | 92 |
310 | 93 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
|
94 return get_output(writebuf, index); |
373 | 95 } |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
96 |
932
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
97 /** |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
98 * swap read / write buffer |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
99 * output が read buffer の書き換えならば、memcpy せずに |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
100 * swap するだけで良い。size は同じである必要がある。 |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
101 */ |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
102 void swap() { |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
103 void * tmp = readbuf; |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
104 readbuf = writebuf; |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
105 writebuf = tmp; |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
106 } |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
107 |
f4d7cf77ec3d
sort test (add swap())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
108 |
619 | 109 // user |
110 HTaskPtr create_task(int cmd); | |
634 | 111 HTaskPtr create_task(int cmd, memaddr r, long rs, memaddr w, long ws); |
806 | 112 HTaskPtr create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData); |
634 | 113 |
619 | 114 void set_task_depend(HTaskPtr master, HTaskPtr slave); |
115 void spawn_task(HTaskPtr); | |
116 void set_task_cpu(HTaskPtr, CPU_TYPE); | |
117 void* allocate(int size,int align); | |
118 Scheduler* get_scheduler(); | |
674
bde5f13adf10
fix many task example (sort).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
119 long get_random(); |
619 | 120 |
466
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
121 int printf(const char * format, ...); |
4fa8760e18c2
prohibit global variable in Task....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
122 |
899 | 123 } ; |
109 | 124 |
308 | 125 |
695 | 126 extern void loadSchedTask(Scheduler *scheduler,TaskPtr task); |
302 | 127 |
128 #endif | |
308 | 129 |