Mercurial > hg > Game > Cerium
view TaskManager/Cell/spe/CellDmaManager.cc @ 249:eeb859bc39f1 draft
no move
author | e065746@localhost.localdomain |
---|---|
date | Tue, 02 Jun 2009 21:38:30 +0900 |
parents | 23e76c5369b7 |
children | 443f36ba43a8 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "CellDmaManager.h" unsigned int CellDmaManager::wait_time, CellDmaManager::busy_time; unsigned long long CellDmaManager::global_busy_time, CellDmaManager::global_wait_time; /** * 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 */ static void CellDmaManager::start_dmawait_profile() { wait_time = spu_readch(SPU_RdDec); // global 変数にする global_busy_time += busy_time - wait_time; spu_writech(SPU_WrDec, 0xffffffff); } static void CellDmaManager::end_dmawait_profile() { wait_time = spu_readch(SPU_RdDec); // global 変数にする global_wait_time += 0xffffffff - wait_time; busy_time = wait_time; } void CellDmaManager::print_wait() { } 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); }