Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/spe/CellDmaManager.cc @ 239:ae6aa53faf70
hey
author | admin@mcbk.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 29 May 2009 15:34:13 +0900 |
parents | 5cde66c926b4 |
children | f8182c7058b5 |
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 */ |
40 void | |
239 | 41 CellDmaManager::start_dmawait_profile() |
42 { | |
43 wait_time = readch(SPU_RdDec); | |
44 global_busy_time += busy_time - wait_time; | |
45 writech(SPU_WrDec, 0xffffffff); | |
46 } | |
47 | |
48 void | |
49 CellDmaManager::end_dmawait_profile() | |
50 { | |
51 wait_time = readch(SPU_RdDec); | |
52 global_wait_time += 0xffffffff - wait_time; | |
53 busy_time = wait_time; | |
54 } | |
55 | |
56 void | |
88 | 57 CellDmaManager::dma_wait(uint32 mask) |
59 | 58 { |
239 | 59 #ifdef SPU_PROFILE |
60 start_dmawait_profile(); | |
61 #endif | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
62 mfc_write_tag_mask(1 << mask); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
63 mfc_write_tag_update_all(); |
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
64 mfc_read_tag_status(); |
239 | 65 #ifdef SPU_PROFILE |
66 end_dmawait_profile(); | |
67 #endif | |
59 | 68 } |
69 | |
70 void | |
88 | 71 CellDmaManager::mail_write(uint32 data) |
59 | 72 { |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
73 spu_write_out_mbox(data); |
59 | 74 } |
75 | |
76 unsigned int | |
77 CellDmaManager::mail_read(void) | |
78 { | |
180
5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
109
diff
changeset
|
79 unsigned int mail = spu_read_in_mbox(); |
109 | 80 return mail; |
81 } | |
82 | |
83 void | |
84 CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
85 { | |
86 mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, | |
87 mask, 0, 0); | |
59 | 88 } |
88 | 89 |
90 void | |
109 | 91 CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) |
88 | 92 { |
109 | 93 mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, |
94 mask, 0, 0); | |
95 } |