Mercurial > hg > Game > Cerium
diff TaskManager/Fifo/FifoDmaManager.cc @ 1213:a49c02dffe6f draft
DMA connector reogranization
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Jul 2011 13:25:30 +0900 |
parents | c9d0683c9b39 |
children | 2fa31362ead0 |
line wrap: on
line diff
--- a/TaskManager/Fifo/FifoDmaManager.cc Fri Jul 22 08:50:04 2011 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.cc Fri Jul 22 13:25:30 2011 +0900 @@ -2,19 +2,31 @@ #include <stdlib.h> #include <string.h> #include "FifoDmaManager.h" +#include "Scheduler.h" +#include "TaskManagerImpl.h" -void -FifoDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) +void * +FifoDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask) { - if (size == 0) return; + if (size == 0) return buf; + if (s) buf = s->manager->allocate(size); memcpy(buf, (void*)addr, size); + return buf; } -void +void * +FifoDmaManager::get_writebuf(Scheduler *s,memaddr addr, uint32 size) +{ + void *b = s->manager->allocate(size); + return b; +} + +void * FifoDmaManager::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask) { - if (size == 0) return; + if (size == 0) return buf; memcpy((void*)addr, buf, size); + return buf; } /** @@ -26,12 +38,13 @@ } -void -FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) +void * +FifoDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask) { int list_size = list->length; long bound; + buff = s->manager->allocate(list->size); bound = (long)(buff); for (int i = 0; i < list_size; i++) { @@ -39,9 +52,17 @@ memcpy((void*)bound, (void*)elm->addr, elm->size); bound += elm->size; } + return buff; } +void * +FifoDmaManager::get_writebuf(Scheduler *s,ListDataPtr addr, uint32 size) +{ + void *b = s->manager->allocate(addr->size); + return b; +} + void FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) { @@ -57,4 +78,28 @@ } } +uint32 +FifoDmaManager::get_tag() +{ + static int tag = 16; + tag ++; + tag &= 0x0f; + return tag+16; +} + +/** + * DMA buffer offset in rbuf + */ +void +FifoDmaManager::bound(ListData *list) +{ + ListElement *elm = list->element; + int *bound = list->bound; + int offset=0; + for(int i=0;i<list->length;i++) { + bound[i] = offset; + offset += elm[i].size; + } +} + /* end */