view TaskManager/Cell/spe/CellDmaManager.cc~ @ 240:b1cfa1c19662 draft

fix
author k098586@localhost.localdomain
date Fri, 29 May 2009 15:45:09 +0900
parents 7e083e9b76b9
children
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::dma_wait(uint32 mask)
{
    mfc_write_tag_mask(1 << mask);
    mfc_write_tag_update_all();
    mfc_read_tag_status();
}

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