annotate Task.h @ 2:803d6bf22e6d default tip

second commit. it's far to complete..
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Dec 2009 16:19:56 +0900
parents 5b089096921f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #ifndef _TASK_H
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #define _TASK_H
2
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3 // ユーザ側でもこのヘッダファイルをインクルードする
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
4 #include "List.h"
0
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
2
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
6 /* used by User'sTask. */
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
7 typedef __code (*Taskrun)(void*, void*, void*);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
8 //typedef __code (*Scheduler)(TaskScheduler*,__code(*)(void*,void*,void*), void*, void*);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
9 //typedef __code (*Taskrun)(_code(*)(void*,void*,void*), void*, void*);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
10 //typedef __code (*Scheduler)(__code(*)(void*,void*,void*), void*, void*);
0
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 //typedef __code (*Scheduler)(Taskrun, void*, void*);
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 //typedef __code (*Taskrun)(Scheduler, void*, void*);
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 #define END (NULL)
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
2
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
15 /* C++CeriumでのTaskObjectにあたる */
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
16 typedef struct _TaskType {
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
17 Taskrun code;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
18 char *name;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
19 } TaskType;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
20
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
21
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
22 /* defined by user automatically. */
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
23 extern const int max_tasktype;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
24 extern const TaskType tasktypes[];
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
25
0
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 enum cpu {
2
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
27 ANY = 0, // not implemented yet.
0
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 MAIN,
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 SUB,
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 };
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
2
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
32 /* C++CeriumでのHTaskにあたるのかな */
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 typedef struct _Task {
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
34 char *name; // task name.
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
35 int typeid; // index of tasktypes array.
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
36 int id; // task identifier.
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
37
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
38 void *rbuff;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
39 void *wbuff;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 int rsize;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
41 int wsize;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
42 List *waiter; // List of tasks waiting for me :-P
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
43 List *waitee; // List of tasks keep me waiting :-(
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
44
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
45 enum cpu cpu;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
46 } Task;
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
47
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
48 /* user interfaces. */
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
49 extern Task * createTask (int, char *);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
50 extern void taskSetData (Task *, void *, int, void *, int);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
51 extern void taskSetWait (Task *, Task *);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
52
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
53 extern __code (*scheduler)(void*,Taskrun,void*,void*);
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
54
0
5b089096921f first commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 #endif /* _TASK_H */
2
803d6bf22e6d second commit.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
56