changeset 1291:1486f2d17e4a draft

can read float_array in collada file.
author Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
date Thu, 01 Dec 2011 23:55:04 +0900
parents 48a65461ed84 (current diff) b194cb2d44bb (diff)
children 3fa46ff7824e
files
diffstat 19 files changed, 332 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Fifo/MainScheduler.cc	Thu Dec 01 23:53:32 2011 +0900
+++ b/TaskManager/Fifo/MainScheduler.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -4,15 +4,18 @@
 #include "TaskManagerImpl.h"
 #include "FifoDmaManager.h"
 #include "ReferencedDmaManager.h"
+#include "PreRefDmaManager.h"
 #include "error.h"
 
 void
 MainScheduler::init_impl(int useRefDma)
 {
-	if (useRefDma == 0) {
+	if (useRefDma & 0x10) {
+		fifoDmaManager = new PreRefDmaManager();
+	} else if (useRefDma & 0x01) {
+		fifoDmaManager = new ReferencedDmaManager();
+	} else {
 		fifoDmaManager = new FifoDmaManager();
-	} else {
-		fifoDmaManager = new ReferencedDmaManager();
 	}
     connector = fifoDmaManager;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/Fifo/PreRefDmaManager.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,13 @@
+#include "PreRefDmaManager.h"
+#include "Scheduler.h"
+#include "TaskManagerImpl.h"
+
+void *
+PreRefDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
+{
+#ifdef __CERIUM_FIFO__
+	asm("prefetcht0 %0"::"m"(addr):"memory");
+#endif // __CERIUM_FIFO__
+	return (void*)addr;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/Fifo/PreRefDmaManager.h	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,13 @@
+#ifndef INCLUDED_PRE_REFERENCED_DMA_MANAGER
+#define INCLUDED_PRE_REFERENCED_DMA_MANAGER
+
+#include "ReferencedDmaManager.h"
+
+class PreRefDmaManager : public ReferencedDmaManager {
+
+public:
+	/* functions */
+    virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask);
+} ;
+
+#endif/* PRE_REFERENCED_DMA_MANAGER */
--- a/TaskManager/Fifo/ReferencedDmaManager.cc	Thu Dec 01 23:53:32 2011 +0900
+++ b/TaskManager/Fifo/ReferencedDmaManager.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -5,10 +5,6 @@
 void *
 ReferencedDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
 {
-#ifdef __CERIUM_FIFO__
-	asm("prefetcht0 %0"::"m"(addr):"memory");
-#endif // __CERIUM_FIFO__
-
 	return (void*)addr;
 }
 
--- a/TaskManager/kernel/main.cc	Thu Dec 01 23:53:32 2011 +0900
+++ b/TaskManager/kernel/main.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -48,7 +48,9 @@
         } else if (strcmp(argv[i], "-poll") == 0) {
 			poll_pattern = 1;
 		} else if (strcmp(argv[i], "-ref") == 0) {
-			useRefDma = 1;
+			useRefDma |= 0x01;
+		} else if (strcmp(argv[i], "-pre") == 0) {
+			useRefDma |= 0x10;
 		}
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Func.h	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,4 @@
+enum {
+#include "SysTasks.h"
+	NullTask,
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,24 @@
+default: macosx
+
+macosx: FORCE
+	@echo "Make for Mac OS X"
+	@$(MAKE) -f Makefile.macosx
+
+fifo64: FORCE
+	@echo "Make for Mac OS X 64bit mode"
+	@$(MAKE) -f Makefile.macosx ABIBIT=64
+
+linux: FORCE
+	@echo "Make for Linux"
+	@$(MAKE) -f Makefile.linux
+
+cell: FORCE
+	@echo "Make for PS3 (Cell)"
+	@$(MAKE) -f Makefile.cell
+
+FORCE:
+
+clean:
+	@$(MAKE) -f Makefile.macosx clean
+	@$(MAKE) -f Makefile.linux clean
+	@$(MAKE) -f Makefile.cell clean
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.cell	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,45 @@
+include ./Makefile.def
+
+ABIBIT=32
+CFLAGS += -m$(ABIBIT)  -D__CERIUM_CELL__
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lCellManager -lspe2 -lpthread -Wl,--gc-sections 
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET) speobject
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) $(CFLAGS) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+speobject:
+	cd spe; $(MAKE) ABIBIT=$(ABIBIT)
+
+run:
+	./$(TARGET) -cpu 6 
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo ppu-gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	cd spe; $(MAKE) clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.def	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,15 @@
+TARGET = null
+
+# include/library path
+# ex  macosx
+#CERIUM = /Users/gongo/Source/Cerium
+
+# ex  linux/ps3
+CERIUM = ../../../Cerium
+
+CC      = g++
+#CFLAGS  = -O9 -Wall
+CFLAGS  = -g -O0 -Wall
+
+INCLUDE = -I${CERIUM}/include/TaskManager -I. -I..
+LIBS = -L${CERIUM}/TaskManager
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.linux	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,36 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lFifoManager
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.macosx	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,36 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lFifoManager `sdl-config --libs`
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/main.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "TaskManager.h"
+#include "Func.h"
+
+extern void task_init(void);
+extern TaskManager *manager;
+
+static long task_num = 10;
+
+/* help文章 */
+const char *usr_help_str = "Usage: ./null [-cpu spe_num] [-num N]\n\
+							-cpu    Number of SPE (default 1) \n\
+							-num 	Task Num (default 10)";
+
+	int
+init(int argc, char **argv)
+{
+	for (int i = 1; argv[i]; ++i) {
+		if (strcmp(argv[i], "-num") == 0) {
+			task_num = atoi(argv[++i]);
+		}
+	}
+	return 0;
+}
+
+	void
+null_init(TaskManager *manager)
+{
+
+	// Create Task
+	for (long i = 0; i < task_num; i++) {
+		HTask *null = manager->create_task(NullTask);
+		null->set_cpu(SPE_ANY);
+		null->spawn();
+	}
+
+}
+
+	int
+TMmain(TaskManager *manager, int argc, char *argv[])
+{
+	if (init(argc, argv) < 0) {
+		return -1;
+	}
+
+	task_init();
+	null_init(manager);
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/ppe/NullTask.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <math.h>
+#include "SchedTask.h"
+#include "NullTask.h"
+#include "Func.h"
+
+SchedDefineTask1(NullTask, nullTask);
+
+	static int
+nullTask(SchedTask *smanager, void *rbuf, void *wbuf)
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/ppe/NullTask.h	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,6 @@
+#ifndef INCLUDED_TASK_NULL
+#define INCLUDED_TASK_NULL
+
+#include "SchedTask.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/ppe/task_init.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,10 @@
+#include "Func.h"
+#include "Scheduler.h"
+
+SchedExternTask(NullTask);
+
+	void
+task_init()
+{
+	SchedRegister(NullTask);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/Makefile	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,26 @@
+include ../Makefile.def
+
+TARGET = ../spe-main
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+CC      = spu-g++  -D__CERIUM_CELL__ -DABIBIT=$(ABIBIT)
+CFLAGS  = -O9 -g -Wall -fno-exceptions -fno-rtti#-DDEBUG
+INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I..
+LIBS = -L../${CERIUM}/TaskManager -lspemanager  -Wl,--gc-sections 
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+clean:
+	rm -f $(TARGET) $(OBJS)
+	rm -f *~ \#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/NullTask.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <math.h>
+#include "SchedTask.h"
+#include "NullTask.h"
+#include "Func.h"
+
+SchedDefineTask1(NullTask, nullTask);
+
+	static int
+nullTask(SchedTask *smanager, void *rbuf, void *wbuf)
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/NullTask.h	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,6 @@
+#ifndef INCLUDED_TASK_NULL
+#define INCLUDED_TASK_NULL
+
+#include "SchedTask.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/spe-main.cc	Thu Dec 01 23:55:04 2011 +0900
@@ -0,0 +1,11 @@
+#include "Func.h"
+#include "Scheduler.h"
+
+SchedExternTask(NullTask);
+
+void
+task_init(Scheduler *s)
+{
+	SchedRegister(NullTask);
+}
+