Mercurial > hg > Members > kono > Cerium
comparison TaskManager/Cell/spe/CellDmaManager.cc @ 1021:f8e9c985e2a8
use MailManager
author | yutaka@localhost.localdomain |
---|---|
date | Sun, 07 Nov 2010 22:10:29 +0900 |
parents | 80b18af207c2 |
children | 5245cf19775d |
comparison
equal
deleted
inserted
replaced
1017:6a2c22cabe10 | 1021:f8e9c985e2a8 |
---|---|
3 #include "CellDmaManager.h" | 3 #include "CellDmaManager.h" |
4 #include "Scheduler.h" | 4 #include "Scheduler.h" |
5 | 5 |
6 | 6 |
7 unsigned long long alloc_flag = 0; | 7 unsigned long long alloc_flag = 0; |
8 // singleton | |
9 QueueInfo<MailQueue> *MailPool = new QueueInfo<MailQueue>() ; | |
10 | 8 |
11 /** | 9 /** |
12 * DMA Load | 10 * DMA Load |
13 * | 11 * |
14 * @param[in] buf Buffer of Load Data | 12 * @param[in] buf Buffer of Load Data |
89 //ので多少は効果あるといいな。 | 87 //ので多少は効果あるといいな。 |
90 void CellDmaManager::mail_write_queue(memaddr data) | 88 void CellDmaManager::mail_write_queue(memaddr data) |
91 { | 89 { |
92 (this->*start_dmawait_profile)(); | 90 (this->*start_dmawait_profile)(); |
93 if (0 != spu_readchcnt(SPU_WrOutMbox)) { | 91 if (0 != spu_readchcnt(SPU_WrOutMbox)) { |
94 if (mail_queue->empty()) { | 92 //if (mail_queue->empty()) { |
93 if (mail_queue->count()) { | |
95 spu_write_out_mbox((uint32)data); | 94 spu_write_out_mbox((uint32)data); |
96 } else { | 95 } else { |
96 /* | |
97 MailQueuePtr mail = mail_queue->poll(); | 97 MailQueuePtr mail = mail_queue->poll(); |
98 spu_write_out_mbox((uint32)mail->data); | 98 spu_write_out_mbox((uint32)mail->data); |
99 mail_queue->free_(mail); | 99 mail_queue->free_(mail); |
100 mail = mail_queue->create(); | 100 mail = mail_queue->create(); |
101 mail->data = data; | 101 mail->data = data; |
102 mail_queue->addLast(mail); | 102 mail_queue->addLast(mail); |
103 */ | |
104 | |
105 //mail_queue から poll する | |
106 spu_write_out_mbox((uint32)mail_queue->recv()); | |
107 //mail_queue に加える | |
108 mail_queue->send(data); | |
109 | |
103 } | 110 } |
104 } else { | 111 } else { |
112 /* | |
105 MailQueuePtr mail = mail_queue->create(); | 113 MailQueuePtr mail = mail_queue->create(); |
106 mail->data = data; | 114 mail->data = data; |
107 mail_queue->addLast(mail); | 115 mail_queue->addLast(mail); |
116 */ | |
117 | |
118 mail_queue->send(data); | |
119 | |
108 } | 120 } |
109 (this->*end_dmawait_profile)(&global_mail_time); | 121 (this->*end_dmawait_profile)(&global_mail_time); |
110 } | 122 } |
111 | 123 |
112 // tasklist おわりに、MailQueue 全部を書き出す | 124 // tasklist おわりに、MailQueue 全部を書き出す |
113 void CellDmaManager::mail_write_finish_list(memaddr data) | 125 void CellDmaManager::mail_write_finish_list(memaddr data) |
114 { | 126 { |
115 | 127 |
116 (this->*start_dmawait_profile)(); | 128 (this->*start_dmawait_profile)(); |
117 | 129 |
118 while (!mail_queue->empty()) { | 130 //while (!mail_queue->empty()) { |
131 while (mail_queue->count()) { | |
132 /* | |
119 MailQueuePtr mail = mail_queue->poll(); | 133 MailQueuePtr mail = mail_queue->poll(); |
120 spu_write_out_mbox((uint32)mail->data); | 134 spu_write_out_mbox((uint32)mail->data); |
121 mail_queue->free_(mail); | 135 mail_queue->free_(mail); |
136 */ | |
137 | |
138 spu_write_out_mbox((uint32)mail_queue->recv()); | |
139 | |
122 } | 140 } |
123 | 141 |
124 spu_write_out_mbox((uint32)data); | 142 spu_write_out_mbox((uint32)data); |
125 //mail_queue.freePool(); | 143 //mail_queue.freePool(); |
126 | 144 |
154 | 172 |
155 | 173 |
156 CellDmaManager::CellDmaManager() | 174 CellDmaManager::CellDmaManager() |
157 { | 175 { |
158 | 176 |
159 mail_queue = new QueueInfo<MailQueue>(MailPool); | 177 mail_queue = new MailManager(); |
160 stop_profile(); | 178 stop_profile(); |
161 } | 179 } |
162 void | 180 void |
163 CellDmaManager::start_profile() | 181 CellDmaManager::start_profile() |
164 { | 182 { |