view TaskManager/Fifo/FifoDmaManager.cc @ 996:bac3b0afc3e8 draft

add sdl_test file
author yutaka@charles.cr.ie.u-ryukyu.ac.jp
date Mon, 11 Oct 2010 18:56:51 +0900
parents 7ba4ad4538b1
children c9d0683c9b39
line wrap: on
line source

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

void
FifoDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask)
{
    if (size == 0) return;
    memcpy(buf, (void*)addr, size);
}

void
FifoDmaManager::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask)
{
    if (size == 0) return;
    memcpy((void*)addr, buf, size);
}

/**
 * mask で設定した DMA 転送の完了を待つ
 */
void
FifoDmaManager::dma_wait(uint32 mask)
{
}


void
FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
{
    int list_size = list->length;
    long bound;

    bound = (long)(buff);

    for (int i = 0; i < list_size; i++) {
	ListElementPtr elm = &list->element[i];
	memcpy((void*)bound, (void*)elm->addr, elm->size);
	bound += elm->size;
    }
}


void
FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
{
    int list_size = list->length;
    memaddr bound;

    bound = (memaddr)(buff);

    for (int i = 0; i < list_size; i++) {
	ListElementPtr elm = &list->element[i];
	memcpy((void*)elm->addr, (void*)bound, elm->size);
	bound += elm->size;
    }    
}

/* end */