Mercurial > hg > Members > yutaka > manager
comparison spe/Dma.cc @ 0:68a98d68d62a
commit
author | yutaka@localhost.localdomain |
---|---|
date | Sun, 28 Mar 2010 19:47:00 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:68a98d68d62a |
---|---|
1 #include <stdio.h> | |
2 #include <malloc.h> | |
3 #include <spu_intrinsics.h> | |
4 #include <spu_mfcio.h> | |
5 #include "Dma.h" | |
6 | |
7 void | |
8 dma_get(void *buf, unsigned int addr, int size, int tag) | |
9 { | |
10 | |
11 //printf("dma get sie %d\n",size); | |
12 mfc_get(buf, addr, size, tag, 0, 0); | |
13 | |
14 } | |
15 | |
16 void | |
17 dma_put(void *buf, unsigned int addr, int size, int tag) | |
18 { | |
19 | |
20 mfc_put(buf, addr, size, tag, 0, 0); | |
21 | |
22 } | |
23 | |
24 int | |
25 dma_wait(int tag) | |
26 { | |
27 | |
28 int dma_wait_time; | |
29 | |
30 spu_writech(MFC_WrTagMask, 1 << tag); | |
31 | |
32 spu_write_decrementer(0xFFFFFFFF); | |
33 dma_wait_time = spu_read_decrementer(); | |
34 | |
35 spu_mfcstat(MFC_TAG_UPDATE_ALL); | |
36 | |
37 dma_wait_time = dma_wait_time - spu_read_decrementer(); | |
38 | |
39 return dma_wait_time; | |
40 | |
41 } | |
42 | |
43 int | |
44 dma_stat(int tag) | |
45 { | |
46 | |
47 spu_writech(MFC_WrTagMask, 1 << tag); | |
48 return spu_mfcstat(MFC_TAG_UPDATE_IMMEDIATE); | |
49 | |
50 } | |
51 | |
52 |