diff TaskManager/Cell/spe/CellDmaManager.cc @ 59:16f9f6251f49

*** empty log message ***
author gongo
date Sat, 16 Feb 2008 19:57:23 +0900
parents
children 6bc72fde6615
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Sat Feb 16 19:57:23 2008 +0900
@@ -0,0 +1,40 @@
+#include <spu_mfcio.h>
+#include "CellDmaManager.h"
+
+void
+CellDmaManager::dma_load(void *buf, unsigned int addr, int size, int mask)
+{
+    if (buf == NULL || (void*)addr == NULL) return;
+    spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT),
+		 mask, MFC_GET_CMD);
+}
+
+void
+CellDmaManager::dma_store(void *buf, unsigned int addr, int size, int mask)
+{
+    if (buf == NULL || (void*)addr == NULL) return;
+    spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT),
+		 mask, MFC_PUT_CMD);
+}
+
+/**
+ * mask で設定した DMA 転送の完了を待つ
+ */
+void
+CellDmaManager::dma_wait(int mask)
+{
+    spu_writech(MFC_WrTagMask, 1 << mask);
+    spu_mfcstat(MFC_TAG_UPDATE_ALL);
+}
+
+void
+CellDmaManager::mail_write(unsigned int data)
+{
+    spu_writech(SPU_WrOutMbox, data);
+}
+
+unsigned int
+CellDmaManager::mail_read(void)
+{
+    return spu_readch(SPU_RdInMbox);
+}