annotate TaskManager/Fifo/FifoTaskManagerImpl.cc @ 109:5c194c71eca8

Cerium cvs version
author gongo@gendarme.local
date Wed, 12 Nov 2008 17:39:33 +0900
parents 7492eb28b577
children 72dcf908ec52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
1 #include <stdio.h>
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
2 #include <stdlib.h>
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
3 #include <string.h>
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
4 #include "FifoTaskManagerImpl.h"
47
8266445bdac2 *** empty log message ***
gongo
parents: 42
diff changeset
5 #include "types.h"
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
6 #include "error.h"
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
7
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
8 FifoTaskManagerImpl::~FifoTaskManagerImpl(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
9 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
10 delete mailManager;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
11 delete scheduler;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
12 delete bufferManager;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
13 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
14
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
15 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
16 * MailManager は PPE スケジューラとのメール交換、
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
17 * FifoScheduler は PPE 側のスケジューラ
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
18 * BufferManager は Task、TaskList などのメモリ管理(大層なことしてないが
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
19 */
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
20 void
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
21 FifoTaskManagerImpl::init(void)
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
22 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
23 mailManager = new MailManager();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
24 mailManager->init(20);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
25
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
26 scheduler = new MainScheduler();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
27 scheduler->init();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
28 scheduler->set_mailManager(mailManager);
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 22
diff changeset
29
58
7492eb28b577 *** empty log message ***
gongo
parents: 47
diff changeset
30 bufferManager = new BufferManager;
7492eb28b577 *** empty log message ***
gongo
parents: 47
diff changeset
31 bufferManager->init();
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
32
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
33 mainTaskList = bufferManager->create_taskList();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
34 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
35
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
36 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
37 * これは CellTaskManagerImpl から呼ばれる。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
38 * BufferManager は共用で使うので引数に。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
39 * CellTaskManagerImpl と FifoTaskManagerImpl が同時に
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
40 * 上のデータにアクセスする事は(今は)ないのでこれでおk
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
41 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
42 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
43 FifoTaskManagerImpl::init(MainScheduler *_sched, BufferManager *buff)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
44 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
45 mailManager = new MailManager();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
46 mailManager->init(20);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
47
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
48 //scheduler = new MainScheduler();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
49 scheduler = _sched;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
50 scheduler->init();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
51 scheduler->set_mailManager(mailManager);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
52
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
53 bufferManager = buff;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
54
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
55 mainTaskList = bufferManager->create_taskList();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
56 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
57
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
58 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
59 * スケジューラに渡す TaskList を取得する。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
60 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
61 * @return 実行タスクリスト
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
62 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
63 * ActiveTaskQueue (依存条件は満たし済み) のタスクを
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
64 * 実行タスクリストに入れる
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
65 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
66 TaskListPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
67 FifoTaskManagerImpl::get_runTaskList(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
68 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
69 TaskListPtr list, list_top;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
70 TaskQueuePtr queue;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
71 TaskQueuePtr d;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
72 HTaskPtr htask; // HTask (PPE にある)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
73 TaskPtr task; // Task (SPE に送る Task)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
74
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
75 queue = activeTaskQueue;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
76 if (queue == NULL) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
77 return NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
78 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
79
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
80 // PPE 側で実行される TaskList
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
81 list_top = mainTaskList;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
82
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
83 // list_top->clear() とかの方がいいかもしれん。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
84 list_top = bufferManager->clear_taskList(list_top);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
85 list = list_top;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
86
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
87 while (queue) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
88 htask = (HTaskPtr)queue->task;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
89 d = queue;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
90 queue = queue->next;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
91
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
92 task = &list->tasks[list->length++];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
93
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
94 #if 0
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
95 task->command = htask->command;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
96 task->inData = htask->inData;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
97 task->outData = htask->outData;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
98 task->self = (unsigned int)htask;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
99 #else
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
100 memcpy(task, htask, sizeof(Task));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
101 #endif
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
102
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
103 if (list->length >= TASK_MAX_SIZE) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
104 TaskListPtr newList = bufferManager->create_taskList();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
105 list_top = TaskListInfo::append(list_top, newList);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
106 list = newList;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
107 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
108
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
109 bufferManager->free_taskQueue(d);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
110 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
111
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
112 activeTaskQueue = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
113 mainTaskList = list_top;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
114
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
115 return list_top;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
116 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
117
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
118
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
119 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
120 FifoTaskManagerImpl::run(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
121 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
122 TaskListPtr list;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
123 MailQueuePtr mail;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
124
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
125 list = get_runTaskList();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
126
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
127 do {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
128 // list を実行する
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
129 mail = schedule(list);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
130
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
131 // mail には、ppe scheduler からの mail がある
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
132 mail_check(mail);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
133
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
134 // 依存関係を満たしたものは実行可能キューへ
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
135 wakeup_waitTask();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
136 list = get_runTaskList();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
137 } while (list);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
138 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
139
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
140 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
141 * @param [list] 実行タスクリスト
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
142 * @return FifoScheduler からのメール
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
143 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
144 * [Tasklist] -> [番兵] -> scheduler->run を抜ける
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
145 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
146 MailQueuePtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
147 FifoTaskManagerImpl::schedule(TaskListPtr list)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
148 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
149 MailQueuePtr list_mail; // task list
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
150 MailQueuePtr sentinel; // 番兵
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
151 MailQueuePtr in_mail_list = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
152 MailQueuePtr out_mail_list = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
153
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
154 // TaskList のアドレス
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
155 list_mail = mailManager->create((unsigned int)list);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
156 in_mail_list = MailManager::append_mailQueue(in_mail_list, list_mail);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
157
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
158 // EXIT_COMMAND (番兵的な意味で)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
159 sentinel = mailManager->create(MY_SPE_COMMAND_EXIT);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
160 in_mail_list = MailManager::append_mailQueue(in_mail_list, sentinel);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
161
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
162 // scheduler は受け取ったメールを元に実行する
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
163 scheduler->send_mailList(in_mail_list);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
164 scheduler->run();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
165 out_mail_list = scheduler->recv_mailList();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
166
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
167 return out_mail_list;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
168 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
169
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
170 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
171 * PPE Scheduler からのメールをチェックする
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
172 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
173 * @param [mail_list]
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
174 * PPE 側で動く Scheduler からのメールリスト
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
175 * 終了した Task や、その他(今はまだ実装してないけど)の情報が入ってる
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
176 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
177 * @return Scheduler が次に実行する Task List
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
178 * NULL なら全てのタスクが実行終了したということ
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
179 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
180 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
181 FifoTaskManagerImpl::mail_check(MailQueuePtr mail_list)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
182 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
183 MailQueuePtr q = mail_list;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
184 MailQueuePtr d;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
185 unsigned int data;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
186
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
187 while (q) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
188 data = q->data;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
189
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
190 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
191 * MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
192 * MY_SPE_NOP: 特に意味のないコマンド
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
193 * それ以外:終了したタスク(PPEにあるのでアドレス
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
194 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
195 * MY_SPE_NOP が 0 なので、
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
196 * 下のように data > MY_SPE_NOP とかしています。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
197 * 一目でよくわからない書き方なんで、直したいところですが。。。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
198 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
199 if (data == MY_SPE_STATUS_READY) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
200 __debug_ppe("mail_check(): Task List finish\n");
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
201 } else if (data > MY_SPE_NOP) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
202 __debug_ppe("mail_check(): recv from 0x%x\n", data);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
203 check_task_finish((HTaskPtr)data);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
204 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
205
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
206 d = q;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
207 q = q->next;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
208
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
209 mailManager->free(d);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
210 }
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
211 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
212
14
41ccd4b38184 *** empty log message ***
gongo
parents: 10
diff changeset
213 void
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
214 FifoTaskManagerImpl::mail_check(MailQueuePtr mail_list, TaskQueuePtr *wait)
14
41ccd4b38184 *** empty log message ***
gongo
parents: 10
diff changeset
215 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
216 waitTaskQueue = *wait;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
217 mail_check(mail_list);
14
41ccd4b38184 *** empty log message ***
gongo
parents: 10
diff changeset
218 }
41ccd4b38184 *** empty log message ***
gongo
parents: 10
diff changeset
219
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
220 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
221 FifoTaskManagerImpl::allocate(int size)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
222 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
223 return malloc(size);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
224 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
225
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
226 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
227 * こういう使い方を
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
228 * Abstract Factory Pattern
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
229 * というらしい。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
230 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
231 #ifdef __CERIUM_FIFO__
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
232 TaskManagerImpl*
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
233 create_impl(int num)
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
234 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
235 return new FifoTaskManagerImpl();
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
236 }
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 58
diff changeset
237 #endif // __CERIUM_FIFO__