Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Fifo/FifoDmaManager.cc @ 602:1733f3cbfa28
64bit mode try... not worked.
author | e075740@nw0740.st.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 06 Nov 2009 21:20:26 +0900 |
parents | f64d75473f95 |
children | 42c94f85c779 |
rev | line source |
---|---|
109 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 #include "FifoDmaManager.h" | |
5 | |
6 void | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
7 FifoDmaManager::dma_load(void *buf, long addr, uint32 size, uint32 mask) |
109 | 8 { |
9 if (size == 0) return; | |
10 memcpy(buf, (void*)addr, size); | |
11 } | |
12 | |
13 void | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
14 FifoDmaManager::dma_store(void *buf, long addr, uint32 size, uint32 mask) |
109 | 15 { |
16 if (size == 0) return; | |
17 memcpy((void*)addr, buf, size); | |
18 } | |
19 | |
20 /** | |
321 | 21 * mask で設定した DMA 転送の完了を待つ |
109 | 22 */ |
23 void | |
24 FifoDmaManager::dma_wait(uint32 mask) | |
25 { | |
26 //spu_writech(MFC_WrTagMask, 1 << mask); | |
27 //spu_mfcstat(MFC_TAG_UPDATE_ALL); | |
28 } | |
29 | |
30 void | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
31 FifoDmaManager::mail_write(long data) |
109 | 32 { |
33 mail_sendQueue | |
34 = MailManager::append_mailQueue(mail_sendQueue, | |
35 mailManager->create(data)); | |
36 } | |
37 | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
38 long |
109 | 39 FifoDmaManager::mail_read(void) |
40 { | |
41 MailQueuePtr q; | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
42 long ret; |
109 | 43 |
44 q = mail_recvQueue; | |
45 | |
46 if (q == NULL) { | |
321 | 47 return 0; // error か 正しい値か判断できないな・・・ |
109 | 48 } |
49 | |
50 mail_recvQueue = mail_recvQueue->next; | |
51 | |
52 ret = q->data; | |
53 mailManager->free(q); | |
54 | |
55 return ret; | |
56 } | |
57 | |
58 void | |
59 FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
60 { | |
61 int list_size = list->length; | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
62 long bound; |
109 | 63 |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
64 bound = (long)(buff); |
109 | 65 |
66 for (int i = 0; i < list_size; i++) { | |
67 ListElementPtr elm = &list->element[i]; | |
68 memcpy((void*)bound, (void*)elm->addr, elm->size); | |
69 bound += elm->size; | |
70 } | |
71 } | |
72 | |
73 #if 0 | |
74 void* | |
75 FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) | |
76 { | |
77 void **buffList; | |
78 int bound; | |
79 | |
80 dma_wait(mask); | |
81 | |
82 if (list->length == 1) { | |
83 return buff; | |
84 } | |
85 | |
86 bound = (int)buff; | |
87 buffList = (void**)malloc(list->length); | |
88 buffList[0] = (void*)bound; | |
89 | |
90 for (int i = 1; i < list->length; i++) { | |
91 bound += list->element[i-1].size; | |
92 buffList[i] = (void*)(bound); | |
93 } | |
94 | |
95 return (void*)buffList; | |
96 } | |
97 #endif | |
98 | |
99 void | |
100 FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) | |
101 { | |
102 int list_size = list->length; | |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
103 long bound; |
109 | 104 |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
321
diff
changeset
|
105 bound = (long)(buff); |
109 | 106 |
107 for (int i = 0; i < list_size; i++) { | |
108 ListElementPtr elm = &list->element[i]; | |
109 memcpy((void*)elm->addr, (void*)bound, elm->size); | |
110 bound += elm->size; | |
111 } | |
112 } |