Mercurial > hg > Members > kono > Cerium
changeset 440:0f3605d1ee73
fix get_segment exaple PPE task
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 25 Sep 2009 01:47:03 +0900 |
parents | 95c0457a7d31 |
children | 7bae2117f239 |
files | TaskManager/Makefile.def example/get_segment/Makefile.def example/get_segment/ppe/Hello1.cc example/get_segment/ppe/Hello1.h example/get_segment/ppe/task_init.cc |
diffstat | 5 files changed, 62 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Makefile.def Fri Sep 25 00:46:50 2009 +0900 +++ b/TaskManager/Makefile.def Fri Sep 25 01:47:03 2009 +0900 @@ -28,7 +28,7 @@ IMPL_CELL_OBJS = $(IMPL_CELL_SRCS:.cc=.o) CC = g++ -CFLAGS = -O9 -Wall `sdl-config --cflags` -g +CFLAGS = -Wall `sdl-config --cflags` -g # -O9 LIBS = -INCLUDE = -I../include/TaskManager \ No newline at end of file +INCLUDE = -I../include/TaskManager
--- a/example/get_segment/Makefile.def Fri Sep 25 00:46:50 2009 +0900 +++ b/example/get_segment/Makefile.def Fri Sep 25 01:47:03 2009 +0900 @@ -8,7 +8,7 @@ CERIUM = ../../../Cerium CC = g++ -CFLAGS = -g -Wall -O9 +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/get_segment/ppe/Hello1.cc Fri Sep 25 01:47:03 2009 +0900 @@ -0,0 +1,42 @@ +#include <stdio.h> +#include "Hello1.h" +#include "Func.h" + +/* これは必須 */ +SchedDefineTask(Hello1); + +#define PP_STORE 3 +#define SIZE (4096*sizeof(int)) + +int +Hello1::run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + int *ptr = 0; +#if 1 + ptr = (int*)smanager->allocate(SIZE); + + smanager->mainMem_alloc(0, SIZE); + + int i; + for(i=0;i<4096;i++) { + ptr[i] = i; + } +#endif + + void *next = 0; +#if 1 + smanager->mainMem_wait(); + next = (void *)smanager->mainMem_get(0); + + smanager->dma_wait(PP_STORE); + smanager->dma_store(ptr, (uint32)next, + SIZE, PP_STORE); +#endif + + + fprintf(stderr,"Hello1 sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); + fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/ppe/Hello1.h Fri Sep 25 01:47:03 2009 +0900 @@ -0,0 +1,15 @@ +#ifndef INCLUDED_TASK_HELLO +#define INCLUDED_TASK_HELLO + +#ifndef INCLUDED_SCHED_TASK +# include "SchedTask.h" +#endif + +class Hello1 : public SchedTask { +public: + SchedConstructor(Hello1); + + int run(SchedTask *smanager, void *r, void *w); +}; + +#endif
--- a/example/get_segment/ppe/task_init.cc Fri Sep 25 00:46:50 2009 +0900 +++ b/example/get_segment/ppe/task_init.cc Fri Sep 25 01:47:03 2009 +0900 @@ -3,6 +3,7 @@ /* 必ずこの位置に書いて */ SchedExternTask(Hello); +SchedExternTask(Hello1); /** * この関数は ../spe/spe-main と違って @@ -14,4 +15,5 @@ task_init(void) { SchedRegisterTask(HELLO_TASK, Hello); + SchedRegisterTask(HELLO_TASK1, Hello1); }