61
|
1 #include <stdio.h>
|
59
|
2 #include <spu_mfcio.h>
|
|
3 #include "CellDmaManager.h"
|
|
4
|
|
5 void
|
|
6 CellDmaManager::dma_load(void *buf, unsigned int addr, int size, int mask)
|
|
7 {
|
|
8 if (buf == NULL || (void*)addr == NULL) return;
|
|
9 spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT),
|
|
10 mask, MFC_GET_CMD);
|
|
11 }
|
|
12
|
|
13 void
|
|
14 CellDmaManager::dma_store(void *buf, unsigned int addr, int size, int mask)
|
|
15 {
|
|
16 if (buf == NULL || (void*)addr == NULL) return;
|
|
17 spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT),
|
|
18 mask, MFC_PUT_CMD);
|
|
19 }
|
|
20
|
|
21 /**
|
|
22 * mask で設定した DMA 転送の完了を待つ
|
|
23 */
|
|
24 void
|
|
25 CellDmaManager::dma_wait(int mask)
|
|
26 {
|
|
27 spu_writech(MFC_WrTagMask, 1 << mask);
|
|
28 spu_mfcstat(MFC_TAG_UPDATE_ALL);
|
|
29 }
|
|
30
|
|
31 void
|
|
32 CellDmaManager::mail_write(unsigned int data)
|
|
33 {
|
|
34 spu_writech(SPU_WrOutMbox, data);
|
|
35 }
|
|
36
|
|
37 unsigned int
|
|
38 CellDmaManager::mail_read(void)
|
|
39 {
|
|
40 return spu_readch(SPU_RdInMbox);
|
|
41 }
|