Mercurial > hg > Members > kono > Cerium
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Cell/CellDmaManager.cc Tue Feb 12 14:48:35 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); +}