Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/spe/CellDmaManager.cc @ 255:6bb8725e60ae
show dma wait
author | tkaito@localhost.localdomain |
---|---|
date | Wed, 03 Jun 2009 15:46:07 +0900 |
parents | 8382f0f8c0b4 |
children | f872cc000fe0 |
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 |
88 | 14 CellDmaManager::dma_load(void *buf, uint32 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 |
88 | 29 CellDmaManager::dma_store(void *buf, uint32 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 */ |
242 | 40 void |
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 | |
48 void | |
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 | |
88 | 81 CellDmaManager::mail_write(uint32 data) |
59 | 82 { |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
83 spu_write_out_mbox(data); |
59 | 84 } |
85 | |
86 unsigned int | |
87 CellDmaManager::mail_read(void) | |
88 { | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
89 unsigned int mail = spu_read_in_mbox(); |
109 | 90 return mail; |
91 } | |
92 | |
93 void | |
94 CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
95 { | |
96 mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, | |
97 mask, 0, 0); | |
59 | 98 } |
88 | 99 |
100 void | |
109 | 101 CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) |
88 | 102 { |
109 | 103 mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, |
104 mask, 0, 0); | |
105 } |