Mercurial > hg > Members > kono > Cerium
changeset 247:0098b5ff0d11
change example
line wrap: on
line diff
--- a/example/HelloWorld/Makefile.def Mon Jun 01 10:54:09 2009 +0900 +++ b/example/HelloWorld/Makefile.def Mon Jun 01 19:33:09 2009 +0900 @@ -5,7 +5,8 @@ #CERIUM = /Users/gongo/Source/Cerium # ex: linux/ps3 -CERIUM = /home/gongo/Cerium +#CERIUM = /home/gongo/Cerium +CERIUM = /Users/e065746/Works/lab/hg/Cerium CC = g++ CFLAGS = -g -Wall -O9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/HelloWorld/Makefile.def~ Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,14 @@ +TARGET = hello + +# include/library path +# ex: macosx +#CERIUM = /Users/gongo/Source/Cerium + +# ex: linux/ps3 +CERIUM = /home/gongo/Cerium + +CC = g++ +CFLAGS = -g -Wall -O9 + +INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. +LIBS = -L${CERIUM}/TaskManager
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/HelloWorld/ppe/#Hello.cc# Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,17 @@ +#include <stdio.h> +#include "SchedTask.h" +#include "Hello.h" +#include "Func.h" + +/* ’¤³’¤ì’¤Ï’ɬ’¿Ü */ + + +int +Hello::run(void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + + printf("[%d] Hello, World!!\n", task_id); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/HelloWorld/ppe/.#Hello.cc Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,1 @@ +e065746@nakasone-hiroki-no-macbook.local.1456 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/Func.h Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,3 @@ +enum { + BUSY_TASK, +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/Makefile Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,20 @@ +default: macosx + +macosx: FORCE + @echo "Make for Mac OS X" + @$(MAKE) -f Makefile.macosx + +linux: FORCE + @echo "Make for Linux" + @$(MAKE) -f Makefile.linux + +ps3: FORCE + @echo "Make for PS3 (Cell)" + @$(MAKE) -f Makefile.ps3 + +FORCE: + +clean: + @$(MAKE) -f Makefile.macosx clean + @$(MAKE) -f Makefile.linux clean + @$(MAKE) -f Makefile.ps3 clean \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/Makefile.def Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,14 @@ +TARGET = busy + +# include/library path +# ex: macosx +#CERIUM = /Users/gongo/Source/Cerium + +# ex: linux/ps3 +CERIUM = /Users/e065746/Works/lab/hg/hiroki/Game_Project/Cerium + +CC = g++ +CFLAGS = -g -Wall -O9 + +INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. +LIBS = -L${CERIUM}/TaskManager
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/Makefile.linux Mon Jun 01 19:33:09 2009 +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/busy_rate/Makefile.macosx Mon Jun 01 19:33:09 2009 +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/busy_rate/Makefile.ps3 Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,39 @@ +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 += -lCellManager -lspe2 -lpthread -Wl,--gc-sections + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) speobject + +$(TARGET): $(OBJS) $(TASK_OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +speobject: + cd spe; $(MAKE) + +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/busy_rate/main.cc Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "TaskManager.h" +#include "Func.h" + +extern void task_init(void); + +void +busy_init(void) +{ + HTask *busy; + + for (int i = 0; i < 6; i++) { + + busy = manager->create_task(BUSY_TASK); + busy->set_cpu(SPE_ANY); + + busy->add_param(i); + busy->spawn(); + } +} + +int +TMmain(int argc, char *argv[]) +{ + task_init(); + busy_init(); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/ppe/busy_rate.cc Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,17 @@ +#include <stdio.h> +#include "SchedTask.h" +#include "busy_rate.h" +#include "Func.h" + + +SchedDefineTask(Busy_rate); + +int +Busy_rate::run(void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + + printf("[%d] Busy World!\n", task_id); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/ppe/busy_rate.h Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,10 @@ +#ifndef INCLUDED_SCHED_TASK +# include "SchedTask.h" +#endif + +class Busy_rate : public SchedTask { +public: + SchedConstructor(Busy_rate); + + int run(void *r, void *w); +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/ppe/task_init.cc Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,10 @@ +#include "Func.h" +#include "Scheduler.h" + +SchedExternTask(Busy_rate); + +void +task_init(void) +{ + SchedRegisterTask(BUSY_TASK, Busy_rate); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/spe/Makefile Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,20 @@ +default: macosx + +macosx: FORCE + @echo "Make for Mac OS X" + @$(MAKE) -f Makefile.macosx + +linux: FORCE + @echo "Make for Linux" + @$(MAKE) -f Makefile.linux + +ps3: FORCE + @echo "Make for PS3 (Cell)" + @$(MAKE) -f Makefile.ps3 + +FORCE: + +clean: + @$(MAKE) -f Makefile.macosx clean + @$(MAKE) -f Makefile.linux clean + @$(MAKE) -f Makefile.ps3 clean \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/spe/busy_rate.cc Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,13 @@ +#include <stdio.h> +#include "busy_rate.h" +#include "Func.h" + +SchedDefineTask(Busy_rate); + +int +Busy_rate::run(void *rbuf, void *wbuf) +{ + printf("Busy World!\n"); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/busy_rate/spe/busy_rate.h Mon Jun 01 19:33:09 2009 +0900 @@ -0,0 +1,10 @@ +#ifndef INCLUDED_SCHED_TASK +# include "SchedTask.h" +#endif + +class Busy_rate : public SchedTask { +public: + SchedConstructor(Busy_rate); + + int run(void *r, void *w); +};