view TaskManager/Fifo/FifoDmaManager.cc @ 50:7927e00fb8e2

*** empty log message ***
author gongo
date Fri, 15 Feb 2008 19:36:08 +0900
parents 41ccd4b38184
children
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include "FifoDmaManager.h"

void
FifoDmaManager::dma_load(void *buf, unsigned int addr, int size, int mask)
{
    if (buf == NULL || (void*)addr == NULL) return;
    memcpy(buf, (void*)addr, size);
}

void
FifoDmaManager::dma_store(void *buf, unsigned int addr, int size, int mask)
{
    if (buf == NULL || (void*)addr == NULL) return;
    memcpy((void*)addr, buf, size);
}

/**
 * mask で設定した DMA 転送の完了を待つ
 */
void
FifoDmaManager::dma_wait(int mask)
{
    //spu_writech(MFC_WrTagMask, 1 << mask);
    //spu_mfcstat(MFC_TAG_UPDATE_ALL);
}

void
FifoDmaManager::mail_write(unsigned int data)
{
    //spu_writech(SPU_WrOutMbox, data);

    mail_sendQueue
	= MailManager::append_mailQueue(mail_sendQueue,
					mailManager->create(data));
}

unsigned int
FifoDmaManager::mail_read(void)
{
    MailQueuePtr q;
    unsigned int ret;

    q = mail_recvQueue;

    if (q == NULL) {
	return 0; // error か 正しい値か判断できないな・・・
    }

    mail_recvQueue = mail_recvQueue->next;

    ret = q->data;
    mailManager->free(q);

    return ret;
}