Mercurial > hg > Game > Cerium
annotate TaskManager/Cell/spe/CellDmaManager.cc @ 249:eeb859bc39f1 draft
no move
author | e065746@localhost.localdomain |
---|---|
date | Tue, 02 Jun 2009 21:38:30 +0900 (2009-06-02) |
parents | 23e76c5369b7 |
children | 443f36ba43a8 |
rev | line source |
---|---|
61 | 1 #include <stdio.h> |
88 | 2 #include <stdlib.h> |
59 | 3 #include "CellDmaManager.h" |
4 | |
249 | 5 unsigned int CellDmaManager::wait_time, CellDmaManager::busy_time; |
6 unsigned long long CellDmaManager::global_busy_time, CellDmaManager::global_wait_time; | |
7 | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
8 /** |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
9 * DMA Load |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
10 * |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
11 * @param[in] buf Buffer of Load Data |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
12 * @param[in] addr Address of Load Data at Main Memory |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
13 * @param[in] size Size of Load Data |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
14 * @param[in] mask DMA tag |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
15 */ |
59 | 16 void |
88 | 17 CellDmaManager::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) |
59 | 18 { |
88 | 19 if (size == 0) return ; |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
20 mfc_get((volatile void *)buf, addr, size, mask, 0, 0); |
59 | 21 } |
22 | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
23 /** |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
24 * DMA Store |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
25 * |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
26 * @param[in] buf Buffer of Store Data at SPE |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
27 * @param[in] addr Address of Store Data at Main Memory |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
28 * @param[in] size Size of Store Data |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
29 * @param[in] mask DMA tag |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
30 */ |
59 | 31 void |
88 | 32 CellDmaManager::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask) |
59 | 33 { |
88 | 34 if (size == 0) return ; |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
35 mfc_put((volatile void *)buf, addr, size, mask, 0, 0); |
59 | 36 } |
37 | |
38 /** | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
39 * DMA Wait |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
40 * |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
41 * @param[in] mask Tag for Wait DMA process |
59 | 42 */ |
249 | 43 |
44 static void | |
242 | 45 CellDmaManager::start_dmawait_profile() |
46 { | |
47 wait_time = spu_readch(SPU_RdDec); | |
249 | 48 // global 変数にする |
242 | 49 global_busy_time += busy_time - wait_time; |
50 spu_writech(SPU_WrDec, 0xffffffff); | |
51 } | |
52 | |
249 | 53 static void |
242 | 54 CellDmaManager::end_dmawait_profile() |
55 { | |
56 wait_time = spu_readch(SPU_RdDec); | |
249 | 57 // global 変数にする |
242 | 58 global_wait_time += 0xffffffff - wait_time; |
59 busy_time = wait_time; | |
60 } | |
239 | 61 |
62 void | |
249 | 63 CellDmaManager::print_wait() |
64 { | |
65 } | |
66 | |
67 void | |
88 | 68 CellDmaManager::dma_wait(uint32 mask) |
59 | 69 { |
242 | 70 #ifdef SPU_PROFILE |
71 start_dmawait_profile(); | |
72 #endif | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
73 mfc_write_tag_mask(1 << mask); |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
74 mfc_write_tag_update_all(); |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
75 mfc_read_tag_status(); |
242 | 76 #ifdef SPU_PROFILE |
77 end_dmawait_profile(); | |
78 #endif | |
59 | 79 } |
80 | |
81 void | |
88 | 82 CellDmaManager::mail_write(uint32 data) |
59 | 83 { |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
84 spu_write_out_mbox(data); |
59 | 85 } |
86 | |
87 unsigned int | |
88 CellDmaManager::mail_read(void) | |
89 { | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
90 unsigned int mail = spu_read_in_mbox(); |
109 | 91 return mail; |
92 } | |
93 | |
94 void | |
95 CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
96 { | |
97 mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, | |
98 mask, 0, 0); | |
59 | 99 } |
88 | 100 |
101 void | |
109 | 102 CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) |
88 | 103 { |
109 | 104 mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, |
105 mask, 0, 0); | |
106 } |