Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/spe/CellDmaManager.cc @ 604:7a41d2cb0a84
fix mail box size
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Nov 2009 14:23:40 +0900 |
parents | 87462f8d3761 |
children | ab866bc8a624 |
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); |
84 if (sizeof(memaddr)>4) | |
85 spu_write_out_mbox(data>>4); | |
59 | 86 } |
87 | |
604 | 88 memaddr |
89 CellDmaManager::mail_read() | |
59 | 90 { |
604 | 91 memaddr mail = spu_read_in_mbox(); |
92 if (sizeof(memaddr)>4) | |
93 mail += (spu_read_in_mbox()<<4); | |
109 | 94 return mail; |
95 } | |
96 | |
97 void | |
98 CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
99 { | |
100 mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, | |
101 mask, 0, 0); | |
59 | 102 } |
88 | 103 |
104 void | |
109 | 105 CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) |
88 | 106 { |
109 | 107 mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, |
108 mask, 0, 0); | |
109 } | |
604 | 110 |
111 /* end */ |