Mercurial > hg > Members > kono > Cerium
view TaskManager/Cell/spe/CellDmaManager.cc @ 239:ae6aa53faf70
hey
author | admin@mcbk.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 29 May 2009 15:34:13 +0900 |
parents | 5cde66c926b4 |
children | f8182c7058b5 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "CellDmaManager.h" /** * DMA Load * * @param[in] buf Buffer of Load Data * @param[in] addr Address of Load Data at Main Memory * @param[in] size Size of Load Data * @param[in] mask DMA tag */ void CellDmaManager::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) { if (size == 0) return ; mfc_get((volatile void *)buf, addr, size, mask, 0, 0); } /** * DMA Store * * @param[in] buf Buffer of Store Data at SPE * @param[in] addr Address of Store Data at Main Memory * @param[in] size Size of Store Data * @param[in] mask DMA tag */ void CellDmaManager::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask) { if (size == 0) return ; mfc_put((volatile void *)buf, addr, size, mask, 0, 0); } /** * DMA Wait * * @param[in] mask Tag for Wait DMA process */ void CellDmaManager::start_dmawait_profile() { wait_time = readch(SPU_RdDec); global_busy_time += busy_time - wait_time; writech(SPU_WrDec, 0xffffffff); } void CellDmaManager::end_dmawait_profile() { wait_time = readch(SPU_RdDec); global_wait_time += 0xffffffff - wait_time; busy_time = wait_time; } void CellDmaManager::dma_wait(uint32 mask) { #ifdef SPU_PROFILE start_dmawait_profile(); #endif mfc_write_tag_mask(1 << mask); mfc_write_tag_update_all(); mfc_read_tag_status(); #ifdef SPU_PROFILE end_dmawait_profile(); #endif } void CellDmaManager::mail_write(uint32 data) { spu_write_out_mbox(data); } unsigned int CellDmaManager::mail_read(void) { unsigned int mail = spu_read_in_mbox(); return mail; } void CellDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) { mfc_getl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, mask, 0, 0); } void CellDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) { mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, mask, 0, 0); }