annotate TaskManager/Fifo/FifoDmaManager.cc @ 50:7927e00fb8e2

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