Mercurial > hg > Game > Cerium
changeset 59:16f9f6251f49
*** empty log message ***
author | gongo |
---|---|
date | Sat, 16 Feb 2008 19:57:23 +0900 |
parents | 7492eb28b577 |
children | f50c74835a9b |
files | TaskManager/Cell/CellDmaManager.cc TaskManager/Cell/CellScheduler.cc TaskManager/Cell/spe/CellDmaManager.cc TaskManager/Cell/spe/CellScheduler.cc TaskManager/Makefile.cell include/TaskManager/TaskListInfo.h |
diffstat | 6 files changed, 76 insertions(+), 68 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellDmaManager.cc Sat Feb 16 19:40:20 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -#include <spu_mfcio.h> -#include "CellDmaManager.h" - -void -CellDmaManager::dma_load(void *buf, unsigned int addr, int size, int mask) -{ - if (buf == NULL || (void*)addr == NULL) return; - spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT), - mask, MFC_GET_CMD); -} - -void -CellDmaManager::dma_store(void *buf, unsigned int addr, int size, int mask) -{ - if (buf == NULL || (void*)addr == NULL) return; - spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT), - mask, MFC_PUT_CMD); -} - -/** - * mask で設定した DMA 転送の完了を待つ - */ -void -CellDmaManager::dma_wait(int mask) -{ - spu_writech(MFC_WrTagMask, 1 << mask); - spu_mfcstat(MFC_TAG_UPDATE_ALL); -} - -void -CellDmaManager::mail_write(unsigned int data) -{ - spu_writech(SPU_WrOutMbox, data); -} - -unsigned int -CellDmaManager::mail_read(void) -{ - return spu_readch(SPU_RdInMbox); -}
--- a/TaskManager/Cell/CellScheduler.cc Sat Feb 16 19:40:20 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#include <malloc.h> -#include "CellScheduler.h" -#include "CellDmaManager.h" -#include "error.h" - -void -CellScheduler::init(MailManager *m) -{ - connector = new CellDmaManager; - - for (int i = 0; i < 2; i++) { - listBuf[i] = (TaskListPtr)memalign(DEFAULT_ALIGNMENT, - sizeof(TaskListPtr)); - readBuf[i] = memalign(DEFAULT_ALIGNMENT, DMA_MAX_SIZE); - writeBuf[i] = memalign(DEFAULT_ALIGNMENT, DMA_MAX_SIZE); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Sat Feb 16 19:57:23 2008 +0900 @@ -0,0 +1,40 @@ +#include <spu_mfcio.h> +#include "CellDmaManager.h" + +void +CellDmaManager::dma_load(void *buf, unsigned int addr, int size, int mask) +{ + if (buf == NULL || (void*)addr == NULL) return; + spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT), + mask, MFC_GET_CMD); +} + +void +CellDmaManager::dma_store(void *buf, unsigned int addr, int size, int mask) +{ + if (buf == NULL || (void*)addr == NULL) return; + spu_mfcdma32(buf, addr, ROUND_UP_ALIGN(size, DEFAULT_ALIGNMENT), + mask, MFC_PUT_CMD); +} + +/** + * mask で設定した DMA 転送の完了を待つ + */ +void +CellDmaManager::dma_wait(int mask) +{ + spu_writech(MFC_WrTagMask, 1 << mask); + spu_mfcstat(MFC_TAG_UPDATE_ALL); +} + +void +CellDmaManager::mail_write(unsigned int data) +{ + spu_writech(SPU_WrOutMbox, data); +} + +unsigned int +CellDmaManager::mail_read(void) +{ + return spu_readch(SPU_RdInMbox); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Cell/spe/CellScheduler.cc Sat Feb 16 19:57:23 2008 +0900 @@ -0,0 +1,17 @@ +#include <malloc.h> +#include "CellScheduler.h" +#include "CellDmaManager.h" +#include "error.h" + +void +CellScheduler::init(MailManager *m) +{ + connector = new CellDmaManager; + + for (int i = 0; i < 2; i++) { + listBuf[i] = (TaskListPtr)memalign(DEFAULT_ALIGNMENT, + sizeof(TaskListPtr)); + readBuf[i] = memalign(DEFAULT_ALIGNMENT, DMA_MAX_SIZE); + writeBuf[i] = memalign(DEFAULT_ALIGNMENT, DMA_MAX_SIZE); + } +}
--- a/TaskManager/Makefile.cell Sat Feb 16 19:40:20 2008 +0900 +++ b/TaskManager/Makefile.cell Sat Feb 16 19:57:23 2008 +0900 @@ -1,13 +1,22 @@ include ./Makefile.def -.SUFFIXES: .cpp .o +CELL_SPE_DIR = $(IMPL_CELL_DIR)/spe +CELL_SPE_SRCS = $(wildcard $(CELL_SPE_DIR)/*.cpp) +CELL_SPE_OBJS = $(CELL_SPE_SRCS:.cpp=.o) + +SPUCC = spu-g++ -.cpp.o: +all: default +default: $(TARGET) spe + +PPE_ALL_OBJS = $(KERN_PPE_OBJS) $(KERN_SCHED_OBJS) $(IMPL_CELL_OBJS) +$(TARGET): $(PPE_ALL_OBJS) + ar crus $@ $(ALL_OBJS) + +$(PPE_ALL_OBJS): %.o : %.cpp $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -all: default -default: $(TARGET) +spe: $(CELL_SPE_OBJS) -ALL_OBJS = $(KERN_PPE_OBJS) $(KERN_SCHED_OBJS) $(IMPL_CELL_OBJS) -$(TARGET): $(ALL_OBJS) - ar crus $@ $(ALL_OBJS) +$(CELL_SPE_OBJS): %.o %.cpp + $(SPUCC) $(CFLAGS) $(INCLUDE) -c $< -o $@ \ No newline at end of file
--- a/include/TaskManager/TaskListInfo.h Sat Feb 16 19:40:20 2008 +0900 +++ b/include/TaskManager/TaskListInfo.h Sat Feb 16 19:57:23 2008 +0900 @@ -20,18 +20,17 @@ TaskListPtr create(void); void free(TaskListPtr list); static TaskListPtr append(TaskListPtr list, TaskListPtr q); + virtual int extend_pool(int num); protected: - /* functions */ - virtual int extend_pool(int num); - -private: /* variables */ TaskListPtr taskListPool; TaskListPtr freeTaskList; /* functions */ void destroy(void); + +private: }; #endif