annotate include/TaskManager/SchedTask.h @ 143:9588726193e1 draft

add xml
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Sat, 29 Nov 2008 03:36:11 +0900
parents 028ffc9c0375
children e3b7776b1420
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
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
2 #define INCLUDED_SCHED_TASK
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
3
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
4 #ifndef INCLUDED_BASE_H_
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
5 # include "base.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
6 #endif
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
7
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
8 #ifndef INCLUDED_SCHEDULER
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
9 # include "Scheduler.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
10 #endif
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
11
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
12 #ifndef INCLUDED_SCHED_TASK_BASE
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
13 # include "SchedTaskBase.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
14 #endif
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
15
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
16 #ifndef INCLUDED_LIST_DATA
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
17 # include "ListData.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
18 #endif
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
19
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
20 #ifndef INCLUDED_TASK_GROUP
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
21 # include "TaskGroup.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
22 #endif
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
23
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
24
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
25 class SchedTask : public SchedTaskBase {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
26 public:
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
27 /* constructor */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
28 SchedTask(TaskListPtr, TaskPtr, ListDataPtr, ListDataPtr, Scheduler*);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
29 ~SchedTask(void);
88
504899860e66 *** empty log message ***
gongo
parents: 82
diff changeset
30
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
31 BASE_NEW_DELETE(SchedTask);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
32
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
33 /* variables */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
34 // 現在スケジューラが持つ TaskList と、このタスクに対応する Task
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
35 TaskListPtr __list;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
36 TaskPtr __task;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
37
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
38 // read/write 用の ListData
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
39 ListDataPtr __inListData;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
40 ListDataPtr __outListData;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
41
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
42 // read データ、write 用のバッファ
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
43 // readbuf には タスク登録時に設定した入力データが入っている。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
44 // writebuf にデータを描き込んでおくと、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
45 // タスク登録時に設定した出力先に書き込む
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
46 void *__readbuf;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
47 void *__writebuf;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
48
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
49 Scheduler *__scheduler;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
50 TaskGroup *__taskGroup;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
51
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
52 int __renew_flag; // タスクが生成されたフラグ
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
53 int __flag_renewTask;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
54
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
55 /* functions */
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
56 SchedTaskBase* next(Scheduler *, SchedTaskBase *);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
57
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
58 void __init__(void);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
59
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
60 // override
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
61 void read(void);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
62 void exec(void);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
63 void write(void);
82
14a5ca0be17e *** empty log message ***
gongo
parents: 42
diff changeset
64
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
65 // ここをユーザが継承して
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
66 // それぞれのタスクに対応した処理を記述する
82
14a5ca0be17e *** empty log message ***
gongo
parents: 42
diff changeset
67 virtual int run(void* r, void *w) { return 0; }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
68
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
69 void* get_input(void *buff, int index);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
70 void* get_output(void *buff, int index);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
71 int get_param(int index);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
72
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
73 TaskPtr create_task(int cmd);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
74 void wait_task(TaskPtr waitTask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
75
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
76 void* global_alloc(int id, int size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
77 void* global_get(int id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
78 void global_free(int id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
79
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
80 void mainMem_alloc(int id, int size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
81 void mainMem_wait(void);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
82 void* mainMem_get(int id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
83
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
84 void *allocate(int size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
85
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
86 void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
87 void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
88 void dma_wait(uint32 mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
89
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
90 class STaskManager {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
91 public:
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
92 STaskManager(SchedTask *_t) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
93 outer = _t;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
94 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
95
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
96 BASE_NEW_DELETE(STaskManager);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
97
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
98 SchedTask *outer;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
99
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
100 void* get_input(int index) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
101 return outer->get_input(outer->__readbuf, index);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
102 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
103
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
104 void* get_output(int index) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
105 return outer->get_output(outer->__writebuf, index);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
106 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
107
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
108 int get_param(int index) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
109 return outer->get_param(index);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
110 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
111
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
112 TaskPtr create_task(int cmd) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
113 return outer->create_task(cmd);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
114 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
115
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
116 void wait_task(TaskPtr waitTask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
117 outer->wait_task(waitTask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
118 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
119
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
120 void* global_alloc(int id, int size) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
121 return outer->global_alloc(id, size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
122 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
123
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
124 void* global_get(int id) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
125 return outer->global_get(id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
126 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
127
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
128 void global_free(int id) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
129 outer->global_free(id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
130 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
131
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
132 void mainMem_alloc(int id, int size) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
133 outer->mainMem_alloc(id, size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
134 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
135
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
136 void mainMem_wait(void) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
137 outer->mainMem_wait();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
138 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
139
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
140 void* mainMem_get(int id) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
141 return outer->mainMem_get(id);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
142 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
143
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
144 void *allocate(int size) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
145 return outer->allocate(size);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
146 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
147
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
148 void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
149 outer->dma_load(buf, addr, size, mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
150 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
151
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
152 void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
153 outer->dma_store(buf, addr, size, mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
154 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
155
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
156 void dma_wait(uint32 mask) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
157 outer->dma_wait(mask);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
158 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
159 };
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
160
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
161 STaskManager *smanager;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
162 };
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
163
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
164 #endif
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
165
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
166 extern SchedTask* CreateSchedTask(TaskListPtr, Scheduler *);