Mercurial > hg > Members > kono > Cerium
view TaskManager/Fifo/FifoDmaManager.cc @ 643:bffdede05f1e
minor fix.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 21 Nov 2009 10:57:37 +0900 |
parents | a909c50081c2 |
children | 5e1a477fcaec |
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 1 if (MailManager::length(mail_sendQueue)== -1) { fprintf(stderr,"Mail Queue Error %s\n",__FUNCTION__); 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; } } 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 */