Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/spe/CellDmaManager.cc @ 647:7c9ded1ea750
MailManager rewrite. not yet worked.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 21 Nov 2009 16:18:47 +0900 |
parents | 8843edf37c0e |
children | 3b6290c05f9f |
rev | line source |
---|---|
61 | 1 #include <stdio.h> |
88 | 2 #include <stdlib.h> |
59 | 3 #include "CellDmaManager.h" |
4 | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
5 /** |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
6 * DMA Load |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
7 * |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
8 * @param[in] buf Buffer of Load Data |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
9 * @param[in] addr Address of Load Data at Main Memory |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
10 * @param[in] size Size of Load Data |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
11 * @param[in] mask DMA tag |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
12 */ |
59 | 13 void |
364 | 14 CellDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) |
59 | 15 { |
88 | 16 if (size == 0) return ; |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
17 mfc_get((volatile void *)buf, addr, size, mask, 0, 0); |
59 | 18 } |
19 | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
20 /** |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
21 * DMA Store |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
22 * |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
23 * @param[in] buf Buffer of Store Data at SPE |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
24 * @param[in] addr Address of Store Data at Main Memory |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
25 * @param[in] size Size of Store Data |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
26 * @param[in] mask DMA tag |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
27 */ |
59 | 28 void |
364 | 29 CellDmaManager::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask) |
59 | 30 { |
88 | 31 if (size == 0) return ; |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
32 mfc_put((volatile void *)buf, addr, size, mask, 0, 0); |
59 | 33 } |
34 | |
35 /** | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
36 * DMA Wait |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
37 * |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
38 * @param[in] mask Tag for Wait DMA process |
59 | 39 */ |
273 | 40 void |
242 | 41 CellDmaManager::start_dmawait_profile() |
42 { | |
43 wait_time = spu_readch(SPU_RdDec); | |
44 global_busy_time += busy_time - wait_time; | |
45 spu_writech(SPU_WrDec, 0xffffffff); | |
46 } | |
47 | |
273 | 48 void |
242 | 49 CellDmaManager::end_dmawait_profile() |
50 { | |
51 wait_time = spu_readch(SPU_RdDec); | |
52 global_wait_time += 0xffffffff - wait_time; | |
53 busy_time = wait_time; | |
54 } | |
239 | 55 |
56 void | |
255 | 57 CellDmaManager::show_dma_wait(int cpu) |
58 { | |
59 | |
60 printf("spu%d: global_wait_time = %lld\n",cpu, global_wait_time); | |
61 printf("spu%d: global_busy_time = %lld\n",cpu, global_busy_time); | |
62 printf("spu%d: busy_ratio = %g%%\n",cpu, | |
63 ((double)global_busy_time)/((double)(global_busy_time+global_wait_time))*100.0); | |
64 } | |
65 | |
66 void | |
88 | 67 CellDmaManager::dma_wait(uint32 mask) |
59 | 68 { |
242 | 69 #ifdef SPU_PROFILE |
70 start_dmawait_profile(); | |
71 #endif | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
72 mfc_write_tag_mask(1 << mask); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
73 mfc_write_tag_update_all(); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
74 mfc_read_tag_status(); |
242 | 75 #ifdef SPU_PROFILE |
76 end_dmawait_profile(); | |
77 #endif | |
59 | 78 } |
79 | |
80 void | |
604 | 81 CellDmaManager::mail_write(memaddr data) |
59 | 82 { |
604 | 83 spu_write_out_mbox((uint32)data); |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
84 if (ABIBIT>32) { |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
604
diff
changeset
|
85 unsigned long data0 = (unsigned long)data; |
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
604
diff
changeset
|
86 spu_write_out_mbox((uint32)(data0>>4)); |
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
604
diff
changeset
|
87 } |
59 | 88 } |
89 | |
604 | 90 memaddr |
91 CellDmaManager::mail_read() | |
59 | 92 { |
647
7c9ded1ea750
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
629
diff
changeset
|
93 memaddr data = (memaddr)spu_read_in_mbox(); |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
94 if (ABIBIT>32) { |
647
7c9ded1ea750
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
629
diff
changeset
|
95 data += (spu_read_in_mbox()<<4); |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
604
diff
changeset
|
96 } |
647
7c9ded1ea750
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
629
diff
changeset
|
97 return data; |
109 | 98 } |
99 | |
100 void | |
101 CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
102 { | |
103 mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, | |
104 mask, 0, 0); | |
59 | 105 } |
88 | 106 |
107 void | |
109 | 108 CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) |
88 | 109 { |
109 | 110 mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, |
111 mask, 0, 0); | |
112 } | |
604 | 113 |
114 /* end */ |