Mercurial > hg > Members > kono > Cerium
diff TaskManager/Cell/spe/CellDmaManager.cc @ 180:5cde66c926b4
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
author | gongo@localhost.localdomain |
---|---|
date | Mon, 22 Dec 2008 16:09:57 +0900 |
parents | 5c194c71eca8 |
children | ae6aa53faf70 |
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc Fri Dec 19 14:21:29 2008 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Mon Dec 22 16:09:57 2008 +0900 @@ -1,44 +1,60 @@ #include <stdio.h> #include <stdlib.h> -#include <malloc.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 ; - spu_mfcdma32(buf, addr, size, mask, MFC_GET_CMD); + 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 ; - spu_mfcdma32(buf, addr, size, mask, MFC_PUT_CMD); - - //spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT), + mfc_put((volatile void *)buf, addr, size, mask, 0, 0); } /** - * mask ꤷ DMA žδλԤ + * DMA Wait + * + * @param[in] mask Tag for Wait DMA process */ void CellDmaManager::dma_wait(uint32 mask) { - spu_writech(MFC_WrTagMask, 1 << mask); - spu_mfcstat(MFC_TAG_UPDATE_ALL); + mfc_write_tag_mask(1 << mask); + mfc_write_tag_update_all(); + mfc_read_tag_status(); } void CellDmaManager::mail_write(uint32 data) { - spu_writech(SPU_WrOutMbox, data); + spu_write_out_mbox(data); } unsigned int CellDmaManager::mail_read(void) { - unsigned int mail = spu_readch(SPU_RdInMbox); + unsigned int mail = spu_read_in_mbox(); return mail; } @@ -55,62 +71,3 @@ mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, mask, 0, 0); } - - -#if 0 -/** - * dma_loadList Сn - */ - -void** -CellDmaManager::dmaList_load(uint32 mask) -{ - int index = buff_index[buff_flag]; - DmaListPtr queue = dmaQueue[buff_flag]; - mfc_list_element_t *mfc_list = mfcList[buff_flag]; - - void **buffList; - void *buff; - int bound; - int total_size = 0; - - mfc_list = (mfc_list_element_t *)malloc(sizeof(mfc_list_element_t)*index); - - for (int i = 0; i < index; i++) { - mfc_list[i].notify = 0; - mfc_list[i].reserved = 0; - mfc_list[i].size = queue[i].size; - mfc_list[i].eal = queue[i].addr; - total_size += queue[i].size; - } - - //---------------------------------------------------------------- - // list element n Ĥ buff, buffList ι¤ - // - // +---------------+---------------+--------+-----------------+ - // buff | queue[0].size | queue[1].size | ...... | queue[n-1].size | - // +---------------+---------------+--------+-----------------+ - // ^ ^ ^ ^ - // | | | | - // buffList[0] buffList[1] buffList[2] buffList[n-1] - //---------------------------------------------------------------- - - buff = memalign(DEFAULT_ALIGNMENT, total_size); - buffList = (void**)malloc(index); - - bound = (int)buff; - buffList[0] = (void*)bound; - for (int i = 1; i < index; i++) { - bound += queue[i-1].size; - buffList[i] = (void*)bound; - } - - mfc_getl(buff, 0, mfc_list, sizeof(mfc_list_element_t), mask, 0, 0); - dma_wait(mask); - - _buffList[buff_flag] = buffList; - _buff[buff_flag] = buff; - - return buffList; -} -#endif