Mercurial > hg > Members > kono > Cerium
comparison TaskManager/Cell/spe/CellDmaManager.cc @ 1009:c67379f9d411
not yet....
author | yutaka@localhost.localdomain |
---|---|
date | Thu, 28 Oct 2010 13:00:51 +0900 |
parents | 18a548c337cb |
children | 44b2c4cb539d |
comparison
equal
deleted
inserted
replaced
1008:b48fffbba5fc | 1009:c67379f9d411 |
---|---|
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 | |
9 QueueInfo<MailQueue> *MailPool = new QueueInfo<MailQueue>() ; | |
8 | 10 |
9 /** | 11 /** |
10 * DMA Load | 12 * DMA Load |
11 * | 13 * |
12 * @param[in] buf Buffer of Load Data | 14 * @param[in] buf Buffer of Load Data |
86 //TASK_LIST_MAIL は仕事が最後に溜まってしまうけど、MailQueueなら出来る時にmailを書き出す | 88 //TASK_LIST_MAIL は仕事が最後に溜まってしまうけど、MailQueueなら出来る時にmailを書き出す |
87 //ので多少は効果あるといいな。 | 89 //ので多少は効果あるといいな。 |
88 void CellDmaManager::mail_write_queue(memaddr data) | 90 void CellDmaManager::mail_write_queue(memaddr data) |
89 { | 91 { |
90 (this->*start_dmawait_profile)(); | 92 (this->*start_dmawait_profile)(); |
91 if (0 == spu_readchcnt(SPU_WrOutMbox)) { | 93 if (0 != spu_readchcnt(SPU_WrOutMbox)) { |
92 if (mail_queue.empty()) { | 94 if (mail_queue->empty()) { |
93 spu_write_out_mbox((uint32)data); | 95 spu_write_out_mbox((uint32)data); |
94 } else { | 96 } else { |
95 MailQueuePtr mail = mail_queue.getFirst(); | 97 MailQueuePtr mail = mail_queue->poll(); |
98 if (mail == NULL) { | |
99 printf("あっるえぇー、おっかっしぃぞぉー\n"); | |
100 } | |
96 spu_write_out_mbox((uint32)mail->data); | 101 spu_write_out_mbox((uint32)mail->data); |
97 mail_queue.free_(mail); | 102 mail_queue->free_(mail); |
98 mail = mail_queue.create(); | 103 mail = mail_queue->create(); |
99 mail->data = data; | 104 mail->data = data; |
100 mail_queue.addLast(mail); | 105 mail_queue->addLast(mail); |
101 } | 106 } |
102 } else { | 107 } else { |
103 MailQueuePtr mail = mail_queue.create(); | 108 MailQueuePtr mail = mail_queue->create(); |
104 mail->data = data; | 109 mail->data = data; |
105 mail_queue.addLast(mail); | 110 mail_queue->addLast(mail); |
106 } | 111 } |
107 (this->*end_dmawait_profile)(&global_mail_time); | 112 (this->*end_dmawait_profile)(&global_mail_time); |
108 } | 113 } |
109 | 114 |
110 // tasklist おわりに、MailQueue 全部を書き出す | 115 // tasklist おわりに、MailQueue 全部を書き出す |
111 void CellDmaManager::mail_write_finish_list(memaddr data) | 116 void CellDmaManager::mail_write_finish_list(memaddr data) |
112 { | 117 { |
113 | 118 |
114 (this->*start_dmawait_profile)(); | 119 (this->*start_dmawait_profile)(); |
115 | 120 |
116 while (!mail_queue.empty()) { | 121 while (!mail_queue->empty()) { |
117 MailQueuePtr mail = mail_queue.getFirst(); | 122 MailQueuePtr mail = mail_queue->poll(); |
118 spu_write_out_mbox((uint32)mail->data); | 123 spu_write_out_mbox((uint32)mail->data); |
119 mail_queue.free_(mail); | 124 mail_queue->free_(mail); |
120 } | 125 } |
121 | 126 |
122 spu_write_out_mbox((uint32)data); | 127 spu_write_out_mbox((uint32)data); |
128 //mail_queue.freePool(); | |
123 | 129 |
124 (this->*end_dmawait_profile)(&global_mail_time); | 130 (this->*end_dmawait_profile)(&global_mail_time); |
125 } | 131 } |
126 | 132 |
127 memaddr CellDmaManager::mail_read() | 133 memaddr CellDmaManager::mail_read() |
150 } | 156 } |
151 | 157 |
152 | 158 |
153 CellDmaManager::CellDmaManager() | 159 CellDmaManager::CellDmaManager() |
154 { | 160 { |
161 | |
162 mail_queue = new QueueInfo<MailQueue>(MailPool); | |
163 | |
155 stop_profile(); | 164 stop_profile(); |
156 } | 165 } |
157 void | 166 void |
158 CellDmaManager::start_profile() | 167 CellDmaManager::start_profile() |
159 { | 168 { |