3
|
1 #include <stdio.h>
|
|
2 #include <string.h>
|
|
3 #include "FifoDmaManager.h"
|
|
4
|
|
5 void
|
|
6 FifoDmaManager::dma_load(void *buf, unsigned int addr, int size, int mask)
|
|
7 {
|
14
|
8 if (buf == NULL || (void*)addr == NULL) return;
|
3
|
9 memcpy(buf, (void*)addr, size);
|
|
10 }
|
|
11
|
|
12 void
|
|
13 FifoDmaManager::dma_store(void *buf, unsigned int addr, int size, int mask)
|
|
14 {
|
14
|
15 if (buf == NULL || (void*)addr == NULL) return;
|
3
|
16 memcpy((void*)addr, buf, size);
|
|
17 }
|
|
18
|
|
19 /**
|
|
20 * mask で設定した DMA 転送の完了を待つ
|
|
21 */
|
|
22 void
|
|
23 FifoDmaManager::dma_wait(int mask)
|
|
24 {
|
|
25 //spu_writech(MFC_WrTagMask, 1 << mask);
|
|
26 //spu_mfcstat(MFC_TAG_UPDATE_ALL);
|
|
27 }
|
|
28
|
|
29 void
|
|
30 FifoDmaManager::mail_write(unsigned int data)
|
|
31 {
|
|
32 //spu_writech(SPU_WrOutMbox, data);
|
|
33
|
50
|
34 mail_sendQueue
|
|
35 = MailManager::append_mailQueue(mail_sendQueue,
|
|
36 mailManager->create(data));
|
3
|
37 }
|
|
38
|
|
39 unsigned int
|
|
40 FifoDmaManager::mail_read(void)
|
|
41 {
|
|
42 MailQueuePtr q;
|
|
43 unsigned int ret;
|
|
44
|
|
45 q = mail_recvQueue;
|
|
46
|
|
47 if (q == NULL) {
|
|
48 return 0; // error か 正しい値か判断できないな・・・
|
|
49 }
|
|
50
|
|
51 mail_recvQueue = mail_recvQueue->next;
|
|
52
|
|
53 ret = q->data;
|
50
|
54 mailManager->free(q);
|
3
|
55
|
|
56 return ret;
|
|
57 }
|