view TaskManager/Cell/CellDmaManager.cc @ 32:f7fd92a1d7bb

*** empty log message ***
author gongo
date Tue, 12 Feb 2008 14:48:35 +0900
parents
children
line wrap: on
line source

#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);
}