Mercurial > hg > Members > kono > Cerium
view TaskManager/Fifo/FifoDmaManager.cc @ 640:a909c50081c2
SimpeTask on Cell worked.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Nov 2009 23:12:34 +0900 |
parents | 60aa3f241b10 |
children | bffdede05f1e |
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::mail_write(memaddr data) { mail_sendQueue = MailManager::append_mailQueue(mail_sendQueue, mailManager->create(data)); #if 0 if (MailManager::length(mail_sendQueue)== -1) { fprintf(stderr,"Mail Queue Error\n"); exit(1); } #endif } memaddr FifoDmaManager::mail_read() { MailQueuePtr q; memaddr ret; q = mail_recvQueue; if (q == NULL) { return 0; // error か 正しい値か判断できないな・・・ } mail_recvQueue = mail_recvQueue->next; ret = q->data; mailManager->free(q); return ret; } 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; } } #if 0 void* FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) { void **buffList; int bound; dma_wait(mask); if (list->length == 1) { return buff; } bound = (int)buff; buffList = (void**)malloc(list->length); buffList[0] = (void*)bound; for (int i = 1; i < list->length; i++) { bound += list->element[i-1].size; buffList[i] = (void*)(bound); } return (void*)buffList; } #endif 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; } }